glib_circle.c File Reference

Silicon Labs Graphics Library: Circle Drawing Routines.

License

Copyright 2018 Silicon Laboratories Inc. www.silabs.com

The licensor of this software is Silicon Laboratories Inc. Your use of this software is governed by the terms of Silicon Labs Master Software License Agreement (MSLA) available at www.silabs.com/about-us/legal/master-software-license-agreement. This software is distributed to you in Source Code format and is governed by the sections of the MSLA applicable to Source Code.

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 249 of file glib_circle.c.

References GLIB_drawPixel(), GLIB_ERROR_NOTHING_TO_DRAW, and GLIB_OK.

Referenced by GLIB_drawPartialCircle().