Command |
Image |
|
|
Description |
Draw or update an Image. Source has several techniques.
If an image is pre-stored in the library, it’s entity name is used for
Source.
If it is to be directly loaded from the SDHC card or NAND flash, the path is the Source.
Scaling and rotation can also be specified in the LIB command.
The system does not recognize directory structures in the SDHC card.
Please put all active files in the root. All file names are 8
characters maximum length.
LIB can be used with BMP and JPG although due to the lossy nature of
jpeg, it is used for non transparency images like backgrounds |
|
|
Syntax/Parameters |
IMG(Name,Source,Style)
IMG(Name,Source,Style,PosX,PosY); |
|
|
Style |
Image Styles
The
image may be larger than the size specified so it is necessary to define how it will be
scaled.
Support for accepting both "centre" and "center" in parameters
- v49.16.
STYLE(MyImage,Image)
{
scale=100; // The image is scaled down or up by a percentage.
//Supports 5% steps below 100 and 100% steps above 100.
maxX=160; // Not
required except for dynamic rotation where the maximum width
is declared
maxY=40;
// Not required except for dynamic rotation where the maximum height is
declared
rotate=0;
//
Specify the rotation of the shape with respect to the screen. 0,90,180,270
action =i;
// defines the way in which an image is presented on screen
step=20;
//sets the number of pixels an image moves when the action is a moving.
1-minimum of TFT screen's x or y.
opacity = n;
// n = 0..100 where 0=transparent..100=opaque (default=100)
curRel=CC;
// specify placement relative to cursor. CC Centre Centre , TC Top
Centre,
}
// BC Bottom Centre, LC Left Centre,
RC Right Centre, TL Top Left,
// BL Bottom Left, TR Top Right, BR
Bottom Right
If maxX and maxY are the same size as the loaded file or unspecified,
the library image is used rather than a copy created which saves memory
space. 24 bit images are stored as 32 bit data. 16 bit images are stored
as 16 bit and only expanded to 32 bit during page refresh so optimizing
memory usage.
|
|
|
Options |
Actions - v47.12
The way in which an image is displayed can be changed for slideshows.
STYLE(imgSt,Image){ action=type; step=pixels; }
> action type options are:
- i or instant = Instant (default);
- u or up = Move Up;
- d or down = Move Down;
- l or left = Move Left;
- r or right = Move Right;
- ur or ru or upright = Move Diagonal Up-Right
- dr or rd or downright = Move Diagonal Down-Right
- ul or lu or upleft = Move Diagonal Up-Left
- dl or ld or downleft = Move Diagonal Down-Left
- a or all = Sequence through all (except instant);
Image scaling - v48.24 and rotation - v38.00 for LIB()
Support for image scalling for LIB() command using bilinear scaling algorithm.
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).
Raw Image Files - v49.16
Support for new TFT raw image file (*.tri) format.
A converted library BMP/JPG can be stored as .tri format using FILE("SAVE") command.
Raw image files are loaded using LIB() command directly into the library entities memory, thus greatly speeding up loading.
File Format:
Offset Size Description
\\00 8 bytes Identifier (IUK_TRIF)
\\08 4 bytes size of image (N) in bytes (LSB first)
\\0C 4 bytes width of image in pixels (LSB first)
\\10 4 bytes height of image in pixels (LSB first)
\\14 1 byte number of bytes per pixel
\\15 3 bytes unused
Displaying .PNG image files - v49.42
* PNG images can now be displayed on the TFT module.
* The following formats are supported: 24-bit RGB, 48-bit RGB,
32-bit RGBA, 64-bit RGBA, 8-bit Greyscale, 8-bit Greyscale with
8-bit
Alpha
* The less common formats of interlaced images, paletted images, and
fixed-transparency are not supported.
IMG() Source Filename in a Text Var - v49.42
* IMG now supports source image filename in a text var.
eg
LOAD( varFilePath, "SDHC/dir1/", varFileName );
IMG( imN, varFilePath, stImg );
Using PAGE STYLE Update=Changed
To gain the faster refreshing, a few rules apply.
1/ Only the screen area where the changed entity is located is redrawn.
2/ The entity is redrawn on top of any existing pixels being displayed
in that area.
3/ Entities with transparent backgrounds will show all previous
rendering at that location in the transparent area.
4/ Hiding an entity will not produce any visible difference until a full
page refresh is performed.
To support the
“update=changed;” method.
1/ Do not use images with transparent backgrounds
2/ Specify the “back” colour in the style for text.
3/ To hide an entity, a “masking” image will need to be placed over the
entity.
4/ To refresh only the entities on a page that have been modified, use
the double semi-colon “;;” refresh method after the last update object,
e.g. IMG(imgt1,myimg );;.
5/ To refresh the whole page, use the SHOW( page ); method. |
|
|
Example |
IMG(MyPic,TopBtn,MyImage);
//previously stored as TopBtn using LIB command
IMG(MyPic,"sdhc/TopBtn.bmp",90,60,MyImage);
//stored on
SDHC card |
|
|
|