version 2.8
GDISP

Detailed Description

Module to interface graphic / pixel oriented displays.

The GDISP module provides high level abstraction to interface pixel oriented graphic displays.

Precondition
GFX_USE_GDISP must be set to TRUE in gfxconf.h
Note
Each drawing routine supports a gdispXXXX and a gdispGXXXX function. The difference is that the gdispXXXX function does not require a display to be specified. Note there is a slight anomaly in the naming with gdispGBlitArea() vs gdispBlitAreaEx() and gdispBlitArea(), the latter of which is now deprecated.

Data Structures

struct  point
 Type for a 2D point on the screen. More...
 

Modules

 Colors
 Sub-Module for color handling.
 
 Image
 Sub-Module for image handling.
 
 Pixmap
 Sub-Module for dynamic framebuffers.
 

Functions

color_t gdispBlendColor (color_t fg, color_t bg, uint8_t alpha)
 Blend 2 colors according to the alpha. More...
 
color_t gdispContrastColor (color_t color)
 Find a contrasting color. More...
 
GDisplay * gdispGetDisplay (unsigned display)
 Get the specified display. More...
 
void gdispSetDisplay (GDisplay *g)
 Set the current default display to the specified display. More...
 
unsigned gdispGetDisplayCount (void)
 Get the count of currently active displays. More...
 
coord_t gdispGGetWidth (GDisplay *g)
 Get the display width in pixels. More...
 
coord_t gdispGGetHeight (GDisplay *g)
 Get the display height in pixels. More...
 
powermode_t gdispGGetPowerMode (GDisplay *g)
 Get the current display power mode. More...
 
orientation_t gdispGGetOrientation (GDisplay *g)
 Get the current display orientation. More...
 
uint8_t gdispGGetBacklight (GDisplay *g)
 Get the current display backlight brightness. More...
 
uint8_t gdispGGetContrast (GDisplay *g)
 Get the current display contrast. More...
 
void gdispGFlush (GDisplay *g)
 Flush current drawing operations to the display. More...
 
void gdispGClear (GDisplay *g, color_t color)
 Clear the display to the specified color. More...
 
void gdispGDrawPixel (GDisplay *g, coord_t x, coord_t y, color_t color)
 Set a pixel in the specified color. More...
 
void gdispGDrawLine (GDisplay *g, coord_t x0, coord_t y0, coord_t x1, coord_t y1, color_t color)
 Draw a line. More...
 
void gdispGFillArea (GDisplay *g, coord_t x, coord_t y, coord_t cx, coord_t cy, color_t color)
 Fill an area with a color. More...
 
void gdispGBlitArea (GDisplay *g, coord_t x, coord_t y, coord_t cx, coord_t cy, coord_t srcx, coord_t srcy, coord_t srccx, const pixel_t *buffer)
 Fill an area using the supplied bitmap. More...
 
void gdispGDrawBox (GDisplay *g, coord_t x, coord_t y, coord_t cx, coord_t cy, color_t color)
 Draw a rectangular box. More...
 
void gdispGStreamStart (GDisplay *g, coord_t x, coord_t y, coord_t cx, coord_t cy)
 Start a streaming operation. More...
 
void gdispGStreamColor (GDisplay *g, color_t color)
 Send pixel data to the stream. More...
 
void gdispGStreamStop (GDisplay *g)
 Finish the current streaming operation. More...
 
void gdispGSetClip (GDisplay *g, coord_t x, coord_t y, coord_t cx, coord_t cy)
 Clip all drawing to the defined area. More...
 
void gdispGDrawCircle (GDisplay *g, coord_t x, coord_t y, coord_t radius, color_t color)
 Draw a circle. More...
 
void gdispGFillCircle (GDisplay *g, coord_t x, coord_t y, coord_t radius, color_t color)
 Draw a filled circle. More...
 
void gdispGFillDualCircle (GDisplay *g, coord_t x, coord_t y, coord_t radius1, color_t color1, coord_t radius2, color_t color2)
 Draw two filled circles with the same centre. More...
 
void gdispGDrawEllipse (GDisplay *g, coord_t x, coord_t y, coord_t a, coord_t b, color_t color)
 Draw an ellipse. More...
 
void gdispGFillEllipse (GDisplay *g, coord_t x, coord_t y, coord_t a, coord_t b, color_t color)
 Draw a filled ellipse. More...
 
void gdispGDrawArcSectors (GDisplay *g, coord_t x, coord_t y, coord_t radius, uint8_t sectors, color_t color)
 Draw a selection of 45 degree arcs of a circle. More...
 
void gdispGFillArcSectors (GDisplay *g, coord_t x, coord_t y, coord_t radius, uint8_t sectors, color_t color)
 Fill a selection of 45 degree arcs of a circle. More...
 
void gdispGDrawArc (GDisplay *g, coord_t x, coord_t y, coord_t radius, coord_t startangle, coord_t endangle, color_t color)
 Draw an arc. More...
 
void gdispGDrawThickArc (GDisplay *g, coord_t xc, coord_t yc, coord_t startradius, coord_t endradius, coord_t startangle, coord_t endangle, color_t color)
 Draw a thick arc. More...
 
void gdispGFillArc (GDisplay *g, coord_t x, coord_t y, coord_t radius, coord_t startangle, coord_t endangle, color_t color)
 Draw a filled arc. More...
 
color_t gdispGGetPixelColor (GDisplay *g, coord_t x, coord_t y)
 Get the color of a pixel. More...
 
void gdispGVerticalScroll (GDisplay *g, coord_t x, coord_t y, coord_t cx, coord_t cy, int lines, color_t bgcolor)
 Scroll vertically a section of the screen. More...
 
void gdispGControl (GDisplay *g, unsigned what, void *value)
 Control hardware specific parts of the display. eg powermodes, backlight etc. More...
 
void * gdispGQuery (GDisplay *g, unsigned what)
 Query a property of the display. More...
 
void gdispGDrawPoly (GDisplay *g, coord_t tx, coord_t ty, const point *pntarray, unsigned cnt, color_t color)
 Draw an enclosed polygon (convex, non-convex or complex). More...
 
void gdispGFillConvexPoly (GDisplay *g, coord_t tx, coord_t ty, const point *pntarray, unsigned cnt, color_t color)
 Fill a convex polygon. More...
 
void gdispGDrawThickLine (GDisplay *g, coord_t x0, coord_t y0, coord_t x1, coord_t y1, color_t color, coord_t width, bool_t round)
 Draw a line with a specified thickness. More...
 
void gdispGDrawChar (GDisplay *g, coord_t x, coord_t y, uint16_t c, font_t font, color_t color)
 Draw a text character. More...
 
void gdispGFillChar (GDisplay *g, coord_t x, coord_t y, uint16_t c, font_t font, color_t color, color_t bgcolor)
 Draw a text character with a filled background. More...
 
void gdispGDrawString (GDisplay *g, coord_t x, coord_t y, const char *str, font_t font, color_t color)
 Draw a text string. More...
 
void gdispGFillString (GDisplay *g, coord_t x, coord_t y, const char *str, font_t font, color_t color, color_t bgcolor)
 Draw a text string. More...
 
void gdispGDrawStringBox (GDisplay *g, coord_t x, coord_t y, coord_t cx, coord_t cy, const char *str, font_t font, color_t color, justify_t justify)
 Draw a text string vertically centered within the specified box. More...
 
void gdispGFillStringBox (GDisplay *g, coord_t x, coord_t y, coord_t cx, coord_t cy, const char *str, font_t font, color_t color, color_t bgColor, justify_t justify)
 Draw a text string vertically centered within the specified box. The box background is filled with the specified background color. More...
 
coord_t gdispGetFontMetric (font_t font, fontmetric_t metric)
 Get a metric of a font. More...
 
coord_t gdispGetCharWidth (char c, font_t font)
 Get the pixel width of a character. More...
 
coord_t gdispGetStringWidthCount (const char *str, font_t font, uint16_t count)
 Get the pixel width of a string of a given character length. More...
 
coord_t gdispGetStringWidth (const char *str, font_t font)
 Get the pixel width of an entire string. More...
 
font_t gdispOpenFont (const char *name)
 Find a font and return it. More...
 
void gdispCloseFont (font_t font)
 Release a font after use. More...
 
font_t gdispScaleFont (font_t font, uint8_t scale_x, uint8_t scale_y)
 Make a scaled copy of an existing font. More...
 
const char * gdispGetFontName (font_t font)
 Get the name of the specified font. More...
 
bool_t gdispAddFont (font_t font)
 Add a font permanently to the font list. More...
 
void gdispGDrawRoundedBox (GDisplay *g, coord_t x, coord_t y, coord_t cx, coord_t cy, coord_t radius, color_t color)
 Draw a rectangular box with rounded corners. More...
 
void gdispGFillRoundedBox (GDisplay *g, coord_t x, coord_t y, coord_t cx, coord_t cy, coord_t radius, color_t color)
 Draw a filled rectangular box with rounded corners. More...
 

Variables

GDisplay * GDISP
 The default screen to use for the gdispXXXX calls. More...
 

GDISP Functionality to be included

