yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
Graphics and Bitmap Functions

Classes

struct  yaze_bitmap
 Bitmap data structure. More...
 
struct  snes_color
 SNES color in 15-bit RGB format (BGR555) More...
 
struct  snes_palette
 SNES color palette. More...
 
struct  snes_tile8
 8x8 SNES tile data More...
 
struct  snes_tile_info
 
struct  snes_tile16
 
struct  snes_tile32
 

Typedefs

typedef struct yaze_bitmap yaze_bitmap
 Bitmap data structure.
 
typedef struct snes_color snes_color
 SNES color in 15-bit RGB format (BGR555)
 
typedef struct snes_palette snes_palette
 SNES color palette.
 
typedef struct snes_tile8 snes_tile8
 8x8 SNES tile data
 
typedef struct snes_tile_info snes_tile_info
 
typedef struct snes_tile16 snes_tile16
 
typedef struct snes_tile32 snes_tile32
 

Functions

yaze_bitmap yaze_load_bitmap (const char *filename)
 Load a bitmap from file.
 
void yaze_free_bitmap (yaze_bitmap *bitmap)
 Free bitmap data.
 
yaze_bitmap yaze_create_bitmap (int width, int height, uint8_t bpp)
 Create an empty bitmap.
 
snes_color yaze_rgb_to_snes_color (uint8_t r, uint8_t g, uint8_t b)
 Convert RGB888 color to SNES color.
 
void yaze_snes_color_to_rgb (snes_color color, uint8_t *r, uint8_t *g, uint8_t *b)
 Convert SNES color to RGB888.
 
snes_paletteyaze_create_palette (uint16_t id, uint16_t size)
 Create an empty palette.
 
void yaze_free_palette (snes_palette *palette)
 Free palette memory.
 
snes_paletteyaze_load_palette_from_rom (const zelda3_rom *rom, uint16_t palette_id)
 Load palette from ROM.
 
snes_tile8 yaze_load_tile_from_rom (const zelda3_rom *rom, uint32_t tile_id, uint8_t bpp)
 Load tile data from ROM.
 
snes_tile8 yaze_convert_tile_bpp (const snes_tile8 *tile, uint8_t from_bpp, uint8_t to_bpp)
 Convert tile data between different bit depths.
 

Detailed Description

Typedef Documentation

◆ yaze_bitmap

typedef struct yaze_bitmap yaze_bitmap

Bitmap data structure.

Represents a bitmap image with pixel data and metadata.

◆ snes_color

typedef struct snes_color snes_color

SNES color in 15-bit RGB format (BGR555)

Represents a color in the SNES native format. Colors are stored as 8-bit values but only the lower 5 bits are used by the SNES.

◆ snes_palette

typedef struct snes_palette snes_palette

SNES color palette.

Represents a color palette used by the SNES. Each palette contains up to 256 colors, though most modes use fewer colors per palette.

◆ snes_tile8

typedef struct snes_tile8 snes_tile8

8x8 SNES tile data

Represents an 8x8 pixel tile with indexed color data. Each pixel value is an index into a palette.

◆ snes_tile_info

◆ snes_tile16

typedef struct snes_tile16 snes_tile16

◆ snes_tile32

typedef struct snes_tile32 snes_tile32

Function Documentation

◆ yaze_load_bitmap()

yaze_bitmap yaze_load_bitmap ( const char *  filename)

Load a bitmap from file.

Loads a bitmap image from the specified file. Supports common image formats and SNES-specific formats.

Parameters
filenamePath to the image file
Returns
Bitmap structure with loaded data, or empty bitmap on error
Note
The caller is responsible for freeing the data pointer

Definition at line 172 of file yaze.cc.

References yaze_bitmap::bpp, yaze_bitmap::data, yaze_bitmap::height, and yaze_bitmap::width.

◆ yaze_free_bitmap()

void yaze_free_bitmap ( yaze_bitmap bitmap)

Free bitmap data.

Releases memory allocated for bitmap pixel data.

Parameters
bitmapPointer to bitmap structure to free

Definition at line 280 of file yaze.cc.

References yaze_bitmap::bpp, yaze_bitmap::data, yaze_bitmap::height, and yaze_bitmap::width.

◆ yaze_create_bitmap()

yaze_bitmap yaze_create_bitmap ( int  width,
int  height,
uint8_t  bpp 
)

Create an empty bitmap.

Allocates a new bitmap with the specified dimensions.

Parameters
widthWidth in pixels
heightHeight in pixels
bppBits per pixel
Returns
Initialized bitmap structure, or empty bitmap on error

Definition at line 290 of file yaze.cc.

References yaze_bitmap::bpp, yaze_bitmap::data, yaze_bitmap::height, and yaze_bitmap::width.

◆ yaze_rgb_to_snes_color()

snes_color yaze_rgb_to_snes_color ( uint8_t  r,
uint8_t  g,
uint8_t  b 
)

Convert RGB888 color to SNES color.

Parameters
rRed component (0-255)
gGreen component (0-255)
bBlue component (0-255)
Returns
SNES color structure

Definition at line 306 of file yaze.cc.

References snes_color::blue, snes_color::green, and snes_color::red.

◆ yaze_snes_color_to_rgb()

void yaze_snes_color_to_rgb ( snes_color  color,
uint8_t *  r,
uint8_t *  g,
uint8_t *  b 
)

Convert SNES color to RGB888.

Parameters
colorSNES color to convert
rPointer to store red component (0-255)
gPointer to store green component (0-255)
bPointer to store blue component (0-255)

Definition at line 314 of file yaze.cc.

References snes_color::blue, snes_color::green, and snes_color::red.

◆ yaze_create_palette()

snes_palette * yaze_create_palette ( uint16_t  id,
uint16_t  size 
)

Create an empty palette.

Parameters
idPalette ID
sizeNumber of colors to allocate
Returns
Initialized palette structure, or NULL on error

◆ yaze_free_palette()

void yaze_free_palette ( snes_palette palette)

Free palette memory.

Parameters
palettePointer to palette to free

◆ yaze_load_palette_from_rom()

snes_palette * yaze_load_palette_from_rom ( const zelda3_rom rom,
uint16_t  palette_id 
)

Load palette from ROM.

Parameters
romROM to load palette from
palette_idID of palette to load
Returns
Loaded palette, or NULL on error

◆ yaze_load_tile_from_rom()

snes_tile8 yaze_load_tile_from_rom ( const zelda3_rom rom,
uint32_t  tile_id,
uint8_t  bpp 
)

Load tile data from ROM.

Parameters
romROM to load from
tile_idID of tile to load
bppBits per pixel (1, 2, 4, 8)
Returns
Loaded tile data, or empty tile on error

◆ yaze_convert_tile_bpp()

snes_tile8 yaze_convert_tile_bpp ( const snes_tile8 tile,
uint8_t  from_bpp,
uint8_t  to_bpp 
)

Convert tile data between different bit depths.

Parameters
tileSource tile data
from_bppSource bits per pixel
to_bppTarget bits per pixel
Returns
Converted tile data