diff options
author | lecoanet | 2006-10-17 09:37:47 +0000 |
---|---|---|
committer | lecoanet | 2006-10-17 09:37:47 +0000 |
commit | 9918eca9e9723616cd5f70b173b3fcd33253a941 (patch) | |
tree | 869917e331c4844bad736f22483651f8182add00 | |
parent | cd748d0696ed7c03a329472c06db5b1370ad2bd2 (diff) | |
download | tkzinc-9918eca9e9723616cd5f70b173b3fcd33253a941.zip tkzinc-9918eca9e9723616cd5f70b173b3fcd33253a941.tar.gz tkzinc-9918eca9e9723616cd5f70b173b3fcd33253a941.tar.bz2 tkzinc-9918eca9e9723616cd5f70b173b3fcd33253a941.tar.xz |
Added the missing region routines. They are written in QD.
The clipping is not working nicely with the rest of the Tk mac code.
I have no time right now to figure out why.
Still missing are the stippled fills (Rectangle, Arc, Polygon).
-rw-r--r-- | macosx/OSXPort.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/macosx/OSXPort.c b/macosx/OSXPort.c index 780ced9..1174970 100644 --- a/macosx/OSXPort.c +++ b/macosx/OSXPort.c @@ -26,6 +26,9 @@ * */ +#ifdef MAC_OSX_TK + +#include "Types.h" static const char rcsid[] = "$Id"; static const char compile_id[]="$Compile$"; @@ -58,6 +61,13 @@ ZnPointInRegion(TkRegion reg, int x, int y) { + RgnHandle rgn = (RgnHandle) reg; + Point pt; + + pt.h = x; + pt.v = y; + + return (int) PtInRgn(pt, rgn); } /* @@ -80,6 +90,11 @@ ZnUnionRegion(TkRegion sra, TkRegion srb, TkRegion dr_return) { + RgnHandle srcRgnA = (RgnHandle) sra; + RgnHandle srcRgnB = (RgnHandle) srb; + RgnHandle destRgn = (RgnHandle) dr_return; + + UnionRgn(srcRgnA, srcRgnB, destRgn); } /* @@ -102,6 +117,8 @@ ZnOffsetRegion(TkRegion reg, int dx, int dy) { + RgnHandle rgn = (RgnHandle) reg; + OffsetRgn(rgn, (short) dx, (short) dy); } /* @@ -124,8 +141,23 @@ ZnPolygonRegion(XPoint *points, int n, int fill_rule) { + RgnHandle rgn; + int i; + + rgn = NewRgn(); + + OpenRgn(); + MoveTo((short) points[0].x, (short) points[0].y); + for (i = 1; i < n; i++) { + LineTo((short) points[i].x, (short) points[i].y); + } + LineTo((short) points[0].x, (short) points[0].y); + CloseRgn(rgn); + + return (TkRegion) rgn; } +#if 0 /* *---------------------------------------------------------------------- * @@ -335,4 +367,6 @@ XFillArc(Display *display, int extent) { } +#endif +#endif |