#define GDISP_NEED_AUTOFLUSH   FALSE
 Should drawing operations be automatically flushed. More...
 
#define GDISP_NEED_TIMERFLUSH   FALSE
 Should drawing operations be automatically flushed on a timer. More...
 
#define GDISP_NEED_VALIDATION   TRUE
 Should all operations be clipped to the screen and colors validated. More...
 
#define GDISP_NEED_CLIP   TRUE
 Are clipping functions needed. More...
 
#define GDISP_NEED_STREAMING   FALSE
 Streaming functions are needed. More...
 
#define GDISP_NEED_TEXT   FALSE
 Are text functions needed. More...
 
#define GDISP_NEED_CIRCLE   FALSE
 Are circle functions needed. More...
 
#define GDISP_NEED_DUALCIRCLE   FALSE
 Are dual circle functions needed (one circle inside another). More...
 
#define GDISP_NEED_ELLIPSE   FALSE
 Are ellipse functions needed. More...
 
#define GDISP_NEED_ARCSECTORS   FALSE
 Are arc sector functions needed. More...
 
#define GDISP_NEED_ARC   FALSE
 Are arc functions needed. More...
 
#define GDISP_NEED_CONVEX_POLYGON   FALSE
 Are convex polygon functions needed. More...
 
#define GDISP_NEED_SCROLL   FALSE
 Are scrolling functions needed. More...
 
#define GDISP_NEED_PIXELREAD   FALSE
 Is the capability to read pixels back needed. More...
 
#define GDISP_NEED_CONTROL   FALSE
 Control some aspect of the hardware operation. More...
 
#define GDISP_NEED_QUERY   FALSE
 Query some aspect of the hardware operation. More...
 
#define GDISP_NEED_IMAGE   FALSE
 Is the image interface required. More...
 
#define GDISP_NEED_PIXMAP   FALSE
 Is the image interface required. More...
 

GDISP Multi-Threading Options

#define GDISP_NEED_MULTITHREAD   FALSE
 Do the drawing functions need to be thread-safe. More...
 

GDISP Optional Parameters

#define GDISP_NEED_STARTUP_LOGO   TRUE
 Should the startup logo be displayed. More...
 
#define GDISP_STARTUP_COLOR   Black
 Define the initial background color for all displays in the system. More...
 
#define GDISP_LINEBUF_SIZE   128
 Define the default orientation for all displays in the system. More...
 

GDISP Multiple Display Support

#define GDISP_TOTAL_DISPLAYS   1
 The total number of displays using the default driver. More...
 
#define GDISP_DRIVER_LIST   GDISPVMT_Win32, GDISPVMT_SSD1963
 The list of display drivers. More...
 

GDISP Image Options

Precondition
GDISP_NEED_IMAGE must be TRUE
#define GDISP_NEED_IMAGE_NATIVE   FALSE
 Is native image decoding required. More...
 
#define GDISP_NEED_IMAGE_GIF   FALSE
 Is GIF image decoding required. More...
 
#define GDISP_NEED_IMAGE_BMP   FALSE
 Is BMP image decoding required. More...
 
#define GDISP_NEED_IMAGE_JPG   FALSE
 Is JPG image decoding required. More...
 
#define GDISP_NEED_IMAGE_PNG   FALSE
 Is PNG image decoding required. More...
 
#define GDISP_NEED_IMAGE_ACCOUNTING   FALSE
 Is memory accounting required during image decoding. More...
 

GDISP BMP Image Options

Precondition
GDISP_NEED_IMAGE and GDISP_NEED_IMAGE_BMP must be TRUE
#define GDISP_NEED_IMAGE_BMP_1   TRUE
 Is BMP 1 bit per pixel (monochrome/2 color) image decoding required. More...
 
#define GDISP_NEED_IMAGE_BMP_4   TRUE
 Is BMP 4 bits per pixel (16 color) image decoding required. More...
 
#define GDISP_NEED_IMAGE_BMP_4_RLE   TRUE
 Is BMP 4 bits per pixel (16 color) with RLE compression image decoding required. More...
 
#define GDISP_NEED_IMAGE_BMP_8   TRUE
 Is BMP 8 bits per pixel (256 color) image decoding required. More...
 
#define GDISP_NEED_IMAGE_BMP_8_RLE   TRUE
 Is BMP 8 bits per pixel (256 color) with RLE compression image decoding required. More...
 
#define GDISP_NEED_IMAGE_BMP_16   TRUE
 Is BMP 16 bits per pixel (65536 color) image decoding required. More...
 
#define GDISP_NEED_IMAGE_BMP_24   TRUE
 Is BMP 24 bits per pixel (true-color) image decoding required. More...
 
#define GDISP_NEED_IMAGE_BMP_32   TRUE
 Is BMP 32 bits per pixel (true-color) image decoding required. More...
 
#define GDISP_IMAGE_BMP_BLIT_BUFFER_SIZE   32
 The BMP blit buffer size. More...
 

GDISP GIF Image Options

Precondition
GDISP_NEED_IMAGE and GDISP_NEED_IMAGE_GIF must be TRUE
#define GDISP_IMAGE_GIF_BLIT_BUFFER_SIZE   32
 The GIF blit buffer size. More...
 

GDISP PNG Image Options

Precondition
GDISP_NEED_IMAGE and GDISP_NEED_IMAGE_PNG must be TRUE
#define GDISP_NEED_IMAGE_PNG_INTERLACED   FALSE
 Is PNG Interlaced image decoding required. More...
 
#define GDISP_NEED_IMAGE_PNG_TRANSPARENCY   TRUE
 Is PNG image transparency processed. More...
 
#define GDISP_NEED_IMAGE_PNG_BACKGROUND   TRUE
 Is PNG background data processed. More...
 
#define GDISP_NEED_IMAGE_PNG_ALPHACLIFF   32
 What is the cliff between non-blended alpha pixels being displayed or not. More...
 
#define GDISP_NEED_IMAGE_PNG_PALETTE_124   TRUE
 Is 1, 2 and 4 bit PNG palettized image decoding required. More...
 
#define GDISP_NEED_IMAGE_PNG_PALETTE_8   TRUE
 Is 8 bit PNG palettized image decoding required. More...
 
#define GDISP_NEED_IMAGE_PNG_GRAYSCALE_124   TRUE
 Is 1,2 and 4 bit PNG grayscale image decoding required. More...
 
#define GDISP_NEED_IMAGE_PNG_GRAYSCALE_8   TRUE
 Is 8 bit PNG grayscale image decoding required. More...
 
#define GDISP_NEED_IMAGE_PNG_GRAYSCALE_16   TRUE
 Is 16 bit PNG grayscale image decoding required. More...
 
#define GDISP_NEED_IMAGE_PNG_GRAYALPHA_8   TRUE
 Is 8 bit PNG grayscale with 8 bit alpha image decoding required. More...
 
#define GDISP_NEED_IMAGE_PNG_GRAYALPHA_16   TRUE
 Is 16 bit PNG grayscale with 16 bit alpha image decoding required. More...
 
#define GDISP_NEED_IMAGE_PNG_RGB_8   TRUE
 Is 8/8/8 bit PNG RGB image decoding required. More...
 
#define GDISP_NEED_IMAGE_PNG_RGB_16   TRUE
 Is 16/16/16 bit PNG RGB image decoding required. More...
 
#define GDISP_NEED_IMAGE_PNG_RGBALPHA_8   TRUE
 Is 8/8/8 bit PNG RGB with 8 bit alpha image decoding required. More...
 
#define GDISP_NEED_IMAGE_PNG_RGBALPHA_16   TRUE
 Is 16/16/16 bit PNG RGB with 16 bit alpha image decoding required. More...
 
#define GDISP_IMAGE_PNG_BLIT_BUFFER_SIZE   32
 The PNG blit buffer size in pixels. More...
 
#define GDISP_IMAGE_PNG_FILE_BUFFER_SIZE   8
 The PNG input file buffer size in bytes. More...
 
#define GDISP_IMAGE_PNG_Z_BUFFER_SIZE   32768
 The PNG inflate decompression buffer size in bytes. More...
 

GDISP Text Rendering Options

#define GDISP_NEED_TEXT_WORDWRAP   FALSE
 Enable advanced word-wrapping. More...
 
#define GDISP_NEED_TEXT_BOXPADLR   1
 Adding pixels to the left and right side of the box to pad text. More...
 
#define GDISP_NEED_TEXT_BOXPADTB   1
 Adding pixels to the top and bottom side of the box to pad text. More...
 
#define GDISP_NEED_UTF8   FALSE
 Enable UTF-8 support for text rendering. More...
 
#define GDISP_NEED_TEXT_KERNING   FALSE
 Enable kerning for font rendering (improves character placement). More...
 
#define GDISP_NEED_ANTIALIAS   FALSE
 Enable antialiased font support. More...
 

GDISP Pixmap Options

#define GDISP_NEED_PIXMAP_IMAGE   FALSE
 

Macros

#define GDISP_CONTROL_POWER   0
 Driver Control Constants. More...
 
#define gdispGSetPowerMode(g, powerMode)   gdispGControl((g), GDISP_CONTROL_POWER, (void *)(unsigned)(powerMode))
 Set the display power mode. More...
 
