GUIslice  0.16.0
Embedded GUI in C
Graphics Primitive Functions

These routines cause immediate drawing to occur on the primary screen. More...

Functions

void gslc_DrawSetPixel (gslc_tsGui *pGui, int16_t nX, int16_t nY, gslc_tsColor nCol)
 Set a pixel on the active screen to the given color with lock. More...
 
void gslc_DrawLine (gslc_tsGui *pGui, int16_t nX0, int16_t nY0, int16_t nX1, int16_t nY1, gslc_tsColor nCol)
 Draw an arbitrary line using Bresenham's algorithm. More...
 
void gslc_DrawLineH (gslc_tsGui *pGui, int16_t nX, int16_t nY, uint16_t nW, gslc_tsColor nCol)
 Draw a horizontal line. More...
 
void gslc_DrawLineV (gslc_tsGui *pGui, int16_t nX, int16_t nY, uint16_t nH, gslc_tsColor nCol)
 Draw a vertical line. More...
 
void gslc_DrawLinePolar (gslc_tsGui *pGui, int16_t nX, int16_t nY, uint16_t nRadStart, uint16_t nRadEnd, int16_t n64Ang, gslc_tsColor nCol)
 Draw a polar ray segment. More...
 
void gslc_DrawFrameRect (gslc_tsGui *pGui, gslc_tsRect rRect, gslc_tsColor nCol)
 Draw a framed rectangle. More...
 
void gslc_DrawFrameRoundRect (gslc_tsGui *pGui, gslc_tsRect rRect, int16_t nRadius, gslc_tsColor nCol)
 Draw a framed rounded rectangle. More...
 
void gslc_DrawFillRect (gslc_tsGui *pGui, gslc_tsRect rRect, gslc_tsColor nCol)
 Draw a filled rectangle. More...
 
void gslc_DrawFillRoundRect (gslc_tsGui *pGui, gslc_tsRect rRect, int16_t nRadius, gslc_tsColor nCol)
 Draw a filled rounded rectangle. More...
 
void gslc_DrawFrameCircle (gslc_tsGui *pGui, int16_t nMidX, int16_t nMidY, uint16_t nRadius, gslc_tsColor nCol)
 Draw a framed circle. More...
 
void gslc_DrawFillCircle (gslc_tsGui *pGui, int16_t nMidX, int16_t nMidY, uint16_t nRadius, gslc_tsColor nCol)
 Draw a filled circle. More...
 
void gslc_DrawFrameTriangle (gslc_tsGui *pGui, int16_t nX0, int16_t nY0, int16_t nX1, int16_t nY1, int16_t nX2, int16_t nY2, gslc_tsColor nCol)
 Draw a framed triangle. More...
 
void gslc_DrawFillTriangle (gslc_tsGui *pGui, int16_t nX0, int16_t nY0, int16_t nX1, int16_t nY1, int16_t nX2, int16_t nY2, gslc_tsColor nCol)
 Draw a filled triangle. More...
 
void gslc_DrawFrameQuad (gslc_tsGui *pGui, gslc_tsPt *psPt, gslc_tsColor nCol)
 Draw a framed quadrilateral. More...
 
void gslc_DrawFillQuad (gslc_tsGui *pGui, gslc_tsPt *psPt, gslc_tsColor nCol)
 Draw a filled quadrilateral. More...
 
void gslc_DrawFillGradSector (gslc_tsGui *pGui, int16_t nQuality, int16_t nMidX, int16_t nMidY, int16_t nRad1, int16_t nRad2, gslc_tsColor cArcStart, gslc_tsColor cArcEnd, int16_t nAngSecStart, int16_t nAngSecEnd, int16_t nAngGradStart, int16_t nAngGradRange)
 Draw a gradient filled sector of a circle with support for inner and outer radius. More...
 
void gslc_DrawFillSector (gslc_tsGui *pGui, int16_t nQuality, int16_t nMidX, int16_t nMidY, int16_t nRad1, int16_t nRad2, gslc_tsColor cArc, int16_t nAngSecStart, int16_t nAngSecEnd)
 Draw a flat filled sector of a circle with support for inner and outer radius. More...
 

Detailed Description

These routines cause immediate drawing to occur on the primary screen.

Function Documentation

void gslc_DrawFillCircle ( gslc_tsGui pGui,
int16_t  nMidX,
int16_t  nMidY,
uint16_t  nRadius,
gslc_tsColor  nCol 
)

Draw a filled circle.

Parameters
[in]pGuiPointer to GUI
[in]nMidXCenter X coordinate
[in]nMidYCenter Y coordinate
[in]nRadiusRadius of circle
[in]nColColor RGB value for the fill
Returns
none
void gslc_DrawFillGradSector ( gslc_tsGui pGui,
int16_t  nQuality,
int16_t  nMidX,
int16_t  nMidY,
int16_t  nRad1,
int16_t  nRad2,
gslc_tsColor  cArcStart,
gslc_tsColor  cArcEnd,
int16_t  nAngSecStart,
int16_t  nAngSecEnd,
int16_t  nAngGradStart,
int16_t  nAngGradRange 
)

