picofuse

Data Structures | Typedefs
Bitmap

A bitmap is a plain, backend-agnostic pixel buffer descriptor - see pix_bitmap_t's own doc. More...

Collaboration diagram for Bitmap:

Data Structures

struct  pix_bitmap_t
 Plain in-memory pixel bitmap descriptor. More...
 

Typedefs

typedef struct pix_bitmap_ops_t pix_bitmap_ops_t
 Backend-specific bitmap operations - opaque to public API callers.
 

Methods

pix_color_t pix_bitmap_get_pixel (const pix_bitmap_t *bitmap, pix_point_t point)
 Read a single pixel's color. More...
 
void pix_bitmap_set_pixel (pix_bitmap_t *bitmap, pix_point_t point, pix_color_t color)
 Write a single pixel's color. More...
 
void pix_bitmap_fill_rect (pix_bitmap_t *bitmap, pix_point_t origin, pix_size_t size, pix_color_t color)
 Fill a rectangle with a single color. More...
 
void pix_bitmap_draw_line (pix_bitmap_t *bitmap, pix_point_t a, pix_point_t b, pix_color_t color)
 Draw a straight line between two points. More...
 
void pix_bitmap_set_op (pix_bitmap_t *bitmap, pix_op_t op)
 Change a bitmap's compositing mode. More...
 

Detailed Description

A bitmap is a plain, backend-agnostic pixel buffer descriptor - see pix_bitmap_t's own doc.

Function Documentation

◆ pix_bitmap_draw_line()

void pix_bitmap_draw_line ( pix_bitmap_t bitmap,
pix_point_t  a,
pix_point_t  b,
pix_color_t  color 
)

Draw a straight line between two points.

Parameters
bitmapThe bitmap to write to.
aOne endpoint.
bThe other endpoint.
colorThe color to draw with - see pix_bitmap_set_pixel()'s own doc on compositing.

Silently clips to bitmap's own bounds - a no-op if bitmap is invalid.

◆ pix_bitmap_fill_rect()

void pix_bitmap_fill_rect ( pix_bitmap_t bitmap,
pix_point_t  origin,
pix_size_t  size,
pix_color_t  color 
)

Fill a rectangle with a single color.

Parameters
bitmapThe bitmap to write to.
originThe rectangle's top-left corner.
sizeThe rectangle's dimensions.
colorThe color to fill with - see pix_bitmap_set_pixel()'s own doc on compositing.

Silently clips to bitmap's own bounds - a no-op if bitmap is invalid.

◆ pix_bitmap_get_pixel()

pix_color_t pix_bitmap_get_pixel ( const pix_bitmap_t bitmap,
pix_point_t  point 
)

Read a single pixel's color.

Parameters
bitmapThe bitmap to read from.
pointThe pixel coordinates to read.
Returns
The pixel's color, or PIX_COLOR_NONE if bitmap is invalid, point is out of bounds, or bitmap's format isn't supported.

◆ pix_bitmap_set_op()

void pix_bitmap_set_op ( pix_bitmap_t bitmap,
pix_op_t  op 
)

Change a bitmap's compositing mode.

Parameters
bitmapThe bitmap to change. A no-op if invalid.
opThe new mode - see pix_bitmap_t::op.

◆ pix_bitmap_set_pixel()

void pix_bitmap_set_pixel ( pix_bitmap_t bitmap,
pix_point_t  point,
pix_color_t  color 
)

Write a single pixel's color.

Parameters
bitmapThe bitmap to write to.
pointThe pixel coordinates to write.
colorThe color to write - composited according to bitmap's own op (see pix_bitmap_t::op), which defaults to PIX_BLEND; a format with no alpha channel of its own treats its existing pixel as fully opaque for that blend.

A no-op if bitmap is invalid, point is out of bounds, or bitmap's format isn't supported.