#define gdispGSetOrientation(g, newOrientation)   gdispGControl((g), GDISP_CONTROL_ORIENTATION, (void *)(unsigned)(newOrientation))
 Set the display orientation. More...
 
#define gdispGSetBacklight(g, percent)   gdispGControl((g), GDISP_CONTROL_BACKLIGHT, (void *)(unsigned)(percent))
 Set the display backlight. More...
 
#define gdispGSetContrast(g, percent)   gdispGControl((g), GDISP_CONTROL_CONTRAST, (void *)(unsigned)(percent))
 Set the display contrast. More...
 
#define gdispGUnsetClip(g)   gdispGSetClip((g),0,0,gdispGGetWidth(g),gdispGGetHeight(g))
 Reset the clip area to the full screen. More...
 

Typedefs

typedef int16_t coord_t
 The type for a coordinate or length on the screen. More...
 
typedef const struct mf_font_s * font_t
 The type of a font. More...
 
typedef color_t pixel_t
 The pixel format. More...
 

Enumerations

Function Documentation

bool_t gdispAddFont ( font_t  font)

Add a font permanently to the font list.

Returns
TRUE on success. Reasons it may fail: out of memory, if it is already on the list, it is not a font loaded in RAM.
Precondition
GDISP_NEED_TEXT must be TRUE in your gfxconf.h
Parameters
[in]fontThe font to add to the font list.
Function Class:
Normal API, this function can be invoked by regular system threads.
color_t gdispBlendColor ( color_t  fg,
color_t  bg,
uint8_t  alpha 
)

Blend 2 colors according to the alpha.

Returns
The combined color
Parameters
[in]fgThe foreground color
[in]bgThe background color
[in]alphaThe alpha value (0-255). 0 is all background, 255 is all foreground.
Function Class:
Normal API, this function can be invoked by regular system threads.

Referenced by gwinCheckboxDraw_Button().

void gdispCloseFont ( font_t  font)

Release a font after use.

Precondition
GDISP_NEED_TEXT must be TRUE in your gfxconf.h
Parameters
[in]fontThe font to release.
Function Class:
Normal API, this function can be invoked by regular system threads.
color_t gdispContrastColor ( color_t  color)

Find a contrasting color.

Returns
The contrasting color
Parameters
[in]colorThe color to contrast
Function Class:
Normal API, this function can be invoked by regular system threads.
void gdispGBlitArea ( GDisplay *  g,
coord_t  x,
coord_t  y,
coord_t  cx,
coord_t  cy,
coord_t  srcx,
coord_t  srcy,
coord_t  srccx,
const pixel_t buffer 
)

Fill an area using the supplied bitmap.

The bitmap is in the pixel format specified by the low level driver

Note
If a packed pixel format is used and the width doesn't match a whole number of bytes, the next line will start on a non-byte boundary (no end-of-line padding).
If GDISP_NEED_ASYNC is defined then the buffer must be static or at least retained until this call has finished the blit. You can tell when all graphics drawing is finished by gdispIsBusy() going FALSE.
Parameters
[in]gThe display to use
[in]x,yThe start position
[in]cx,cyThe size of the filled area
[in]srcx,srcyThe bitmap position to start the fill form
[in]srccxThe width of a line in the bitmap
[in]bufferThe bitmap in the driver's pixel format
Function Class:
Normal API, this function can be invoked by regular system threads.
void gdispGClear ( GDisplay *  g,
color_t  color 
)

Clear the display to the specified color.

Parameters
[in]gThe display to use
[in]colorThe color to use when clearing the screen
Function Class:
Normal API, this function can be invoked by regular system threads.
void gdispGControl ( GDisplay *  g,
unsigned  what,
void *  value 
)

Control hardware specific parts of the display. eg powermodes, backlight etc.

Precondition
GDISP_NEED_CONTROL must be TRUE in your gfxconf.h
Note
Depending on the hardware implementation this function may not support some codes. They will be ignored.
Parameters
[in]gThe display to use
[in]whatwhat you want to control
[in]valueThe value to be assigned
Function Class:
Normal API, this function can be invoked by regular system threads.
void gdispGDrawArc ( GDisplay *  g,
coord_t  x,
coord_t  y,
coord_t  radius,
coord_t  startangle,
coord_t  endangle,
color_t  color 
)

Draw an arc.

Precondition
GDISP_NEED_ARC must be TRUE in your gfxconf.h
Parameters
[in]gThe display to use
[in]x,yThe center point
[in]radiusThe radius of the arc
[in]startangleThe start angle (0 to 360)
[in]endangleThe end angle (0 to 360)
[in]colorThe color of the arc
Note
If you are just doing 45 degree angles consider using gdispDrawArcSectors() instead.
This routine requires trig support. It can either come from your C runtime library cos() and sin() which requires floating point support (and is slow), or you can define GFX_USE_GMISC and either GMISC_NEED_FIXEDTRIG or GMISC_NEED_FASTTRIG. GMISC_NEED_FASTTRIG uses table based floating point trig operations. GMISC_NEED_FIXEDTRIG uses fixed point integer trig operations. Note accuracy on both the table based options are more than adequate for the one degree resolution provided by these arc routines. Both are much faster than your C runtime library.
Function Class:
Normal API, this function can be invoked by regular system threads.
void gdispGDrawArcSectors ( GDisplay *  g,
coord_t  x,
coord_t  y,
coord_t  radius,
uint8_t  sectors,
color_t  color 
)

Draw a selection of 45 degree arcs of a circle.

Precondition
GDISP_NEED_ARCSECTORS must be TRUE in your gfxconf.h
Parameters
[in]gThe display to use
[in]x,yThe center of the circle
[in]radiusThe radius of the circle
[in]sectorsBits determine which sectors are drawn. Bits go anti-clockwise from the 0 degree mark (y = 0, x is positive), as follows: bit 0 - upper right right --— bit 1 - upper upper right /2 1\ bit 2 - upper upper left /3 0\ bit 3 - upper left left \4 7/ bit 4 - lower left left \5 6/ bit 5 - lower lower left --— bit 6 - lower lower right bit 7 - lower left left
[in]colorThe color to use
Note
This is a more limited versions of the general arc drawing routine. It doesn't require trig libraries or tables or floating point and is smaller in code size. There is probably little point in including both this and the general arc routine as the general arc routine can do everything this can do.
Function Class:
Normal API, this function can be invoked by regular system threads.
void gdispGDrawBox ( GDisplay *  g,
coord_t  x,
coord_t  y,
coord_t  cx,
coord_t  cy,
color_t  color 
)

Draw a rectangular box.

Parameters
[in]gThe display to use
[in]x,yThe start position
[in]cx,cyThe size of the box (outside dimensions)
[in]colorThe color to use
Function Class:
Normal API, this function can be invoked by regular system threads.

Referenced by gwinCheckboxDraw_CheckOnLeft(), gwinCheckboxDraw_CheckOnRight(), gwinProgressbarDraw_Std(), and gwinSliderDraw_Std().

void gdispGDrawChar ( GDisplay *  g,
coord_t  x,
coord_t  y,
uint16_t  c,
font_t  font,
color_t  color 
)

Draw a text character.

Precondition
GDISP_NEED_TEXT must be TRUE in your gfxconf.h
Parameters
[in]gThe display to use
[in]x,yThe position for the text
[in]cThe character to draw
[in]fontThe font to use
[in]colorThe color to use
Function Class:
Normal API, this function can be invoked by regular system threads.
void gdispGDrawCircle ( GDisplay *  g,
coord_t  x,
coord_t  y,
coord_t  radius,
color_t  color 
)

Draw a circle.

Precondition
GDISP_NEED_CIRCLE must be TRUE in your gfxconf.h
Parameters
[in]gThe display to use
[in]x,yThe center of the circle
[in]radiusThe radius of the circle
[in]colorThe color to use
Function Class:
Normal API, this function can be invoked by regular system threads.
void gdispGDrawEllipse ( GDisplay *  g,
coord_t  x,
coord_t  y,
coord_t  a,
coord_t  b,
color_t  color 
)

Draw an ellipse.

Precondition
GDISP_NEED_ELLIPSE must be TRUE in your gfxconf.h
Parameters
[in]gThe display to use
[in]x,yThe center of the ellipse
[in]a,bThe dimensions of the ellipse
[in]colorThe color to use
Function Class:
Normal API, this function can be invoked by regular system threads.
void gdispGDrawLine ( GDisplay *  g,
coord_t  x0,
coord_t  y0,
coord_t  x1,
coord_t  y1,
color_t  color 
)

Draw a line.

Parameters
[in]gThe display to use
[in]x0,y0The start position
[in]x1,y1The end position
[in]colorThe color to use
Function Class:
Normal API, this function can be invoked by regular system threads.

Referenced by gwinCheckboxDraw_Button(), gwinCheckboxDraw_CheckOnRight(), gwinProgressbarDraw_Std(), and gwinSliderDraw_Std().

void gdispGDrawPixel ( GDisplay *  g,
coord_t  x,
coord_t  y,
color_t  color 
)

Set a pixel in the specified color.

