General graphics routines header file. More...
#include <assert.h>#include <hugemem.h>#include <progmem.h>Go to the source code of this file.
Data Structures | |
| struct | font |
| Storage structure for font metadata. More... | |
| struct | gfx_bitmap |
| Storage structure for bitmap pixel data and metadata. More... | |
Defines | |
Circle Sector Definitions | |
| #define | GFX_OCTANT0 (1 << 0) |
| Bitmask for drawing circle octant 0. | |
| #define | GFX_OCTANT1 (1 << 1) |
| Bitmask for drawing circle octant 1. | |
| #define | GFX_OCTANT2 (1 << 2) |
| Bitmask for drawing circle octant 2. | |
| #define | GFX_OCTANT3 (1 << 3) |
| Bitmask for drawing circle octant 3. | |
| #define | GFX_OCTANT4 (1 << 4) |
| Bitmask for drawing circle octant 4. | |
| #define | GFX_OCTANT5 (1 << 5) |
| Bitmask for drawing circle octant 5. | |
| #define | GFX_OCTANT6 (1 << 6) |
| Bitmask for drawing circle octant 6. | |
| #define | GFX_OCTANT7 (1 << 7) |
| Bitmask for drawing circle octant 7. | |
| #define | GFX_QUADRANT0 (GFX_OCTANT0 | GFX_OCTANT1) |
| Bitmask for drawing circle quadrant 0. | |
| #define | GFX_QUADRANT1 (GFX_OCTANT2 | GFX_OCTANT3) |
| Bitmask for drawing circle quadrant 1. | |
| #define | GFX_QUADRANT2 (GFX_OCTANT4 | GFX_OCTANT5) |
| Bitmask for drawing circle quadrant 2. | |
| #define | GFX_QUADRANT3 (GFX_OCTANT6 | GFX_OCTANT7) |
| Bitmask for drawing circle quadrant 3. | |
| #define | GFX_LEFTHALF (GFX_QUADRANT3 | GFX_QUADRANT0) |
| Bitmask for drawing left half of circle. | |
| #define | GFX_TOPHALF (GFX_QUADRANT0 | GFX_QUADRANT1) |
| Bitmask for drawing top half of circle. | |
| #define | GFX_RIGHTHALF (GFX_QUADRANT1 | GFX_QUADRANT2) |
| Bitmask for drawing right half of circle. | |
| #define | GFX_BOTTOMHALF (GFX_QUADRANT2 | GFX_QUADRANT3) |
| Bitmask for drawing bottom half of circle. | |
| #define | GFX_WHOLE 0xFF |
| Bitmask for drawing whole circle. | |
Flags for gfx_set_orientation() | |
| #define | GFX_FLIP_X 1 |
| Bitmask for flipping X for gfx_set_orientation. | |
| #define | GFX_FLIP_Y 2 |
| Bitmask for flipping Y for gfx_set_orientation. | |
| #define | GFX_SWITCH_XY 4 |
| Bitmask for swapping X and Y for gfx_set_orientation. | |
Enumerations | |
| enum | font_data_type { FONT_LOC_PROGMEM, FONT_LOC_HUGEMEM } |
Functions | |
| static uint_fast8_t | gfx_font_get_height (struct font *font) |
| Get scaled height of a font. | |
| static uint_fast8_t | gfx_font_get_width (struct font *font) |
| Get scaled width of a font. | |
Display driver management functions | |
| void | gfx_init (void) |
| Initialize the low-level graphics device driver. | |
| void | gfx_sync (void) |
| Synchronize access to the display. | |
Display Geometry | |
| void | gfx_set_orientation (uint8_t flags) |
| Change display orientation. | |
| gfx_coord_t | gfx_get_width (void) |
| Return the current width of the screen. | |
| gfx_coord_t | gfx_get_height (void) |
| Return the current height of the screen. | |
Display Clipping | |
The display driver uses software and hardware clipping. In the graphics drivers software clipping is referred to as clipping and hardware clipping as limits. Software clipping is used to ensure that nothing outside the set region is draw to the screen by any of the drawing functions. Eliminating unwanted drawing to the display will give a higher performance on displays which has a low bandwidth from the CPU. Software is enabled by the CONFIG_GFX_USE_CLIPPING configuration symbol. Clipping region is set with the gfx_set_clipping function. Hardware clipping is used in the supported display drivers to efficiently draw primitives on a subset of the display. Example: when drawing a filled rectangle the limits is set to the size of the rectangle, and the driver sends the correct number of pixels to fill the entire rectangle. Without hardware clipping/limits the driver will have to to move the graphics ram (GRAM) position/pointer manually. Hardware clipping/limits is not used like software clipping to eliminate drawing outside a given region. Hardware clipping is set with the gfx_set_top_left_limit, gfx_set_bottom_right_limit and gfx_set_limits functions. In display drivers that do not use hardware clipping these functions will not have any effect. | |
| void | gfx_set_clipping (gfx_coord_t min_x, gfx_coord_t min_y, gfx_coord_t max_x, gfx_coord_t max_y) |
| Set the clipping region. | |
| void | gfx_set_top_left_limit (gfx_coord_t x, gfx_coord_t y) |
| Set the top-left limit for the display. | |
| void | gfx_set_bottom_right_limit (gfx_coord_t x, gfx_coord_t y) |
| Set the bottom-right limit for the display. | |
| void | gfx_set_limits (gfx_coord_t x1, gfx_coord_t y1, gfx_coord_t x2, gfx_coord_t y2) |
| Set the limits for the display. | |
Low-level pixel drawing operations | |
| gfx_color_t | gfx_color (uint8_t r, uint8_t g, uint8_t b) |
| Generate native color value from R/G/B values. | |
| void | gfx_draw_pixel (gfx_coord_t x, gfx_coord_t y, gfx_color_t color) |
| Draw a single pixel on the screen. | |
| void | gfx_draw_line_pixel (gfx_coord_t x, gfx_coord_t y, gfx_color_t color) |
| Draw a single pixel on the screen (for lines, apparently). | |
| gfx_color_t | gfx_get_pixel (gfx_coord_t x, gfx_coord_t y) |
| Get the color of a pixel on the display. | |
| void | gfx_duplicate_pixel (gfx_color_t color, uint32_t count) |
| Draw multiple pixels all having the same color. | |
| void | gfx_copy_pixels_to_screen (const gfx_color_t *pixels, uint32_t count) |
| Copy a block of pixels from data memory to screen. | |
| void | gfx_copy_progmem_pixels_to_screen (const gfx_color_t __progmem_arg *pixels, uint32_t count) |
| Copy a block of pixels from program memory to screen. | |
| void | gfx_copy_hugemem_pixels_to_screen (const hugemem_ptr_t pixels, uint32_t count) |
| Copy a block of pixels from hugemem to screen. | |
| void | gfx_copy_pixels_from_screen (gfx_color_t *pixels, uint32_t count) |
| Copy a block of pixels from screen to data memory. | |
Graphics Drawing Primitives | |
| void | gfx_draw_char (char c, gfx_coord_t x, gfx_coord_t y, struct font *font, gfx_color_t color, gfx_color_t background_color) |
| Draws a character to the display. | |
| void | gfx_draw_string (char *str, gfx_coord_t x, gfx_coord_t y, struct font *font, gfx_color_t color, gfx_color_t background_color) |
| Draws a string to the display. | |
| void | gfx_draw_progmem_string (const char __progmem_arg *str, gfx_coord_t x, gfx_coord_t y, struct font *font, gfx_color_t color, gfx_color_t background_color) |
| void | gfx_get_string_bounding_box (char const *str, struct font *font, gfx_coord_t *width, gfx_coord_t *height) |
| Computes the bounding box of a string. | |
| void | gfx_get_progmem_string_bounding_box (const char __progmem_arg *str, struct font *font, gfx_coord_t *width, gfx_coord_t *height) |
| Computes the bounding box of a string stored in progmem. | |
Variables | |
Screen geometry and clipping variables | |
For internal use only. These global variables should not be accessed directly. They cannot be marked as private/static since they are shared within multiple C files of the graphics drivers. Use gfx_set_clipping to change clipping region. | |
| gfx_coord_t | gfx_min_x |
| Minimum X of current clipping region. | |
| gfx_coord_t | gfx_min_y |
| Maximum Y of current clipping region. | |
| gfx_coord_t | gfx_max_x |
| Minimum X of current clipping region. | |
| gfx_coord_t | gfx_max_y |
| Maximum Y of current clipping region. | |
| gfx_coord_t | gfx_width |
| Current width of screen. | |
| gfx_coord_t | gfx_height |
| Current height of screen. | |
Bitmap functions and structures | |
|
| |
| enum | gfx_bitmap_type { BITMAP_SOLID, BITMAP_RAM, BITMAP_PROGMEM } |
| void | gfx_draw_bitmap (const struct gfx_bitmap *bmp, gfx_coord_t x, gfx_coord_t y) |
| Draw a bitmap. | |
| void | gfx_draw_bitmap_tiled (const struct gfx_bitmap *bmp, gfx_coord_t x1, gfx_coord_t y1, gfx_coord_t x2, gfx_coord_t y2, gfx_coord_t tile_origin_x, gfx_coord_t tile_origin_y) |
| Draw a bitmap to the screen tiled to cover the output area. | |
| void | gfx_put_bitmap (const struct gfx_bitmap *bmp, gfx_coord_t map_x, gfx_coord_t map_y, gfx_coord_t x, gfx_coord_t y, gfx_coord_t width, gfx_coord_t height) |
| Write a rectangular block of pixels from a bitmap to the screen. | |
General graphics routines header file.
Copyright (C) 2009 - 2010 Atmel Corporation. All rights reserved.
Definition in file gfx.h.
1.6.3