mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-20 10:12:06 +00:00
Document output formats
This commit is contained in:
38
man/rgbgfx.1
38
man/rgbgfx.1
@@ -435,15 +435,37 @@ chunk.
|
|||||||
Since few image editors (such as GIMP) expose that detail, this behavior is only kept for compatibility and should be considered deprecated.
|
Since few image editors (such as GIMP) expose that detail, this behavior is only kept for compatibility and should be considered deprecated.
|
||||||
.Sh OUTPUT FILES
|
.Sh OUTPUT FILES
|
||||||
.Ss Tile data
|
.Ss Tile data
|
||||||
TODO.
|
Tile data is output like a binary dump of VRAM, following the Game Boy's native format.
|
||||||
|
Each tile is 16 bytes, 2 per row of 8 pixels; the first byte
|
||||||
|
.Pq or Dq bitplane
|
||||||
|
contains the least significant bit of the color ID of each pixel, the second one the most significant bit.
|
||||||
|
The most significant bits of each byte are for the leftmost pixel of its row, and so on, with the least significant bits describing the rightmost pixel.
|
||||||
|
.Pp
|
||||||
|
When the bit depth
|
||||||
|
.Pq Fl d
|
||||||
|
is set to 1, every other byte (being all zeros) is simply not output.
|
||||||
.Ss Palette data
|
.Ss Palette data
|
||||||
Palette data is output like a dump of GBC palette memory: the output is a binary file.
|
Palette data is output like a dump of GBC palette memory: the output is a binary file.
|
||||||
Each color is written as GBC-native little-endian RGB555 (that is, the first byte contains the red and the lower 3 bits of green).
|
Each color is written as GBC-native little-endian RGB555 (that is, the first byte contains the red and the lower 3 bits of green, and the second byte the upper 2 bits of green and the 5 bits of blue, plus an unused bit set to 0).
|
||||||
There is no padding between colors, nor between palettes; however, empty colors in the palettes are TODO.
|
There is no padding between colors, nor between palettes; however, empty colors in the palettes are TODO.
|
||||||
.Ss Tilemap data
|
.Ss Tile map data
|
||||||
TODO.
|
Tile maps are output as binary files.
|
||||||
.Ss Attrmap data
|
A tile map is an array of tile IDs, with one byte per tile ID.
|
||||||
TODO.
|
The first byte always corresponds to the ID of the tile in top-left corner of the input image; the second byte is either the ID of the tile to its right (by default), or below it
|
||||||
|
.Pq with Fl Z ;
|
||||||
|
and so on.
|
||||||
|
Rows / columns (respectively) are stored consecutively, with no padding.
|
||||||
|
.Ss Attribute map data
|
||||||
|
Attribute maps mirror the format of tile maps, like on the GBC, especially the order in which bytes are output.
|
||||||
|
The contents of individual bytes follows the GBC's native format:
|
||||||
|
.Bl -column "Bit 2\(en0" "Background Palette number"
|
||||||
|
.It Bit 7 Ta BG-to-OAM Priority Ta Set to 0
|
||||||
|
.It Bit 6 Ta Vertical Flip Ta 0=Normal, 1=Mirror vertically
|
||||||
|
.It Bit 5 Ta Horizontal Flip Ta 0=Normal, 1=Mirror horizontally
|
||||||
|
.It Bit 4 Ta Not used Ta Set to 0
|
||||||
|
.It Bit 3 Ta Tile VRAM Bank number Ta 0=Bank 0, 1=Bank 1
|
||||||
|
.It Bit 2\(en0 Ta Background Palette number Ta BGP0-7
|
||||||
|
.El
|
||||||
.Sh REVERSE MODE
|
.Sh REVERSE MODE
|
||||||
.Nm
|
.Nm
|
||||||
can produce a PNG image from valid data.
|
can produce a PNG image from valid data.
|
||||||
@@ -527,6 +549,10 @@ Please report bugs on
|
|||||||
.Xr rgblink 1 ,
|
.Xr rgblink 1 ,
|
||||||
.Xr rgbfix 1 ,
|
.Xr rgbfix 1 ,
|
||||||
.Xr gbz80 7
|
.Xr gbz80 7
|
||||||
|
.Pp
|
||||||
|
The Game Boy hardware reference
|
||||||
|
.Lk https://gbdev.io/pandocs/Rendering.html Pan Docs ,
|
||||||
|
particularly the section about graphics.
|
||||||
.Sh HISTORY
|
.Sh HISTORY
|
||||||
.Nm
|
.Nm
|
||||||
was originally created by
|
was originally created by
|
||||||
|
|||||||
@@ -130,10 +130,10 @@ static struct option const longopts[] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
static void printUsage(void) {
|
static void printUsage(void) {
|
||||||
fputs("Usage: rgbgfx [-r] [-CmuVZ] [-v [-v ...]] [-a <attr_map> | -A] [-b base_ids]\n"
|
fputs("Usage: rgbgfx [-r stride] [-CmuVZ] [-v [-v ...]] [-a <attr_map> | -A]\n"
|
||||||
" [-c color_spec] [-d <depth>] [-L slice] [-N nb_tiles] [-n nb_pals]\n"
|
" [-b base_ids] [-c color_spec] [-d <depth>] [-L slice] [-N nb_tiles]\n"
|
||||||
" [-o <out_file>] [-p <pal_file> | -P] [-s nb_colors] [-t <tile_map> | -T]\n"
|
" [-n nb_pals] [-o <out_file>] [-p <pal_file> | -P] [-s nb_colors]\n"
|
||||||
" [-U unit_size] [-x <tiles>] <file>\n"
|
" [-t <tile_map> | -T] [-U unit_size] [-x <tiles>] <file>\n"
|
||||||
"Useful options:\n"
|
"Useful options:\n"
|
||||||
" -m, --mirror-tiles optimize out mirrored tiles\n"
|
" -m, --mirror-tiles optimize out mirrored tiles\n"
|
||||||
" -o, --output <path> set the output binary file\n"
|
" -o, --output <path> set the output binary file\n"
|
||||||
|
|||||||
Reference in New Issue
Block a user