picofuse

Macros | Typedefs
Display

Displays can be created by a backend, which returns a pix_display_t handle. More...

Collaboration diagram for Display:

Macros

#define PIX_DISPLAY_POOL_CAPACITY   1u
 Maximum number of concurrently active displays. More...
 
#define PIX_DISPLAY_CONTEXT_SIZE   64u
 Size in bytes of backend-private state embedded in each display. More...
 

Typedefs

typedef struct pix_display_t pix_display_t
 Opaque display descriptor.
 
typedef void(* pix_display_draw_t) (pix_display_t *display, pix_bitmap_t *bitmap, void *userdata)
 Draw callback signature. More...
 

Methods

void pix_display_set_callback (pix_display_t *display, pix_display_draw_t callback, void *userdata)
 Register the function that draws this display's contents. More...
 
void pix_display_deinit (pix_display_t *display)
 Deinitialize a display and release it back to the pool. More...
 

Detailed Description

Displays can be created by a backend, which returns a pix_display_t handle.

The backends are:

A display is usually backed by a bitmap buffer of a specific pixel format, but how that's implemented is up to the backend.

Macro Definition Documentation

◆ PIX_DISPLAY_CONTEXT_SIZE

#define PIX_DISPLAY_CONTEXT_SIZE   64u

Size in bytes of backend-private state embedded in each display.

Default fits the SDL backend's context, the largest today. Must be defined identically everywhere pix_display_t is used - override by defining PIX_DISPLAY_CONTEXT_SIZE globally at compile time.

Definition at line 45 of file display.h.

◆ PIX_DISPLAY_POOL_CAPACITY

#define PIX_DISPLAY_POOL_CAPACITY   1u

Maximum number of concurrently active displays.

Displays come from a small fixed-size pool, not the heap. Override by defining PIX_DISPLAY_POOL_CAPACITY at compile time.

Definition at line 33 of file display.h.

Typedef Documentation

◆ pix_display_draw_t

typedef void(* pix_display_draw_t) (pix_display_t *display, pix_bitmap_t *bitmap, void *userdata)

Draw callback signature.

Parameters
displayThe display being drawn.
bitmapThe display's bitmap, already locked for direct pixel access - the callback should draw into it, but never lock/unlock it itself.
userdataOpaque pointer, as passed to pix_display_set_callback().

Called internally, from within pix_poll(), whenever this display's backend reports it's due a redraw - never called directly.

Definition at line 60 of file display.h.

Function Documentation

◆ pix_display_deinit()

void pix_display_deinit ( pix_display_t display)

Deinitialize a display and release it back to the pool.

Parameters
displayThe display to deinitialize. Safe to call on NULL.

◆ pix_display_set_callback()

void pix_display_set_callback ( pix_display_t display,
pix_display_draw_t  callback,
void *  userdata 
)

Register the function that draws this display's contents.

Parameters
displayThe display to set the callback on. A no-op if invalid.
callbackCalled whenever display is due a redraw, or NULL to clear a previously registered callback.
userdataOpaque pointer passed back to callback unchanged.