]> granicus.if.org Git - python/commitdiff
Added ClipCGContextToRegion() from Quickdraw.h.
authorJust van Rossum <just@letterror.com>
Mon, 4 Mar 2002 10:31:32 +0000 (10:31 +0000)
committerJust van Rossum <just@letterror.com>
Mon, 4 Mar 2002 10:31:32 +0000 (10:31 +0000)
Mac/Modules/cg/CGStubLib
Mac/Modules/cg/CGStubLib.exp
Mac/Modules/cg/_CGmodule.c
Mac/Modules/cg/cgsupport.py

index 8b374a1c21a74d15a6f1ba4ce773809321ed72b1..5f939a3cc01b39f2c4e2abc3970918f9266f6df9 100755 (executable)
Binary files a/Mac/Modules/cg/CGStubLib and b/Mac/Modules/cg/CGStubLib differ
index 9f4e592c502b6ff52ff075cf7258fd99a9fc0950..b93dc7c085d26b895868cba9a5f784c6d5f13b06 100755 (executable)
@@ -57,3 +57,4 @@ CGContextSaveGState
 CGContextRelease
 CreateCGContextForPort
 SyncCGContextOriginWithPort
+ClipCGContextToRegion
index aaa53899a72f9692399a4fd6de27adec3f51577a..9849cf7add6833292cd71dfb055dbc7bbda745ea 100755 (executable)
@@ -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, &region))
+               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}
 };
 
index c9255eef29b3e2eb1af6bbbb5617ad0a279d798c..d09068553447c5a260d2cdd7f2fe3690255762cc 100755 (executable)
@@ -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;