Parameters
[in]gThe display to use
[in]x,yThe position to set the pixel.
[in]colorThe color to use
Function Class:
Normal API, this function can be invoked by regular system threads.
void gdispGDrawPoly ( GDisplay *  g,
coord_t  tx,
coord_t  ty,
const point pntarray,
unsigned  cnt,
color_t  color 
)

Draw an enclosed polygon (convex, non-convex or complex).

Precondition
GDISP_NEED_CONVEX_POLYGON must be TRUE in your gfxconf.h
Parameters
[in]gThe display to use
[in]tx,tyTransform all points in pntarray by tx, ty
[in]pntarrayAn array of points
[in]cntThe number of points in the array
[in]colorThe color to use
Function Class:
Normal API, this function can be invoked by regular system threads.
void gdispGDrawRoundedBox ( GDisplay *  g,
coord_t  x,
coord_t  y,
coord_t  cx,
coord_t  cy,
coord_t  radius,
color_t  color 
)

Draw a rectangular box with rounded corners.

Precondition
GDISP_NEED_ARC or GDISP_NEED_ARCSECTORS must be TRUE in your gfxconf.h
Parameters
[in]gThe display to use
[in]x,yThe start position
[in]cx,cyThe size of the box (outside dimensions)
[in]radiusThe radius of the rounded corners
[in]colorThe color to use
Function Class:
Normal API, this function can be invoked by regular system threads.
void gdispGDrawString ( GDisplay *  g,
coord_t  x,
coord_t  y,
const char *  str,
font_t  font,
color_t  color 
)

Draw a text string.

Precondition
GDISP_NEED_TEXT must be TRUE in your gfxconf.h
Parameters
[in]gThe display to use
[in]x,yThe position for the text
[in]strThe string to draw
[in]fontThe font to use
[in]colorThe color to use
Function Class:
Normal API, this function can be invoked by regular system threads.
void gdispGDrawStringBox ( GDisplay *  g,
coord_t  x,
coord_t  y,
coord_t  cx,
coord_t  cy,
const char *  str,
font_t  font,
color_t  color,
justify_t  justify 
)

Draw a text string vertically centered within the specified box.

Precondition
GDISP_NEED_TEXT must be TRUE in your gfxconf.h
Parameters
[in]gThe display to use
[in]x,yThe position for the text (need to define top-right or base-line - check code)
[in]cx,cyThe width and height of the box
[in]strThe string to draw
[in]fontThe font to use
[in]colorThe color to use
[in]justifyJustify the text left, center or right within the box
Function Class:
Normal API, this function can be invoked by regular system threads.

Referenced by gwinCheckboxDraw_Button(), gwinProgressbarDraw_Std(), and gwinSliderDraw_Std().

void gdispGDrawThickArc ( GDisplay *  g,
coord_t  xc,
coord_t  yc,
coord_t  startradius,
coord_t  endradius,
coord_t  startangle,
coord_t  endangle,
color_t  color 
)

Draw a thick arc.

Precondition
GDISP_NEED_ARC must be TRUE in your gfxconf.h
Parameters
[in]gThe display to use
[in]xc,ycThe center point
[in]startradiusThe inner radius of the thick arc
[in]endradiusThe outer radius of the thick arc
[in]startangleThe start angle (0 to 360)
[in]endangleThe end angle (0 to 360)
[in]colorThe color of the arc
Note
This routine requires trig support. It can either come from your C runtime library cos() and sin() which requires floating point support (and is slow), or you can define GFX_USE_GMISC and either GMISC_NEED_FIXEDTRIG or GMISC_NEED_FASTTRIG. GMISC_NEED_FASTTRIG uses table based floating point trig operations. GMISC_NEED_FIXEDTRIG uses fixed point integer trig operations. Note accuracy on both the table based options are more than adequate for the one degree resolution provided by these arc routines. Both are much faster than your C runtime library.
Function Class:
Normal API, this function can be invoked by regular system threads.
void gdispGDrawThickLine ( GDisplay *  g,
coord_t  x0,
coord_t  y0,
coord_t  x1,
coord_t  y1,
color_t  color,
coord_t  width,
bool_t  round 
)

Draw a line with a specified thickness.

The line thickness is specified in pixels. The line ends can be selected to be either flat or round.

Precondition
GDISP_NEED_CONVEX_POLYGON must be TRUE in your gfxconf.h
Note
Uses gdispGFillConvexPoly() internally to perform the drawing.
Parameters
[in]gThe display to use
[in]x0,y0The start position
[in]x1,y1The end position
[in]colorThe color to use
[in]widthThe width of the line
[in]roundUse round ends for the line
Function Class:
Normal API, this function can be invoked by regular system threads.
coord_t gdispGetCharWidth ( char  c,
font_t  font 
)

Get the pixel width of a character.

Returns
The width of the character in pixels. Does not include any between character padding.
Precondition
GDISP_NEED_TEXT must be TRUE in your gfxconf.h
Parameters
[in]cThe character to draw
[in]fontThe font to use
Function Class:
Normal API, this function can be invoked by regular system threads.
GDisplay* gdispGetDisplay ( unsigned  display)

Get the specified display.

Returns
The pointer to the display or NULL if the display doesn't exist
Note
The GDISP variable contains the display used by the gdispXxxx routines as opposed to the gdispGXxxx routines which take an explicit display parameter.
Displays are numbered from 0 to gdispGetDisplayCount() - 1
Parameters
[in]displayThe display number (0..n)
Function Class:
Normal API, this function can be invoked by regular system threads.
unsigned gdispGetDisplayCount ( void  )

Get the count of currently active displays.

Returns
The count of displays currently in the system
Note
Displays are numbered from 0 to gdispGetDisplayCount() - 1
coord_t gdispGetFontMetric ( font_t  font,
fontmetric_t  metric 
)

Get a metric of a font.

Returns
The metric requested in pixels.
Precondition
GDISP_NEED_TEXT must be TRUE in your gfxconf.h
Parameters
[in]fontThe font to test
[in]metricThe metric to measure
Function Class:
Normal API, this function can be invoked by regular system threads.
const char* gdispGetFontName ( font_t  font)

Get the name of the specified font.

Returns
The name of the font.
Precondition
GDISP_NEED_TEXT must be TRUE in your gfxconf.h
Parameters
[in]fontThe font to get the name for.
Function Class:
Normal API, this function can be invoked by regular system threads.
coord_t gdispGetStringWidth ( const char *  str,
font_t  font 
)

Get the pixel width of an entire string.

Returns
The width of the string in pixels.
Precondition
GDISP_NEED_TEXT must be TRUE in your gfxconf.h
Parameters
[in]strThe string to measure
[in]fontThe font to use
Function Class:
Normal API, this function can be invoked by regular system threads.
coord_t gdispGetStringWidthCount ( const char *  str,
font_t  font,
uint16_t  count 
)

Get the pixel width of a string of a given character length.

Returns
The width of the string in pixels.
Precondition
GDISP_NEED_TEXT must be TRUE in your gfxconf.h
Note
Passing 0 to count has the same effect as calling gdispGetStringWidt()
Parameters
[in]strThe string to measure
[in]fontThe font to use
[in]countThe number of characters to take into account
Function Class:
Normal API, this function can be invoked by regular system threads.
void gdispGFillArc ( GDisplay *  g,
coord_t  x,
coord_t  y,
coord_t  radius,
coord_t  startangle,
coord_t  endangle,
color_t  color 
)

Draw a filled arc.

Precondition
GDISP_NEED_ARC must be TRUE in your gfxconf.h
Parameters
[in]gThe display to use
[in]x,yThe center point
[in]radiusThe radius of the arc
[in]startangleThe start angle (0 to 360)
[in]endangleThe end angle (0 to 360)
[in]colorThe color of the arc
Note
If you are just doing 45 degree angles consider using gdispFillArcSectors() instead.
This routine requires trig support. It can either come from your C runtime library cos() and sin() which requires floating point support (and is slow), or you can define GFX_USE_GMISC and either GMISC_NEED_FIXEDTRIG or GMISC_NEED_FASTTRIG. GMISC_NEED_FASTTRIG uses table based floating point trig operations. GMISC_NEED_FIXEDTRIG uses fixed point integer trig operations. Note accuracy on both the table based options are more than adequate for the one degree resolution provided by these arc routines. Both are much faster than your C runtime library.
Function Class:
Normal API, this function can be invoked by regular system threads.
void gdispGFillArcSectors ( GDisplay *  g,
coord_t  x,
coord_t  y,
coord_t  radius,
uint8_t  sectors,
color_t  color 
)

Fill a selection of 45 degree arcs of a circle.

Precondition
GDISP_NEED_ARCSECTORS must be TRUE in your gfxconf.h
Parameters
[in]gThe display to use
[in]x,yThe center of the circle
[in]radiusThe radius of the circle
[in]sectorsBits determine which sectors are drawn. Bits go anti-clockwise from the 0 degree mark (y = 0, x is positive), as follows: bit 0 - upper right right --— bit 1 - upper upper right /2 1\ bit 2 - upper upper left /3 0\ bit 3 - upper left left \4 7/ bit 4 - lower left left \5 6/ bit 5 - lower lower left --— bit 6 - lower lower right bit 7 - lower left left
[in]colorThe color to use
Note
This is a more limited versions of the general arc filling routine. It doesn't require trig libraries or tables or floating point and is smaller in code size. There is probably little point in including both this and the general arc routine as the general arc routine can do everything this can do.
Function Class:
Normal API, this function can be invoked by regular system threads.
void gdispGFillArea ( GDisplay *  g,
coord_t  x,
coord_t  y,
coord_t  cx,
coord_t  cy,
color_t  color 
)

