EFM32 Wonder Gecko Software Documentation
efm32wg-doc-5.1.2
|
Silicon Labs Graphics Library: Line Drawing Routines.
Copyright 2015 Silicon Labs, http://www.silabs.com
This file is licensensed under the Silabs License Agreement. See the file "Silabs_License_Agreement.txt" for details. Before using this software for any purpose, you must agree to the terms of that agreement.
Definition in file glib_line.c.
Go to the source code of this file.
Functions | |
static bool | GLIB_clipLine (GLIB_Context_t *pContext, int32_t *pX1, int32_t *pY1, int32_t *pX2, int32_t *pY2) |
Clips the line if necessary, using the Cohen-Sutherland algorithm for clipping lines. See Wikipedia for algorithm. More... | |
EMSTATUS | GLIB_drawLine (GLIB_Context_t *pContext, int32_t x1, int32_t y1, int32_t x2, int32_t y2) |
Draws a line from x1,y1 to x2, y2. More... | |
EMSTATUS | GLIB_drawLineH (GLIB_Context_t *pContext, int32_t x1, int32_t y1, int32_t x2) |
Draws a horizontal line from x1, y1 to x2, y2. More... | |
EMSTATUS | GLIB_drawLineV (GLIB_Context_t *pContext, int32_t x1, int32_t y1, int32_t y2) |
Draws a vertical line from x1, y1 to x1, y2. More... | |
static uint8_t | GLIB_getClipCode (GLIB_Context_t *pContext, int32_t x, int32_t y) |
Gets the clip code for the point that is used by Cohen-Sutherland algorithm. More... | |
|
static |
Clips the line if necessary, using the Cohen-Sutherland algorithm for clipping lines. See Wikipedia for algorithm.
The points are moved using the linear equations: y=y0+slope*(x-x0),x=x0+(1/slope)*(y-y0)
pContext | Pointer to the GLIB_Context_t which holds the clipping region |
pX1 | Pointer to the start x-coordinate |
pY1 | Pointer to the start y-coordinate |
pX2 | Pointer to the end-x coordinate |
pY2 | Pointer to the end-y coordinate |
Definition at line 217 of file glib_line.c.
References __GLIB_Context_t::clippingRegion, GLIB_getClipCode(), __GLIB_Rectangle_t::xMax, __GLIB_Rectangle_t::xMin, __GLIB_Rectangle_t::yMax, and __GLIB_Rectangle_t::yMin.
Referenced by GLIB_drawLine().
|
static |
Gets the clip code for the point that is used by Cohen-Sutherland algorithm.
pContext | Pointer to the GLIB_Context_t which holds the clipping region |
x | Start x-coordinate |
y | Start y-coordinate |
Definition at line 175 of file glib_line.c.
References __GLIB_Context_t::clippingRegion, __GLIB_Rectangle_t::xMax, and __GLIB_Rectangle_t::yMax.
Referenced by GLIB_clipLine().