Bump to 2.3.1 to pick up the missing file.
[python/dscho.git] / Mac / Modules / qd / _Qdmodule.c
blob1084031d57b482887b8c5f8e1fa93e33e8c95b01
2 /* =========================== Module _Qd =========================== */
4 #include "Python.h"
8 #ifdef _WIN32
9 #include "pywintoolbox.h"
10 #else
11 #include "macglue.h"
12 #include "pymactoolbox.h"
13 #endif
15 /* Macro to test whether a weak-loaded CFM function exists */
16 #define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\
17 PyErr_SetString(PyExc_NotImplementedError, \
18 "Not available in this shared library/OS version"); \
19 return NULL; \
20 }} while(0)
23 #ifdef WITHOUT_FRAMEWORKS
24 #include <QuickDraw.h>
25 #else
26 #include <Carbon/Carbon.h>
27 #endif
29 #ifdef USE_TOOLBOX_OBJECT_GLUE
30 extern PyObject *_GrafObj_New(GrafPtr);
31 extern int _GrafObj_Convert(PyObject *, GrafPtr *);
32 extern PyObject *_BMObj_New(BitMapPtr);
33 extern int _BMObj_Convert(PyObject *, BitMapPtr *);
34 extern PyObject *_QdRGB_New(RGBColorPtr);
35 extern int _QdRGB_Convert(PyObject *, RGBColorPtr);
37 #define GrafObj_New _GrafObj_New
38 #define GrafObj_Convert _GrafObj_Convert
39 #define BMObj_New _BMObj_New
40 #define BMObj_Convert _BMObj_Convert
41 #define QdRGB_New _QdRGB_New
42 #define QdRGB_Convert _QdRGB_Convert
43 #endif
45 #if !ACCESSOR_CALLS_ARE_FUNCTIONS
46 #define GetPortBitMapForCopyBits(port) ((const struct BitMap *)&((GrafPort *)(port))->portBits)
47 #define GetPortPixMap(port) (((CGrafPtr)(port))->portPixMap)
48 #define GetPortBounds(port, bounds) (*(bounds) = (port)->portRect, (bounds))
49 #define GetPortForeColor(port, color) (*(color) = (port)->rgbFgColor, (color))
50 #define GetPortBackColor(port, color) (*(color) = (port)->rgbBkColor, (color))
51 #define GetPortOpColor(port, color) (*(color) = (*(GVarHandle)((port)->grafVars))->rgbOpColor, (color))
52 #define GetPortHiliteColor(port, color) (*(color) = (*(GVarHandle)((port)->grafVars))->rgbHiliteColor, (color))
53 #define GetPortTextFont(port) ((port)->txFont)
54 #define GetPortTextFace(port) ((port)->txFace)
55 #define GetPortTextMode(port) ((port)->txMode)
56 #define GetPortTextSize(port) ((port)->txSize)
57 #define GetPortChExtra(port) ((port)->chExtra)
58 #define GetPortFracHPenLocation(port) ((port)->pnLocHFrac)
59 #define GetPortSpExtra(port) ((port)->spExtra)
60 #define GetPortPenVisibility(port) ((port)->pnVis)
61 #define GetPortVisibleRegion(port, rgn) ((rgn) = (port)->visRgn, (rgn))
62 #define GetPortClipRegion(port, rgn) ((rgn) = (port)->clipRgn, (rgn))
63 #define GetPortBackPixPat(port, pat) ((pat) = (port)->bkPixPat, (pat))
64 #define GetPortPenPixPat(port, pat) ((pat) = (port)->pnPixPat, (pat))
65 #define GetPortFillPixPat(port, pat) ((pat) = (port)->fillPixPat, (pat))
66 #define GetPortPenSize(port, pensize) (*(pensize) = (port)->pnSize, (pensize))
67 #define GetPortPenMode(port) ((port)->pnMode)
68 #define GetPortPenLocation(port, location) ((*location) = (port)->pnLoc, (location))
69 #define IsPortRegionBeingDefined(port) (!!((port)->rgnSave))
70 #define IsPortPictureBeingDefined(port) (!!((port)->picSave))
71 /* #define IsPortOffscreen(port) */
72 /* #define IsPortColor(port) */
74 #define SetPortBounds(port, bounds) ((port)->portRect = *(bounds))
75 #define SetPortOpColor(port, color) ((*(GVarHandle)((port)->grafVars))->rgbOpColor = *(color))
76 #define SetPortVisibleRegion(port, rgn) ((port)->visRgn = (rgn))
77 #define SetPortClipRegion(port, rgn) ((port)->clipRgn = (rgn))
78 #define SetPortBackPixPat(port, pat) ((port)->bkPixPat = (pat))
79 #define SetPortPenPixPat(port, pat) ((port)->pnPixPat = (pat))
80 #define SetPortFillPixPat(port, pat) ((port)->fillPixPat = (pat))
81 #define SetPortPenSize(port, pensize) ((port)->pnSize = (pensize))
82 #define SetPortPenMode(port, mode) ((port)->pnMode = (mode))
83 #define SetPortFracHPenLocation(port, frac) ((port)->pnLocHFrac = (frac))
85 /* On pixmaps */
86 #define GetPixBounds(pixmap, rect) (*(rect) = (*(pixmap))->bounds, (rect))
87 #define GetPixDepth(pixmap) ((*(pixmap))->pixelSize)
89 /* On regions */
90 #define GetRegionBounds(rgn, rect) (*(rect) = (*(rgn))->rgnBBox, (rect))
92 /* On QD Globals */
93 #define GetQDGlobalsRandomSeed() (qd.randSeed)
94 #define GetQDGlobalsScreenBits(bits) (*(bits) = qd.screenBits, (bits))
95 #define GetQDGlobalsArrow(crsr) (*(crsr) = qd.arrow, (crsr))
96 #define GetQDGlobalsDarkGray(pat) (*(pat) = qd.dkGray, (pat))
97 #define GetQDGlobalsLightGray(pat) (*(pat) = qd.ltGray, (pat))
98 #define GetQDGlobalsGray(pat) (*(pat) = qd.gray, (pat))
99 #define GetQDGlobalsBlack(pat) (*(pat) = qd.black, (pat))
100 #define GetQDGlobalsWhite(pat) (*(pat) = qd.white, (pat))
101 #define GetQDGlobalsThePort() ((CGrafPtr)qd.thePort)
103 #define SetQDGlobalsRandomSeed(seed) (qd.randSeed = (seed))
104 #define SetQDGlobalsArrow(crsr) (qd.arrow = *(crsr))
106 #endif /* ACCESSOR_CALLS_ARE_FUNCTIONS */
108 #if !TARGET_API_MAC_CARBON
109 #define QDFlushPortBuffer(port, rgn) /* pass */
110 #define QDIsPortBufferDirty(port) 0
111 #define QDIsPortBuffered(port) 0
112 #endif /* !TARGET_API_MAC_CARBON */
114 static PyObject *BMObj_NewCopied(BitMapPtr);
117 ** Parse/generate RGB records
119 PyObject *QdRGB_New(RGBColorPtr itself)
122 return Py_BuildValue("lll", (long)itself->red, (long)itself->green, (long)itself->blue);
125 int QdRGB_Convert(PyObject *v, RGBColorPtr p_itself)
127 long red, green, blue;
129 if( !PyArg_ParseTuple(v, "lll", &red, &green, &blue) )
130 return 0;
131 p_itself->red = (unsigned short)red;
132 p_itself->green = (unsigned short)green;
133 p_itself->blue = (unsigned short)blue;
134 return 1;
138 ** Generate FontInfo records
140 static
141 PyObject *QdFI_New(FontInfo *itself)
144 return Py_BuildValue("hhhh", itself->ascent, itself->descent,
145 itself->widMax, itself->leading);
148 static PyObject *Qd_Error;
150 /* ---------------------- Object type GrafPort ---------------------- */
152 PyTypeObject GrafPort_Type;
154 #define GrafObj_Check(x) ((x)->ob_type == &GrafPort_Type)
156 typedef struct GrafPortObject {
157 PyObject_HEAD
158 GrafPtr ob_itself;
159 } GrafPortObject;
161 PyObject *GrafObj_New(GrafPtr itself)
163 GrafPortObject *it;
164 if (itself == NULL) return PyMac_Error(resNotFound);
165 it = PyObject_NEW(GrafPortObject, &GrafPort_Type);
166 if (it == NULL) return NULL;
167 it->ob_itself = itself;
168 return (PyObject *)it;
170 int GrafObj_Convert(PyObject *v, GrafPtr *p_itself)
172 #if 1
174 WindowRef win;
175 if (WinObj_Convert(v, &win) && v) {
176 *p_itself = (GrafPtr)GetWindowPort(win);
177 return 1;
179 PyErr_Clear();
181 #else
182 if (DlgObj_Check(v)) {
183 DialogRef dlg = (DialogRef)((GrafPortObject *)v)->ob_itself;
184 *p_itself = (GrafPtr)GetWindowPort(GetDialogWindow(dlg));
185 return 1;
187 if (WinObj_Check(v)) {
188 WindowRef win = (WindowRef)((GrafPortObject *)v)->ob_itself;
189 *p_itself = (GrafPtr)GetWindowPort(win);
190 return 1;
192 #endif
193 if (!GrafObj_Check(v))
195 PyErr_SetString(PyExc_TypeError, "GrafPort required");
196 return 0;
198 *p_itself = ((GrafPortObject *)v)->ob_itself;
199 return 1;
202 static void GrafObj_dealloc(GrafPortObject *self)
204 /* Cleanup of self->ob_itself goes here */
205 PyObject_Del(self);
208 static PyMethodDef GrafObj_methods[] = {
209 {NULL, NULL, 0}
212 PyMethodChain GrafObj_chain = { GrafObj_methods, NULL };
214 static PyObject *GrafObj_getattr(GrafPortObject *self, char *name)
216 #if !ACCESSOR_CALLS_ARE_FUNCTIONS
218 { CGrafPtr itself_color = (CGrafPtr)self->ob_itself;
220 if ( strcmp(name, "data") == 0 )
221 return PyString_FromStringAndSize((char *)self->ob_itself, sizeof(GrafPort));
223 if ( (itself_color->portVersion&0xc000) == 0xc000 ) {
224 /* Color-only attributes */
226 if ( strcmp(name, "portBits") == 0 )
227 /* XXXX Do we need HLock() stuff here?? */
228 return BMObj_New((BitMapPtr)*itself_color->portPixMap);
229 if ( strcmp(name, "grafVars") == 0 )
230 return Py_BuildValue("O&", ResObj_New, (Handle)itself_color->visRgn);
231 if ( strcmp(name, "chExtra") == 0 )
232 return Py_BuildValue("h", itself_color->chExtra);
233 if ( strcmp(name, "pnLocHFrac") == 0 )
234 return Py_BuildValue("h", itself_color->pnLocHFrac);
235 if ( strcmp(name, "bkPixPat") == 0 )
236 return Py_BuildValue("O&", ResObj_New, (Handle)itself_color->bkPixPat);
237 if ( strcmp(name, "rgbFgColor") == 0 )
238 return Py_BuildValue("O&", QdRGB_New, &itself_color->rgbFgColor);
239 if ( strcmp(name, "rgbBkColor") == 0 )
240 return Py_BuildValue("O&", QdRGB_New, &itself_color->rgbBkColor);
241 if ( strcmp(name, "pnPixPat") == 0 )
242 return Py_BuildValue("O&", ResObj_New, (Handle)itself_color->pnPixPat);
243 if ( strcmp(name, "fillPixPat") == 0 )
244 return Py_BuildValue("O&", ResObj_New, (Handle)itself_color->fillPixPat);
245 } else {
246 /* Mono-only attributes */
247 if ( strcmp(name, "portBits") == 0 )
248 return BMObj_New(&self->ob_itself->portBits);
249 if ( strcmp(name, "bkPat") == 0 )
250 return Py_BuildValue("s#", (char *)&self->ob_itself->bkPat, sizeof(Pattern));
251 if ( strcmp(name, "fillPat") == 0 )
252 return Py_BuildValue("s#", (char *)&self->ob_itself->fillPat, sizeof(Pattern));
253 if ( strcmp(name, "pnPat") == 0 )
254 return Py_BuildValue("s#", (char *)&self->ob_itself->pnPat, sizeof(Pattern));
257 ** Accessible for both color/mono windows.
258 ** portVersion is really color-only, but we put it here
259 ** for convenience
261 if ( strcmp(name, "portVersion") == 0 )
262 return Py_BuildValue("h", itself_color->portVersion);
263 if ( strcmp(name, "device") == 0 )
264 return PyInt_FromLong((long)self->ob_itself->device);
265 if ( strcmp(name, "portRect") == 0 )
266 return Py_BuildValue("O&", PyMac_BuildRect, &self->ob_itself->portRect);
267 if ( strcmp(name, "visRgn") == 0 )
268 return Py_BuildValue("O&", ResObj_New, (Handle)self->ob_itself->visRgn);
269 if ( strcmp(name, "clipRgn") == 0 )
270 return Py_BuildValue("O&", ResObj_New, (Handle)self->ob_itself->clipRgn);
271 if ( strcmp(name, "pnLoc") == 0 )
272 return Py_BuildValue("O&", PyMac_BuildPoint, self->ob_itself->pnLoc);
273 if ( strcmp(name, "pnSize") == 0 )
274 return Py_BuildValue("O&", PyMac_BuildPoint, self->ob_itself->pnSize);
275 if ( strcmp(name, "pnMode") == 0 )
276 return Py_BuildValue("h", self->ob_itself->pnMode);
277 if ( strcmp(name, "pnVis") == 0 )
278 return Py_BuildValue("h", self->ob_itself->pnVis);
279 if ( strcmp(name, "txFont") == 0 )
280 return Py_BuildValue("h", self->ob_itself->txFont);
281 if ( strcmp(name, "txFace") == 0 )
282 return Py_BuildValue("h", (short)self->ob_itself->txFace);
283 if ( strcmp(name, "txMode") == 0 )
284 return Py_BuildValue("h", self->ob_itself->txMode);
285 if ( strcmp(name, "txSize") == 0 )
286 return Py_BuildValue("h", self->ob_itself->txSize);
287 if ( strcmp(name, "spExtra") == 0 )
288 return Py_BuildValue("O&", PyMac_BuildFixed, self->ob_itself->spExtra);
289 /* XXXX Add more, as needed */
290 /* This one is so we can compare grafports: */
291 if ( strcmp(name, "_id") == 0 )
292 return Py_BuildValue("l", (long)self->ob_itself);
294 #else
296 { CGrafPtr itself_color = (CGrafPtr)self->ob_itself;
297 if ( strcmp(name, "portBits") == 0 )
298 return BMObj_New((BitMapPtr)GetPortBitMapForCopyBits(itself_color));
299 if ( strcmp(name, "chExtra") == 0 )
300 return Py_BuildValue("h", GetPortChExtra(itself_color));
301 if ( strcmp(name, "pnLocHFrac") == 0 )
302 return Py_BuildValue("h", GetPortFracHPenLocation(itself_color));
303 if ( strcmp(name, "bkPixPat") == 0 ) {
304 PixPatHandle h=0;
305 return Py_BuildValue("O&", ResObj_New, (Handle)GetPortBackPixPat(itself_color, h));
307 if ( strcmp(name, "rgbFgColor") == 0 ) {
308 RGBColor c;
309 return Py_BuildValue("O&", QdRGB_New, GetPortForeColor(itself_color, &c));
311 if ( strcmp(name, "rgbBkColor") == 0 ) {
312 RGBColor c;
313 return Py_BuildValue("O&", QdRGB_New, GetPortBackColor(itself_color, &c));
315 if ( strcmp(name, "pnPixPat") == 0 ) {
316 PixPatHandle h=NewPixPat(); /* XXXX wrong dispose routine */
318 return Py_BuildValue("O&", ResObj_New, (Handle)GetPortPenPixPat(itself_color, h));
320 if ( strcmp(name, "fillPixPat") == 0 ) {
321 PixPatHandle h=NewPixPat(); /* XXXX wrong dispose routine */
322 return Py_BuildValue("O&", ResObj_New, (Handle)GetPortFillPixPat(itself_color, h));
324 if ( strcmp(name, "portRect") == 0 ) {
325 Rect r;
326 return Py_BuildValue("O&", PyMac_BuildRect, GetPortBounds(itself_color, &r));
328 if ( strcmp(name, "visRgn") == 0 ) {
329 RgnHandle h=NewRgn(); /* XXXX wrong dispose routine */
330 return Py_BuildValue("O&", ResObj_New, (Handle)GetPortVisibleRegion(itself_color, h));
332 if ( strcmp(name, "clipRgn") == 0 ) {
333 RgnHandle h=NewRgn(); /* XXXX wrong dispose routine */
334 return Py_BuildValue("O&", ResObj_New, (Handle)GetPortClipRegion(itself_color, h));
336 if ( strcmp(name, "pnLoc") == 0 ) {
337 Point p;
338 return Py_BuildValue("O&", PyMac_BuildPoint, *GetPortPenLocation(itself_color, &p));
340 if ( strcmp(name, "pnSize") == 0 ) {
341 Point p;
342 return Py_BuildValue("O&", PyMac_BuildPoint, *GetPortPenSize(itself_color, &p));
344 if ( strcmp(name, "pnMode") == 0 )
345 return Py_BuildValue("h", GetPortPenMode(itself_color));
346 if ( strcmp(name, "pnVis") == 0 )
347 return Py_BuildValue("h", GetPortPenVisibility(itself_color));
348 if ( strcmp(name, "txFont") == 0 )
349 return Py_BuildValue("h", GetPortTextFont(itself_color));
350 if ( strcmp(name, "txFace") == 0 )
351 return Py_BuildValue("h", (short)GetPortTextFace(itself_color));
352 if ( strcmp(name, "txMode") == 0 )
353 return Py_BuildValue("h", GetPortTextMode(itself_color));
354 if ( strcmp(name, "txSize") == 0 )
355 return Py_BuildValue("h", GetPortTextSize(itself_color));
356 if ( strcmp(name, "spExtra") == 0 )
357 return Py_BuildValue("O&", PyMac_BuildFixed, GetPortSpExtra(itself_color));
358 /* XXXX Add more, as needed */
359 /* This one is so we can compare grafports: */
360 if ( strcmp(name, "_id") == 0 )
361 return Py_BuildValue("l", (long)self->ob_itself);
363 #endif
364 return Py_FindMethodInChain(&GrafObj_chain, (PyObject *)self, name);
367 #define GrafObj_setattr NULL
369 #define GrafObj_compare NULL
371 #define GrafObj_repr NULL
373 #define GrafObj_hash NULL
375 PyTypeObject GrafPort_Type = {
376 PyObject_HEAD_INIT(NULL)
377 0, /*ob_size*/
378 "_Qd.GrafPort", /*tp_name*/
379 sizeof(GrafPortObject), /*tp_basicsize*/
380 0, /*tp_itemsize*/
381 /* methods */
382 (destructor) GrafObj_dealloc, /*tp_dealloc*/
383 0, /*tp_print*/
384 (getattrfunc) GrafObj_getattr, /*tp_getattr*/
385 (setattrfunc) GrafObj_setattr, /*tp_setattr*/
386 (cmpfunc) GrafObj_compare, /*tp_compare*/
387 (reprfunc) GrafObj_repr, /*tp_repr*/
388 (PyNumberMethods *)0, /* tp_as_number */
389 (PySequenceMethods *)0, /* tp_as_sequence */
390 (PyMappingMethods *)0, /* tp_as_mapping */
391 (hashfunc) GrafObj_hash, /*tp_hash*/
394 /* -------------------- End object type GrafPort -------------------- */
397 /* ----------------------- Object type BitMap ----------------------- */
399 PyTypeObject BitMap_Type;
401 #define BMObj_Check(x) ((x)->ob_type == &BitMap_Type)
403 typedef struct BitMapObject {
404 PyObject_HEAD
405 BitMapPtr ob_itself;
406 PyObject *referred_object;
407 BitMap *referred_bitmap;
408 } BitMapObject;
410 PyObject *BMObj_New(BitMapPtr itself)
412 BitMapObject *it;
413 if (itself == NULL) return PyMac_Error(resNotFound);
414 it = PyObject_NEW(BitMapObject, &BitMap_Type);
415 if (it == NULL) return NULL;
416 it->ob_itself = itself;
417 it->referred_object = NULL;
418 it->referred_bitmap = NULL;
419 return (PyObject *)it;
421 int BMObj_Convert(PyObject *v, BitMapPtr *p_itself)
423 if (!BMObj_Check(v))
425 PyErr_SetString(PyExc_TypeError, "BitMap required");
426 return 0;
428 *p_itself = ((BitMapObject *)v)->ob_itself;
429 return 1;
432 static void BMObj_dealloc(BitMapObject *self)
434 Py_XDECREF(self->referred_object);
435 if (self->referred_bitmap) free(self->referred_bitmap);
436 PyObject_Del(self);
439 static PyObject *BMObj_getdata(BitMapObject *_self, PyObject *_args)
441 PyObject *_res = NULL;
443 int from, length;
444 char *cp;
446 if ( !PyArg_ParseTuple(_args, "ii", &from, &length) )
447 return NULL;
448 cp = _self->ob_itself->baseAddr+from;
449 _res = PyString_FromStringAndSize(cp, length);
450 return _res;
454 static PyObject *BMObj_putdata(BitMapObject *_self, PyObject *_args)
456 PyObject *_res = NULL;
458 int from, length;
459 char *cp, *icp;
461 if ( !PyArg_ParseTuple(_args, "is#", &from, &icp, &length) )
462 return NULL;
463 cp = _self->ob_itself->baseAddr+from;
464 memcpy(cp, icp, length);
465 Py_INCREF(Py_None);
466 _res = Py_None;
467 return _res;
471 static PyMethodDef BMObj_methods[] = {
472 {"getdata", (PyCFunction)BMObj_getdata, 1,
473 PyDoc_STR("(int start, int size) -> string. Return bytes from the bitmap")},
474 {"putdata", (PyCFunction)BMObj_putdata, 1,
475 PyDoc_STR("(int start, string data). Store bytes into the bitmap")},
476 {NULL, NULL, 0}
479 PyMethodChain BMObj_chain = { BMObj_methods, NULL };
481 static PyObject *BMObj_getattr(BitMapObject *self, char *name)
483 if ( strcmp(name, "baseAddr") == 0 )
484 return PyInt_FromLong((long)self->ob_itself->baseAddr);
485 if ( strcmp(name, "rowBytes") == 0 )
486 return PyInt_FromLong((long)self->ob_itself->rowBytes);
487 if ( strcmp(name, "bounds") == 0 )
488 return Py_BuildValue("O&", PyMac_BuildRect, &self->ob_itself->bounds);
489 /* XXXX Add more, as needed */
490 if ( strcmp(name, "bitmap_data") == 0 )
491 return PyString_FromStringAndSize((char *)self->ob_itself, sizeof(BitMap));
492 if ( strcmp(name, "pixmap_data") == 0 )
493 return PyString_FromStringAndSize((char *)self->ob_itself, sizeof(PixMap));
495 return Py_FindMethodInChain(&BMObj_chain, (PyObject *)self, name);
498 #define BMObj_setattr NULL
500 #define BMObj_compare NULL
502 #define BMObj_repr NULL
504 #define BMObj_hash NULL
506 PyTypeObject BitMap_Type = {
507 PyObject_HEAD_INIT(NULL)
508 0, /*ob_size*/
509 "_Qd.BitMap", /*tp_name*/
510 sizeof(BitMapObject), /*tp_basicsize*/
511 0, /*tp_itemsize*/
512 /* methods */
513 (destructor) BMObj_dealloc, /*tp_dealloc*/
514 0, /*tp_print*/
515 (getattrfunc) BMObj_getattr, /*tp_getattr*/
516 (setattrfunc) BMObj_setattr, /*tp_setattr*/
517 (cmpfunc) BMObj_compare, /*tp_compare*/
518 (reprfunc) BMObj_repr, /*tp_repr*/
519 (PyNumberMethods *)0, /* tp_as_number */
520 (PySequenceMethods *)0, /* tp_as_sequence */
521 (PyMappingMethods *)0, /* tp_as_mapping */
522 (hashfunc) BMObj_hash, /*tp_hash*/
525 /* --------------------- End object type BitMap --------------------- */
528 /* ------------------ Object type QDGlobalsAccess ------------------- */
530 static PyTypeObject QDGlobalsAccess_Type;
532 #define QDGA_Check(x) ((x)->ob_type == &QDGlobalsAccess_Type)
534 typedef struct QDGlobalsAccessObject {
535 PyObject_HEAD
536 } QDGlobalsAccessObject;
538 static PyObject *QDGA_New(void)
540 QDGlobalsAccessObject *it;
541 it = PyObject_NEW(QDGlobalsAccessObject, &QDGlobalsAccess_Type);
542 if (it == NULL) return NULL;
543 return (PyObject *)it;
546 static void QDGA_dealloc(QDGlobalsAccessObject *self)
548 PyObject_Del(self);
551 static PyMethodDef QDGA_methods[] = {
552 {NULL, NULL, 0}
555 static PyMethodChain QDGA_chain = { QDGA_methods, NULL };
557 static PyObject *QDGA_getattr(QDGlobalsAccessObject *self, char *name)
559 #if !ACCESSOR_CALLS_ARE_FUNCTIONS
561 if ( strcmp(name, "arrow") == 0 )
562 return PyString_FromStringAndSize((char *)&qd.arrow, sizeof(qd.arrow));
563 if ( strcmp(name, "black") == 0 )
564 return PyString_FromStringAndSize((char *)&qd.black, sizeof(qd.black));
565 if ( strcmp(name, "white") == 0 )
566 return PyString_FromStringAndSize((char *)&qd.white, sizeof(qd.white));
567 if ( strcmp(name, "gray") == 0 )
568 return PyString_FromStringAndSize((char *)&qd.gray, sizeof(qd.gray));
569 if ( strcmp(name, "ltGray") == 0 )
570 return PyString_FromStringAndSize((char *)&qd.ltGray, sizeof(qd.ltGray));
571 if ( strcmp(name, "dkGray") == 0 )
572 return PyString_FromStringAndSize((char *)&qd.dkGray, sizeof(qd.dkGray));
573 if ( strcmp(name, "screenBits") == 0 )
574 return BMObj_New(&qd.screenBits);
575 if ( strcmp(name, "thePort") == 0 )
576 return GrafObj_New(qd.thePort);
577 if ( strcmp(name, "randSeed") == 0 )
578 return Py_BuildValue("l", &qd.randSeed);
580 #else
582 if ( strcmp(name, "arrow") == 0 ) {
583 Cursor rv;
584 GetQDGlobalsArrow(&rv);
585 return PyString_FromStringAndSize((char *)&rv, sizeof(rv));
587 if ( strcmp(name, "black") == 0 ) {
588 Pattern rv;
589 GetQDGlobalsBlack(&rv);
590 return PyString_FromStringAndSize((char *)&rv, sizeof(rv));
592 if ( strcmp(name, "white") == 0 ) {
593 Pattern rv;
594 GetQDGlobalsWhite(&rv);
595 return PyString_FromStringAndSize((char *)&rv, sizeof(rv));
597 if ( strcmp(name, "gray") == 0 ) {
598 Pattern rv;
599 GetQDGlobalsGray(&rv);
600 return PyString_FromStringAndSize((char *)&rv, sizeof(rv));
602 if ( strcmp(name, "ltGray") == 0 ) {
603 Pattern rv;
604 GetQDGlobalsLightGray(&rv);
605 return PyString_FromStringAndSize((char *)&rv, sizeof(rv));
607 if ( strcmp(name, "dkGray") == 0 ) {
608 Pattern rv;
609 GetQDGlobalsDarkGray(&rv);
610 return PyString_FromStringAndSize((char *)&rv, sizeof(rv));
612 if ( strcmp(name, "screenBits") == 0 ) {
613 BitMap rv;
614 GetQDGlobalsScreenBits(&rv);
615 return BMObj_NewCopied(&rv);
617 if ( strcmp(name, "thePort") == 0 )
618 return GrafObj_New(GetQDGlobalsThePort());
619 if ( strcmp(name, "randSeed") == 0 )
620 return Py_BuildValue("l", GetQDGlobalsRandomSeed());
622 #endif
623 return Py_FindMethodInChain(&QDGA_chain, (PyObject *)self, name);
626 #define QDGA_setattr NULL
628 #define QDGA_compare NULL
630 #define QDGA_repr NULL
632 #define QDGA_hash NULL
634 static PyTypeObject QDGlobalsAccess_Type = {
635 PyObject_HEAD_INIT(NULL)
636 0, /*ob_size*/
637 "_Qd.QDGlobalsAccess", /*tp_name*/
638 sizeof(QDGlobalsAccessObject), /*tp_basicsize*/
639 0, /*tp_itemsize*/
640 /* methods */
641 (destructor) QDGA_dealloc, /*tp_dealloc*/
642 0, /*tp_print*/
643 (getattrfunc) QDGA_getattr, /*tp_getattr*/
644 (setattrfunc) QDGA_setattr, /*tp_setattr*/
645 (cmpfunc) QDGA_compare, /*tp_compare*/
646 (reprfunc) QDGA_repr, /*tp_repr*/
647 (PyNumberMethods *)0, /* tp_as_number */
648 (PySequenceMethods *)0, /* tp_as_sequence */
649 (PyMappingMethods *)0, /* tp_as_mapping */
650 (hashfunc) QDGA_hash, /*tp_hash*/
653 /* ---------------- End object type QDGlobalsAccess ----------------- */
656 static PyObject *Qd_MacSetPort(PyObject *_self, PyObject *_args)
658 PyObject *_res = NULL;
659 GrafPtr port;
660 #ifndef MacSetPort
661 PyMac_PRECHECK(MacSetPort);
662 #endif
663 if (!PyArg_ParseTuple(_args, "O&",
664 GrafObj_Convert, &port))
665 return NULL;
666 MacSetPort(port);
667 Py_INCREF(Py_None);
668 _res = Py_None;
669 return _res;
672 static PyObject *Qd_GetPort(PyObject *_self, PyObject *_args)
674 PyObject *_res = NULL;
675 GrafPtr port;
676 #ifndef GetPort
677 PyMac_PRECHECK(GetPort);
678 #endif
679 if (!PyArg_ParseTuple(_args, ""))
680 return NULL;
681 GetPort(&port);
682 _res = Py_BuildValue("O&",
683 GrafObj_New, port);
684 return _res;
687 static PyObject *Qd_GrafDevice(PyObject *_self, PyObject *_args)
689 PyObject *_res = NULL;
690 short device;
691 #ifndef GrafDevice
692 PyMac_PRECHECK(GrafDevice);
693 #endif
694 if (!PyArg_ParseTuple(_args, "h",
695 &device))
696 return NULL;
697 GrafDevice(device);
698 Py_INCREF(Py_None);
699 _res = Py_None;
700 return _res;
703 static PyObject *Qd_SetPortBits(PyObject *_self, PyObject *_args)
705 PyObject *_res = NULL;
706 BitMapPtr bm;
707 #ifndef SetPortBits
708 PyMac_PRECHECK(SetPortBits);
709 #endif
710 if (!PyArg_ParseTuple(_args, "O&",
711 BMObj_Convert, &bm))
712 return NULL;
713 SetPortBits(bm);
714 Py_INCREF(Py_None);
715 _res = Py_None;
716 return _res;
719 static PyObject *Qd_PortSize(PyObject *_self, PyObject *_args)
721 PyObject *_res = NULL;
722 short width;
723 short height;
724 #ifndef PortSize
725 PyMac_PRECHECK(PortSize);
726 #endif
727 if (!PyArg_ParseTuple(_args, "hh",
728 &width,
729 &height))
730 return NULL;
731 PortSize(width,
732 height);
733 Py_INCREF(Py_None);
734 _res = Py_None;
735 return _res;
738 static PyObject *Qd_MovePortTo(PyObject *_self, PyObject *_args)
740 PyObject *_res = NULL;
741 short leftGlobal;
742 short topGlobal;
743 #ifndef MovePortTo
744 PyMac_PRECHECK(MovePortTo);
745 #endif
746 if (!PyArg_ParseTuple(_args, "hh",
747 &leftGlobal,
748 &topGlobal))
749 return NULL;
750 MovePortTo(leftGlobal,
751 topGlobal);
752 Py_INCREF(Py_None);
753 _res = Py_None;
754 return _res;
757 static PyObject *Qd_SetOrigin(PyObject *_self, PyObject *_args)
759 PyObject *_res = NULL;
760 short h;
761 short v;
762 #ifndef SetOrigin
763 PyMac_PRECHECK(SetOrigin);
764 #endif
765 if (!PyArg_ParseTuple(_args, "hh",
767 &v))
768 return NULL;
769 SetOrigin(h,
771 Py_INCREF(Py_None);
772 _res = Py_None;
773 return _res;
776 static PyObject *Qd_SetClip(PyObject *_self, PyObject *_args)
778 PyObject *_res = NULL;
779 RgnHandle rgn;
780 #ifndef SetClip
781 PyMac_PRECHECK(SetClip);
782 #endif
783 if (!PyArg_ParseTuple(_args, "O&",
784 ResObj_Convert, &rgn))
785 return NULL;
786 SetClip(rgn);
787 Py_INCREF(Py_None);
788 _res = Py_None;
789 return _res;
792 static PyObject *Qd_GetClip(PyObject *_self, PyObject *_args)
794 PyObject *_res = NULL;
795 RgnHandle rgn;
796 #ifndef GetClip
797 PyMac_PRECHECK(GetClip);
798 #endif
799 if (!PyArg_ParseTuple(_args, "O&",
800 ResObj_Convert, &rgn))
801 return NULL;
802 GetClip(rgn);
803 Py_INCREF(Py_None);
804 _res = Py_None;
805 return _res;
808 static PyObject *Qd_ClipRect(PyObject *_self, PyObject *_args)
810 PyObject *_res = NULL;
811 Rect r;
812 #ifndef ClipRect
813 PyMac_PRECHECK(ClipRect);
814 #endif
815 if (!PyArg_ParseTuple(_args, "O&",
816 PyMac_GetRect, &r))
817 return NULL;
818 ClipRect(&r);
819 Py_INCREF(Py_None);
820 _res = Py_None;
821 return _res;
824 static PyObject *Qd_BackPat(PyObject *_self, PyObject *_args)
826 PyObject *_res = NULL;
827 Pattern *pat__in__;
828 int pat__in_len__;
829 #ifndef BackPat
830 PyMac_PRECHECK(BackPat);
831 #endif
832 if (!PyArg_ParseTuple(_args, "s#",
833 (char **)&pat__in__, &pat__in_len__))
834 return NULL;
835 if (pat__in_len__ != sizeof(Pattern))
837 PyErr_SetString(PyExc_TypeError, "buffer length should be sizeof(Pattern)");
838 goto pat__error__;
840 BackPat(pat__in__);
841 Py_INCREF(Py_None);
842 _res = Py_None;
843 pat__error__: ;
844 return _res;
847 static PyObject *Qd_InitCursor(PyObject *_self, PyObject *_args)
849 PyObject *_res = NULL;
850 #ifndef InitCursor
851 PyMac_PRECHECK(InitCursor);
852 #endif
853 if (!PyArg_ParseTuple(_args, ""))
854 return NULL;
855 InitCursor();
856 Py_INCREF(Py_None);
857 _res = Py_None;
858 return _res;
861 static PyObject *Qd_MacSetCursor(PyObject *_self, PyObject *_args)
863 PyObject *_res = NULL;
864 Cursor *crsr__in__;
865 int crsr__in_len__;
866 #ifndef MacSetCursor
867 PyMac_PRECHECK(MacSetCursor);
868 #endif
869 if (!PyArg_ParseTuple(_args, "s#",
870 (char **)&crsr__in__, &crsr__in_len__))
871 return NULL;
872 if (crsr__in_len__ != sizeof(Cursor))
874 PyErr_SetString(PyExc_TypeError, "buffer length should be sizeof(Cursor)");
875 goto crsr__error__;
877 MacSetCursor(crsr__in__);
878 Py_INCREF(Py_None);
879 _res = Py_None;
880 crsr__error__: ;
881 return _res;
884 static PyObject *Qd_HideCursor(PyObject *_self, PyObject *_args)
886 PyObject *_res = NULL;
887 #ifndef HideCursor
888 PyMac_PRECHECK(HideCursor);
889 #endif
890 if (!PyArg_ParseTuple(_args, ""))
891 return NULL;
892 HideCursor();
893 Py_INCREF(Py_None);
894 _res = Py_None;
895 return _res;
898 static PyObject *Qd_MacShowCursor(PyObject *_self, PyObject *_args)
900 PyObject *_res = NULL;
901 #ifndef MacShowCursor
902 PyMac_PRECHECK(MacShowCursor);
903 #endif
904 if (!PyArg_ParseTuple(_args, ""))
905 return NULL;
906 MacShowCursor();
907 Py_INCREF(Py_None);
908 _res = Py_None;
909 return _res;
912 static PyObject *Qd_ObscureCursor(PyObject *_self, PyObject *_args)
914 PyObject *_res = NULL;
915 #ifndef ObscureCursor
916 PyMac_PRECHECK(ObscureCursor);
917 #endif
918 if (!PyArg_ParseTuple(_args, ""))
919 return NULL;
920 ObscureCursor();
921 Py_INCREF(Py_None);
922 _res = Py_None;
923 return _res;
926 static PyObject *Qd_HidePen(PyObject *_self, PyObject *_args)
928 PyObject *_res = NULL;
929 #ifndef HidePen
930 PyMac_PRECHECK(HidePen);
931 #endif
932 if (!PyArg_ParseTuple(_args, ""))
933 return NULL;
934 HidePen();
935 Py_INCREF(Py_None);
936 _res = Py_None;
937 return _res;
940 static PyObject *Qd_ShowPen(PyObject *_self, PyObject *_args)
942 PyObject *_res = NULL;
943 #ifndef ShowPen
944 PyMac_PRECHECK(ShowPen);
945 #endif
946 if (!PyArg_ParseTuple(_args, ""))
947 return NULL;
948 ShowPen();
949 Py_INCREF(Py_None);
950 _res = Py_None;
951 return _res;
954 static PyObject *Qd_GetPen(PyObject *_self, PyObject *_args)
956 PyObject *_res = NULL;
957 Point pt;
958 #ifndef GetPen
959 PyMac_PRECHECK(GetPen);
960 #endif
961 if (!PyArg_ParseTuple(_args, ""))
962 return NULL;
963 GetPen(&pt);
964 _res = Py_BuildValue("O&",
965 PyMac_BuildPoint, pt);
966 return _res;
969 static PyObject *Qd_GetPenState(PyObject *_self, PyObject *_args)
971 PyObject *_res = NULL;
972 PenState pnState__out__;
973 #ifndef GetPenState
974 PyMac_PRECHECK(GetPenState);
975 #endif
976 if (!PyArg_ParseTuple(_args, ""))
977 return NULL;
978 GetPenState(&pnState__out__);
979 _res = Py_BuildValue("s#",
980 (char *)&pnState__out__, (int)sizeof(PenState));
981 return _res;
984 static PyObject *Qd_SetPenState(PyObject *_self, PyObject *_args)
986 PyObject *_res = NULL;
987 PenState *pnState__in__;
988 int pnState__in_len__;
989 #ifndef SetPenState
990 PyMac_PRECHECK(SetPenState);
991 #endif
992 if (!PyArg_ParseTuple(_args, "s#",
993 (char **)&pnState__in__, &pnState__in_len__))
994 return NULL;
995 if (pnState__in_len__ != sizeof(PenState))
997 PyErr_SetString(PyExc_TypeError, "buffer length should be sizeof(PenState)");
998 goto pnState__error__;
1000 SetPenState(pnState__in__);
1001 Py_INCREF(Py_None);
1002 _res = Py_None;
1003 pnState__error__: ;
1004 return _res;
1007 static PyObject *Qd_PenSize(PyObject *_self, PyObject *_args)
1009 PyObject *_res = NULL;
1010 short width;
1011 short height;
1012 #ifndef PenSize
1013 PyMac_PRECHECK(PenSize);
1014 #endif
1015 if (!PyArg_ParseTuple(_args, "hh",
1016 &width,
1017 &height))
1018 return NULL;
1019 PenSize(width,
1020 height);
1021 Py_INCREF(Py_None);
1022 _res = Py_None;
1023 return _res;
1026 static PyObject *Qd_PenMode(PyObject *_self, PyObject *_args)
1028 PyObject *_res = NULL;
1029 short mode;
1030 #ifndef PenMode
1031 PyMac_PRECHECK(PenMode);
1032 #endif
1033 if (!PyArg_ParseTuple(_args, "h",
1034 &mode))
1035 return NULL;
1036 PenMode(mode);
1037 Py_INCREF(Py_None);
1038 _res = Py_None;
1039 return _res;
1042 static PyObject *Qd_PenPat(PyObject *_self, PyObject *_args)
1044 PyObject *_res = NULL;
1045 Pattern *pat__in__;
1046 int pat__in_len__;
1047 #ifndef PenPat
1048 PyMac_PRECHECK(PenPat);
1049 #endif
1050 if (!PyArg_ParseTuple(_args, "s#",
1051 (char **)&pat__in__, &pat__in_len__))
1052 return NULL;
1053 if (pat__in_len__ != sizeof(Pattern))
1055 PyErr_SetString(PyExc_TypeError, "buffer length should be sizeof(Pattern)");
1056 goto pat__error__;
1058 PenPat(pat__in__);
1059 Py_INCREF(Py_None);
1060 _res = Py_None;
1061 pat__error__: ;
1062 return _res;
1065 static PyObject *Qd_PenNormal(PyObject *_self, PyObject *_args)
1067 PyObject *_res = NULL;
1068 #ifndef PenNormal
1069 PyMac_PRECHECK(PenNormal);
1070 #endif
1071 if (!PyArg_ParseTuple(_args, ""))
1072 return NULL;
1073 PenNormal();
1074 Py_INCREF(Py_None);
1075 _res = Py_None;
1076 return _res;
1079 static PyObject *Qd_MoveTo(PyObject *_self, PyObject *_args)
1081 PyObject *_res = NULL;
1082 short h;
1083 short v;
1084 #ifndef MoveTo
1085 PyMac_PRECHECK(MoveTo);
1086 #endif
1087 if (!PyArg_ParseTuple(_args, "hh",
1089 &v))
1090 return NULL;
1091 MoveTo(h,
1093 Py_INCREF(Py_None);
1094 _res = Py_None;
1095 return _res;
1098 static PyObject *Qd_Move(PyObject *_self, PyObject *_args)
1100 PyObject *_res = NULL;
1101 short dh;
1102 short dv;
1103 #ifndef Move
1104 PyMac_PRECHECK(Move);
1105 #endif
1106 if (!PyArg_ParseTuple(_args, "hh",
1107 &dh,
1108 &dv))
1109 return NULL;
1110 Move(dh,
1111 dv);
1112 Py_INCREF(Py_None);
1113 _res = Py_None;
1114 return _res;
1117 static PyObject *Qd_MacLineTo(PyObject *_self, PyObject *_args)
1119 PyObject *_res = NULL;
1120 short h;
1121 short v;
1122 #ifndef MacLineTo
1123 PyMac_PRECHECK(MacLineTo);
1124 #endif
1125 if (!PyArg_ParseTuple(_args, "hh",
1127 &v))
1128 return NULL;
1129 MacLineTo(h,
1131 Py_INCREF(Py_None);
1132 _res = Py_None;
1133 return _res;
1136 static PyObject *Qd_Line(PyObject *_self, PyObject *_args)
1138 PyObject *_res = NULL;
1139 short dh;
1140 short dv;
1141 #ifndef Line
1142 PyMac_PRECHECK(Line);
1143 #endif
1144 if (!PyArg_ParseTuple(_args, "hh",
1145 &dh,
1146 &dv))
1147 return NULL;
1148 Line(dh,
1149 dv);
1150 Py_INCREF(Py_None);
1151 _res = Py_None;
1152 return _res;
1155 static PyObject *Qd_ForeColor(PyObject *_self, PyObject *_args)
1157 PyObject *_res = NULL;
1158 long color;
1159 #ifndef ForeColor
1160 PyMac_PRECHECK(ForeColor);
1161 #endif
1162 if (!PyArg_ParseTuple(_args, "l",
1163 &color))
1164 return NULL;
1165 ForeColor(color);
1166 Py_INCREF(Py_None);
1167 _res = Py_None;
1168 return _res;
1171 static PyObject *Qd_BackColor(PyObject *_self, PyObject *_args)
1173 PyObject *_res = NULL;
1174 long color;
1175 #ifndef BackColor
1176 PyMac_PRECHECK(BackColor);
1177 #endif
1178 if (!PyArg_ParseTuple(_args, "l",
1179 &color))
1180 return NULL;
1181 BackColor(color);
1182 Py_INCREF(Py_None);
1183 _res = Py_None;
1184 return _res;
1187 static PyObject *Qd_ColorBit(PyObject *_self, PyObject *_args)
1189 PyObject *_res = NULL;
1190 short whichBit;
1191 #ifndef ColorBit
1192 PyMac_PRECHECK(ColorBit);
1193 #endif
1194 if (!PyArg_ParseTuple(_args, "h",
1195 &whichBit))
1196 return NULL;
1197 ColorBit(whichBit);
1198 Py_INCREF(Py_None);
1199 _res = Py_None;
1200 return _res;
1203 static PyObject *Qd_MacSetRect(PyObject *_self, PyObject *_args)
1205 PyObject *_res = NULL;
1206 Rect r;
1207 short left;
1208 short top;
1209 short right;
1210 short bottom;
1211 #ifndef MacSetRect
1212 PyMac_PRECHECK(MacSetRect);
1213 #endif
1214 if (!PyArg_ParseTuple(_args, "hhhh",
1215 &left,
1216 &top,
1217 &right,
1218 &bottom))
1219 return NULL;
1220 MacSetRect(&r,
1221 left,
1222 top,
1223 right,
1224 bottom);
1225 _res = Py_BuildValue("O&",
1226 PyMac_BuildRect, &r);
1227 return _res;
1230 static PyObject *Qd_MacOffsetRect(PyObject *_self, PyObject *_args)
1232 PyObject *_res = NULL;
1233 Rect r;
1234 short dh;
1235 short dv;
1236 #ifndef MacOffsetRect
1237 PyMac_PRECHECK(MacOffsetRect);
1238 #endif
1239 if (!PyArg_ParseTuple(_args, "O&hh",
1240 PyMac_GetRect, &r,
1241 &dh,
1242 &dv))
1243 return NULL;
1244 MacOffsetRect(&r,
1246 dv);
1247 _res = Py_BuildValue("O&",
1248 PyMac_BuildRect, &r);
1249 return _res;
1252 static PyObject *Qd_MacInsetRect(PyObject *_self, PyObject *_args)
1254 PyObject *_res = NULL;
1255 Rect r;
1256 short dh;
1257 short dv;
1258 #ifndef MacInsetRect
1259 PyMac_PRECHECK(MacInsetRect);
1260 #endif
1261 if (!PyArg_ParseTuple(_args, "O&hh",
1262 PyMac_GetRect, &r,
1263 &dh,
1264 &dv))
1265 return NULL;
1266 MacInsetRect(&r,
1268 dv);
1269 _res = Py_BuildValue("O&",
1270 PyMac_BuildRect, &r);
1271 return _res;
1274 static PyObject *Qd_SectRect(PyObject *_self, PyObject *_args)
1276 PyObject *_res = NULL;
1277 Boolean _rv;
1278 Rect src1;
1279 Rect src2;
1280 Rect dstRect;
1281 #ifndef SectRect
1282 PyMac_PRECHECK(SectRect);
1283 #endif
1284 if (!PyArg_ParseTuple(_args, "O&O&",
1285 PyMac_GetRect, &src1,
1286 PyMac_GetRect, &src2))
1287 return NULL;
1288 _rv = SectRect(&src1,
1289 &src2,
1290 &dstRect);
1291 _res = Py_BuildValue("bO&",
1292 _rv,
1293 PyMac_BuildRect, &dstRect);
1294 return _res;
1297 static PyObject *Qd_MacUnionRect(PyObject *_self, PyObject *_args)
1299 PyObject *_res = NULL;
1300 Rect src1;
1301 Rect src2;
1302 Rect dstRect;
1303 #ifndef MacUnionRect
1304 PyMac_PRECHECK(MacUnionRect);
1305 #endif
1306 if (!PyArg_ParseTuple(_args, "O&O&",
1307 PyMac_GetRect, &src1,
1308 PyMac_GetRect, &src2))
1309 return NULL;
1310 MacUnionRect(&src1,
1311 &src2,
1312 &dstRect);
1313 _res = Py_BuildValue("O&",
1314 PyMac_BuildRect, &dstRect);
1315 return _res;
1318 static PyObject *Qd_MacEqualRect(PyObject *_self, PyObject *_args)
1320 PyObject *_res = NULL;
1321 Boolean _rv;
1322 Rect rect1;
1323 Rect rect2;
1324 #ifndef MacEqualRect
1325 PyMac_PRECHECK(MacEqualRect);
1326 #endif
1327 if (!PyArg_ParseTuple(_args, "O&O&",
1328 PyMac_GetRect, &rect1,
1329 PyMac_GetRect, &rect2))
1330 return NULL;
1331 _rv = MacEqualRect(&rect1,
1332 &rect2);
1333 _res = Py_BuildValue("b",
1334 _rv);
1335 return _res;
1338 static PyObject *Qd_EmptyRect(PyObject *_self, PyObject *_args)
1340 PyObject *_res = NULL;
1341 Boolean _rv;
1342 Rect r;
1343 #ifndef EmptyRect
1344 PyMac_PRECHECK(EmptyRect);
1345 #endif
1346 if (!PyArg_ParseTuple(_args, "O&",
1347 PyMac_GetRect, &r))
1348 return NULL;
1349 _rv = EmptyRect(&r);
1350 _res = Py_BuildValue("b",
1351 _rv);
1352 return _res;
1355 static PyObject *Qd_MacFrameRect(PyObject *_self, PyObject *_args)
1357 PyObject *_res = NULL;
1358 Rect r;
1359 #ifndef MacFrameRect
1360 PyMac_PRECHECK(MacFrameRect);
1361 #endif
1362 if (!PyArg_ParseTuple(_args, "O&",
1363 PyMac_GetRect, &r))
1364 return NULL;
1365 MacFrameRect(&r);
1366 Py_INCREF(Py_None);
1367 _res = Py_None;
1368 return _res;
1371 static PyObject *Qd_PaintRect(PyObject *_self, PyObject *_args)
1373 PyObject *_res = NULL;
1374 Rect r;
1375 #ifndef PaintRect
1376 PyMac_PRECHECK(PaintRect);
1377 #endif
1378 if (!PyArg_ParseTuple(_args, "O&",
1379 PyMac_GetRect, &r))
1380 return NULL;
1381 PaintRect(&r);
1382 Py_INCREF(Py_None);
1383 _res = Py_None;
1384 return _res;
1387 static PyObject *Qd_EraseRect(PyObject *_self, PyObject *_args)
1389 PyObject *_res = NULL;
1390 Rect r;
1391 #ifndef EraseRect
1392 PyMac_PRECHECK(EraseRect);
1393 #endif
1394 if (!PyArg_ParseTuple(_args, "O&",
1395 PyMac_GetRect, &r))
1396 return NULL;
1397 EraseRect(&r);
1398 Py_INCREF(Py_None);
1399 _res = Py_None;
1400 return _res;
1403 static PyObject *Qd_MacInvertRect(PyObject *_self, PyObject *_args)
1405 PyObject *_res = NULL;
1406 Rect r;
1407 #ifndef MacInvertRect
1408 PyMac_PRECHECK(MacInvertRect);
1409 #endif
1410 if (!PyArg_ParseTuple(_args, "O&",
1411 PyMac_GetRect, &r))
1412 return NULL;
1413 MacInvertRect(&r);
1414 Py_INCREF(Py_None);
1415 _res = Py_None;
1416 return _res;
1419 static PyObject *Qd_MacFillRect(PyObject *_self, PyObject *_args)
1421 PyObject *_res = NULL;
1422 Rect r;
1423 Pattern *pat__in__;
1424 int pat__in_len__;
1425 #ifndef MacFillRect
1426 PyMac_PRECHECK(MacFillRect);
1427 #endif
1428 if (!PyArg_ParseTuple(_args, "O&s#",
1429 PyMac_GetRect, &r,
1430 (char **)&pat__in__, &pat__in_len__))
1431 return NULL;
1432 if (pat__in_len__ != sizeof(Pattern))
1434 PyErr_SetString(PyExc_TypeError, "buffer length should be sizeof(Pattern)");
1435 goto pat__error__;
1437 MacFillRect(&r,
1438 pat__in__);
1439 Py_INCREF(Py_None);
1440 _res = Py_None;
1441 pat__error__: ;
1442 return _res;
1445 static PyObject *Qd_FrameOval(PyObject *_self, PyObject *_args)
1447 PyObject *_res = NULL;
1448 Rect r;
1449 #ifndef FrameOval
1450 PyMac_PRECHECK(FrameOval);
1451 #endif
1452 if (!PyArg_ParseTuple(_args, "O&",
1453 PyMac_GetRect, &r))
1454 return NULL;
1455 FrameOval(&r);
1456 Py_INCREF(Py_None);
1457 _res = Py_None;
1458 return _res;
1461 static PyObject *Qd_PaintOval(PyObject *_self, PyObject *_args)
1463 PyObject *_res = NULL;
1464 Rect r;
1465 #ifndef PaintOval
1466 PyMac_PRECHECK(PaintOval);
1467 #endif
1468 if (!PyArg_ParseTuple(_args, "O&",
1469 PyMac_GetRect, &r))
1470 return NULL;
1471 PaintOval(&r);
1472 Py_INCREF(Py_None);
1473 _res = Py_None;
1474 return _res;
1477 static PyObject *Qd_EraseOval(PyObject *_self, PyObject *_args)
1479 PyObject *_res = NULL;
1480 Rect r;
1481 #ifndef EraseOval
1482 PyMac_PRECHECK(EraseOval);
1483 #endif
1484 if (!PyArg_ParseTuple(_args, "O&",
1485 PyMac_GetRect, &r))
1486 return NULL;
1487 EraseOval(&r);
1488 Py_INCREF(Py_None);
1489 _res = Py_None;
1490 return _res;
1493 static PyObject *Qd_InvertOval(PyObject *_self, PyObject *_args)
1495 PyObject *_res = NULL;
1496 Rect r;
1497 #ifndef InvertOval
1498 PyMac_PRECHECK(InvertOval);
1499 #endif
1500 if (!PyArg_ParseTuple(_args, "O&",
1501 PyMac_GetRect, &r))
1502 return NULL;
1503 InvertOval(&r);
1504 Py_INCREF(Py_None);
1505 _res = Py_None;
1506 return _res;
1509 static PyObject *Qd_FillOval(PyObject *_self, PyObject *_args)
1511 PyObject *_res = NULL;
1512 Rect r;
1513 Pattern *pat__in__;
1514 int pat__in_len__;
1515 #ifndef FillOval
1516 PyMac_PRECHECK(FillOval);
1517 #endif
1518 if (!PyArg_ParseTuple(_args, "O&s#",
1519 PyMac_GetRect, &r,
1520 (char **)&pat__in__, &pat__in_len__))
1521 return NULL;
1522 if (pat__in_len__ != sizeof(Pattern))
1524 PyErr_SetString(PyExc_TypeError, "buffer length should be sizeof(Pattern)");
1525 goto pat__error__;
1527 FillOval(&r,
1528 pat__in__);
1529 Py_INCREF(Py_None);
1530 _res = Py_None;
1531 pat__error__: ;
1532 return _res;
1535 static PyObject *Qd_FrameRoundRect(PyObject *_self, PyObject *_args)
1537 PyObject *_res = NULL;
1538 Rect r;
1539 short ovalWidth;
1540 short ovalHeight;
1541 #ifndef FrameRoundRect
1542 PyMac_PRECHECK(FrameRoundRect);
1543 #endif
1544 if (!PyArg_ParseTuple(_args, "O&hh",
1545 PyMac_GetRect, &r,
1546 &ovalWidth,
1547 &ovalHeight))
1548 return NULL;
1549 FrameRoundRect(&r,
1550 ovalWidth,
1551 ovalHeight);
1552 Py_INCREF(Py_None);
1553 _res = Py_None;
1554 return _res;
1557 static PyObject *Qd_PaintRoundRect(PyObject *_self, PyObject *_args)
1559 PyObject *_res = NULL;
1560 Rect r;
1561 short ovalWidth;
1562 short ovalHeight;
1563 #ifndef PaintRoundRect
1564 PyMac_PRECHECK(PaintRoundRect);
1565 #endif
1566 if (!PyArg_ParseTuple(_args, "O&hh",
1567 PyMac_GetRect, &r,
1568 &ovalWidth,
1569 &ovalHeight))
1570 return NULL;
1571 PaintRoundRect(&r,
1572 ovalWidth,
1573 ovalHeight);
1574 Py_INCREF(Py_None);
1575 _res = Py_None;
1576 return _res;
1579 static PyObject *Qd_EraseRoundRect(PyObject *_self, PyObject *_args)
1581 PyObject *_res = NULL;
1582 Rect r;
1583 short ovalWidth;
1584 short ovalHeight;
1585 #ifndef EraseRoundRect
1586 PyMac_PRECHECK(EraseRoundRect);
1587 #endif
1588 if (!PyArg_ParseTuple(_args, "O&hh",
1589 PyMac_GetRect, &r,
1590 &ovalWidth,
1591 &ovalHeight))
1592 return NULL;
1593 EraseRoundRect(&r,
1594 ovalWidth,
1595 ovalHeight);
1596 Py_INCREF(Py_None);
1597 _res = Py_None;
1598 return _res;
1601 static PyObject *Qd_InvertRoundRect(PyObject *_self, PyObject *_args)
1603 PyObject *_res = NULL;
1604 Rect r;
1605 short ovalWidth;
1606 short ovalHeight;
1607 #ifndef InvertRoundRect
1608 PyMac_PRECHECK(InvertRoundRect);
1609 #endif
1610 if (!PyArg_ParseTuple(_args, "O&hh",
1611 PyMac_GetRect, &r,
1612 &ovalWidth,
1613 &ovalHeight))
1614 return NULL;
1615 InvertRoundRect(&r,
1616 ovalWidth,
1617 ovalHeight);
1618 Py_INCREF(Py_None);
1619 _res = Py_None;
1620 return _res;
1623 static PyObject *Qd_FillRoundRect(PyObject *_self, PyObject *_args)
1625 PyObject *_res = NULL;
1626 Rect r;
1627 short ovalWidth;
1628 short ovalHeight;
1629 Pattern *pat__in__;
1630 int pat__in_len__;
1631 #ifndef FillRoundRect
1632 PyMac_PRECHECK(FillRoundRect);
1633 #endif
1634 if (!PyArg_ParseTuple(_args, "O&hhs#",
1635 PyMac_GetRect, &r,
1636 &ovalWidth,
1637 &ovalHeight,
1638 (char **)&pat__in__, &pat__in_len__))
1639 return NULL;
1640 if (pat__in_len__ != sizeof(Pattern))
1642 PyErr_SetString(PyExc_TypeError, "buffer length should be sizeof(Pattern)");
1643 goto pat__error__;
1645 FillRoundRect(&r,
1646 ovalWidth,
1647 ovalHeight,
1648 pat__in__);
1649 Py_INCREF(Py_None);
1650 _res = Py_None;
1651 pat__error__: ;
1652 return _res;
1655 static PyObject *Qd_FrameArc(PyObject *_self, PyObject *_args)
1657 PyObject *_res = NULL;
1658 Rect r;
1659 short startAngle;
1660 short arcAngle;
1661 #ifndef FrameArc
1662 PyMac_PRECHECK(FrameArc);
1663 #endif
1664 if (!PyArg_ParseTuple(_args, "O&hh",
1665 PyMac_GetRect, &r,
1666 &startAngle,
1667 &arcAngle))
1668 return NULL;
1669 FrameArc(&r,
1670 startAngle,
1671 arcAngle);
1672 Py_INCREF(Py_None);
1673 _res = Py_None;
1674 return _res;
1677 static PyObject *Qd_PaintArc(PyObject *_self, PyObject *_args)
1679 PyObject *_res = NULL;
1680 Rect r;
1681 short startAngle;
1682 short arcAngle;
1683 #ifndef PaintArc
1684 PyMac_PRECHECK(PaintArc);
1685 #endif
1686 if (!PyArg_ParseTuple(_args, "O&hh",
1687 PyMac_GetRect, &r,
1688 &startAngle,
1689 &arcAngle))
1690 return NULL;
1691 PaintArc(&r,
1692 startAngle,
1693 arcAngle);
1694 Py_INCREF(Py_None);
1695 _res = Py_None;
1696 return _res;
1699 static PyObject *Qd_EraseArc(PyObject *_self, PyObject *_args)
1701 PyObject *_res = NULL;
1702 Rect r;
1703 short startAngle;
1704 short arcAngle;
1705 #ifndef EraseArc
1706 PyMac_PRECHECK(EraseArc);
1707 #endif
1708 if (!PyArg_ParseTuple(_args, "O&hh",
1709 PyMac_GetRect, &r,
1710 &startAngle,
1711 &arcAngle))
1712 return NULL;
1713 EraseArc(&r,
1714 startAngle,
1715 arcAngle);
1716 Py_INCREF(Py_None);
1717 _res = Py_None;
1718 return _res;
1721 static PyObject *Qd_InvertArc(PyObject *_self, PyObject *_args)
1723 PyObject *_res = NULL;
1724 Rect r;
1725 short startAngle;
1726 short arcAngle;
1727 #ifndef InvertArc
1728 PyMac_PRECHECK(InvertArc);
1729 #endif
1730 if (!PyArg_ParseTuple(_args, "O&hh",
1731 PyMac_GetRect, &r,
1732 &startAngle,
1733 &arcAngle))
1734 return NULL;
1735 InvertArc(&r,
1736 startAngle,
1737 arcAngle);
1738 Py_INCREF(Py_None);
1739 _res = Py_None;
1740 return _res;
1743 static PyObject *Qd_FillArc(PyObject *_self, PyObject *_args)
1745 PyObject *_res = NULL;
1746 Rect r;
1747 short startAngle;
1748 short arcAngle;
1749 Pattern *pat__in__;
1750 int pat__in_len__;
1751 #ifndef FillArc
1752 PyMac_PRECHECK(FillArc);
1753 #endif
1754 if (!PyArg_ParseTuple(_args, "O&hhs#",
1755 PyMac_GetRect, &r,
1756 &startAngle,
1757 &arcAngle,
1758 (char **)&pat__in__, &pat__in_len__))
1759 return NULL;
1760 if (pat__in_len__ != sizeof(Pattern))
1762 PyErr_SetString(PyExc_TypeError, "buffer length should be sizeof(Pattern)");
1763 goto pat__error__;
1765 FillArc(&r,
1766 startAngle,
1767 arcAngle,
1768 pat__in__);
1769 Py_INCREF(Py_None);
1770 _res = Py_None;
1771 pat__error__: ;
1772 return _res;
1775 static PyObject *Qd_NewRgn(PyObject *_self, PyObject *_args)
1777 PyObject *_res = NULL;
1778 RgnHandle _rv;
1779 #ifndef NewRgn
1780 PyMac_PRECHECK(NewRgn);
1781 #endif
1782 if (!PyArg_ParseTuple(_args, ""))
1783 return NULL;
1784 _rv = NewRgn();
1785 _res = Py_BuildValue("O&",
1786 ResObj_New, _rv);
1787 return _res;
1790 static PyObject *Qd_OpenRgn(PyObject *_self, PyObject *_args)
1792 PyObject *_res = NULL;
1793 #ifndef OpenRgn
1794 PyMac_PRECHECK(OpenRgn);
1795 #endif
1796 if (!PyArg_ParseTuple(_args, ""))
1797 return NULL;
1798 OpenRgn();
1799 Py_INCREF(Py_None);
1800 _res = Py_None;
1801 return _res;
1804 static PyObject *Qd_CloseRgn(PyObject *_self, PyObject *_args)
1806 PyObject *_res = NULL;
1807 RgnHandle dstRgn;
1808 #ifndef CloseRgn
1809 PyMac_PRECHECK(CloseRgn);
1810 #endif
1811 if (!PyArg_ParseTuple(_args, "O&",
1812 ResObj_Convert, &dstRgn))
1813 return NULL;
1814 CloseRgn(dstRgn);
1815 Py_INCREF(Py_None);
1816 _res = Py_None;
1817 return _res;
1820 static PyObject *Qd_BitMapToRegion(PyObject *_self, PyObject *_args)
1822 PyObject *_res = NULL;
1823 OSErr _err;
1824 RgnHandle region;
1825 BitMapPtr bMap;
1826 #ifndef BitMapToRegion
1827 PyMac_PRECHECK(BitMapToRegion);
1828 #endif
1829 if (!PyArg_ParseTuple(_args, "O&O&",
1830 ResObj_Convert, &region,
1831 BMObj_Convert, &bMap))
1832 return NULL;
1833 _err = BitMapToRegion(region,
1834 bMap);
1835 if (_err != noErr) return PyMac_Error(_err);
1836 Py_INCREF(Py_None);
1837 _res = Py_None;
1838 return _res;
1841 #if TARGET_API_MAC_CARBON
1843 static PyObject *Qd_RgnToHandle(PyObject *_self, PyObject *_args)
1845 PyObject *_res = NULL;
1846 RgnHandle region;
1847 Handle flattenedRgnDataHdl;
1848 #ifndef RgnToHandle
1849 PyMac_PRECHECK(RgnToHandle);
1850 #endif
1851 if (!PyArg_ParseTuple(_args, "O&O&",
1852 ResObj_Convert, &region,
1853 ResObj_Convert, &flattenedRgnDataHdl))
1854 return NULL;
1855 RgnToHandle(region,
1856 flattenedRgnDataHdl);
1857 Py_INCREF(Py_None);
1858 _res = Py_None;
1859 return _res;
1861 #endif
1863 static PyObject *Qd_DisposeRgn(PyObject *_self, PyObject *_args)
1865 PyObject *_res = NULL;
1866 RgnHandle rgn;
1867 #ifndef DisposeRgn
1868 PyMac_PRECHECK(DisposeRgn);
1869 #endif
1870 if (!PyArg_ParseTuple(_args, "O&",
1871 ResObj_Convert, &rgn))
1872 return NULL;
1873 DisposeRgn(rgn);
1874 Py_INCREF(Py_None);
1875 _res = Py_None;
1876 return _res;
1879 static PyObject *Qd_MacCopyRgn(PyObject *_self, PyObject *_args)
1881 PyObject *_res = NULL;
1882 RgnHandle srcRgn;
1883 RgnHandle dstRgn;
1884 #ifndef MacCopyRgn
1885 PyMac_PRECHECK(MacCopyRgn);
1886 #endif
1887 if (!PyArg_ParseTuple(_args, "O&O&",
1888 ResObj_Convert, &srcRgn,
1889 ResObj_Convert, &dstRgn))
1890 return NULL;
1891 MacCopyRgn(srcRgn,
1892 dstRgn);
1893 Py_INCREF(Py_None);
1894 _res = Py_None;
1895 return _res;
1898 static PyObject *Qd_SetEmptyRgn(PyObject *_self, PyObject *_args)
1900 PyObject *_res = NULL;
1901 RgnHandle rgn;
1902 #ifndef SetEmptyRgn
1903 PyMac_PRECHECK(SetEmptyRgn);
1904 #endif
1905 if (!PyArg_ParseTuple(_args, "O&",
1906 ResObj_Convert, &rgn))
1907 return NULL;
1908 SetEmptyRgn(rgn);
1909 Py_INCREF(Py_None);
1910 _res = Py_None;
1911 return _res;
1914 static PyObject *Qd_MacSetRectRgn(PyObject *_self, PyObject *_args)
1916 PyObject *_res = NULL;
1917 RgnHandle rgn;
1918 short left;
1919 short top;
1920 short right;
1921 short bottom;
1922 #ifndef MacSetRectRgn
1923 PyMac_PRECHECK(MacSetRectRgn);
1924 #endif
1925 if (!PyArg_ParseTuple(_args, "O&hhhh",
1926 ResObj_Convert, &rgn,
1927 &left,
1928 &top,
1929 &right,
1930 &bottom))
1931 return NULL;
1932 MacSetRectRgn(rgn,
1933 left,
1934 top,
1935 right,
1936 bottom);
1937 Py_INCREF(Py_None);
1938 _res = Py_None;
1939 return _res;
1942 static PyObject *Qd_RectRgn(PyObject *_self, PyObject *_args)
1944 PyObject *_res = NULL;
1945 RgnHandle rgn;
1946 Rect r;
1947 #ifndef RectRgn
1948 PyMac_PRECHECK(RectRgn);
1949 #endif
1950 if (!PyArg_ParseTuple(_args, "O&O&",
1951 ResObj_Convert, &rgn,
1952 PyMac_GetRect, &r))
1953 return NULL;
1954 RectRgn(rgn,
1955 &r);
1956 Py_INCREF(Py_None);
1957 _res = Py_None;
1958 return _res;
1961 static PyObject *Qd_MacOffsetRgn(PyObject *_self, PyObject *_args)
1963 PyObject *_res = NULL;
1964 RgnHandle rgn;
1965 short dh;
1966 short dv;
1967 #ifndef MacOffsetRgn
1968 PyMac_PRECHECK(MacOffsetRgn);
1969 #endif
1970 if (!PyArg_ParseTuple(_args, "O&hh",
1971 ResObj_Convert, &rgn,
1972 &dh,
1973 &dv))
1974 return NULL;
1975 MacOffsetRgn(rgn,
1977 dv);
1978 Py_INCREF(Py_None);
1979 _res = Py_None;
1980 return _res;
1983 static PyObject *Qd_InsetRgn(PyObject *_self, PyObject *_args)
1985 PyObject *_res = NULL;
1986 RgnHandle rgn;
1987 short dh;
1988 short dv;
1989 #ifndef InsetRgn
1990 PyMac_PRECHECK(InsetRgn);
1991 #endif
1992 if (!PyArg_ParseTuple(_args, "O&hh",
1993 ResObj_Convert, &rgn,
1994 &dh,
1995 &dv))
1996 return NULL;
1997 InsetRgn(rgn,
1999 dv);
2000 Py_INCREF(Py_None);
2001 _res = Py_None;
2002 return _res;
2005 static PyObject *Qd_SectRgn(PyObject *_self, PyObject *_args)
2007 PyObject *_res = NULL;
2008 RgnHandle srcRgnA;
2009 RgnHandle srcRgnB;
2010 RgnHandle dstRgn;
2011 #ifndef SectRgn
2012 PyMac_PRECHECK(SectRgn);
2013 #endif
2014 if (!PyArg_ParseTuple(_args, "O&O&O&",
2015 ResObj_Convert, &srcRgnA,
2016 ResObj_Convert, &srcRgnB,
2017 ResObj_Convert, &dstRgn))
2018 return NULL;
2019 SectRgn(srcRgnA,
2020 srcRgnB,
2021 dstRgn);
2022 Py_INCREF(Py_None);
2023 _res = Py_None;
2024 return _res;
2027 static PyObject *Qd_MacUnionRgn(PyObject *_self, PyObject *_args)
2029 PyObject *_res = NULL;
2030 RgnHandle srcRgnA;
2031 RgnHandle srcRgnB;
2032 RgnHandle dstRgn;
2033 #ifndef MacUnionRgn
2034 PyMac_PRECHECK(MacUnionRgn);
2035 #endif
2036 if (!PyArg_ParseTuple(_args, "O&O&O&",
2037 ResObj_Convert, &srcRgnA,
2038 ResObj_Convert, &srcRgnB,
2039 ResObj_Convert, &dstRgn))
2040 return NULL;
2041 MacUnionRgn(srcRgnA,
2042 srcRgnB,
2043 dstRgn);
2044 Py_INCREF(Py_None);
2045 _res = Py_None;
2046 return _res;
2049 static PyObject *Qd_DiffRgn(PyObject *_self, PyObject *_args)
2051 PyObject *_res = NULL;
2052 RgnHandle srcRgnA;
2053 RgnHandle srcRgnB;
2054 RgnHandle dstRgn;
2055 #ifndef DiffRgn
2056 PyMac_PRECHECK(DiffRgn);
2057 #endif
2058 if (!PyArg_ParseTuple(_args, "O&O&O&",
2059 ResObj_Convert, &srcRgnA,
2060 ResObj_Convert, &srcRgnB,
2061 ResObj_Convert, &dstRgn))
2062 return NULL;
2063 DiffRgn(srcRgnA,
2064 srcRgnB,
2065 dstRgn);
2066 Py_INCREF(Py_None);
2067 _res = Py_None;
2068 return _res;
2071 static PyObject *Qd_MacXorRgn(PyObject *_self, PyObject *_args)
2073 PyObject *_res = NULL;
2074 RgnHandle srcRgnA;
2075 RgnHandle srcRgnB;
2076 RgnHandle dstRgn;
2077 #ifndef MacXorRgn
2078 PyMac_PRECHECK(MacXorRgn);
2079 #endif
2080 if (!PyArg_ParseTuple(_args, "O&O&O&",
2081 ResObj_Convert, &srcRgnA,
2082 ResObj_Convert, &srcRgnB,
2083 ResObj_Convert, &dstRgn))
2084 return NULL;
2085 MacXorRgn(srcRgnA,
2086 srcRgnB,
2087 dstRgn);
2088 Py_INCREF(Py_None);
2089 _res = Py_None;
2090 return _res;
2093 static PyObject *Qd_RectInRgn(PyObject *_self, PyObject *_args)
2095 PyObject *_res = NULL;
2096 Boolean _rv;
2097 Rect r;
2098 RgnHandle rgn;
2099 #ifndef RectInRgn
2100 PyMac_PRECHECK(RectInRgn);
2101 #endif
2102 if (!PyArg_ParseTuple(_args, "O&O&",
2103 PyMac_GetRect, &r,
2104 ResObj_Convert, &rgn))
2105 return NULL;
2106 _rv = RectInRgn(&r,
2107 rgn);
2108 _res = Py_BuildValue("b",
2109 _rv);
2110 return _res;
2113 static PyObject *Qd_MacEqualRgn(PyObject *_self, PyObject *_args)
2115 PyObject *_res = NULL;
2116 Boolean _rv;
2117 RgnHandle rgnA;
2118 RgnHandle rgnB;
2119 #ifndef MacEqualRgn
2120 PyMac_PRECHECK(MacEqualRgn);
2121 #endif
2122 if (!PyArg_ParseTuple(_args, "O&O&",
2123 ResObj_Convert, &rgnA,
2124 ResObj_Convert, &rgnB))
2125 return NULL;
2126 _rv = MacEqualRgn(rgnA,
2127 rgnB);
2128 _res = Py_BuildValue("b",
2129 _rv);
2130 return _res;
2133 static PyObject *Qd_EmptyRgn(PyObject *_self, PyObject *_args)
2135 PyObject *_res = NULL;
2136 Boolean _rv;
2137 RgnHandle rgn;
2138 #ifndef EmptyRgn
2139 PyMac_PRECHECK(EmptyRgn);
2140 #endif
2141 if (!PyArg_ParseTuple(_args, "O&",
2142 ResObj_Convert, &rgn))
2143 return NULL;
2144 _rv = EmptyRgn(rgn);
2145 _res = Py_BuildValue("b",
2146 _rv);
2147 return _res;
2150 static PyObject *Qd_MacFrameRgn(PyObject *_self, PyObject *_args)
2152 PyObject *_res = NULL;
2153 RgnHandle rgn;
2154 #ifndef MacFrameRgn
2155 PyMac_PRECHECK(MacFrameRgn);
2156 #endif
2157 if (!PyArg_ParseTuple(_args, "O&",
2158 ResObj_Convert, &rgn))
2159 return NULL;
2160 MacFrameRgn(rgn);
2161 Py_INCREF(Py_None);
2162 _res = Py_None;
2163 return _res;
2166 static PyObject *Qd_MacPaintRgn(PyObject *_self, PyObject *_args)
2168 PyObject *_res = NULL;
2169 RgnHandle rgn;
2170 #ifndef MacPaintRgn
2171 PyMac_PRECHECK(MacPaintRgn);
2172 #endif
2173 if (!PyArg_ParseTuple(_args, "O&",
2174 ResObj_Convert, &rgn))
2175 return NULL;
2176 MacPaintRgn(rgn);
2177 Py_INCREF(Py_None);
2178 _res = Py_None;
2179 return _res;
2182 static PyObject *Qd_EraseRgn(PyObject *_self, PyObject *_args)
2184 PyObject *_res = NULL;
2185 RgnHandle rgn;
2186 #ifndef EraseRgn
2187 PyMac_PRECHECK(EraseRgn);
2188 #endif
2189 if (!PyArg_ParseTuple(_args, "O&",
2190 ResObj_Convert, &rgn))
2191 return NULL;
2192 EraseRgn(rgn);
2193 Py_INCREF(Py_None);
2194 _res = Py_None;
2195 return _res;
2198 static PyObject *Qd_MacInvertRgn(PyObject *_self, PyObject *_args)
2200 PyObject *_res = NULL;
2201 RgnHandle rgn;
2202 #ifndef MacInvertRgn
2203 PyMac_PRECHECK(MacInvertRgn);
2204 #endif
2205 if (!PyArg_ParseTuple(_args, "O&",
2206 ResObj_Convert, &rgn))
2207 return NULL;
2208 MacInvertRgn(rgn);
2209 Py_INCREF(Py_None);
2210 _res = Py_None;
2211 return _res;
2214 static PyObject *Qd_MacFillRgn(PyObject *_self, PyObject *_args)
2216 PyObject *_res = NULL;
2217 RgnHandle rgn;
2218 Pattern *pat__in__;
2219 int pat__in_len__;
2220 #ifndef MacFillRgn
2221 PyMac_PRECHECK(MacFillRgn);
2222 #endif
2223 if (!PyArg_ParseTuple(_args, "O&s#",
2224 ResObj_Convert, &rgn,
2225 (char **)&pat__in__, &pat__in_len__))
2226 return NULL;
2227 if (pat__in_len__ != sizeof(Pattern))
2229 PyErr_SetString(PyExc_TypeError, "buffer length should be sizeof(Pattern)");
2230 goto pat__error__;
2232 MacFillRgn(rgn,
2233 pat__in__);
2234 Py_INCREF(Py_None);
2235 _res = Py_None;
2236 pat__error__: ;
2237 return _res;
2240 static PyObject *Qd_ScrollRect(PyObject *_self, PyObject *_args)
2242 PyObject *_res = NULL;
2243 Rect r;
2244 short dh;
2245 short dv;
2246 RgnHandle updateRgn;
2247 #ifndef ScrollRect
2248 PyMac_PRECHECK(ScrollRect);
2249 #endif
2250 if (!PyArg_ParseTuple(_args, "O&hhO&",
2251 PyMac_GetRect, &r,
2252 &dh,
2253 &dv,
2254 ResObj_Convert, &updateRgn))
2255 return NULL;
2256 ScrollRect(&r,
2259 updateRgn);
2260 Py_INCREF(Py_None);
2261 _res = Py_None;
2262 return _res;
2265 static PyObject *Qd_CopyBits(PyObject *_self, PyObject *_args)
2267 PyObject *_res = NULL;
2268 BitMapPtr srcBits;
2269 BitMapPtr dstBits;
2270 Rect srcRect;
2271 Rect dstRect;
2272 short mode;
2273 RgnHandle maskRgn;
2274 #ifndef CopyBits
2275 PyMac_PRECHECK(CopyBits);
2276 #endif
2277 if (!PyArg_ParseTuple(_args, "O&O&O&O&hO&",
2278 BMObj_Convert, &srcBits,
2279 BMObj_Convert, &dstBits,
2280 PyMac_GetRect, &srcRect,
2281 PyMac_GetRect, &dstRect,
2282 &mode,
2283 OptResObj_Convert, &maskRgn))
2284 return NULL;
2285 CopyBits(srcBits,
2286 dstBits,
2287 &srcRect,
2288 &dstRect,
2289 mode,
2290 maskRgn);
2291 Py_INCREF(Py_None);
2292 _res = Py_None;
2293 return _res;
2296 static PyObject *Qd_CopyMask(PyObject *_self, PyObject *_args)
2298 PyObject *_res = NULL;
2299 BitMapPtr srcBits;
2300 BitMapPtr maskBits;
2301 BitMapPtr dstBits;
2302 Rect srcRect;
2303 Rect maskRect;
2304 Rect dstRect;
2305 #ifndef CopyMask
2306 PyMac_PRECHECK(CopyMask);
2307 #endif
2308 if (!PyArg_ParseTuple(_args, "O&O&O&O&O&O&",
2309 BMObj_Convert, &srcBits,
2310 BMObj_Convert, &maskBits,
2311 BMObj_Convert, &dstBits,
2312 PyMac_GetRect, &srcRect,
2313 PyMac_GetRect, &maskRect,
2314 PyMac_GetRect, &dstRect))
2315 return NULL;
2316 CopyMask(srcBits,
2317 maskBits,
2318 dstBits,
2319 &srcRect,
2320 &maskRect,
2321 &dstRect);
2322 Py_INCREF(Py_None);
2323 _res = Py_None;
2324 return _res;
2327 static PyObject *Qd_OpenPicture(PyObject *_self, PyObject *_args)
2329 PyObject *_res = NULL;
2330 PicHandle _rv;
2331 Rect picFrame;
2332 #ifndef OpenPicture
2333 PyMac_PRECHECK(OpenPicture);
2334 #endif
2335 if (!PyArg_ParseTuple(_args, "O&",
2336 PyMac_GetRect, &picFrame))
2337 return NULL;
2338 _rv = OpenPicture(&picFrame);
2339 _res = Py_BuildValue("O&",
2340 ResObj_New, _rv);
2341 return _res;
2344 static PyObject *Qd_PicComment(PyObject *_self, PyObject *_args)
2346 PyObject *_res = NULL;
2347 short kind;
2348 short dataSize;
2349 Handle dataHandle;
2350 #ifndef PicComment
2351 PyMac_PRECHECK(PicComment);
2352 #endif
2353 if (!PyArg_ParseTuple(_args, "hhO&",
2354 &kind,
2355 &dataSize,
2356 ResObj_Convert, &dataHandle))
2357 return NULL;
2358 PicComment(kind,
2359 dataSize,
2360 dataHandle);
2361 Py_INCREF(Py_None);
2362 _res = Py_None;
2363 return _res;
2366 static PyObject *Qd_ClosePicture(PyObject *_self, PyObject *_args)
2368 PyObject *_res = NULL;
2369 #ifndef ClosePicture
2370 PyMac_PRECHECK(ClosePicture);
2371 #endif
2372 if (!PyArg_ParseTuple(_args, ""))
2373 return NULL;
2374 ClosePicture();
2375 Py_INCREF(Py_None);
2376 _res = Py_None;
2377 return _res;
2380 static PyObject *Qd_DrawPicture(PyObject *_self, PyObject *_args)
2382 PyObject *_res = NULL;
2383 PicHandle myPicture;
2384 Rect dstRect;
2385 #ifndef DrawPicture
2386 PyMac_PRECHECK(DrawPicture);
2387 #endif
2388 if (!PyArg_ParseTuple(_args, "O&O&",
2389 ResObj_Convert, &myPicture,
2390 PyMac_GetRect, &dstRect))
2391 return NULL;
2392 DrawPicture(myPicture,
2393 &dstRect);
2394 Py_INCREF(Py_None);
2395 _res = Py_None;
2396 return _res;
2399 static PyObject *Qd_KillPicture(PyObject *_self, PyObject *_args)
2401 PyObject *_res = NULL;
2402 PicHandle myPicture;
2403 #ifndef KillPicture
2404 PyMac_PRECHECK(KillPicture);
2405 #endif
2406 if (!PyArg_ParseTuple(_args, "O&",
2407 ResObj_Convert, &myPicture))
2408 return NULL;
2409 KillPicture(myPicture);
2410 Py_INCREF(Py_None);
2411 _res = Py_None;
2412 return _res;
2415 static PyObject *Qd_OpenPoly(PyObject *_self, PyObject *_args)
2417 PyObject *_res = NULL;
2418 PolyHandle _rv;
2419 #ifndef OpenPoly
2420 PyMac_PRECHECK(OpenPoly);
2421 #endif
2422 if (!PyArg_ParseTuple(_args, ""))
2423 return NULL;
2424 _rv = OpenPoly();
2425 _res = Py_BuildValue("O&",
2426 ResObj_New, _rv);
2427 return _res;
2430 static PyObject *Qd_ClosePoly(PyObject *_self, PyObject *_args)
2432 PyObject *_res = NULL;
2433 #ifndef ClosePoly
2434 PyMac_PRECHECK(ClosePoly);
2435 #endif
2436 if (!PyArg_ParseTuple(_args, ""))
2437 return NULL;
2438 ClosePoly();
2439 Py_INCREF(Py_None);
2440 _res = Py_None;
2441 return _res;
2444 static PyObject *Qd_KillPoly(PyObject *_self, PyObject *_args)
2446 PyObject *_res = NULL;
2447 PolyHandle poly;
2448 #ifndef KillPoly
2449 PyMac_PRECHECK(KillPoly);
2450 #endif
2451 if (!PyArg_ParseTuple(_args, "O&",
2452 ResObj_Convert, &poly))
2453 return NULL;
2454 KillPoly(poly);
2455 Py_INCREF(Py_None);
2456 _res = Py_None;
2457 return _res;
2460 static PyObject *Qd_OffsetPoly(PyObject *_self, PyObject *_args)
2462 PyObject *_res = NULL;
2463 PolyHandle poly;
2464 short dh;
2465 short dv;
2466 #ifndef OffsetPoly
2467 PyMac_PRECHECK(OffsetPoly);
2468 #endif
2469 if (!PyArg_ParseTuple(_args, "O&hh",
2470 ResObj_Convert, &poly,
2471 &dh,
2472 &dv))
2473 return NULL;
2474 OffsetPoly(poly,
2476 dv);
2477 Py_INCREF(Py_None);
2478 _res = Py_None;
2479 return _res;
2482 static PyObject *Qd_FramePoly(PyObject *_self, PyObject *_args)
2484 PyObject *_res = NULL;
2485 PolyHandle poly;
2486 #ifndef FramePoly
2487 PyMac_PRECHECK(FramePoly);
2488 #endif
2489 if (!PyArg_ParseTuple(_args, "O&",
2490 ResObj_Convert, &poly))
2491 return NULL;
2492 FramePoly(poly);
2493 Py_INCREF(Py_None);
2494 _res = Py_None;
2495 return _res;
2498 static PyObject *Qd_PaintPoly(PyObject *_self, PyObject *_args)
2500 PyObject *_res = NULL;
2501 PolyHandle poly;
2502 #ifndef PaintPoly
2503 PyMac_PRECHECK(PaintPoly);
2504 #endif
2505 if (!PyArg_ParseTuple(_args, "O&",
2506 ResObj_Convert, &poly))
2507 return NULL;
2508 PaintPoly(poly);
2509 Py_INCREF(Py_None);
2510 _res = Py_None;
2511 return _res;
2514 static PyObject *Qd_ErasePoly(PyObject *_self, PyObject *_args)
2516 PyObject *_res = NULL;
2517 PolyHandle poly;
2518 #ifndef ErasePoly
2519 PyMac_PRECHECK(ErasePoly);
2520 #endif
2521 if (!PyArg_ParseTuple(_args, "O&",
2522 ResObj_Convert, &poly))
2523 return NULL;
2524 ErasePoly(poly);
2525 Py_INCREF(Py_None);
2526 _res = Py_None;
2527 return _res;
2530 static PyObject *Qd_InvertPoly(PyObject *_self, PyObject *_args)
2532 PyObject *_res = NULL;
2533 PolyHandle poly;
2534 #ifndef InvertPoly
2535 PyMac_PRECHECK(InvertPoly);
2536 #endif
2537 if (!PyArg_ParseTuple(_args, "O&",
2538 ResObj_Convert, &poly))
2539 return NULL;
2540 InvertPoly(poly);
2541 Py_INCREF(Py_None);
2542 _res = Py_None;
2543 return _res;
2546 static PyObject *Qd_FillPoly(PyObject *_self, PyObject *_args)
2548 PyObject *_res = NULL;
2549 PolyHandle poly;
2550 Pattern *pat__in__;
2551 int pat__in_len__;
2552 #ifndef FillPoly
2553 PyMac_PRECHECK(FillPoly);
2554 #endif
2555 if (!PyArg_ParseTuple(_args, "O&s#",
2556 ResObj_Convert, &poly,
2557 (char **)&pat__in__, &pat__in_len__))
2558 return NULL;
2559 if (pat__in_len__ != sizeof(Pattern))
2561 PyErr_SetString(PyExc_TypeError, "buffer length should be sizeof(Pattern)");
2562 goto pat__error__;
2564 FillPoly(poly,
2565 pat__in__);
2566 Py_INCREF(Py_None);
2567 _res = Py_None;
2568 pat__error__: ;
2569 return _res;
2572 static PyObject *Qd_SetPt(PyObject *_self, PyObject *_args)
2574 PyObject *_res = NULL;
2575 Point pt;
2576 short h;
2577 short v;
2578 #ifndef SetPt
2579 PyMac_PRECHECK(SetPt);
2580 #endif
2581 if (!PyArg_ParseTuple(_args, "hh",
2583 &v))
2584 return NULL;
2585 SetPt(&pt,
2588 _res = Py_BuildValue("O&",
2589 PyMac_BuildPoint, pt);
2590 return _res;
2593 static PyObject *Qd_LocalToGlobal(PyObject *_self, PyObject *_args)
2595 PyObject *_res = NULL;
2596 Point pt;
2597 #ifndef LocalToGlobal
2598 PyMac_PRECHECK(LocalToGlobal);
2599 #endif
2600 if (!PyArg_ParseTuple(_args, "O&",
2601 PyMac_GetPoint, &pt))
2602 return NULL;
2603 LocalToGlobal(&pt);
2604 _res = Py_BuildValue("O&",
2605 PyMac_BuildPoint, pt);
2606 return _res;
2609 static PyObject *Qd_GlobalToLocal(PyObject *_self, PyObject *_args)
2611 PyObject *_res = NULL;
2612 Point pt;
2613 #ifndef GlobalToLocal
2614 PyMac_PRECHECK(GlobalToLocal);
2615 #endif
2616 if (!PyArg_ParseTuple(_args, "O&",
2617 PyMac_GetPoint, &pt))
2618 return NULL;
2619 GlobalToLocal(&pt);
2620 _res = Py_BuildValue("O&",
2621 PyMac_BuildPoint, pt);
2622 return _res;
2625 static PyObject *Qd_Random(PyObject *_self, PyObject *_args)
2627 PyObject *_res = NULL;
2628 short _rv;
2629 #ifndef Random
2630 PyMac_PRECHECK(Random);
2631 #endif
2632 if (!PyArg_ParseTuple(_args, ""))
2633 return NULL;
2634 _rv = Random();
2635 _res = Py_BuildValue("h",
2636 _rv);
2637 return _res;
2640 static PyObject *Qd_MacGetPixel(PyObject *_self, PyObject *_args)
2642 PyObject *_res = NULL;
2643 Boolean _rv;
2644 short h;
2645 short v;
2646 #ifndef MacGetPixel
2647 PyMac_PRECHECK(MacGetPixel);
2648 #endif
2649 if (!PyArg_ParseTuple(_args, "hh",
2651 &v))
2652 return NULL;
2653 _rv = MacGetPixel(h,
2655 _res = Py_BuildValue("b",
2656 _rv);
2657 return _res;
2660 static PyObject *Qd_ScalePt(PyObject *_self, PyObject *_args)
2662 PyObject *_res = NULL;
2663 Point pt;
2664 Rect srcRect;
2665 Rect dstRect;
2666 #ifndef ScalePt
2667 PyMac_PRECHECK(ScalePt);
2668 #endif
2669 if (!PyArg_ParseTuple(_args, "O&O&O&",
2670 PyMac_GetPoint, &pt,
2671 PyMac_GetRect, &srcRect,
2672 PyMac_GetRect, &dstRect))
2673 return NULL;
2674 ScalePt(&pt,
2675 &srcRect,
2676 &dstRect);
2677 _res = Py_BuildValue("O&",
2678 PyMac_BuildPoint, pt);
2679 return _res;
2682 static PyObject *Qd_MapPt(PyObject *_self, PyObject *_args)
2684 PyObject *_res = NULL;
2685 Point pt;
2686 Rect srcRect;
2687 Rect dstRect;
2688 #ifndef MapPt
2689 PyMac_PRECHECK(MapPt);
2690 #endif
2691 if (!PyArg_ParseTuple(_args, "O&O&O&",
2692 PyMac_GetPoint, &pt,
2693 PyMac_GetRect, &srcRect,
2694 PyMac_GetRect, &dstRect))
2695 return NULL;
2696 MapPt(&pt,
2697 &srcRect,
2698 &dstRect);
2699 _res = Py_BuildValue("O&",
2700 PyMac_BuildPoint, pt);
2701 return _res;
2704 static PyObject *Qd_MapRect(PyObject *_self, PyObject *_args)
2706 PyObject *_res = NULL;
2707 Rect r;
2708 Rect srcRect;
2709 Rect dstRect;
2710 #ifndef MapRect
2711 PyMac_PRECHECK(MapRect);
2712 #endif
2713 if (!PyArg_ParseTuple(_args, "O&O&O&",
2714 PyMac_GetRect, &r,
2715 PyMac_GetRect, &srcRect,
2716 PyMac_GetRect, &dstRect))
2717 return NULL;
2718 MapRect(&r,
2719 &srcRect,
2720 &dstRect);
2721 _res = Py_BuildValue("O&",
2722 PyMac_BuildRect, &r);
2723 return _res;
2726 static PyObject *Qd_MapRgn(PyObject *_self, PyObject *_args)
2728 PyObject *_res = NULL;
2729 RgnHandle rgn;
2730 Rect srcRect;
2731 Rect dstRect;
2732 #ifndef MapRgn
2733 PyMac_PRECHECK(MapRgn);
2734 #endif
2735 if (!PyArg_ParseTuple(_args, "O&O&O&",
2736 ResObj_Convert, &rgn,
2737 PyMac_GetRect, &srcRect,
2738 PyMac_GetRect, &dstRect))
2739 return NULL;
2740 MapRgn(rgn,
2741 &srcRect,
2742 &dstRect);
2743 Py_INCREF(Py_None);
2744 _res = Py_None;
2745 return _res;
2748 static PyObject *Qd_MapPoly(PyObject *_self, PyObject *_args)
2750 PyObject *_res = NULL;
2751 PolyHandle poly;
2752 Rect srcRect;
2753 Rect dstRect;
2754 #ifndef MapPoly
2755 PyMac_PRECHECK(MapPoly);
2756 #endif
2757 if (!PyArg_ParseTuple(_args, "O&O&O&",
2758 ResObj_Convert, &poly,
2759 PyMac_GetRect, &srcRect,
2760 PyMac_GetRect, &dstRect))
2761 return NULL;
2762 MapPoly(poly,
2763 &srcRect,
2764 &dstRect);
2765 Py_INCREF(Py_None);
2766 _res = Py_None;
2767 return _res;
2770 static PyObject *Qd_StdBits(PyObject *_self, PyObject *_args)
2772 PyObject *_res = NULL;
2773 BitMapPtr srcBits;
2774 Rect srcRect;
2775 Rect dstRect;
2776 short mode;
2777 RgnHandle maskRgn;
2778 #ifndef StdBits
2779 PyMac_PRECHECK(StdBits);
2780 #endif
2781 if (!PyArg_ParseTuple(_args, "O&O&O&hO&",
2782 BMObj_Convert, &srcBits,
2783 PyMac_GetRect, &srcRect,
2784 PyMac_GetRect, &dstRect,
2785 &mode,
2786 OptResObj_Convert, &maskRgn))
2787 return NULL;
2788 StdBits(srcBits,
2789 &srcRect,
2790 &dstRect,
2791 mode,
2792 maskRgn);
2793 Py_INCREF(Py_None);
2794 _res = Py_None;
2795 return _res;
2798 static PyObject *Qd_AddPt(PyObject *_self, PyObject *_args)
2800 PyObject *_res = NULL;
2801 Point src;
2802 Point dst;
2803 #ifndef AddPt
2804 PyMac_PRECHECK(AddPt);
2805 #endif
2806 if (!PyArg_ParseTuple(_args, "O&O&",
2807 PyMac_GetPoint, &src,
2808 PyMac_GetPoint, &dst))
2809 return NULL;
2810 AddPt(src,
2811 &dst);
2812 _res = Py_BuildValue("O&",
2813 PyMac_BuildPoint, dst);
2814 return _res;
2817 static PyObject *Qd_EqualPt(PyObject *_self, PyObject *_args)
2819 PyObject *_res = NULL;
2820 Boolean _rv;
2821 Point pt1;
2822 Point pt2;
2823 #ifndef EqualPt
2824 PyMac_PRECHECK(EqualPt);
2825 #endif
2826 if (!PyArg_ParseTuple(_args, "O&O&",
2827 PyMac_GetPoint, &pt1,
2828 PyMac_GetPoint, &pt2))
2829 return NULL;
2830 _rv = EqualPt(pt1,
2831 pt2);
2832 _res = Py_BuildValue("b",
2833 _rv);
2834 return _res;
2837 static PyObject *Qd_MacPtInRect(PyObject *_self, PyObject *_args)
2839 PyObject *_res = NULL;
2840 Boolean _rv;
2841 Point pt;
2842 Rect r;
2843 #ifndef MacPtInRect
2844 PyMac_PRECHECK(MacPtInRect);
2845 #endif
2846 if (!PyArg_ParseTuple(_args, "O&O&",
2847 PyMac_GetPoint, &pt,
2848 PyMac_GetRect, &r))
2849 return NULL;
2850 _rv = MacPtInRect(pt,
2851 &r);
2852 _res = Py_BuildValue("b",
2853 _rv);
2854 return _res;
2857 static PyObject *Qd_Pt2Rect(PyObject *_self, PyObject *_args)
2859 PyObject *_res = NULL;
2860 Point pt1;
2861 Point pt2;
2862 Rect dstRect;
2863 #ifndef Pt2Rect
2864 PyMac_PRECHECK(Pt2Rect);
2865 #endif
2866 if (!PyArg_ParseTuple(_args, "O&O&",
2867 PyMac_GetPoint, &pt1,
2868 PyMac_GetPoint, &pt2))
2869 return NULL;
2870 Pt2Rect(pt1,
2871 pt2,
2872 &dstRect);
2873 _res = Py_BuildValue("O&",
2874 PyMac_BuildRect, &dstRect);
2875 return _res;
2878 static PyObject *Qd_PtToAngle(PyObject *_self, PyObject *_args)
2880 PyObject *_res = NULL;
2881 Rect r;
2882 Point pt;
2883 short angle;
2884 #ifndef PtToAngle
2885 PyMac_PRECHECK(PtToAngle);
2886 #endif
2887 if (!PyArg_ParseTuple(_args, "O&O&",
2888 PyMac_GetRect, &r,
2889 PyMac_GetPoint, &pt))
2890 return NULL;
2891 PtToAngle(&r,
2893 &angle);
2894 _res = Py_BuildValue("h",
2895 angle);
2896 return _res;
2899 static PyObject *Qd_SubPt(PyObject *_self, PyObject *_args)
2901 PyObject *_res = NULL;
2902 Point src;
2903 Point dst;
2904 #ifndef SubPt
2905 PyMac_PRECHECK(SubPt);
2906 #endif
2907 if (!PyArg_ParseTuple(_args, "O&O&",
2908 PyMac_GetPoint, &src,
2909 PyMac_GetPoint, &dst))
2910 return NULL;
2911 SubPt(src,
2912 &dst);
2913 _res = Py_BuildValue("O&",
2914 PyMac_BuildPoint, dst);
2915 return _res;
2918 static PyObject *Qd_PtInRgn(PyObject *_self, PyObject *_args)
2920 PyObject *_res = NULL;
2921 Boolean _rv;
2922 Point pt;
2923 RgnHandle rgn;
2924 #ifndef PtInRgn
2925 PyMac_PRECHECK(PtInRgn);
2926 #endif
2927 if (!PyArg_ParseTuple(_args, "O&O&",
2928 PyMac_GetPoint, &pt,
2929 ResObj_Convert, &rgn))
2930 return NULL;
2931 _rv = PtInRgn(pt,
2932 rgn);
2933 _res = Py_BuildValue("b",
2934 _rv);
2935 return _res;
2938 static PyObject *Qd_NewPixMap(PyObject *_self, PyObject *_args)
2940 PyObject *_res = NULL;
2941 PixMapHandle _rv;
2942 #ifndef NewPixMap
2943 PyMac_PRECHECK(NewPixMap);
2944 #endif
2945 if (!PyArg_ParseTuple(_args, ""))
2946 return NULL;
2947 _rv = NewPixMap();
2948 _res = Py_BuildValue("O&",
2949 ResObj_New, _rv);
2950 return _res;
2953 static PyObject *Qd_DisposePixMap(PyObject *_self, PyObject *_args)
2955 PyObject *_res = NULL;
2956 PixMapHandle pm;
2957 #ifndef DisposePixMap
2958 PyMac_PRECHECK(DisposePixMap);
2959 #endif
2960 if (!PyArg_ParseTuple(_args, "O&",
2961 ResObj_Convert, &pm))
2962 return NULL;
2963 DisposePixMap(pm);
2964 Py_INCREF(Py_None);
2965 _res = Py_None;
2966 return _res;
2969 static PyObject *Qd_CopyPixMap(PyObject *_self, PyObject *_args)
2971 PyObject *_res = NULL;
2972 PixMapHandle srcPM;
2973 PixMapHandle dstPM;
2974 #ifndef CopyPixMap
2975 PyMac_PRECHECK(CopyPixMap);
2976 #endif
2977 if (!PyArg_ParseTuple(_args, "O&O&",
2978 ResObj_Convert, &srcPM,
2979 ResObj_Convert, &dstPM))
2980 return NULL;
2981 CopyPixMap(srcPM,
2982 dstPM);
2983 Py_INCREF(Py_None);
2984 _res = Py_None;
2985 return _res;
2988 static PyObject *Qd_NewPixPat(PyObject *_self, PyObject *_args)
2990 PyObject *_res = NULL;
2991 PixPatHandle _rv;
2992 #ifndef NewPixPat
2993 PyMac_PRECHECK(NewPixPat);
2994 #endif
2995 if (!PyArg_ParseTuple(_args, ""))
2996 return NULL;
2997 _rv = NewPixPat();
2998 _res = Py_BuildValue("O&",
2999 ResObj_New, _rv);
3000 return _res;
3003 static PyObject *Qd_DisposePixPat(PyObject *_self, PyObject *_args)
3005 PyObject *_res = NULL;
3006 PixPatHandle pp;
3007 #ifndef DisposePixPat
3008 PyMac_PRECHECK(DisposePixPat);
3009 #endif
3010 if (!PyArg_ParseTuple(_args, "O&",
3011 ResObj_Convert, &pp))
3012 return NULL;
3013 DisposePixPat(pp);
3014 Py_INCREF(Py_None);
3015 _res = Py_None;
3016 return _res;
3019 static PyObject *Qd_CopyPixPat(PyObject *_self, PyObject *_args)
3021 PyObject *_res = NULL;
3022 PixPatHandle srcPP;
3023 PixPatHandle dstPP;
3024 #ifndef CopyPixPat
3025 PyMac_PRECHECK(CopyPixPat);
3026 #endif
3027 if (!PyArg_ParseTuple(_args, "O&O&",
3028 ResObj_Convert, &srcPP,
3029 ResObj_Convert, &dstPP))
3030 return NULL;
3031 CopyPixPat(srcPP,
3032 dstPP);
3033 Py_INCREF(Py_None);
3034 _res = Py_None;
3035 return _res;
3038 static PyObject *Qd_PenPixPat(PyObject *_self, PyObject *_args)
3040 PyObject *_res = NULL;
3041 PixPatHandle pp;
3042 #ifndef PenPixPat
3043 PyMac_PRECHECK(PenPixPat);
3044 #endif
3045 if (!PyArg_ParseTuple(_args, "O&",
3046 ResObj_Convert, &pp))
3047 return NULL;
3048 PenPixPat(pp);
3049 Py_INCREF(Py_None);
3050 _res = Py_None;
3051 return _res;
3054 static PyObject *Qd_BackPixPat(PyObject *_self, PyObject *_args)
3056 PyObject *_res = NULL;
3057 PixPatHandle pp;
3058 #ifndef BackPixPat
3059 PyMac_PRECHECK(BackPixPat);
3060 #endif
3061 if (!PyArg_ParseTuple(_args, "O&",
3062 ResObj_Convert, &pp))
3063 return NULL;
3064 BackPixPat(pp);
3065 Py_INCREF(Py_None);
3066 _res = Py_None;
3067 return _res;
3070 static PyObject *Qd_GetPixPat(PyObject *_self, PyObject *_args)
3072 PyObject *_res = NULL;
3073 PixPatHandle _rv;
3074 short patID;
3075 #ifndef GetPixPat
3076 PyMac_PRECHECK(GetPixPat);
3077 #endif
3078 if (!PyArg_ParseTuple(_args, "h",
3079 &patID))
3080 return NULL;
3081 _rv = GetPixPat(patID);
3082 _res = Py_BuildValue("O&",
3083 ResObj_New, _rv);
3084 return _res;
3087 static PyObject *Qd_MakeRGBPat(PyObject *_self, PyObject *_args)
3089 PyObject *_res = NULL;
3090 PixPatHandle pp;
3091 RGBColor myColor;
3092 #ifndef MakeRGBPat
3093 PyMac_PRECHECK(MakeRGBPat);
3094 #endif
3095 if (!PyArg_ParseTuple(_args, "O&O&",
3096 ResObj_Convert, &pp,
3097 QdRGB_Convert, &myColor))
3098 return NULL;
3099 MakeRGBPat(pp,
3100 &myColor);
3101 Py_INCREF(Py_None);
3102 _res = Py_None;
3103 return _res;
3106 static PyObject *Qd_FillCRect(PyObject *_self, PyObject *_args)
3108 PyObject *_res = NULL;
3109 Rect r;
3110 PixPatHandle pp;
3111 #ifndef FillCRect
3112 PyMac_PRECHECK(FillCRect);
3113 #endif
3114 if (!PyArg_ParseTuple(_args, "O&O&",
3115 PyMac_GetRect, &r,
3116 ResObj_Convert, &pp))
3117 return NULL;
3118 FillCRect(&r,
3119 pp);
3120 Py_INCREF(Py_None);
3121 _res = Py_None;
3122 return _res;
3125 static PyObject *Qd_FillCOval(PyObject *_self, PyObject *_args)
3127 PyObject *_res = NULL;
3128 Rect r;
3129 PixPatHandle pp;
3130 #ifndef FillCOval
3131 PyMac_PRECHECK(FillCOval);
3132 #endif
3133 if (!PyArg_ParseTuple(_args, "O&O&",
3134 PyMac_GetRect, &r,
3135 ResObj_Convert, &pp))
3136 return NULL;
3137 FillCOval(&r,
3138 pp);
3139 Py_INCREF(Py_None);
3140 _res = Py_None;
3141 return _res;
3144 static PyObject *Qd_FillCRoundRect(PyObject *_self, PyObject *_args)
3146 PyObject *_res = NULL;
3147 Rect r;
3148 short ovalWidth;
3149 short ovalHeight;
3150 PixPatHandle pp;
3151 #ifndef FillCRoundRect
3152 PyMac_PRECHECK(FillCRoundRect);
3153 #endif
3154 if (!PyArg_ParseTuple(_args, "O&hhO&",
3155 PyMac_GetRect, &r,
3156 &ovalWidth,
3157 &ovalHeight,
3158 ResObj_Convert, &pp))
3159 return NULL;
3160 FillCRoundRect(&r,
3161 ovalWidth,
3162 ovalHeight,
3163 pp);
3164 Py_INCREF(Py_None);
3165 _res = Py_None;
3166 return _res;
3169 static PyObject *Qd_FillCArc(PyObject *_self, PyObject *_args)
3171 PyObject *_res = NULL;
3172 Rect r;
3173 short startAngle;
3174 short arcAngle;
3175 PixPatHandle pp;
3176 #ifndef FillCArc
3177 PyMac_PRECHECK(FillCArc);
3178 #endif
3179 if (!PyArg_ParseTuple(_args, "O&hhO&",
3180 PyMac_GetRect, &r,
3181 &startAngle,
3182 &arcAngle,
3183 ResObj_Convert, &pp))
3184 return NULL;
3185 FillCArc(&r,
3186 startAngle,
3187 arcAngle,
3188 pp);
3189 Py_INCREF(Py_None);
3190 _res = Py_None;
3191 return _res;
3194 static PyObject *Qd_FillCRgn(PyObject *_self, PyObject *_args)
3196 PyObject *_res = NULL;
3197 RgnHandle rgn;
3198 PixPatHandle pp;
3199 #ifndef FillCRgn
3200 PyMac_PRECHECK(FillCRgn);
3201 #endif
3202 if (!PyArg_ParseTuple(_args, "O&O&",
3203 ResObj_Convert, &rgn,
3204 ResObj_Convert, &pp))
3205 return NULL;
3206 FillCRgn(rgn,
3207 pp);
3208 Py_INCREF(Py_None);
3209 _res = Py_None;
3210 return _res;
3213 static PyObject *Qd_FillCPoly(PyObject *_self, PyObject *_args)
3215 PyObject *_res = NULL;
3216 PolyHandle poly;
3217 PixPatHandle pp;
3218 #ifndef FillCPoly
3219 PyMac_PRECHECK(FillCPoly);
3220 #endif
3221 if (!PyArg_ParseTuple(_args, "O&O&",
3222 ResObj_Convert, &poly,
3223 ResObj_Convert, &pp))
3224 return NULL;
3225 FillCPoly(poly,
3226 pp);
3227 Py_INCREF(Py_None);
3228 _res = Py_None;
3229 return _res;
3232 static PyObject *Qd_RGBForeColor(PyObject *_self, PyObject *_args)
3234 PyObject *_res = NULL;
3235 RGBColor color;
3236 #ifndef RGBForeColor
3237 PyMac_PRECHECK(RGBForeColor);
3238 #endif
3239 if (!PyArg_ParseTuple(_args, "O&",
3240 QdRGB_Convert, &color))
3241 return NULL;
3242 RGBForeColor(&color);
3243 Py_INCREF(Py_None);
3244 _res = Py_None;
3245 return _res;
3248 static PyObject *Qd_RGBBackColor(PyObject *_self, PyObject *_args)
3250 PyObject *_res = NULL;
3251 RGBColor color;
3252 #ifndef RGBBackColor
3253 PyMac_PRECHECK(RGBBackColor);
3254 #endif
3255 if (!PyArg_ParseTuple(_args, "O&",
3256 QdRGB_Convert, &color))
3257 return NULL;
3258 RGBBackColor(&color);
3259 Py_INCREF(Py_None);
3260 _res = Py_None;
3261 return _res;
3264 static PyObject *Qd_SetCPixel(PyObject *_self, PyObject *_args)
3266 PyObject *_res = NULL;
3267 short h;
3268 short v;
3269 RGBColor cPix;
3270 #ifndef SetCPixel
3271 PyMac_PRECHECK(SetCPixel);
3272 #endif
3273 if (!PyArg_ParseTuple(_args, "hhO&",
3276 QdRGB_Convert, &cPix))
3277 return NULL;
3278 SetCPixel(h,
3280 &cPix);
3281 Py_INCREF(Py_None);
3282 _res = Py_None;
3283 return _res;
3286 static PyObject *Qd_SetPortPix(PyObject *_self, PyObject *_args)
3288 PyObject *_res = NULL;
3289 PixMapHandle pm;
3290 #ifndef SetPortPix
3291 PyMac_PRECHECK(SetPortPix);
3292 #endif
3293 if (!PyArg_ParseTuple(_args, "O&",
3294 ResObj_Convert, &pm))
3295 return NULL;
3296 SetPortPix(pm);
3297 Py_INCREF(Py_None);
3298 _res = Py_None;
3299 return _res;
3302 static PyObject *Qd_GetCPixel(PyObject *_self, PyObject *_args)
3304 PyObject *_res = NULL;
3305 short h;
3306 short v;
3307 RGBColor cPix;
3308 #ifndef GetCPixel
3309 PyMac_PRECHECK(GetCPixel);
3310 #endif
3311 if (!PyArg_ParseTuple(_args, "hh",
3313 &v))
3314 return NULL;
3315 GetCPixel(h,
3317 &cPix);
3318 _res = Py_BuildValue("O&",
3319 QdRGB_New, &cPix);
3320 return _res;
3323 static PyObject *Qd_GetForeColor(PyObject *_self, PyObject *_args)
3325 PyObject *_res = NULL;
3326 RGBColor color;
3327 #ifndef GetForeColor
3328 PyMac_PRECHECK(GetForeColor);
3329 #endif
3330 if (!PyArg_ParseTuple(_args, ""))
3331 return NULL;
3332 GetForeColor(&color);
3333 _res = Py_BuildValue("O&",
3334 QdRGB_New, &color);
3335 return _res;
3338 static PyObject *Qd_GetBackColor(PyObject *_self, PyObject *_args)
3340 PyObject *_res = NULL;
3341 RGBColor color;
3342 #ifndef GetBackColor
3343 PyMac_PRECHECK(GetBackColor);
3344 #endif
3345 if (!PyArg_ParseTuple(_args, ""))
3346 return NULL;
3347 GetBackColor(&color);
3348 _res = Py_BuildValue("O&",
3349 QdRGB_New, &color);
3350 return _res;
3353 static PyObject *Qd_OpColor(PyObject *_self, PyObject *_args)
3355 PyObject *_res = NULL;
3356 RGBColor color;
3357 #ifndef OpColor
3358 PyMac_PRECHECK(OpColor);
3359 #endif
3360 if (!PyArg_ParseTuple(_args, "O&",
3361 QdRGB_Convert, &color))
3362 return NULL;
3363 OpColor(&color);
3364 Py_INCREF(Py_None);
3365 _res = Py_None;
3366 return _res;
3369 static PyObject *Qd_HiliteColor(PyObject *_self, PyObject *_args)
3371 PyObject *_res = NULL;
3372 RGBColor color;
3373 #ifndef HiliteColor
3374 PyMac_PRECHECK(HiliteColor);
3375 #endif
3376 if (!PyArg_ParseTuple(_args, "O&",
3377 QdRGB_Convert, &color))
3378 return NULL;
3379 HiliteColor(&color);
3380 Py_INCREF(Py_None);
3381 _res = Py_None;
3382 return _res;
3385 static PyObject *Qd_DisposeCTable(PyObject *_self, PyObject *_args)
3387 PyObject *_res = NULL;
3388 CTabHandle cTable;
3389 #ifndef DisposeCTable
3390 PyMac_PRECHECK(DisposeCTable);
3391 #endif
3392 if (!PyArg_ParseTuple(_args, "O&",
3393 ResObj_Convert, &cTable))
3394 return NULL;
3395 DisposeCTable(cTable);
3396 Py_INCREF(Py_None);
3397 _res = Py_None;
3398 return _res;
3401 static PyObject *Qd_GetCTable(PyObject *_self, PyObject *_args)
3403 PyObject *_res = NULL;
3404 CTabHandle _rv;
3405 short ctID;
3406 #ifndef GetCTable
3407 PyMac_PRECHECK(GetCTable);
3408 #endif
3409 if (!PyArg_ParseTuple(_args, "h",
3410 &ctID))
3411 return NULL;
3412 _rv = GetCTable(ctID);
3413 _res = Py_BuildValue("O&",
3414 ResObj_New, _rv);
3415 return _res;
3418 static PyObject *Qd_GetCCursor(PyObject *_self, PyObject *_args)
3420 PyObject *_res = NULL;
3421 CCrsrHandle _rv;
3422 short crsrID;
3423 #ifndef GetCCursor
3424 PyMac_PRECHECK(GetCCursor);
3425 #endif
3426 if (!PyArg_ParseTuple(_args, "h",
3427 &crsrID))
3428 return NULL;
3429 _rv = GetCCursor(crsrID);
3430 _res = Py_BuildValue("O&",
3431 ResObj_New, _rv);
3432 return _res;
3435 static PyObject *Qd_SetCCursor(PyObject *_self, PyObject *_args)
3437 PyObject *_res = NULL;
3438 CCrsrHandle cCrsr;
3439 #ifndef SetCCursor
3440 PyMac_PRECHECK(SetCCursor);
3441 #endif
3442 if (!PyArg_ParseTuple(_args, "O&",
3443 ResObj_Convert, &cCrsr))
3444 return NULL;
3445 SetCCursor(cCrsr);
3446 Py_INCREF(Py_None);
3447 _res = Py_None;
3448 return _res;
3451 static PyObject *Qd_AllocCursor(PyObject *_self, PyObject *_args)
3453 PyObject *_res = NULL;
3454 #ifndef AllocCursor
3455 PyMac_PRECHECK(AllocCursor);
3456 #endif
3457 if (!PyArg_ParseTuple(_args, ""))
3458 return NULL;
3459 AllocCursor();
3460 Py_INCREF(Py_None);
3461 _res = Py_None;
3462 return _res;
3465 static PyObject *Qd_DisposeCCursor(PyObject *_self, PyObject *_args)
3467 PyObject *_res = NULL;
3468 CCrsrHandle cCrsr;
3469 #ifndef DisposeCCursor
3470 PyMac_PRECHECK(DisposeCCursor);
3471 #endif
3472 if (!PyArg_ParseTuple(_args, "O&",
3473 ResObj_Convert, &cCrsr))
3474 return NULL;
3475 DisposeCCursor(cCrsr);
3476 Py_INCREF(Py_None);
3477 _res = Py_None;
3478 return _res;
3481 static PyObject *Qd_GetMaxDevice(PyObject *_self, PyObject *_args)
3483 PyObject *_res = NULL;
3484 GDHandle _rv;
3485 Rect globalRect;
3486 #ifndef GetMaxDevice
3487 PyMac_PRECHECK(GetMaxDevice);
3488 #endif
3489 if (!PyArg_ParseTuple(_args, "O&",
3490 PyMac_GetRect, &globalRect))
3491 return NULL;
3492 _rv = GetMaxDevice(&globalRect);
3493 _res = Py_BuildValue("O&",
3494 ResObj_New, _rv);
3495 return _res;
3498 static PyObject *Qd_GetCTSeed(PyObject *_self, PyObject *_args)
3500 PyObject *_res = NULL;
3501 long _rv;
3502 #ifndef GetCTSeed
3503 PyMac_PRECHECK(GetCTSeed);
3504 #endif
3505 if (!PyArg_ParseTuple(_args, ""))
3506 return NULL;
3507 _rv = GetCTSeed();
3508 _res = Py_BuildValue("l",
3509 _rv);
3510 return _res;
3513 static PyObject *Qd_GetDeviceList(PyObject *_self, PyObject *_args)
3515 PyObject *_res = NULL;
3516 GDHandle _rv;
3517 #ifndef GetDeviceList
3518 PyMac_PRECHECK(GetDeviceList);
3519 #endif
3520 if (!PyArg_ParseTuple(_args, ""))
3521 return NULL;
3522 _rv = GetDeviceList();
3523 _res = Py_BuildValue("O&",
3524 ResObj_New, _rv);
3525 return _res;
3528 static PyObject *Qd_GetMainDevice(PyObject *_self, PyObject *_args)
3530 PyObject *_res = NULL;
3531 GDHandle _rv;
3532 #ifndef GetMainDevice
3533 PyMac_PRECHECK(GetMainDevice);
3534 #endif
3535 if (!PyArg_ParseTuple(_args, ""))
3536 return NULL;
3537 _rv = GetMainDevice();
3538 _res = Py_BuildValue("O&",
3539 ResObj_New, _rv);
3540 return _res;
3543 static PyObject *Qd_GetNextDevice(PyObject *_self, PyObject *_args)
3545 PyObject *_res = NULL;
3546 GDHandle _rv;
3547 GDHandle curDevice;
3548 #ifndef GetNextDevice
3549 PyMac_PRECHECK(GetNextDevice);
3550 #endif
3551 if (!PyArg_ParseTuple(_args, "O&",
3552 ResObj_Convert, &curDevice))
3553 return NULL;
3554 _rv = GetNextDevice(curDevice);
3555 _res = Py_BuildValue("O&",
3556 ResObj_New, _rv);
3557 return _res;
3560 static PyObject *Qd_TestDeviceAttribute(PyObject *_self, PyObject *_args)
3562 PyObject *_res = NULL;
3563 Boolean _rv;
3564 GDHandle gdh;
3565 short attribute;
3566 #ifndef TestDeviceAttribute
3567 PyMac_PRECHECK(TestDeviceAttribute);
3568 #endif
3569 if (!PyArg_ParseTuple(_args, "O&h",
3570 ResObj_Convert, &gdh,
3571 &attribute))
3572 return NULL;
3573 _rv = TestDeviceAttribute(gdh,
3574 attribute);
3575 _res = Py_BuildValue("b",
3576 _rv);
3577 return _res;
3580 static PyObject *Qd_SetDeviceAttribute(PyObject *_self, PyObject *_args)
3582 PyObject *_res = NULL;
3583 GDHandle gdh;
3584 short attribute;
3585 Boolean value;
3586 #ifndef SetDeviceAttribute
3587 PyMac_PRECHECK(SetDeviceAttribute);
3588 #endif
3589 if (!PyArg_ParseTuple(_args, "O&hb",
3590 ResObj_Convert, &gdh,
3591 &attribute,
3592 &value))
3593 return NULL;
3594 SetDeviceAttribute(gdh,
3595 attribute,
3596 value);
3597 Py_INCREF(Py_None);
3598 _res = Py_None;
3599 return _res;
3602 static PyObject *Qd_InitGDevice(PyObject *_self, PyObject *_args)
3604 PyObject *_res = NULL;
3605 short qdRefNum;
3606 long mode;
3607 GDHandle gdh;
3608 #ifndef InitGDevice
3609 PyMac_PRECHECK(InitGDevice);
3610 #endif
3611 if (!PyArg_ParseTuple(_args, "hlO&",
3612 &qdRefNum,
3613 &mode,
3614 ResObj_Convert, &gdh))
3615 return NULL;
3616 InitGDevice(qdRefNum,
3617 mode,
3618 gdh);
3619 Py_INCREF(Py_None);
3620 _res = Py_None;
3621 return _res;
3624 static PyObject *Qd_NewGDevice(PyObject *_self, PyObject *_args)
3626 PyObject *_res = NULL;
3627 GDHandle _rv;
3628 short refNum;
3629 long mode;
3630 #ifndef NewGDevice
3631 PyMac_PRECHECK(NewGDevice);
3632 #endif
3633 if (!PyArg_ParseTuple(_args, "hl",
3634 &refNum,
3635 &mode))
3636 return NULL;
3637 _rv = NewGDevice(refNum,
3638 mode);
3639 _res = Py_BuildValue("O&",
3640 ResObj_New, _rv);
3641 return _res;
3644 static PyObject *Qd_DisposeGDevice(PyObject *_self, PyObject *_args)
3646 PyObject *_res = NULL;
3647 GDHandle gdh;
3648 #ifndef DisposeGDevice
3649 PyMac_PRECHECK(DisposeGDevice);
3650 #endif
3651 if (!PyArg_ParseTuple(_args, "O&",
3652 ResObj_Convert, &gdh))
3653 return NULL;
3654 DisposeGDevice(gdh);
3655 Py_INCREF(Py_None);
3656 _res = Py_None;
3657 return _res;
3660 static PyObject *Qd_SetGDevice(PyObject *_self, PyObject *_args)
3662 PyObject *_res = NULL;
3663 GDHandle gd;
3664 #ifndef SetGDevice
3665 PyMac_PRECHECK(SetGDevice);
3666 #endif
3667 if (!PyArg_ParseTuple(_args, "O&",
3668 ResObj_Convert, &gd))
3669 return NULL;
3670 SetGDevice(gd);
3671 Py_INCREF(Py_None);
3672 _res = Py_None;
3673 return _res;
3676 static PyObject *Qd_GetGDevice(PyObject *_self, PyObject *_args)
3678 PyObject *_res = NULL;
3679 GDHandle _rv;
3680 #ifndef GetGDevice
3681 PyMac_PRECHECK(GetGDevice);
3682 #endif
3683 if (!PyArg_ParseTuple(_args, ""))
3684 return NULL;
3685 _rv = GetGDevice();
3686 _res = Py_BuildValue("O&",
3687 ResObj_New, _rv);
3688 return _res;
3691 static PyObject *Qd_Color2Index(PyObject *_self, PyObject *_args)
3693 PyObject *_res = NULL;
3694 long _rv;
3695 RGBColor myColor;
3696 #ifndef Color2Index
3697 PyMac_PRECHECK(Color2Index);
3698 #endif
3699 if (!PyArg_ParseTuple(_args, "O&",
3700 QdRGB_Convert, &myColor))
3701 return NULL;
3702 _rv = Color2Index(&myColor);
3703 _res = Py_BuildValue("l",
3704 _rv);
3705 return _res;
3708 static PyObject *Qd_Index2Color(PyObject *_self, PyObject *_args)
3710 PyObject *_res = NULL;
3711 long index;
3712 RGBColor aColor;
3713 #ifndef Index2Color
3714 PyMac_PRECHECK(Index2Color);
3715 #endif
3716 if (!PyArg_ParseTuple(_args, "l",
3717 &index))
3718 return NULL;
3719 Index2Color(index,
3720 &aColor);
3721 _res = Py_BuildValue("O&",
3722 QdRGB_New, &aColor);
3723 return _res;
3726 static PyObject *Qd_InvertColor(PyObject *_self, PyObject *_args)
3728 PyObject *_res = NULL;
3729 RGBColor myColor;
3730 #ifndef InvertColor
3731 PyMac_PRECHECK(InvertColor);
3732 #endif
3733 if (!PyArg_ParseTuple(_args, ""))
3734 return NULL;
3735 InvertColor(&myColor);
3736 _res = Py_BuildValue("O&",
3737 QdRGB_New, &myColor);
3738 return _res;
3741 static PyObject *Qd_RealColor(PyObject *_self, PyObject *_args)
3743 PyObject *_res = NULL;
3744 Boolean _rv;
3745 RGBColor color;
3746 #ifndef RealColor
3747 PyMac_PRECHECK(RealColor);
3748 #endif
3749 if (!PyArg_ParseTuple(_args, "O&",
3750 QdRGB_Convert, &color))
3751 return NULL;
3752 _rv = RealColor(&color);
3753 _res = Py_BuildValue("b",
3754 _rv);
3755 return _res;
3758 static PyObject *Qd_GetSubTable(PyObject *_self, PyObject *_args)
3760 PyObject *_res = NULL;
3761 CTabHandle myColors;
3762 short iTabRes;
3763 CTabHandle targetTbl;
3764 #ifndef GetSubTable
3765 PyMac_PRECHECK(GetSubTable);
3766 #endif
3767 if (!PyArg_ParseTuple(_args, "O&hO&",
3768 ResObj_Convert, &myColors,
3769 &iTabRes,
3770 ResObj_Convert, &targetTbl))
3771 return NULL;
3772 GetSubTable(myColors,
3773 iTabRes,
3774 targetTbl);
3775 Py_INCREF(Py_None);
3776 _res = Py_None;
3777 return _res;
3780 static PyObject *Qd_MakeITable(PyObject *_self, PyObject *_args)
3782 PyObject *_res = NULL;
3783 CTabHandle cTabH;
3784 ITabHandle iTabH;
3785 short res;
3786 #ifndef MakeITable
3787 PyMac_PRECHECK(MakeITable);
3788 #endif
3789 if (!PyArg_ParseTuple(_args, "O&O&h",
3790 ResObj_Convert, &cTabH,
3791 ResObj_Convert, &iTabH,
3792 &res))
3793 return NULL;
3794 MakeITable(cTabH,
3795 iTabH,
3796 res);
3797 Py_INCREF(Py_None);
3798 _res = Py_None;
3799 return _res;
3802 static PyObject *Qd_SetClientID(PyObject *_self, PyObject *_args)
3804 PyObject *_res = NULL;
3805 short id;
3806 #ifndef SetClientID
3807 PyMac_PRECHECK(SetClientID);
3808 #endif
3809 if (!PyArg_ParseTuple(_args, "h",
3810 &id))
3811 return NULL;
3812 SetClientID(id);
3813 Py_INCREF(Py_None);
3814 _res = Py_None;
3815 return _res;
3818 static PyObject *Qd_ProtectEntry(PyObject *_self, PyObject *_args)
3820 PyObject *_res = NULL;
3821 short index;
3822 Boolean protect;
3823 #ifndef ProtectEntry
3824 PyMac_PRECHECK(ProtectEntry);
3825 #endif
3826 if (!PyArg_ParseTuple(_args, "hb",
3827 &index,
3828 &protect))
3829 return NULL;
3830 ProtectEntry(index,
3831 protect);
3832 Py_INCREF(Py_None);
3833 _res = Py_None;
3834 return _res;
3837 static PyObject *Qd_ReserveEntry(PyObject *_self, PyObject *_args)
3839 PyObject *_res = NULL;
3840 short index;
3841 Boolean reserve;
3842 #ifndef ReserveEntry
3843 PyMac_PRECHECK(ReserveEntry);
3844 #endif
3845 if (!PyArg_ParseTuple(_args, "hb",
3846 &index,
3847 &reserve))
3848 return NULL;
3849 ReserveEntry(index,
3850 reserve);
3851 Py_INCREF(Py_None);
3852 _res = Py_None;
3853 return _res;
3856 static PyObject *Qd_QDError(PyObject *_self, PyObject *_args)
3858 PyObject *_res = NULL;
3859 short _rv;
3860 #ifndef QDError
3861 PyMac_PRECHECK(QDError);
3862 #endif
3863 if (!PyArg_ParseTuple(_args, ""))
3864 return NULL;
3865 _rv = QDError();
3866 _res = Py_BuildValue("h",
3867 _rv);
3868 return _res;
3871 static PyObject *Qd_CopyDeepMask(PyObject *_self, PyObject *_args)
3873 PyObject *_res = NULL;
3874 BitMapPtr srcBits;
3875 BitMapPtr maskBits;
3876 BitMapPtr dstBits;
3877 Rect srcRect;
3878 Rect maskRect;
3879 Rect dstRect;
3880 short mode;
3881 RgnHandle maskRgn;
3882 #ifndef CopyDeepMask
3883 PyMac_PRECHECK(CopyDeepMask);
3884 #endif
3885 if (!PyArg_ParseTuple(_args, "O&O&O&O&O&O&hO&",
3886 BMObj_Convert, &srcBits,
3887 BMObj_Convert, &maskBits,
3888 BMObj_Convert, &dstBits,
3889 PyMac_GetRect, &srcRect,
3890 PyMac_GetRect, &maskRect,
3891 PyMac_GetRect, &dstRect,
3892 &mode,
3893 OptResObj_Convert, &maskRgn))
3894 return NULL;
3895 CopyDeepMask(srcBits,
3896 maskBits,
3897 dstBits,
3898 &srcRect,
3899 &maskRect,
3900 &dstRect,
3901 mode,
3902 maskRgn);
3903 Py_INCREF(Py_None);
3904 _res = Py_None;
3905 return _res;
3908 static PyObject *Qd_GetPattern(PyObject *_self, PyObject *_args)
3910 PyObject *_res = NULL;
3911 PatHandle _rv;
3912 short patternID;
3913 #ifndef GetPattern
3914 PyMac_PRECHECK(GetPattern);
3915 #endif
3916 if (!PyArg_ParseTuple(_args, "h",
3917 &patternID))
3918 return NULL;
3919 _rv = GetPattern(patternID);
3920 _res = Py_BuildValue("O&",
3921 ResObj_New, _rv);
3922 return _res;
3925 static PyObject *Qd_MacGetCursor(PyObject *_self, PyObject *_args)
3927 PyObject *_res = NULL;
3928 CursHandle _rv;
3929 short cursorID;
3930 #ifndef MacGetCursor
3931 PyMac_PRECHECK(MacGetCursor);
3932 #endif
3933 if (!PyArg_ParseTuple(_args, "h",
3934 &cursorID))
3935 return NULL;
3936 _rv = MacGetCursor(cursorID);
3937 _res = Py_BuildValue("O&",
3938 ResObj_New, _rv);
3939 return _res;
3942 static PyObject *Qd_GetPicture(PyObject *_self, PyObject *_args)
3944 PyObject *_res = NULL;
3945 PicHandle _rv;
3946 short pictureID;
3947 #ifndef GetPicture
3948 PyMac_PRECHECK(GetPicture);
3949 #endif
3950 if (!PyArg_ParseTuple(_args, "h",
3951 &pictureID))
3952 return NULL;
3953 _rv = GetPicture(pictureID);
3954 _res = Py_BuildValue("O&",
3955 ResObj_New, _rv);
3956 return _res;
3959 static PyObject *Qd_DeltaPoint(PyObject *_self, PyObject *_args)
3961 PyObject *_res = NULL;
3962 long _rv;
3963 Point ptA;
3964 Point ptB;
3965 #ifndef DeltaPoint
3966 PyMac_PRECHECK(DeltaPoint);
3967 #endif
3968 if (!PyArg_ParseTuple(_args, "O&O&",
3969 PyMac_GetPoint, &ptA,
3970 PyMac_GetPoint, &ptB))
3971 return NULL;
3972 _rv = DeltaPoint(ptA,
3973 ptB);
3974 _res = Py_BuildValue("l",
3975 _rv);
3976 return _res;
3979 static PyObject *Qd_ShieldCursor(PyObject *_self, PyObject *_args)
3981 PyObject *_res = NULL;
3982 Rect shieldRect;
3983 Point offsetPt;
3984 #ifndef ShieldCursor
3985 PyMac_PRECHECK(ShieldCursor);
3986 #endif
3987 if (!PyArg_ParseTuple(_args, "O&O&",
3988 PyMac_GetRect, &shieldRect,
3989 PyMac_GetPoint, &offsetPt))
3990 return NULL;
3991 ShieldCursor(&shieldRect,
3992 offsetPt);
3993 Py_INCREF(Py_None);
3994 _res = Py_None;
3995 return _res;
3998 static PyObject *Qd_ScreenRes(PyObject *_self, PyObject *_args)
4000 PyObject *_res = NULL;
4001 short scrnHRes;
4002 short scrnVRes;
4003 #ifndef ScreenRes
4004 PyMac_PRECHECK(ScreenRes);
4005 #endif
4006 if (!PyArg_ParseTuple(_args, ""))
4007 return NULL;
4008 ScreenRes(&scrnHRes,
4009 &scrnVRes);
4010 _res = Py_BuildValue("hh",
4011 scrnHRes,
4012 scrnVRes);
4013 return _res;
4016 static PyObject *Qd_GetIndPattern(PyObject *_self, PyObject *_args)
4018 PyObject *_res = NULL;
4019 Pattern thePat__out__;
4020 short patternListID;
4021 short index;
4022 #ifndef GetIndPattern
4023 PyMac_PRECHECK(GetIndPattern);
4024 #endif
4025 if (!PyArg_ParseTuple(_args, "hh",
4026 &patternListID,
4027 &index))
4028 return NULL;
4029 GetIndPattern(&thePat__out__,
4030 patternListID,
4031 index);
4032 _res = Py_BuildValue("s#",
4033 (char *)&thePat__out__, (int)sizeof(Pattern));
4034 return _res;
4037 static PyObject *Qd_SlopeFromAngle(PyObject *_self, PyObject *_args)
4039 PyObject *_res = NULL;
4040 Fixed _rv;
4041 short angle;
4042 #ifndef SlopeFromAngle
4043 PyMac_PRECHECK(SlopeFromAngle);
4044 #endif
4045 if (!PyArg_ParseTuple(_args, "h",
4046 &angle))
4047 return NULL;
4048 _rv = SlopeFromAngle(angle);
4049 _res = Py_BuildValue("O&",
4050 PyMac_BuildFixed, _rv);
4051 return _res;
4054 static PyObject *Qd_AngleFromSlope(PyObject *_self, PyObject *_args)
4056 PyObject *_res = NULL;
4057 short _rv;
4058 Fixed slope;
4059 #ifndef AngleFromSlope
4060 PyMac_PRECHECK(AngleFromSlope);
4061 #endif
4062 if (!PyArg_ParseTuple(_args, "O&",
4063 PyMac_GetFixed, &slope))
4064 return NULL;
4065 _rv = AngleFromSlope(slope);
4066 _res = Py_BuildValue("h",
4067 _rv);
4068 return _res;
4071 #if TARGET_API_MAC_CARBON
4073 static PyObject *Qd_IsValidPort(PyObject *_self, PyObject *_args)
4075 PyObject *_res = NULL;
4076 Boolean _rv;
4077 CGrafPtr port;
4078 #ifndef IsValidPort
4079 PyMac_PRECHECK(IsValidPort);
4080 #endif
4081 if (!PyArg_ParseTuple(_args, "O&",
4082 GrafObj_Convert, &port))
4083 return NULL;
4084 _rv = IsValidPort(port);
4085 _res = Py_BuildValue("b",
4086 _rv);
4087 return _res;
4089 #endif
4091 static PyObject *Qd_GetPortPixMap(PyObject *_self, PyObject *_args)
4093 PyObject *_res = NULL;
4094 PixMapHandle _rv;
4095 CGrafPtr port;
4096 #ifndef GetPortPixMap
4097 PyMac_PRECHECK(GetPortPixMap);
4098 #endif
4099 if (!PyArg_ParseTuple(_args, "O&",
4100 GrafObj_Convert, &port))
4101 return NULL;
4102 _rv = GetPortPixMap(port);
4103 _res = Py_BuildValue("O&",
4104 ResObj_New, _rv);
4105 return _res;
4108 static PyObject *Qd_GetPortBitMapForCopyBits(PyObject *_self, PyObject *_args)
4110 PyObject *_res = NULL;
4111 const BitMap * _rv;
4112 CGrafPtr port;
4113 #ifndef GetPortBitMapForCopyBits
4114 PyMac_PRECHECK(GetPortBitMapForCopyBits);
4115 #endif
4116 if (!PyArg_ParseTuple(_args, "O&",
4117 GrafObj_Convert, &port))
4118 return NULL;
4119 _rv = GetPortBitMapForCopyBits(port);
4120 _res = Py_BuildValue("O&",
4121 BMObj_New, _rv);
4122 return _res;
4125 static PyObject *Qd_GetPortBounds(PyObject *_self, PyObject *_args)
4127 PyObject *_res = NULL;
4128 CGrafPtr port;
4129 Rect rect;
4130 #ifndef GetPortBounds
4131 PyMac_PRECHECK(GetPortBounds);
4132 #endif
4133 if (!PyArg_ParseTuple(_args, "O&",
4134 GrafObj_Convert, &port))
4135 return NULL;
4136 GetPortBounds(port,
4137 &rect);
4138 _res = Py_BuildValue("O&",
4139 PyMac_BuildRect, &rect);
4140 return _res;
4143 static PyObject *Qd_GetPortForeColor(PyObject *_self, PyObject *_args)
4145 PyObject *_res = NULL;
4146 CGrafPtr port;
4147 RGBColor foreColor;
4148 #ifndef GetPortForeColor
4149 PyMac_PRECHECK(GetPortForeColor);
4150 #endif
4151 if (!PyArg_ParseTuple(_args, "O&",
4152 GrafObj_Convert, &port))
4153 return NULL;
4154 GetPortForeColor(port,
4155 &foreColor);
4156 _res = Py_BuildValue("O&",
4157 QdRGB_New, &foreColor);
4158 return _res;
4161 static PyObject *Qd_GetPortBackColor(PyObject *_self, PyObject *_args)
4163 PyObject *_res = NULL;
4164 CGrafPtr port;
4165 RGBColor backColor;
4166 #ifndef GetPortBackColor
4167 PyMac_PRECHECK(GetPortBackColor);
4168 #endif
4169 if (!PyArg_ParseTuple(_args, "O&",
4170 GrafObj_Convert, &port))
4171 return NULL;
4172 GetPortBackColor(port,
4173 &backColor);
4174 _res = Py_BuildValue("O&",
4175 QdRGB_New, &backColor);
4176 return _res;
4179 static PyObject *Qd_GetPortOpColor(PyObject *_self, PyObject *_args)
4181 PyObject *_res = NULL;
4182 CGrafPtr port;
4183 RGBColor opColor;
4184 #ifndef GetPortOpColor
4185 PyMac_PRECHECK(GetPortOpColor);
4186 #endif
4187 if (!PyArg_ParseTuple(_args, "O&",
4188 GrafObj_Convert, &port))
4189 return NULL;
4190 GetPortOpColor(port,
4191 &opColor);
4192 _res = Py_BuildValue("O&",
4193 QdRGB_New, &opColor);
4194 return _res;
4197 static PyObject *Qd_GetPortHiliteColor(PyObject *_self, PyObject *_args)
4199 PyObject *_res = NULL;
4200 CGrafPtr port;
4201 RGBColor hiliteColor;
4202 #ifndef GetPortHiliteColor
4203 PyMac_PRECHECK(GetPortHiliteColor);
4204 #endif
4205 if (!PyArg_ParseTuple(_args, "O&",
4206 GrafObj_Convert, &port))
4207 return NULL;
4208 GetPortHiliteColor(port,
4209 &hiliteColor);
4210 _res = Py_BuildValue("O&",
4211 QdRGB_New, &hiliteColor);
4212 return _res;
4215 static PyObject *Qd_GetPortTextFont(PyObject *_self, PyObject *_args)
4217 PyObject *_res = NULL;
4218 short _rv;
4219 CGrafPtr port;
4220 #ifndef GetPortTextFont
4221 PyMac_PRECHECK(GetPortTextFont);
4222 #endif
4223 if (!PyArg_ParseTuple(_args, "O&",
4224 GrafObj_Convert, &port))
4225 return NULL;
4226 _rv = GetPortTextFont(port);
4227 _res = Py_BuildValue("h",
4228 _rv);
4229 return _res;
4232 static PyObject *Qd_GetPortTextFace(PyObject *_self, PyObject *_args)
4234 PyObject *_res = NULL;
4235 Style _rv;
4236 CGrafPtr port;
4237 #ifndef GetPortTextFace
4238 PyMac_PRECHECK(GetPortTextFace);
4239 #endif
4240 if (!PyArg_ParseTuple(_args, "O&",
4241 GrafObj_Convert, &port))
4242 return NULL;
4243 _rv = GetPortTextFace(port);
4244 _res = Py_BuildValue("b",
4245 _rv);
4246 return _res;
4249 static PyObject *Qd_GetPortTextMode(PyObject *_self, PyObject *_args)
4251 PyObject *_res = NULL;
4252 short _rv;
4253 CGrafPtr port;
4254 #ifndef GetPortTextMode
4255 PyMac_PRECHECK(GetPortTextMode);
4256 #endif
4257 if (!PyArg_ParseTuple(_args, "O&",
4258 GrafObj_Convert, &port))
4259 return NULL;
4260 _rv = GetPortTextMode(port);
4261 _res = Py_BuildValue("h",
4262 _rv);
4263 return _res;
4266 static PyObject *Qd_GetPortTextSize(PyObject *_self, PyObject *_args)
4268 PyObject *_res = NULL;
4269 short _rv;
4270 CGrafPtr port;
4271 #ifndef GetPortTextSize
4272 PyMac_PRECHECK(GetPortTextSize);
4273 #endif
4274 if (!PyArg_ParseTuple(_args, "O&",
4275 GrafObj_Convert, &port))
4276 return NULL;
4277 _rv = GetPortTextSize(port);
4278 _res = Py_BuildValue("h",
4279 _rv);
4280 return _res;
4283 static PyObject *Qd_GetPortChExtra(PyObject *_self, PyObject *_args)
4285 PyObject *_res = NULL;
4286 short _rv;
4287 CGrafPtr port;
4288 #ifndef GetPortChExtra
4289 PyMac_PRECHECK(GetPortChExtra);
4290 #endif
4291 if (!PyArg_ParseTuple(_args, "O&",
4292 GrafObj_Convert, &port))
4293 return NULL;
4294 _rv = GetPortChExtra(port);
4295 _res = Py_BuildValue("h",
4296 _rv);
4297 return _res;
4300 static PyObject *Qd_GetPortFracHPenLocation(PyObject *_self, PyObject *_args)
4302 PyObject *_res = NULL;
4303 short _rv;
4304 CGrafPtr port;
4305 #ifndef GetPortFracHPenLocation
4306 PyMac_PRECHECK(GetPortFracHPenLocation);
4307 #endif
4308 if (!PyArg_ParseTuple(_args, "O&",
4309 GrafObj_Convert, &port))
4310 return NULL;
4311 _rv = GetPortFracHPenLocation(port);
4312 _res = Py_BuildValue("h",
4313 _rv);
4314 return _res;
4317 static PyObject *Qd_GetPortSpExtra(PyObject *_self, PyObject *_args)
4319 PyObject *_res = NULL;
4320 Fixed _rv;
4321 CGrafPtr port;
4322 #ifndef GetPortSpExtra
4323 PyMac_PRECHECK(GetPortSpExtra);
4324 #endif
4325 if (!PyArg_ParseTuple(_args, "O&",
4326 GrafObj_Convert, &port))
4327 return NULL;
4328 _rv = GetPortSpExtra(port);
4329 _res = Py_BuildValue("O&",
4330 PyMac_BuildFixed, _rv);
4331 return _res;
4334 static PyObject *Qd_GetPortPenVisibility(PyObject *_self, PyObject *_args)
4336 PyObject *_res = NULL;
4337 short _rv;
4338 CGrafPtr port;
4339 #ifndef GetPortPenVisibility
4340 PyMac_PRECHECK(GetPortPenVisibility);
4341 #endif
4342 if (!PyArg_ParseTuple(_args, "O&",
4343 GrafObj_Convert, &port))
4344 return NULL;
4345 _rv = GetPortPenVisibility(port);
4346 _res = Py_BuildValue("h",
4347 _rv);
4348 return _res;
4351 static PyObject *Qd_GetPortVisibleRegion(PyObject *_self, PyObject *_args)
4353 PyObject *_res = NULL;
4354 RgnHandle _rv;
4355 CGrafPtr port;
4356 RgnHandle visRgn;
4357 #ifndef GetPortVisibleRegion
4358 PyMac_PRECHECK(GetPortVisibleRegion);
4359 #endif
4360 if (!PyArg_ParseTuple(_args, "O&O&",
4361 GrafObj_Convert, &port,
4362 ResObj_Convert, &visRgn))
4363 return NULL;
4364 _rv = GetPortVisibleRegion(port,
4365 visRgn);
4366 _res = Py_BuildValue("O&",
4367 ResObj_New, _rv);
4368 return _res;
4371 static PyObject *Qd_GetPortClipRegion(PyObject *_self, PyObject *_args)
4373 PyObject *_res = NULL;
4374 RgnHandle _rv;
4375 CGrafPtr port;
4376 RgnHandle clipRgn;
4377 #ifndef GetPortClipRegion
4378 PyMac_PRECHECK(GetPortClipRegion);
4379 #endif
4380 if (!PyArg_ParseTuple(_args, "O&O&",
4381 GrafObj_Convert, &port,
4382 ResObj_Convert, &clipRgn))
4383 return NULL;
4384 _rv = GetPortClipRegion(port,
4385 clipRgn);
4386 _res = Py_BuildValue("O&",
4387 ResObj_New, _rv);
4388 return _res;
4391 static PyObject *Qd_GetPortBackPixPat(PyObject *_self, PyObject *_args)
4393 PyObject *_res = NULL;
4394 PixPatHandle _rv;
4395 CGrafPtr port;
4396 PixPatHandle backPattern;
4397 #ifndef GetPortBackPixPat
4398 PyMac_PRECHECK(GetPortBackPixPat);
4399 #endif
4400 if (!PyArg_ParseTuple(_args, "O&O&",
4401 GrafObj_Convert, &port,
4402 ResObj_Convert, &backPattern))
4403 return NULL;
4404 _rv = GetPortBackPixPat(port,
4405 backPattern);
4406 _res = Py_BuildValue("O&",
4407 ResObj_New, _rv);
4408 return _res;
4411 static PyObject *Qd_GetPortPenPixPat(PyObject *_self, PyObject *_args)
4413 PyObject *_res = NULL;
4414 PixPatHandle _rv;
4415 CGrafPtr port;
4416 PixPatHandle penPattern;
4417 #ifndef GetPortPenPixPat
4418 PyMac_PRECHECK(GetPortPenPixPat);
4419 #endif
4420 if (!PyArg_ParseTuple(_args, "O&O&",
4421 GrafObj_Convert, &port,
4422 ResObj_Convert, &penPattern))
4423 return NULL;
4424 _rv = GetPortPenPixPat(port,
4425 penPattern);
4426 _res = Py_BuildValue("O&",
4427 ResObj_New, _rv);
4428 return _res;
4431 static PyObject *Qd_GetPortFillPixPat(PyObject *_self, PyObject *_args)
4433 PyObject *_res = NULL;
4434 PixPatHandle _rv;
4435 CGrafPtr port;
4436 PixPatHandle fillPattern;
4437 #ifndef GetPortFillPixPat
4438 PyMac_PRECHECK(GetPortFillPixPat);
4439 #endif
4440 if (!PyArg_ParseTuple(_args, "O&O&",
4441 GrafObj_Convert, &port,
4442 ResObj_Convert, &fillPattern))
4443 return NULL;
4444 _rv = GetPortFillPixPat(port,
4445 fillPattern);
4446 _res = Py_BuildValue("O&",
4447 ResObj_New, _rv);
4448 return _res;
4451 static PyObject *Qd_GetPortPenSize(PyObject *_self, PyObject *_args)
4453 PyObject *_res = NULL;
4454 CGrafPtr port;
4455 Point penSize;
4456 #ifndef GetPortPenSize
4457 PyMac_PRECHECK(GetPortPenSize);
4458 #endif
4459 if (!PyArg_ParseTuple(_args, "O&O&",
4460 GrafObj_Convert, &port,
4461 PyMac_GetPoint, &penSize))
4462 return NULL;
4463 GetPortPenSize(port,
4464 &penSize);
4465 _res = Py_BuildValue("O&",
4466 PyMac_BuildPoint, penSize);
4467 return _res;
4470 static PyObject *Qd_GetPortPenMode(PyObject *_self, PyObject *_args)
4472 PyObject *_res = NULL;
4473 SInt32 _rv;
4474 CGrafPtr port;
4475 #ifndef GetPortPenMode
4476 PyMac_PRECHECK(GetPortPenMode);
4477 #endif
4478 if (!PyArg_ParseTuple(_args, "O&",
4479 GrafObj_Convert, &port))
4480 return NULL;
4481 _rv = GetPortPenMode(port);
4482 _res = Py_BuildValue("l",
4483 _rv);
4484 return _res;
4487 static PyObject *Qd_GetPortPenLocation(PyObject *_self, PyObject *_args)
4489 PyObject *_res = NULL;
4490 CGrafPtr port;
4491 Point penLocation;
4492 #ifndef GetPortPenLocation
4493 PyMac_PRECHECK(GetPortPenLocation);
4494 #endif
4495 if (!PyArg_ParseTuple(_args, "O&O&",
4496 GrafObj_Convert, &port,
4497 PyMac_GetPoint, &penLocation))
4498 return NULL;
4499 GetPortPenLocation(port,
4500 &penLocation);
4501 _res = Py_BuildValue("O&",
4502 PyMac_BuildPoint, penLocation);
4503 return _res;
4506 static PyObject *Qd_IsPortRegionBeingDefined(PyObject *_self, PyObject *_args)
4508 PyObject *_res = NULL;
4509 Boolean _rv;
4510 CGrafPtr port;
4511 #ifndef IsPortRegionBeingDefined
4512 PyMac_PRECHECK(IsPortRegionBeingDefined);
4513 #endif
4514 if (!PyArg_ParseTuple(_args, "O&",
4515 GrafObj_Convert, &port))
4516 return NULL;
4517 _rv = IsPortRegionBeingDefined(port);
4518 _res = Py_BuildValue("b",
4519 _rv);
4520 return _res;
4523 static PyObject *Qd_IsPortPictureBeingDefined(PyObject *_self, PyObject *_args)
4525 PyObject *_res = NULL;
4526 Boolean _rv;
4527 CGrafPtr port;
4528 #ifndef IsPortPictureBeingDefined
4529 PyMac_PRECHECK(IsPortPictureBeingDefined);
4530 #endif
4531 if (!PyArg_ParseTuple(_args, "O&",
4532 GrafObj_Convert, &port))
4533 return NULL;
4534 _rv = IsPortPictureBeingDefined(port);
4535 _res = Py_BuildValue("b",
4536 _rv);
4537 return _res;
4540 #if TARGET_API_MAC_CARBON
4542 static PyObject *Qd_IsPortPolyBeingDefined(PyObject *_self, PyObject *_args)
4544 PyObject *_res = NULL;
4545 Boolean _rv;
4546 CGrafPtr port;
4547 #ifndef IsPortPolyBeingDefined
4548 PyMac_PRECHECK(IsPortPolyBeingDefined);
4549 #endif
4550 if (!PyArg_ParseTuple(_args, "O&",
4551 GrafObj_Convert, &port))
4552 return NULL;
4553 _rv = IsPortPolyBeingDefined(port);
4554 _res = Py_BuildValue("b",
4555 _rv);
4556 return _res;
4558 #endif
4560 #if TARGET_API_MAC_CARBON
4562 static PyObject *Qd_IsPortOffscreen(PyObject *_self, PyObject *_args)
4564 PyObject *_res = NULL;
4565 Boolean _rv;
4566 CGrafPtr port;
4567 #ifndef IsPortOffscreen
4568 PyMac_PRECHECK(IsPortOffscreen);
4569 #endif
4570 if (!PyArg_ParseTuple(_args, "O&",
4571 GrafObj_Convert, &port))
4572 return NULL;
4573 _rv = IsPortOffscreen(port);
4574 _res = Py_BuildValue("b",
4575 _rv);
4576 return _res;
4578 #endif
4580 #if TARGET_API_MAC_CARBON
4582 static PyObject *Qd_IsPortColor(PyObject *_self, PyObject *_args)
4584 PyObject *_res = NULL;
4585 Boolean _rv;
4586 CGrafPtr port;
4587 #ifndef IsPortColor
4588 PyMac_PRECHECK(IsPortColor);
4589 #endif
4590 if (!PyArg_ParseTuple(_args, "O&",
4591 GrafObj_Convert, &port))
4592 return NULL;
4593 _rv = IsPortColor(port);
4594 _res = Py_BuildValue("b",
4595 _rv);
4596 return _res;
4598 #endif
4600 static PyObject *Qd_SetPortBounds(PyObject *_self, PyObject *_args)
4602 PyObject *_res = NULL;
4603 CGrafPtr port;
4604 Rect rect;
4605 #ifndef SetPortBounds
4606 PyMac_PRECHECK(SetPortBounds);
4607 #endif
4608 if (!PyArg_ParseTuple(_args, "O&O&",
4609 GrafObj_Convert, &port,
4610 PyMac_GetRect, &rect))
4611 return NULL;
4612 SetPortBounds(port,
4613 &rect);
4614 Py_INCREF(Py_None);
4615 _res = Py_None;
4616 return _res;
4619 static PyObject *Qd_SetPortOpColor(PyObject *_self, PyObject *_args)
4621 PyObject *_res = NULL;
4622 CGrafPtr port;
4623 RGBColor opColor;
4624 #ifndef SetPortOpColor
4625 PyMac_PRECHECK(SetPortOpColor);
4626 #endif
4627 if (!PyArg_ParseTuple(_args, "O&O&",
4628 GrafObj_Convert, &port,
4629 QdRGB_Convert, &opColor))
4630 return NULL;
4631 SetPortOpColor(port,
4632 &opColor);
4633 Py_INCREF(Py_None);
4634 _res = Py_None;
4635 return _res;
4638 static PyObject *Qd_SetPortVisibleRegion(PyObject *_self, PyObject *_args)
4640 PyObject *_res = NULL;
4641 CGrafPtr port;
4642 RgnHandle visRgn;
4643 #ifndef SetPortVisibleRegion
4644 PyMac_PRECHECK(SetPortVisibleRegion);
4645 #endif
4646 if (!PyArg_ParseTuple(_args, "O&O&",
4647 GrafObj_Convert, &port,
4648 ResObj_Convert, &visRgn))
4649 return NULL;
4650 SetPortVisibleRegion(port,
4651 visRgn);
4652 Py_INCREF(Py_None);
4653 _res = Py_None;
4654 return _res;
4657 static PyObject *Qd_SetPortClipRegion(PyObject *_self, PyObject *_args)
4659 PyObject *_res = NULL;
4660 CGrafPtr port;
4661 RgnHandle clipRgn;
4662 #ifndef SetPortClipRegion
4663 PyMac_PRECHECK(SetPortClipRegion);
4664 #endif
4665 if (!PyArg_ParseTuple(_args, "O&O&",
4666 GrafObj_Convert, &port,
4667 ResObj_Convert, &clipRgn))
4668 return NULL;
4669 SetPortClipRegion(port,
4670 clipRgn);
4671 Py_INCREF(Py_None);
4672 _res = Py_None;
4673 return _res;
4676 static PyObject *Qd_SetPortPenPixPat(PyObject *_self, PyObject *_args)
4678 PyObject *_res = NULL;
4679 CGrafPtr port;
4680 PixPatHandle penPattern;
4681 #ifndef SetPortPenPixPat
4682 PyMac_PRECHECK(SetPortPenPixPat);
4683 #endif
4684 if (!PyArg_ParseTuple(_args, "O&O&",
4685 GrafObj_Convert, &port,
4686 ResObj_Convert, &penPattern))
4687 return NULL;
4688 SetPortPenPixPat(port,
4689 penPattern);
4690 Py_INCREF(Py_None);
4691 _res = Py_None;
4692 return _res;
4695 static PyObject *Qd_SetPortFillPixPat(PyObject *_self, PyObject *_args)
4697 PyObject *_res = NULL;
4698 CGrafPtr port;
4699 PixPatHandle penPattern;
4700 #ifndef SetPortFillPixPat
4701 PyMac_PRECHECK(SetPortFillPixPat);
4702 #endif
4703 if (!PyArg_ParseTuple(_args, "O&O&",
4704 GrafObj_Convert, &port,
4705 ResObj_Convert, &penPattern))
4706 return NULL;
4707 SetPortFillPixPat(port,
4708 penPattern);
4709 Py_INCREF(Py_None);
4710 _res = Py_None;
4711 return _res;
4714 static PyObject *Qd_SetPortBackPixPat(PyObject *_self, PyObject *_args)
4716 PyObject *_res = NULL;
4717 CGrafPtr port;
4718 PixPatHandle backPattern;
4719 #ifndef SetPortBackPixPat
4720 PyMac_PRECHECK(SetPortBackPixPat);
4721 #endif
4722 if (!PyArg_ParseTuple(_args, "O&O&",
4723 GrafObj_Convert, &port,
4724 ResObj_Convert, &backPattern))
4725 return NULL;
4726 SetPortBackPixPat(port,
4727 backPattern);
4728 Py_INCREF(Py_None);
4729 _res = Py_None;
4730 return _res;
4733 static PyObject *Qd_SetPortPenSize(PyObject *_self, PyObject *_args)
4735 PyObject *_res = NULL;
4736 CGrafPtr port;
4737 Point penSize;
4738 #ifndef SetPortPenSize
4739 PyMac_PRECHECK(SetPortPenSize);
4740 #endif
4741 if (!PyArg_ParseTuple(_args, "O&O&",
4742 GrafObj_Convert, &port,
4743 PyMac_GetPoint, &penSize))
4744 return NULL;
4745 SetPortPenSize(port,
4746 penSize);
4747 Py_INCREF(Py_None);
4748 _res = Py_None;
4749 return _res;
4752 static PyObject *Qd_SetPortPenMode(PyObject *_self, PyObject *_args)
4754 PyObject *_res = NULL;
4755 CGrafPtr port;
4756 SInt32 penMode;
4757 #ifndef SetPortPenMode
4758 PyMac_PRECHECK(SetPortPenMode);
4759 #endif
4760 if (!PyArg_ParseTuple(_args, "O&l",
4761 GrafObj_Convert, &port,
4762 &penMode))
4763 return NULL;
4764 SetPortPenMode(port,
4765 penMode);
4766 Py_INCREF(Py_None);
4767 _res = Py_None;
4768 return _res;
4771 static PyObject *Qd_SetPortFracHPenLocation(PyObject *_self, PyObject *_args)
4773 PyObject *_res = NULL;
4774 CGrafPtr port;
4775 short pnLocHFrac;
4776 #ifndef SetPortFracHPenLocation
4777 PyMac_PRECHECK(SetPortFracHPenLocation);
4778 #endif
4779 if (!PyArg_ParseTuple(_args, "O&h",
4780 GrafObj_Convert, &port,
4781 &pnLocHFrac))
4782 return NULL;
4783 SetPortFracHPenLocation(port,
4784 pnLocHFrac);
4785 Py_INCREF(Py_None);
4786 _res = Py_None;
4787 return _res;
4790 static PyObject *Qd_GetPixBounds(PyObject *_self, PyObject *_args)
4792 PyObject *_res = NULL;
4793 PixMapHandle pixMap;
4794 Rect bounds;
4795 #ifndef GetPixBounds
4796 PyMac_PRECHECK(GetPixBounds);
4797 #endif
4798 if (!PyArg_ParseTuple(_args, "O&",
4799 ResObj_Convert, &pixMap))
4800 return NULL;
4801 GetPixBounds(pixMap,
4802 &bounds);
4803 _res = Py_BuildValue("O&",
4804 PyMac_BuildRect, &bounds);
4805 return _res;
4808 static PyObject *Qd_GetPixDepth(PyObject *_self, PyObject *_args)
4810 PyObject *_res = NULL;
4811 short _rv;
4812 PixMapHandle pixMap;
4813 #ifndef GetPixDepth
4814 PyMac_PRECHECK(GetPixDepth);
4815 #endif
4816 if (!PyArg_ParseTuple(_args, "O&",
4817 ResObj_Convert, &pixMap))
4818 return NULL;
4819 _rv = GetPixDepth(pixMap);
4820 _res = Py_BuildValue("h",
4821 _rv);
4822 return _res;
4825 static PyObject *Qd_GetQDGlobalsRandomSeed(PyObject *_self, PyObject *_args)
4827 PyObject *_res = NULL;
4828 long _rv;
4829 #ifndef GetQDGlobalsRandomSeed
4830 PyMac_PRECHECK(GetQDGlobalsRandomSeed);
4831 #endif
4832 if (!PyArg_ParseTuple(_args, ""))
4833 return NULL;
4834 _rv = GetQDGlobalsRandomSeed();
4835 _res = Py_BuildValue("l",
4836 _rv);
4837 return _res;
4840 static PyObject *Qd_GetQDGlobalsScreenBits(PyObject *_self, PyObject *_args)
4842 PyObject *_res = NULL;
4843 BitMap screenBits;
4844 #ifndef GetQDGlobalsScreenBits
4845 PyMac_PRECHECK(GetQDGlobalsScreenBits);
4846 #endif
4847 if (!PyArg_ParseTuple(_args, ""))
4848 return NULL;
4849 GetQDGlobalsScreenBits(&screenBits);
4850 _res = Py_BuildValue("O&",
4851 BMObj_NewCopied, &screenBits);
4852 return _res;
4855 static PyObject *Qd_GetQDGlobalsArrow(PyObject *_self, PyObject *_args)
4857 PyObject *_res = NULL;
4858 Cursor arrow__out__;
4859 #ifndef GetQDGlobalsArrow
4860 PyMac_PRECHECK(GetQDGlobalsArrow);
4861 #endif
4862 if (!PyArg_ParseTuple(_args, ""))
4863 return NULL;
4864 GetQDGlobalsArrow(&arrow__out__);
4865 _res = Py_BuildValue("s#",
4866 (char *)&arrow__out__, (int)sizeof(Cursor));
4867 return _res;
4870 static PyObject *Qd_GetQDGlobalsDarkGray(PyObject *_self, PyObject *_args)
4872 PyObject *_res = NULL;
4873 Pattern dkGray__out__;
4874 #ifndef GetQDGlobalsDarkGray
4875 PyMac_PRECHECK(GetQDGlobalsDarkGray);
4876 #endif
4877 if (!PyArg_ParseTuple(_args, ""))
4878 return NULL;
4879 GetQDGlobalsDarkGray(&dkGray__out__);
4880 _res = Py_BuildValue("s#",
4881 (char *)&dkGray__out__, (int)sizeof(Pattern));
4882 return _res;
4885 static PyObject *Qd_GetQDGlobalsLightGray(PyObject *_self, PyObject *_args)
4887 PyObject *_res = NULL;
4888 Pattern ltGray__out__;
4889 #ifndef GetQDGlobalsLightGray
4890 PyMac_PRECHECK(GetQDGlobalsLightGray);
4891 #endif
4892 if (!PyArg_ParseTuple(_args, ""))
4893 return NULL;
4894 GetQDGlobalsLightGray(&ltGray__out__);
4895 _res = Py_BuildValue("s#",
4896 (char *)&ltGray__out__, (int)sizeof(Pattern));
4897 return _res;
4900 static PyObject *Qd_GetQDGlobalsGray(PyObject *_self, PyObject *_args)
4902 PyObject *_res = NULL;
4903 Pattern gray__out__;
4904 #ifndef GetQDGlobalsGray
4905 PyMac_PRECHECK(GetQDGlobalsGray);
4906 #endif
4907 if (!PyArg_ParseTuple(_args, ""))
4908 return NULL;
4909 GetQDGlobalsGray(&gray__out__);
4910 _res = Py_BuildValue("s#",
4911 (char *)&gray__out__, (int)sizeof(Pattern));
4912 return _res;
4915 static PyObject *Qd_GetQDGlobalsBlack(PyObject *_self, PyObject *_args)
4917 PyObject *_res = NULL;
4918 Pattern black__out__;
4919 #ifndef GetQDGlobalsBlack
4920 PyMac_PRECHECK(GetQDGlobalsBlack);
4921 #endif
4922 if (!PyArg_ParseTuple(_args, ""))
4923 return NULL;
4924 GetQDGlobalsBlack(&black__out__);
4925 _res = Py_BuildValue("s#",
4926 (char *)&black__out__, (int)sizeof(Pattern));
4927 return _res;
4930 static PyObject *Qd_GetQDGlobalsWhite(PyObject *_self, PyObject *_args)
4932 PyObject *_res = NULL;
4933 Pattern white__out__;
4934 #ifndef GetQDGlobalsWhite
4935 PyMac_PRECHECK(GetQDGlobalsWhite);
4936 #endif
4937 if (!PyArg_ParseTuple(_args, ""))
4938 return NULL;
4939 GetQDGlobalsWhite(&white__out__);
4940 _res = Py_BuildValue("s#",
4941 (char *)&white__out__, (int)sizeof(Pattern));
4942 return _res;
4945 static PyObject *Qd_GetQDGlobalsThePort(PyObject *_self, PyObject *_args)
4947 PyObject *_res = NULL;
4948 CGrafPtr _rv;
4949 #ifndef GetQDGlobalsThePort
4950 PyMac_PRECHECK(GetQDGlobalsThePort);
4951 #endif
4952 if (!PyArg_ParseTuple(_args, ""))
4953 return NULL;
4954 _rv = GetQDGlobalsThePort();
4955 _res = Py_BuildValue("O&",
4956 GrafObj_New, _rv);
4957 return _res;
4960 static PyObject *Qd_SetQDGlobalsRandomSeed(PyObject *_self, PyObject *_args)
4962 PyObject *_res = NULL;
4963 long randomSeed;
4964 #ifndef SetQDGlobalsRandomSeed
4965 PyMac_PRECHECK(SetQDGlobalsRandomSeed);
4966 #endif
4967 if (!PyArg_ParseTuple(_args, "l",
4968 &randomSeed))
4969 return NULL;
4970 SetQDGlobalsRandomSeed(randomSeed);
4971 Py_INCREF(Py_None);
4972 _res = Py_None;
4973 return _res;
4976 static PyObject *Qd_SetQDGlobalsArrow(PyObject *_self, PyObject *_args)
4978 PyObject *_res = NULL;
4979 Cursor *arrow__in__;
4980 int arrow__in_len__;
4981 #ifndef SetQDGlobalsArrow
4982 PyMac_PRECHECK(SetQDGlobalsArrow);
4983 #endif
4984 if (!PyArg_ParseTuple(_args, "s#",
4985 (char **)&arrow__in__, &arrow__in_len__))
4986 return NULL;
4987 if (arrow__in_len__ != sizeof(Cursor))
4989 PyErr_SetString(PyExc_TypeError, "buffer length should be sizeof(Cursor)");
4990 goto arrow__error__;
4992 SetQDGlobalsArrow(arrow__in__);
4993 Py_INCREF(Py_None);
4994 _res = Py_None;
4995 arrow__error__: ;
4996 return _res;
4999 static PyObject *Qd_GetRegionBounds(PyObject *_self, PyObject *_args)
5001 PyObject *_res = NULL;
5002 RgnHandle region;
5003 Rect bounds;
5004 #ifndef GetRegionBounds
5005 PyMac_PRECHECK(GetRegionBounds);
5006 #endif
5007 if (!PyArg_ParseTuple(_args, "O&",
5008 ResObj_Convert, &region))
5009 return NULL;
5010 GetRegionBounds(region,
5011 &bounds);
5012 _res = Py_BuildValue("O&",
5013 PyMac_BuildRect, &bounds);
5014 return _res;
5017 #if TARGET_API_MAC_CARBON
5019 static PyObject *Qd_IsRegionRectangular(PyObject *_self, PyObject *_args)
5021 PyObject *_res = NULL;
5022 Boolean _rv;
5023 RgnHandle region;
5024 #ifndef IsRegionRectangular
5025 PyMac_PRECHECK(IsRegionRectangular);
5026 #endif
5027 if (!PyArg_ParseTuple(_args, "O&",
5028 ResObj_Convert, &region))
5029 return NULL;
5030 _rv = IsRegionRectangular(region);
5031 _res = Py_BuildValue("b",
5032 _rv);
5033 return _res;
5035 #endif
5037 #if TARGET_API_MAC_CARBON
5039 static PyObject *Qd_CreateNewPort(PyObject *_self, PyObject *_args)
5041 PyObject *_res = NULL;
5042 CGrafPtr _rv;
5043 #ifndef CreateNewPort
5044 PyMac_PRECHECK(CreateNewPort);
5045 #endif
5046 if (!PyArg_ParseTuple(_args, ""))
5047 return NULL;
5048 _rv = CreateNewPort();
5049 _res = Py_BuildValue("O&",
5050 GrafObj_New, _rv);
5051 return _res;
5053 #endif
5055 #if TARGET_API_MAC_CARBON
5057 static PyObject *Qd_DisposePort(PyObject *_self, PyObject *_args)
5059 PyObject *_res = NULL;
5060 CGrafPtr port;
5061 #ifndef DisposePort
5062 PyMac_PRECHECK(DisposePort);
5063 #endif
5064 if (!PyArg_ParseTuple(_args, "O&",
5065 GrafObj_Convert, &port))
5066 return NULL;
5067 DisposePort(port);
5068 Py_INCREF(Py_None);
5069 _res = Py_None;
5070 return _res;
5072 #endif
5074 #if TARGET_API_MAC_CARBON
5076 static PyObject *Qd_SetQDError(PyObject *_self, PyObject *_args)
5078 PyObject *_res = NULL;
5079 OSErr err;
5080 #ifndef SetQDError
5081 PyMac_PRECHECK(SetQDError);
5082 #endif
5083 if (!PyArg_ParseTuple(_args, "h",
5084 &err))
5085 return NULL;
5086 SetQDError(err);
5087 Py_INCREF(Py_None);
5088 _res = Py_None;
5089 return _res;
5091 #endif
5093 static PyObject *Qd_QDIsPortBuffered(PyObject *_self, PyObject *_args)
5095 PyObject *_res = NULL;
5096 Boolean _rv;
5097 CGrafPtr port;
5098 #ifndef QDIsPortBuffered
5099 PyMac_PRECHECK(QDIsPortBuffered);
5100 #endif
5101 if (!PyArg_ParseTuple(_args, "O&",
5102 GrafObj_Convert, &port))
5103 return NULL;
5104 _rv = QDIsPortBuffered(port);
5105 _res = Py_BuildValue("b",
5106 _rv);
5107 return _res;
5110 static PyObject *Qd_QDIsPortBufferDirty(PyObject *_self, PyObject *_args)
5112 PyObject *_res = NULL;
5113 Boolean _rv;
5114 CGrafPtr port;
5115 #ifndef QDIsPortBufferDirty
5116 PyMac_PRECHECK(QDIsPortBufferDirty);
5117 #endif
5118 if (!PyArg_ParseTuple(_args, "O&",
5119 GrafObj_Convert, &port))
5120 return NULL;
5121 _rv = QDIsPortBufferDirty(port);
5122 _res = Py_BuildValue("b",
5123 _rv);
5124 return _res;
5127 static PyObject *Qd_QDFlushPortBuffer(PyObject *_self, PyObject *_args)
5129 PyObject *_res = NULL;
5130 CGrafPtr port;
5131 RgnHandle region;
5132 #ifndef QDFlushPortBuffer
5133 PyMac_PRECHECK(QDFlushPortBuffer);
5134 #endif
5135 if (!PyArg_ParseTuple(_args, "O&O&",
5136 GrafObj_Convert, &port,
5137 OptResObj_Convert, &region))
5138 return NULL;
5139 QDFlushPortBuffer(port,
5140 region);
5141 Py_INCREF(Py_None);
5142 _res = Py_None;
5143 return _res;
5146 #if TARGET_API_MAC_CARBON
5148 static PyObject *Qd_QDGetDirtyRegion(PyObject *_self, PyObject *_args)
5150 PyObject *_res = NULL;
5151 OSStatus _err;
5152 CGrafPtr port;
5153 RgnHandle rgn;
5154 #ifndef QDGetDirtyRegion
5155 PyMac_PRECHECK(QDGetDirtyRegion);
5156 #endif
5157 if (!PyArg_ParseTuple(_args, "O&O&",
5158 GrafObj_Convert, &port,
5159 ResObj_Convert, &rgn))
5160 return NULL;
5161 _err = QDGetDirtyRegion(port,
5162 rgn);
5163 if (_err != noErr) return PyMac_Error(_err);
5164 Py_INCREF(Py_None);
5165 _res = Py_None;
5166 return _res;
5168 #endif
5170 #if TARGET_API_MAC_CARBON
5172 static PyObject *Qd_QDSetDirtyRegion(PyObject *_self, PyObject *_args)
5174 PyObject *_res = NULL;
5175 OSStatus _err;
5176 CGrafPtr port;
5177 RgnHandle rgn;
5178 #ifndef QDSetDirtyRegion
5179 PyMac_PRECHECK(QDSetDirtyRegion);
5180 #endif
5181 if (!PyArg_ParseTuple(_args, "O&O&",
5182 GrafObj_Convert, &port,
5183 ResObj_Convert, &rgn))
5184 return NULL;
5185 _err = QDSetDirtyRegion(port,
5186 rgn);
5187 if (_err != noErr) return PyMac_Error(_err);
5188 Py_INCREF(Py_None);
5189 _res = Py_None;
5190 return _res;
5192 #endif
5194 static PyObject *Qd_LMGetScrVRes(PyObject *_self, PyObject *_args)
5196 PyObject *_res = NULL;
5197 SInt16 _rv;
5198 #ifndef LMGetScrVRes
5199 PyMac_PRECHECK(LMGetScrVRes);
5200 #endif
5201 if (!PyArg_ParseTuple(_args, ""))
5202 return NULL;
5203 _rv = LMGetScrVRes();
5204 _res = Py_BuildValue("h",
5205 _rv);
5206 return _res;
5209 static PyObject *Qd_LMSetScrVRes(PyObject *_self, PyObject *_args)
5211 PyObject *_res = NULL;
5212 SInt16 value;
5213 #ifndef LMSetScrVRes
5214 PyMac_PRECHECK(LMSetScrVRes);
5215 #endif
5216 if (!PyArg_ParseTuple(_args, "h",
5217 &value))
5218 return NULL;
5219 LMSetScrVRes(value);
5220 Py_INCREF(Py_None);
5221 _res = Py_None;
5222 return _res;
5225 static PyObject *Qd_LMGetScrHRes(PyObject *_self, PyObject *_args)
5227 PyObject *_res = NULL;
5228 SInt16 _rv;
5229 #ifndef LMGetScrHRes
5230 PyMac_PRECHECK(LMGetScrHRes);
5231 #endif
5232 if (!PyArg_ParseTuple(_args, ""))
5233 return NULL;
5234 _rv = LMGetScrHRes();
5235 _res = Py_BuildValue("h",
5236 _rv);
5237 return _res;
5240 static PyObject *Qd_LMSetScrHRes(PyObject *_self, PyObject *_args)
5242 PyObject *_res = NULL;
5243 SInt16 value;
5244 #ifndef LMSetScrHRes
5245 PyMac_PRECHECK(LMSetScrHRes);
5246 #endif
5247 if (!PyArg_ParseTuple(_args, "h",
5248 &value))
5249 return NULL;
5250 LMSetScrHRes(value);
5251 Py_INCREF(Py_None);
5252 _res = Py_None;
5253 return _res;
5256 static PyObject *Qd_LMGetMainDevice(PyObject *_self, PyObject *_args)
5258 PyObject *_res = NULL;
5259 GDHandle _rv;
5260 #ifndef LMGetMainDevice
5261 PyMac_PRECHECK(LMGetMainDevice);
5262 #endif
5263 if (!PyArg_ParseTuple(_args, ""))
5264 return NULL;
5265 _rv = LMGetMainDevice();
5266 _res = Py_BuildValue("O&",
5267 ResObj_New, _rv);
5268 return _res;
5271 static PyObject *Qd_LMSetMainDevice(PyObject *_self, PyObject *_args)
5273 PyObject *_res = NULL;
5274 GDHandle value;
5275 #ifndef LMSetMainDevice
5276 PyMac_PRECHECK(LMSetMainDevice);
5277 #endif
5278 if (!PyArg_ParseTuple(_args, "O&",
5279 ResObj_Convert, &value))
5280 return NULL;
5281 LMSetMainDevice(value);
5282 Py_INCREF(Py_None);
5283 _res = Py_None;
5284 return _res;
5287 static PyObject *Qd_LMGetDeviceList(PyObject *_self, PyObject *_args)
5289 PyObject *_res = NULL;
5290 GDHandle _rv;
5291 #ifndef LMGetDeviceList
5292 PyMac_PRECHECK(LMGetDeviceList);
5293 #endif
5294 if (!PyArg_ParseTuple(_args, ""))
5295 return NULL;
5296 _rv = LMGetDeviceList();
5297 _res = Py_BuildValue("O&",
5298 ResObj_New, _rv);
5299 return _res;
5302 static PyObject *Qd_LMSetDeviceList(PyObject *_self, PyObject *_args)
5304 PyObject *_res = NULL;
5305 GDHandle value;
5306 #ifndef LMSetDeviceList
5307 PyMac_PRECHECK(LMSetDeviceList);
5308 #endif
5309 if (!PyArg_ParseTuple(_args, "O&",
5310 ResObj_Convert, &value))
5311 return NULL;
5312 LMSetDeviceList(value);
5313 Py_INCREF(Py_None);
5314 _res = Py_None;
5315 return _res;
5318 static PyObject *Qd_LMGetQDColors(PyObject *_self, PyObject *_args)
5320 PyObject *_res = NULL;
5321 Handle _rv;
5322 #ifndef LMGetQDColors
5323 PyMac_PRECHECK(LMGetQDColors);
5324 #endif
5325 if (!PyArg_ParseTuple(_args, ""))
5326 return NULL;
5327 _rv = LMGetQDColors();
5328 _res = Py_BuildValue("O&",
5329 ResObj_New, _rv);
5330 return _res;
5333 static PyObject *Qd_LMSetQDColors(PyObject *_self, PyObject *_args)
5335 PyObject *_res = NULL;
5336 Handle value;
5337 #ifndef LMSetQDColors
5338 PyMac_PRECHECK(LMSetQDColors);
5339 #endif
5340 if (!PyArg_ParseTuple(_args, "O&",
5341 ResObj_Convert, &value))
5342 return NULL;
5343 LMSetQDColors(value);
5344 Py_INCREF(Py_None);
5345 _res = Py_None;
5346 return _res;
5349 static PyObject *Qd_LMGetWidthListHand(PyObject *_self, PyObject *_args)
5351 PyObject *_res = NULL;
5352 Handle _rv;
5353 #ifndef LMGetWidthListHand
5354 PyMac_PRECHECK(LMGetWidthListHand);
5355 #endif
5356 if (!PyArg_ParseTuple(_args, ""))
5357 return NULL;
5358 _rv = LMGetWidthListHand();
5359 _res = Py_BuildValue("O&",
5360 ResObj_New, _rv);
5361 return _res;
5364 static PyObject *Qd_LMSetWidthListHand(PyObject *_self, PyObject *_args)
5366 PyObject *_res = NULL;
5367 Handle value;
5368 #ifndef LMSetWidthListHand
5369 PyMac_PRECHECK(LMSetWidthListHand);
5370 #endif
5371 if (!PyArg_ParseTuple(_args, "O&",
5372 ResObj_Convert, &value))
5373 return NULL;
5374 LMSetWidthListHand(value);
5375 Py_INCREF(Py_None);
5376 _res = Py_None;
5377 return _res;
5380 static PyObject *Qd_LMGetHiliteMode(PyObject *_self, PyObject *_args)
5382 PyObject *_res = NULL;
5383 UInt8 _rv;
5384 #ifndef LMGetHiliteMode
5385 PyMac_PRECHECK(LMGetHiliteMode);
5386 #endif
5387 if (!PyArg_ParseTuple(_args, ""))
5388 return NULL;
5389 _rv = LMGetHiliteMode();
5390 _res = Py_BuildValue("b",
5391 _rv);
5392 return _res;
5395 static PyObject *Qd_LMSetHiliteMode(PyObject *_self, PyObject *_args)
5397 PyObject *_res = NULL;
5398 UInt8 value;
5399 #ifndef LMSetHiliteMode
5400 PyMac_PRECHECK(LMSetHiliteMode);
5401 #endif
5402 if (!PyArg_ParseTuple(_args, "b",
5403 &value))
5404 return NULL;
5405 LMSetHiliteMode(value);
5406 Py_INCREF(Py_None);
5407 _res = Py_None;
5408 return _res;
5411 static PyObject *Qd_LMGetWidthTabHandle(PyObject *_self, PyObject *_args)
5413 PyObject *_res = NULL;
5414 Handle _rv;
5415 #ifndef LMGetWidthTabHandle
5416 PyMac_PRECHECK(LMGetWidthTabHandle);
5417 #endif
5418 if (!PyArg_ParseTuple(_args, ""))
5419 return NULL;
5420 _rv = LMGetWidthTabHandle();
5421 _res = Py_BuildValue("O&",
5422 ResObj_New, _rv);
5423 return _res;
5426 static PyObject *Qd_LMSetWidthTabHandle(PyObject *_self, PyObject *_args)
5428 PyObject *_res = NULL;
5429 Handle value;
5430 #ifndef LMSetWidthTabHandle
5431 PyMac_PRECHECK(LMSetWidthTabHandle);
5432 #endif
5433 if (!PyArg_ParseTuple(_args, "O&",
5434 ResObj_Convert, &value))
5435 return NULL;
5436 LMSetWidthTabHandle(value);
5437 Py_INCREF(Py_None);
5438 _res = Py_None;
5439 return _res;
5442 static PyObject *Qd_LMGetLastSPExtra(PyObject *_self, PyObject *_args)
5444 PyObject *_res = NULL;
5445 SInt32 _rv;
5446 #ifndef LMGetLastSPExtra
5447 PyMac_PRECHECK(LMGetLastSPExtra);
5448 #endif
5449 if (!PyArg_ParseTuple(_args, ""))
5450 return NULL;
5451 _rv = LMGetLastSPExtra();
5452 _res = Py_BuildValue("l",
5453 _rv);
5454 return _res;
5457 static PyObject *Qd_LMSetLastSPExtra(PyObject *_self, PyObject *_args)
5459 PyObject *_res = NULL;
5460 SInt32 value;
5461 #ifndef LMSetLastSPExtra
5462 PyMac_PRECHECK(LMSetLastSPExtra);
5463 #endif
5464 if (!PyArg_ParseTuple(_args, "l",
5465 &value))
5466 return NULL;
5467 LMSetLastSPExtra(value);
5468 Py_INCREF(Py_None);
5469 _res = Py_None;
5470 return _res;
5473 static PyObject *Qd_LMGetLastFOND(PyObject *_self, PyObject *_args)
5475 PyObject *_res = NULL;
5476 Handle _rv;
5477 #ifndef LMGetLastFOND
5478 PyMac_PRECHECK(LMGetLastFOND);
5479 #endif
5480 if (!PyArg_ParseTuple(_args, ""))
5481 return NULL;
5482 _rv = LMGetLastFOND();
5483 _res = Py_BuildValue("O&",
5484 ResObj_New, _rv);
5485 return _res;
5488 static PyObject *Qd_LMSetLastFOND(PyObject *_self, PyObject *_args)
5490 PyObject *_res = NULL;
5491 Handle value;
5492 #ifndef LMSetLastFOND
5493 PyMac_PRECHECK(LMSetLastFOND);
5494 #endif
5495 if (!PyArg_ParseTuple(_args, "O&",
5496 ResObj_Convert, &value))
5497 return NULL;
5498 LMSetLastFOND(value);
5499 Py_INCREF(Py_None);
5500 _res = Py_None;
5501 return _res;
5504 static PyObject *Qd_LMGetFractEnable(PyObject *_self, PyObject *_args)
5506 PyObject *_res = NULL;
5507 UInt8 _rv;
5508 #ifndef LMGetFractEnable
5509 PyMac_PRECHECK(LMGetFractEnable);
5510 #endif
5511 if (!PyArg_ParseTuple(_args, ""))
5512 return NULL;
5513 _rv = LMGetFractEnable();
5514 _res = Py_BuildValue("b",
5515 _rv);
5516 return _res;
5519 static PyObject *Qd_LMSetFractEnable(PyObject *_self, PyObject *_args)
5521 PyObject *_res = NULL;
5522 UInt8 value;
5523 #ifndef LMSetFractEnable
5524 PyMac_PRECHECK(LMSetFractEnable);
5525 #endif
5526 if (!PyArg_ParseTuple(_args, "b",
5527 &value))
5528 return NULL;
5529 LMSetFractEnable(value);
5530 Py_INCREF(Py_None);
5531 _res = Py_None;
5532 return _res;
5535 static PyObject *Qd_LMGetTheGDevice(PyObject *_self, PyObject *_args)
5537 PyObject *_res = NULL;
5538 GDHandle _rv;
5539 #ifndef LMGetTheGDevice
5540 PyMac_PRECHECK(LMGetTheGDevice);
5541 #endif
5542 if (!PyArg_ParseTuple(_args, ""))
5543 return NULL;
5544 _rv = LMGetTheGDevice();
5545 _res = Py_BuildValue("O&",
5546 ResObj_New, _rv);
5547 return _res;
5550 static PyObject *Qd_LMSetTheGDevice(PyObject *_self, PyObject *_args)
5552 PyObject *_res = NULL;
5553 GDHandle value;
5554 #ifndef LMSetTheGDevice
5555 PyMac_PRECHECK(LMSetTheGDevice);
5556 #endif
5557 if (!PyArg_ParseTuple(_args, "O&",
5558 ResObj_Convert, &value))
5559 return NULL;
5560 LMSetTheGDevice(value);
5561 Py_INCREF(Py_None);
5562 _res = Py_None;
5563 return _res;
5566 static PyObject *Qd_LMGetHiliteRGB(PyObject *_self, PyObject *_args)
5568 PyObject *_res = NULL;
5569 RGBColor hiliteRGBValue;
5570 #ifndef LMGetHiliteRGB
5571 PyMac_PRECHECK(LMGetHiliteRGB);
5572 #endif
5573 if (!PyArg_ParseTuple(_args, ""))
5574 return NULL;
5575 LMGetHiliteRGB(&hiliteRGBValue);
5576 _res = Py_BuildValue("O&",
5577 QdRGB_New, &hiliteRGBValue);
5578 return _res;
5581 static PyObject *Qd_LMSetHiliteRGB(PyObject *_self, PyObject *_args)
5583 PyObject *_res = NULL;
5584 RGBColor hiliteRGBValue;
5585 #ifndef LMSetHiliteRGB
5586 PyMac_PRECHECK(LMSetHiliteRGB);
5587 #endif
5588 if (!PyArg_ParseTuple(_args, "O&",
5589 QdRGB_Convert, &hiliteRGBValue))
5590 return NULL;
5591 LMSetHiliteRGB(&hiliteRGBValue);
5592 Py_INCREF(Py_None);
5593 _res = Py_None;
5594 return _res;
5597 static PyObject *Qd_LMGetCursorNew(PyObject *_self, PyObject *_args)
5599 PyObject *_res = NULL;
5600 Boolean _rv;
5601 #ifndef LMGetCursorNew
5602 PyMac_PRECHECK(LMGetCursorNew);
5603 #endif
5604 if (!PyArg_ParseTuple(_args, ""))
5605 return NULL;
5606 _rv = LMGetCursorNew();
5607 _res = Py_BuildValue("b",
5608 _rv);
5609 return _res;
5612 static PyObject *Qd_LMSetCursorNew(PyObject *_self, PyObject *_args)
5614 PyObject *_res = NULL;
5615 Boolean value;
5616 #ifndef LMSetCursorNew
5617 PyMac_PRECHECK(LMSetCursorNew);
5618 #endif
5619 if (!PyArg_ParseTuple(_args, "b",
5620 &value))
5621 return NULL;
5622 LMSetCursorNew(value);
5623 Py_INCREF(Py_None);
5624 _res = Py_None;
5625 return _res;
5628 static PyObject *Qd_TextFont(PyObject *_self, PyObject *_args)
5630 PyObject *_res = NULL;
5631 short font;
5632 #ifndef TextFont
5633 PyMac_PRECHECK(TextFont);
5634 #endif
5635 if (!PyArg_ParseTuple(_args, "h",
5636 &font))
5637 return NULL;
5638 TextFont(font);
5639 Py_INCREF(Py_None);
5640 _res = Py_None;
5641 return _res;
5644 static PyObject *Qd_TextFace(PyObject *_self, PyObject *_args)
5646 PyObject *_res = NULL;
5647 StyleParameter face;
5648 #ifndef TextFace
5649 PyMac_PRECHECK(TextFace);
5650 #endif
5651 if (!PyArg_ParseTuple(_args, "h",
5652 &face))
5653 return NULL;
5654 TextFace(face);
5655 Py_INCREF(Py_None);
5656 _res = Py_None;
5657 return _res;
5660 static PyObject *Qd_TextMode(PyObject *_self, PyObject *_args)
5662 PyObject *_res = NULL;
5663 short mode;
5664 #ifndef TextMode
5665 PyMac_PRECHECK(TextMode);
5666 #endif
5667 if (!PyArg_ParseTuple(_args, "h",
5668 &mode))
5669 return NULL;
5670 TextMode(mode);
5671 Py_INCREF(Py_None);
5672 _res = Py_None;
5673 return _res;
5676 static PyObject *Qd_TextSize(PyObject *_self, PyObject *_args)
5678 PyObject *_res = NULL;
5679 short size;
5680 #ifndef TextSize
5681 PyMac_PRECHECK(TextSize);
5682 #endif
5683 if (!PyArg_ParseTuple(_args, "h",
5684 &size))
5685 return NULL;
5686 TextSize(size);
5687 Py_INCREF(Py_None);
5688 _res = Py_None;
5689 return _res;
5692 static PyObject *Qd_SpaceExtra(PyObject *_self, PyObject *_args)
5694 PyObject *_res = NULL;
5695 Fixed extra;
5696 #ifndef SpaceExtra
5697 PyMac_PRECHECK(SpaceExtra);
5698 #endif
5699 if (!PyArg_ParseTuple(_args, "O&",
5700 PyMac_GetFixed, &extra))
5701 return NULL;
5702 SpaceExtra(extra);
5703 Py_INCREF(Py_None);
5704 _res = Py_None;
5705 return _res;
5708 static PyObject *Qd_DrawChar(PyObject *_self, PyObject *_args)
5710 PyObject *_res = NULL;
5711 CharParameter ch;
5712 #ifndef DrawChar
5713 PyMac_PRECHECK(DrawChar);
5714 #endif
5715 if (!PyArg_ParseTuple(_args, "h",
5716 &ch))
5717 return NULL;
5718 DrawChar(ch);
5719 Py_INCREF(Py_None);
5720 _res = Py_None;
5721 return _res;
5724 static PyObject *Qd_DrawString(PyObject *_self, PyObject *_args)
5726 PyObject *_res = NULL;
5727 Str255 s;
5728 #ifndef DrawString
5729 PyMac_PRECHECK(DrawString);
5730 #endif
5731 if (!PyArg_ParseTuple(_args, "O&",
5732 PyMac_GetStr255, s))
5733 return NULL;
5734 DrawString(s);
5735 Py_INCREF(Py_None);
5736 _res = Py_None;
5737 return _res;
5740 static PyObject *Qd_MacDrawText(PyObject *_self, PyObject *_args)
5742 PyObject *_res = NULL;
5743 char *textBuf__in__;
5744 int textBuf__in_len__;
5745 short firstByte;
5746 short byteCount;
5747 #ifndef MacDrawText
5748 PyMac_PRECHECK(MacDrawText);
5749 #endif
5750 if (!PyArg_ParseTuple(_args, "s#hh",
5751 &textBuf__in__, &textBuf__in_len__,
5752 &firstByte,
5753 &byteCount))
5754 return NULL;
5755 /* Fool compiler warnings */
5756 textBuf__in_len__ = textBuf__in_len__;
5757 MacDrawText(textBuf__in__,
5758 firstByte,
5759 byteCount);
5760 Py_INCREF(Py_None);
5761 _res = Py_None;
5762 return _res;
5765 static PyObject *Qd_CharWidth(PyObject *_self, PyObject *_args)
5767 PyObject *_res = NULL;
5768 short _rv;
5769 CharParameter ch;
5770 #ifndef CharWidth
5771 PyMac_PRECHECK(CharWidth);
5772 #endif
5773 if (!PyArg_ParseTuple(_args, "h",
5774 &ch))
5775 return NULL;
5776 _rv = CharWidth(ch);
5777 _res = Py_BuildValue("h",
5778 _rv);
5779 return _res;
5782 static PyObject *Qd_StringWidth(PyObject *_self, PyObject *_args)
5784 PyObject *_res = NULL;
5785 short _rv;
5786 Str255 s;
5787 #ifndef StringWidth
5788 PyMac_PRECHECK(StringWidth);
5789 #endif
5790 if (!PyArg_ParseTuple(_args, "O&",
5791 PyMac_GetStr255, s))
5792 return NULL;
5793 _rv = StringWidth(s);
5794 _res = Py_BuildValue("h",
5795 _rv);
5796 return _res;
5799 static PyObject *Qd_TextWidth(PyObject *_self, PyObject *_args)
5801 PyObject *_res = NULL;
5802 short _rv;
5803 char *textBuf__in__;
5804 int textBuf__in_len__;
5805 short firstByte;
5806 short byteCount;
5807 #ifndef TextWidth
5808 PyMac_PRECHECK(TextWidth);
5809 #endif
5810 if (!PyArg_ParseTuple(_args, "s#hh",
5811 &textBuf__in__, &textBuf__in_len__,
5812 &firstByte,
5813 &byteCount))
5814 return NULL;
5815 /* Fool compiler warnings */
5816 textBuf__in_len__ = textBuf__in_len__;
5817 _rv = TextWidth(textBuf__in__,
5818 firstByte,
5819 byteCount);
5820 _res = Py_BuildValue("h",
5821 _rv);
5822 return _res;
5825 static PyObject *Qd_GetFontInfo(PyObject *_self, PyObject *_args)
5827 PyObject *_res = NULL;
5828 FontInfo info;
5829 #ifndef GetFontInfo
5830 PyMac_PRECHECK(GetFontInfo);
5831 #endif
5832 if (!PyArg_ParseTuple(_args, ""))
5833 return NULL;
5834 GetFontInfo(&info);
5835 _res = Py_BuildValue("O&",
5836 QdFI_New, &info);
5837 return _res;
5840 static PyObject *Qd_CharExtra(PyObject *_self, PyObject *_args)
5842 PyObject *_res = NULL;
5843 Fixed extra;
5844 #ifndef CharExtra
5845 PyMac_PRECHECK(CharExtra);
5846 #endif
5847 if (!PyArg_ParseTuple(_args, "O&",
5848 PyMac_GetFixed, &extra))
5849 return NULL;
5850 CharExtra(extra);
5851 Py_INCREF(Py_None);
5852 _res = Py_None;
5853 return _res;
5856 static PyObject *Qd_TruncString(PyObject *_self, PyObject *_args)
5858 PyObject *_res = NULL;
5859 short _rv;
5860 short width;
5861 Str255 theString;
5862 TruncCode truncWhere;
5863 #ifndef TruncString
5864 PyMac_PRECHECK(TruncString);
5865 #endif
5866 if (!PyArg_ParseTuple(_args, "hO&h",
5867 &width,
5868 PyMac_GetStr255, theString,
5869 &truncWhere))
5870 return NULL;
5871 _rv = TruncString(width,
5872 theString,
5873 truncWhere);
5874 _res = Py_BuildValue("h",
5875 _rv);
5876 return _res;
5879 static PyObject *Qd_SetPort(PyObject *_self, PyObject *_args)
5881 PyObject *_res = NULL;
5882 GrafPtr thePort;
5883 #ifndef SetPort
5884 PyMac_PRECHECK(SetPort);
5885 #endif
5886 if (!PyArg_ParseTuple(_args, "O&",
5887 GrafObj_Convert, &thePort))
5888 return NULL;
5889 SetPort(thePort);
5890 Py_INCREF(Py_None);
5891 _res = Py_None;
5892 return _res;
5895 static PyObject *Qd_GetCursor(PyObject *_self, PyObject *_args)
5897 PyObject *_res = NULL;
5898 CursHandle _rv;
5899 short cursorID;
5900 #ifndef GetCursor
5901 PyMac_PRECHECK(GetCursor);
5902 #endif
5903 if (!PyArg_ParseTuple(_args, "h",
5904 &cursorID))
5905 return NULL;
5906 _rv = GetCursor(cursorID);
5907 _res = Py_BuildValue("O&",
5908 ResObj_New, _rv);
5909 return _res;
5912 static PyObject *Qd_SetCursor(PyObject *_self, PyObject *_args)
5914 PyObject *_res = NULL;
5915 Cursor *crsr__in__;
5916 int crsr__in_len__;
5917 #ifndef SetCursor
5918 PyMac_PRECHECK(SetCursor);
5919 #endif
5920 if (!PyArg_ParseTuple(_args, "s#",
5921 (char **)&crsr__in__, &crsr__in_len__))
5922 return NULL;
5923 if (crsr__in_len__ != sizeof(Cursor))
5925 PyErr_SetString(PyExc_TypeError, "buffer length should be sizeof(Cursor)");
5926 goto crsr__error__;
5928 SetCursor(crsr__in__);
5929 Py_INCREF(Py_None);
5930 _res = Py_None;
5931 crsr__error__: ;
5932 return _res;
5935 static PyObject *Qd_ShowCursor(PyObject *_self, PyObject *_args)
5937 PyObject *_res = NULL;
5938 #ifndef ShowCursor
5939 PyMac_PRECHECK(ShowCursor);
5940 #endif
5941 if (!PyArg_ParseTuple(_args, ""))
5942 return NULL;
5943 ShowCursor();
5944 Py_INCREF(Py_None);
5945 _res = Py_None;
5946 return _res;
5949 static PyObject *Qd_LineTo(PyObject *_self, PyObject *_args)
5951 PyObject *_res = NULL;
5952 short h;
5953 short v;
5954 #ifndef LineTo
5955 PyMac_PRECHECK(LineTo);
5956 #endif
5957 if (!PyArg_ParseTuple(_args, "hh",
5959 &v))
5960 return NULL;
5961 LineTo(h,
5963 Py_INCREF(Py_None);
5964 _res = Py_None;
5965 return _res;
5968 static PyObject *Qd_SetRect(PyObject *_self, PyObject *_args)
5970 PyObject *_res = NULL;
5971 Rect r;
5972 short left;
5973 short top;
5974 short right;
5975 short bottom;
5976 #ifndef SetRect
5977 PyMac_PRECHECK(SetRect);
5978 #endif
5979 if (!PyArg_ParseTuple(_args, "hhhh",
5980 &left,
5981 &top,
5982 &right,
5983 &bottom))
5984 return NULL;
5985 SetRect(&r,
5986 left,
5987 top,
5988 right,
5989 bottom);
5990 _res = Py_BuildValue("O&",
5991 PyMac_BuildRect, &r);
5992 return _res;
5995 static PyObject *Qd_OffsetRect(PyObject *_self, PyObject *_args)
5997 PyObject *_res = NULL;
5998 Rect r;
5999 short dh;
6000 short dv;
6001 #ifndef OffsetRect
6002 PyMac_PRECHECK(OffsetRect);
6003 #endif
6004 if (!PyArg_ParseTuple(_args, "O&hh",
6005 PyMac_GetRect, &r,
6006 &dh,
6007 &dv))
6008 return NULL;
6009 OffsetRect(&r,
6011 dv);
6012 _res = Py_BuildValue("O&",
6013 PyMac_BuildRect, &r);
6014 return _res;
6017 static PyObject *Qd_InsetRect(PyObject *_self, PyObject *_args)
6019 PyObject *_res = NULL;
6020 Rect r;
6021 short dh;
6022 short dv;
6023 #ifndef InsetRect
6024 PyMac_PRECHECK(InsetRect);
6025 #endif
6026 if (!PyArg_ParseTuple(_args, "O&hh",
6027 PyMac_GetRect, &r,
6028 &dh,
6029 &dv))
6030 return NULL;
6031 InsetRect(&r,
6033 dv);
6034 _res = Py_BuildValue("O&",
6035 PyMac_BuildRect, &r);
6036 return _res;
6039 static PyObject *Qd_UnionRect(PyObject *_self, PyObject *_args)
6041 PyObject *_res = NULL;
6042 Rect src1;
6043 Rect src2;
6044 Rect dstRect;
6045 #ifndef UnionRect
6046 PyMac_PRECHECK(UnionRect);
6047 #endif
6048 if (!PyArg_ParseTuple(_args, "O&O&",
6049 PyMac_GetRect, &src1,
6050 PyMac_GetRect, &src2))
6051 return NULL;
6052 UnionRect(&src1,
6053 &src2,
6054 &dstRect);
6055 _res = Py_BuildValue("O&",
6056 PyMac_BuildRect, &dstRect);
6057 return _res;
6060 static PyObject *Qd_EqualRect(PyObject *_self, PyObject *_args)
6062 PyObject *_res = NULL;
6063 Boolean _rv;
6064 Rect rect1;
6065 Rect rect2;
6066 #ifndef EqualRect
6067 PyMac_PRECHECK(EqualRect);
6068 #endif
6069 if (!PyArg_ParseTuple(_args, "O&O&",
6070 PyMac_GetRect, &rect1,
6071 PyMac_GetRect, &rect2))
6072 return NULL;
6073 _rv = EqualRect(&rect1,
6074 &rect2);
6075 _res = Py_BuildValue("b",
6076 _rv);
6077 return _res;
6080 static PyObject *Qd_FrameRect(PyObject *_self, PyObject *_args)
6082 PyObject *_res = NULL;
6083 Rect r;
6084 #ifndef FrameRect
6085 PyMac_PRECHECK(FrameRect);
6086 #endif
6087 if (!PyArg_ParseTuple(_args, "O&",
6088 PyMac_GetRect, &r))
6089 return NULL;
6090 FrameRect(&r);
6091 Py_INCREF(Py_None);
6092 _res = Py_None;
6093 return _res;
6096 static PyObject *Qd_InvertRect(PyObject *_self, PyObject *_args)
6098 PyObject *_res = NULL;
6099 Rect r;
6100 #ifndef InvertRect
6101 PyMac_PRECHECK(InvertRect);
6102 #endif
6103 if (!PyArg_ParseTuple(_args, "O&",
6104 PyMac_GetRect, &r))
6105 return NULL;
6106 InvertRect(&r);
6107 Py_INCREF(Py_None);
6108 _res = Py_None;
6109 return _res;
6112 static PyObject *Qd_FillRect(PyObject *_self, PyObject *_args)
6114 PyObject *_res = NULL;
6115 Rect r;
6116 Pattern *pat__in__;
6117 int pat__in_len__;
6118 #ifndef FillRect
6119 PyMac_PRECHECK(FillRect);
6120 #endif
6121 if (!PyArg_ParseTuple(_args, "O&s#",
6122 PyMac_GetRect, &r,
6123 (char **)&pat__in__, &pat__in_len__))
6124 return NULL;
6125 if (pat__in_len__ != sizeof(Pattern))
6127 PyErr_SetString(PyExc_TypeError, "buffer length should be sizeof(Pattern)");
6128 goto pat__error__;
6130 FillRect(&r,
6131 pat__in__);
6132 Py_INCREF(Py_None);
6133 _res = Py_None;
6134 pat__error__: ;
6135 return _res;
6138 static PyObject *Qd_CopyRgn(PyObject *_self, PyObject *_args)
6140 PyObject *_res = NULL;
6141 RgnHandle srcRgn;
6142 RgnHandle dstRgn;
6143 #ifndef CopyRgn
6144 PyMac_PRECHECK(CopyRgn);
6145 #endif
6146 if (!PyArg_ParseTuple(_args, "O&O&",
6147 ResObj_Convert, &srcRgn,
6148 ResObj_Convert, &dstRgn))
6149 return NULL;
6150 CopyRgn(srcRgn,
6151 dstRgn);
6152 Py_INCREF(Py_None);
6153 _res = Py_None;
6154 return _res;
6157 static PyObject *Qd_SetRectRgn(PyObject *_self, PyObject *_args)
6159 PyObject *_res = NULL;
6160 RgnHandle rgn;
6161 short left;
6162 short top;
6163 short right;
6164 short bottom;
6165 #ifndef SetRectRgn
6166 PyMac_PRECHECK(SetRectRgn);
6167 #endif
6168 if (!PyArg_ParseTuple(_args, "O&hhhh",
6169 ResObj_Convert, &rgn,
6170 &left,
6171 &top,
6172 &right,
6173 &bottom))
6174 return NULL;
6175 SetRectRgn(rgn,
6176 left,
6177 top,
6178 right,
6179 bottom);
6180 Py_INCREF(Py_None);
6181 _res = Py_None;
6182 return _res;
6185 static PyObject *Qd_OffsetRgn(PyObject *_self, PyObject *_args)
6187 PyObject *_res = NULL;
6188 RgnHandle rgn;
6189 short dh;
6190 short dv;
6191 #ifndef OffsetRgn
6192 PyMac_PRECHECK(OffsetRgn);
6193 #endif
6194 if (!PyArg_ParseTuple(_args, "O&hh",
6195 ResObj_Convert, &rgn,
6196 &dh,
6197 &dv))
6198 return NULL;
6199 OffsetRgn(rgn,
6201 dv);
6202 Py_INCREF(Py_None);
6203 _res = Py_None;
6204 return _res;
6207 static PyObject *Qd_UnionRgn(PyObject *_self, PyObject *_args)
6209 PyObject *_res = NULL;
6210 RgnHandle srcRgnA;
6211 RgnHandle srcRgnB;
6212 RgnHandle dstRgn;
6213 #ifndef UnionRgn
6214 PyMac_PRECHECK(UnionRgn);
6215 #endif
6216 if (!PyArg_ParseTuple(_args, "O&O&O&",
6217 ResObj_Convert, &srcRgnA,
6218 ResObj_Convert, &srcRgnB,
6219 ResObj_Convert, &dstRgn))
6220 return NULL;
6221 UnionRgn(srcRgnA,
6222 srcRgnB,
6223 dstRgn);
6224 Py_INCREF(Py_None);
6225 _res = Py_None;
6226 return _res;
6229 static PyObject *Qd_XorRgn(PyObject *_self, PyObject *_args)
6231 PyObject *_res = NULL;
6232 RgnHandle srcRgnA;
6233 RgnHandle srcRgnB;
6234 RgnHandle dstRgn;
6235 #ifndef XorRgn
6236 PyMac_PRECHECK(XorRgn);
6237 #endif
6238 if (!PyArg_ParseTuple(_args, "O&O&O&",
6239 ResObj_Convert, &srcRgnA,
6240 ResObj_Convert, &srcRgnB,
6241 ResObj_Convert, &dstRgn))
6242 return NULL;
6243 XorRgn(srcRgnA,
6244 srcRgnB,
6245 dstRgn);
6246 Py_INCREF(Py_None);
6247 _res = Py_None;
6248 return _res;
6251 static PyObject *Qd_EqualRgn(PyObject *_self, PyObject *_args)
6253 PyObject *_res = NULL;
6254 Boolean _rv;
6255 RgnHandle rgnA;
6256 RgnHandle rgnB;
6257 #ifndef EqualRgn
6258 PyMac_PRECHECK(EqualRgn);
6259 #endif
6260 if (!PyArg_ParseTuple(_args, "O&O&",
6261 ResObj_Convert, &rgnA,
6262 ResObj_Convert, &rgnB))
6263 return NULL;
6264 _rv = EqualRgn(rgnA,
6265 rgnB);
6266 _res = Py_BuildValue("b",
6267 _rv);
6268 return _res;
6271 static PyObject *Qd_FrameRgn(PyObject *_self, PyObject *_args)
6273 PyObject *_res = NULL;
6274 RgnHandle rgn;
6275 #ifndef FrameRgn
6276 PyMac_PRECHECK(FrameRgn);
6277 #endif
6278 if (!PyArg_ParseTuple(_args, "O&",
6279 ResObj_Convert, &rgn))
6280 return NULL;
6281 FrameRgn(rgn);
6282 Py_INCREF(Py_None);
6283 _res = Py_None;
6284 return _res;
6287 static PyObject *Qd_PaintRgn(PyObject *_self, PyObject *_args)
6289 PyObject *_res = NULL;
6290 RgnHandle rgn;
6291 #ifndef PaintRgn
6292 PyMac_PRECHECK(PaintRgn);
6293 #endif
6294 if (!PyArg_ParseTuple(_args, "O&",
6295 ResObj_Convert, &rgn))
6296 return NULL;
6297 PaintRgn(rgn);
6298 Py_INCREF(Py_None);
6299 _res = Py_None;
6300 return _res;
6303 static PyObject *Qd_InvertRgn(PyObject *_self, PyObject *_args)
6305 PyObject *_res = NULL;
6306 RgnHandle rgn;
6307 #ifndef InvertRgn
6308 PyMac_PRECHECK(InvertRgn);
6309 #endif
6310 if (!PyArg_ParseTuple(_args, "O&",
6311 ResObj_Convert, &rgn))
6312 return NULL;
6313 InvertRgn(rgn);
6314 Py_INCREF(Py_None);
6315 _res = Py_None;
6316 return _res;
6319 static PyObject *Qd_FillRgn(PyObject *_self, PyObject *_args)
6321 PyObject *_res = NULL;
6322 RgnHandle rgn;
6323 Pattern *pat__in__;
6324 int pat__in_len__;
6325 #ifndef FillRgn
6326 PyMac_PRECHECK(FillRgn);
6327 #endif
6328 if (!PyArg_ParseTuple(_args, "O&s#",
6329 ResObj_Convert, &rgn,
6330 (char **)&pat__in__, &pat__in_len__))
6331 return NULL;
6332 if (pat__in_len__ != sizeof(Pattern))
6334 PyErr_SetString(PyExc_TypeError, "buffer length should be sizeof(Pattern)");
6335 goto pat__error__;
6337 FillRgn(rgn,
6338 pat__in__);
6339 Py_INCREF(Py_None);
6340 _res = Py_None;
6341 pat__error__: ;
6342 return _res;
6345 static PyObject *Qd_GetPixel(PyObject *_self, PyObject *_args)
6347 PyObject *_res = NULL;
6348 Boolean _rv;
6349 short h;
6350 short v;
6351 #ifndef GetPixel
6352 PyMac_PRECHECK(GetPixel);
6353 #endif
6354 if (!PyArg_ParseTuple(_args, "hh",
6356 &v))
6357 return NULL;
6358 _rv = GetPixel(h,
6360 _res = Py_BuildValue("b",
6361 _rv);
6362 return _res;
6365 static PyObject *Qd_PtInRect(PyObject *_self, PyObject *_args)
6367 PyObject *_res = NULL;
6368 Boolean _rv;
6369 Point pt;
6370 Rect r;
6371 #ifndef PtInRect
6372 PyMac_PRECHECK(PtInRect);
6373 #endif
6374 if (!PyArg_ParseTuple(_args, "O&O&",
6375 PyMac_GetPoint, &pt,
6376 PyMac_GetRect, &r))
6377 return NULL;
6378 _rv = PtInRect(pt,
6379 &r);
6380 _res = Py_BuildValue("b",
6381 _rv);
6382 return _res;
6385 static PyObject *Qd_DrawText(PyObject *_self, PyObject *_args)
6387 PyObject *_res = NULL;
6388 char *textBuf__in__;
6389 int textBuf__in_len__;
6390 short firstByte;
6391 short byteCount;
6392 #ifndef DrawText
6393 PyMac_PRECHECK(DrawText);
6394 #endif
6395 if (!PyArg_ParseTuple(_args, "s#hh",
6396 &textBuf__in__, &textBuf__in_len__,
6397 &firstByte,
6398 &byteCount))
6399 return NULL;
6400 /* Fool compiler warnings */
6401 textBuf__in_len__ = textBuf__in_len__;
6402 DrawText(textBuf__in__,
6403 firstByte,
6404 byteCount);
6405 Py_INCREF(Py_None);
6406 _res = Py_None;
6407 return _res;
6410 static PyObject *Qd_BitMap(PyObject *_self, PyObject *_args)
6412 PyObject *_res = NULL;
6414 BitMap *ptr;
6415 PyObject *source;
6416 Rect bounds;
6417 int rowbytes;
6418 char *data;
6420 if ( !PyArg_ParseTuple(_args, "O!iO&", &PyString_Type, &source, &rowbytes, PyMac_GetRect,
6421 &bounds) )
6422 return NULL;
6423 data = PyString_AsString(source);
6424 if ((ptr=(BitMap *)malloc(sizeof(BitMap))) == NULL )
6425 return PyErr_NoMemory();
6426 ptr->baseAddr = (Ptr)data;
6427 ptr->rowBytes = rowbytes;
6428 ptr->bounds = bounds;
6429 if ( (_res = BMObj_New(ptr)) == NULL ) {
6430 free(ptr);
6431 return NULL;
6433 ((BitMapObject *)_res)->referred_object = source;
6434 Py_INCREF(source);
6435 ((BitMapObject *)_res)->referred_bitmap = ptr;
6436 return _res;
6440 static PyObject *Qd_RawBitMap(PyObject *_self, PyObject *_args)
6442 PyObject *_res = NULL;
6444 BitMap *ptr;
6445 PyObject *source;
6447 if ( !PyArg_ParseTuple(_args, "O!", &PyString_Type, &source) )
6448 return NULL;
6449 if ( PyString_Size(source) != sizeof(BitMap) && PyString_Size(source) != sizeof(PixMap) ) {
6450 PyErr_BadArgument();
6451 return NULL;
6453 ptr = (BitMapPtr)PyString_AsString(source);
6454 if ( (_res = BMObj_New(ptr)) == NULL ) {
6455 return NULL;
6457 ((BitMapObject *)_res)->referred_object = source;
6458 Py_INCREF(source);
6459 return _res;
6463 static PyMethodDef Qd_methods[] = {
6464 {"MacSetPort", (PyCFunction)Qd_MacSetPort, 1,
6465 PyDoc_STR("(GrafPtr port) -> None")},
6466 {"GetPort", (PyCFunction)Qd_GetPort, 1,
6467 PyDoc_STR("() -> (GrafPtr port)")},
6468 {"GrafDevice", (PyCFunction)Qd_GrafDevice, 1,
6469 PyDoc_STR("(short device) -> None")},
6470 {"SetPortBits", (PyCFunction)Qd_SetPortBits, 1,
6471 PyDoc_STR("(BitMapPtr bm) -> None")},
6472 {"PortSize", (PyCFunction)Qd_PortSize, 1,
6473 PyDoc_STR("(short width, short height) -> None")},
6474 {"MovePortTo", (PyCFunction)Qd_MovePortTo, 1,
6475 PyDoc_STR("(short leftGlobal, short topGlobal) -> None")},
6476 {"SetOrigin", (PyCFunction)Qd_SetOrigin, 1,
6477 PyDoc_STR("(short h, short v) -> None")},
6478 {"SetClip", (PyCFunction)Qd_SetClip, 1,
6479 PyDoc_STR("(RgnHandle rgn) -> None")},
6480 {"GetClip", (PyCFunction)Qd_GetClip, 1,
6481 PyDoc_STR("(RgnHandle rgn) -> None")},
6482 {"ClipRect", (PyCFunction)Qd_ClipRect, 1,
6483 PyDoc_STR("(Rect r) -> None")},
6484 {"BackPat", (PyCFunction)Qd_BackPat, 1,
6485 PyDoc_STR("(Pattern pat) -> None")},
6486 {"InitCursor", (PyCFunction)Qd_InitCursor, 1,
6487 PyDoc_STR("() -> None")},
6488 {"MacSetCursor", (PyCFunction)Qd_MacSetCursor, 1,
6489 PyDoc_STR("(Cursor crsr) -> None")},
6490 {"HideCursor", (PyCFunction)Qd_HideCursor, 1,
6491 PyDoc_STR("() -> None")},
6492 {"MacShowCursor", (PyCFunction)Qd_MacShowCursor, 1,
6493 PyDoc_STR("() -> None")},
6494 {"ObscureCursor", (PyCFunction)Qd_ObscureCursor, 1,
6495 PyDoc_STR("() -> None")},
6496 {"HidePen", (PyCFunction)Qd_HidePen, 1,
6497 PyDoc_STR("() -> None")},
6498 {"ShowPen", (PyCFunction)Qd_ShowPen, 1,
6499 PyDoc_STR("() -> None")},
6500 {"GetPen", (PyCFunction)Qd_GetPen, 1,
6501 PyDoc_STR("() -> (Point pt)")},
6502 {"GetPenState", (PyCFunction)Qd_GetPenState, 1,
6503 PyDoc_STR("() -> (PenState pnState)")},
6504 {"SetPenState", (PyCFunction)Qd_SetPenState, 1,
6505 PyDoc_STR("(PenState pnState) -> None")},
6506 {"PenSize", (PyCFunction)Qd_PenSize, 1,
6507 PyDoc_STR("(short width, short height) -> None")},
6508 {"PenMode", (PyCFunction)Qd_PenMode, 1,
6509 PyDoc_STR("(short mode) -> None")},
6510 {"PenPat", (PyCFunction)Qd_PenPat, 1,
6511 PyDoc_STR("(Pattern pat) -> None")},
6512 {"PenNormal", (PyCFunction)Qd_PenNormal, 1,
6513 PyDoc_STR("() -> None")},
6514 {"MoveTo", (PyCFunction)Qd_MoveTo, 1,
6515 PyDoc_STR("(short h, short v) -> None")},
6516 {"Move", (PyCFunction)Qd_Move, 1,
6517 PyDoc_STR("(short dh, short dv) -> None")},
6518 {"MacLineTo", (PyCFunction)Qd_MacLineTo, 1,
6519 PyDoc_STR("(short h, short v) -> None")},
6520 {"Line", (PyCFunction)Qd_Line, 1,
6521 PyDoc_STR("(short dh, short dv) -> None")},
6522 {"ForeColor", (PyCFunction)Qd_ForeColor, 1,
6523 PyDoc_STR("(long color) -> None")},
6524 {"BackColor", (PyCFunction)Qd_BackColor, 1,
6525 PyDoc_STR("(long color) -> None")},
6526 {"ColorBit", (PyCFunction)Qd_ColorBit, 1,
6527 PyDoc_STR("(short whichBit) -> None")},
6528 {"MacSetRect", (PyCFunction)Qd_MacSetRect, 1,
6529 PyDoc_STR("(short left, short top, short right, short bottom) -> (Rect r)")},
6530 {"MacOffsetRect", (PyCFunction)Qd_MacOffsetRect, 1,
6531 PyDoc_STR("(Rect r, short dh, short dv) -> (Rect r)")},
6532 {"MacInsetRect", (PyCFunction)Qd_MacInsetRect, 1,
6533 PyDoc_STR("(Rect r, short dh, short dv) -> (Rect r)")},
6534 {"SectRect", (PyCFunction)Qd_SectRect, 1,
6535 PyDoc_STR("(Rect src1, Rect src2) -> (Boolean _rv, Rect dstRect)")},
6536 {"MacUnionRect", (PyCFunction)Qd_MacUnionRect, 1,
6537 PyDoc_STR("(Rect src1, Rect src2) -> (Rect dstRect)")},
6538 {"MacEqualRect", (PyCFunction)Qd_MacEqualRect, 1,
6539 PyDoc_STR("(Rect rect1, Rect rect2) -> (Boolean _rv)")},
6540 {"EmptyRect", (PyCFunction)Qd_EmptyRect, 1,
6541 PyDoc_STR("(Rect r) -> (Boolean _rv)")},
6542 {"MacFrameRect", (PyCFunction)Qd_MacFrameRect, 1,
6543 PyDoc_STR("(Rect r) -> None")},
6544 {"PaintRect", (PyCFunction)Qd_PaintRect, 1,
6545 PyDoc_STR("(Rect r) -> None")},
6546 {"EraseRect", (PyCFunction)Qd_EraseRect, 1,
6547 PyDoc_STR("(Rect r) -> None")},
6548 {"MacInvertRect", (PyCFunction)Qd_MacInvertRect, 1,
6549 PyDoc_STR("(Rect r) -> None")},
6550 {"MacFillRect", (PyCFunction)Qd_MacFillRect, 1,
6551 PyDoc_STR("(Rect r, Pattern pat) -> None")},
6552 {"FrameOval", (PyCFunction)Qd_FrameOval, 1,
6553 PyDoc_STR("(Rect r) -> None")},
6554 {"PaintOval", (PyCFunction)Qd_PaintOval, 1,
6555 PyDoc_STR("(Rect r) -> None")},
6556 {"EraseOval", (PyCFunction)Qd_EraseOval, 1,
6557 PyDoc_STR("(Rect r) -> None")},
6558 {"InvertOval", (PyCFunction)Qd_InvertOval, 1,
6559 PyDoc_STR("(Rect r) -> None")},
6560 {"FillOval", (PyCFunction)Qd_FillOval, 1,
6561 PyDoc_STR("(Rect r, Pattern pat) -> None")},
6562 {"FrameRoundRect", (PyCFunction)Qd_FrameRoundRect, 1,
6563 PyDoc_STR("(Rect r, short ovalWidth, short ovalHeight) -> None")},
6564 {"PaintRoundRect", (PyCFunction)Qd_PaintRoundRect, 1,
6565 PyDoc_STR("(Rect r, short ovalWidth, short ovalHeight) -> None")},
6566 {"EraseRoundRect", (PyCFunction)Qd_EraseRoundRect, 1,
6567 PyDoc_STR("(Rect r, short ovalWidth, short ovalHeight) -> None")},
6568 {"InvertRoundRect", (PyCFunction)Qd_InvertRoundRect, 1,
6569 PyDoc_STR("(Rect r, short ovalWidth, short ovalHeight) -> None")},
6570 {"FillRoundRect", (PyCFunction)Qd_FillRoundRect, 1,
6571 PyDoc_STR("(Rect r, short ovalWidth, short ovalHeight, Pattern pat) -> None")},
6572 {"FrameArc", (PyCFunction)Qd_FrameArc, 1,
6573 PyDoc_STR("(Rect r, short startAngle, short arcAngle) -> None")},
6574 {"PaintArc", (PyCFunction)Qd_PaintArc, 1,
6575 PyDoc_STR("(Rect r, short startAngle, short arcAngle) -> None")},
6576 {"EraseArc", (PyCFunction)Qd_EraseArc, 1,
6577 PyDoc_STR("(Rect r, short startAngle, short arcAngle) -> None")},
6578 {"InvertArc", (PyCFunction)Qd_InvertArc, 1,
6579 PyDoc_STR("(Rect r, short startAngle, short arcAngle) -> None")},
6580 {"FillArc", (PyCFunction)Qd_FillArc, 1,
6581 PyDoc_STR("(Rect r, short startAngle, short arcAngle, Pattern pat) -> None")},
6582 {"NewRgn", (PyCFunction)Qd_NewRgn, 1,
6583 PyDoc_STR("() -> (RgnHandle _rv)")},
6584 {"OpenRgn", (PyCFunction)Qd_OpenRgn, 1,
6585 PyDoc_STR("() -> None")},
6586 {"CloseRgn", (PyCFunction)Qd_CloseRgn, 1,
6587 PyDoc_STR("(RgnHandle dstRgn) -> None")},
6588 {"BitMapToRegion", (PyCFunction)Qd_BitMapToRegion, 1,
6589 PyDoc_STR("(RgnHandle region, BitMapPtr bMap) -> None")},
6591 #if TARGET_API_MAC_CARBON
6592 {"RgnToHandle", (PyCFunction)Qd_RgnToHandle, 1,
6593 PyDoc_STR("(RgnHandle region, Handle flattenedRgnDataHdl) -> None")},
6594 #endif
6595 {"DisposeRgn", (PyCFunction)Qd_DisposeRgn, 1,
6596 PyDoc_STR("(RgnHandle rgn) -> None")},
6597 {"MacCopyRgn", (PyCFunction)Qd_MacCopyRgn, 1,
6598 PyDoc_STR("(RgnHandle srcRgn, RgnHandle dstRgn) -> None")},
6599 {"SetEmptyRgn", (PyCFunction)Qd_SetEmptyRgn, 1,
6600 PyDoc_STR("(RgnHandle rgn) -> None")},
6601 {"MacSetRectRgn", (PyCFunction)Qd_MacSetRectRgn, 1,
6602 PyDoc_STR("(RgnHandle rgn, short left, short top, short right, short bottom) -> None")},
6603 {"RectRgn", (PyCFunction)Qd_RectRgn, 1,
6604 PyDoc_STR("(RgnHandle rgn, Rect r) -> None")},
6605 {"MacOffsetRgn", (PyCFunction)Qd_MacOffsetRgn, 1,
6606 PyDoc_STR("(RgnHandle rgn, short dh, short dv) -> None")},
6607 {"InsetRgn", (PyCFunction)Qd_InsetRgn, 1,
6608 PyDoc_STR("(RgnHandle rgn, short dh, short dv) -> None")},
6609 {"SectRgn", (PyCFunction)Qd_SectRgn, 1,
6610 PyDoc_STR("(RgnHandle srcRgnA, RgnHandle srcRgnB, RgnHandle dstRgn) -> None")},
6611 {"MacUnionRgn", (PyCFunction)Qd_MacUnionRgn, 1,
6612 PyDoc_STR("(RgnHandle srcRgnA, RgnHandle srcRgnB, RgnHandle dstRgn) -> None")},
6613 {"DiffRgn", (PyCFunction)Qd_DiffRgn, 1,
6614 PyDoc_STR("(RgnHandle srcRgnA, RgnHandle srcRgnB, RgnHandle dstRgn) -> None")},
6615 {"MacXorRgn", (PyCFunction)Qd_MacXorRgn, 1,
6616 PyDoc_STR("(RgnHandle srcRgnA, RgnHandle srcRgnB, RgnHandle dstRgn) -> None")},
6617 {"RectInRgn", (PyCFunction)Qd_RectInRgn, 1,
6618 PyDoc_STR("(Rect r, RgnHandle rgn) -> (Boolean _rv)")},
6619 {"MacEqualRgn", (PyCFunction)Qd_MacEqualRgn, 1,
6620 PyDoc_STR("(RgnHandle rgnA, RgnHandle rgnB) -> (Boolean _rv)")},
6621 {"EmptyRgn", (PyCFunction)Qd_EmptyRgn, 1,
6622 PyDoc_STR("(RgnHandle rgn) -> (Boolean _rv)")},
6623 {"MacFrameRgn", (PyCFunction)Qd_MacFrameRgn, 1,
6624 PyDoc_STR("(RgnHandle rgn) -> None")},
6625 {"MacPaintRgn", (PyCFunction)Qd_MacPaintRgn, 1,
6626 PyDoc_STR("(RgnHandle rgn) -> None")},
6627 {"EraseRgn", (PyCFunction)Qd_EraseRgn, 1,
6628 PyDoc_STR("(RgnHandle rgn) -> None")},
6629 {"MacInvertRgn", (PyCFunction)Qd_MacInvertRgn, 1,
6630 PyDoc_STR("(RgnHandle rgn) -> None")},
6631 {"MacFillRgn", (PyCFunction)Qd_MacFillRgn, 1,
6632 PyDoc_STR("(RgnHandle rgn, Pattern pat) -> None")},
6633 {"ScrollRect", (PyCFunction)Qd_ScrollRect, 1,
6634 PyDoc_STR("(Rect r, short dh, short dv, RgnHandle updateRgn) -> None")},
6635 {"CopyBits", (PyCFunction)Qd_CopyBits, 1,
6636 PyDoc_STR("(BitMapPtr srcBits, BitMapPtr dstBits, Rect srcRect, Rect dstRect, short mode, RgnHandle maskRgn) -> None")},
6637 {"CopyMask", (PyCFunction)Qd_CopyMask, 1,
6638 PyDoc_STR("(BitMapPtr srcBits, BitMapPtr maskBits, BitMapPtr dstBits, Rect srcRect, Rect maskRect, Rect dstRect) -> None")},
6639 {"OpenPicture", (PyCFunction)Qd_OpenPicture, 1,
6640 PyDoc_STR("(Rect picFrame) -> (PicHandle _rv)")},
6641 {"PicComment", (PyCFunction)Qd_PicComment, 1,
6642 PyDoc_STR("(short kind, short dataSize, Handle dataHandle) -> None")},
6643 {"ClosePicture", (PyCFunction)Qd_ClosePicture, 1,
6644 PyDoc_STR("() -> None")},
6645 {"DrawPicture", (PyCFunction)Qd_DrawPicture, 1,
6646 PyDoc_STR("(PicHandle myPicture, Rect dstRect) -> None")},
6647 {"KillPicture", (PyCFunction)Qd_KillPicture, 1,
6648 PyDoc_STR("(PicHandle myPicture) -> None")},
6649 {"OpenPoly", (PyCFunction)Qd_OpenPoly, 1,
6650 PyDoc_STR("() -> (PolyHandle _rv)")},
6651 {"ClosePoly", (PyCFunction)Qd_ClosePoly, 1,
6652 PyDoc_STR("() -> None")},
6653 {"KillPoly", (PyCFunction)Qd_KillPoly, 1,
6654 PyDoc_STR("(PolyHandle poly) -> None")},
6655 {"OffsetPoly", (PyCFunction)Qd_OffsetPoly, 1,
6656 PyDoc_STR("(PolyHandle poly, short dh, short dv) -> None")},
6657 {"FramePoly", (PyCFunction)Qd_FramePoly, 1,
6658 PyDoc_STR("(PolyHandle poly) -> None")},
6659 {"PaintPoly", (PyCFunction)Qd_PaintPoly, 1,
6660 PyDoc_STR("(PolyHandle poly) -> None")},
6661 {"ErasePoly", (PyCFunction)Qd_ErasePoly, 1,
6662 PyDoc_STR("(PolyHandle poly) -> None")},
6663 {"InvertPoly", (PyCFunction)Qd_InvertPoly, 1,
6664 PyDoc_STR("(PolyHandle poly) -> None")},
6665 {"FillPoly", (PyCFunction)Qd_FillPoly, 1,
6666 PyDoc_STR("(PolyHandle poly, Pattern pat) -> None")},
6667 {"SetPt", (PyCFunction)Qd_SetPt, 1,
6668 PyDoc_STR("(short h, short v) -> (Point pt)")},
6669 {"LocalToGlobal", (PyCFunction)Qd_LocalToGlobal, 1,
6670 PyDoc_STR("(Point pt) -> (Point pt)")},
6671 {"GlobalToLocal", (PyCFunction)Qd_GlobalToLocal, 1,
6672 PyDoc_STR("(Point pt) -> (Point pt)")},
6673 {"Random", (PyCFunction)Qd_Random, 1,
6674 PyDoc_STR("() -> (short _rv)")},
6675 {"MacGetPixel", (PyCFunction)Qd_MacGetPixel, 1,
6676 PyDoc_STR("(short h, short v) -> (Boolean _rv)")},
6677 {"ScalePt", (PyCFunction)Qd_ScalePt, 1,
6678 PyDoc_STR("(Point pt, Rect srcRect, Rect dstRect) -> (Point pt)")},
6679 {"MapPt", (PyCFunction)Qd_MapPt, 1,
6680 PyDoc_STR("(Point pt, Rect srcRect, Rect dstRect) -> (Point pt)")},
6681 {"MapRect", (PyCFunction)Qd_MapRect, 1,
6682 PyDoc_STR("(Rect r, Rect srcRect, Rect dstRect) -> (Rect r)")},
6683 {"MapRgn", (PyCFunction)Qd_MapRgn, 1,
6684 PyDoc_STR("(RgnHandle rgn, Rect srcRect, Rect dstRect) -> None")},
6685 {"MapPoly", (PyCFunction)Qd_MapPoly, 1,
6686 PyDoc_STR("(PolyHandle poly, Rect srcRect, Rect dstRect) -> None")},
6687 {"StdBits", (PyCFunction)Qd_StdBits, 1,
6688 PyDoc_STR("(BitMapPtr srcBits, Rect srcRect, Rect dstRect, short mode, RgnHandle maskRgn) -> None")},
6689 {"AddPt", (PyCFunction)Qd_AddPt, 1,
6690 PyDoc_STR("(Point src, Point dst) -> (Point dst)")},
6691 {"EqualPt", (PyCFunction)Qd_EqualPt, 1,
6692 PyDoc_STR("(Point pt1, Point pt2) -> (Boolean _rv)")},
6693 {"MacPtInRect", (PyCFunction)Qd_MacPtInRect, 1,
6694 PyDoc_STR("(Point pt, Rect r) -> (Boolean _rv)")},
6695 {"Pt2Rect", (PyCFunction)Qd_Pt2Rect, 1,
6696 PyDoc_STR("(Point pt1, Point pt2) -> (Rect dstRect)")},
6697 {"PtToAngle", (PyCFunction)Qd_PtToAngle, 1,
6698 PyDoc_STR("(Rect r, Point pt) -> (short angle)")},
6699 {"SubPt", (PyCFunction)Qd_SubPt, 1,
6700 PyDoc_STR("(Point src, Point dst) -> (Point dst)")},
6701 {"PtInRgn", (PyCFunction)Qd_PtInRgn, 1,
6702 PyDoc_STR("(Point pt, RgnHandle rgn) -> (Boolean _rv)")},
6703 {"NewPixMap", (PyCFunction)Qd_NewPixMap, 1,
6704 PyDoc_STR("() -> (PixMapHandle _rv)")},
6705 {"DisposePixMap", (PyCFunction)Qd_DisposePixMap, 1,
6706 PyDoc_STR("(PixMapHandle pm) -> None")},
6707 {"CopyPixMap", (PyCFunction)Qd_CopyPixMap, 1,
6708 PyDoc_STR("(PixMapHandle srcPM, PixMapHandle dstPM) -> None")},
6709 {"NewPixPat", (PyCFunction)Qd_NewPixPat, 1,
6710 PyDoc_STR("() -> (PixPatHandle _rv)")},
6711 {"DisposePixPat", (PyCFunction)Qd_DisposePixPat, 1,
6712 PyDoc_STR("(PixPatHandle pp) -> None")},
6713 {"CopyPixPat", (PyCFunction)Qd_CopyPixPat, 1,
6714 PyDoc_STR("(PixPatHandle srcPP, PixPatHandle dstPP) -> None")},
6715 {"PenPixPat", (PyCFunction)Qd_PenPixPat, 1,
6716 PyDoc_STR("(PixPatHandle pp) -> None")},
6717 {"BackPixPat", (PyCFunction)Qd_BackPixPat, 1,
6718 PyDoc_STR("(PixPatHandle pp) -> None")},
6719 {"GetPixPat", (PyCFunction)Qd_GetPixPat, 1,
6720 PyDoc_STR("(short patID) -> (PixPatHandle _rv)")},
6721 {"MakeRGBPat", (PyCFunction)Qd_MakeRGBPat, 1,
6722 PyDoc_STR("(PixPatHandle pp, RGBColor myColor) -> None")},
6723 {"FillCRect", (PyCFunction)Qd_FillCRect, 1,
6724 PyDoc_STR("(Rect r, PixPatHandle pp) -> None")},
6725 {"FillCOval", (PyCFunction)Qd_FillCOval, 1,
6726 PyDoc_STR("(Rect r, PixPatHandle pp) -> None")},
6727 {"FillCRoundRect", (PyCFunction)Qd_FillCRoundRect, 1,
6728 PyDoc_STR("(Rect r, short ovalWidth, short ovalHeight, PixPatHandle pp) -> None")},
6729 {"FillCArc", (PyCFunction)Qd_FillCArc, 1,
6730 PyDoc_STR("(Rect r, short startAngle, short arcAngle, PixPatHandle pp) -> None")},
6731 {"FillCRgn", (PyCFunction)Qd_FillCRgn, 1,
6732 PyDoc_STR("(RgnHandle rgn, PixPatHandle pp) -> None")},
6733 {"FillCPoly", (PyCFunction)Qd_FillCPoly, 1,
6734 PyDoc_STR("(PolyHandle poly, PixPatHandle pp) -> None")},
6735 {"RGBForeColor", (PyCFunction)Qd_RGBForeColor, 1,
6736 PyDoc_STR("(RGBColor color) -> None")},
6737 {"RGBBackColor", (PyCFunction)Qd_RGBBackColor, 1,
6738 PyDoc_STR("(RGBColor color) -> None")},
6739 {"SetCPixel", (PyCFunction)Qd_SetCPixel, 1,
6740 PyDoc_STR("(short h, short v, RGBColor cPix) -> None")},
6741 {"SetPortPix", (PyCFunction)Qd_SetPortPix, 1,
6742 PyDoc_STR("(PixMapHandle pm) -> None")},
6743 {"GetCPixel", (PyCFunction)Qd_GetCPixel, 1,
6744 PyDoc_STR("(short h, short v) -> (RGBColor cPix)")},
6745 {"GetForeColor", (PyCFunction)Qd_GetForeColor, 1,
6746 PyDoc_STR("() -> (RGBColor color)")},
6747 {"GetBackColor", (PyCFunction)Qd_GetBackColor, 1,
6748 PyDoc_STR("() -> (RGBColor color)")},
6749 {"OpColor", (PyCFunction)Qd_OpColor, 1,
6750 PyDoc_STR("(RGBColor color) -> None")},
6751 {"HiliteColor", (PyCFunction)Qd_HiliteColor, 1,
6752 PyDoc_STR("(RGBColor color) -> None")},
6753 {"DisposeCTable", (PyCFunction)Qd_DisposeCTable, 1,
6754 PyDoc_STR("(CTabHandle cTable) -> None")},
6755 {"GetCTable", (PyCFunction)Qd_GetCTable, 1,
6756 PyDoc_STR("(short ctID) -> (CTabHandle _rv)")},
6757 {"GetCCursor", (PyCFunction)Qd_GetCCursor, 1,
6758 PyDoc_STR("(short crsrID) -> (CCrsrHandle _rv)")},
6759 {"SetCCursor", (PyCFunction)Qd_SetCCursor, 1,
6760 PyDoc_STR("(CCrsrHandle cCrsr) -> None")},
6761 {"AllocCursor", (PyCFunction)Qd_AllocCursor, 1,
6762 PyDoc_STR("() -> None")},
6763 {"DisposeCCursor", (PyCFunction)Qd_DisposeCCursor, 1,
6764 PyDoc_STR("(CCrsrHandle cCrsr) -> None")},
6765 {"GetMaxDevice", (PyCFunction)Qd_GetMaxDevice, 1,
6766 PyDoc_STR("(Rect globalRect) -> (GDHandle _rv)")},
6767 {"GetCTSeed", (PyCFunction)Qd_GetCTSeed, 1,
6768 PyDoc_STR("() -> (long _rv)")},
6769 {"GetDeviceList", (PyCFunction)Qd_GetDeviceList, 1,
6770 PyDoc_STR("() -> (GDHandle _rv)")},
6771 {"GetMainDevice", (PyCFunction)Qd_GetMainDevice, 1,
6772 PyDoc_STR("() -> (GDHandle _rv)")},
6773 {"GetNextDevice", (PyCFunction)Qd_GetNextDevice, 1,
6774 PyDoc_STR("(GDHandle curDevice) -> (GDHandle _rv)")},
6775 {"TestDeviceAttribute", (PyCFunction)Qd_TestDeviceAttribute, 1,
6776 PyDoc_STR("(GDHandle gdh, short attribute) -> (Boolean _rv)")},
6777 {"SetDeviceAttribute", (PyCFunction)Qd_SetDeviceAttribute, 1,
6778 PyDoc_STR("(GDHandle gdh, short attribute, Boolean value) -> None")},
6779 {"InitGDevice", (PyCFunction)Qd_InitGDevice, 1,
6780 PyDoc_STR("(short qdRefNum, long mode, GDHandle gdh) -> None")},
6781 {"NewGDevice", (PyCFunction)Qd_NewGDevice, 1,
6782 PyDoc_STR("(short refNum, long mode) -> (GDHandle _rv)")},
6783 {"DisposeGDevice", (PyCFunction)Qd_DisposeGDevice, 1,
6784 PyDoc_STR("(GDHandle gdh) -> None")},
6785 {"SetGDevice", (PyCFunction)Qd_SetGDevice, 1,
6786 PyDoc_STR("(GDHandle gd) -> None")},
6787 {"GetGDevice", (PyCFunction)Qd_GetGDevice, 1,
6788 PyDoc_STR("() -> (GDHandle _rv)")},
6789 {"Color2Index", (PyCFunction)Qd_Color2Index, 1,
6790 PyDoc_STR("(RGBColor myColor) -> (long _rv)")},
6791 {"Index2Color", (PyCFunction)Qd_Index2Color, 1,
6792 PyDoc_STR("(long index) -> (RGBColor aColor)")},
6793 {"InvertColor", (PyCFunction)Qd_InvertColor, 1,
6794 PyDoc_STR("() -> (RGBColor myColor)")},
6795 {"RealColor", (PyCFunction)Qd_RealColor, 1,
6796 PyDoc_STR("(RGBColor color) -> (Boolean _rv)")},
6797 {"GetSubTable", (PyCFunction)Qd_GetSubTable, 1,
6798 PyDoc_STR("(CTabHandle myColors, short iTabRes, CTabHandle targetTbl) -> None")},
6799 {"MakeITable", (PyCFunction)Qd_MakeITable, 1,
6800 PyDoc_STR("(CTabHandle cTabH, ITabHandle iTabH, short res) -> None")},
6801 {"SetClientID", (PyCFunction)Qd_SetClientID, 1,
6802 PyDoc_STR("(short id) -> None")},
6803 {"ProtectEntry", (PyCFunction)Qd_ProtectEntry, 1,
6804 PyDoc_STR("(short index, Boolean protect) -> None")},
6805 {"ReserveEntry", (PyCFunction)Qd_ReserveEntry, 1,
6806 PyDoc_STR("(short index, Boolean reserve) -> None")},
6807 {"QDError", (PyCFunction)Qd_QDError, 1,
6808 PyDoc_STR("() -> (short _rv)")},
6809 {"CopyDeepMask", (PyCFunction)Qd_CopyDeepMask, 1,
6810 PyDoc_STR("(BitMapPtr srcBits, BitMapPtr maskBits, BitMapPtr dstBits, Rect srcRect, Rect maskRect, Rect dstRect, short mode, RgnHandle maskRgn) -> None")},
6811 {"GetPattern", (PyCFunction)Qd_GetPattern, 1,
6812 PyDoc_STR("(short patternID) -> (PatHandle _rv)")},
6813 {"MacGetCursor", (PyCFunction)Qd_MacGetCursor, 1,
6814 PyDoc_STR("(short cursorID) -> (CursHandle _rv)")},
6815 {"GetPicture", (PyCFunction)Qd_GetPicture, 1,
6816 PyDoc_STR("(short pictureID) -> (PicHandle _rv)")},
6817 {"DeltaPoint", (PyCFunction)Qd_DeltaPoint, 1,
6818 PyDoc_STR("(Point ptA, Point ptB) -> (long _rv)")},
6819 {"ShieldCursor", (PyCFunction)Qd_ShieldCursor, 1,
6820 PyDoc_STR("(Rect shieldRect, Point offsetPt) -> None")},
6821 {"ScreenRes", (PyCFunction)Qd_ScreenRes, 1,
6822 PyDoc_STR("() -> (short scrnHRes, short scrnVRes)")},
6823 {"GetIndPattern", (PyCFunction)Qd_GetIndPattern, 1,
6824 PyDoc_STR("(short patternListID, short index) -> (Pattern thePat)")},
6825 {"SlopeFromAngle", (PyCFunction)Qd_SlopeFromAngle, 1,
6826 PyDoc_STR("(short angle) -> (Fixed _rv)")},
6827 {"AngleFromSlope", (PyCFunction)Qd_AngleFromSlope, 1,
6828 PyDoc_STR("(Fixed slope) -> (short _rv)")},
6830 #if TARGET_API_MAC_CARBON
6831 {"IsValidPort", (PyCFunction)Qd_IsValidPort, 1,
6832 PyDoc_STR("(CGrafPtr port) -> (Boolean _rv)")},
6833 #endif
6834 {"GetPortPixMap", (PyCFunction)Qd_GetPortPixMap, 1,
6835 PyDoc_STR("(CGrafPtr port) -> (PixMapHandle _rv)")},
6836 {"GetPortBitMapForCopyBits", (PyCFunction)Qd_GetPortBitMapForCopyBits, 1,
6837 PyDoc_STR("(CGrafPtr port) -> (const BitMap * _rv)")},
6838 {"GetPortBounds", (PyCFunction)Qd_GetPortBounds, 1,
6839 PyDoc_STR("(CGrafPtr port) -> (Rect rect)")},
6840 {"GetPortForeColor", (PyCFunction)Qd_GetPortForeColor, 1,
6841 PyDoc_STR("(CGrafPtr port) -> (RGBColor foreColor)")},
6842 {"GetPortBackColor", (PyCFunction)Qd_GetPortBackColor, 1,
6843 PyDoc_STR("(CGrafPtr port) -> (RGBColor backColor)")},
6844 {"GetPortOpColor", (PyCFunction)Qd_GetPortOpColor, 1,
6845 PyDoc_STR("(CGrafPtr port) -> (RGBColor opColor)")},
6846 {"GetPortHiliteColor", (PyCFunction)Qd_GetPortHiliteColor, 1,
6847 PyDoc_STR("(CGrafPtr port) -> (RGBColor hiliteColor)")},
6848 {"GetPortTextFont", (PyCFunction)Qd_GetPortTextFont, 1,
6849 PyDoc_STR("(CGrafPtr port) -> (short _rv)")},
6850 {"GetPortTextFace", (PyCFunction)Qd_GetPortTextFace, 1,
6851 PyDoc_STR("(CGrafPtr port) -> (Style _rv)")},
6852 {"GetPortTextMode", (PyCFunction)Qd_GetPortTextMode, 1,
6853 PyDoc_STR("(CGrafPtr port) -> (short _rv)")},
6854 {"GetPortTextSize", (PyCFunction)Qd_GetPortTextSize, 1,
6855 PyDoc_STR("(CGrafPtr port) -> (short _rv)")},
6856 {"GetPortChExtra", (PyCFunction)Qd_GetPortChExtra, 1,
6857 PyDoc_STR("(CGrafPtr port) -> (short _rv)")},
6858 {"GetPortFracHPenLocation", (PyCFunction)Qd_GetPortFracHPenLocation, 1,
6859 PyDoc_STR("(CGrafPtr port) -> (short _rv)")},
6860 {"GetPortSpExtra", (PyCFunction)Qd_GetPortSpExtra, 1,
6861 PyDoc_STR("(CGrafPtr port) -> (Fixed _rv)")},
6862 {"GetPortPenVisibility", (PyCFunction)Qd_GetPortPenVisibility, 1,
6863 PyDoc_STR("(CGrafPtr port) -> (short _rv)")},
6864 {"GetPortVisibleRegion", (PyCFunction)Qd_GetPortVisibleRegion, 1,
6865 PyDoc_STR("(CGrafPtr port, RgnHandle visRgn) -> (RgnHandle _rv)")},
6866 {"GetPortClipRegion", (PyCFunction)Qd_GetPortClipRegion, 1,
6867 PyDoc_STR("(CGrafPtr port, RgnHandle clipRgn) -> (RgnHandle _rv)")},
6868 {"GetPortBackPixPat", (PyCFunction)Qd_GetPortBackPixPat, 1,
6869 PyDoc_STR("(CGrafPtr port, PixPatHandle backPattern) -> (PixPatHandle _rv)")},
6870 {"GetPortPenPixPat", (PyCFunction)Qd_GetPortPenPixPat, 1,
6871 PyDoc_STR("(CGrafPtr port, PixPatHandle penPattern) -> (PixPatHandle _rv)")},
6872 {"GetPortFillPixPat", (PyCFunction)Qd_GetPortFillPixPat, 1,
6873 PyDoc_STR("(CGrafPtr port, PixPatHandle fillPattern) -> (PixPatHandle _rv)")},
6874 {"GetPortPenSize", (PyCFunction)Qd_GetPortPenSize, 1,
6875 PyDoc_STR("(CGrafPtr port, Point penSize) -> (Point penSize)")},
6876 {"GetPortPenMode", (PyCFunction)Qd_GetPortPenMode, 1,
6877 PyDoc_STR("(CGrafPtr port) -> (SInt32 _rv)")},
6878 {"GetPortPenLocation", (PyCFunction)Qd_GetPortPenLocation, 1,
6879 PyDoc_STR("(CGrafPtr port, Point penLocation) -> (Point penLocation)")},
6880 {"IsPortRegionBeingDefined", (PyCFunction)Qd_IsPortRegionBeingDefined, 1,
6881 PyDoc_STR("(CGrafPtr port) -> (Boolean _rv)")},
6882 {"IsPortPictureBeingDefined", (PyCFunction)Qd_IsPortPictureBeingDefined, 1,
6883 PyDoc_STR("(CGrafPtr port) -> (Boolean _rv)")},
6885 #if TARGET_API_MAC_CARBON
6886 {"IsPortPolyBeingDefined", (PyCFunction)Qd_IsPortPolyBeingDefined, 1,
6887 PyDoc_STR("(CGrafPtr port) -> (Boolean _rv)")},
6888 #endif
6890 #if TARGET_API_MAC_CARBON
6891 {"IsPortOffscreen", (PyCFunction)Qd_IsPortOffscreen, 1,
6892 PyDoc_STR("(CGrafPtr port) -> (Boolean _rv)")},
6893 #endif
6895 #if TARGET_API_MAC_CARBON
6896 {"IsPortColor", (PyCFunction)Qd_IsPortColor, 1,
6897 PyDoc_STR("(CGrafPtr port) -> (Boolean _rv)")},
6898 #endif
6899 {"SetPortBounds", (PyCFunction)Qd_SetPortBounds, 1,
6900 PyDoc_STR("(CGrafPtr port, Rect rect) -> None")},
6901 {"SetPortOpColor", (PyCFunction)Qd_SetPortOpColor, 1,
6902 PyDoc_STR("(CGrafPtr port, RGBColor opColor) -> None")},
6903 {"SetPortVisibleRegion", (PyCFunction)Qd_SetPortVisibleRegion, 1,
6904 PyDoc_STR("(CGrafPtr port, RgnHandle visRgn) -> None")},
6905 {"SetPortClipRegion", (PyCFunction)Qd_SetPortClipRegion, 1,
6906 PyDoc_STR("(CGrafPtr port, RgnHandle clipRgn) -> None")},
6907 {"SetPortPenPixPat", (PyCFunction)Qd_SetPortPenPixPat, 1,
6908 PyDoc_STR("(CGrafPtr port, PixPatHandle penPattern) -> None")},
6909 {"SetPortFillPixPat", (PyCFunction)Qd_SetPortFillPixPat, 1,
6910 PyDoc_STR("(CGrafPtr port, PixPatHandle penPattern) -> None")},
6911 {"SetPortBackPixPat", (PyCFunction)Qd_SetPortBackPixPat, 1,
6912 PyDoc_STR("(CGrafPtr port, PixPatHandle backPattern) -> None")},
6913 {"SetPortPenSize", (PyCFunction)Qd_SetPortPenSize, 1,
6914 PyDoc_STR("(CGrafPtr port, Point penSize) -> None")},
6915 {"SetPortPenMode", (PyCFunction)Qd_SetPortPenMode, 1,
6916 PyDoc_STR("(CGrafPtr port, SInt32 penMode) -> None")},
6917 {"SetPortFracHPenLocation", (PyCFunction)Qd_SetPortFracHPenLocation, 1,
6918 PyDoc_STR("(CGrafPtr port, short pnLocHFrac) -> None")},
6919 {"GetPixBounds", (PyCFunction)Qd_GetPixBounds, 1,
6920 PyDoc_STR("(PixMapHandle pixMap) -> (Rect bounds)")},
6921 {"GetPixDepth", (PyCFunction)Qd_GetPixDepth, 1,
6922 PyDoc_STR("(PixMapHandle pixMap) -> (short _rv)")},
6923 {"GetQDGlobalsRandomSeed", (PyCFunction)Qd_GetQDGlobalsRandomSeed, 1,
6924 PyDoc_STR("() -> (long _rv)")},
6925 {"GetQDGlobalsScreenBits", (PyCFunction)Qd_GetQDGlobalsScreenBits, 1,
6926 PyDoc_STR("() -> (BitMap screenBits)")},
6927 {"GetQDGlobalsArrow", (PyCFunction)Qd_GetQDGlobalsArrow, 1,
6928 PyDoc_STR("() -> (Cursor arrow)")},
6929 {"GetQDGlobalsDarkGray", (PyCFunction)Qd_GetQDGlobalsDarkGray, 1,
6930 PyDoc_STR("() -> (Pattern dkGray)")},
6931 {"GetQDGlobalsLightGray", (PyCFunction)Qd_GetQDGlobalsLightGray, 1,
6932 PyDoc_STR("() -> (Pattern ltGray)")},
6933 {"GetQDGlobalsGray", (PyCFunction)Qd_GetQDGlobalsGray, 1,
6934 PyDoc_STR("() -> (Pattern gray)")},
6935 {"GetQDGlobalsBlack", (PyCFunction)Qd_GetQDGlobalsBlack, 1,
6936 PyDoc_STR("() -> (Pattern black)")},
6937 {"GetQDGlobalsWhite", (PyCFunction)Qd_GetQDGlobalsWhite, 1,
6938 PyDoc_STR("() -> (Pattern white)")},
6939 {"GetQDGlobalsThePort", (PyCFunction)Qd_GetQDGlobalsThePort, 1,
6940 PyDoc_STR("() -> (CGrafPtr _rv)")},
6941 {"SetQDGlobalsRandomSeed", (PyCFunction)Qd_SetQDGlobalsRandomSeed, 1,
6942 PyDoc_STR("(long randomSeed) -> None")},
6943 {"SetQDGlobalsArrow", (PyCFunction)Qd_SetQDGlobalsArrow, 1,
6944 PyDoc_STR("(Cursor arrow) -> None")},
6945 {"GetRegionBounds", (PyCFunction)Qd_GetRegionBounds, 1,
6946 PyDoc_STR("(RgnHandle region) -> (Rect bounds)")},
6948 #if TARGET_API_MAC_CARBON
6949 {"IsRegionRectangular", (PyCFunction)Qd_IsRegionRectangular, 1,
6950 PyDoc_STR("(RgnHandle region) -> (Boolean _rv)")},
6951 #endif
6953 #if TARGET_API_MAC_CARBON
6954 {"CreateNewPort", (PyCFunction)Qd_CreateNewPort, 1,
6955 PyDoc_STR("() -> (CGrafPtr _rv)")},
6956 #endif
6958 #if TARGET_API_MAC_CARBON
6959 {"DisposePort", (PyCFunction)Qd_DisposePort, 1,
6960 PyDoc_STR("(CGrafPtr port) -> None")},
6961 #endif
6963 #if TARGET_API_MAC_CARBON
6964 {"SetQDError", (PyCFunction)Qd_SetQDError, 1,
6965 PyDoc_STR("(OSErr err) -> None")},
6966 #endif
6967 {"QDIsPortBuffered", (PyCFunction)Qd_QDIsPortBuffered, 1,
6968 PyDoc_STR("(CGrafPtr port) -> (Boolean _rv)")},
6969 {"QDIsPortBufferDirty", (PyCFunction)Qd_QDIsPortBufferDirty, 1,
6970 PyDoc_STR("(CGrafPtr port) -> (Boolean _rv)")},
6971 {"QDFlushPortBuffer", (PyCFunction)Qd_QDFlushPortBuffer, 1,
6972 PyDoc_STR("(CGrafPtr port, RgnHandle region) -> None")},
6974 #if TARGET_API_MAC_CARBON
6975 {"QDGetDirtyRegion", (PyCFunction)Qd_QDGetDirtyRegion, 1,
6976 PyDoc_STR("(CGrafPtr port, RgnHandle rgn) -> None")},
6977 #endif
6979 #if TARGET_API_MAC_CARBON
6980 {"QDSetDirtyRegion", (PyCFunction)Qd_QDSetDirtyRegion, 1,
6981 PyDoc_STR("(CGrafPtr port, RgnHandle rgn) -> None")},
6982 #endif
6983 {"LMGetScrVRes", (PyCFunction)Qd_LMGetScrVRes, 1,
6984 PyDoc_STR("() -> (SInt16 _rv)")},
6985 {"LMSetScrVRes", (PyCFunction)Qd_LMSetScrVRes, 1,
6986 PyDoc_STR("(SInt16 value) -> None")},
6987 {"LMGetScrHRes", (PyCFunction)Qd_LMGetScrHRes, 1,
6988 PyDoc_STR("() -> (SInt16 _rv)")},
6989 {"LMSetScrHRes", (PyCFunction)Qd_LMSetScrHRes, 1,
6990 PyDoc_STR("(SInt16 value) -> None")},
6991 {"LMGetMainDevice", (PyCFunction)Qd_LMGetMainDevice, 1,
6992 PyDoc_STR("() -> (GDHandle _rv)")},
6993 {"LMSetMainDevice", (PyCFunction)Qd_LMSetMainDevice, 1,
6994 PyDoc_STR("(GDHandle value) -> None")},
6995 {"LMGetDeviceList", (PyCFunction)Qd_LMGetDeviceList, 1,
6996 PyDoc_STR("() -> (GDHandle _rv)")},
6997 {"LMSetDeviceList", (PyCFunction)Qd_LMSetDeviceList, 1,
6998 PyDoc_STR("(GDHandle value) -> None")},
6999 {"LMGetQDColors", (PyCFunction)Qd_LMGetQDColors, 1,
7000 PyDoc_STR("() -> (Handle _rv)")},
7001 {"LMSetQDColors", (PyCFunction)Qd_LMSetQDColors, 1,
7002 PyDoc_STR("(Handle value) -> None")},
7003 {"LMGetWidthListHand", (PyCFunction)Qd_LMGetWidthListHand, 1,
7004 PyDoc_STR("() -> (Handle _rv)")},
7005 {"LMSetWidthListHand", (PyCFunction)Qd_LMSetWidthListHand, 1,
7006 PyDoc_STR("(Handle value) -> None")},
7007 {"LMGetHiliteMode", (PyCFunction)Qd_LMGetHiliteMode, 1,
7008 PyDoc_STR("() -> (UInt8 _rv)")},
7009 {"LMSetHiliteMode", (PyCFunction)Qd_LMSetHiliteMode, 1,
7010 PyDoc_STR("(UInt8 value) -> None")},
7011 {"LMGetWidthTabHandle", (PyCFunction)Qd_LMGetWidthTabHandle, 1,
7012 PyDoc_STR("() -> (Handle _rv)")},
7013 {"LMSetWidthTabHandle", (PyCFunction)Qd_LMSetWidthTabHandle, 1,
7014 PyDoc_STR("(Handle value) -> None")},
7015 {"LMGetLastSPExtra", (PyCFunction)Qd_LMGetLastSPExtra, 1,
7016 PyDoc_STR("() -> (SInt32 _rv)")},
7017 {"LMSetLastSPExtra", (PyCFunction)Qd_LMSetLastSPExtra, 1,
7018 PyDoc_STR("(SInt32 value) -> None")},
7019 {"LMGetLastFOND", (PyCFunction)Qd_LMGetLastFOND, 1,
7020 PyDoc_STR("() -> (Handle _rv)")},
7021 {"LMSetLastFOND", (PyCFunction)Qd_LMSetLastFOND, 1,
7022 PyDoc_STR("(Handle value) -> None")},
7023 {"LMGetFractEnable", (PyCFunction)Qd_LMGetFractEnable, 1,
7024 PyDoc_STR("() -> (UInt8 _rv)")},
7025 {"LMSetFractEnable", (PyCFunction)Qd_LMSetFractEnable, 1,
7026 PyDoc_STR("(UInt8 value) -> None")},
7027 {"LMGetTheGDevice", (PyCFunction)Qd_LMGetTheGDevice, 1,
7028 PyDoc_STR("() -> (GDHandle _rv)")},
7029 {"LMSetTheGDevice", (PyCFunction)Qd_LMSetTheGDevice, 1,
7030 PyDoc_STR("(GDHandle value) -> None")},
7031 {"LMGetHiliteRGB", (PyCFunction)Qd_LMGetHiliteRGB, 1,
7032 PyDoc_STR("() -> (RGBColor hiliteRGBValue)")},
7033 {"LMSetHiliteRGB", (PyCFunction)Qd_LMSetHiliteRGB, 1,
7034 PyDoc_STR("(RGBColor hiliteRGBValue) -> None")},
7035 {"LMGetCursorNew", (PyCFunction)Qd_LMGetCursorNew, 1,
7036 PyDoc_STR("() -> (Boolean _rv)")},
7037 {"LMSetCursorNew", (PyCFunction)Qd_LMSetCursorNew, 1,
7038 PyDoc_STR("(Boolean value) -> None")},
7039 {"TextFont", (PyCFunction)Qd_TextFont, 1,
7040 PyDoc_STR("(short font) -> None")},
7041 {"TextFace", (PyCFunction)Qd_TextFace, 1,
7042 PyDoc_STR("(StyleParameter face) -> None")},
7043 {"TextMode", (PyCFunction)Qd_TextMode, 1,
7044 PyDoc_STR("(short mode) -> None")},
7045 {"TextSize", (PyCFunction)Qd_TextSize, 1,
7046 PyDoc_STR("(short size) -> None")},
7047 {"SpaceExtra", (PyCFunction)Qd_SpaceExtra, 1,
7048 PyDoc_STR("(Fixed extra) -> None")},
7049 {"DrawChar", (PyCFunction)Qd_DrawChar, 1,
7050 PyDoc_STR("(CharParameter ch) -> None")},
7051 {"DrawString", (PyCFunction)Qd_DrawString, 1,
7052 PyDoc_STR("(Str255 s) -> None")},
7053 {"MacDrawText", (PyCFunction)Qd_MacDrawText, 1,
7054 PyDoc_STR("(Buffer textBuf, short firstByte, short byteCount) -> None")},
7055 {"CharWidth", (PyCFunction)Qd_CharWidth, 1,
7056 PyDoc_STR("(CharParameter ch) -> (short _rv)")},
7057 {"StringWidth", (PyCFunction)Qd_StringWidth, 1,
7058 PyDoc_STR("(Str255 s) -> (short _rv)")},
7059 {"TextWidth", (PyCFunction)Qd_TextWidth, 1,
7060 PyDoc_STR("(Buffer textBuf, short firstByte, short byteCount) -> (short _rv)")},
7061 {"GetFontInfo", (PyCFunction)Qd_GetFontInfo, 1,
7062 PyDoc_STR("() -> (FontInfo info)")},
7063 {"CharExtra", (PyCFunction)Qd_CharExtra, 1,
7064 PyDoc_STR("(Fixed extra) -> None")},
7065 {"TruncString", (PyCFunction)Qd_TruncString, 1,
7066 PyDoc_STR("(short width, Str255 theString, TruncCode truncWhere) -> (short _rv)")},
7067 {"SetPort", (PyCFunction)Qd_SetPort, 1,
7068 PyDoc_STR("(GrafPtr thePort) -> None")},
7069 {"GetCursor", (PyCFunction)Qd_GetCursor, 1,
7070 PyDoc_STR("(short cursorID) -> (CursHandle _rv)")},
7071 {"SetCursor", (PyCFunction)Qd_SetCursor, 1,
7072 PyDoc_STR("(Cursor crsr) -> None")},
7073 {"ShowCursor", (PyCFunction)Qd_ShowCursor, 1,
7074 PyDoc_STR("() -> None")},
7075 {"LineTo", (PyCFunction)Qd_LineTo, 1,
7076 PyDoc_STR("(short h, short v) -> None")},
7077 {"SetRect", (PyCFunction)Qd_SetRect, 1,
7078 PyDoc_STR("(short left, short top, short right, short bottom) -> (Rect r)")},
7079 {"OffsetRect", (PyCFunction)Qd_OffsetRect, 1,
7080 PyDoc_STR("(Rect r, short dh, short dv) -> (Rect r)")},
7081 {"InsetRect", (PyCFunction)Qd_InsetRect, 1,
7082 PyDoc_STR("(Rect r, short dh, short dv) -> (Rect r)")},
7083 {"UnionRect", (PyCFunction)Qd_UnionRect, 1,
7084 PyDoc_STR("(Rect src1, Rect src2) -> (Rect dstRect)")},
7085 {"EqualRect", (PyCFunction)Qd_EqualRect, 1,
7086 PyDoc_STR("(Rect rect1, Rect rect2) -> (Boolean _rv)")},
7087 {"FrameRect", (PyCFunction)Qd_FrameRect, 1,
7088 PyDoc_STR("(Rect r) -> None")},
7089 {"InvertRect", (PyCFunction)Qd_InvertRect, 1,
7090 PyDoc_STR("(Rect r) -> None")},
7091 {"FillRect", (PyCFunction)Qd_FillRect, 1,
7092 PyDoc_STR("(Rect r, Pattern pat) -> None")},
7093 {"CopyRgn", (PyCFunction)Qd_CopyRgn, 1,
7094 PyDoc_STR("(RgnHandle srcRgn, RgnHandle dstRgn) -> None")},
7095 {"SetRectRgn", (PyCFunction)Qd_SetRectRgn, 1,
7096 PyDoc_STR("(RgnHandle rgn, short left, short top, short right, short bottom) -> None")},
7097 {"OffsetRgn", (PyCFunction)Qd_OffsetRgn, 1,
7098 PyDoc_STR("(RgnHandle rgn, short dh, short dv) -> None")},
7099 {"UnionRgn", (PyCFunction)Qd_UnionRgn, 1,
7100 PyDoc_STR("(RgnHandle srcRgnA, RgnHandle srcRgnB, RgnHandle dstRgn) -> None")},
7101 {"XorRgn", (PyCFunction)Qd_XorRgn, 1,
7102 PyDoc_STR("(RgnHandle srcRgnA, RgnHandle srcRgnB, RgnHandle dstRgn) -> None")},
7103 {"EqualRgn", (PyCFunction)Qd_EqualRgn, 1,
7104 PyDoc_STR("(RgnHandle rgnA, RgnHandle rgnB) -> (Boolean _rv)")},
7105 {"FrameRgn", (PyCFunction)Qd_FrameRgn, 1,
7106 PyDoc_STR("(RgnHandle rgn) -> None")},
7107 {"PaintRgn", (PyCFunction)Qd_PaintRgn, 1,
7108 PyDoc_STR("(RgnHandle rgn) -> None")},
7109 {"InvertRgn", (PyCFunction)Qd_InvertRgn, 1,
7110 PyDoc_STR("(RgnHandle rgn) -> None")},
7111 {"FillRgn", (PyCFunction)Qd_FillRgn, 1,
7112 PyDoc_STR("(RgnHandle rgn, Pattern pat) -> None")},
7113 {"GetPixel", (PyCFunction)Qd_GetPixel, 1,
7114 PyDoc_STR("(short h, short v) -> (Boolean _rv)")},
7115 {"PtInRect", (PyCFunction)Qd_PtInRect, 1,
7116 PyDoc_STR("(Point pt, Rect r) -> (Boolean _rv)")},
7117 {"DrawText", (PyCFunction)Qd_DrawText, 1,
7118 PyDoc_STR("(Buffer textBuf, short firstByte, short byteCount) -> None")},
7119 {"BitMap", (PyCFunction)Qd_BitMap, 1,
7120 PyDoc_STR("Take (string, int, Rect) argument and create BitMap")},
7121 {"RawBitMap", (PyCFunction)Qd_RawBitMap, 1,
7122 PyDoc_STR("Take string BitMap and turn into BitMap object")},
7123 {NULL, NULL, 0}
7128 /* Like BMObj_New, but the original bitmap data structure is copied (and
7129 ** released when the object is released)
7131 PyObject *BMObj_NewCopied(BitMapPtr itself)
7133 BitMapObject *it;
7134 BitMapPtr itself_copy;
7136 if ((itself_copy=(BitMapPtr)malloc(sizeof(BitMap))) == NULL)
7137 return PyErr_NoMemory();
7138 *itself_copy = *itself;
7139 it = (BitMapObject *)BMObj_New(itself_copy);
7140 it->referred_bitmap = itself_copy;
7141 return (PyObject *)it;
7146 void init_Qd(void)
7148 PyObject *m;
7149 PyObject *d;
7153 PyMac_INIT_TOOLBOX_OBJECT_NEW(BitMapPtr, BMObj_New);
7154 PyMac_INIT_TOOLBOX_OBJECT_CONVERT(BitMapPtr, BMObj_Convert);
7155 PyMac_INIT_TOOLBOX_OBJECT_NEW(GrafPtr, GrafObj_New);
7156 PyMac_INIT_TOOLBOX_OBJECT_CONVERT(GrafPtr, GrafObj_Convert);
7157 PyMac_INIT_TOOLBOX_OBJECT_NEW(RGBColorPtr, QdRGB_New);
7158 PyMac_INIT_TOOLBOX_OBJECT_CONVERT(RGBColor, QdRGB_Convert);
7161 m = Py_InitModule("_Qd", Qd_methods);
7162 d = PyModule_GetDict(m);
7163 Qd_Error = PyMac_GetOSErrException();
7164 if (Qd_Error == NULL ||
7165 PyDict_SetItemString(d, "Error", Qd_Error) != 0)
7166 return;
7167 GrafPort_Type.ob_type = &PyType_Type;
7168 Py_INCREF(&GrafPort_Type);
7169 if (PyDict_SetItemString(d, "GrafPortType", (PyObject *)&GrafPort_Type) != 0)
7170 Py_FatalError("can't initialize GrafPortType");
7171 BitMap_Type.ob_type = &PyType_Type;
7172 Py_INCREF(&BitMap_Type);
7173 if (PyDict_SetItemString(d, "BitMapType", (PyObject *)&BitMap_Type) != 0)
7174 Py_FatalError("can't initialize BitMapType");
7175 QDGlobalsAccess_Type.ob_type = &PyType_Type;
7176 Py_INCREF(&QDGlobalsAccess_Type);
7177 if (PyDict_SetItemString(d, "QDGlobalsAccessType", (PyObject *)&QDGlobalsAccess_Type) != 0)
7178 Py_FatalError("can't initialize QDGlobalsAccessType");
7181 PyObject *o;
7183 o = QDGA_New();
7184 if (o == NULL || PyDict_SetItemString(d, "qd", o) != 0)
7185 return;
7191 /* ========================= End module _Qd ========================= */