Fill an area with a color.

Parameters
[in]gThe display to use
[in]x,yThe start position
[in]cx,cyThe size of the box (outside dimensions)
[in]colorThe color to use
Function Class:
Normal API, this function can be invoked by regular system threads.

Referenced by gwinCheckboxDraw_CheckOnLeft(), gwinCheckboxDraw_CheckOnRight(), gwinProgressbarDraw_Std(), and gwinSliderDraw_Std().

void gdispGFillChar ( GDisplay *  g,
coord_t  x,
coord_t  y,
uint16_t  c,
font_t  font,
color_t  color,
color_t  bgcolor 
)

Draw a text character with a filled background.

Precondition
GDISP_NEED_TEXT must be TRUE in your gfxconf.h
Parameters
[in]gThe display to use
[in]x,yThe position for the text
[in]cThe character to draw
[in]fontThe font to use
[in]colorThe color to use
[in]bgcolorThe background color to use
Function Class:
Normal API, this function can be invoked by regular system threads.
void gdispGFillCircle ( GDisplay *  g,
coord_t  x,
coord_t  y,
coord_t  radius,
color_t  color 
)

Draw a filled circle.

Precondition
GDISP_NEED_CIRCLE must be TRUE in your gfxconf.h
Parameters
[in]gThe display to use
[in]x,yThe center of the circle
[in]radiusThe radius of the circle
[in]colorThe color to use
Function Class:
Normal API, this function can be invoked by regular system threads.
void gdispGFillConvexPoly ( GDisplay *  g,
coord_t  tx,
coord_t  ty,
const point pntarray,
unsigned  cnt,
color_t  color 
)

Fill a convex polygon.

Doesn't handle non-convex or complex polygons.

Precondition
GDISP_NEED_CONVEX_POLYGON must be TRUE in your gfxconf.h
Parameters
[in]gThe display to use
[in]tx,tyTransform all points in pntarray by tx, ty
[in]pntarrayAn array of points
[in]cntThe number of points in the array
[in]colorThe color to use
Note
Convex polygons are those that have no internal angles. That is; you can draw a line from any point on the polygon to any other point on the polygon without it going outside the polygon. In our case we generalise this a little by saying that an infinite horizontal line (at any y value) will cross no more than two edges on the polygon. Some non-convex polygons do fit this criteria and can therefore be drawn.
This routine is designed to be very efficient with even simple display hardware.
Function Class:
Normal API, this function can be invoked by regular system threads.
void gdispGFillDualCircle ( GDisplay *  g,
coord_t  x,
coord_t  y,
coord_t  radius1,
color_t  color1,
coord_t  radius2,
color_t  color2 
)

Draw two filled circles with the same centre.

Precondition
GDISP_NEED_DUALCIRCLE must be TRUE in your gfxconf.h
Parameters
[in]gThe display to use
[in]x,yThe center of the circle
[in]radius1The radius of the larger circle
[in]color1The color to use for the larger circle
[in]radius2The radius of the smaller circle
[in]color2The color to use for the smaller circle
Function Class:
Normal API, this function can be invoked by regular system threads.
void gdispGFillEllipse ( GDisplay *  g,
coord_t  x,
coord_t  y,
coord_t  a,
coord_t  b,
color_t  color 
)

Draw a filled ellipse.

Precondition
GDISP_NEED_ELLIPSE must be TRUE in your gfxconf.h
Parameters
[in]gThe display to use
[in]x,yThe center of the ellipse
[in]a,bThe dimensions of the ellipse
[in]colorThe color to use
Function Class:
Normal API, this function can be invoked by regular system threads.
void gdispGFillRoundedBox ( GDisplay *  g,
coord_t  x,
coord_t  y,
coord_t  cx,
coord_t  cy,
coord_t  radius,
color_t  color 
)

Draw a filled rectangular box with rounded corners.

Precondition
GDISP_NEED_ARC or GDISP_NEED_ARCSECTORS must be TRUE in your gfxconf.h
Parameters
[in]gThe display to use
[in]x,yThe start position
[in]cx,cyThe size of the box (outside dimensions)
[in]radiusThe radius of the rounded corners
[in]colorThe color to use
Function Class:
Normal API, this function can be invoked by regular system threads.
void gdispGFillString ( GDisplay *  g,
coord_t  x,
coord_t  y,
const char *  str,
font_t  font,
color_t  color,
color_t  bgcolor 
)

Draw a text string.

Precondition
GDISP_NEED_TEXT must be TRUE in your gfxconf.h
Parameters
[in]gThe display to use
[in]x,yThe position for the text
[in]strThe string to draw
[in]fontThe font to use
[in]colorThe color to use
[in]bgcolorThe background color to use
Function Class:
Normal API, this function can be invoked by regular system threads.
void gdispGFillStringBox ( GDisplay *  g,
coord_t  x,
coord_t  y,
coord_t  cx,
coord_t  cy,
const char *  str,
font_t  font,
color_t  color,
color_t  bgColor,
justify_t  justify 
)

Draw a text string vertically centered within the specified box. The box background is filled with the specified background color.

Precondition
GDISP_NEED_TEXT must be TRUE in your gfxconf.h
Note
The entire box is filled
Parameters
[in]gThe display to use
[in]x,yThe position for the text (need to define top-right or base-line - check code)
[in]cx,cyThe width and height of the box
[in]strThe string to draw
[in]fontThe font to use
[in]colorThe color to use
[in]bgColorThe background color to use
[in]justifyJustify the text left, center or right within the box
Function Class:
Normal API, this function can be invoked by regular system threads.

Referenced by gwinCheckboxDraw_CheckOnLeft(), and gwinCheckboxDraw_CheckOnRight().

void gdispGFlush ( GDisplay *  g)

Flush current drawing operations to the display.

Note
Some low level drivers do not update the display until the display is flushed. For others it is optional but can help prevent tearing effects. For some it is ignored. Calling it at the end of a logic set of drawing operations in your application will ensure controller portability. If you know your controller does not need to be flushed there is no need to call it (which is in reality most controllers).
Even for displays that require flushing, there is no need to call this function if GDISP_NEED_AUTOFLUSH is TRUE. Calling it again won't hurt though.
Parameters
[in]gThe display to use
Function Class:
Normal API, this function can be invoked by regular system threads.
uint8_t gdispGGetBacklight ( GDisplay *  g)

Get the current display backlight brightness.

Parameters
[in]gThe display to use
Returns
The current backlight value
Function Class:
Normal API, this function can be invoked by regular system threads.
uint8_t gdispGGetContrast ( GDisplay *  g)

Get the current display contrast.

Parameters
[in]gThe display to use
Returns
The current contrast value
Function Class:
Normal API, this function can be invoked by regular system threads.
coord_t gdispGGetHeight ( GDisplay *  g)

Get the display height in pixels.

Parameters
[in]gThe display to use
Returns
The height of the display
Function Class:
Normal API, this function can be invoked by regular system threads.
orientation_t gdispGGetOrientation ( GDisplay *  g)

Get the current display orientation.

Parameters
[in]gThe display to use
Returns
The current orientation
Function Class:
Normal API, this function can be invoked by regular system threads.
color_t gdispGGetPixelColor ( GDisplay *  g,
coord_t  x,
coord_t  y 
)

Get the color of a pixel.

Returns
The color of the pixel.
Precondition
GDISP_NEED_PIXELREAD must be TRUE in your gfxconf.h
Parameters
[in]gThe display to use
[in]x,yThe position of the pixel
Function Class:
Normal API, this function can be invoked by regular system threads.
powermode_t gdispGGetPowerMode ( GDisplay *  g)

Get the current display power mode.

Parameters
[in]gThe display to use
Returns
The current power mode
Function Class:
Normal API, this function can be invoked by regular system threads.
coord_t gdispGGetWidth ( GDisplay *  g)

Get the display width in pixels.

Parameters
[in]gThe display to use
Returns
The width of the display
Function Class:
Normal API, this function can be invoked by regular system threads.
void* gdispGQuery ( GDisplay *  g,
unsigned  what 
)

Query a property of the display.

Precondition
GDISP_NEED_QUERY must be TRUE in your gfxconf.h
Note
The result must be typecast to the correct type.
An unsupported query will return (void *)-1.
Parameters
[in]gThe display to use
[in]whatWhat to query
Function Class:
Normal API, this function can be invoked by regular system threads.
void gdispGSetClip ( GDisplay *  g,
coord_t  x,
coord_t  y,
coord_t  cx,
coord_t  cy 
)

Clip all drawing to the defined area.

