summaryrefslogtreecommitdiffstats
path: root/win/tkWinDraw.c
diff options
context:
space:
mode:
Diffstat (limited to 'win/tkWinDraw.c')
-rw-r--r--win/tkWinDraw.c132
1 files changed, 109 insertions, 23 deletions
diff --git a/win/tkWinDraw.c b/win/tkWinDraw.c
index ba4176c..1d17cc6 100644
--- a/win/tkWinDraw.c
+++ b/win/tkWinDraw.c
@@ -486,7 +486,7 @@ XCopyPlane(
/*
*----------------------------------------------------------------------
*
- * TkPutImage --
+ * TkPutImage, XPutImage --
*
* Copies a subimage from an in-memory image to a rectangle of of the
* specified drawable.
@@ -599,6 +599,21 @@ TkPutImage(
TkWinReleaseDrawableDC(d, dc, &state);
return Success;
}
+
+int
+XPutImage(
+ Display *display,
+ Drawable d, /* Destination drawable. */
+ GC gc,
+ XImage *image, /* Source image. */
+ int src_x, int src_y, /* Offset of subimage. */
+ int dest_x, int dest_y, /* Position of subimage origin in drawable. */
+ unsigned int width, unsigned int height)
+ /* Dimensions of subimage. */
+{
+ return TkPutImage(NULL, 0, display, d, gc, image,
+ src_x, src_y, dest_x, dest_y, width, height);
+}
/*
*----------------------------------------------------------------------
@@ -625,7 +640,6 @@ XFillRectangles(
int nrectangles)
{
HDC dc;
- int i;
RECT rect;
TkWinDCState state;
HBRUSH brush, oldBrush;
@@ -666,25 +680,26 @@ XFillRectangles(
* result with the stipple pattern.
*/
- for (i = 0; i < nrectangles; i++) {
- bitmap = CreateCompatibleBitmap(dc, rectangles[i].width,
- rectangles[i].height);
+ while (nrectangles-- > 0) {
+ bitmap = CreateCompatibleBitmap(dc, rectangles[0].width,
+ rectangles[0].height);
oldBitmap = SelectObject(dcMem, bitmap);
rect.left = 0;
rect.top = 0;
- rect.right = rectangles[i].width;
- rect.bottom = rectangles[i].height;
+ rect.right = rectangles[0].width;
+ rect.bottom = rectangles[0].height;
FillRect(dcMem, &rect, brush);
- BitBlt(dc, rectangles[i].x, rectangles[i].y, rectangles[i].width,
- rectangles[i].height, dcMem, 0, 0, COPYFG);
+ BitBlt(dc, rectangles[0].x, rectangles[0].y, rectangles[0].width,
+ rectangles[0].height, dcMem, 0, 0, COPYFG);
if (gc->fill_style == FillOpaqueStippled) {
FillRect(dcMem, &rect, bgBrush);
- BitBlt(dc, rectangles[i].x, rectangles[i].y,
- rectangles[i].width, rectangles[i].height, dcMem,
+ BitBlt(dc, rectangles[0].x, rectangles[0].y,
+ rectangles[0].width, rectangles[0].height, dcMem,
0, 0, COPYBG);
}
SelectObject(dcMem, oldBitmap);
DeleteObject(bitmap);
+ ++rectangles;
}
DeleteDC(dcMem);
@@ -693,22 +708,24 @@ XFillRectangles(
DeleteObject(bgBrush);
} else {
if (gc->function == GXcopy) {
- for (i = 0; i < nrectangles; i++) {
- rect.left = rectangles[i].x;
- rect.right = rect.left + rectangles[i].width;
- rect.top = rectangles[i].y;
- rect.bottom = rect.top + rectangles[i].height;
+ while (nrectangles-- > 0) {
+ rect.left = rectangles[0].x;
+ rect.right = rect.left + rectangles[0].width;
+ rect.top = rectangles[0].y;
+ rect.bottom = rect.top + rectangles[0].height;
FillRect(dc, &rect, brush);
+ ++rectangles;
}
} else {
HPEN newPen = CreatePen(PS_NULL, 0, gc->foreground);
HPEN oldPen = SelectObject(dc, newPen);
oldBrush = SelectObject(dc, brush);
- for (i = 0; i < nrectangles; i++) {
- Rectangle(dc, rectangles[i].x, rectangles[i].y,
- rectangles[i].x + rectangles[i].width + 1,
- rectangles[i].y + rectangles[i].height + 1);
+ while (nrectangles-- > 0) {
+ Rectangle(dc, rectangles[0].x, rectangles[0].y,
+ rectangles[0].x + rectangles[0].width + 1,
+ rectangles[0].y + rectangles[0].height + 1);
+ ++rectangles;
}
SelectObject(dc, oldBrush);
@@ -940,7 +957,7 @@ XFillPolygon(
/*
*----------------------------------------------------------------------
*
- * XDrawRectangle --
+ * XDrawRectangle, XDrawRectangles --
*
* Draws a rectangle.
*
@@ -985,11 +1002,32 @@ XDrawRectangle(
TkWinReleaseDrawableDC(d, dc, &state);
return Success;
}
+
+int
+XDrawRectangles(
+ Display *display,
+ Drawable d,
+ GC gc,
+ XRectangle rects[],
+ int nrects)
+{
+ int ret = Success;
+
+ while (nrects-- > 0) {
+ ret = XDrawRectangle(display, d, gc, rects[0].x, rects[0].y,
+ rects[0].width, rects[0].height);
+ if (ret != Success) {
+ break;
+ }
+ ++rects;
+ }
+ return ret;
+}
/*
*----------------------------------------------------------------------
*
- * XDrawArc --
+ * XDrawArc, XDrawArcs --
*
* Draw an arc.
*
@@ -1015,11 +1053,35 @@ XDrawArc(
return DrawOrFillArc(display, d, gc, x, y, width, height, start, extent, 0);
}
+
+int
+XDrawArcs(
+ Display *display,
+ Drawable d,
+ GC gc,
+ XArc *arcs,
+ int narcs)
+{
+ int ret = Success;
+
+ display->request++;
+
+ while (narcs-- > 0) {
+ ret = DrawOrFillArc(display, d, gc, arcs[0].x, arcs[0].y,
+ arcs[0].width, arcs[0].height,
+ arcs[0].angle1, arcs[0].angle2, 0);
+ if (ret != Success) {
+ break;
+ }
+ ++arcs;
+ }
+ return ret;
+}
/*
*----------------------------------------------------------------------
*
- * XFillArc --
+ * XFillArc, XFillArcs --
*
* Draw a filled arc.
*
@@ -1045,6 +1107,30 @@ XFillArc(
return DrawOrFillArc(display, d, gc, x, y, width, height, start, extent, 1);
}
+
+int
+XFillArcs(
+ Display *display,
+ Drawable d,
+ GC gc,
+ XArc *arcs,
+ int narcs)
+{
+ int ret = Success;
+
+ display->request++;
+
+ while (narcs-- > 0) {
+ ret = DrawOrFillArc(display, d, gc, arcs[0].x, arcs[0].y,
+ arcs[0].width, arcs[0].height,
+ arcs[0].angle1, arcs[0].angle2, 1);
+ if (ret != Success) {
+ break;
+ }
+ ++arcs;
+ }
+ return ret;
+}
/*
*----------------------------------------------------------------------