Bitmap, palette, and tile helpers for the YAZE public API.
More...
#include <stdbool.h>
#include <stdint.h>
Go to the source code of this file.
|
| 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.
|
| |
Bitmap, palette, and tile helpers for the YAZE public API.
Definition in file yaze_graphics.h.
◆ 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 |
◆ yaze_load_bitmap()
Load a bitmap from file.
Loads a bitmap image from the specified file. Supports common image formats and SNES-specific formats.
- Parameters
-
| filename | Path 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()
Free bitmap data.
Releases memory allocated for bitmap pixel data.
- Parameters
-
| bitmap | Pointer 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
-
| width | Width in pixels |
| height | Height in pixels |
| bpp | Bits 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
-
| r | Red component (0-255) |
| g | Green component (0-255) |
| b | Blue 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
-
| color | SNES color to convert |
| r | Pointer to store red component (0-255) |
| g | Pointer to store green component (0-255) |
| b | Pointer 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
-
| id | Palette ID |
| size | Number of colors to allocate |
- Returns
- Initialized palette structure, or NULL on error
◆ yaze_free_palette()
Free palette memory.
- Parameters
-
| palette | Pointer to palette to free |
◆ yaze_convert_tile_bpp()
Convert tile data between different bit depths.
- Parameters
-
| tile | Source tile data |
| from_bpp | Source bits per pixel |
| to_bpp | Target bits per pixel |
- Returns
- Converted tile data