Precondition
GDISP_NEED_CLIP must be TRUE in your gfxconf.h
Parameters
[in]gThe display to use
[in]x,yThe start position
[in]cx,cyThe size of the clip area
Function Class:
Normal API, this function can be invoked by regular system threads.
void gdispGStreamColor ( GDisplay *  g,
color_t  color 
)

Send pixel data to the stream.

Write a pixel to the next position in the streamed area and increment the position

Precondition
GDISP_NEED_STREAMING must be TRUE in your gfxconf.h
gdispStreamStart() has been called.
Note
If the gdispStreamStart() has not been called (or failed due to clipping), the data provided here is simply thrown away.
Parameters
[in]gThe display to use
[in]colorThe color of the pixel to write
Function Class:
Normal API, this function can be invoked by regular system threads.
void gdispGStreamStart ( GDisplay *  g,
coord_t  x,
coord_t  y,
coord_t  cx,
coord_t  cy 
)

Start a streaming operation.

Stream data to a window on the display sequentially and very fast.

Precondition
GDISP_NEED_STREAMING must be TRUE in your gfxconf.h
Note
While streaming is in operation - no other calls to GDISP functions can be made (with the exception of gdispBlendColor() and streaming functions). If a call is made (eg in a multi-threaded application) the other call is blocked waiting for the streaming operation to finish.
gdispStreamStop() must be called to finish the streaming operation.
If more data is written than the defined area then the results are unspecified. Some drivers may wrap back to the beginning of the area, others may just ignore subsequent data.
Unlike most operations that clip the defined area to the display to generate a smaller active area, this call will just silently fail if any of the stream region lies outside the current clipping area.
A streaming operation may be terminated early (without writing to every location in the stream area) by calling gdispStreamStop().
Parameters
[in]gThe display to use
[in]x,yThe start position
[in]cx,cyThe size of the streamable area
Function Class:
Normal API, this function can be invoked by regular system threads.
void gdispGStreamStop ( GDisplay *  g)

Finish the current streaming operation.

Completes the current streaming operation and allows other GDISP calls to operate again.

Precondition
GDISP_NEED_STREAMING must be TRUE in your gfxconf.h
gdispStreamStart() has been called.
Note
If the gdispStreamStart() has not been called (or failed due to clipping), this call is simply ignored.
Parameters
[in]gThe display to use
Function Class:
Normal API, this function can be invoked by regular system threads.
void gdispGVerticalScroll ( GDisplay *  g,
coord_t  x,
coord_t  y,
coord_t  cx,
coord_t  cy,
int  lines,
color_t  bgcolor 
)

Scroll vertically a section of the screen.

Precondition
GDISP_NEED_SCROLL must be set to TRUE in gfxconf.h
Note
Optional.
If lines is >= cy, it is equivelent to an area fill with bgcolor.
Parameters
[in]gThe display to use
[in]x,yThe start of the area to be scrolled
[in]cx,cyThe size of the area to be scrolled
[in]linesThe number of lines to scroll (Can be positive or negative)
[in]bgcolorThe color to fill the newly exposed area.
Function Class:
Normal API, this function can be invoked by regular system threads.
font_t gdispOpenFont ( const char *  name)

Find a font and return it.

The supplied name is matched against the font name. A '*' will replace 0 or more characters.

Returns
Returns a font or NULL if no matching font could be found.
Precondition
GDISP_NEED_TEXT must be TRUE in your gfxconf.h
Parameters
[in]nameThe font name to find.
Note
Wildcard matching will match the shortest possible match.
Function Class:
Normal API, this function can be invoked by regular system threads.
font_t gdispScaleFont ( font_t  font,
uint8_t  scale_x,
uint8_t  scale_y 
)

Make a scaled copy of an existing font.

Allocates memory for new font metadata using gfxAlloc, remember to close font after use!

Returns
A new font or NULL if out of memory.
Precondition
GDISP_NEED_TEXT must be TRUE in your gfxconf.h
Note
A scaled font should probably not be added to the font list as it will prevent the unscaled font of the same name being found as it will be the scaled version that will be found.
Parameters
[in]fontThe base font to use.
[in]scale_xThe scale factor in horizontal direction.
[in]scale_yThe scale factor in vertical direction.
void gdispSetDisplay ( GDisplay *  g)

Set the current default display to the specified display.

Note
The default display is used for the gdispXxxx functions.
The default display is contained in the variable GDISP. Using this function to set it protects against it being set to a NULL value.
If a NULL is passed for the dispay this call is ignored.
Parameters
[in]gThe display to use
Function Class:
Normal API, this function can be invoked by regular system threads.

Variable Documentation

GDisplay* GDISP

The default screen to use for the gdispXXXX calls.

Note
This is set by default to the first display in the system. You can change it by calling gdispSetDisplay().

Macro Definition Documentation

#define GDISP_CONTROL_POWER   0

Driver Control Constants.

Unsupported control codes are ignored.

Note
The value parameter should always be typecast to (void *).
There are some predefined and some specific to the low level driver.
GDISP_CONTROL_POWER - Takes a gdisp_powermode_t GDISP_CONTROL_ORIENTATION - Takes a gdisp_orientation_t GDISP_CONTROL_BACKLIGHT - Takes an int from 0 to 100. For a driver that only supports off/on anything other than zero is on. GDISP_CONTROL_CONTRAST - Takes an int from 0 to 100. GDISP_CONTROL_LLD - Low level driver control constants start at this value.

Definition at line 151 of file gdisp.h.

#define GDISP_DRIVER_LIST   GDISPVMT_Win32, GDISPVMT_SSD1963

The list of display drivers.

Note
Replace this example with your own definition in your gfxconf.h file. See the gdisp_lld.c in each driver (near the top) to get the name of the VMT for a driver.
The same driver can occur more than once in the list to create an extra instance of that driver.
If defining this you must also define GDISP_PIXELFORMAT for your application to use. Choose a value that is most common accross all your drivers for efficiency.
If using this you may optionally define the GDISP_HARDWARE_xxx values as either TRUE or FALSE. Doing this causes GDISP to assume that all (TRUE) or none (FALSE) of the listed drivers have that capability. This can help improve drawing speed and efficiency.

Definition at line 277 of file gdisp_options.h.

#define GDISP_IMAGE_BMP_BLIT_BUFFER_SIZE   32

The BMP blit buffer size.

Defaults to 32

Note
Bigger is faster but requires more RAM.
This must be greater than 40 bytes and 32 pixels as we read our headers into this space as well.

Definition at line 398 of file gdisp_options.h.

#define GDISP_IMAGE_GIF_BLIT_BUFFER_SIZE   32

The GIF blit buffer size.

Defaults to 32

Note
Bigger is faster but requires more RAM.

Definition at line 413 of file gdisp_options.h.

#define GDISP_IMAGE_PNG_BLIT_BUFFER_SIZE   32

The PNG blit buffer size in pixels.

Defaults to 32

Note
Bigger is faster but requires more RAM.

Definition at line 542 of file gdisp_options.h.

#define GDISP_IMAGE_PNG_FILE_BUFFER_SIZE   8

The PNG input file buffer size in bytes.

Defaults to 8

Note
Bigger is faster but requires more RAM.
Must be >= 8

Definition at line 551 of file gdisp_options.h.

#define GDISP_IMAGE_PNG_Z_BUFFER_SIZE   32768

The PNG inflate decompression buffer size in bytes.

Defaults to 32768

Note
Bigger is faster but requires more RAM.
Must be >= 32768 due to the PNG 32K sliding window.
More efficient code is generated if this value is a power of 2.

Definition at line 561 of file gdisp_options.h.

#define GDISP_LINEBUF_SIZE   128

Define the default orientation for all displays in the system.

Note
GDISP_NEED_CONTROL must also be set (and the hardware must support it)
If not specified then displays default to the native hardware orientation The size of pixel buffer (in pixels) used for optimization.

Set to zero to guarantee disabling of the buffer.

Note
Depending on the driver and what operations the application needs, this buffer may never be allocated.
Setting the size to zero may cause some operations to not compile eg. Scrolling if there is no hardware scroll support.
Increasing the size will speedup certain operations at the expense of RAM.
Currently only used to support scrolling on hardware without scrolling support, and to increase the speed of streaming operations on non-streaming hardware where there is a hardware supported bit-blit.

Definition at line 249 of file gdisp_options.h.

#define GDISP_NEED_ANTIALIAS   FALSE

Enable antialiased font support.

Defaults to FALSE

Definition at line 614 of file gdisp_options.h.

#define GDISP_NEED_ARC   FALSE

Are arc functions needed.

Defaults to FALSE

Note
This can be compiled using fully integer mathematics by defining GFX_USE_GMISC and GMISC_NEED_FIXEDTRIG as TRUE.
This can be compiled to use floating point but no trig functions by defining GFX_USE_GMISC and GMISC_NEED_FASTTRIG as TRUE.
If neither of the above are defined it requires the maths library to be included in the link to provide floating point and trig support. ie include -lm in your compiler flags.

Definition at line 132 of file gdisp_options.h.

#define GDISP_NEED_ARCSECTORS   FALSE

Are arc sector functions needed.

Defaults to FALSE

Note
Uses integer algorithms only. It does not use any trig or floating point.

Definition at line 118 of file gdisp_options.h.

