Skip to content

Commit

Permalink
adjust: 纠正 PIMAGE 和 PCIMAGE 的错误混用 (#260)
Browse files Browse the repository at this point in the history
  • Loading branch information
yixy-only authored Feb 18, 2025
1 parent b7abf8f commit a2d667b
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 60 deletions.
30 changes: 15 additions & 15 deletions include/ege.h
Original file line number Diff line number Diff line change
Expand Up @@ -931,20 +931,20 @@ void EGEAPI window_getviewport(viewporttype * viewport);
void EGEAPI window_getviewport(int* left, int* top, int* right, int* bottom);
void EGEAPI window_setviewport(int left, int top, int right, int bottom);

void EGEAPI setlinewidth(float width, PIMAGE pimg = NULL);

void EGEAPI getlinestyle(int* linestyle, unsigned short* pattern = NULL, int* thickness = NULL, PCIMAGE pimg = NULL);
void EGEAPI setlinestyle(int linestyle, unsigned short pattern = 0, int thickness = 1, PIMAGE pimg = NULL);
void EGEAPI setlinewidth(float width, PIMAGE pimg = NULL);
void EGEAPI setlinestyle(int linestyle, unsigned short pattern = 0, int thickness = 1, PIMAGE pimg = NULL);

void EGEAPI setlinecap(line_cap_type linecap, PIMAGE pimg = NULL);
void EGEAPI setlinecap(line_cap_type startCap, line_cap_type endCap, PIMAGE pimg = NULL);
void EGEAPI getlinecap(line_cap_type* startCap, line_cap_type* endCap, PIMAGE pimg = NULL);
line_cap_type EGEAPI getlinecap(PIMAGE pimg = NULL);
void EGEAPI setlinecap(line_cap_type startCap, line_cap_type endCap, PIMAGE pimg = NULL);
void EGEAPI getlinecap(line_cap_type* startCap, line_cap_type* endCap, PCIMAGE pimg = NULL);
line_cap_type EGEAPI getlinecap(PCIMAGE pimg = NULL);

void EGEAPI setlinejoin(line_join_type linejoin, PIMAGE pimg = NULL);
void EGEAPI setlinejoin(line_join_type linejoin, float miterLimit, PIMAGE pimg = NULL);
void EGEAPI getlinejoin(line_join_type* linejoin, float* miterLimit, PIMAGE pimg = NULL);
line_join_type EGEAPI getlinejoin(PIMAGE pimg = NULL);
void EGEAPI getlinejoin(line_join_type* linejoin, float* miterLimit, PCIMAGE pimg = NULL);
line_join_type EGEAPI getlinejoin(PCIMAGE pimg = NULL);

//void getfillstyle(color_t *pcolor, int *ppattern = NULL, PIMAGE pimg = NULL); // ###
void EGEAPI setfillstyle(int pattern, color_t color, PIMAGE pimg = NULL);
Expand Down Expand Up @@ -1252,15 +1252,15 @@ void EGEAPI outtextrect(int x, int y, int w, int h, const wchar_t* text, PIMAGE
void EGEAPI rectprintf (int x, int y, int w, int h, const char* format, ...);
void EGEAPI rectprintf (int x, int y, int w, int h, const wchar_t* format, ...);

int EGEAPI textwidth(const char* text, PIMAGE pimg = NULL);
int EGEAPI textwidth(const wchar_t* text, PIMAGE pimg = NULL);
int EGEAPI textwidth(char c, PIMAGE pimg = NULL);
int EGEAPI textwidth(wchar_t c, PIMAGE pimg = NULL);
int EGEAPI textwidth(const char* text, PCIMAGE pimg = NULL);
int EGEAPI textwidth(const wchar_t* text, PCIMAGE pimg = NULL);
int EGEAPI textwidth(char c, PCIMAGE pimg = NULL);
int EGEAPI textwidth(wchar_t c, PCIMAGE pimg = NULL);

int EGEAPI textheight(const char* text, PIMAGE pimg = NULL);
int EGEAPI textheight(const wchar_t* text, PIMAGE pimg = NULL);
int EGEAPI textheight(char c, PIMAGE pimg = NULL);
int EGEAPI textheight(wchar_t c, PIMAGE pimg = NULL);
int EGEAPI textheight(const char* text, PCIMAGE pimg = NULL);
int EGEAPI textheight(const wchar_t* text, PCIMAGE pimg = NULL);
int EGEAPI textheight(char c, PCIMAGE pimg = NULL);
int EGEAPI textheight(wchar_t c, PCIMAGE pimg = NULL);

void EGEAPI ege_outtextxy(float x, float y, const char* text, PIMAGE pimg = NULL);
void EGEAPI ege_outtextxy(float x, float y, const wchar_t* text, PIMAGE pimg = NULL);
Expand Down
64 changes: 32 additions & 32 deletions src/egegapi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ int mousepos(int* x, int* y)

void setwritemode(int mode, PIMAGE pimg)
{
PIMAGE img = CONVERT_IMAGE_CONST(pimg);
PIMAGE img = CONVERT_IMAGE(pimg);
SetROP2(img->m_hDC, mode);
CONVERT_IMAGE_END;
}
Expand Down Expand Up @@ -631,7 +631,7 @@ void setcolor(color_t color, PIMAGE pimg)

void setlinecolor(color_t color, PIMAGE pimg)
{
PIMAGE img = CONVERT_IMAGE_CONST(pimg);
PIMAGE img = CONVERT_IMAGE(pimg);
if (img && img->m_hDC) {
img->m_linecolor = color;
update_pen(img);
Expand All @@ -641,7 +641,7 @@ void setlinecolor(color_t color, PIMAGE pimg)

void setfillcolor(color_t color, PIMAGE pimg)
{
PIMAGE img = CONVERT_IMAGE_CONST(pimg);
PIMAGE img = CONVERT_IMAGE(pimg);
img->m_fillcolor = color;
HBRUSH hbr = CreateSolidBrush(ARGBTOZBGR(color));
if (hbr) {
Expand Down Expand Up @@ -724,7 +724,7 @@ void setbkcolor_f(color_t color, PIMAGE pimg)

void settextcolor(color_t color, PIMAGE pimg)
{
PIMAGE img = CONVERT_IMAGE_CONST(pimg);
PIMAGE img = CONVERT_IMAGE(pimg);

if (img && img->m_hDC) {
img->m_textcolor = color;
Expand All @@ -745,7 +745,7 @@ void setfontbkcolor(color_t color, PIMAGE pimg)

void setbkmode(int bkMode, PIMAGE pimg)
{
PIMAGE img = CONVERT_IMAGE_CONST(pimg);
PIMAGE img = CONVERT_IMAGE(pimg);
if (img && img->m_hDC) {
SetBkMode(img->m_hDC, bkMode);
}
Expand Down Expand Up @@ -862,7 +862,7 @@ void sectorf(float x, float y, float startAngle, float endAngle, float xRadius,

void pie(int x, int y, int startAngle, int endAngle, int xRadius, int yRadius, PIMAGE pimg)
{
PIMAGE img = CONVERT_IMAGE_CONST(pimg);
PIMAGE img = CONVERT_IMAGE(pimg);
HBRUSH oldBrush = (HBRUSH)SelectObject(img->m_hDC, GetStockObject(NULL_BRUSH));
fillpie(x, y, startAngle, endAngle, xRadius, yRadius, pimg);
SelectObject(img->m_hDC, oldBrush);
Expand All @@ -871,7 +871,7 @@ void pie(int x, int y, int startAngle, int endAngle, int xRadius, int yRadius, P

void pief(float x, float y, float startAngle, float endAngle, float xRadius, float yRadius, PIMAGE pimg)
{
PIMAGE img = CONVERT_IMAGE_CONST(pimg);
PIMAGE img = CONVERT_IMAGE(pimg);
HBRUSH oldBrush = (HBRUSH)SelectObject(img->m_hDC, GetStockObject(NULL_BRUSH));
fillpief(x, y, startAngle, endAngle, xRadius, yRadius, pimg);
SelectObject(img->m_hDC, oldBrush);
Expand Down Expand Up @@ -916,7 +916,7 @@ void fillpief(float x, float y, float startAngle, float endAngle, float xRadius,

void solidpie(int x, int y, int startAngle, int endAngle, int xRadius, int yRadius, PIMAGE pimg)
{
PIMAGE img = CONVERT_IMAGE_CONST(pimg);
PIMAGE img = CONVERT_IMAGE(pimg);
HBRUSH oldPen = (HBRUSH)SelectObject(img->m_hDC, GetStockObject(NULL_PEN));
fillpie(x, y, startAngle, endAngle, xRadius, yRadius, pimg);
SelectObject(img->m_hDC, oldPen);
Expand All @@ -925,7 +925,7 @@ void solidpie(int x, int y, int startAngle, int endAngle, int xRadius, int yRadi

void solidpief(float x, float y, float startAngle, float endAngle, float xRadius, float yRadius, PIMAGE pimg)
{
PIMAGE img = CONVERT_IMAGE_CONST(pimg);
PIMAGE img = CONVERT_IMAGE(pimg);
HBRUSH oldPen = (HBRUSH)SelectObject(img->m_hDC, GetStockObject(NULL_PEN));
fillpief(x, y, startAngle, endAngle, xRadius, yRadius, pimg);
SelectObject(img->m_hDC, oldPen);
Expand All @@ -952,7 +952,7 @@ void fillellipsef(float x, float y, float xRadius, float yRadius, PIMAGE pimg)

void solidellipse(int x, int y, int xRadius, int yRadius, PIMAGE pimg)
{
PIMAGE img = CONVERT_IMAGE_CONST(pimg);
PIMAGE img = CONVERT_IMAGE(pimg);
HBRUSH oldPen = (HBRUSH)SelectObject(img->m_hDC, GetStockObject(NULL_PEN));
fillellipse(x, y, xRadius, yRadius, pimg);
SelectObject(img->m_hDC, oldPen);
Expand All @@ -961,7 +961,7 @@ void solidellipse(int x, int y, int xRadius, int yRadius, PIMAGE pimg)

void solidellipsef(float x, float y, float xRadius, float yRadius, PIMAGE pimg)
{
PIMAGE img = CONVERT_IMAGE_CONST(pimg);
PIMAGE img = CONVERT_IMAGE(pimg);
HBRUSH oldPen = (HBRUSH)SelectObject(img->m_hDC, GetStockObject(NULL_PEN));
fillellipsef(x, y, xRadius, yRadius, pimg);
SelectObject(img->m_hDC, oldPen);
Expand All @@ -980,7 +980,7 @@ void fillcirclef(float x, float y, float radius, PIMAGE pimg)

void solidcircle(int x, int y, int radius, PIMAGE pimg)
{
PIMAGE img = CONVERT_IMAGE_CONST(pimg);
PIMAGE img = CONVERT_IMAGE(pimg);
HBRUSH oldPen = (HBRUSH)SelectObject(img->m_hDC, GetStockObject(NULL_PEN));
fillcircle(x, y, radius, pimg);
SelectObject(img->m_hDC, oldPen);
Expand All @@ -989,7 +989,7 @@ void solidcircle(int x, int y, int radius, PIMAGE pimg)

void solidcirclef(float x, float y, float radius, PIMAGE pimg)
{
PIMAGE img = CONVERT_IMAGE_CONST(pimg);
PIMAGE img = CONVERT_IMAGE(pimg);
HBRUSH oldPen = (HBRUSH)SelectObject(img->m_hDC, GetStockObject(NULL_PEN));
fillcirclef(x, y, radius, pimg);
SelectObject(img->m_hDC, oldPen);
Expand Down Expand Up @@ -1031,7 +1031,7 @@ void fillroundrect(int left, int top, int right, int bottom, int radius, PIMAGE

void solidroundrect(int left, int top, int right, int bottom, int radius, PIMAGE pimg)
{
PIMAGE img = CONVERT_IMAGE_CONST(pimg);
PIMAGE img = CONVERT_IMAGE(pimg);
HBRUSH oldPen = (HBRUSH)SelectObject(img->m_hDC, GetStockObject(NULL_PEN));
fillroundrect(left, top, right, bottom, radius, pimg);
SelectObject(img->m_hDC, oldPen);
Expand All @@ -1049,7 +1049,7 @@ void fillroundrect(int left, int top, int right, int bottom, int xRadius, int yR

void solidroundrect(int left, int top, int right, int bottom, int xRadius, int yRadius, PIMAGE pimg)
{
PIMAGE img = CONVERT_IMAGE_CONST(pimg);
PIMAGE img = CONVERT_IMAGE(pimg);
HBRUSH oldPen = (HBRUSH)SelectObject(img->m_hDC, GetStockObject(NULL_PEN));
fillroundrect(left, top, right, bottom, xRadius, yRadius, pimg);
SelectObject(img->m_hDC, oldPen);
Expand All @@ -1067,7 +1067,7 @@ void fillrect(int left, int top, int right, int bottom, PIMAGE pimg)

void solidrect(int left, int top, int right, int bottom, PIMAGE pimg)
{
PIMAGE img = CONVERT_IMAGE_CONST(pimg);
PIMAGE img = CONVERT_IMAGE(pimg);
HBRUSH oldPen = (HBRUSH)SelectObject(img->m_hDC, GetStockObject(NULL_PEN));
fillrect(left, top, right, bottom, pimg);
SelectObject(img->m_hDC, oldPen);
Expand Down Expand Up @@ -1132,7 +1132,7 @@ void fillpoly(int numOfPoints, const int* points, PIMAGE pimg)

void solidpoly(int numOfPoints, const int *points, PIMAGE pimg)
{
PIMAGE img = CONVERT_IMAGE_CONST(pimg);
PIMAGE img = CONVERT_IMAGE(pimg);
HBRUSH oldPen = (HBRUSH)SelectObject(img->m_hDC, GetStockObject(NULL_PEN));
fillpoly(numOfPoints, points, pimg);
SelectObject(img->m_hDC, oldPen);
Expand Down Expand Up @@ -1256,7 +1256,7 @@ void getlinestyle(int* linestyle, unsigned short* pattern, int* thickness, PCIMA

void setlinestyle(int linestyle, unsigned short pattern, int thickness, PIMAGE pimg)
{
PIMAGE img = CONVERT_IMAGE_CONST(pimg);
PIMAGE img = CONVERT_IMAGE(pimg);

if (!(img && img->m_hDC)) {
CONVERT_IMAGE_END;
Expand All @@ -1275,7 +1275,7 @@ void setlinestyle(int linestyle, unsigned short pattern, int thickness, PIMAGE p

void setlinewidth(float width, PIMAGE pimg)
{
PIMAGE img = CONVERT_IMAGE_CONST(pimg);
PIMAGE img = CONVERT_IMAGE(pimg);

if (img && img->m_hDC) {
img->m_linestyle.thickness = (int)width;
Expand Down Expand Up @@ -1312,7 +1312,7 @@ Gdiplus::LineJoin convertToGdiplusLineJoin(line_join_type linejoin)

void setlinecap(line_cap_type linecap, PIMAGE pimg)
{
PIMAGE img = CONVERT_IMAGE_CONST(pimg);
PIMAGE img = CONVERT_IMAGE(pimg);

if (img && img->m_hDC) {
img->m_linestartcap = linecap;
Expand All @@ -1325,7 +1325,7 @@ void setlinecap(line_cap_type linecap, PIMAGE pimg)

void setlinecap(line_cap_type startCap, line_cap_type endCap, PIMAGE pimg)
{
PIMAGE img = CONVERT_IMAGE_CONST(pimg);
PIMAGE img = CONVERT_IMAGE(pimg);

if (img && img->m_hDC) {
img->m_linestartcap = startCap;
Expand All @@ -1336,9 +1336,9 @@ void setlinecap(line_cap_type startCap, line_cap_type endCap, PIMAGE pimg)
CONVERT_IMAGE_END;
}

void getlinecap(line_cap_type* startCap, line_cap_type* endCap, PIMAGE pimg)
void getlinecap(line_cap_type* startCap, line_cap_type* endCap, PCIMAGE pimg)
{
PIMAGE img = CONVERT_IMAGE_CONST(pimg);
PCIMAGE img = CONVERT_IMAGE_CONST(pimg);
if (img && img->m_hDC) {
if (startCap != NULL) {
*startCap = img->m_linestartcap;
Expand All @@ -1351,9 +1351,9 @@ void getlinecap(line_cap_type* startCap, line_cap_type* endCap, PIMAGE pimg)
CONVERT_IMAGE_END
}

line_cap_type getlinecap(PIMAGE pimg)
line_cap_type getlinecap(PCIMAGE pimg)
{
PIMAGE img = CONVERT_IMAGE_CONST(pimg);
PCIMAGE img = CONVERT_IMAGE_CONST(pimg);

if (img && img->m_hDC) {
return img->m_linestartcap;
Expand All @@ -1371,7 +1371,7 @@ void setlinejoin(line_join_type linejoin, PIMAGE pimg)

void setlinejoin(line_join_type linejoin, float miterLimit, PIMAGE pimg)
{
PIMAGE img = CONVERT_IMAGE_CONST(pimg);
PIMAGE img = CONVERT_IMAGE(pimg);

if (img && img->m_hDC) {
miterLimit = MAX(1.0f, miterLimit);
Expand All @@ -1382,9 +1382,9 @@ void setlinejoin(line_join_type linejoin, float miterLimit, PIMAGE pimg)
CONVERT_IMAGE_END;
}

void getlinejoin(line_join_type *linejoin, float *miterLimit, PIMAGE pimg)
void getlinejoin(line_join_type *linejoin, float *miterLimit, PCIMAGE pimg)
{
PIMAGE img = CONVERT_IMAGE_CONST(pimg);
PCIMAGE img = CONVERT_IMAGE_CONST(pimg);
if (img && img->m_hDC) {
if (linejoin != NULL) {
*linejoin = img->m_linejoin;
Expand All @@ -1397,9 +1397,9 @@ void getlinejoin(line_join_type *linejoin, float *miterLimit, PIMAGE pimg)
CONVERT_IMAGE_END
}

line_join_type getlinejoin(PIMAGE pimg)
line_join_type getlinejoin(PCIMAGE pimg)
{
PIMAGE img = CONVERT_IMAGE_CONST(pimg);
PCIMAGE img = CONVERT_IMAGE_CONST(pimg);

if (img && img->m_hDC) {
return img->m_linejoin;
Expand All @@ -1410,7 +1410,7 @@ line_join_type getlinejoin(PIMAGE pimg)

void setfillstyle(int pattern, color_t color, PIMAGE pimg)
{
PIMAGE img = CONVERT_IMAGE_CONST(pimg);
PIMAGE img = CONVERT_IMAGE(pimg);
LOGBRUSH lbr = {0};
img->m_fillcolor = color;
lbr.lbColor = ARGBTOZBGR(color);
Expand Down Expand Up @@ -2115,7 +2115,7 @@ void ege_puttexture(PCIMAGE srcimg, float x, float y, float w, float h, PIMAGE p
void ege_puttexture(PCIMAGE srcimg, ege_rect dest, PIMAGE pimg)
{
ege_rect src;
PIMAGE img = CONVERT_IMAGE_CONST(pimg);
PIMAGE img = CONVERT_IMAGE(pimg);
if (img) {
src.x = 0;
src.y = 0;
Expand Down
Loading

0 comments on commit a2d667b

Please sign in to comment.