glib_circle.c File Reference

Silicon Labs Graphics Library: Circle Drawing Routines.

License

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_circle.c.

#include <stdint.h>
#include "em_types.h"
#include "glib.h"

Functions

EMSTATUS GLIB_drawCircle (GLIB_Context_t *pContext, int32_t xCenter, int32_t yCenter, uint32_t radius)
 Draws a circle with center at x, y, and a radius.
 
EMSTATUS GLIB_drawCircleFilled (GLIB_Context_t *pContext, int32_t xCenter, int32_t yCenter, uint32_t radius)
 Draws a filled circle with center at x, y, and a radius.
 
EMSTATUS GLIB_drawPartialCircle (GLIB_Context_t *pContext, int32_t xCenter, int32_t yCenter, uint32_t radius, uint8_t bitMask)
 Draws a partial circle with center at x, y, and a radius.
 
static EMSTATUS GLIB_drawPartialCirclePoints (GLIB_Context_t *pContext, int32_t xCenter, int32_t yCenter, int32_t x, int32_t y, uint8_t bitMask)
 Draws circle points using 8-way symmetry.
 

Function Documentation

static EMSTATUS GLIB_drawPartialCirclePoints ( GLIB_Context_t pContext,
int32_t  xCenter,
int32_t  yCenter,
int32_t  x,
int32_t  y,
uint8_t  bitMask 
)
static

Draws circle points using 8-way symmetry.

Example: bitMask = 4 draws only pixels in 3. octant (00000100). bitMask = 5 draws only pixels in 3. and 1. octant (00000101).

Parameters
pContextPointer to a GLIB_Context_t in which the circle is drawn. The circle is drawn using the foreground color.
xCenterCenter x-coordinate
yCenterCenter y-coordinate
xx-coordinate of circle point
yy-coordinate of circle point
bitMaskBitmask which decides which octants pixels should be drawn The LSB is 1. octant, and the MSB is 8. octant. The octants are ordered from 1 to 8 in counterclockwise order.
Returns
  • Returns GLIB_OK on succes.
  • Returns GLIB_ERROR_NOTHING_TO_DRAW if none of the points were drawn
  • Returns error code otherwise

Definition at line 246 of file glib_circle.c.

References GLIB_drawPixel(), GLIB_ERROR_NOTHING_TO_DRAW, and GLIB_OK.

Referenced by GLIB_drawPartialCircle().