yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
yaze_graphics.h File Reference

Bitmap, palette, and tile helpers for the YAZE public API. More...

#include <stdbool.h>
#include <stdint.h>
Include dependency graph for yaze_graphics.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

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_palette * yaze_create_palette (uint16_t id, uint16_t size)
 Create an empty palette.
 
void yaze_free_palette (snes_palette *palette)
 Free palette memory.
 
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

Bitmap, palette, and tile helpers for the YAZE public API.

Definition in file yaze_graphics.h.

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

typedef struct snes_tile_info 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

◆ 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

◆ 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

◆ 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

◆ 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)

◆ 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_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