Command 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" );
 
Update Information

 Version

 Title

Date  

 Details

49.49

 Alpha Blending in Scaled Images

20 Dec 13 

Show

Alpha blending was only supported on images scaled to 100%. The alpha values were lost when an image was scaled to greater than or less than 100%.

An algorithm has now been added to calculate the new alpha value the image when it is scaled.

49.42

 LIB() image and IMG() rotate 90 deg pixel error

06 Sep 13 

Show

* Rotation of 90 degrees fixed - pixel misalignment was causing overflow.

49.37

 Fonts using too much memory

10 Jun 13 

Show

Resolved issue where too much memory was being allocated for some fonts. This was only applicable to a small number of fonts which had a negative offset.

49.37

 TRI File Error

10 Jun 13 

Show

Fixed problem with entity name allocation to raw image files.

49.00

 Image Copying - Fixed bug related to copying image from library causing image corruption.

22 Mar 12 

Show

Fixed bug related to copying image from library causing image corruption (introduced in V00.48.03).

48.24

 Images - Added image scaling for LIB() command using bilinear scaling algorithm.

10 Mar 12 

Show

Added image scaling for LIB() command using bilinear scaling algorithm.
Rotation of 0, 90, 180, 270 degrees corrected in LIB() command.
Images now correctly redrawn when page has been set up for update=changed.
Fixed problem with watchdog timeout when processing large JPEGs.

Note: Progressive JPEG's are not supported - error message now provides more accurate information.

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).

Variable Names
Entities can now be created with either an immediate name, a pointer to an entity name or a name from the contents of a text variable, eg.
LOAD( name, "My", "Img", 1 );
IMG( name, imgSource, imgStyle ); // Creates an image called MyImg1

47.12

 Reset(library) - Progress bar operation corrected when run from SDcard.

09 Sep 11 

Show

Progress bar operation corrected when run from SDcard.
* Fixed protection of memory used by system built in entities.

47.12

 LIB image reloading

09 Sep 11 

Show

LIB images can now be replaced without further allocation of memory being made unless new image is larger than original.

47.12

 iDEVTFT - A Media File folder has been added (.wav) in preparation for AC97 audio.

09 Sep 11 

Show

A Media File folder has been added (.wav) in preparation for AC97 audio.
The playing of .wav files under emulation is possible by using a LIB to load the file
and then LOAD(AC97,libname); to play the music via hidden media player on the PC.
Other parameters such as volume and tone will be added later.

47.04

 Restriction of Reset Library

26 Jul 11 

Show

When a RESET(LIBRARY) command is issued, all user entities are deleted back to the last serial port SETUP(). This is so that communications is not lost with the module. If entities have been defined before the setting up of a serial port, then these will not be erased! Therefore it is suggested, that during development, the serial ports are configured first in your mnu file.

44.00

 Calibration - Calibration now supported with screen rotation of 180 deg (as well as 0 deg).

20 May 11 

Show

Calibration now supported with screen rotation of 180 deg (as well as 0 deg)

42.00

 Reset(library) - Added. Clears all entities from memory (apart from built in entities).

09 Mar 11 

Show

Added. Clears all entities from memory (apart from built in entities).
Users uploading their program via RS232/RS485/AS1 can then restart without system reset

39.00

 LIB - LIB command now accepts text variable (or pointer to text variable) for file name.

21 Jan 11 

Show

LIB command now accepts text variable (or pointer to text variable) for file name.

21.00

 LIB Transparency - Specify a background transparency colour for an image.

30 Jul 10 

Show

Specify a background transparency colour for an image.
Added '?back=\\rrggbb' parameter for bitmaps using the LIB command

e.g. LIB( StartImage, "SDHC/start.bmp?back=\\76bbfe" );