gfx/gfx.t header reference
[Lightweight 2d graphic module]

The source code of this header can be browsed online.

Members [link] 

Types [link] 

Functions [link] 

  • _GFX_BPP_EXPAND(_GFX_BPP_L2PPW )
  • bool_t gfx_box_check(const struct gfx_surface_s *s, gfx_pos_t x0, gfx_pos_t y0, gfx_pos_t x1, gfx_pos_t y1)
  • bool_t gfx_box_safe(const struct gfx_surface_s *s, gfx_pos_t *x0, gfx_pos_t *y0, gfx_pos_t *x1, gfx_pos_t *y1)
  • bool_t gfx_draw_tile(const struct gfx_surface_s *s, const struct gfx_tilemap_s *t, uint_fast16_t tile, gfx_pos_t x, gfx_pos_t y, bool_t center)
  • void gfx_draw_tile_string(const struct gfx_surface_s *s, const struct gfx_tilemap_s *t, const uint8_t *str, uint_fast16_t size, gfx_pos_t x, gfx_pos_t y, enum gfx_direction_e dir, bool_t center)
  • gfx_pos_t gfx_height(const struct gfx_surface_s *s)
  • gfx_word_t * gfx_surface_data(const struct gfx_surface_s *s)
  • void gfx_surface_dummy(struct gfx_surface_s *s)
  • error_t gfx_surface_init(struct gfx_surface_s *s, gfx_word_t *data, size_t bytes, gfx_pos_t w, gfx_pos_t h, enum gfx_surface_format fmt)
  • error_t gfx_surface_storage(size_t *bytes, size_t *row_bytes, gfx_pos_t w, gfx_pos_t h, enum gfx_surface_format fmt)
  • error_t gfx_tilemap_init(struct gfx_tilemap_s *t, const struct gfx_surface_s *s, gfx_pos_t tw, gfx_pos_t th, uint_fast8_t first)
  • gfx_pos_t gfx_width(const struct gfx_surface_s *s)
  • bool_t gfx_xcheck(const struct gfx_surface_s *s, gfx_pos_t x)
  • gfx_pos_t gfx_xmod(const struct gfx_surface_s *s, gfx_pos_t x)
  • gfx_addr_t gfx_yaddr(const struct gfx_surface_s *s, gfx_pos_t y)
  • bool_t gfx_ycheck(const struct gfx_surface_s *s, gfx_pos_t y)
  • gfx_pos_t gfx_ymod(const struct gfx_surface_s *s, gfx_pos_t y)
  • gfx_addr_t gfx_xymod(const struct gfx_surface_s *s, gfx_addr_t a)

Constant [link] 

Members detail [link] 

_GFX_BPP_EXPAND(_GFX_BPP_L2PPW ) [link] 

This constructor is declared in gfx/gfx.t source file, line 495.

Alternate declarations with same identifier: [1], [2], [3], [4], [5].

enum <anonymous> [link] 

This enum is declared in gfx/gfx.t source file, line 490.

This enum is empty.

#define GFX_ASSERT(...) [link] 

This macro is declared in gfx/gfx.t source file, line 67.

#define _GFX_BPP0(...) [link] 

This macro is declared in gfx/gfx.t source file, line 330.

Preprocessor condition: defined( CONFIG_GFX_BPP0 )

#define _GFX_BPP0(...) [link] 

This macro is declared in gfx/gfx.t source file, line 334.

Preprocessor condition: not defined( CONFIG_GFX_BPP0 ) and not ( CONFIG_GFX_DEFAULT_L2BPP == 0 )

#define _GFX_BPP1(...) [link] 

This macro is declared in gfx/gfx.t source file, line 338.

Preprocessor condition: defined( CONFIG_GFX_BPP1 )

#define _GFX_BPP1(...) [link] 

This macro is declared in gfx/gfx.t source file, line 342.

Preprocessor condition: not defined( CONFIG_GFX_BPP1 ) and not ( CONFIG_GFX_DEFAULT_L2BPP == 1 )

#define _GFX_BPP2(...) [link] 

This macro is declared in gfx/gfx.t source file, line 346.

Preprocessor condition: defined( CONFIG_GFX_BPP2 )

#define _GFX_BPP2(...) [link] 

This macro is declared in gfx/gfx.t source file, line 350.

Preprocessor condition: not defined( CONFIG_GFX_BPP2 ) and not ( CONFIG_GFX_DEFAULT_L2BPP == 2 )

#define _GFX_BPP3(...) [link] 

This macro is declared in gfx/gfx.t source file, line 354.

Preprocessor condition: defined( CONFIG_GFX_BPP3 )

#define _GFX_BPP3(...) [link] 

This macro is declared in gfx/gfx.t source file, line 358.

Preprocessor condition: not defined( CONFIG_GFX_BPP3 ) and not ( CONFIG_GFX_DEFAULT_L2BPP == 3 )

#define _GFX_BPP4(...) [link] 

This macro is declared in gfx/gfx.t source file, line 362.

