LIB
Description
Load image, font, user font or user code file into the library.
Image and Fonts from an SD/SDHC Card or NAND
Image and Font files can be BMP, JPG and FNT formats. Use iDevTFT to auto convert GIF and PNG.
Since BMP and JPG format does not contain transparency information, a colour can be specified after the file name. The rotation and scaling of an image can also be specified as in the IMG command. By default, BMP images are loaded in and converted to 32-bits-per-pixel images, whereas JPG images are converted to 16-bits-per-pixel images, saving memory usage.
Syntax/Parameters
LIB(Name,Source);
Options
LIB() Image
LIB( name, "SDHC/file.ext?scale=x&width=w&height=h&back=c&col=c&rotate=r&bits=b" );
> 'scale'
number => percentage 1%, 2%, ..., 100%, ..., 120%, ... etc in 1% steps.
fit => non-proportional fit into the width and height specified (else panel size is assumed)
min => proportional fit into width and height specified (minimum fit - gaps top/bottom or left/right) (default, if not specified = 100%)
> 'col' = colour If specified, the destination area not containing the image is filled with the colour (height and/or width required).
> 'back' = colour If specified, then this is the transparent colour in the image.
> 'width' and 'height'
These are the destination sizes before any rotation is performed.
If width and height are not specified then the result transformation are used or if not possible then the screen size is used.
> 'rotate' = 0, 90, 180, 270 in degrees (default, if not specified = 0 degrees)
> 'bits' = 16, 32 Specifies the destination image pixel depth, either 16 bpp or 32 bpp. Jpegs default to 16 bpp (1555 ARGB), bitmaps to 32 bit (8888 ARGB).

Faster Loading

Fast start can be achieved by only loading the main menu images at start up then loading other images on demand and setting a flag to indicate they have been loaded.

Image and Font loaded from a Serial Link TBD
Where the image or font is sent over a serial interface use the following command structure.

User Code TBD
User code is submitted in 'C' and compiled by our firmware engineers subject to quotation and agreement. The resultant file is of type .BIN. The user code can then be used with the RUN(Name) command.

Text variable - v39.00
LIB command accepts text variable (or pointer to text variable) for file name.

Reset(library) - v42.00
Cears all entities from memory (apart from built in entities).
Users uploading their program via RS232/RS485/AS1 can then restart without system reset.

Image scaling for LIB() - v48.24
Added image scaling for LIB() command using bilinear scaling algorithm.
Rotation of 0, 90, 180, 270 degrees corrected in LIB() command.
Images correctly redrawn when page has been set up for update=changed.

Note: Progressive JPEG's are not supported - error message now provides more accurate information.
Example
LIB( libImg1, "SDHC/backimg.bmp?back=\\000007" ); // colour for tranparency RRGGBB=\\000007
LIB( libImg2, "NAND/backimg.bmp?back=\\000007&rotate=180&scale=75" );
LIB( fntAsc16x16, "SDHC/asc16B.fnt?start=\\0020" );
LIB( libImg3, "NAND/image.jpg" );
JPG Image Handling

NOTE: Use of JPEG files instead of bitmaps can significantly decrease load time (though it can take longer to convert the file once loaded). However the lossy nature of JPEG may not provide accurate transparency capability and is therefore most suitable for backgrounds.

User Code
LIB( prog1, "SDHC/ourprog.bin" );
LIB( prog2, "RS2/bin?size=36574" );

Loaded from Serial Link
LIB( libImg1, "RS2/bmp?size=2438&back=\\FFFFFF&rotate=180&scale=75" );
LIB( libImg2, "RS4/bmp?size=1076&back=\\FFFFFF" );
LIB( fntAsc1, "SPI/fnt?size=23765&start=\\0000" );