From dd989e1ce795dac837b51e40883dbd6f38dd9dd8 Mon Sep 17 00:00:00 2001 From: Just van Rossum Date: Mon, 4 Mar 2002 10:31:32 +0000 Subject: [PATCH] Added ClipCGContextToRegion() from Quickdraw.h. --- Mac/Modules/cg/CGStubLib | Bin 2744 -> 2776 bytes Mac/Modules/cg/CGStubLib.exp | 1 + Mac/Modules/cg/_CGmodule.c | 19 +++++++++++++++++++ Mac/Modules/cg/cgsupport.py | 10 ++++++++++ 4 files changed, 30 insertions(+) diff --git a/Mac/Modules/cg/CGStubLib b/Mac/Modules/cg/CGStubLib index 8b374a1c21a74d15a6f1ba4ce773809321ed72b1..5f939a3cc01b39f2c4e2abc3970918f9266f6df9 100755 GIT binary patch delta 811 zcmX}pO=uHA6bJDC&TdRrjM-#A+++vs!NzLZV5FCbRzgGt?FXS^p@;TTO+}k%qX;Sy zQR+z>_Rvd?f<*<9BJ`m2Ad2E86#NP(ttg0Is$$JSt&_@ImdF11KjzIaGi$yvCwHq0 z02rY5RQ9Fi>6NdQ%Uh&tmD^dhMKoklyY4U7lydgOXfeA#TNo>ioGbMgawEq^3uB^- z&7#_&iZaBv30x!`2~j(+4ryqMXAvsS!|~@}|GA0q+;doMdl0#@45!ioJ~0TRCxi9r zI_z`?k*QW#`7VTC+=ba_2akM$5hy={o@j+0uR~k7hw#%VjI0K$w-ZLD1ZVGC=zJ2P z@q>t&N5$fcuo5*mbsOfdpU{&7um{hGHNO#^8v+jwBXV^Z(U~Eb6-6AT8+ylSakwAQ zm&S$j2%XBqaoS)dU&AiPe27deLHpQ?4W)kYlLnm5cL-M3h`~h|sh48YDy-=ggS@SI zF)M$C91?p)YX1Ls*%Okqlf=47$^(*=M_ITz5P1smog~eZlq5-NKFjI~<*=t33Aae> z8%eo9f+wjNtxjP$;y(2AF1)8i`a;515=)V!SrTlL>~kCbxP==ONE(Ux+*}~uA~z^d zIEkJ2bloim_yHwI0Und&51zaWlJ8Kacst6MD3cGlp99>I`n+Ju(<4_?V>8>;;}Y|2 IbgOImKY6&wNB{r; delta 823 zcmX}pOK1~87zgnG%x>FVY0PF{-E7ztrbyQ?4iX&$wjC(da1f1 zmEN?=9_pdsMYO0OQiL9q3Zf{2l!C8-qM{cMQWUEPUz5ad4&UyN|I9Go%)D~uovCg5 zeE=NLvr$h$xq4_kI=7x3iLQ6+nix<-ZN0s+sD@Z4n1PN>uwY{i0J^3qB)pkM(bWv>+;h0IISy75_kq8E;xCOYVQ<|W`~`_^A@PT#>c6^% zL%l;{OH$Pvu8(F(_`i#Ipi`8oQn*&n;!91892TAax`bn&c+BSGAwSlBOBdH@K z_L;PErJ}xEKr~zfl&-k#`5zlINhzBy1r&c~t#xIc61WCC; uV*5zS9;ve=RW`#WDC0Xx%DtL=@hr+Th3e(Hs$XEPM=vwZ&%}3E1^)n6#>eFV diff --git a/Mac/Modules/cg/CGStubLib.exp b/Mac/Modules/cg/CGStubLib.exp index 9f4e592c50..b93dc7c085 100755 --- a/Mac/Modules/cg/CGStubLib.exp +++ b/Mac/Modules/cg/CGStubLib.exp @@ -57,3 +57,4 @@ CGContextSaveGState CGContextRelease CreateCGContextForPort SyncCGContextOriginWithPort +ClipCGContextToRegion diff --git a/Mac/Modules/cg/_CGmodule.c b/Mac/Modules/cg/_CGmodule.c index aaa53899a7..9849cf7add 100755 --- a/Mac/Modules/cg/_CGmodule.c +++ b/Mac/Modules/cg/_CGmodule.c @@ -1129,6 +1129,23 @@ static PyObject *CGContextRefObj_SyncCGContextOriginWithPort(CGContextRefObject return _res; } +static PyObject *CGContextRefObj_ClipCGContextToRegion(CGContextRefObject *_self, PyObject *_args) +{ + PyObject *_res = NULL; + Rect portRect; + RgnHandle region; + if (!PyArg_ParseTuple(_args, "O&O&", + PyMac_GetRect, &portRect, + ResObj_Convert, ®ion)) + return NULL; + ClipCGContextToRegion(_self->ob_itself, + &portRect, + region); + Py_INCREF(Py_None); + _res = Py_None; + return _res; +} + static PyMethodDef CGContextRefObj_methods[] = { {"CGContextSaveGState", (PyCFunction)CGContextRefObj_CGContextSaveGState, 1, "() -> None"}, @@ -1244,6 +1261,8 @@ static PyMethodDef CGContextRefObj_methods[] = { "(int shouldAntialias) -> None"}, {"SyncCGContextOriginWithPort", (PyCFunction)CGContextRefObj_SyncCGContextOriginWithPort, 1, "(CGrafPtr port) -> None"}, + {"ClipCGContextToRegion", (PyCFunction)CGContextRefObj_ClipCGContextToRegion, 1, + "(Rect portRect, RgnHandle region) -> None"}, {NULL, NULL, 0} }; diff --git a/Mac/Modules/cg/cgsupport.py b/Mac/Modules/cg/cgsupport.py index c9255eef29..d090685534 100755 --- a/Mac/Modules/cg/cgsupport.py +++ b/Mac/Modules/cg/cgsupport.py @@ -18,6 +18,7 @@ OUTPUTFILE = MODNAME + "module.c" # The file generated by this program from macsupport import * CGrafPtr = OpaqueByValueType("CGrafPtr", "GrafObj") +RgnHandle = OpaqueByValueType("RgnHandle", "ResObj") # Create the type objects @@ -283,6 +284,15 @@ f = Method(void, 'SyncCGContextOriginWithPort', ) CGContextRef_methods.append(f) +# manual method, lives in Quickdraw.h +f = Method(void, 'ClipCGContextToRegion', + (CGContextRef, 'ctx', InMode), + (Rect, 'portRect', InMode), + (RgnHandle, 'region', InMode), +) +CGContextRef_methods.append(f) + + CreateCGContextForPort_body = """\ GrafPtr port; CGContextRef ctx; -- 2.50.0