#define GDISP_NEED_AUTOFLUSH   FALSE

Should drawing operations be automatically flushed.

Defaults to FALSE

Note
If set to FALSE and the controller requires flushing then the application must manually call gdispGFlush(). Setting this to TRUE causes GDISP to automatically flush after each drawing operation. Note this may be slow but enables an application to avoid having to manually call the flush routine.
If TRUE and GDISP_NEED_TIMERFLUSH is also TRUE, this takes precedence.
Most controllers don't need flushing which is why this is set to FALSE by default.

Definition at line 36 of file gdisp_options.h.

#define GDISP_NEED_CIRCLE   FALSE

Are circle functions needed.

Defaults to FALSE

Note
Uses integer algorithms only. It does not use any trig or floating point.

Definition at line 94 of file gdisp_options.h.

#define GDISP_NEED_CLIP   TRUE

Are clipping functions needed.

Defaults to TRUE

Definition at line 71 of file gdisp_options.h.

#define GDISP_NEED_CONTROL   FALSE

Control some aspect of the hardware operation.

Defaults to FALSE

Note
This allows control of hardware specific features such as screen rotation, backlight levels, contrast etc

Definition at line 171 of file gdisp_options.h.

#define GDISP_NEED_CONVEX_POLYGON   FALSE

Are convex polygon functions needed.

Defaults to FALSE

Note
Convex polygons are those that have no internal angles. That is; you can draw a line from any point on the polygon to any other point on the polygon without it going outside the polygon.

Definition at line 142 of file gdisp_options.h.

#define GDISP_NEED_DUALCIRCLE   FALSE

Are dual circle functions needed (one circle inside another).

Defaults to FALSE

Note
Uses integer algorithms only. It does not use any trig or floating point.

Definition at line 102 of file gdisp_options.h.

#define GDISP_NEED_ELLIPSE   FALSE

Are ellipse functions needed.

Defaults to FALSE

Note
Uses integer algorithms only. It does not use any trig or floating point.

Definition at line 110 of file gdisp_options.h.

#define GDISP_NEED_IMAGE   FALSE

Is the image interface required.

Defaults to FALSE

Definition at line 186 of file gdisp_options.h.

#define GDISP_NEED_IMAGE_ACCOUNTING   FALSE

Is memory accounting required during image decoding.

Defaults to FALSE

Definition at line 326 of file gdisp_options.h.

#define GDISP_NEED_IMAGE_BMP   FALSE

Is BMP image decoding required.

Defaults to FALSE

Definition at line 305 of file gdisp_options.h.

#define GDISP_NEED_IMAGE_BMP_1   TRUE

Is BMP 1 bit per pixel (monochrome/2 color) image decoding required.

Defaults to TRUE

Definition at line 340 of file gdisp_options.h.

#define GDISP_NEED_IMAGE_BMP_16   TRUE

Is BMP 16 bits per pixel (65536 color) image decoding required.

Defaults to TRUE

Definition at line 375 of file gdisp_options.h.

#define GDISP_NEED_IMAGE_BMP_24   TRUE

Is BMP 24 bits per pixel (true-color) image decoding required.

Defaults to TRUE

Definition at line 382 of file gdisp_options.h.

#define GDISP_NEED_IMAGE_BMP_32   TRUE

Is BMP 32 bits per pixel (true-color) image decoding required.

Defaults to TRUE

Definition at line 389 of file gdisp_options.h.

#define GDISP_NEED_IMAGE_BMP_4   TRUE

Is BMP 4 bits per pixel (16 color) image decoding required.

Defaults to TRUE

Definition at line 347 of file gdisp_options.h.

#define GDISP_NEED_IMAGE_BMP_4_RLE   TRUE

Is BMP 4 bits per pixel (16 color) with RLE compression image decoding required.

Defaults to TRUE

Definition at line 354 of file gdisp_options.h.

#define GDISP_NEED_IMAGE_BMP_8   TRUE

Is BMP 8 bits per pixel (256 color) image decoding required.

Defaults to TRUE

Definition at line 361 of file gdisp_options.h.

#define GDISP_NEED_IMAGE_BMP_8_RLE   TRUE

Is BMP 8 bits per pixel (256 color) with RLE compression image decoding required.

Defaults to TRUE

Definition at line 368 of file gdisp_options.h.

#define GDISP_NEED_IMAGE_GIF   FALSE

Is GIF image decoding required.

Defaults to FALSE

Definition at line 298 of file gdisp_options.h.

#define GDISP_NEED_IMAGE_JPG   FALSE

Is JPG image decoding required.

Defaults to FALSE

Definition at line 312 of file gdisp_options.h.

#define GDISP_NEED_IMAGE_NATIVE   FALSE

Is native image decoding required.

Defaults to FALSE

Definition at line 291 of file gdisp_options.h.

#define GDISP_NEED_IMAGE_PNG   FALSE

Is PNG image decoding required.

Defaults to FALSE

Definition at line 319 of file gdisp_options.h.

#define GDISP_NEED_IMAGE_PNG_ALPHACLIFF   32

What is the cliff between non-blended alpha pixels being displayed or not.

Range of 0 to 255

Note
If GDISP_NEED_IMAGE_PNG_BACKGROUND is TRUE and the PNG file contains a background color then the pixel will be blended with the background color according to the alpha. If not then no blending occurs. The pixel will either be set or not. Any alpha value greater or equal to this number will be displayed. Anything less than this number is not displayed.

Definition at line 457 of file gdisp_options.h.

#define GDISP_NEED_IMAGE_PNG_BACKGROUND   TRUE

Is PNG background data processed.

Defaults to TRUE

Note
If the background is specified in the image file and this define is TRUE, that background color is used for transparency and alpha blending.

Definition at line 444 of file gdisp_options.h.

#define GDISP_NEED_IMAGE_PNG_GRAYALPHA_16   TRUE

Is 16 bit PNG grayscale with 16 bit alpha image decoding required.

Defaults to TRUE

Definition at line 506 of file gdisp_options.h.

#define GDISP_NEED_IMAGE_PNG_GRAYALPHA_8   TRUE

Is 8 bit PNG grayscale with 8 bit alpha image decoding required.

Defaults to TRUE

Definition at line 499 of file gdisp_options.h.

#define GDISP_NEED_IMAGE_PNG_GRAYSCALE_124   TRUE

Is 1,2 and 4 bit PNG grayscale image decoding required.

Defaults to TRUE

Definition at line 478 of file gdisp_options.h.

#define GDISP_NEED_IMAGE_PNG_GRAYSCALE_16   TRUE

Is 16 bit PNG grayscale image decoding required.

Defaults to TRUE

Definition at line 492 of file gdisp_options.h.

#define GDISP_NEED_IMAGE_PNG_GRAYSCALE_8   TRUE

Is 8 bit PNG grayscale image decoding required.

Defaults to TRUE

Definition at line 485 of file gdisp_options.h.

#define GDISP_NEED_IMAGE_PNG_INTERLACED   FALSE

Is PNG Interlaced image decoding required.

Defaults to FALSE

Note
Currently not supported due to the complex decoding and display requirements

Definition at line 428 of file gdisp_options.h.

#define GDISP_NEED_IMAGE_PNG_PALETTE_124   TRUE

Is 1, 2 and 4 bit PNG palettized image decoding required.

Defaults to TRUE

Definition at line 464 of file gdisp_options.h.

#define GDISP_NEED_IMAGE_PNG_PALETTE_8   TRUE

Is 8 bit PNG palettized image decoding required.

Defaults to TRUE

Definition at line 471 of file gdisp_options.h.

#define GDISP_NEED_IMAGE_PNG_RGB_16   TRUE

Is 16/16/16 bit PNG RGB image decoding required.

Defaults to TRUE

Definition at line 520 of file gdisp_options.h.

#define GDISP_NEED_IMAGE_PNG_RGB_8   TRUE

Is 8/8/8 bit PNG RGB image decoding required.

Defaults to TRUE

Definition at line 513 of file gdisp_options.h.

#define GDISP_NEED_IMAGE_PNG_RGBALPHA_16   TRUE

Is 16/16/16 bit PNG RGB with 16 bit alpha image decoding required.

Defaults to TRUE

Definition at line 534 of file gdisp_options.h.

#define GDISP_NEED_IMAGE_PNG_RGBALPHA_8   TRUE

Is 8/8/8 bit PNG RGB with 8 bit alpha image decoding required.

Defaults to TRUE

Definition at line 527 of file gdisp_options.h.

#define GDISP_NEED_IMAGE_PNG_TRANSPARENCY   TRUE

Is PNG image transparency processed.

Defaults to TRUE

Definition at line 435 of file gdisp_options.h.

#define GDISP_NEED_MULTITHREAD   FALSE

Do the drawing functions need to be thread-safe.

Defaults to FALSE

Definition at line 206 of file gdisp_options.h.

#define GDISP_NEED_PIXELREAD   FALSE

Is the capability to read pixels back needed.

Defaults to FALSE

Note
This function must be supported by the low level GDISP driver you have included in your project. If it isn't, defining this option will cause a compile error.

Definition at line 162 of file gdisp_options.h.

#define GDISP_NEED_PIXMAP   FALSE

