libmsx
C library for MSX
Loading...
Searching...
No Matches
Tile-mapping for 8x8px 1bpp bitmap images.

Tile-mapping for 8x8px 1bpp bitmap images. More...

+ Collaboration diagram for Tile-mapping for 8x8px 1bpp bitmap images.:

Enumerations

enum  ImOp {
  IM_IDENTITY = 0 , IM_COPY = IM_IDENTITY , IM_COMPLEMENT = 1 , IM_TRANSPOSE = (1 << 5) ,
  IM_FLIP_VERT = (1 << 6) , IM_FLIP_HORZ = (1 << 7) , IM_ROTATE_90 = (IM_TRANSPOSE | IM_FLIP_HORZ) , IM_ROTATE_180 = (IM_FLIP_VERT | IM_FLIP_HORZ) ,
  IM_ROTATE_270 = (IM_TRANSPOSE | IM_FLIP_VERT) , IM_ANTITRANSPOSE = (IM_TRANSPOSE | IM_FLIP_VERT | IM_FLIP_HORZ)
}
 Enumeration of unary operators for images. More...
 

Functions

void im_tilemap_BM8x8 (const BM8x8 tileset[256], size_t n, const uint8_t tilemap[][2], BM8x8 *dst)
 MSX Construct a set of 8x8 pixels 1bpp tile images from tileset and tilemap.
 
void im_tilemap_v_BM8x8 (const BM8x8 tileset[256], size_t n, const uint8_t tilemap[][2])
 MSX Construct a set of 8x8 pixels 1bpp tile images from tileset and tilemap.
 

Detailed Description

Tile-mapping for 8x8px 1bpp bitmap images.

OPERATOR ROM/RAM to RAM ROM/RAM to VRAM
TILE MAPPING im_tilemap_BM8x8() im_tilemap_v_BM8x8()

Enumeration Type Documentation

◆ ImOp

enum ImOp

Enumeration of unary operators for images.

These can be specified as operator identifier of tilemap element.

See also
im_tilemap_BM8x8(), im_tilemap_v_BM8x8()
Enumerator
IM_IDENTITY 

Identity transformation.

Corresponds to im_copy_BM8x8(), im_copy_v_BM8x8().

IM_COPY 

Synonym for IM_IDENTITY.

IM_COMPLEMENT 

Bitwise NOT (complement).

Corresponds to im_cmpl_BM8x8(), im_cmpl_v_BM8x8().

IM_TRANSPOSE 

Transposition around the main diagonal.

Corresponds to im_tr_BM8x8(), im_tr_v_BM8x8().

IM_FLIP_VERT 

Flip vertically.

Corresponds to im_vflip_BM8x8(), im_vflip_v_BM8x8().

IM_FLIP_HORZ 

Flip horizontally.

Corresponds to im_hflip_BM8x8(), im_hflip_v_BM8x8().

IM_ROTATE_90 

Rotate 90 degrees clockwise.

Corresponds to im_rot90_BM8x8(), im_rot90_v_BM8x8().

IM_ROTATE_180 

Rotate 180 degrees.

Corresponds to im_rot180_BM8x8(), im_rot180_v_BM8x8().

IM_ROTATE_270 

Rotate 270 degrees clockwise.

Corresponds to im_rot270_BM8x8(), im_rot270_v_BM8x8().

IM_ANTITRANSPOSE 

Transposition around the antidiagonal.

Corresponds to im_adtr_BM8x8(), im_adtr_v_BM8x8().

Definition at line 751 of file im.h.

Function Documentation

◆ im_tilemap_BM8x8()

void im_tilemap_BM8x8 ( const BM8x8  tileset[256],
size_t  n,
const uint8_t  tilemap[][2],
BM8x8 dst 
)

MSX Construct a set of 8x8 pixels 1bpp tile images from tileset and tilemap.

Tile, Tileset, and Tilemap are similar to Pixel, Color palette, and Indexed color image respectively.

An indexed color image is an array/matrix of pixels. The representation of each pixel (i.e. color) is specified by its index into a color palette.

A tilemap image, on the other hand, is an array/matrix of tiles. The representation of each tile is usually specified by the tileset index (and optional attributes).

The concepts of Tile, Tileset, and Tilemap in this function are defined as follows:

  • Tile : Small fixed size image. (8x8px 1bpp image).
  • Tileset : A set of tile images. (256 8x8px 1bpp images).
  • Tilemap : An array of 2-byte cells.
    • The first byte of the cell is the index of the tileset, and
    • The second byte is the identifier of the operator applied to the tile (one of enum ImOp).

The below pseudo code shows what the function performs:

c
for (size_t i = 0; i < n; ++i) {
uint8_t idx = tilemap[i][0];
uint8_t op = tilemap[i][1];
switch (op) {
case IM_COPY: im_copy_BM8x8(&tileset[idx], &dst[i]); break;
case ...
}
}
@ IM_COPY
Synonym for IM_IDENTITY.
Definition im.h:761
void im_copy_BM8x8(const BM8x8 *src, BM8x8 *dst)
MSX Copy an 8x8 pixels 1bpp image.
Parameters
tilesetPointer to source tileset (256 sets of 8x8px 1bpp images).
nNumber of elements of the tilemap.
tilemapPointer to n element array of 2-byte cells.
  • The first byte of the cell is the index of the tileset, and
  • The second byte is the identifier of the operator applied to the tile (one of enum ImOp).
dstPointer to destination n elements array of 8x8px 1bpp images.
See also
enum ImOp
im_tilemap_v_BM8x8()

◆ im_tilemap_v_BM8x8()

void im_tilemap_v_BM8x8 ( const BM8x8  tileset[256],
size_t  n,
const uint8_t  tilemap[][2] 
)

MSX Construct a set of 8x8 pixels 1bpp tile images from tileset and tilemap.

A variant of im_tilemap_BM8x8(). (writes output to VRAM instead of RAM).

The below pseudo code shows what the function performs:

c
for (size_t i = 0; i < n; ++i) {
uint8_t idx = tilemap[i][0];
uint8_t op = tilemap[i][1];
switch (op) {
case IM_COPY: im_copy_v_BM8x8(&tileset[idx]); break;
case ...
}
}
void im_copy_v_BM8x8(const BM8x8 *src)
MSX Copy an 8x8 pixels 1bpp image.
Parameters
tilesetPointer to source tileset (256 sets of 8x8px 1bpp images).
nNumber of elements of the tilemap.
tilemapPointer to n element array of 2-byte cells.
  • The first byte of the cell is the index of the tileset, and
  • The second byte is the identifier of the operator applied to the tile (one of enum ImOp).
See also
enum ImOp
im_tilemap_BM8x8()
Note
The destination VRAM address must be set in advance with vmem_set_write_address().