diff options
Diffstat (limited to 'include/gdisp/gdisp.h')
-rw-r--r-- | include/gdisp/gdisp.h | 83 |
1 files changed, 43 insertions, 40 deletions
diff --git a/include/gdisp/gdisp.h b/include/gdisp/gdisp.h index ca1844fd..b82c9f3c 100644 --- a/include/gdisp/gdisp.h +++ b/include/gdisp/gdisp.h @@ -37,12 +37,6 @@ typedef int16_t coord_t; #if GFX_USE_GDISP || defined(__DOXYGEN__) /*===========================================================================*/ -/* Include the low level driver configuration information */ -/*===========================================================================*/ - -#include "gdisp_lld_config.h" - -/*===========================================================================*/ /* Type definitions */ /*===========================================================================*/ @@ -55,7 +49,11 @@ typedef struct point_t { /** * @brief Type for the text justification. */ -typedef enum justify {justifyLeft, justifyCenter, justifyRight} justify_t; +typedef enum justify { + justifyLeft = 0, + justifyCenter = 1, + justifyRight = 2 +} justify_t; /** * @brief Type for the font metric. */ @@ -63,7 +61,7 @@ typedef enum fontmetric {fontHeight, fontDescendersHeight, fontLineSpacing, font /** * @brief The type of a font. */ -typedef const struct font *font_t; +typedef const struct mf_font_s* font_t; /** * @brief Type for the screen orientation. */ @@ -476,35 +474,6 @@ extern "C" { void gdispFillArc(coord_t x, coord_t y, coord_t radius, coord_t startangle, coord_t endangle, color_t color); #endif - /* Basic Text Rendering Functions */ - - #if GDISP_NEED_TEXT || defined(__DOXYGEN__) - /** - * @brief Draw a text character. - * - * @param[in] x,y The position for the text - * @param[in] c The character to draw - * @param[in] font The font to use - * @param[in] color The color to use - * - * @api - */ - void gdispDrawChar(coord_t x, coord_t y, char c, font_t font, color_t color); - - /** - * @brief Draw a text character with a filled background. - * - * @param[in] x,y The position for the text - * @param[in] c The character to draw - * @param[in] font The font to use - * @param[in] color The color to use - * @param[in] bgcolor The background color to use - * - * @api - */ - void gdispFillChar(coord_t x, coord_t y, char c, font_t font, color_t color, color_t bgcolor); - #endif - /* Read a pixel Function */ #if GDISP_NEED_PIXELREAD || defined(__DOXYGEN__) @@ -587,8 +556,6 @@ extern "C" { #define gdispFillArc(x, y, radius, sangle, eangle, color) gdisp_lld_fill_arc(x, y, radius, sangle, eangle, color) #define gdispDrawEllipse(x, y, a, b, color) gdisp_lld_draw_ellipse(x, y, a, b, color) #define gdispFillEllipse(x, y, a, b, color) gdisp_lld_fill_ellipse(x, y, a, b, color) - #define gdispDrawChar(x, y, c, font, color) gdisp_lld_draw_char(x, y, c, font, color) - #define gdispFillChar(x, y, c, font, color, bgcolor) gdisp_lld_fill_char(x, y, c, font, color, bgcolor) #define gdispGetPixelColor(x, y) gdisp_lld_get_pixel_color(x, y) #define gdispVerticalScroll(x, y, cx, cy, lines, bgcolor) gdisp_lld_vertical_scroll(x, y, cx, cy, lines, bgcolor) #define gdispControl(what, value) gdisp_lld_control(what, value) @@ -648,10 +615,35 @@ void gdispDrawBox(coord_t x, coord_t y, coord_t cx, coord_t cy, color_t color); void gdispFillConvexPoly(coord_t tx, coord_t ty, const point *pntarray, unsigned cnt, color_t color); #endif -/* Extra Text Functions */ +/* Text Functions */ #if GDISP_NEED_TEXT || defined(__DOXYGEN__) /** + * @brief Draw a text character. + * + * @param[in] x,y The position for the text + * @param[in] c The character to draw + * @param[in] font The font to use + * @param[in] color The color to use + * + * @api + */ + void gdispDrawChar(coord_t x, coord_t y, uint16_t c, font_t font, color_t color); + + /** + * @brief Draw a text character with a filled background. + * + * @param[in] x,y The position for the text + * @param[in] c The character to draw + * @param[in] font The font to use + * @param[in] color The color to use + * @param[in] bgcolor The background color to use + * + * @api + */ + void gdispFillChar(coord_t x, coord_t y, uint16_t c, font_t font, color_t color, color_t bgcolor); + + /** * @brief Draw a text string. * * @param[in] x,y The position for the text @@ -762,6 +754,17 @@ void gdispDrawBox(coord_t x, coord_t y, coord_t cx, coord_t cy, color_t color); void gdispCloseFont(font_t font); /** + * @brief Make a scaled copy of an existing font. + * @details Allocates memory for new font metadata using gfxAlloc, remember to close font after use! + * @return A new font or NULL if out of memory. + * + * @param[in] font The base font to use. + * @param[in] scale_x The scale factor in horizontal direction. + * @param[in] scale_y The scale factor in vertical direction. + */ + font_t gdispScaleFont(font_t font, uint8_t scale_x, uint8_t scale_y); + + /** * @brief Get the name of the specified font. * @returns The name of the font. * |