GUIslice  0.16.0
Embedded GUI in C
General Functions

General functions for configuring the GUI. More...

Functions

char * gslc_GetVer (gslc_tsGui *pGui)
 Get the GUIslice version number. More...
 
const char * gslc_GetNameDisp (gslc_tsGui *pGui)
 Get the GUIslice display driver name. More...
 
const char * gslc_GetNameTouch (gslc_tsGui *pGui)
 Get the GUIslice touch driver name. More...
 
void * gslc_GetDriverDisp (gslc_tsGui *pGui)
 Get the native display driver instance. More...
 
void * gslc_GetDriverTouch (gslc_tsGui *pGui)
 Get the native touch driver instance. More...
 
bool gslc_Init (gslc_tsGui *pGui, void *pvDriver, gslc_tsPage *asPage, uint8_t nMaxPage, gslc_tsFont *asFont, uint8_t nMaxFont)
 Initialize the GUIslice library. More...
 
void gslc_InitDebug (GSLC_CB_DEBUG_OUT pfunc)
 Initialize debug output. More...
 
void gslc_DebugPrintf (const char *pFmt,...)
 Optimized printf routine for GUIslice debug/error output. More...
 
bool gslc_GuiRotate (gslc_tsGui *pGui, uint8_t nRotation)
 Dynamically change rotation, automatically adapt touchscreen axes swap/flip. More...
 
void gslc_Quit (gslc_tsGui *pGui)
 Exit the GUIslice environment. More...
 
void gslc_Update (gslc_tsGui *pGui)
 Perform main GUIslice handling functions. More...
 
bool gslc_SetBkgndImage (gslc_tsGui *pGui, gslc_tsImgRef sImgRef)
 Configure the background to use a bitmap image. More...
 
bool gslc_SetBkgndColor (gslc_tsGui *pGui, gslc_tsColor nCol)
 Configure the background to use a solid color. More...
 
bool gslc_SetTransparentColor (gslc_tsGui *pGui, gslc_tsColor nCol)
 Configure the color to use for image transparency. More...
 
gslc_tsRect gslc_GetClipRect (gslc_tsGui *pGui)
 Get the current the clipping rectangle. More...
 
bool gslc_SetClipRect (gslc_tsGui *pGui, gslc_tsRect *pRect)
 Set the clipping rectangle for further drawing. More...
 

Detailed Description

General functions for configuring the GUI.

Function Documentation

void gslc_DebugPrintf ( const char *  pFmt,
  ... 
)

Optimized printf routine for GUIslice debug/error output.

  • Only supports 's','d','u' tokens
  • Calls on the output function configured in gslc_InitDebug()
Parameters
[in]pFmtFormat string to use for printing
[in]...Variable parameter list
Returns
none
gslc_tsRect gslc_GetClipRect ( gslc_tsGui *  pGui)

Get the current the clipping rectangle.

Parameters
[in]pGuiPointer to GUI
Returns
rect for active clipping region
void* gslc_GetDriverDisp ( gslc_tsGui *  pGui)

Get the native display driver instance.

  • This can be useful to access special commands available in the selected driver.
Parameters
[in]pGuiPointer to GUI
Returns
Void pointer to the display driver instance. This pointer should be typecast to the particular driver being used. If no driver was created then this function will return NULL.
void* gslc_GetDriverTouch ( gslc_tsGui *  pGui)

Get the native touch driver instance.

  • This can be useful to access special commands available in the selected driver.
Parameters
[in]pGuiPointer to GUI
Returns
Void pointer to the touch driver instance. This pointer should be typecast to the particular driver being used. If no driver was created then this function will return NULL.
const char* gslc_GetNameDisp ( gslc_tsGui *  pGui)

Get the GUIslice display driver name.

Parameters
[in]pGuiPointer to GUI
Returns
String containing driver name
const char* gslc_GetNameTouch ( gslc_tsGui *  pGui)

Get the GUIslice touch driver name.

Parameters
[in]pGuiPointer to GUI
Returns
String containing driver name
char* gslc_GetVer ( gslc_tsGui *  pGui)

Get the GUIslice version number.

Parameters
[in]pGuiPointer to GUI
Returns
String containing version number
bool gslc_GuiRotate ( gslc_tsGui *  pGui,
uint8_t  nRotation 
)

Dynamically change rotation, automatically adapt touchscreen axes swap/flip.

The function assumes that the touchscreen settings for swap and flip in the GUIslice config are valid for the configured GSLC_ROTATE.

Parameters
[in]pGuiPointer to GUI
[in]nRotationScreen Rotation value (0, 1, 2 or 3)
Returns
true if success, false otherwise
bool gslc_Init ( gslc_tsGui *  pGui,
void *  pvDriver,
gslc_tsPage *  asPage,
uint8_t  nMaxPage,
gslc_tsFont *  asFont,
uint8_t  nMaxFont 
)

Initialize the GUIslice library.

  • Configures the primary screen surface(s)
  • Initializes font support

PRE:

  • The environment variables should be configured before calling gslc_Init().
Parameters
[in]pGuiPointer to GUI
[in]pvDriverVoid pointer to Driver struct (gslc_tsDriver*)
[in]asPagePointer to Page array
[in]nMaxPageSize of Page array
[in]asFontPointer to Font array
[in]nMaxFontSize of Font array
Returns
true if success, false if fail
void gslc_InitDebug ( GSLC_CB_DEBUG_OUT  pfunc)

Initialize debug output.

  • Defines the user function used for debug/error output
  • pfunc is responsible for outputing a single character
  • For Arduino, this user function would typically call Serial.print()
Parameters
[in]pfuncPointer to user character-out function
Returns
none
void gslc_Quit ( gslc_tsGui *  pGui)

Exit the GUIslice environment.

  • Calls lower-level destructors to clean up any initialized subsystems and deletes any created elements or fonts
Parameters
[in]pGuiPointer to GUI
Returns
None
bool gslc_SetBkgndColor ( gslc_tsGui *  pGui,
gslc_tsColor  nCol 
)

Configure the background to use a solid color.

  • The background is used when redrawing the entire page
Parameters
[in]pGuiPointer to GUI
[in]nColRGB Color to use
Returns
true if success, false if fail
bool gslc_SetBkgndImage ( gslc_tsGui *  pGui,
gslc_tsImgRef  sImgRef 
)

Configure the background to use a bitmap image.

  • The background is used when redrawing the entire page
Parameters
[in]pGuiPointer to GUI
[in]sImgRefImage reference
Returns
true if success, false if fail
bool gslc_SetClipRect ( gslc_tsGui *  pGui,
gslc_tsRect *  pRect 
)

Set the clipping rectangle for further drawing.

Parameters
[in]pGuiPointer to GUI
[in]pRectPointer to Rect for clipping (or NULL for entire screen)
Returns
true if success, false if error
bool gslc_SetTransparentColor ( gslc_tsGui *  pGui,
gslc_tsColor  nCol 
)

Configure the color to use for image transparency.

  • Drawing a BMP with transparency enabled will cause regions in this specific color to appear transparent
  • This API overrides the config option GSLC_BMP_TRANS_RGB
Parameters
[in]pGuiPointer to GUI
[in]nColRGB Color to use
Returns
true if success, false if fail
void gslc_Update ( gslc_tsGui *  pGui)

Perform main GUIslice handling functions.

  • Handles any touch events
  • Performs any necessary screen redraw
Parameters
[in]pGuiPointer to GUI
Returns
None