Skip to content

Commit

Permalink
Feat: 增加使用中心坐标和半径参数的圆(ege_circle, ege_fillcircle) (#194)
Browse files Browse the repository at this point in the history
  • Loading branch information
yixy-only authored Jun 5, 2024
1 parent 24b971c commit 8b3c82a
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 14 deletions.
31 changes: 17 additions & 14 deletions include/ege.h
Original file line number Diff line number Diff line change
Expand Up @@ -992,10 +992,13 @@ void EGEAPI ege_enable_aa(bool enable, PIMAGE pimg = NULL);

void EGEAPI ege_setalpha(int alpha, PIMAGE pimg = NULL);

void EGEAPI ege_line (float x1, float y1, float x2, float y2, PIMAGE pimg = NULL);
void EGEAPI ege_line(float x1, float y1, float x2, float y2, PIMAGE pimg = NULL);

void EGEAPI ege_drawpoly (int numOfPoints, const ege_point* points, PIMAGE pimg = NULL);
void EGEAPI ege_fillpoly (int numOfPoints, const ege_point* points, PIMAGE pimg = NULL);
void EGEAPI ege_drawpoly (int numOfPoints, const ege_point* points, PIMAGE pimg = NULL);
void EGEAPI ege_fillpoly (int numOfPoints, const ege_point* points, PIMAGE pimg = NULL);

void EGEAPI ege_bezier (int numOfPoints, const ege_point* points, PIMAGE pimg = NULL);
void EGEAPI ege_drawbezier (int numOfPoints, const ege_point* points, PIMAGE pimg = NULL); // Same as ege_bezier

void EGEAPI ege_drawcurve (int numOfPoints, const ege_point* points, PIMAGE pimg = NULL);
void EGEAPI ege_drawclosedcurve(int numOfPoints, const ege_point* points, PIMAGE pimg = NULL);
Expand All @@ -1004,17 +1007,17 @@ void EGEAPI ege_drawcurve (int numOfPoints, const ege_point* points, float
void EGEAPI ege_drawclosedcurve(int numOfPoints, const ege_point* points, float tension, PIMAGE pimg = NULL);
void EGEAPI ege_fillclosedcurve(int numOfPoints, const ege_point* points, float tension, PIMAGE pimg = NULL);

void EGEAPI ege_bezier (int numOfPoints, const ege_point* points, PIMAGE pimg = NULL);
void EGEAPI ege_drawbezier(int numOfPoints, const ege_point* points, PIMAGE pimg = NULL); // Same as ege_bezier
void EGEAPI ege_rectangle (float x, float y, float w, float h, PIMAGE pimg = NULL);
void EGEAPI ege_fillrect (float x, float y, float w, float h, PIMAGE pimg = NULL);

void EGEAPI ege_rectangle(float x, float y, float w, float h, PIMAGE pimg = NULL);
void EGEAPI ege_ellipse (float x, float y, float w, float h, PIMAGE pimg = NULL);
void EGEAPI ege_pie (float x, float y, float w, float h, float startAngle, float sweepAngle, PIMAGE pimg = NULL);
void EGEAPI ege_circle (float x, float y, float radius, PIMAGE pimg);
void EGEAPI ege_fillcircle (float x, float y, float radius, PIMAGE pimg);

void EGEAPI ege_fillrect (float x, float y, float w, float h, PIMAGE pimg = NULL);
void EGEAPI ege_fillellipse(float x, float y, float w, float h, PIMAGE pimg = NULL);
void EGEAPI ege_arc (float x, float y, float w, float h, float startAngle, float sweepAngle, PIMAGE pimg = NULL);
void EGEAPI ege_fillpie (float x, float y, float w, float h, float startAngle, float sweepAngle, PIMAGE pimg = NULL);
void EGEAPI ege_ellipse (float x, float y, float w, float h, PIMAGE pimg = NULL);
void EGEAPI ege_fillellipse (float x, float y, float w, float h, PIMAGE pimg = NULL);
void EGEAPI ege_arc (float x, float y, float w, float h, float startAngle, float sweepAngle, PIMAGE pimg = NULL);
void EGEAPI ege_pie (float x, float y, float w, float h, float startAngle, float sweepAngle, PIMAGE pimg = NULL);
void EGEAPI ege_fillpie (float x, float y, float w, float h, float startAngle, float sweepAngle, PIMAGE pimg = NULL);

void EGEAPI ege_roundrect (float x, float y, float w, float h, float radius, PIMAGE pimg = NULL);
void EGEAPI ege_fillroundrect(float x, float y, float w, float h, float radius, PIMAGE pimg = NULL);
Expand All @@ -1027,7 +1030,7 @@ void EGEAPI ege_setpattern_pathgradient(ege_point center, color_t centerColor, i
void EGEAPI ege_setpattern_ellipsegradient(ege_point center, color_t centerColor, float x, float y, float w, float h, color_t color, PIMAGE pimg = NULL);
void EGEAPI ege_setpattern_texture(PIMAGE imgSrc, float x, float y, float w, float h, PIMAGE pimg = NULL);

void EGEAPI ege_drawtext(const char* text, float x, float y, PIMAGE pimg = NULL);
void EGEAPI ege_drawtext(const char* text, float x, float y, PIMAGE pimg = NULL);
void EGEAPI ege_drawtext(const wchar_t* text, float x, float y, PIMAGE pimg = NULL);

void EGEAPI ege_gentexture(bool generate, PIMAGE pimg = NULL);
Expand All @@ -1036,7 +1039,7 @@ void EGEAPI ege_puttexture(PCIMAGE imgSrc, ege_rect dest, PIMAGE pimg = NULL);
void EGEAPI ege_puttexture(PCIMAGE imgSrc, ege_rect dest, ege_rect src, PIMAGE pimg = NULL);

//draw image
void EGEAPI ege_drawimage(PCIMAGE imgSrc,int xDest, int yDest,PIMAGE pimg = NULL);
void EGEAPI ege_drawimage(PCIMAGE imgSrc,int xDest, int yDest, PIMAGE pimg = NULL);
void EGEAPI ege_drawimage(PCIMAGE imgSrc,int xDest, int yDest, int widthDest, int heightDest, int xSrc, int ySrc, int widthSrc, int heightSrc,PIMAGE pimg = NULL);

// matrix for transformation
Expand Down
10 changes: 10 additions & 0 deletions src/egegapi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1582,6 +1582,16 @@ void ege_rectangle(float x, float y, float w, float h, PIMAGE pimg)
CONVERT_IMAGE_END;
}

void ege_circle(float x, float y, float radius, PIMAGE pimg)
{
ege_ellipse(x - radius, y - radius, radius * 2.0f, radius * 2.0f, pimg);
}

void ege_fillcircle(float x, float y, float radius, PIMAGE pimg)
{
ege_fillellipse(x - radius, y - radius, radius * 2.0f, radius * 2.0f, pimg);
}

void ege_ellipse(float x, float y, float w, float h, PIMAGE pimg)
{
PIMAGE img = CONVERT_IMAGE(pimg);
Expand Down

0 comments on commit 8b3c82a

Please sign in to comment.