本文整理汇总了Java中net.rim.device.api.system.Bitmap.getWidth方法的典型用法代码示例。如果您正苦于以下问题:Java Bitmap.getWidth方法的具体用法?Java Bitmap.getWidth怎么用?Java Bitmap.getWidth使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.rim.device.api.system.Bitmap
的用法示例。
在下文中一共展示了Bitmap.getWidth方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: scale
import net.rim.device.api.system.Bitmap; //导入方法依赖的package包/类
/**
* @inheritDoc
*/
public Object scale(Object nativeImage, int width, int height) {
Bitmap image = (Bitmap) nativeImage;
int srcWidth = image.getWidth();
int srcHeight = image.getHeight();
// no need to scale
if (srcWidth == width && srcHeight == height) {
return image;
}
int[] currentArray = new int[srcWidth];
int[] destinationArray = new int[width * height];
scaleArray(image, srcWidth, srcHeight, height, width, currentArray, destinationArray);
return createImage(destinationArray, width, height);
}
示例2: BitmapLuminanceSource
import net.rim.device.api.system.Bitmap; //导入方法依赖的package包/类
/**
* Construct luminance source for specified Bitmap
* @param bitmap
*/
public BitmapLuminanceSource(Bitmap bitmap) {
super(bitmap.getWidth(), bitmap.getHeight());
int width = bitmap.getWidth();
int height = bitmap.getHeight();
_bitmap = bitmap;
int area = width * height;
_matrix = new byte[area];
int[] rgb = new int[area];
_bitmap.getARGB(rgb, 0, width, 0, 0, width, height);
for (int y = 0; y < height; y++) {
int offset = y * width;
for (int x = 0; x < width; x++) {
int pixel = rgb[offset + x];
int luminance = (306 * ((pixel >> 16) & 0xFF) + 601
* ((pixel >> 8) & 0xFF) + 117 * (pixel & 0xFF)) >> 10;
_matrix[offset + x] = (byte) luminance;
}
}
rgb = null;
}
示例3: AbstractBitmapField
import net.rim.device.api.system.Bitmap; //导入方法依赖的package包/类
public AbstractBitmapField(Bitmap bmp, XYDimension size, boolean scale,
boolean roundAngles) {
int newHeight = size.height, newWidth = size.width;
Bitmap newBmp;
if (bmp.getWidth() > newWidth || bmp.getHeight() > newHeight || scale) {
newBmp = GPATools.ResizeTransparentBitmap(bmp, newWidth, newHeight,
Bitmap.FILTER_LANCZOS, Bitmap.SCALE_TO_FIT);
} else {
newBmp = bmp;
}
this.height = newHeight;
this.width = newWidth;
if (roundAngles) {
RoundAngles.roundAngles(newBmp, 3);
}
this.bmp = newBmp;
}
示例4: copyBitmapSection
import net.rim.device.api.system.Bitmap; //导入方法依赖的package包/类
/**
* Creates a bitmap that is a copy of a portion of an existing bitmap.
*
* @param src the source bitmap
* @param x the x offset
* @param y the y offset
* @param width the width to copy
* @param height the height to copy
* @return a new Bitmap that is a copy of the specified portion of the specified bitmap
*/
private Bitmap copyBitmapSection(Bitmap src, int x, int y, int width, int height) {
if (x < 0 || y < 0 || x + width > src.getWidth() || y + height > src.getHeight()) {
throw new IllegalArgumentException(
"must not specify a rectangle that falls outside of the source bitmap");
}
Bitmap dst = new Bitmap(width, height);
int[] raw = new int[width * height];
src.getARGB(raw, 0, width, x, y, width, height);
dst.setARGB(raw, 0, width, 0, 0, width, height);
return dst;
}
示例5: convert
import net.rim.device.api.system.Bitmap; //导入方法依赖的package包/类
/**
* Utility to convert a RIM API Bitmap into a J2ME LCDUI Image. This assists
* in using this library within a MIDP application, where the
* drawTexturedPath method is not available.
*
* @param bitmap
* the source Bitmap
* @return the Image object based on the Bitmap data
* @since 1.2
*/
public static Image convert(Bitmap bitmap) {
int[] data = new int[bitmap.getWidth() * bitmap.getHeight()];
bitmap.getARGB(data, 0, bitmap.getWidth(), 0, 0, bitmap.getWidth(), bitmap.getHeight());
return Image.createRGBImage(data, bitmap.getWidth(), bitmap.getHeight(), true);
}