TKE_Image
Opcode
ASCII |
i |
Hexadecimal |
69 |
Decimal |
105 |
Operands
position | reference point for the image |
format | type of image data and options |
name_length | length of name string, present if Image_Is_Named bit set in format |
name | name associated with image, present if Image_Is_Named bit set in format |
width | number of pixel columns in image |
height | number of pixel rows in image |
compression | type of data compression used on image data |
data | image contents |
alpha_format | format of separate alpha |
alpha_rle_length | length of alpha data (if alpha_format is 1), otherwise assumed 1 |
alpha_data | alpha data |
size | explicit image sizing |
size_units | manner of interpretting size |
Notes
An image is inserted into the currently open segment.
Image data is arranged per-pixel, starting at the upper-left and moving right, then moving down to successive rows. The amount of data per pixel is shown in the following table. Pixels in mapped images are indices into the appropriate color map. The order of bytes in non-mapped formats is as shown.
RGBA and BGRA images with jpeg compression requested are separated into an RGB image which is compressed normally, and an alpha image which is processed separately. If the alpha value is constant, such as an image that is completely opaque, the alpha format indicator is zero, and the constant alpha value is a single Byte following. Otherwise, the format indicator is 1 to indicate RLE, and is followed by a Long to indicate the length of the rle compressed data which follows (the same as if the alpha data were a Mapped 8 image).
Format value (lower nibble of the format byte)
Format | Description | Bytes per pixel |
0 | Mapped 8 | 1 |
1 | Mapped 16 | 2 |
2 | RGB | 3 |
3 | RGBA | 4 |
4 | BGRA | 4 |
Option values (higher nibble of the format byte)
Bit | Description |
0x10 | size and size_units is specified |
0x20 | implicit texture for this image is local to the owner |
0x80 | Image_Is_Named (and an implicit texture) |
Compression formats
Compression | Description |
0 | None - Data is simply (width x height x {bytes per pixel})x Byte data |
1 | RLE (Mapped 8 format only)
- Data is
Long rle_length, [(rle_length)x Byte rle_data
where rle_data is a series of [count,run] pairs. if the count byte is positive, the run is a series of count bytes used directly. if the count byte is negative, the run is a single byte to be repeated ABS(count)+3 times. |
2 | JPEG - Data is Long jpeg_length, [(jpeg_length)x Byte jpeg_data where jpeg_datarepresents an RGB image |
99 | External reference - Data is Word ref_length, [(ref_length)x Byte reference where reference is a reference to external image data (filename, URL, etc.) |
Size units options
0 | Object space size |
1 | Screen space size |
2 | Window space size |
3 | Points |
4 | Pixels |
6 | size is a scale factor on original size |
7 | World space size |
Image size was added in 10.01.
JPEG Compression of RGBA and BGRA images via separate alpha handling was dded in 13.40.