Is the image interface required.

Defaults to FALSE

Definition at line 193 of file gdisp_options.h.

#define GDISP_NEED_QUERY   FALSE

Query some aspect of the hardware operation.

Defaults to FALSE

Note
This allows query of hardware specific features

Definition at line 179 of file gdisp_options.h.

#define GDISP_NEED_SCROLL   FALSE

Are scrolling functions needed.

Defaults to FALSE

Note
This function must be supported by the low level GDISP driver you have included in your project. If it isn't, defining this option will cause a compile error.

Definition at line 152 of file gdisp_options.h.

#define GDISP_NEED_STARTUP_LOGO   TRUE

Should the startup logo be displayed.

Defaults to TRUE

Definition at line 220 of file gdisp_options.h.

#define GDISP_NEED_STREAMING   FALSE

Streaming functions are needed.

Defaults to FALSE.

Definition at line 78 of file gdisp_options.h.

#define GDISP_NEED_TEXT   FALSE

Are text functions needed.

Defaults to FALSE

Note
You must also define at least one font.

Definition at line 86 of file gdisp_options.h.

#define GDISP_NEED_TEXT_BOXPADLR   1

Adding pixels to the left and right side of the box to pad text.

Only has an effect with gdispGDrawStringBox() and gdispGFillStringBox()

Note
Can be turned off by using justifyNoPad

Defaults to 1

Definition at line 584 of file gdisp_options.h.

#define GDISP_NEED_TEXT_BOXPADTB   1

Adding pixels to the top and bottom side of the box to pad text.

Only has an effect with gdispGDrawStringBox() and gdispGFillStringBox()

Note
Can be turned off by using justifyNoPad

Defaults to 1

Definition at line 593 of file gdisp_options.h.

#define GDISP_NEED_TEXT_KERNING   FALSE

Enable kerning for font rendering (improves character placement).

Defaults to FALSE

Definition at line 607 of file gdisp_options.h.

#define GDISP_NEED_TEXT_WORDWRAP   FALSE

Enable advanced word-wrapping.

Only has an effect with gdispGDrawStringBox() and gdispGFillStringBox()

Defaults to FALSE

Definition at line 575 of file gdisp_options.h.

#define GDISP_NEED_TIMERFLUSH   FALSE

Should drawing operations be automatically flushed on a timer.

Defaults to FALSE, Can be set to FALSE or a timer period in milliseconds.

Note
The period should not be set too short or it will consume all your CPU. A value between 250 and 500 milliseconds would probably be suitable.
If TRUE and GDISP_NEED_AUTOFLUSH is also TRUE, this is ineffective.
Most controllers don't need flushing which is why this is set to FALSE by default.

Definition at line 48 of file gdisp_options.h.

#define GDISP_NEED_UTF8   FALSE

Enable UTF-8 support for text rendering.

Defaults to FALSE

Definition at line 600 of file gdisp_options.h.

#define GDISP_NEED_VALIDATION   TRUE

Should all operations be clipped to the screen and colors validated.

Defaults to TRUE.

Note
If this is FALSE, any operations that extend beyond the edge of the screen will have undefined results. Any out-of-range colors will produce undefined results.
This should always be left as the default (TRUE) unless you are a maniac for speed and you have thoroughly tested your code and it never overwrites the edges of the screen.
Setting GDISP_NEED_CLIP to TRUE internally uses the same mechanism as this validation. There is no advantage in setting this FALSE if GDISP_NEED_CLIP is TRUE.

Definition at line 64 of file gdisp_options.h.

#define GDISP_STARTUP_COLOR   Black

Define the initial background color for all displays in the system.

Definition at line 226 of file gdisp_options.h.

#define GDISP_TOTAL_DISPLAYS   1

The total number of displays using the default driver.

Note
If you want to use multiple displays either set GDISP_TOTAL_DISPLAYS or GDISP_DRIVER_LIST but not both.

Definition at line 263 of file gdisp_options.h.

#define gdispGSetBacklight (   g,
  percent 
)    gdispGControl((g), GDISP_CONTROL_BACKLIGHT, (void *)(unsigned)(percent))

Set the display backlight.

Note
Ignored if not supported by the display.
Parameters
[in]gThe display to use
[in]percentThe new brightness (0 - 100%)
Note
For displays that only support backlight off and on, 0 = off, anything else = on
Function Class:
Normal API, this function can be invoked by regular system threads.

Definition at line 1201 of file gdisp.h.

#define gdispGSetContrast (   g,
  percent 
)    gdispGControl((g), GDISP_CONTROL_CONTRAST, (void *)(unsigned)(percent))

Set the display contrast.

Note
Ignored if not supported by the display.
Parameters
[in]gThe display to use
[in]percentThe new contrast (0 - 100%)
Function Class:
Normal API, this function can be invoked by regular system threads.

Definition at line 1213 of file gdisp.h.

#define gdispGSetOrientation (   g,
  newOrientation 
)    gdispGControl((g), GDISP_CONTROL_ORIENTATION, (void *)(unsigned)(newOrientation))

Set the display orientation.

Note
Ignored if not supported by the display.
Parameters
[in]gThe display to use
[in]newOrientationThe new orientation
Function Class:
Normal API, this function can be invoked by regular system threads.

Definition at line 1186 of file gdisp.h.

#define gdispGSetPowerMode (   g,
  powerMode 
)    gdispGControl((g), GDISP_CONTROL_POWER, (void *)(unsigned)(powerMode))

Set the display power mode.

Note
Ignored if not supported by the display.
Parameters
[in]gThe display to use
[in]powerModeThe new power mode
Function Class:
Normal API, this function can be invoked by regular system threads.

Definition at line 1174 of file gdisp.h.

#define gdispGUnsetClip (   g)    gdispGSetClip((g),0,0,gdispGGetWidth(g),gdispGGetHeight(g))

Reset the clip area to the full screen.

Parameters
[in]gThe display to use
Function Class:
Normal API, this function can be invoked by regular system threads.

Definition at line 1225 of file gdisp.h.

Typedef Documentation

typedef int16_t coord_t

The type for a coordinate or length on the screen.

Definition at line 39 of file gdisp.h.

typedef const struct mf_font_s* font_t

The type of a font.

Definition at line 93 of file gdisp.h.

typedef color_t pixel_t

The pixel format.

It generally defaults to the hardware pixel format.

Note
This doesn't need to match the hardware pixel format. It is definitely more efficient when it does.
When GDISP_DRIVER_LIST is defined, this must be explicitly defined and you should ensure the best match with your hardware across all devices. Do pixels require packing for a blit
Is only valid for a pixel format that doesn't fill it's datatype. eg formats: GDISP_PIXELFORMAT_RGB888 GDISP_PIXELFORMAT_RGB444 GDISP_PIXELFORMAT_RGB666 GDISP_PIXELFORMAT_CUSTOM
Very few cases should actually require packed pixels as the low level driver can also pack on the fly as it is sending it to the graphics device.
Packed pixels are not really supported at this point. Do lines of pixels require packing for a blit
Ignored if GDISP_PACKED_PIXELS is FALSE The type of a pixel.

Definition at line 226 of file gdisp.h.

Enumeration Type Documentation

enum fontmetric

Type for the font metric.

Enumerator
fontHeight 

The height of the font

fontDescendersHeight 

The descenders height

fontLineSpacing 

The line spacing

fontCharPadding 

The char padding

fontMinWidth 

The minimum width

fontMaxWidth 

The maximum width

fontBaselineX 

The base line in x direction

fontBaselineY 

The base line in y direction

Definition at line 79 of file gdisp.h.

enum justify

Type for the text justification.

Enumerator
justifyLeft 

Justify Left (the default)

justifyCenter 

Justify Center

justifyRight 

Justify Right

justifyTop 

Justify Top

justifyMiddle 

Justify Middle (the default)

justifyBottom 

Justify Bottom

justifyWordWrap 

Word wrap (the default if GDISP_NEED_TEXT_WORDWRAP is on)

justifyNoWordWrap 

No word wrap

justifyPad 

Pad the text box (the default)

justifyNoPad 

No padding the text box

Definition at line 60 of file gdisp.h.

Type for the screen orientation.

Note
GDISP_ROTATE_LANDSCAPE and GDISP_ROTATE_PORTRAIT are internally converted to the most appropriate other orientation.
Enumerator
GDISP_ROTATE_0 

Don't rotate. This is the displays native orientation.

GDISP_ROTATE_90 

Rotate by 90 degrees absolute to the native rotation.

GDISP_ROTATE_180 

Rotate by 180 degrees absolute to the native rotation.

GDISP_ROTATE_270 

Rotate by 270 degrees absolute to the native rotation.

GDISP_ROTATE_PORTRAIT 

Put the display into portrait mode.

GDISP_ROTATE_LANDSCAPE 

Put the display into landscape mode.

Definition at line 101 of file gdisp.h.

enum powermode

Type for the available power modes for the screen.

Enumerator
powerOff 

Turn the display off.

powerSleep 

Put the display into sleep mode.

powerDeepSleep 

Put the display into deep-sleep mode.

powerOn 

Turn the display on.

Definition at line 114 of file gdisp.h.