summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1991-05-14 12:09:25 (GMT)
committerGuido van Rossum <guido@python.org>1991-05-14 12:09:25 (GMT)
commita2a181a6a373efb05ace4949be628b4a8b7cf9d0 (patch)
treef63ce60024827bf53e475836fc03a7532fc89129 /Modules
parentcf7423ac8fb8524ace6f6a6f204dc017d481c653 (diff)
downloadcpython-a2a181a6a373efb05ace4949be628b4a8b7cf9d0.zip
cpython-a2a181a6a373efb05ace4949be628b4a8b7cf9d0.tar.gz
cpython-a2a181a6a373efb05ace4949be628b4a8b7cf9d0.tar.bz2
Added xor functions.
Hide/show focus hacks around tedraw are no longer needed.
Diffstat (limited to 'Modules')
-rw-r--r--Modules/stdwinmodule.c55
1 files changed, 46 insertions, 9 deletions
diff --git a/Modules/stdwinmodule.c b/Modules/stdwinmodule.c
index fb448f2..07bb866 100644
--- a/Modules/stdwinmodule.c
+++ b/Modules/stdwinmodule.c
@@ -314,6 +314,7 @@ drawing_circle(dp, args)
INCREF(None);
return None;
}
+
static object *
drawing_fillcircle(dp, args)
drawingobject *dp;
@@ -328,6 +329,19 @@ drawing_fillcircle(dp, args)
}
static object *
+drawing_xorcircle(dp, args)
+ drawingobject *dp;
+ object *args;
+{
+ int a[3];
+ if (!getpointintarg(args, a))
+ return NULL;
+ wxorcircle(a[0], a[1], a[2]);
+ INCREF(None);
+ return None;
+}
+
+static object *
drawing_elarc(dp, args)
drawingobject *dp;
object *args;
@@ -354,6 +368,19 @@ drawing_fillelarc(dp, args)
}
static object *
+drawing_xorelarc(dp, args)
+ drawingobject *dp;
+ object *args;
+{
+ int a[6];
+ if (!get3pointarg(args, a))
+ return NULL;
+ wxorelarc(a[0], a[1], a[2], a[3], a[4], a[5]);
+ INCREF(None);
+ return None;
+}
+
+static object *
drawing_box(dp, args)
drawingobject *dp;
object *args;
@@ -463,6 +490,21 @@ drawing_fillpoly(dp, args)
}
static object *
+drawing_xorpoly(dp, args)
+ drawingobject *dp;
+ object *args;
+{
+ int n;
+ POINT *points = getpointsarray(args, &n);
+ if (points == NULL)
+ return NULL;
+ wxorpoly(n, points);
+ DEL(points);
+ INCREF(None);
+ return None;
+}
+
+static object *
drawing_cliprect(dp, args)
drawingobject *dp;
object *args;
@@ -665,8 +707,8 @@ static struct methodlist drawing_methods[] = {
{"cliprect", drawing_cliprect},
{"elarc", drawing_elarc},
{"erase", drawing_erase},
- {"fillelarc", drawing_fillelarc},
{"fillcircle", drawing_fillcircle},
+ {"fillelarc", drawing_fillelarc},
{"fillpoly", drawing_fillpoly},
{"invert", drawing_invert},
{"line", drawing_line},
@@ -675,7 +717,10 @@ static struct methodlist drawing_methods[] = {
{"poly", drawing_poly},
{"shade", drawing_shade},
{"text", drawing_text},
+ {"xorcircle", drawing_xorcircle},
+ {"xorelarc", drawing_xorelarc},
{"xorline", drawing_xorline},
+ {"xorpoly", drawing_xorpoly},
/* Text measuring methods: */
{"baseline", drawing_baseline},
@@ -801,17 +846,9 @@ text_draw(self, args)
if (a[2] > right) a[2] = right;
if (a[3] > bottom) a[3] = bottom;
if (a[0] < a[2] && a[1] < a[3]) {
- /* Hide/show focus around draw call; these are undocumented,
- but required here to get the highlighting correct.
- The call to werase is also required for this reason.
- Finally, this forces us to require (above) that we are NOT
- already drawing. */
- tehidefocus(tp);
wbegindrawing(self->t_ref->w_win);
- werase(a[0], a[1], a[2], a[3]);
tedrawnew(tp, a[0], a[1], a[2], a[3]);
wenddrawing(self->t_ref->w_win);
- teshowfocus(tp);
}
INCREF(None);
return None;