GUIslice
0.16.0
Embedded GUI in C
|
Helper functions that support graphics operations. More...
Functions | |
bool | gslc_IsInRect (int16_t nSelX, int16_t nSelY, gslc_tsRect rRect) |
Determine if a coordinate is inside of a rectangular region. More... | |
gslc_tsRect | gslc_ExpandRect (gslc_tsRect rRect, int16_t nExpandW, int16_t nExpandH) |
Expand or contract a rectangle in width and/or height (equal amounts on both side), based on the centerpoint of the rectangle. More... | |
bool | gslc_IsInWH (int16_t nSelX, int16_t nSelY, uint16_t nWidth, uint16_t nHeight) |
Determine if a coordinate is inside of a width x height region. More... | |
void | gslc_UnionRect (gslc_tsRect *pRect, gslc_tsRect rAddRect) |
Expand a rect to include another rect. More... | |
void | gslc_InvalidateRgnReset (gslc_tsGui *pGui) |
Reset the invalidation region. More... | |
void | gslc_InvalidateRgnPage (gslc_tsGui *pGui, gslc_tsPage *pPage) |
Include an entire page (eg. More... | |
void | gslc_InvalidateRgnScreen (gslc_tsGui *pGui) |
Mark the entire screen as invalidated. More... | |
void | gslc_InvalidateRgnAdd (gslc_tsGui *pGui, gslc_tsRect rAddRect) |
Add a rectangular region to the invalidation region. More... | |
bool | gslc_ClipPt (gslc_tsRect *pClipRect, int16_t nX, int16_t nY) |
Perform basic clipping of a single point to a clipping region. More... | |
bool | gslc_ClipLine (gslc_tsRect *pClipRect, int16_t *pnX0, int16_t *pnY0, int16_t *pnX1, int16_t *pnY1) |
Perform basic clipping of a line to a clipping region. More... | |
bool | gslc_ClipRect (gslc_tsRect *pClipRect, gslc_tsRect *pRect) |
Perform basic clipping of a rectangle to a clipping region. More... | |
gslc_tsImgRef | gslc_GetImageFromFile (const char *pFname, gslc_teImgRefFlags eFmt) |
Create an image reference to a bitmap file in LINUX filesystem. More... | |
gslc_tsImgRef | gslc_GetImageFromSD (const char *pFname, gslc_teImgRefFlags eFmt) |
Create an image reference to a bitmap file in SD card. More... | |
gslc_tsImgRef | gslc_GetImageFromRam (unsigned char *pImgBuf, gslc_teImgRefFlags eFmt) |
Create an image reference to a bitmap in SRAM. More... | |
gslc_tsImgRef | gslc_GetImageFromProg (const unsigned char *pImgBuf, gslc_teImgRefFlags eFmt) |
Create an image reference to a bitmap in program memory (PROGMEM) More... | |
void | gslc_PolarToXY (uint16_t nRad, int16_t n64Ang, int16_t *nDX, int16_t *nDY) |
Convert polar coordinate to cartesian. More... | |
int16_t | gslc_sinFX (int16_t n64Ang) |
Calculate fixed-point sine function from fractional degrees. More... | |
int16_t | gslc_cosFX (int16_t n64Ang) |
Calculate fixed-point cosine function from fractional degrees. More... | |
gslc_tsColor | gslc_ColorBlend2 (gslc_tsColor colStart, gslc_tsColor colEnd, uint16_t nMidAmt, uint16_t nBlendAmt) |
Create a color based on a blend between two colors. More... | |
gslc_tsColor | gslc_ColorBlend3 (gslc_tsColor colStart, gslc_tsColor colMid, gslc_tsColor colEnd, uint16_t nMidAmt, uint16_t nBlendAmt) |
Create a color based on a blend between three colors. More... | |
bool | gslc_ColorEqual (gslc_tsColor a, gslc_tsColor b) |
Check whether two colors are equal. More... | |
Helper functions that support graphics operations.
bool gslc_ClipLine | ( | gslc_tsRect * | pClipRect, |
int16_t * | pnX0, | ||
int16_t * | pnY0, | ||
int16_t * | pnX1, | ||
int16_t * | pnY1 | ||
) |
Perform basic clipping of a line to a clipping region.
[in] | pClipRect | Pointer to clipping region |
[in,out] | pnX0 | Ptr to X coordinate of line start |
[in,out] | pnY0 | Ptr to Y coordinate of line start |
[in,out] | pnX1 | Ptr to X coordinate of line end |
[in,out] | pnY1 | Ptr to Y coordinate of line end |
bool gslc_ClipPt | ( | gslc_tsRect * | pClipRect, |
int16_t | nX, | ||
int16_t | nY | ||
) |
Perform basic clipping of a single point to a clipping region.
[in] | pClipRect | Pointer to clipping region |
[in] | nX | X coordinate of point |
[in] | nY | Y coordinate of point |
bool gslc_ClipRect | ( | gslc_tsRect * | pClipRect, |
gslc_tsRect * | pRect | ||
) |
Perform basic clipping of a rectangle to a clipping region.
[in] | pClipRect | Pointer to clipping region |
[in,out] | pRect | Ptr to rectangle |
gslc_tsColor gslc_ColorBlend2 | ( | gslc_tsColor | colStart, |
gslc_tsColor | colEnd, | ||
uint16_t | nMidAmt, | ||
uint16_t | nBlendAmt | ||
) |
Create a color based on a blend between two colors.
[in] | colStart | Starting color |
[in] | colEnd | Ending color |
[in] | nMidAmt | Position (0..1000) between start and end color at which the midpoint between colors should appear. Normally set to 500 (half-way). |
[in] | nBlendAmt | The position (0..1000) between start and end at which we want to calculate the resulting blended color. |
gslc_tsColor gslc_ColorBlend3 | ( | gslc_tsColor | colStart, |
gslc_tsColor | colMid, | ||
gslc_tsColor | colEnd, | ||
uint16_t | nMidAmt, | ||
uint16_t | nBlendAmt | ||
) |
Create a color based on a blend between three colors.
[in] | colStart | Starting color |
[in] | colMid | Intermediate color |
[in] | colEnd | Ending color |
[in] | nMidAmt | Position (0..1000) between start and end color at which the intermediate color should appear. |
[in] | nBlendAmt | The position (0..1000) between start and end at which we want to calculate the resulting blended color. |
bool gslc_ColorEqual | ( | gslc_tsColor | a, |
gslc_tsColor | b | ||
) |
Check whether two colors are equal.
[in] | a | First color |
[in] | b | Second color |
int16_t gslc_cosFX | ( | int16_t | n64Ang | ) |
Calculate fixed-point cosine function from fractional degrees.
[in] | n64Ang | Angle (in units of 1/64 degrees) |
gslc_tsRect gslc_ExpandRect | ( | gslc_tsRect | rRect, |
int16_t | nExpandW, | ||
int16_t | nExpandH | ||
) |
Expand or contract a rectangle in width and/or height (equal amounts on both side), based on the centerpoint of the rectangle.
[in] | rRect | Rectangular region before resizing |
[in] | nExpandW | Number of pixels to expand the width (if positive) of contract the width (if negative) |
[in] | nExpandH | Number of pixels to expand the height (if positive) of contract the height (if negative) |
gslc_tsImgRef gslc_GetImageFromFile | ( | const char * | pFname, |
gslc_teImgRefFlags | eFmt | ||
) |
Create an image reference to a bitmap file in LINUX filesystem.
[in] | pFname | Pointer to filename string of image in filesystem |
[in] | eFmt | Image format |
gslc_tsImgRef gslc_GetImageFromProg | ( | const unsigned char * | pImgBuf, |
gslc_teImgRefFlags | eFmt | ||
) |
Create an image reference to a bitmap in program memory (PROGMEM)
[in] | pImgBuf | Pointer to image buffer in memory |
[in] | eFmt | Image format |
gslc_tsImgRef gslc_GetImageFromRam | ( | unsigned char * | pImgBuf, |
gslc_teImgRefFlags | eFmt | ||
) |
Create an image reference to a bitmap in SRAM.
[in] | pImgBuf | Pointer to image buffer in memory |
[in] | eFmt | Image format |
gslc_tsImgRef gslc_GetImageFromSD | ( | const char * | pFname, |
gslc_teImgRefFlags | eFmt | ||
) |
Create an image reference to a bitmap file in SD card.
[in] | pFname | Pointer to filename string of image in SD card |
[in] | eFmt | Image format |
void gslc_InvalidateRgnAdd | ( | gslc_tsGui * | pGui, |
gslc_tsRect | rAddRect | ||
) |
Add a rectangular region to the invalidation region.
[in] | pGui | Pointer to GUI |
[in] | rAddRect | Rectangle to add to the invalidation region |
void gslc_InvalidateRgnPage | ( | gslc_tsGui * | pGui, |
gslc_tsPage * | pPage | ||
) |
Include an entire page (eg.
from a page stack) in the invalidation region
[in] | pGui | Pointer to GUI |
[in] | pPage | Pointer to page |
void gslc_InvalidateRgnReset | ( | gslc_tsGui * | pGui | ) |
Reset the invalidation region.
[in] | pGui | Pointer to GUI |
void gslc_InvalidateRgnScreen | ( | gslc_tsGui * | pGui | ) |
Mark the entire screen as invalidated.
[in] | pGui | Pointer to GUI |
bool gslc_IsInRect | ( | int16_t | nSelX, |
int16_t | nSelY, | ||
gslc_tsRect | rRect | ||
) |
Determine if a coordinate is inside of a rectangular region.
[in] | nSelX | X coordinate to test |
[in] | nSelY | X coordinate to test |
[in] | rRect | Rectangular region to compare against |
bool gslc_IsInWH | ( | int16_t | nSelX, |
int16_t | nSelY, | ||
uint16_t | nWidth, | ||
uint16_t | nHeight | ||
) |
Determine if a coordinate is inside of a width x height region.
[in] | nSelX | X coordinate to test |
[in] | nSelY | X coordinate to test |
[in] | nWidth | Width to test against |
[in] | nHeight | Height to test against |
void gslc_PolarToXY | ( | uint16_t | nRad, |
int16_t | n64Ang, | ||
int16_t * | nDX, | ||
int16_t * | nDY | ||
) |
Convert polar coordinate to cartesian.
[in] | nRad | Radius of ray |
[in] | n64Ang | Angle of ray (in units of 1/64 degrees, 0 is up) |
[out] | nDX | X offset for ray end |
[out] | nDY | Y offset for ray end |
int16_t gslc_sinFX | ( | int16_t | n64Ang | ) |
Calculate fixed-point sine function from fractional degrees.
[in] | n64Ang | Angle (in units of 1/64 degrees) |
void gslc_UnionRect | ( | gslc_tsRect * | pRect, |
gslc_tsRect | rAddRect | ||
) |
Expand a rect to include another rect.
[in] | pRect | Initial rect region |
[in] | rAddRect | Rectangle to add to the rect region |