/**1* @file lv_circ.c2* Circle drawing algorithm (with Bresenham)3* Only a 1/8 circle is calculated. Use CIRC_OCT1_X, CIRC_OCT1_Y macros to get4* the other octets.5*/67/*********************8* INCLUDES9*********************/10#include "lv_circ.h"1112/*********************13* DEFINES14*********************/1516/**********************17* TYPEDEFS18**********************/1920/**********************21* STATIC PROTOTYPES22**********************/2324/**********************25* STATIC VARIABLES26**********************/2728/**********************29* MACROS30**********************/3132/**********************33* GLOBAL FUNCTIONS34**********************/3536/**37* Initialize the circle drawing38* @param c pointer to a point. The coordinates will be calculated here39* @param tmp point to a variable. It will store temporary data40* @param radius radius of the circle41*/42void lv_circ_init(lv_point_t * c, lv_coord_t * tmp, lv_coord_t radius)43{44c->x = radius;45c->y = 0;46*tmp = 1 - radius;47}4849/**50* Test the circle drawing is ready or not51* @param c same as in circ_init52* @return true if the circle is not ready yet53*/54bool lv_circ_cont(lv_point_t * c)55{56return c->y <= c->x ? true : false;57}5859/**60* Get the next point from the circle61* @param c same as in circ_init. The next point stored here.62* @param tmp same as in circ_init.63*/64void lv_circ_next(lv_point_t * c, lv_coord_t * tmp)65{66c->y++;6768if(*tmp <= 0) {69(*tmp) += 2 * c->y + 1; // Change in decision criterion for y -> y+170} else {71c->x--;72(*tmp) += 2 * (c->y - c->x) + 1; // Change for y -> y+1, x -> x-173}74}7576/**********************77* STATIC FUNCTIONS78**********************/798081