606 const struct bj_rect* mask_area,
608 const struct bj_rect* dst_area,
641 const struct bj_rect* mask_area,
643 const struct bj_rect* dst_area,
General-purpose definitions for Banjo API.
Recoverable error handling.
void bj_clear_bitmap(struct bj_bitmap *bitmap)
Fills the entire bitmap with the clear color.
bj_bool bj_blit_mask_stretched(const struct bj_bitmap *mask, const struct bj_rect *mask_area, struct bj_bitmap *dst, const struct bj_rect *dst_area, uint32_t fg_native, uint32_t bg_native, bj_mask_bg_mode mode)
Masked blit with stretching (nearest neighbor).
void bj_assign_bitmap(struct bj_bitmap *bitmap, void *pixels, size_t width, size_t height, enum bj_pixel_mode mode, size_t stride)
struct bj_bitmap * bj_allocate_bitmap(void)
Allocate a new bitmap object.
bj_bool bj_blit_stretched(const struct bj_bitmap *src, const struct bj_rect *src_area, struct bj_bitmap *dst, const struct bj_rect *dst_area, enum bj_blit_op op)
Stretched bitmap blitting (nearest neighbor).
bj_mask_bg_mode
Mask background mode for masked blits (glyph/text rendering).
Definition bitmap.h:566
struct bj_bitmap * bj_create_bitmap_from_file(const char *path, struct bj_error **error)
Creates a new bitmap by loading from a file.
void * bj_bitmap_pixels(struct bj_bitmap *bitmap)
Get the underlying pixels data for direct access.
bj_bool bj_blit(const struct bj_bitmap *src, const struct bj_rect *src_area, struct bj_bitmap *dst, const struct bj_rect *dst_area, enum bj_blit_op op)
Bitmap blitting operation from a source to a destination bitmap.
size_t bj_bitmap_height(const struct bj_bitmap *bitmap)
Get the height of the given bitmap.
size_t bj_bitmap_stride(struct bj_bitmap *bitmap)
Get the number of bytes in a row of pixel data, including the padding.
void bj_reset_bitmap(struct bj_bitmap *bitmap)
Resets a struct bj_bitmap object making it ready for a new init or free.
void bj_set_bitmap_clear_color(struct bj_bitmap *bitmap, uint32_t clear_color)
Sets the color used for clearing the bitmap.
void bj_make_bitmap_rgb(const struct bj_bitmap *bitmap, size_t x, size_t y, uint8_t *red, uint8_t *green, uint8_t *blue)
Gets the RGB value of a pixel given its 32-bits representation.
uint32_t bj_make_bitmap_pixel(struct bj_bitmap *bitmap, uint8_t red, uint8_t green, uint8_t blue)
Returns an opaque value representing a pixel color, given its RGB composition.
bj_blit_op
Raster operation (ROP) to apply during blitting.
Definition bitmap.h:48
struct bj_bitmap * bj_convert_bitmap(const struct bj_bitmap *bitmap, enum bj_pixel_mode mode)
Creates a new struct bj_bitmap by converting bitmap.
bj_bool bj_blit_mask(const struct bj_bitmap *mask, const struct bj_rect *mask_area, struct bj_bitmap *dst, const struct bj_rect *dst_area, uint32_t fg_native, uint32_t bg_native, bj_mask_bg_mode mode)
Masked blit (non-stretched).
size_t bj_bitmap_width(const struct bj_bitmap *bitmap)
Get the width of the given bitmap.
void bj_blit_text(struct 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.
void bj_draw_textf(struct bj_bitmap *bitmap, int x, int y, unsigned height, uint32_t fg_native, const char *fmt,...)
Prints formatted text into a bitmap, similar to printf.
void bj_draw_text(struct 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.
struct bj_bitmap * bj_init_bitmap(struct bj_bitmap *bitmap, void *pixels, size_t width, size_t height, enum bj_pixel_mode mode, size_t stride)
Initializes a new struct bj_bitmap with the specified width and height.
void bj_set_bitmap_colorkey(struct bj_bitmap *bitmap, bj_bool enabled, uint32_t key_value)
Enables or disables color key transparency for blitting.
int bj_bitmap_mode(struct bj_bitmap *bitmap)
Get the pixel mode of the given bitmap.
struct bj_bitmap * bj_create_bitmap(size_t width, size_t height, enum bj_pixel_mode mode, size_t stride)
Creates a new struct bj_bitmap with the specified width and height.
struct bj_bitmap * bj_create_bitmap_from_pixels(void *pixels, size_t width, size_t height, enum bj_pixel_mode mode, size_t stride)
Creates a new struct bj_bitmap with the specified width and height.
void bj_put_pixel(struct bj_bitmap *bitmap, size_t x, size_t y, uint32_t value)
Change the pixel color at given coordinate.
uint32_t bj_bitmap_pixel(const struct bj_bitmap *bitmap, size_t x, size_t y)
Gets the color of a bitmap pixel, given its coordinates.
void bj_destroy_bitmap(struct bj_bitmap *bitmap)
Deletes a struct bj_bitmap object and releases associated memory.
struct bj_bitmap * bj_copy_bitmap(const struct bj_bitmap *bitmap)
Creates a new struct bj_bitmap by copying bitmap.
@ BJ_MASK_BG_TRANSPARENT
Foreground over destination where mask>0.
Definition bitmap.h:567
@ BJ_MASK_BG_OPAQUE
Opaque band: mix(background, foreground, mask)
Definition bitmap.h:568
@ BJ_MASK_BG_REV_TRANSPARENT
Carved: mix(destination, background, 1-mask)
Definition bitmap.h:569
@ 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:155
uint32_t bj_bool
Boolean type used throughout the Banjo API.
Definition api.h:249
struct bj_bitmap bj_bitmap
Definition api.h:331
Error structure.
Definition error.h:131
Represents a rectangle with position and dimensions.
Definition rect.h:19
bj_pixel_mode
Representation of a pixel encoding.
Definition pixel.h:16
Header file for general pixel manipulation facilities.
Defines the struct bj_rect struct representing a rectangle with position and dimensions.
Header file for struct bj_stream struct and related functions.