32 lines
1.1 KiB
C
32 lines
1.1 KiB
C
/* ************************************************************************** */
|
|
/* */
|
|
/* ML_ellipse_in_rect.c */
|
|
/* | Project : libmonochrome */
|
|
/* */
|
|
/* By: Pierre "PierrotLL" Le Gall <legallpierre89@gmail.com> */
|
|
/* Last updated: 2011/11/22 */
|
|
/* */
|
|
/* ************************************************************************** */
|
|
|
|
#include <monochrome/internals.h>
|
|
|
|
void ML_ellipse_in_rect(int x1, int y1, int x2, int y2, ML_Color color)
|
|
{
|
|
int radius1, radius2;
|
|
if(x1 > x2)
|
|
{
|
|
int tmp = x1;
|
|
x1 = x2;
|
|
x2 = tmp;
|
|
}
|
|
if(y1 > y2)
|
|
{
|
|
int tmp = y1;
|
|
y1 = y2;
|
|
y2 = tmp;
|
|
}
|
|
radius1 = (x2-x1)/2;
|
|
radius2 = (y2-y1)/2;
|
|
ML_ellipse(x1+radius1, y1+radius2, radius1, radius2, color);
|
|
}
|