Banjo API 0.0.1
Multi-purpose C99 API
|
Header file for general pixel manipulation facilities.
#include <banjo/api.h>
Go to the source code of this file.
Macros | |
#define | BJ_PIXEL_TYPE_INDEX 0x01 |
Pixel type: Indexed (palette-based). | |
#define | BJ_PIXEL_TYPE_BITFIELD 0x02 |
Pixel type: Bitfield representation (e.g., RGB565). | |
#define | BJ_PIXEL_TYPE_BYTES 0x03 |
Pixel type: Byte-packed representation (e.g., RGBA8888). | |
#define | BJ_PIXEL_ORDER_RGB 0x01 |
Pixel order: Red-Green-Blue (RGB). | |
#define | BJ_PIXEL_ORDER_XRGB BJ_PIXEL_ORDER_RGB |
Pixel order: Same as BJ_PIXEL_ORDER_RGB with unused alpha. | |
#define | BJ_PIXEL_ORDER_BGR 0x02 |
Pixel order: Blue-Green-Red (BGR). | |
#define | BJ_PIXEL_ORDER_XBGR BJ_PIXEL_ORDER_BGR |
Pixel order: Same as BJ_PIXEL_ORDER_BGR with unused alpha. | |
#define | BJ_PIXEL_ORDER_RGBX 0x03 |
Pixel order: Red-Green-Blue with padding byte (RGBX). | |
#define | BJ_PIXEL_ORDER_BGRX 0x04 |
Pixel order: Blue-Green-Red with padding byte (BGRX). | |
#define | BJ_PIXEL_ORDER_ARGB 0x05 |
Pixel order: Alpha-Red-Green-Blue (ARGB). | |
#define | BJ_PIXEL_ORDER_ABGR 0x06 |
Pixel order: Alpha-Blue-Green-Red (ABGR). | |
#define | BJ_PIXEL_ORDER_RGBA 0x07 |
Pixel order: Red-Green-Blue-Alpha (RGBA). | |
#define | BJ_PIXEL_ORDER_BGRA 0x08 |
Pixel order: Blue-Green-Red-Alpha (BGRA). | |
#define | BJ_PIXEL_LAYOUT_1555 0x00 |
Pixel layout: 16-bit with 1-bit alpha, 5-bit red, green, and blue (1555). | |
#define | BJ_PIXEL_LAYOUT_8888 0x01 |
Pixel layout: 32-bit with 8 bits per channel (8888). | |
#define | BJ_PIXEL_LAYOUT_565 0x02 |
Pixel layout: 16-bit with 5 bits for red and blue, 6 bits for green (565). | |
#define | BJ_PIXEL_MODE_MAKE(bpp, type, layout, order) |
Creates a pixel format mode from bits-per-pixel, type, layout, and order. | |
#define | BJ_PIXEL_MODE_MAKE_INDEXED(bpp) |
Creates a pixel format for indexed (palette-based) pixels. | |
#define | BJ_PIXEL_MODE_MAKE_BITFIELD_16(layout, order) |
Creates a 16-bit bitfield pixel format. | |
#define | BJ_PIXEL_MODE_MAKE_BITFIELD_32(layout, order) |
Creates a 32-bit bitfield pixel format. | |
#define | BJ_PIXEL_MODE_MAKE_BYTES(bpp, order) |
Creates a byte-packed pixel format. | |
#define | BJ_PIXEL_GET_BPP(fmt) |
Extracts the bits-per-pixel from a pixel format. | |
#define | BJ_PIXEL_GET_TYPE(fmt) |
Extracts the pixel type from a pixel format. | |
#define | BJ_PIXEL_GET_LAYOUT(fmt) |
Extracts the pixel layout from a pixel format. | |
#define | BJ_PIXEL_GET_ORDER(fmt) |
Extracts the pixel order from a pixel format. | |
Enumerations | |
enum | bj_pixel_mode { BJ_PIXEL_MODE_UNKNOWN = 0x00u , BJ_PIXEL_MODE_INDEXED_1 = 0x00000101u , BJ_PIXEL_MODE_INDEXED_4 = 0x00000104u , BJ_PIXEL_MODE_INDEXED_8 = 0x00000108u , BJ_PIXEL_MODE_XRGB1555 = 0x01000210u , BJ_PIXEL_MODE_RGB565 = 0x01020210u , BJ_PIXEL_MODE_XRGB8888 = 0x01010220u , BJ_PIXEL_MODE_BGR24 = 0x02000318u } |
Representation of a pixel encoding. More... | |
Functions | |
void | bj_pixel_rgb (bj_pixel_mode mode, uint32_t value, uint8_t *p_red, uint8_t *p_green, uint8_t *p_blue) |
Gets the RGB value of a pixel given its 32-bits representation. | |
uint32_t | bj_pixel_value (bj_pixel_mode mode, uint8_t red, uint8_t green, uint8_t blue) |
Returns an opaque value representing a pixel color, given its RGB composition. | |
int | bj_compute_pixel_mode (uint8_t bpp, uint32_t red_mask, uint32_t green_mask, uint32_t blue_mask) |
Determine the most suitable bj_pixel_mode from a set of masks. | |
size_t | bj_compute_bitmap_stride (size_t width, bj_pixel_mode mode) |
Returns the stride used for encoding a bitmaps in Banjo. | |