From 98863e9e59b3745315b7b718152863d6ee1d2cf8 Mon Sep 17 00:00:00 2001 From: Jack Jansen Date: Wed, 6 Mar 2002 21:59:54 +0000 Subject: [PATCH] Backport of 1.4 and 1.5: Added support for SyncCGContextOriginWithPort Added ClipCGContextToRegion --- Mac/Modules/cg/CGStubLib | Bin 3014 -> 2871 bytes Mac/Modules/cg/CGStubLib.exp | 2 ++ Mac/Modules/cg/_CGmodule.c | 35 +++++++++++++++++++++++++++++++++++ Mac/Modules/cg/cgsupport.py | 18 ++++++++++++++++++ 4 files changed, 55 insertions(+) diff --git a/Mac/Modules/cg/CGStubLib b/Mac/Modules/cg/CGStubLib index 74de90927ee50226baa5e058d5359c5b4be42177..f92d3a0ef9895108598608a700e5de30d452158a 100755 GIT binary patch literal 2871 zc-rMw&2Jk;6n~o!NPskn?YK^Dg&?)4kTfDygb1oyoK0eAV{B|!DXK&|wI}f=n;kPd zP8z<{Ls8)Z^wdiwE|n-M5(tEp3+e%ZKuD;n1c*qWf+*tSQb0hFfb!O{pLf^JU%*=9 zef#^p-r- zOEutifSWw8riI&wE5~J0vQ@)cNQwd{%E8i172UowhQ$wJCw@$4C4v&0A=AP(lp!oP zUI|y0l3V^%xsz?#EW|BkFw%tV$PfZ)9*+66x6I)1-X{ty_ zwzh@Dp&B*1X_Rszg9~4uu#^LOJX{Z)NssqtZw@qTsN$?qaF+ye^|iqan&>^1G?j9^ zJWvBrEtd&VwhB1Y6QaIAkJt_~wOmqbgvASmxXkB-x2`r(_oF8@-4wPrGxT_@%nDef zE4)dtt#IcZ@WV;b=sLj{49ovg#m!QYd8*fB%Hp=|#*zkB-HfqpDF3_XT@jo%J(sMH zP*{29K{7%y#ob6wGRro7U^dT850K%u5|Ssf6*;-F6+e{0U543Qm)wm`3z-(O@-`Ee zk_JwPQ&kS-DMP1X7x3kCcD1EOd4K@Elw_e1X|Z$RITVTc8;L8#*+ z2oCLn;N2V0bM;N={jeWGdJlwCV-Sifh)#Y9!PqO%Z6AUiee)$)1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I`WUFj;iPc3vCtjuou$;5vm&zv&dAPvnGMn(vWr4t z0qbYax(J(kieZE{Tj-TVc41nUil zhi9*KBWHucR)I2~Uykh-(>TOI#V=Z!&m5ep#WwZrIKR5mtjqprH^Fbt8$RHJJR07 zroIJWi(?LSX?YR2c4dN6FJ1H|H2~AQI0E+gSO86)oeXKGjn?2mZDLRWZ&MsGzaj#9 z%UldsiA<0xw#0P&TlBVR?(ur2&**(!vqRmn}DVQvBVoMU(+ zV~qK43mwBfWWe4>TZr)e&@^8GUCr9J#JC|XA>BqD(P1U~i3d}?$3-tgM?EHktsr#l zG0l4+`L4(C>bb*@(7sS!6*Pg7_EE@>{kd%Q4&WH|DbP=X2TMrdUQnon6tL-7)9kU| z?g{JOKOKRU>~Y%T@u(C++#fuqS*I% zC`7FhLHYhukNHwC#Ct4BLPR4Wh2ewX?X4grIAB6LqYpv~8VH{61tH;Fk$XH5>NO&c zK-7ZJ56`dw-R~Zz-2=EC6#%lZ-qVJHNKqkY2%J~2{6W*7F qi%Zvyt{KtDbXsU8)!epMg4QZ1JPDGZW#b@9O@oa!7(edbkpBReyy{l~ diff --git a/Mac/Modules/cg/CGStubLib.exp b/Mac/Modules/cg/CGStubLib.exp index 4b034b581197..b93dc7c085d2 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 3bcb2602583e..9849cf7add68 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, ®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"}, @@ -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 e0931e54761c..d09068553447 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; -- 2.47.3