libdragon
Data Structures | Macros | Functions
graphics.h File Reference

2D Graphics More...

Go to the source code of this file.

Data Structures

struct  color_t
 Generic color structure. More...
 

Macros

#define RGBA16(rx, gx, bx, ax)
 Create a color_t from the R,G,B,A components in the RGBA16 range (that is: RGB in 0-31, A in 0-1) More...
 
#define RGBA32(rx, gx, bx, ax)
 Create a color_t from the R,G,B,A components in the RGBA32 range (0-255). More...
 

Functions

uint16_t color_to_packed16 (color_t c)
 Convert a color_t to the 16-bit packed format used by a FMT_RGBA16 surface (RGBA 5551)
 
uint32_t color_to_packed32 (color_t c)
 Convert a color_t to the 32-bit packed format used by a FMT_RGBA32 surface (RGBA 8888)
 
color_t color_from_packed16 (uint16_t c)
 Create a color_t from the 16-bit packed format used by a FMT_RGBA16 surface (RGBA 5551)
 
color_t color_from_packed32 (uint32_t c)
 Create a color_t from the 32-bit packed format used by a FMT_RGBA32 surface (RGBA 8888)
 
uint32_t graphics_make_color (int r, int g, int b, int a)
 Return a packed 32-bit representation of an RGBA color. More...
 
uint32_t graphics_convert_color (color_t color)
 Convert a color structure to a 32-bit representation of an RGBA color. More...
 
void graphics_draw_pixel (surface_t *disp, int x, int y, uint32_t color)
 Draw a pixel to a given display context. More...
 
void graphics_draw_pixel_trans (surface_t *disp, int x, int y, uint32_t color)
 Draw a pixel to a given display context with alpha support. More...
 
void graphics_draw_line (surface_t *disp, int x0, int y0, int x1, int y1, uint32_t color)
 Draw a line to a given display context. More...
 
void graphics_draw_line_trans (surface_t *disp, int x0, int y0, int x1, int y1, uint32_t color)
 Draw a line to a given display context with alpha support. More...
 
void graphics_draw_box (surface_t *disp, int x, int y, int width, int height, uint32_t color)
 Draw a filled rectangle to a display context. More...
 
void graphics_draw_box_trans (surface_t *disp, int x, int y, int width, int height, uint32_t color)
 Draw a filled rectangle to a display context. More...
 
void graphics_fill_screen (surface_t *disp, uint32_t c)
 Fill the entire screen with a particular color. More...
 
void graphics_set_color (uint32_t forecolor, uint32_t backcolor)
 Set the current forecolor and backcolor for text operations. More...
 
void graphics_set_default_font (void)
 Set the font to the default.
 
void graphics_set_font_sprite (sprite_t *font)
 Set the current font. Should be set before using any of the draw function. More...
 
void graphics_draw_character (surface_t *disp, int x, int y, char ch)
 Draw a character to the screen using the built-in font. More...
 
void graphics_draw_text (surface_t *disp, int x, int y, const char *const msg)
 Draw a null terminated string to a display context. More...
 
void graphics_draw_sprite (surface_t *disp, int x, int y, sprite_t *sprite)
 Draw a sprite to a display context. More...
 
void graphics_draw_sprite_stride (surface_t *disp, int x, int y, sprite_t *sprite, int offset)
 Draw a sprite from a spritemap to a display context. More...
 
void graphics_draw_sprite_trans (surface_t *disp, int x, int y, sprite_t *sprite)
 Draw a sprite to a display context with alpha transparency. More...
 
void graphics_draw_sprite_trans_stride (surface_t *disp, int x, int y, sprite_t *sprite, int offset)
 Draw a sprite from a spritemap to a display context. More...
 

Detailed Description

2D Graphics