Preprocessor condition: defined( CONFIG_GFX_BPP4 )

#define _GFX_BPP4(...) [link] 

This macro is declared in gfx/gfx.t source file, line 366.

Preprocessor condition: not defined( CONFIG_GFX_BPP4 ) and not ( CONFIG_GFX_DEFAULT_L2BPP == 4 )

#define _GFX_BPP5(...) [link] 

This macro is declared in gfx/gfx.t source file, line 370.

Preprocessor condition: defined( CONFIG_GFX_BPP5 )

#define _GFX_BPP5(...) [link] 

This macro is declared in gfx/gfx.t source file, line 374.

Preprocessor condition: not defined( CONFIG_GFX_BPP5 ) and not ( CONFIG_GFX_DEFAULT_L2BPP == 5 )

#define _GFX_BPP_L2PPW(bpp, ppw, l2bpp, l2ppw, pm, ps, word_t) [link] 

This macro is declared in gfx/gfx.t source file, line 488.

#define _GFX_CPP1(a) [link] 

This macro is declared in gfx/gfx.t source file, line 323.

#define _GFX_CPP3(a, b, c) [link] 

This macro is declared in gfx/gfx.t source file, line 324.

#define _GFX_FMT_SWITCH(name, args) [link] 

This macro is declared in gfx/gfx.t source file, line 378.

#define _GFX_H_ [link] 

This macro is declared in gfx/gfx.t source file, line 29.

#define _GFX_SWAP(a, b) [link] 

This macro is declared in gfx/gfx.t source file, line 327.

#define __GFX_CPP3(a, b, c) [link] 

This macro is declared in gfx/gfx.t source file, line 325.

typedef uint32_t gfx_addr_t [link] 

This typedef is declared in gfx/gfx.t source file, line 79.

An integer type large enough to address a word in the data storage of a surface.

bool_t gfx_box_check(const struct gfx_surface_s *s, gfx_pos_t x0, gfx_pos_t y0, gfx_pos_t x1, gfx_pos_t y1) [link] 

This function is declared in gfx/gfx.t source file, line 296.

This function returns false if the box falls outside the surface

bool_t gfx_box_safe(const struct gfx_surface_s *s, gfx_pos_t *x0, gfx_pos_t *y0, gfx_pos_t *x1, gfx_pos_t *y1) [link] 

This function is declared in gfx/gfx.t source file, line 310.

This function prevents coordinates from falling outside a surface either by mangling the values or returns an error.

enum gfx_direction_e [link] 

This enum is declared in gfx/gfx.t source file, line 106.

This enum specifies directions.

IdentifierDescription
GFX_DIR_LEFT
GFX_DIR_RIGHT
GFX_DIR_UP
GFX_DIR_DOWN

bool_t gfx_draw_tile(const struct gfx_surface_s *s, const struct gfx_tilemap_s *t, uint_fast16_t tile, gfx_pos_t x, gfx_pos_t y, bool_t center) [link] 

This function is declared in gfx/gfx.t source file, line 540.

This function draws a single tile from a tilemap on a surface.

void gfx_draw_tile_string(const struct gfx_surface_s *s, const struct gfx_tilemap_s *t, const uint8_t *str, uint_fast16_t size, gfx_pos_t x, gfx_pos_t y, enum gfx_direction_e dir, bool_t center) [link] 

This function is declared in gfx/gfx.t source file, line 549.

This function draws multiple tiles from a tilemap on a surface. Tiles index are taken from a string.

gfx_pos_t gfx_height(const struct gfx_surface_s *s) [link] 

This function is declared in gfx/gfx.t source file, line 206.

This function returns the height of a surface in pixels.

typedef uint32_t gfx_pixel_t [link] 

This typedef is declared in gfx/gfx.t source file, line 75.

An integer type large enough to hold a pixel value in any format.

typedef int32_t gfx_pos_t [link] 

This typedef is declared in gfx/gfx.t source file, line 77.

An signed integer type large enough to hold a pixel coordinate.

enum gfx_surface_compress [link] 

This enum is declared in gfx/gfx.t source file, line 98.

This enum specifies the various implemented surface compression formats

IdentifierDescription
GFX_CMP_NONE
GFX_CMP_RLE
GFX_CMP_LZO

gfx_word_t * gfx_surface_data(const struct gfx_surface_s *s) [link] 

This function is declared in gfx/gfx.t source file, line 484.

This function returns a pointer to the surface storage.

void gfx_surface_dummy(struct gfx_surface_s *s) [link] 

This function is declared in gfx/gfx.t source file, line 479.

This function initializes a surface with a dummy single pixel storage.

enum gfx_surface_format [link] 

This enum is declared in gfx/gfx.t source file, line 85.

This enum specifies the various implemented pixel formats

IdentifierDescription
GFX_FMT_DEFAULTsee CONFIG_GFX_DEFAULT_L2BPP
GFX_FMT_1BIT
GFX_FMT_2BIT
GFX_FMT_4BIT
GFX_FMT_8BIT
GFX_FMT_16BIT
GFX_FMT_32BIT