Draw a gradient filled sector of a circle with support for inner and outer radius.

  • Can be used to create a ring or pie chart
  • Note that the gradient fill is defined by both the color stops (cArcStart..cArcEnd) as well as a gradient angular range (nAngGradStart..nAngGradStart+nAngGradRange). This gradient angular range can be differeng from the drawing angular range (nAngSegStart..nAngSecEnd) to enable more advanced control styling / updates.
Parameters
[in]pGuiPointer to GUI
[in]nQualityNumber of segments used to depict a full circle. The higher the value, the smoother the resulting arcs. A value of 72 provides 360/72=5 degrees per segment which is a reasonable compromise between smoothness and performance. Note that 360/nQuality should be an integer result, thus the allowable quality settings are: 360 (max quality), 180, 120, 90, 72, 60, 45, 40, 36 (low quality), etc.
[in]nMidXMidpoint X coordinate of circle
[in]nMidYMidpoint Y coordinate of circle
[in]nRad1Inner sector radius (0 for sector / pie, non-zero for ring)
[in]nRad2Outer sector radius. Delta from nRad1 defines ring thickness.
[in]cArcStartStart color for gradient fill (with angular range defined by nAngGradStart,nAngGradRange)
[in]cArcEndEnd color for gradient fill
[in]nAngSecStartAngle of start of sector drawing (0 at top), measured in degrees.
[in]nAngSecEndAngle of end of sector drawing (0 at top), measured in degrees.
[in]nAngGradStartFor gradient fill, defines the starting angle associated with the starting color (cArcStart)
[in]nAngGradRangeFor gradient fill, defines the angular range associated with the start-to-end color range (cArcStart..cArcEnd)
Returns
none
void gslc_DrawFillQuad ( gslc_tsGui pGui,
gslc_tsPt psPt,
gslc_tsColor  nCol 
)

Draw a filled quadrilateral.

Parameters
[in]pGuiPointer to GUI
[in]psPtPointer to array of 4 points
[in]nColColor RGB value for the frame
Returns
true if success, false if error
void gslc_DrawFillRect ( gslc_tsGui pGui,
gslc_tsRect  rRect,
gslc_tsColor  nCol 
)

Draw a filled rectangle.

Parameters
[in]pGuiPointer to GUI
[in]rRectRectangular region to fill
[in]nColColor RGB value to fill
Returns
none
void gslc_DrawFillRoundRect ( gslc_tsGui pGui,
gslc_tsRect  rRect,
int16_t  nRadius,
gslc_tsColor  nCol 
)

Draw a filled rounded rectangle.

Parameters
[in]pGuiPointer to GUI
[in]rRectRectangular region to fill
[in]nRadiusRadius for the rounded corners
[in]nColColor RGB value to fill
Returns
none
void gslc_DrawFillSector ( gslc_tsGui pGui,
int16_t  nQuality,
int16_t  nMidX,
int16_t  nMidY,
int16_t  nRad1,
int16_t  nRad2,
gslc_tsColor  cArc,
int16_t  nAngSecStart,
int16_t  nAngSecEnd 
)

Draw a flat filled sector of a circle with support for inner and outer radius.

  • Can be used to create a ring or pie chart
Parameters
[in]pGuiPointer to GUI
[in]nQualityNumber of segments used to depict a full circle. The higher the value, the smoother the resulting arcs. A value of 72 provides 360/72=5 degrees per segment which is a reasonable compromise between smoothness and performance.
[in]nMidXMidpoint X coordinate of circle
[in]nMidYMidpoint Y coordinate of circle
[in]nRad1Inner sector radius (0 for sector / pie, non-zero for ring)
[in]nRad2Outer sector radius. Delta from nRad1 defines ring thickness.
[in]cArcColor for flat fill
[in]nAngSecStartAngle of start of sector drawing (0 at top), measured in degrees.
[in]nAngSecEndAngle of end of sector drawing (0 at top), measured in degrees.
Returns
none
void gslc_DrawFillTriangle ( gslc_tsGui pGui,
int16_t  nX0,
int16_t  nY0,
int16_t  nX1,
int16_t  nY1,
int16_t  nX2,
int16_t  nY2,
gslc_tsColor  nCol 
)

Draw a filled triangle.

Parameters
[in]pGuiPointer to GUI
[in]nX0X Coordinate #1
[in]nY0Y Coordinate #1
[in]nX1X Coordinate #2
[in]nY1Y Coordinate #2
[in]nX2X Coordinate #3
[in]nY2Y Coordinate #3
[in]nColColor RGB value for the fill
Returns
true if success, false if error
void gslc_DrawFrameCircle ( gslc_tsGui pGui,
int16_t  nMidX,
int16_t  nMidY,
uint16_t  nRadius,
gslc_tsColor  nCol 
)

