new function

git-svn-id: http://svn2.nishi.boats/svn/milsko/trunk@317 b9cfdab3-6d41-4d17-bbe4-086880011989
This commit is contained in:
NishiOwO
2025-10-14 06:56:03 +00:00
parent bf5e65a40d
commit 6fe9770bf8
3 changed files with 17 additions and 0 deletions

View File

@@ -82,6 +82,7 @@ MWDECL MwLL MwLLCreate(MwLL parent, int x, int y, int width, int height);
MWDECL void MwLLDestroy(MwLL handle);
MWDECL void MwLLPolygon(MwLL handle, MwPoint* points, int points_count, MwLLColor color);
MWDECL void MwLLLine(MwLL handle, MwPoint* points, MwLLColor color);
MWDECL MwLLColor MwLLAllocColor(MwLL handle, int r, int g, int b);
MWDECL void MwLLFreeColor(MwLLColor color);

View File

@@ -239,6 +239,16 @@ void MwLLPolygon(MwLL handle, MwPoint* points, int points_count, MwLLColor color
free(p);
}
void MwLLLine(MwLL handle, MwPoint* points, MwLLColor color) {
HPEN pen = CreatePen(PS_SOLID, 1, RGB(color->red, color->green, color->blue));
SelectObject(handle->hDC, pen);
MoveToEx(handle->hDC, points[0].x, points[0].y, NULL);
LineTo(handle->hDC, points[1].x, points[1].y);
DeleteObject(pen);
}
MwLLColor MwLLAllocColor(MwLL handle, int r, int g, int b) {
MwLLColor c = malloc(sizeof(*c));
HDC dc = GetDC(handle->hWnd);

View File

@@ -123,6 +123,12 @@ void MwLLPolygon(MwLL handle, MwPoint* points, int points_count, MwLLColor color
free(p);
}
void MwLLLine(MwLL handle, MwPoint* points, MwLLColor color) {
XSetForeground(handle->display, handle->gc, color->pixel);
XDrawLine(handle->display, handle->pixmap, handle->gc, points[0].x, points[0].y, points[1].x, points[1].y);
}
MwLLColor MwLLAllocColor(MwLL handle, int r, int g, int b) {
MwLLColor c = malloc(sizeof(*c));
XColor xc;