404
Platforms
©2000-2008 Tibbo Technology Inc.
simple calculation:
bitmap_offset + (desired_code - start_code)*4: 000 (0043H-0041H)
*4= 00000050H.
Next, we read a 32-bit value at file offset 00000050H. This will tell us the file
offset at which the target bitmap is stored.
At this file offset, the first byte will be the width of the bitmap in pixels. Based on
this width and also height, pixels_per_byte and orientation fields of the header
we can calculate the number of bytes in the bitmap. For example, supposing that
height = 14, pixels_per_byte = 0 (8 pixels/byte), and orientation = 0 (pixels
are grouped vertically). Also, let's suppose that the width of the target character is
10 pixels. In this case the bitmap will occupy 20 bytes, as shown on the drawing B
above. Two bits of each byte in the second byte row will be unused.
Displaying Images
outputs a full image, or a portion of the image from a BMP file.
Naturally, this file must be present in your project (see how to
a file). Here
is a simple example of how to display an image:
romfile.open("mad_happiness.bmp")
lcd.bmp(romfile.offset,0,0,0,0,65535,65535)
'see how we set maxwidth and
maxheight to 65535 (max value). This way we specify that the entire image
should be displayed (if only it can fit on the screen)
One powerful feature of the lcd.bmp method is that you can selectively display a
portion of the image stored in a BMP file. This opens up two interesting
possibilities. First, you can scroll around a large file image by specifying which part
you want to see. Second, you can combine several images into one large file and
display required portions when needed. For example, if your project requires
several icons you can put them all into a single "strip". This improves performance
because you don't have to open a separate file to display each icon:
415
128