libdragon
Macros | Functions
graphics.c File Reference

2D Graphics More...

Macros

#define __set_pixel(buffer, x, y, color)    (buffer)[(x) + ((y) * pix_stride)] = color
 Macro to set a pixel to a certain color in a buffer. More...
 
#define __get_pixel(buffer, x, y)    (buffer)[(x) + ((y) * pix_stride)]
 Macro to get a pixel color from a buffer. More...
 
#define __get_buffer(disp)   ((disp)->buffer)
 Get the correct video buffer given a display context. More...
 

Functions

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_set_color (uint32_t forecolor, uint32_t backcolor)
 Set the current forecolor and backcolor for text operations. 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_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...
 
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)
 

Detailed Description

2D Graphics