use of net.rim.device.api.system.Bitmap in project Samples-for-Java by blackberry.
the class BitmapFactory method getNewGameScreen.
public static Bitmap getNewGameScreen() {
int width = Display.getWidth();
int height = Display.getHeight();
UiConfig uiconfig = UiConfigFactory.getUiConfig(width, height);
Bitmap new_game = Bitmap.getBitmapResource(uiconfig.getNewGameScreenName());
return new_game;
}
use of net.rim.device.api.system.Bitmap in project Samples-for-Java by blackberry.
the class BitmapFactory method getBackground.
public static Bitmap getBackground(int width, int height) {
Bitmap bg = new Bitmap(width, height);
Graphics pen = Graphics.create(bg);
int x1 = width / 3;
int x2 = x1 * 2;
int y1 = height / 3;
int y2 = y1 * 2;
pen.setColor(Color.BLACK);
pen.drawLine(x1, 0, x1, height);
pen.drawLine(x2, 0, x2, height);
pen.drawLine(0, y1, width, y1);
pen.drawLine(0, y2, width, y2);
return bg;
}
use of net.rim.device.api.system.Bitmap in project Samples-for-Java by blackberry.
the class Banner method scaleImage.
/**
* Scale the image down if it's larger than the title bar size
*
* @param image
* the original image
* @return the scaled image
*/
private Bitmap scaleImage(Bitmap image) {
int dimension = BannerFont.getFontHeight();
if (!isDimension) {
// old theme is better with full size image.
dimension -= 2;
}
if (image.getHeight() > dimension) {
Bitmap scaled = new Bitmap(dimension, dimension);
//#ifdef BlackBerrySDK4.2.1 | BlackBerrySDK4.3.0 | BlackBerrySDK4.5.0 | BlackBerrySDK4.6.0 | BlackBerrySDK4.6.1 | BlackBerrySDK4.7.0
ImageManipulator manip = new ImageManipulator(image);
manip.scaleInto(scaled, ImageManipulator.FILTER_BILINEAR, ImageManipulator.SCALE_TO_FIT);
//#else
image.scaleInto(scaled, Bitmap.FILTER_BILINEAR, Bitmap.SCALE_TO_FIT);
//#endif
return scaled;
}
return image;
}
use of net.rim.device.api.system.Bitmap in project Samples-for-Java by blackberry.
the class ImageManipulator method transformAndPaintBitmap.
/**
* Apply the transformation, paint to a new {@link Bitmap} and return it
*
* @return The transformed {@link Bitmap} of the required size to display
* the entire transformed (rotated, scaled) image, with an alpha
* channel so that the space around the bitmap is transparent.
*/
public Bitmap transformAndPaintBitmap() {
applyTransformation();
// create the new bitmap
Bitmap transformedBitmap = new Bitmap(bitmap.getType(), transformedRegion.width, transformedRegion.height);
transformedBitmap.createAlpha(Bitmap.ALPHA_BITDEPTH_8BPP);
Graphics graphics = new Graphics(transformedBitmap);
paintTransformedBitmap(graphics);
return transformedBitmap;
}
Aggregations