GUIslice
0.16.0
Embedded GUI in C
|
GUIslice library (driver layer for LINUX / SDL) More...
Go to the source code of this file.
Data Structures | |
struct | gslc_tsDriver |
Macros | |
#define | DRV_HAS_DRAW_POINT |
Support gslc_DrvDrawPoint() More... | |
#define | DRV_OVERRIDE_TXT_ALIGN |
Driver provides text alignment. More... | |
Functions | |
bool | gslc_DrvInit (gslc_tsGui *pGui) |
Initialize the SDL library. More... | |
void | gslc_DrvDestruct (gslc_tsGui *pGui) |
Free up any members associated with the driver. More... | |
const char * | gslc_DrvGetNameDisp (gslc_tsGui *pGui) |
Get the display driver name. More... | |
const char * | gslc_DrvGetNameTouch (gslc_tsGui *pGui) |
Get the touch driver name. More... | |
void * | gslc_DrvGetDriverDisp (gslc_tsGui *pGui) |
Get the native display driver instance. More... | |
void * | gslc_DrvGetDriverTouch (gslc_tsGui *pGui) |
Get the native touch driver instance. More... | |
void * | gslc_DrvLoadImage (gslc_tsGui *pGui, gslc_tsImgRef sImgRef) |
Load a bitmap (*.bmp) and create a new image resource. More... | |
bool | gslc_DrvSetBkgndImage (gslc_tsGui *pGui, gslc_tsImgRef sImgRef) |
Configure the background to use a bitmap image. More... | |
bool | gslc_DrvSetBkgndColor (gslc_tsGui *pGui, gslc_tsColor nCol) |
Configure the background to use a solid color. More... | |
bool | gslc_DrvSetElemImageNorm (gslc_tsGui *pGui, gslc_tsElem *pElem, gslc_tsImgRef sImgRef) |
Set an element's normal-state image. More... | |
bool | gslc_DrvSetElemImageGlow (gslc_tsGui *pGui, gslc_tsElem *pElem, gslc_tsImgRef sImgRef) |
Set an element's glow-state image. More... | |
void | gslc_DrvImageDestruct (void *pvImg) |
Release an image surface. More... | |
bool | gslc_DrvSetClipRect (gslc_tsGui *pGui, gslc_tsRect *pRect) |
Set the clipping rectangle for future drawing updates. More... | |
const void * | gslc_DrvFontAdd (gslc_teFontRefType eFontRefType, const void *pvFontRef, uint16_t nFontSz) |
Load a font from a resource and return pointer to it. More... | |
void | gslc_DrvFontsDestruct (gslc_tsGui *pGui) |
Release all fonts defined in the GUI. More... | |
bool | gslc_DrvGetTxtSize (gslc_tsGui *pGui, gslc_tsFont *pFont, const char *pStr, gslc_teTxtFlags eTxtFlags, int16_t *pnTxtX, int16_t *pnTxtY, uint16_t *pnTxtSzW, uint16_t *pnTxtSzH) |
Get the extent (width and height) of a text string. More... | |
bool | gslc_DrvDrawTxt (gslc_tsGui *pGui, int16_t nTxtX, int16_t nTxtY, gslc_tsFont *pFont, const char *pStr, gslc_teTxtFlags eTxtFlags, gslc_tsColor colTxt, gslc_tsColor colBg) |
Draw a text string at the given coordinate. More... | |
void | gslc_DrvPageFlipNow (gslc_tsGui *pGui) |
Force a page flip to occur. More... | |
bool | gslc_DrvDrawPoint (gslc_tsGui *pGui, int16_t nX, int16_t nY, gslc_tsColor nCol) |
Draw a point. More... | |
bool | gslc_DrvDrawPoints (gslc_tsGui *pGui, gslc_tsPt *asPt, uint16_t nNumPt, gslc_tsColor nCol) |
Draw a point. More... | |
bool | gslc_DrvDrawFrameRect (gslc_tsGui *pGui, gslc_tsRect rRect, gslc_tsColor nCol) |
Draw a framed rectangle. More... | |
bool | gslc_DrvDrawFillRect (gslc_tsGui *pGui, gslc_tsRect rRect, gslc_tsColor nCol) |
Draw a filled rectangle. More... | |
bool | gslc_DrvDrawLine (gslc_tsGui *pGui, int16_t nX0, int16_t nY0, int16_t nX1, int16_t nY1, gslc_tsColor nCol) |
Draw a line. More... | |
bool | gslc_DrvDrawImage (gslc_tsGui *pGui, int16_t nDstX, int16_t nDstY, gslc_tsImgRef sImgRef) |
Copy all of source image to destination screen at specified coordinate. More... | |
void | gslc_DrvDrawBkgnd (gslc_tsGui *pGui) |
Copy the background image to destination screen. More... | |
bool | gslc_DrvGetTouch (gslc_tsGui *pGui, int16_t *pnX, int16_t *pnY, uint16_t *pnPress, gslc_teInputRawEvent *peInputEvent, int16_t *pnInputVal) |
Get the last touch event from the SDL_Event handler. More... | |
bool | gslc_DrvRotate (gslc_tsGui *pGui, uint8_t nRotation) |
Change rotation, automatically adapt touchscreen axes swap/flip. More... | |
bool | gslc_DrvCleanStart (const char *sTTY) |
Ensure SDL initializes cleanly to workaround possible issues if previous SDL application failed to close down gracefully. More... | |
void | gslc_DrvReportInfoPre () |
Report driver debug info (before initialization) More... | |
void | gslc_DrvReportInfoPost () |
Report driver debug info (after initialization) More... | |
SDL_Rect | gslc_DrvAdaptRect (gslc_tsRect rRect) |
Translate a gslc_tsRect into an SDL_Rect. More... | |
SDL_Color | gslc_DrvAdaptColor (gslc_tsColor sCol) |
Translate a gslc_tsColor into an SDL_Color. More... | |
bool | gslc_DrvInitTouch (gslc_tsGui *pGui, const char *acDev) |
Perform any touchscreen-specific initialization. More... | |
GUIslice library (driver layer for LINUX / SDL)
#define DRV_HAS_DRAW_POINT |
Support gslc_DrvDrawPoint()
#define DRV_OVERRIDE_TXT_ALIGN |
Driver provides text alignment.
SDL_Color gslc_DrvAdaptColor | ( | gslc_tsColor | sCol | ) |
Translate a gslc_tsColor into an SDL_Color.
[in] | sCol | gslc_tsColor |
SDL_Rect gslc_DrvAdaptRect | ( | gslc_tsRect | rRect | ) |
bool gslc_DrvCleanStart | ( | const char * | sTTY | ) |
Ensure SDL initializes cleanly to workaround possible issues if previous SDL application failed to close down gracefully.
[in] | sTTY | Terminal device (eg. "/dev/tty0") |
void gslc_DrvDestruct | ( | gslc_tsGui * | pGui | ) |
Free up any members associated with the driver.
[in] | pGui | Pointer to GUI |
void gslc_DrvDrawBkgnd | ( | gslc_tsGui * | pGui | ) |
Copy the background image to destination screen.
[in] | pGui | Pointer to GUI |
bool gslc_DrvDrawFillRect | ( | gslc_tsGui * | pGui, |
gslc_tsRect | rRect, | ||
gslc_tsColor | nCol | ||
) |
Draw a filled rectangle.
[in] | pGui | Pointer to GUI |
[in] | rRect | Rectangular region to fill |
[in] | nCol | Color RGB value to fill |
bool gslc_DrvDrawFrameRect | ( | gslc_tsGui * | pGui, |
gslc_tsRect | rRect, | ||
gslc_tsColor | nCol | ||
) |
Draw a framed rectangle.
[in] | pGui | Pointer to GUI |
[in] | rRect | Rectangular region to frame |
[in] | nCol | Color RGB value to frame |
bool gslc_DrvDrawImage | ( | gslc_tsGui * | pGui, |
int16_t | nDstX, | ||
int16_t | nDstY, | ||
gslc_tsImgRef | sImgRef | ||
) |
Copy all of source image to destination screen at specified coordinate.
[in] | pGui | Pointer to GUI |
[in] | nDstX | Destination X coord for copy |
[in] | nDstY | Destination Y coord for copy |
[in] | sImgRef | Image reference |
bool gslc_DrvDrawLine | ( | gslc_tsGui * | pGui, |
int16_t | nX0, | ||
int16_t | nY0, | ||
int16_t | nX1, | ||
int16_t | nY1, | ||
gslc_tsColor | nCol | ||
) |
Draw a line.
[in] | pGui | Pointer to GUI |
[in] | nX0 | Line start (X coordinate) |
[in] | nY0 | Line start (Y coordinate) |
[in] | nX1 | Line finish (X coordinate) |
[in] | nY1 | Line finish (Y coordinate) |
[in] | nCol | Color RGB value to draw |
bool gslc_DrvDrawPoint | ( | gslc_tsGui * | pGui, |
int16_t | nX, | ||
int16_t | nY, | ||
gslc_tsColor | nCol | ||
) |
Draw a point.
[in] | pGui | Pointer to GUI |
[in] | nX | X coordinate of point |
[in] | nY | Y coordinate of point |
[in] | nCol | Color RGB value to draw |
bool gslc_DrvDrawPoints | ( | gslc_tsGui * | pGui, |
gslc_tsPt * | asPt, | ||
uint16_t | nNumPt, | ||
gslc_tsColor | nCol | ||
) |
Draw a point.
[in] | pGui | Pointer to GUI |
[in] | asPt | Array of points to draw |
[in] | nNumPt | Number of points in array |
[in] | nCol | Color RGB value to draw |
bool gslc_DrvDrawTxt | ( | gslc_tsGui * | pGui, |
int16_t | nTxtX, | ||
int16_t | nTxtY, | ||
gslc_tsFont * | pFont, | ||
const char * | pStr, | ||
gslc_teTxtFlags | eTxtFlags, | ||
gslc_tsColor | colTxt, | ||
gslc_tsColor | colBg | ||
) |
Draw a text string at the given coordinate.
[in] | pGui | Pointer to GUI |
[in] | nTxtX | X coordinate of top-left text string |
[in] | nTxtY | Y coordinate of top-left text string |
[in] | pFont | Ptr to Font |
[in] | pStr | String to display |
[in] | eTxtFlags | Flags associated with text string |
[in] | colTxt | Color to draw text |
[in] | colBg | unused in SDL, defaults to black |
[in] | pGui | Pointer to GUI |
[in] | nTxtX | X coordinate of top-left text string |
[in] | nTxtY | Y coordinate of top-left text string |
[in] | pFont | Ptr to Font |
[in] | pStr | String to display |
[in] | eTxtFlags | Flags associated with text string |
[in] | colTxt | Color to draw text |
[in] | colBg | unused in ADAGFX, defaults to black |
const void* gslc_DrvFontAdd | ( | gslc_teFontRefType | eFontRefType, |
const void * | pvFontRef, | ||
uint16_t | nFontSz | ||
) |
Load a font from a resource and return pointer to it.
[in] | eFontRefType | Font reference type (GSLC_FONTREF_FNAME for SDL) |
[in] | pvFontRef | Font reference pointer (Pointer to the font filename) |
[in] | nFontSz | Typeface size to use |
[in] | eFontRefType | Font reference type (GSLC_FONTREF_PTR for Arduino) |
[in] | pvFontRef | Font reference pointer (Pointer to the GFXFont array) |
[in] | nFontSz | Typeface size to use |
void gslc_DrvFontsDestruct | ( | gslc_tsGui * | pGui | ) |
Release all fonts defined in the GUI.
[in] | pGui | Pointer to GUI |
void* gslc_DrvGetDriverDisp | ( | gslc_tsGui * | pGui | ) |
Get the native display driver instance.
[in] | pGui | Pointer to GUI |
void* gslc_DrvGetDriverTouch | ( | gslc_tsGui * | pGui | ) |
Get the native touch driver instance.
[in] | pGui | Pointer to GUI |
const char* gslc_DrvGetNameDisp | ( | gslc_tsGui * | pGui | ) |
Get the display driver name.
[in] | pGui | Pointer to GUI |
const char* gslc_DrvGetNameTouch | ( | gslc_tsGui * | pGui | ) |
Get the touch driver name.
[in] | pGui | Pointer to GUI |
bool gslc_DrvGetTouch | ( | gslc_tsGui * | pGui, |
int16_t * | pnX, | ||
int16_t * | pnY, | ||
uint16_t * | pnPress, | ||
gslc_teInputRawEvent * | peInputEvent, | ||
int16_t * | pnInputVal | ||
) |
Get the last touch event from the SDL_Event handler.
[in] | pGui | Pointer to GUI |
[out] | pnX | Ptr to X coordinate of last touch event |
[out] | pnY | Ptr to Y coordinate of last touch event |
[out] | pnPress | Ptr to Pressure level of last touch event (0 for none, 1 for touch) |
[out] | peInputEvent | Indication of event type |
[out] | pnInputVal | Additional data for event type |
Get the last touch event from the SDL_Event handler.
[in] | pGui | Pointer to GUI |
[out] | pnX | Ptr to X coordinate of last touch event |
[out] | pnY | Ptr to Y coordinate of last touch event |
[out] | pnPress | Ptr to Pressure level of last touch event (0 for none, 1 for touch) |
[out] | peInputEvent | Indication of event type |
[out] | pnInputVal | Additional data for event type |
bool gslc_DrvGetTxtSize | ( | gslc_tsGui * | pGui, |
gslc_tsFont * | pFont, | ||
const char * | pStr, | ||
gslc_teTxtFlags | eTxtFlags, | ||
int16_t * | pnTxtX, | ||
int16_t * | pnTxtY, | ||
uint16_t * | pnTxtSzW, | ||
uint16_t * | pnTxtSzH | ||
) |
Get the extent (width and height) of a text string.
[in] | pGui | Pointer to GUI |
[in] | pFont | Ptr to Font structure |
[in] | pStr | String to display |
[in] | eTxtFlags | Flags associated with text string |
[out] | pnTxtX | Ptr to offset X of text |
[out] | pnTxtY | Ptr to offset Y of text |
[out] | pnTxtSzW | Ptr to width of text |
[out] | pnTxtSzH | Ptr to height of text |
void gslc_DrvImageDestruct | ( | void * | pvImg | ) |
Release an image surface.
[in] | pvImg | Void ptr to image |
bool gslc_DrvInit | ( | gslc_tsGui * | pGui | ) |
Initialize the SDL library.
PRE:
[in] | pGui | Pointer to GUI |
PRE:
[in] | pGui | Pointer to GUI |
bool gslc_DrvInitTouch | ( | gslc_tsGui * | pGui, |
const char * | acDev | ||
) |
Perform any touchscreen-specific initialization.
[in] | pGui | Pointer to GUI |
[in] | acDev | Device path to touchscreen eg. "/dev/input/touchscreen" |
void* gslc_DrvLoadImage | ( | gslc_tsGui * | pGui, |
gslc_tsImgRef | sImgRef | ||
) |
Load a bitmap (*.bmp) and create a new image resource.
Transparency is enabled by GSLC_BMP_TRANS_EN through use of color (GSLC_BMP_TRANS_RGB).
[in] | pGui | Pointer to GUI |
[in] | sImgRef | Image reference |
Transparency is enabled by GSLC_BMP_TRANS_EN through use of color (GSLC_BMP_TRANS_RGB).
[in] | pGui | Pointer to GUI |
[in] | sImgRef | Image reference |
void gslc_DrvPageFlipNow | ( | gslc_tsGui * | pGui | ) |
Force a page flip to occur.
This generally copies active screen surface to the display.
[in] | pGui | Pointer to GUI |
void gslc_DrvReportInfoPost | ( | ) |
Report driver debug info (after initialization)
void gslc_DrvReportInfoPre | ( | ) |
Report driver debug info (before initialization)
bool gslc_DrvRotate | ( | gslc_tsGui * | pGui, |
uint8_t | nRotation | ||
) |
Change rotation, automatically adapt touchscreen axes swap/flip.
[in] | pGui | Pointer to GUI |
[in] | nRotation | Screen Rotation value (0, 1, 2 or 3) |
Change rotation, automatically adapt touchscreen axes swap/flip.
bool gslc_DrvSetBkgndColor | ( | gslc_tsGui * | pGui, |
gslc_tsColor | nCol | ||
) |
Configure the background to use a solid color.
[in] | pGui | Pointer to GUI |
[in] | nCol | RGB Color to use |
bool gslc_DrvSetBkgndImage | ( | gslc_tsGui * | pGui, |
gslc_tsImgRef | sImgRef | ||
) |
Configure the background to use a bitmap image.
[in] | pGui | Pointer to GUI |
[in] | sImgRef | Image reference |
bool gslc_DrvSetClipRect | ( | gslc_tsGui * | pGui, |
gslc_tsRect * | pRect | ||
) |
Set the clipping rectangle for future drawing updates.
[in] | pGui | Pointer to GUI |
[in] | pRect | Rectangular region to constrain edits |
bool gslc_DrvSetElemImageGlow | ( | gslc_tsGui * | pGui, |
gslc_tsElem * | pElem, | ||
gslc_tsImgRef | sImgRef | ||
) |
Set an element's glow-state image.
[in] | pGui | Pointer to GUI |
[in] | pElem | Pointer to Element to update |
[in] | sImgRef | Image reference |
bool gslc_DrvSetElemImageNorm | ( | gslc_tsGui * | pGui, |
gslc_tsElem * | pElem, | ||
gslc_tsImgRef | sImgRef | ||
) |
Set an element's normal-state image.
[in] | pGui | Pointer to GUI |
[in] | pElem | Pointer to Element to update |
[in] | sImgRef | Image reference |