30 #include "../../gfx.h"
41 #if GFX_USE_GDISP || defined(__DOXYGEN__)
72 #define JUSTIFYMASK_HORIZONTAL (gJustifyLeft|gJustifyCenter|gJustifyRight)
73 #define JUSTIFYMASK_VERTICAL (gJustifyTop|gJustifyMiddle|gJustifyBottom)
93 typedef const struct mf_font_s*
gFont;
124 typedef struct GDisplay GDisplay;
131 extern GDisplay *
GDISP;
151 #define GDISP_CONTROL_POWER 0
152 #define GDISP_CONTROL_ORIENTATION 1
153 #define GDISP_CONTROL_BACKLIGHT 2
154 #define GDISP_CONTROL_CONTRAST 3
155 #define GDISP_CONTROL_LLD 1000
161 #if !defined(GDISP_DRIVER_LIST)
166 #include "gdisp_lld_config.h"
170 #if !defined(GDISP_PIXELFORMAT) && defined(GDISP_LLD_PIXELFORMAT)
171 #define GDISP_PIXELFORMAT GDISP_LLD_PIXELFORMAT
188 #ifndef GDISP_PIXELFORMAT
189 #define GDISP_PIXELFORMAT GDISP_PIXELFORMAT_ERROR
203 #ifndef GDISP_PACKED_PIXELS
204 #define GDISP_PACKED_PIXELS GFXOFF
211 #ifndef GDISP_PACKED_LINES
212 #define GDISP_PACKED_LINES GFXOFF
302 #define gdispGetWidth() gdispGGetWidth(GDISP)
314 #define gdispGetHeight() gdispGGetHeight(GDISP)
326 #define gdispGetPowerMode() gdispGGetPowerMode(GDISP)
338 #define gdispGetOrientation() gdispGGetOrientation(GDISP)
350 #define gdispGetBacklight() gdispGGetBacklight(GDISP)
362 #define gdispGetContrast() gdispGGetContrast(GDISP)
385 #define gdispFlush() gdispGFlush(GDISP)
396 #define gdispClear(c) gdispGClear(GDISP, c)
408 #define gdispDrawPixel(x,y,c) gdispGDrawPixel(GDISP,x,y,c)
421 #define gdispDrawLine(x0,y0,x1,y1,c) gdispGDrawLine(GDISP,x0,y0,x1,y1,c)
434 #define gdispFillArea(x,y,cx,cy,c) gdispGFillArea(GDISP,x,y,cx,cy,c)
456 #define gdispBlitAreaEx(x,y,cx,cy,sx,sy,rx,b) gdispGBlitArea(GDISP,x,y,cx,cy,sx,sy,rx,b)
469 #define gdispDrawBox(x,y,cx,cy,c) gdispGDrawBox(GDISP,x,y,cx,cy,c)
473 #if GDISP_NEED_STREAMING || defined(__DOXYGEN__)
499 #define gdispStreamStart(x,y,cx,cy) gdispGStreamStart(GDISP,x,y,cx,cy)
515 #define gdispStreamColor(c) gdispGStreamColor(GDISP,c)
530 #define gdispStreamStop() gdispGStreamStop(GDISP)
535 #if GDISP_NEED_CLIP || defined(__DOXYGEN__)
547 #define gdispSetClip(x,y,cx,cy) gdispGSetClip(GDISP,x,y,cx,cy)
552 #if GDISP_NEED_CIRCLE || defined(__DOXYGEN__)
565 #define gdispDrawCircle(x,y,r,c) gdispGDrawCircle(GDISP,x,y,r,c)
579 #define gdispFillCircle(x,y,r,c) gdispGFillCircle(GDISP,x,y,r,c)
582 #if GDISP_NEED_DUALCIRCLE || defined(__DOXYGEN__)
597 #define gdispFillDualCircle(x,y,r1,c1,r2,c2) gdispGFillDualCircle(GDISP,x,y,r1,c1,r2,c2)
602 #if GDISP_NEED_ELLIPSE || defined(__DOXYGEN__)
615 #define gdispDrawEllipse(x,y,a,b,c) gdispGDrawEllipse(GDISP,x,y,a,b,c)
629 #define gdispFillEllipse(x,y,a,b,c) gdispGFillEllipse(GDISP,x,y,a,b,c)
633 #if GDISP_NEED_ARCSECTORS || defined(__DOXYGEN__)
661 #define gdispDrawArcSectors(x,y,r,s,c) gdispGDrawArcSectors(GDISP,x,y,r,s,c)
690 #define gdispFillArcSectors(x,y,r,s,c) gdispGFillArcSectors(GDISP,x,y,r,s,c)
693 #if GDISP_NEED_ARC || defined(__DOXYGEN__)
717 #define gdispDrawArc(x,y,r,s,e,c) gdispGDrawArc(GDISP,x,y,r,s,e,c)
742 #define gdispDrawThickArc(x,y,rs,re,s,e,c) gdispGDrawThickArc(GDISP,x,y,rs,re,s,e,c)
767 #define gdispFillArc(x,y,r,s,e,c) gdispGFillArc(GDISP,x,y,r,s,e,c)
772 #if GDISP_NEED_PIXELREAD || defined(__DOXYGEN__)
784 #define gdispGetPixelColor(x,y) gdispGGetPixelColor(GDISP,x,y)
789 #if GDISP_NEED_SCROLL || defined(__DOXYGEN__)
805 #define gdispVerticalScroll(x,y,cx,cy,l,b) gdispGVerticalScroll(GDISP,x,y,cx,cy,l,b)
810 #if GDISP_NEED_CONTROL || defined(__DOXYGEN__)
824 #define gdispControl(w,v) gdispGControl(GDISP,w,v)
829 #if GDISP_NEED_QUERY || defined(__DOXYGEN__)
842 #define gdispQuery(w) gdispGQuery(GDISP,w)
845 #if GDISP_NEED_CONVEX_POLYGON || defined(__DOXYGEN__)
859 #define gdispDrawPoly(x,y,p,i,c) gdispGDrawPoly(GDISP,x,y,p,i,c)
883 #define gdispFillConvexPoly(x,y,p,i,c) gdispGFillConvexPoly(GDISP,x,y,p,i,c)
902 #define gdispDrawThickLine(x0,y0,x1,y1,c,w,r) gdispGDrawThickLine(GDISP,x0,y0,x1,y1,c,w,r)
907 #if GDISP_NEED_TEXT || defined(__DOXYGEN__)
921 #define gdispDrawChar(x,y,s,f,c) gdispGDrawChar(GDISP,x,y,s,f,c)
937 #define gdispFillChar(x,y,s,f,c,b) gdispGFillChar(GDISP,x,y,s,f,c,b)
952 #define gdispDrawString(x,y,s,f,c) gdispGDrawString(GDISP,x,y,s,f,c)
968 #define gdispFillString(x,y,s,f,c,b) gdispGFillString(GDISP,x,y,s,f,c,b)
985 #define gdispDrawStringBox(x,y,cx,cy,s,f,c,j) gdispGDrawStringBox(GDISP,x,y,cx,cy,s,f,c,j)
1004 #define gdispFillStringBox(x,y,cx,cy,s,f,c,b,j) gdispGFillStringBox(GDISP,x,y,cx,cy,s,f,c,b,j)
1120 #if GDISP_NEED_ARC || GDISP_NEED_ARCSECTORS || defined(__DOXYGEN__)
1134 #define gdispDrawRoundedBox(x,y,cx,cy,r,c) gdispGDrawRoundedBox(GDISP,x,y,cx,cy,r,c)
1149 #define gdispFillRoundedBox(x,y,cx,cy,r,c) gdispGFillRoundedBox(GDISP,x,y,cx,cy,r,c)
1157 #define gdispBlitArea(x, y, cx, cy, buffer) gdispGBlitArea(GDISP, x, y, cx, cy, 0, 0, cx, buffer)
1170 #define gdispGSetPowerMode(g, powerMode) gdispGControl((g), GDISP_CONTROL_POWER, (void *)(gPowermode)(powerMode))
1171 #define gdispSetPowerMode(powerMode) gdispGControl(GDISP, GDISP_CONTROL_POWER, (void *)(gPowermode)(powerMode))
1182 #define gdispGSetOrientation(g, newOrientation) gdispGControl((g), GDISP_CONTROL_ORIENTATION, (void *)(unsigned)(newOrientation))
1183 #define gdispSetOrientation(newOrientation) gdispGControl(GDISP, GDISP_CONTROL_ORIENTATION, (void *)(unsigned)(newOrientation))
1197 #define gdispGSetBacklight(g, percent) gdispGControl((g), GDISP_CONTROL_BACKLIGHT, (void *)(unsigned)(percent))
1198 #define gdispSetBacklight(percent) gdispGControl(GDISP, GDISP_CONTROL_BACKLIGHT, (void *)(unsigned)(percent))
1209 #define gdispGSetContrast(g, percent) gdispGControl((g), GDISP_CONTROL_CONTRAST, (void *)(unsigned)(percent))
1210 #define gdispSetContrast(percent) gdispGControl(GDISP, GDISP_CONTROL_CONTRAST, (void *)(unsigned)(percent))
1221 #define gdispGUnsetClip(g) gdispGSetClip((g),0,0,gdispGGetWidth(g),gdispGGetHeight(g))
1222 #define gdispUnsetClip() gdispGUnsetClip(GDISP)
1224 #if GDISP_NEED_IMAGE || defined(__DOXYGEN__)
1227 #if GDISP_NEED_PIXMAP || defined(__DOXYGEN__)
1233 typedef gColorformat colorformat;
1238 typedef gFont font_t;
1240 #define powerOff gPowerOff
1241 #define powerDeepSleep gPowerDeepSleep
1242 #define powerSleep gPowerSleep
1243 #define powerOn gPowerOn
1245 #define GDISP_ROTATE_0 gOrientation0
1246 #define GDISP_ROTATE_90 gOrientation90
1247 #define GDISP_ROTATE_180 gOrientation180
1248 #define GDISP_ROTATE_270 gOrientation270
1249 #define GDISP_ROTATE_PORTRAIT gOrientationPortrait
1250 #define GDISP_ROTATE_LANDSCAPE gOrientationLandscape
1252 #define justifyLeft gJustifyLeft
1253 #define justifyCenter gJustifyCenter
1254 #define justifyRight gJustifyRight
1255 #define justifyTop gJustifyTop
1256 #define justifyMiddle gJustifyMiddle
1257 #define justifyBottom gJustifyBottom
1258 #define justifyWordWrap gJustifyWordWrap
1259 #define justifyNoWordWrap gJustifyNoWordWrap
1260 #define justifyPad gJustifyPad
1261 #define justifyNoPad gJustifyNoPad
1262 #define JUSTIFYMASK_LEFTRIGHT JUSTIFYMASK_HORIZONTAL
1263 #define JUSTIFYMASK_TOPBOTTOM JUSTIFYMASK_VERTICAL
1265 #define fontHeight gFontHeight
1266 #define fontDescendersHeight gFontDescendersHeight
1267 #define fontLineSpacing gFontLineSpacing
1268 #define fontCharPadding gFontCharPadding
1269 #define fontMinWidth gFontMinWidth
1270 #define fontMaxWidth gFontMaxWidth
1271 #define fontBaselineX gFontBaselineX
1272 #define fontBaselineY gFontBaselineY
1273 #if GDISP_NEED_IMAGE || defined(__DOXYGEN__)
COLOR_TYPE gColor
The color type definition.
GDisplay * gdispGetDisplay(unsigned display)
Get the specified display.
gFont gdispOpenFont(const char *name)
Find a font and return it.
void gdispGDrawArcSectors(GDisplay *g, gCoord x, gCoord y, gCoord radius, gU8 sectors, gColor color)
Draw a selection of 45 degree arcs of a circle.
gU8 gdispGGetBacklight(GDisplay *g)
Get the current display backlight brightness.
gColor gdispBlendColor(gColor fg, gColor bg, gU8 alpha)
Blend 2 colors according to the alpha.
void gdispGVerticalScroll(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, int lines, gColor bgcolor)
Scroll vertically a section of the screen.
gCoord gdispGetCharWidth(char c, gFont font)
Get the pixel width of a character.
void gdispGDrawPixel(GDisplay *g, gCoord x, gCoord y, gColor color)
Set a pixel in the specified color.
void gdispGFillChar(GDisplay *g, gCoord x, gCoord y, gU16 c, gFont font, gColor color, gColor bgcolor)
Draw a text character with a filled background.
gCoord gdispGetFontMetric(gFont font, gFontmetric metric)
Get a metric of a font.
void gdispGClear(GDisplay *g, gColor color)
Clear the display to the specified color.
void gdispGSetClip(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy)
Clip all drawing to the defined area.
GDisplay * GDISP
The default screen to use for the gdispXXXX calls.
void gdispGFillCircle(GDisplay *g, gCoord x, gCoord y, gCoord radius, gColor color)
Draw a filled circle.
void gdispGDrawPoly(GDisplay *g, gCoord tx, gCoord ty, const gPoint *pntarray, unsigned cnt, gColor color)
Draw an enclosed polygon (convex, non-convex or complex).
void gdispCloseFont(gFont font)
Release a font after use.
void gdispGDrawStringBox(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, const char *str, gFont font, gColor color, gJustify justify)
Draw a text string vertically centered within the specified box.
void gdispGDrawRoundedBox(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, gCoord radius, gColor color)
Draw a rectangular box with rounded corners.
gBool gdispAddFont(gFont font)
Add a font permanently to the font list.
void gdispGDrawEllipse(GDisplay *g, gCoord x, gCoord y, gCoord a, gCoord b, gColor color)
Draw an ellipse.
const struct mf_font_s * gFont
The type of a font.
void gdispGFlush(GDisplay *g)
Flush current drawing operations to the display.
void * gdispGQuery(GDisplay *g, unsigned what)
Query a property of the display.
void gdispGBlitArea(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, gCoord srcx, gCoord srcy, gCoord srccx, const gPixel *buffer)
Fill an area using the supplied bitmap.
gColor gPixel
The pixel format.
gU8 gdispGGetContrast(GDisplay *g)
Get the current display contrast.
void gdispGStreamStart(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy)
Start a streaming operation.
gJustify
Type for the text justification.
void gdispGFillArcSectors(GDisplay *g, gCoord x, gCoord y, gCoord radius, gU8 sectors, gColor color)
Fill a selection of 45 degree arcs of a circle.
void gdispGControl(GDisplay *g, unsigned what, void *value)
Control hardware specific parts of the display. eg powermodes, backlight etc.
void gdispGDrawThickArc(GDisplay *g, gCoord xc, gCoord yc, gCoord startradius, gCoord endradius, gCoord startangle, gCoord endangle, gColor color)
Draw a thick arc.
gOrientation
Type for the screen orientation.
gOrientation gdispGGetOrientation(GDisplay *g)
Get the current display orientation.
void gdispGFillEllipse(GDisplay *g, gCoord x, gCoord y, gCoord a, gCoord b, gColor color)
Draw a filled ellipse.
void gdispGDrawCircle(GDisplay *g, gCoord x, gCoord y, gCoord radius, gColor color)
Draw a circle.
gCoord gdispGGetWidth(GDisplay *g)
Get the display width in pixels.
gColor gdispContrastColor(gColor color)
Find a contrasting color.
void gdispGFillArc(GDisplay *g, gCoord x, gCoord y, gCoord radius, gCoord startangle, gCoord endangle, gColor color)
Draw a filled arc.
const char * gdispGetFontName(gFont font)
Get the name of the specified font.
gPowermode
Type for the available power modes for the screen.
void gdispGFillArea(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, gColor color)
Fill an area with a color.
void gdispGDrawChar(GDisplay *g, gCoord x, gCoord y, gU16 c, gFont font, gColor color)
Draw a text character.
void gdispSetDisplay(GDisplay *g)
Set the current default display to the specified display.
void gdispGDrawLine(GDisplay *g, gCoord x0, gCoord y0, gCoord x1, gCoord y1, gColor color)
Draw a line.
void gdispGStreamStop(GDisplay *g)
Finish the current streaming operation.
void gdispGFillRoundedBox(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, gCoord radius, gColor color)
Draw a filled rectangular box with rounded corners.
void gdispGDrawArc(GDisplay *g, gCoord x, gCoord y, gCoord radius, gCoord startangle, gCoord endangle, gColor color)
Draw an arc.
unsigned gdispGetDisplayCount(void)
Get the count of currently active displays.
void gdispGFillStringBox(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, const char *str, gFont font, gColor color, gColor bgColor, gJustify justify)
Draw a text string vertically centered within the specified box. The box background is filled with th...
gColor gdispGGetPixelColor(GDisplay *g, gCoord x, gCoord y)
Get the color of a pixel.
gCoord gdispGetStringWidthCount(const char *str, gFont font, gU16 count)
Get the pixel width of a string of a given character length.
void gdispGDrawString(GDisplay *g, gCoord x, gCoord y, const char *str, gFont font, gColor color)
Draw a text string.
gPowermode gdispGGetPowerMode(GDisplay *g)
Get the current display power mode.
void gdispGDrawThickLine(GDisplay *g, gCoord x0, gCoord y0, gCoord x1, gCoord y1, gColor color, gCoord width, gBool round)
Draw a line with a specified thickness.
gCoord gdispGGetHeight(GDisplay *g)
Get the display height in pixels.
void gdispGFillDualCircle(GDisplay *g, gCoord x, gCoord y, gCoord radius1, gColor color1, gCoord radius2, gColor color2)
Draw two filled circles with the same centre.
void gdispGFillString(GDisplay *g, gCoord x, gCoord y, const char *str, gFont font, gColor color, gColor bgcolor)
Draw a text string.
gI16 gCoord
The type for a coordinate or length on the screen.
gCoord gdispGetStringWidth(const char *str, gFont font)
Get the pixel width of an entire string.
void gdispGStreamColor(GDisplay *g, gColor color)
Send pixel data to the stream.
void gdispGFillConvexPoly(GDisplay *g, gCoord tx, gCoord ty, const gPoint *pntarray, unsigned cnt, gColor color)
Fill a convex polygon.
void gdispGDrawBox(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, gColor color)
Draw a rectangular box.
gFont gdispScaleFont(gFont font, gU8 scale_x, gU8 scale_y)
Make a scaled copy of an existing font.
gFontmetric
Type for the font metric.
The structure for an image.
Type for a 2D point on the screen.