.Bmp Method

Top  Previous  Next

Function:

Displays a portion of or full image stored in a BMP file.

Syntax:

lcd.bmp(offset as dword, x as word, y as word, x_offset as word, y_offset as word, maxwidth as word, maxheight as word) as ok_ng

Returns:

0- OK: Processed successfully.

1- NG: Unsupported or invalid file format.

See Also:

Displaying Images

 


Part

Description

offset

Offset within the compiled binary of your application at which the BMP file is stored.

x

X coordinate of the top-left point of the image position on the screen. Value range is 0 to lcd.width-1.

y

Y coordinate of the top-left point of the image position on the screen. Value range is 0 to lcd.height-1.

x_offset

Horizontal offset within the BMP file marking the top-left corner of the image portion to be displayed.

y_offset

Vertical offset within the BMP file marking the top-left corner of the image portion to be displayed.

maxwidth

Maximum width of the image portion to be displayed. Actual width of the output will be defined by the total width of the image and specified x_offset.

maxheight

Maximum height of the image portion to be displayed. Actual height of the output will be defined by the total height of the image and specified y_offset.

Details

To obtain the offset, open the BMP file with romfile.open, then read the offset of this file from the romfile.offset R/O property. Naturally, the BMP file must be present in your project for this to work (see how to add a file).

Note that only 2-, 16-, and 256-color modes are currently supported and the lcd.bmp will return 1- NG if you try to display any other type of BMP file. Compressed BMP files will be rejected too.

The method takes into account the type of the currently selected controller/panel (selection is made through the Customize Platform dialog, accessible through the Project Settings dialog). It will check the values of lcd.paneltype, lcd.bitsperpixel, lcd.redbits, lcd.greenbits, and lcd.bluebits and produce the best output possible for the selected display.

X_offset, y_offset, maxwidth, and maxheight arguments allow you to display only a portion of the BMP image. This way it is possible to scroll around a large image that does not fit on the screen. Another use is to combine several separate images into a single file and display selected portions. This improves efficiency because romfile.open needs only be done once.