The array of bytes is used to create the picture. Each bit, representing a pixel, is examined, and the color is set to the display or fill color, depending on the bit value. There isn't a height and width restriction on OMBitmaps, but you do have to be careful about the byte array that is used for one. The OMBitmap is based on an X bitmap, not a Windows bmp file. Again, each bit of the bytes corresponds to a pixel. If the height and/or width of the bitmap isn't a multiple of 8, you have to round up the number of bytes used so that the excess bits are covered in that extra byte for the row.
So, for a 4x4 bitmap, you need:
ooooxxxx|ooooxxxx|ooooxxxx|ooooxxxx -> 1 by 4 bytes, 4 bytes totalwhere x's are the bits being used for the bitmap ( and whether they are 1 or 0 dictates either foreground or background color), and o's are the leftover bits (they are ignored). The '|' are byte boundaries.
The bits, per byte, look like they are used in reverse order because they are - least significant bit, per byte, is used in that order.
For a 6x6 bitmap:
ooxxxxxx|ooxxxxxx|ooxxxxxx|ooxxxxxx|ooxxxxxx|ooxxxxxx -> 1 x 6 bytes, 6 bytes totalfor a 10x10 bitmap:
xxxxxxxx|ooooooxx|xxxxxxxx|ooooooxx|xxxxxxxx|ooooooxx|xxxxxxxx|ooooooxx|xxxxxxxx|ooooooxx|xxxxxxxx|ooooooxx|xxxxxxxx|ooooooxx|xxxxxxxx|ooooooxx|xxxxxxxx|ooooooxx|xxxxxxxx|ooooooxx -> 2 by 10 bytes, 20 bytes totalThere is the ability to add a filter to the OMBitmap, to change it's appearance for rendering. The most common filter, which is included as a kind of default, is the scale filter. Filtering the OMRasterObject replaces the bitmap variable, which is the internal java.awt.Image used for rendering.
|
|
|
|