]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Backport of 1.4 and 1.5:
authorJack Jansen <jack.jansen@cwi.nl>
Wed, 6 Mar 2002 21:59:54 +0000 (21:59 +0000)
committerJack Jansen <jack.jansen@cwi.nl>
Wed, 6 Mar 2002 21:59:54 +0000 (21:59 +0000)
Added support for SyncCGContextOriginWithPort
Added ClipCGContextToRegion

Mac/Modules/cg/CGStubLib
Mac/Modules/cg/CGStubLib.exp
Mac/Modules/cg/_CGmodule.c
Mac/Modules/cg/cgsupport.py

index 74de90927ee50226baa5e058d5359c5b4be42177..f92d3a0ef9895108598608a700e5de30d452158a 100755 (executable)
Binary files a/Mac/Modules/cg/CGStubLib and b/Mac/Modules/cg/CGStubLib differ
index 4b034b5811973998f40253b90c297829dbcac0db..b93dc7c085d26b895868cba9a5f784c6d5f13b06 100755 (executable)
@@ -56,3 +56,5 @@ CGContextRestoreGState
 CGContextSaveGState
 CGContextRelease
 CreateCGContextForPort
+SyncCGContextOriginWithPort
+ClipCGContextToRegion
index 3bcb2602583e5250cc73eb81c679903ad507311e..9849cf7add6833292cd71dfb055dbc7bbda745ea 100755 (executable)
@@ -1115,6 +1115,37 @@ static PyObject *CGContextRefObj_CGContextSetShouldAntialias(CGContextRefObject
        return _res;
 }
 
+static PyObject *CGContextRefObj_SyncCGContextOriginWithPort(CGContextRefObject *_self, PyObject *_args)
+{
+       PyObject *_res = NULL;
+       CGrafPtr port;
+       if (!PyArg_ParseTuple(_args, "O&",
+                             GrafObj_Convert, &port))
+               return NULL;
+       SyncCGContextOriginWithPort(_self->ob_itself,
+                                   port);
+       Py_INCREF(Py_None);
+       _res = Py_None;
+       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"},
@@ -1228,6 +1259,10 @@ static PyMethodDef CGContextRefObj_methods[] = {
         "() -> None"},
        {"CGContextSetShouldAntialias", (PyCFunction)CGContextRefObj_CGContextSetShouldAntialias, 1,
         "(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 e0931e54761cbc50a649192b601a1dce3d4d536d..d09068553447c5a260d2cdd7f2fe3690255762cc 100755 (executable)
@@ -17,6 +17,8 @@ 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
 
@@ -275,6 +277,22 @@ CGContextRef_methods = []
 # ADD _methods initializer here
 execfile(INPUTFILE)
 
+# manual method, lives in Quickdraw.h
+f = Method(void, 'SyncCGContextOriginWithPort',
+    (CGContextRef, 'ctx', InMode),
+    (CGrafPtr, 'port', InMode),
+)
+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;