Drawing and positioning images
Your BlackBerry® device application can use Graphics objects to perform drawing functions and rendering operations. Use the Graphics class to draw over the entire screen or on a Field. If your application does not contain any fields, override the javax.microedition.lcdui.Canvas.paint(Graphics) method to perform the painting using the specified Graphics object.
To draw in a specific Bitmap, a BlackBerry device application obtains a graphics context by passing the Bitmap object into the Graphics constructor. To draw over a Bitmap without changing the content of the Bitmap, create a BitmapField and pass the Bitmap object into the BitmapField constructor. When drawing in a field, the field's manager passes a graphics context to the fields when the fields repaint. To perform custom drawing in a field, override the paint(Graphics g) method when you extend the Field class. The Graphics class enables you to draw shapes, such as arcs, lines, rectangles, and circles.
- Position an image
- Verify that the BlackBerry device supports a color screen
- Retrieve the number of colors that the BlackBerry device screen supports
- Configure the pixel transparency in the drawing area
- Query the raster operations that the BlackBerry device application supports
- Draw a path that is shaded and filled
- Code sample: Drawing a path that blends from blue to red on the screen of a BlackBerry device application
- Turn on or off a drawing style
- Determine if a drawing style is configured
- Code sample: Determining if the specified drawing style is turned on
- Use a monochrome bitmap image as a stamp
- Code sample: Demonstrating use of a monochrome bitmap image as a stamp
- Create a bitmap image using another bitmap image
- Create a bitmap image that contains the resized contents of another bitmap image
- Duplicate a bitmap image
- Create a bitmap image that contains some of the content of another bitmap image
- Draw an image on an empty bitmap image
- Interpolation filters