Draw a framed circle.

Parameters
[in]pGuiPointer to GUI
[in]nMidXCenter X coordinate
[in]nMidYCenter Y coordinate
[in]nRadiusRadius of circle
[in]nColColor RGB value for the frame
Returns
none
void gslc_DrawFrameQuad ( gslc_tsGui pGui,
gslc_tsPt psPt,
gslc_tsColor  nCol 
)

Draw a framed quadrilateral.

Parameters
[in]pGuiPointer to GUI
[in]psPtPointer to array of 4 points
[in]nColColor RGB value for the frame
Returns
true if success, false if error
void gslc_DrawFrameRect ( gslc_tsGui pGui,
gslc_tsRect  rRect,
gslc_tsColor  nCol 
)

Draw a framed rectangle.

Parameters
[in]pGuiPointer to GUI
[in]rRectRectangular region to frame
[in]nColColor RGB value for the frame
Returns
none
void gslc_DrawFrameRoundRect ( gslc_tsGui pGui,
gslc_tsRect  rRect,
int16_t  nRadius,
gslc_tsColor  nCol 
)

Draw a framed rounded rectangle.

Parameters
[in]pGuiPointer to GUI
[in]rRectRectangular region to frame
[in]nRadiusRadius for the rounded corners
[in]nColColor RGB value for the frame
Returns
none
void gslc_DrawFrameTriangle ( gslc_tsGui pGui,
int16_t  nX0,
int16_t  nY0,
int16_t  nX1,
int16_t  nY1,
int16_t  nX2,
int16_t  nY2,
gslc_tsColor  nCol 
)

Draw a framed triangle.

Parameters
[in]pGuiPointer to GUI
[in]nX0X Coordinate #1
[in]nY0Y Coordinate #1
[in]nX1X Coordinate #2
[in]nY1Y Coordinate #2
[in]nX2X Coordinate #3
[in]nY2Y Coordinate #3
[in]nColColor RGB value for the frame
Returns
true if success, false if error
void gslc_DrawLine ( gslc_tsGui pGui,
int16_t  nX0,
int16_t  nY0,
int16_t  nX1,
int16_t  nY1,
gslc_tsColor  nCol 
)

Draw an arbitrary line using Bresenham's algorithm.

Parameters
[in]pGuiPointer to GUI
[in]nX0X coordinate of line startpoint
[in]nY0Y coordinate of line startpoint
[in]nX1X coordinate of line endpoint
[in]nY1Y coordinate of line endpoint
[in]nColColor RGB value for the line
Returns
none
void gslc_DrawLineH ( gslc_tsGui pGui,
int16_t  nX,
int16_t  nY,
uint16_t  nW,
gslc_tsColor  nCol 
)

Draw a horizontal line.

  • Note that direction of line is in +ve X axis
Parameters
[in]pGuiPointer to GUI
[in]nXX coordinate of line startpoint
[in]nYY coordinate of line startpoint
[in]nWWidth of line (in +X direction)
[in]nColColor RGB value for the line
Returns
none
void gslc_DrawLinePolar ( gslc_tsGui pGui,
int16_t  nX,
int16_t  nY,
uint16_t  nRadStart,
uint16_t  nRadEnd,
int16_t  n64Ang,
gslc_tsColor  nCol 
)

Draw a polar ray segment.

Parameters
[in]pGuiPointer to GUI
[in]nXX coordinate of line startpoint
[in]nYY coordinate of line startpoint
[in]nRadStartStarting radius of line
[in]nRadEndEnding radius of line
[in]n64AngAngle of ray (degrees * 64). 0 is up, +90*64 is to right From -180*64 to +180*64
[in]nColColor RGB value for the line
Returns
none
void gslc_DrawLineV ( gslc_tsGui pGui,
int16_t  nX,
int16_t  nY,
uint16_t  nH,
gslc_tsColor  nCol 
)

Draw a vertical line.

  • Note that direction of line is in +ve Y axis
Parameters
[in]pGuiPointer to GUI
[in]nXX coordinate of line startpoint
[in]nYY coordinate of line startpoint
[in]nHHeight of line (in +Y direction)
[in]nColColor RGB value for the line
Returns
none
void gslc_DrawSetPixel ( gslc_tsGui pGui,
int16_t  nX,
int16_t  nY,
gslc_tsColor  nCol 
)

Set a pixel on the active screen to the given color with lock.

  • Calls upon gslc_DrvDrawSetPixelRaw() but wraps with a surface lock lock
  • If repeated access is needed, use gslc_DrvDrawSetPixelRaw() instead
Parameters
[in]pGuiPointer to GUI
[in]nXPixel X coordinate to set
[in]nYPixel Y coordinate to set
[in]nColColor pixel value to assign
Returns
none