summaryrefslogtreecommitdiffstats
path: root/Mac
diff options
context:
space:
mode:
authorJack Jansen <jack.jansen@cwi.nl>2002-03-06 21:59:54 (GMT)
committerJack Jansen <jack.jansen@cwi.nl>2002-03-06 21:59:54 (GMT)
commit98863e9e59b3745315b7b718152863d6ee1d2cf8 (patch)
treeb6cdddb2104119fc1f4cc15a2a1e936ecf435212 /Mac
parent13ce09922d8f779dcec6473c5be114a589f28fbe (diff)
downloadcpython-98863e9e59b3745315b7b718152863d6ee1d2cf8.zip
cpython-98863e9e59b3745315b7b718152863d6ee1d2cf8.tar.gz
cpython-98863e9e59b3745315b7b718152863d6ee1d2cf8.tar.bz2
Backport of 1.4 and 1.5:
Added support for SyncCGContextOriginWithPort Added ClipCGContextToRegion
Diffstat (limited to 'Mac')
-rwxr-xr-xMac/Modules/cg/CGStubLibbin3014 -> 2871 bytes
-rwxr-xr-xMac/Modules/cg/CGStubLib.exp2
-rwxr-xr-xMac/Modules/cg/_CGmodule.c35
-rwxr-xr-xMac/Modules/cg/cgsupport.py18
4 files changed, 55 insertions, 0 deletions
diff --git a/Mac/Modules/cg/CGStubLib b/Mac/Modules/cg/CGStubLib
index 74de909..f92d3a0 100755
--- a/Mac/Modules/cg/CGStubLib
+++ b/Mac/Modules/cg/CGStubLib
Binary files differ
diff --git a/Mac/Modules/cg/CGStubLib.exp b/Mac/Modules/cg/CGStubLib.exp
index 4b034b5..b93dc7c 100755
--- a/Mac/Modules/cg/CGStubLib.exp
+++ b/Mac/Modules/cg/CGStubLib.exp
@@ -56,3 +56,5 @@ CGContextRestoreGState
CGContextSaveGState
CGContextRelease
CreateCGContextForPort
+SyncCGContextOriginWithPort
+ClipCGContextToRegion
diff --git a/Mac/Modules/cg/_CGmodule.c b/Mac/Modules/cg/_CGmodule.c
index 3bcb260..9849cf7 100755
--- a/Mac/Modules/cg/_CGmodule.c
+++ b/Mac/Modules/cg/_CGmodule.c
@@ -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}
};
diff --git a/Mac/Modules/cg/cgsupport.py b/Mac/Modules/cg/cgsupport.py
index e0931e5..d090685 100755
--- a/Mac/Modules/cg/cgsupport.py
+++ b/Mac/Modules/cg/cgsupport.py
@@ -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;