General-purpose definitions for Banjo API.
Recoverable error handling.
bj_bool bj_blit_mask(const bj_bitmap *mask, const bj_rect *mask_area, bj_bitmap *dst, const bj_rect *dst_area, uint32_t fg_native, uint32_t bg_native, bj_mask_bg_mode mode)
Masked blit (non-stretched).
bj_bitmap * bj_allocate_bitmap(void)
Allocate a new bitmap object.
size_t bj_bitmap_stride(bj_bitmap *p_bitmap)
Get the number of bytes in a row of pixel data, including the padding.
size_t bj_bitmap_width(const bj_bitmap *p_bitmap)
Get the width of the given bitmap.
bj_bool bj_blit_stretched(const bj_bitmap *src, const bj_rect *src_area, bj_bitmap *dst, const bj_rect *dst_area, bj_blit_op op)
Stretched bitmap blitting (nearest neighbor).
int bj_bitmap_mode(bj_bitmap *p_bitmap)
Get the pixel mode of the given bitmap.
bj_bitmap * bj_create_bitmap_from_pixels(void *p_pixels, size_t width, size_t height, bj_pixel_mode mode, size_t stride)
Creates a new bj_bitmap with the specified width and height.
bj_bitmap * bj_init_bitmap(bj_bitmap *p_bitmap, void *p_pixels, size_t width, size_t height, bj_pixel_mode mode, size_t stride)
Initializes a new bj_bitmap with the specified width and height.
bj_bool bj_blit(const bj_bitmap *src, const bj_rect *src_area, bj_bitmap *dst, const bj_rect *dst_area, bj_blit_op op)
Bitmap blitting operation from a source to a destination bitmap.
bj_mask_bg_mode
Mask background mode for masked blits (glyph/text rendering).
Definition bitmap.h:556
void bj_reset_bitmap(bj_bitmap *p_bitmap)
Resets a bj_bitmap object making it ready for a new init or free.
void bj_blit_text(bj_bitmap *dst, int x, int y, unsigned height, uint32_t fg_native, uint32_t bg_native, bj_mask_bg_mode mode, const char *text)
Prints text with explicit foreground/background and background mode.
bj_bitmap * bj_convert_bitmap(const bj_bitmap *p_bitmap, bj_pixel_mode mode)
Creates a new bj_bitmap by converting p_bitmap.
size_t bj_bitmap_height(const bj_bitmap *p_bitmap)
Get the height of the given bitmap.
bj_bitmap * bj_copy_bitmap(const bj_bitmap *p_bitmap)
Creates a new bj_bitmap by copying p_bitmap.
void bj_draw_text(bj_bitmap *dst, int x, int y, unsigned height, uint32_t fg_native, const char *text)
Prints text using the default foreground color and transparent background.
void * bj_bitmap_pixels(bj_bitmap *p_bitmap)
Get the underlying pixels data for direct access.
bj_blit_op
Raster operation (ROP) to apply during blitting.
Definition bitmap.h:48
void bj_make_bitmap_rgb(const bj_bitmap *p_bitmap, size_t x, size_t y, uint8_t *p_red, uint8_t *p_green, uint8_t *p_blue)
Gets the RGB value of a pixel given its 32-bits representation.
void bj_set_bitmap_colorkey(bj_bitmap *p_bitmap, bj_bool enabled, uint32_t key_value)
Enables or disables color key transparency for blitting.
uint32_t bj_make_bitmap_pixel(bj_bitmap *p_bitmap, uint8_t red, uint8_t green, uint8_t blue)
Returns an opaque value representing a pixel color, given its RGB composition.
uint32_t bj_bitmap_pixel(const bj_bitmap *p_bitmap, size_t x, size_t y)
Gets the color of a bitmap pixel, given its coordinates.
void bj_destroy_bitmap(bj_bitmap *p_bitmap)
Deletes a bj_bitmap object and releases associated memory.
void bj_set_bitmap_clear_color(bj_bitmap *p_bitmap, uint32_t clear_color)
Sets the color used for clearing the bitmap.
void bj_clear_bitmap(bj_bitmap *p_bitmap)
Fills the entire bitmap with the clear color.
bj_bitmap * bj_create_bitmap(size_t width, size_t height, bj_pixel_mode mode, size_t stride)
Creates a new bj_bitmap with the specified width and height.
struct bj_bitmap_t bj_bitmap
Typedef for the bj_bitmap struct.
Definition bitmap.h:60
void bj_put_pixel(bj_bitmap *p_bitmap, size_t x, size_t y, uint32_t value)
Change the pixel color at given coordinate.
void bj_draw_textf(bj_bitmap *p_bitmap, int x, int y, unsigned height, uint32_t fg_native, const char *fmt,...)
Prints formatted text into a bitmap, similar to printf.
bj_bitmap * bj_create_bitmap_from_file(const char *p_path, bj_error **p_error)
Creates a new bitmap by loading from a file.
bj_bool bj_blit_mask_stretched(const bj_bitmap *mask, const bj_rect *mask_area, bj_bitmap *dst, const bj_rect *dst_area, uint32_t fg_native, uint32_t bg_native, bj_mask_bg_mode mode)
Masked blit with stretching (nearest neighbor).
@ BJ_MASK_BG_TRANSPARENT
Foreground over destination where mask>0.
Definition bitmap.h:557
@ BJ_MASK_BG_OPAQUE
Opaque band: mix(background, foreground, mask)
Definition bitmap.h:558
@ BJ_MASK_BG_REV_TRANSPARENT
Carved: mix(destination, background, 1-mask)
Definition bitmap.h:559
@ BJ_BLIT_OP_OR
Bitwise OR.
Definition bitmap.h:51
@ BJ_BLIT_OP_COPY
Copy source to destination (fast path when formats match)
Definition bitmap.h:49
@ BJ_BLIT_OP_AND
Bitwise AND.
Definition bitmap.h:52
@ BJ_BLIT_OP_ADD_SAT
Per-channel saturated add (clamped to 255)
Definition bitmap.h:53
@ BJ_BLIT_OP_XOR
Bitwise XOR (channel-wise for >8bpp)
Definition bitmap.h:50
@ BJ_BLIT_OP_SUB_SAT
Per-channel saturated subtract (clamped to 0)
Definition bitmap.h:54
#define BANJO_EXPORT
Definition api.h:139
uint32_t bj_bool
Boolean type used throughout the Banjo API.
Definition api.h:276
Error structure.
Definition error.h:131
struct bj_rect_t bj_rect
Typedef for bj_rect_t.
Definition rect.h:15
bj_pixel_mode
Representation of a pixel encoding.
Definition pixel.h:16
Header file for general pixel manipulation facilities.
Defines the bj_rect struct representing a rectangle with position and dimensions.
Header file for bj_stream_t struct and related functions.