error_t gfx_surface_init(struct gfx_surface_s *s, gfx_word_t *data, size_t bytes, gfx_pos_t w, gfx_pos_t h, enum gfx_surface_format fmt) [link] 

This function is declared in gfx/gfx.t source file, line 470.

This function initializes a surface with specified log2 width, log2 height and format. The surface data is located at data + offset and is checked to be within data + size.

struct gfx_surface_s [link] 

This struct is declared in gfx/gfx.t source file, line 127.

This struct is a surface descriptor.

A surface object has an associated user provided buffer used to store the image data. The actual data format depends on the pixel format and library configuration.

The image data is stored as an array of gfx_word_t. Native endianess is used. The word width used is defined by the CONFIG_GFX_LOG2_WORD_WIDTH token.

See also gfx_surface_init.

FieldDescription
void * ptr;pointer to surface data
gfx_addr_t mask;ptr index mask
uint8_t l2bw;log2 of row size in words
uint8_t l2w;log2 of width in pixels
uint8_t l2h;log2 of height in pixels
gfx_addr_t bsize;size in words
uint16_t bw;row size in words
uint16_t w;width in pixels
uint16_t h;height in pixels
enum gfx_surface_format fmt;pixel format

error_t gfx_surface_storage(size_t *bytes, size_t *row_bytes, gfx_pos_t w, gfx_pos_t h, enum gfx_surface_format fmt) [link] 

This function is declared in gfx/gfx.t source file, line 475.

This function computes the size in bytes needed to store the surface data.

error_t gfx_tilemap_init(struct gfx_tilemap_s *t, const struct gfx_surface_s *s, gfx_pos_t tw, gfx_pos_t th, uint_fast8_t first) [link] 

This function is declared in gfx/gfx.t source file, line 189.

This function initializes a tilemap object from a surface containing the tile set. You need to specifies the resolution of a single tile.

The number of tiles on a single row of the tile set image is the largest power of 2 that fits. They may be padding on the right if you have some surface resolution constraints.

Example: You have configured the library to only support surfaces with power of two resolution. You have a tile set image with a resolution of 256x128 pixels and the resolution of a single tile is 14x24. You then need to design your tile set image with 16 tiles per row and 32 pixels of padding at the end of each row.

struct gfx_tilemap_s [link] 

This struct is declared in gfx/gfx.t source file, line 161.

This struct contains a struct gfx_surface_s object along with information about the set of tiles it contains. This allows extracting a single tile for drawing on an other surface.

This is typically used to implement bitmap fonts.

FieldDescription
struct gfx_surface_s s;
uint8_t l2tpr;
uint8_t tw;
uint8_t th;
uint8_t offset;

gfx_pos_t gfx_width(const struct gfx_surface_s *s) [link] 

This function is declared in gfx/gfx.t source file, line 232.

This function returns the width of a surface in pixels.

bool_t gfx_xcheck(const struct gfx_surface_s *s, gfx_pos_t x) [link] 

This function is declared in gfx/gfx.t source file, line 259.

This function returns false if the x coordinate falls outside the surface

gfx_pos_t gfx_xmod(const struct gfx_surface_s *s, gfx_pos_t x) [link] 

This function is declared in gfx/gfx.t source file, line 247.

This function performs a modulus on the x coordinate in a surface.

gfx_addr_t gfx_yaddr(const struct gfx_surface_s *s, gfx_pos_t y) [link] 

This function is declared in gfx/gfx.t source file, line 195.

This function returns the address of the row of pixels at position y in a surface.

bool_t gfx_ycheck(const struct gfx_surface_s *s, gfx_pos_t y) [link] 

This function is declared in gfx/gfx.t source file, line 271.

This function returns false if the y coordinate falls outside the surface

gfx_pos_t gfx_ymod(const struct gfx_surface_s *s, gfx_pos_t y) [link] 

This function is declared in gfx/gfx.t source file, line 221.

This function performs a modulus on the y coordinate in a surface.

const struct gfx_fmt_desc_s gfx_fmt_desc[16] [link] 

This constant is declared in gfx/gfx.t source file, line 534.

This constant contains properties all supported pixel formats.

This constant is for internal use only.

struct gfx_fmt_desc_s [link] 

This struct is declared in gfx/gfx.t source file, line 456.

This struct contains properties of a pixel format.

This struct is for internal use only.

FieldDescription
uint8_t l2bpp;
uint8_t l2ppw;
gfx_pixel_t pm;

gfx_addr_t gfx_xymod(const struct gfx_surface_s *s, gfx_addr_t a) [link] 

This function is declared in gfx/gfx.t source file, line 283.

This function clamps the pixel address so that it always fall in the surface.

This function is for internal use only.

Valid XHTML 1.0 StrictGenerated by diaxen on Thu Aug 4 15:44:06 2022 using MkDoc