mirror of
https://github.com/raysan5/raylib.git
synced 2026-01-28 09:49:18 -05:00
Review formating from PR #1138
This commit is contained in:
@ -2029,8 +2029,9 @@ void ImageDrawPixel(Image *dst, Vector2 position, Color color)
|
|||||||
// Draw circle within an image
|
// Draw circle within an image
|
||||||
void ImageDrawCircle(Image *dst, Vector2 center, int radius, Color color)
|
void ImageDrawCircle(Image *dst, Vector2 center, int radius, Color color)
|
||||||
{
|
{
|
||||||
int x = 0, y = radius, xc = center.x, yc = center.y;
|
int x = 0, y = radius, xc = (int)center.x, yc = (int)center.y;
|
||||||
int decesionParameter = 3 - 2 * radius;
|
int decesionParameter = 3 - 2*radius;
|
||||||
|
|
||||||
while (y >= x)
|
while (y >= x)
|
||||||
{
|
{
|
||||||
ImageDrawPixel(dst, (Vector2){ xc + x, yc + y }, color);
|
ImageDrawPixel(dst, (Vector2){ xc + x, yc + y }, color);
|
||||||
@ -2042,22 +2043,23 @@ void ImageDrawCircle(Image *dst, Vector2 center, int radius, Color color)
|
|||||||
ImageDrawPixel(dst, (Vector2){ xc + y, yc - x }, color);
|
ImageDrawPixel(dst, (Vector2){ xc + y, yc - x }, color);
|
||||||
ImageDrawPixel(dst, (Vector2){ xc - y, yc - x }, color);
|
ImageDrawPixel(dst, (Vector2){ xc - y, yc - x }, color);
|
||||||
x++;
|
x++;
|
||||||
|
|
||||||
if (decesionParameter > 0)
|
if (decesionParameter > 0)
|
||||||
{
|
{
|
||||||
y--;
|
y--;
|
||||||
decesionParameter = decesionParameter + 4 * (x - y) + 10;
|
decesionParameter = decesionParameter + 4*(x - y) + 10;
|
||||||
}
|
}
|
||||||
else
|
else decesionParameter = decesionParameter + 4*x + 6;
|
||||||
decesionParameter = decesionParameter + 4 * x + 6;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw line within an image
|
// Draw line within an image
|
||||||
void ImageDrawLineEx(Image *dst, Vector2 start, Vector2 end, Color color)
|
void ImageDrawLineEx(Image *dst, Vector2 start, Vector2 end, Color color)
|
||||||
{
|
{
|
||||||
int x1 = start.x, y1 = start.y, x2 = end.x, y2 = end.y;
|
int x1 = (int)start.x, y1 = (int)start.y, x2 = (int)end.x, y2 = (int)end.y;
|
||||||
int m = 2 * (y2 - y1);
|
int m = 2*(y2 - y1);
|
||||||
int slopeError = m - (x2 - x1);
|
int slopeError = m - (x2 - x1);
|
||||||
|
|
||||||
for (int x = x1, y = y1; x <= x2; x++)
|
for (int x = x1, y = y1; x <= x2; x++)
|
||||||
{
|
{
|
||||||
ImageDrawPixel(dst, (Vector2){ x, y }, color);
|
ImageDrawPixel(dst, (Vector2){ x, y }, color);
|
||||||
@ -2066,7 +2068,7 @@ void ImageDrawLineEx(Image *dst, Vector2 start, Vector2 end, Color color)
|
|||||||
if (slopeError >= 0)
|
if (slopeError >= 0)
|
||||||
{
|
{
|
||||||
y++;
|
y++;
|
||||||
slopeError -= 2 * (x2 - x1);
|
slopeError -= 2*(x2 - x1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user