blob: 299c9ca6992be6bc7e6f80d3621746838a713736 [file] [log] [blame]
Guido van Rossum17448e21995-01-30 11:53:55 +00001
2/* =========================== Module Qd ============================ */
3
4#include "Python.h"
5
6
7
8#define SystemSevenOrLater 1
9
10#include "macglue.h"
11#include <Memory.h>
12#include <Dialogs.h>
13#include <Menus.h>
14#include <Controls.h>
15
16extern PyObject *ResObj_New(Handle);
17extern int ResObj_Convert(PyObject *, Handle *);
Jack Jansen425e9eb1995-12-12 15:02:03 +000018extern PyObject *OptResObj_New(Handle);
19extern int OptResObj_Convert(PyObject *, Handle *);
Guido van Rossum17448e21995-01-30 11:53:55 +000020
21extern PyObject *WinObj_New(WindowPtr);
22extern int WinObj_Convert(PyObject *, WindowPtr *);
Jack Jansen330381c1995-11-15 15:18:01 +000023extern PyTypeObject Window_Type;
24#define WinObj_Check(x) ((x)->ob_type == &Window_Type)
Guido van Rossum17448e21995-01-30 11:53:55 +000025
26extern PyObject *DlgObj_New(DialogPtr);
27extern int DlgObj_Convert(PyObject *, DialogPtr *);
28extern PyTypeObject Dialog_Type;
29#define DlgObj_Check(x) ((x)->ob_type == &Dialog_Type)
30
31extern PyObject *MenuObj_New(MenuHandle);
32extern int MenuObj_Convert(PyObject *, MenuHandle *);
33
34extern PyObject *CtlObj_New(ControlHandle);
35extern int CtlObj_Convert(PyObject *, ControlHandle *);
36
Jack Jansen330381c1995-11-15 15:18:01 +000037extern PyObject *GrafObj_New(GrafPtr);
38extern int GrafObj_Convert(PyObject *, GrafPtr *);
39
Jack Jansen41058c01995-11-16 22:48:29 +000040extern PyObject *BMObj_New(BitMapPtr);
41extern int BMObj_Convert(PyObject *, BitMapPtr *);
42
Guido van Rossum17448e21995-01-30 11:53:55 +000043extern PyObject *WinObj_WhichWindow(WindowPtr);
44
45#include <QuickDraw.h>
Guido van Rossum17448e21995-01-30 11:53:55 +000046
47#define resNotFound -192 /* Can't include <Errors.h> because of Python's "errors.h" */
48
Jack Jansen232f3cd1995-12-09 14:04:31 +000049/*
50** Parse/generate RGB records
51*/
52PyObject *QdRGB_New(itself)
53 RGBColorPtr itself;
54{
55
56 return Py_BuildValue("lll", (long)itself->red, (long)itself->green, (long)itself->blue);
57}
58
59QdRGB_Convert(v, p_itself)
60 PyObject *v;
61 RGBColorPtr p_itself;
62{
63 long red, green, blue;
64
65 if( !PyArg_ParseTuple(v, "lll", &red, &green, &blue) )
66 return 0;
67 p_itself->red = (unsigned short)red;
68 p_itself->green = (unsigned short)green;
69 p_itself->blue = (unsigned short)blue;
70 return 1;
71}
72
Jack Jansen3a50f8a1996-01-11 16:17:14 +000073/*
74** Generate FontInfo records
75*/
76static
77PyObject *QdFI_New(itself)
78 FontInfo *itself;
79{
80
81 return Py_BuildValue("hhhh", itself->ascent, itself->descent,
82 itself->widMax, itself->leading);
83}
84
85
Jack Jansen232f3cd1995-12-09 14:04:31 +000086
Guido van Rossum17448e21995-01-30 11:53:55 +000087static PyObject *Qd_Error;
88
Jack Jansen330381c1995-11-15 15:18:01 +000089/* ---------------------- Object type GrafPort ---------------------- */
90
91PyTypeObject GrafPort_Type;
92
93#define GrafObj_Check(x) ((x)->ob_type == &GrafPort_Type)
94
95typedef struct GrafPortObject {
96 PyObject_HEAD
97 GrafPtr ob_itself;
98} GrafPortObject;
99
100PyObject *GrafObj_New(itself)
101 GrafPtr itself;
Guido van Rossum17448e21995-01-30 11:53:55 +0000102{
Jack Jansen330381c1995-11-15 15:18:01 +0000103 GrafPortObject *it;
104 if (itself == NULL) return PyMac_Error(resNotFound);
105 it = PyObject_NEW(GrafPortObject, &GrafPort_Type);
106 if (it == NULL) return NULL;
107 it->ob_itself = itself;
108 return (PyObject *)it;
109}
110GrafObj_Convert(v, p_itself)
111 PyObject *v;
112 GrafPtr *p_itself;
113{
114 if (DlgObj_Check(v) || WinObj_Check(v)) {
115 *p_itself = ((GrafPortObject *)v)->ob_itself;
116 return 1;
117 }
118 if (!GrafObj_Check(v))
119 {
120 PyErr_SetString(PyExc_TypeError, "GrafPort required");
121 return 0;
122 }
123 *p_itself = ((GrafPortObject *)v)->ob_itself;
124 return 1;
Guido van Rossum17448e21995-01-30 11:53:55 +0000125}
126
Jack Jansen330381c1995-11-15 15:18:01 +0000127static void GrafObj_dealloc(self)
128 GrafPortObject *self;
Guido van Rossum17448e21995-01-30 11:53:55 +0000129{
Jack Jansen330381c1995-11-15 15:18:01 +0000130 /* Cleanup of self->ob_itself goes here */
131 PyMem_DEL(self);
Guido van Rossume56db431995-03-19 22:49:50 +0000132}
133
Jack Jansen330381c1995-11-15 15:18:01 +0000134static PyMethodDef GrafObj_methods[] = {
135 {NULL, NULL, 0}
136};
137
138PyMethodChain GrafObj_chain = { GrafObj_methods, NULL };
139
140static PyObject *GrafObj_getattr(self, name)
141 GrafPortObject *self;
142 char *name;
Guido van Rossume56db431995-03-19 22:49:50 +0000143{
Jack Jansen3a50f8a1996-01-11 16:17:14 +0000144
145 { CGrafPtr itself_color = (CGrafPtr)self->ob_itself;
Jack Jansen330381c1995-11-15 15:18:01 +0000146
Jack Jansen3a50f8a1996-01-11 16:17:14 +0000147 if ( strcmp(name, "data") == 0 )
148 return PyString_FromStringAndSize((char *)self->ob_itself, sizeof(GrafPort));
149
150 if ( (itself_color->portVersion&0xc000) == 0xc000 ) {
151 /* Color-only attributes */
152
153 if ( strcmp(name, "portBits") == 0 )
154 /* XXXX Do we need HLock() stuff here?? */
155 return BMObj_New((BitMapPtr)*itself_color->portPixMap);
156 if ( strcmp(name, "grafVars") == 0 )
157 return Py_BuildValue("O&", ResObj_New, (Handle)itself_color->visRgn);
158 if ( strcmp(name, "chExtra") == 0 )
159 return Py_BuildValue("h", itself_color->chExtra);
160 if ( strcmp(name, "pnLocHFrac") == 0 )
161 return Py_BuildValue("h", itself_color->pnLocHFrac);
Jack Jansen61f3df41996-01-15 14:39:56 +0000162 if ( strcmp(name, "bkPixPat") == 0 )
163 return Py_BuildValue("O&", ResObj_New, (Handle)itself_color->bkPixPat);
164 if ( strcmp(name, "rgbFgColor") == 0 )
165 return Py_BuildValue("O&", QdRGB_New, &itself_color->rgbFgColor);
166 if ( strcmp(name, "rgbBkColor") == 0 )
167 return Py_BuildValue("O&", QdRGB_New, &itself_color->rgbBkColor);
168 if ( strcmp(name, "pnPixPat") == 0 )
169 return Py_BuildValue("O&", ResObj_New, (Handle)itself_color->pnPixPat);
170 if ( strcmp(name, "fillPixPat") == 0 )
171 return Py_BuildValue("O&", ResObj_New, (Handle)itself_color->fillPixPat);
Jack Jansen3a50f8a1996-01-11 16:17:14 +0000172 } else {
173 /* Mono-only attributes */
174 if ( strcmp(name, "portBits") == 0 )
175 return BMObj_New(&self->ob_itself->portBits);
Jack Jansen61f3df41996-01-15 14:39:56 +0000176 if ( strcmp(name, "bkPat") == 0 )
177 return Py_BuildValue("s#", (char *)&self->ob_itself->bkPat, sizeof(Pattern));
178 if ( strcmp(name, "fillPat") == 0 )
179 return Py_BuildValue("s#", (char *)&self->ob_itself->fillPat, sizeof(Pattern));
180 if ( strcmp(name, "pnPat") == 0 )
181 return Py_BuildValue("s#", (char *)&self->ob_itself->pnPat, sizeof(Pattern));
Jack Jansen3a50f8a1996-01-11 16:17:14 +0000182 }
183 /*
184 ** Accessible for both color/mono windows.
185 ** portVersion is really color-only, but we put it here
186 ** for convenience
187 */
188 if ( strcmp(name, "portVersion") == 0 )
189 return Py_BuildValue("h", itself_color->portVersion);
190 if ( strcmp(name, "device") == 0 )
191 return PyInt_FromLong((long)self->ob_itself->device);
192 if ( strcmp(name, "portRect") == 0 )
193 return Py_BuildValue("O&", PyMac_BuildRect, &self->ob_itself->portRect);
194 if ( strcmp(name, "visRgn") == 0 )
195 return Py_BuildValue("O&", ResObj_New, (Handle)self->ob_itself->visRgn);
196 if ( strcmp(name, "clipRgn") == 0 )
197 return Py_BuildValue("O&", ResObj_New, (Handle)self->ob_itself->clipRgn);
Jack Jansen3a50f8a1996-01-11 16:17:14 +0000198 if ( strcmp(name, "pnLoc") == 0 )
199 return Py_BuildValue("O&", PyMac_BuildPoint, self->ob_itself->pnLoc);
200 if ( strcmp(name, "pnSize") == 0 )
201 return Py_BuildValue("O&", PyMac_BuildPoint, self->ob_itself->pnSize);
202 if ( strcmp(name, "pnMode") == 0 )
203 return Py_BuildValue("h", self->ob_itself->pnMode);
Jack Jansen3a50f8a1996-01-11 16:17:14 +0000204 if ( strcmp(name, "pnVis") == 0 )
205 return Py_BuildValue("h", self->ob_itself->pnVis);
206 if ( strcmp(name, "txFont") == 0 )
207 return Py_BuildValue("h", self->ob_itself->txFont);
208 if ( strcmp(name, "txFace") == 0 )
209 return Py_BuildValue("h", (short)self->ob_itself->txFace);
210 if ( strcmp(name, "txMode") == 0 )
211 return Py_BuildValue("h", self->ob_itself->txMode);
212 if ( strcmp(name, "txSize") == 0 )
213 return Py_BuildValue("h", self->ob_itself->txSize);
214 if ( strcmp(name, "spExtra") == 0 )
215 return Py_BuildValue("O&", PyMac_BuildFixed, self->ob_itself->spExtra);
216 /* XXXX Add more, as needed */
Jack Jansen3355be31996-05-08 15:33:20 +0000217 /* This one is so we can compare grafports: */
218 if ( strcmp(name, "_id") == 0 )
219 return Py_BuildValue("l", (long)self->ob_itself);
Jack Jansen3a50f8a1996-01-11 16:17:14 +0000220 }
Jack Jansen330381c1995-11-15 15:18:01 +0000221 return Py_FindMethodInChain(&GrafObj_chain, (PyObject *)self, name);
Guido van Rossum17448e21995-01-30 11:53:55 +0000222}
223
Jack Jansen330381c1995-11-15 15:18:01 +0000224#define GrafObj_setattr NULL
225
Jack Jansena05ac601999-12-12 21:41:51 +0000226#define GrafObj_compare NULL
227
228#define GrafObj_repr NULL
229
230#define GrafObj_hash NULL
231
Jack Jansen330381c1995-11-15 15:18:01 +0000232PyTypeObject GrafPort_Type = {
233 PyObject_HEAD_INIT(&PyType_Type)
234 0, /*ob_size*/
235 "GrafPort", /*tp_name*/
236 sizeof(GrafPortObject), /*tp_basicsize*/
237 0, /*tp_itemsize*/
238 /* methods */
239 (destructor) GrafObj_dealloc, /*tp_dealloc*/
240 0, /*tp_print*/
241 (getattrfunc) GrafObj_getattr, /*tp_getattr*/
242 (setattrfunc) GrafObj_setattr, /*tp_setattr*/
Jack Jansena05ac601999-12-12 21:41:51 +0000243 (cmpfunc) GrafObj_compare, /*tp_compare*/
244 (reprfunc) GrafObj_repr, /*tp_repr*/
245 (PyNumberMethods *)0, /* tp_as_number */
246 (PySequenceMethods *)0, /* tp_as_sequence */
247 (PyMappingMethods *)0, /* tp_as_mapping */
248 (hashfunc) GrafObj_hash, /*tp_hash*/
Jack Jansen330381c1995-11-15 15:18:01 +0000249};
250
251/* -------------------- End object type GrafPort -------------------- */
252
253
Jack Jansen41058c01995-11-16 22:48:29 +0000254/* ----------------------- Object type BitMap ----------------------- */
255
256PyTypeObject BitMap_Type;
257
258#define BMObj_Check(x) ((x)->ob_type == &BitMap_Type)
259
260typedef struct BitMapObject {
261 PyObject_HEAD
262 BitMapPtr ob_itself;
263 PyObject *referred_object;
264 BitMap *referred_bitmap;
265} BitMapObject;
266
267PyObject *BMObj_New(itself)
268 BitMapPtr itself;
269{
270 BitMapObject *it;
271 if (itself == NULL) return PyMac_Error(resNotFound);
272 it = PyObject_NEW(BitMapObject, &BitMap_Type);
273 if (it == NULL) return NULL;
274 it->ob_itself = itself;
275 it->referred_object = NULL;
276 it->referred_bitmap = NULL;
277 return (PyObject *)it;
278}
279BMObj_Convert(v, p_itself)
280 PyObject *v;
281 BitMapPtr *p_itself;
282{
283 if (!BMObj_Check(v))
284 {
285 PyErr_SetString(PyExc_TypeError, "BitMap required");
286 return 0;
287 }
288 *p_itself = ((BitMapObject *)v)->ob_itself;
289 return 1;
290}
291
292static void BMObj_dealloc(self)
293 BitMapObject *self;
294{
295 Py_XDECREF(self->referred_object);
296 if (self->referred_bitmap) free(self->referred_bitmap);
297 PyMem_DEL(self);
298}
299
Jack Jansen484be612000-03-03 16:01:11 +0000300static PyObject *BMObj_getdata(_self, _args)
301 BitMapObject *_self;
302 PyObject *_args;
303{
304 PyObject *_res = NULL;
305
306 int from, length;
307 char *cp;
308
309 if ( !PyArg_ParseTuple(_args, "ii", &from, &length) )
310 return NULL;
311 cp = _self->ob_itself->baseAddr+from;
312 return PyString_FromStringAndSize(cp, length);
313
314}
315
316static PyObject *BMObj_putdata(_self, _args)
317 BitMapObject *_self;
318 PyObject *_args;
319{
320 PyObject *_res = NULL;
321
322 int from, length;
323 char *cp, *icp;
324
325 if ( !PyArg_ParseTuple(_args, "is#", &from, &icp, &length) )
326 return NULL;
327 cp = _self->ob_itself->baseAddr+from;
328 memcpy(cp, icp, length);
329 Py_INCREF(Py_None);
330 return Py_None;
331
332}
333
Jack Jansen41058c01995-11-16 22:48:29 +0000334static PyMethodDef BMObj_methods[] = {
Jack Jansen484be612000-03-03 16:01:11 +0000335 {"getdata", (PyCFunction)BMObj_getdata, 1,
336 "(int start, int size) -> string. Return bytes from the bitmap"},
337 {"putdata", (PyCFunction)BMObj_putdata, 1,
338 "(int start, string data). Store bytes into the bitmap"},
Jack Jansen41058c01995-11-16 22:48:29 +0000339 {NULL, NULL, 0}
340};
341
342PyMethodChain BMObj_chain = { BMObj_methods, NULL };
343
344static PyObject *BMObj_getattr(self, name)
345 BitMapObject *self;
346 char *name;
347{
348 if ( strcmp(name, "baseAddr") == 0 )
349 return PyInt_FromLong((long)self->ob_itself->baseAddr);
350 if ( strcmp(name, "rowBytes") == 0 )
351 return PyInt_FromLong((long)self->ob_itself->rowBytes);
352 if ( strcmp(name, "bounds") == 0 )
353 return Py_BuildValue("O&", PyMac_BuildRect, &self->ob_itself->bounds);
354 /* XXXX Add more, as needed */
Jack Jansen425e9eb1995-12-12 15:02:03 +0000355 if ( strcmp(name, "bitmap_data") == 0 )
356 return PyString_FromStringAndSize((char *)self->ob_itself, sizeof(BitMap));
357 if ( strcmp(name, "pixmap_data") == 0 )
358 return PyString_FromStringAndSize((char *)self->ob_itself, sizeof(PixMap));
Jack Jansen41058c01995-11-16 22:48:29 +0000359
360 return Py_FindMethodInChain(&BMObj_chain, (PyObject *)self, name);
361}
362
363#define BMObj_setattr NULL
364
Jack Jansena05ac601999-12-12 21:41:51 +0000365#define BMObj_compare NULL
366
367#define BMObj_repr NULL
368
369#define BMObj_hash NULL
370
Jack Jansen41058c01995-11-16 22:48:29 +0000371PyTypeObject BitMap_Type = {
372 PyObject_HEAD_INIT(&PyType_Type)
373 0, /*ob_size*/
374 "BitMap", /*tp_name*/
375 sizeof(BitMapObject), /*tp_basicsize*/
376 0, /*tp_itemsize*/
377 /* methods */
378 (destructor) BMObj_dealloc, /*tp_dealloc*/
379 0, /*tp_print*/
380 (getattrfunc) BMObj_getattr, /*tp_getattr*/
381 (setattrfunc) BMObj_setattr, /*tp_setattr*/
Jack Jansena05ac601999-12-12 21:41:51 +0000382 (cmpfunc) BMObj_compare, /*tp_compare*/
383 (reprfunc) BMObj_repr, /*tp_repr*/
384 (PyNumberMethods *)0, /* tp_as_number */
385 (PySequenceMethods *)0, /* tp_as_sequence */
386 (PyMappingMethods *)0, /* tp_as_mapping */
387 (hashfunc) BMObj_hash, /*tp_hash*/
Jack Jansen41058c01995-11-16 22:48:29 +0000388};
389
390/* --------------------- End object type BitMap --------------------- */
391
392
Jack Jansenbdd07471996-01-29 15:44:03 +0000393/* ------------------ Object type QDGlobalsAccess ------------------- */
394
395staticforward PyTypeObject QDGlobalsAccess_Type;
396
397#define QDGA_Check(x) ((x)->ob_type == &QDGlobalsAccess_Type)
398
399typedef struct QDGlobalsAccessObject {
400 PyObject_HEAD
401} QDGlobalsAccessObject;
402
403static PyObject *QDGA_New()
404{
405 QDGlobalsAccessObject *it;
406 it = PyObject_NEW(QDGlobalsAccessObject, &QDGlobalsAccess_Type);
407 if (it == NULL) return NULL;
408 return (PyObject *)it;
409}
410
411static void QDGA_dealloc(self)
412 QDGlobalsAccessObject *self;
413{
414 PyMem_DEL(self);
415}
416
417static PyMethodDef QDGA_methods[] = {
418 {NULL, NULL, 0}
419};
420
421static PyMethodChain QDGA_chain = { QDGA_methods, NULL };
422
423static PyObject *QDGA_getattr(self, name)
424 QDGlobalsAccessObject *self;
425 char *name;
426{
427
428 if ( strcmp(name, "arrow") == 0 )
429 return PyString_FromStringAndSize((char *)&qd.arrow, sizeof(qd.arrow));
430 if ( strcmp(name, "black") == 0 )
431 return PyString_FromStringAndSize((char *)&qd.black, sizeof(qd.black));
432 if ( strcmp(name, "white") == 0 )
433 return PyString_FromStringAndSize((char *)&qd.white, sizeof(qd.white));
434 if ( strcmp(name, "gray") == 0 )
435 return PyString_FromStringAndSize((char *)&qd.gray, sizeof(qd.gray));
436 if ( strcmp(name, "ltGray") == 0 )
437 return PyString_FromStringAndSize((char *)&qd.ltGray, sizeof(qd.ltGray));
438 if ( strcmp(name, "dkGray") == 0 )
439 return PyString_FromStringAndSize((char *)&qd.dkGray, sizeof(qd.dkGray));
440 if ( strcmp(name, "screenBits") == 0 )
441 return BMObj_New(&qd.screenBits);
442 if ( strcmp(name, "thePort") == 0 )
443 return GrafObj_New(qd.thePort);
444 if ( strcmp(name, "randSeed") == 0 )
445 return Py_BuildValue("l", &qd.randSeed);
446
447 return Py_FindMethodInChain(&QDGA_chain, (PyObject *)self, name);
448}
449
450#define QDGA_setattr NULL
451
Jack Jansena05ac601999-12-12 21:41:51 +0000452#define QDGA_compare NULL
453
454#define QDGA_repr NULL
455
456#define QDGA_hash NULL
457
Jack Jansenbdd07471996-01-29 15:44:03 +0000458staticforward PyTypeObject QDGlobalsAccess_Type = {
459 PyObject_HEAD_INIT(&PyType_Type)
460 0, /*ob_size*/
461 "QDGlobalsAccess", /*tp_name*/
462 sizeof(QDGlobalsAccessObject), /*tp_basicsize*/
463 0, /*tp_itemsize*/
464 /* methods */
465 (destructor) QDGA_dealloc, /*tp_dealloc*/
466 0, /*tp_print*/
467 (getattrfunc) QDGA_getattr, /*tp_getattr*/
468 (setattrfunc) QDGA_setattr, /*tp_setattr*/
Jack Jansena05ac601999-12-12 21:41:51 +0000469 (cmpfunc) QDGA_compare, /*tp_compare*/
470 (reprfunc) QDGA_repr, /*tp_repr*/
471 (PyNumberMethods *)0, /* tp_as_number */
472 (PySequenceMethods *)0, /* tp_as_sequence */
473 (PyMappingMethods *)0, /* tp_as_mapping */
474 (hashfunc) QDGA_hash, /*tp_hash*/
Jack Jansenbdd07471996-01-29 15:44:03 +0000475};
476
477/* ---------------- End object type QDGlobalsAccess ----------------- */
478
479
Jack Jansen1c4e6141998-04-21 15:23:55 +0000480static PyObject *Qd_MacSetPort(_self, _args)
Guido van Rossum17448e21995-01-30 11:53:55 +0000481 PyObject *_self;
482 PyObject *_args;
483{
484 PyObject *_res = NULL;
Jack Jansen330381c1995-11-15 15:18:01 +0000485 GrafPtr port;
Guido van Rossum17448e21995-01-30 11:53:55 +0000486 if (!PyArg_ParseTuple(_args, "O&",
Jack Jansen330381c1995-11-15 15:18:01 +0000487 GrafObj_Convert, &port))
Guido van Rossum17448e21995-01-30 11:53:55 +0000488 return NULL;
Jack Jansen1c4e6141998-04-21 15:23:55 +0000489 MacSetPort(port);
Guido van Rossume56db431995-03-19 22:49:50 +0000490 Py_INCREF(Py_None);
491 _res = Py_None;
492 return _res;
493}
494
495static PyObject *Qd_GetPort(_self, _args)
496 PyObject *_self;
497 PyObject *_args;
498{
499 PyObject *_res = NULL;
Jack Jansen330381c1995-11-15 15:18:01 +0000500 GrafPtr port;
Guido van Rossume56db431995-03-19 22:49:50 +0000501 if (!PyArg_ParseTuple(_args, ""))
502 return NULL;
503 GetPort(&port);
504 _res = Py_BuildValue("O&",
Jack Jansen330381c1995-11-15 15:18:01 +0000505 GrafObj_New, port);
Guido van Rossume56db431995-03-19 22:49:50 +0000506 return _res;
507}
508
509static PyObject *Qd_GrafDevice(_self, _args)
510 PyObject *_self;
511 PyObject *_args;
512{
513 PyObject *_res = NULL;
514 short device;
515 if (!PyArg_ParseTuple(_args, "h",
516 &device))
517 return NULL;
518 GrafDevice(device);
519 Py_INCREF(Py_None);
520 _res = Py_None;
521 return _res;
522}
523
Jack Jansen41058c01995-11-16 22:48:29 +0000524static PyObject *Qd_SetPortBits(_self, _args)
525 PyObject *_self;
526 PyObject *_args;
527{
528 PyObject *_res = NULL;
529 BitMapPtr bm;
530 if (!PyArg_ParseTuple(_args, "O&",
531 BMObj_Convert, &bm))
532 return NULL;
533 SetPortBits(bm);
534 Py_INCREF(Py_None);
535 _res = Py_None;
536 return _res;
537}
538
Guido van Rossume56db431995-03-19 22:49:50 +0000539static PyObject *Qd_PortSize(_self, _args)
540 PyObject *_self;
541 PyObject *_args;
542{
543 PyObject *_res = NULL;
544 short width;
545 short height;
546 if (!PyArg_ParseTuple(_args, "hh",
547 &width,
548 &height))
549 return NULL;
550 PortSize(width,
551 height);
552 Py_INCREF(Py_None);
553 _res = Py_None;
554 return _res;
555}
556
557static PyObject *Qd_MovePortTo(_self, _args)
558 PyObject *_self;
559 PyObject *_args;
560{
561 PyObject *_res = NULL;
562 short leftGlobal;
563 short topGlobal;
564 if (!PyArg_ParseTuple(_args, "hh",
565 &leftGlobal,
566 &topGlobal))
567 return NULL;
568 MovePortTo(leftGlobal,
569 topGlobal);
570 Py_INCREF(Py_None);
571 _res = Py_None;
572 return _res;
573}
574
575static PyObject *Qd_SetOrigin(_self, _args)
576 PyObject *_self;
577 PyObject *_args;
578{
579 PyObject *_res = NULL;
580 short h;
581 short v;
582 if (!PyArg_ParseTuple(_args, "hh",
583 &h,
584 &v))
585 return NULL;
586 SetOrigin(h,
587 v);
588 Py_INCREF(Py_None);
589 _res = Py_None;
590 return _res;
591}
592
593static PyObject *Qd_SetClip(_self, _args)
594 PyObject *_self;
595 PyObject *_args;
596{
597 PyObject *_res = NULL;
598 RgnHandle rgn;
599 if (!PyArg_ParseTuple(_args, "O&",
600 ResObj_Convert, &rgn))
601 return NULL;
602 SetClip(rgn);
603 Py_INCREF(Py_None);
604 _res = Py_None;
605 return _res;
606}
607
608static PyObject *Qd_GetClip(_self, _args)
609 PyObject *_self;
610 PyObject *_args;
611{
612 PyObject *_res = NULL;
613 RgnHandle rgn;
614 if (!PyArg_ParseTuple(_args, "O&",
615 ResObj_Convert, &rgn))
616 return NULL;
617 GetClip(rgn);
Guido van Rossum17448e21995-01-30 11:53:55 +0000618 Py_INCREF(Py_None);
619 _res = Py_None;
620 return _res;
621}
622
623static PyObject *Qd_ClipRect(_self, _args)
624 PyObject *_self;
625 PyObject *_args;
626{
627 PyObject *_res = NULL;
628 Rect r;
629 if (!PyArg_ParseTuple(_args, "O&",
630 PyMac_GetRect, &r))
631 return NULL;
632 ClipRect(&r);
633 Py_INCREF(Py_None);
634 _res = Py_None;
635 return _res;
636}
637
Jack Jansen04a02e71996-01-06 17:12:58 +0000638static PyObject *Qd_BackPat(_self, _args)
639 PyObject *_self;
640 PyObject *_args;
641{
642 PyObject *_res = NULL;
643 Pattern *pat__in__;
644 int pat__in_len__;
645 if (!PyArg_ParseTuple(_args, "s#",
646 (char **)&pat__in__, &pat__in_len__))
647 return NULL;
648 if (pat__in_len__ != sizeof(Pattern))
649 {
650 PyErr_SetString(PyExc_TypeError, "buffer length should be sizeof(Pattern)");
651 goto pat__error__;
652 }
653 BackPat(pat__in__);
654 Py_INCREF(Py_None);
655 _res = Py_None;
656 pat__error__: ;
657 return _res;
658}
659
Guido van Rossume56db431995-03-19 22:49:50 +0000660static PyObject *Qd_InitCursor(_self, _args)
661 PyObject *_self;
662 PyObject *_args;
663{
664 PyObject *_res = NULL;
665 if (!PyArg_ParseTuple(_args, ""))
666 return NULL;
667 InitCursor();
668 Py_INCREF(Py_None);
669 _res = Py_None;
670 return _res;
671}
672
Jack Jansen1c4e6141998-04-21 15:23:55 +0000673static PyObject *Qd_MacSetCursor(_self, _args)
Jack Jansenb5394061996-01-05 18:06:41 +0000674 PyObject *_self;
675 PyObject *_args;
676{
677 PyObject *_res = NULL;
678 Cursor *crsr__in__;
679 int crsr__in_len__;
680 if (!PyArg_ParseTuple(_args, "s#",
681 (char **)&crsr__in__, &crsr__in_len__))
682 return NULL;
683 if (crsr__in_len__ != sizeof(Cursor))
684 {
685 PyErr_SetString(PyExc_TypeError, "buffer length should be sizeof(Cursor)");
686 goto crsr__error__;
687 }
Jack Jansen1c4e6141998-04-21 15:23:55 +0000688 MacSetCursor(crsr__in__);
Jack Jansenb5394061996-01-05 18:06:41 +0000689 Py_INCREF(Py_None);
690 _res = Py_None;
691 crsr__error__: ;
692 return _res;
693}
694
Guido van Rossume56db431995-03-19 22:49:50 +0000695static PyObject *Qd_HideCursor(_self, _args)
696 PyObject *_self;
697 PyObject *_args;
698{
699 PyObject *_res = NULL;
700 if (!PyArg_ParseTuple(_args, ""))
701 return NULL;
702 HideCursor();
703 Py_INCREF(Py_None);
704 _res = Py_None;
705 return _res;
706}
707
Jack Jansen1c4e6141998-04-21 15:23:55 +0000708static PyObject *Qd_MacShowCursor(_self, _args)
Guido van Rossume56db431995-03-19 22:49:50 +0000709 PyObject *_self;
710 PyObject *_args;
711{
712 PyObject *_res = NULL;
713 if (!PyArg_ParseTuple(_args, ""))
714 return NULL;
Jack Jansen1c4e6141998-04-21 15:23:55 +0000715 MacShowCursor();
Guido van Rossume56db431995-03-19 22:49:50 +0000716 Py_INCREF(Py_None);
717 _res = Py_None;
718 return _res;
719}
720
721static PyObject *Qd_ObscureCursor(_self, _args)
722 PyObject *_self;
723 PyObject *_args;
724{
725 PyObject *_res = NULL;
726 if (!PyArg_ParseTuple(_args, ""))
727 return NULL;
728 ObscureCursor();
729 Py_INCREF(Py_None);
730 _res = Py_None;
731 return _res;
732}
733
734static PyObject *Qd_HidePen(_self, _args)
735 PyObject *_self;
736 PyObject *_args;
737{
738 PyObject *_res = NULL;
739 if (!PyArg_ParseTuple(_args, ""))
740 return NULL;
741 HidePen();
742 Py_INCREF(Py_None);
743 _res = Py_None;
744 return _res;
745}
746
747static PyObject *Qd_ShowPen(_self, _args)
748 PyObject *_self;
749 PyObject *_args;
750{
751 PyObject *_res = NULL;
752 if (!PyArg_ParseTuple(_args, ""))
753 return NULL;
754 ShowPen();
755 Py_INCREF(Py_None);
756 _res = Py_None;
757 return _res;
758}
759
760static PyObject *Qd_GetPen(_self, _args)
761 PyObject *_self;
762 PyObject *_args;
763{
764 PyObject *_res = NULL;
765 Point pt;
Jack Jansen1d8ede71996-01-08 23:47:31 +0000766 if (!PyArg_ParseTuple(_args, ""))
Guido van Rossume56db431995-03-19 22:49:50 +0000767 return NULL;
768 GetPen(&pt);
769 _res = Py_BuildValue("O&",
770 PyMac_BuildPoint, pt);
771 return _res;
772}
773
Jack Jansen04a02e71996-01-06 17:12:58 +0000774static PyObject *Qd_GetPenState(_self, _args)
775 PyObject *_self;
776 PyObject *_args;
777{
778 PyObject *_res = NULL;
779 PenState pnState__out__;
780 if (!PyArg_ParseTuple(_args, ""))
781 return NULL;
782 GetPenState(&pnState__out__);
783 _res = Py_BuildValue("s#",
784 (char *)&pnState__out__, (int)sizeof(PenState));
785 pnState__error__: ;
786 return _res;
787}
788
789static PyObject *Qd_SetPenState(_self, _args)
790 PyObject *_self;
791 PyObject *_args;
792{
793 PyObject *_res = NULL;
794 PenState *pnState__in__;
795 int pnState__in_len__;
796 if (!PyArg_ParseTuple(_args, "s#",
797 (char **)&pnState__in__, &pnState__in_len__))
798 return NULL;
799 if (pnState__in_len__ != sizeof(PenState))
800 {
801 PyErr_SetString(PyExc_TypeError, "buffer length should be sizeof(PenState)");
802 goto pnState__error__;
803 }
804 SetPenState(pnState__in__);
805 Py_INCREF(Py_None);
806 _res = Py_None;
807 pnState__error__: ;
808 return _res;
809}
810
Guido van Rossume56db431995-03-19 22:49:50 +0000811static PyObject *Qd_PenSize(_self, _args)
812 PyObject *_self;
813 PyObject *_args;
814{
815 PyObject *_res = NULL;
816 short width;
817 short height;
818 if (!PyArg_ParseTuple(_args, "hh",
819 &width,
820 &height))
821 return NULL;
822 PenSize(width,
823 height);
824 Py_INCREF(Py_None);
825 _res = Py_None;
826 return _res;
827}
828
829static PyObject *Qd_PenMode(_self, _args)
830 PyObject *_self;
831 PyObject *_args;
832{
833 PyObject *_res = NULL;
834 short mode;
835 if (!PyArg_ParseTuple(_args, "h",
836 &mode))
837 return NULL;
838 PenMode(mode);
839 Py_INCREF(Py_None);
840 _res = Py_None;
841 return _res;
842}
843
Jack Jansen04a02e71996-01-06 17:12:58 +0000844static PyObject *Qd_PenPat(_self, _args)
845 PyObject *_self;
846 PyObject *_args;
847{
848 PyObject *_res = NULL;
849 Pattern *pat__in__;
850 int pat__in_len__;
851 if (!PyArg_ParseTuple(_args, "s#",
852 (char **)&pat__in__, &pat__in_len__))
853 return NULL;
854 if (pat__in_len__ != sizeof(Pattern))
855 {
856 PyErr_SetString(PyExc_TypeError, "buffer length should be sizeof(Pattern)");
857 goto pat__error__;
858 }
859 PenPat(pat__in__);
860 Py_INCREF(Py_None);
861 _res = Py_None;
862 pat__error__: ;
863 return _res;
864}
865
Guido van Rossume56db431995-03-19 22:49:50 +0000866static PyObject *Qd_PenNormal(_self, _args)
867 PyObject *_self;
868 PyObject *_args;
869{
870 PyObject *_res = NULL;
871 if (!PyArg_ParseTuple(_args, ""))
872 return NULL;
873 PenNormal();
874 Py_INCREF(Py_None);
875 _res = Py_None;
876 return _res;
877}
878
879static PyObject *Qd_MoveTo(_self, _args)
880 PyObject *_self;
881 PyObject *_args;
882{
883 PyObject *_res = NULL;
884 short h;
885 short v;
886 if (!PyArg_ParseTuple(_args, "hh",
887 &h,
888 &v))
889 return NULL;
890 MoveTo(h,
891 v);
892 Py_INCREF(Py_None);
893 _res = Py_None;
894 return _res;
895}
896
897static PyObject *Qd_Move(_self, _args)
898 PyObject *_self;
899 PyObject *_args;
900{
901 PyObject *_res = NULL;
902 short dh;
903 short dv;
904 if (!PyArg_ParseTuple(_args, "hh",
905 &dh,
906 &dv))
907 return NULL;
908 Move(dh,
909 dv);
910 Py_INCREF(Py_None);
911 _res = Py_None;
912 return _res;
913}
914
Jack Jansen1c4e6141998-04-21 15:23:55 +0000915static PyObject *Qd_MacLineTo(_self, _args)
Guido van Rossume56db431995-03-19 22:49:50 +0000916 PyObject *_self;
917 PyObject *_args;
918{
919 PyObject *_res = NULL;
920 short h;
921 short v;
922 if (!PyArg_ParseTuple(_args, "hh",
923 &h,
924 &v))
925 return NULL;
Jack Jansen1c4e6141998-04-21 15:23:55 +0000926 MacLineTo(h,
927 v);
Guido van Rossume56db431995-03-19 22:49:50 +0000928 Py_INCREF(Py_None);
929 _res = Py_None;
930 return _res;
931}
932
933static PyObject *Qd_Line(_self, _args)
934 PyObject *_self;
935 PyObject *_args;
936{
937 PyObject *_res = NULL;
938 short dh;
939 short dv;
940 if (!PyArg_ParseTuple(_args, "hh",
941 &dh,
942 &dv))
943 return NULL;
944 Line(dh,
945 dv);
946 Py_INCREF(Py_None);
947 _res = Py_None;
948 return _res;
949}
950
Guido van Rossume56db431995-03-19 22:49:50 +0000951static PyObject *Qd_ForeColor(_self, _args)
952 PyObject *_self;
953 PyObject *_args;
954{
955 PyObject *_res = NULL;
956 long color;
957 if (!PyArg_ParseTuple(_args, "l",
958 &color))
959 return NULL;
960 ForeColor(color);
961 Py_INCREF(Py_None);
962 _res = Py_None;
963 return _res;
964}
965
966static PyObject *Qd_BackColor(_self, _args)
967 PyObject *_self;
968 PyObject *_args;
969{
970 PyObject *_res = NULL;
971 long color;
972 if (!PyArg_ParseTuple(_args, "l",
973 &color))
974 return NULL;
975 BackColor(color);
976 Py_INCREF(Py_None);
977 _res = Py_None;
978 return _res;
979}
980
981static PyObject *Qd_ColorBit(_self, _args)
982 PyObject *_self;
983 PyObject *_args;
984{
985 PyObject *_res = NULL;
986 short whichBit;
987 if (!PyArg_ParseTuple(_args, "h",
988 &whichBit))
989 return NULL;
990 ColorBit(whichBit);
991 Py_INCREF(Py_None);
992 _res = Py_None;
993 return _res;
994}
995
Jack Jansen1c4e6141998-04-21 15:23:55 +0000996static PyObject *Qd_MacSetRect(_self, _args)
Guido van Rossume56db431995-03-19 22:49:50 +0000997 PyObject *_self;
998 PyObject *_args;
999{
1000 PyObject *_res = NULL;
1001 Rect r;
1002 short left;
1003 short top;
1004 short right;
1005 short bottom;
1006 if (!PyArg_ParseTuple(_args, "hhhh",
1007 &left,
1008 &top,
1009 &right,
1010 &bottom))
1011 return NULL;
Jack Jansen1c4e6141998-04-21 15:23:55 +00001012 MacSetRect(&r,
1013 left,
1014 top,
1015 right,
1016 bottom);
Guido van Rossume56db431995-03-19 22:49:50 +00001017 _res = Py_BuildValue("O&",
1018 PyMac_BuildRect, &r);
1019 return _res;
1020}
1021
Jack Jansen1c4e6141998-04-21 15:23:55 +00001022static PyObject *Qd_MacOffsetRect(_self, _args)
Guido van Rossume56db431995-03-19 22:49:50 +00001023 PyObject *_self;
1024 PyObject *_args;
1025{
1026 PyObject *_res = NULL;
1027 Rect r;
1028 short dh;
1029 short dv;
Jack Jansen54c8f7e1995-11-14 10:46:01 +00001030 if (!PyArg_ParseTuple(_args, "O&hh",
1031 PyMac_GetRect, &r,
Guido van Rossume56db431995-03-19 22:49:50 +00001032 &dh,
1033 &dv))
1034 return NULL;
Jack Jansen1c4e6141998-04-21 15:23:55 +00001035 MacOffsetRect(&r,
1036 dh,
1037 dv);
Guido van Rossume56db431995-03-19 22:49:50 +00001038 _res = Py_BuildValue("O&",
1039 PyMac_BuildRect, &r);
1040 return _res;
1041}
1042
Jack Jansen1c4e6141998-04-21 15:23:55 +00001043static PyObject *Qd_MacInsetRect(_self, _args)
Guido van Rossume56db431995-03-19 22:49:50 +00001044 PyObject *_self;
1045 PyObject *_args;
1046{
1047 PyObject *_res = NULL;
1048 Rect r;
1049 short dh;
1050 short dv;
Jack Jansen54c8f7e1995-11-14 10:46:01 +00001051 if (!PyArg_ParseTuple(_args, "O&hh",
1052 PyMac_GetRect, &r,
Guido van Rossume56db431995-03-19 22:49:50 +00001053 &dh,
1054 &dv))
1055 return NULL;
Jack Jansen1c4e6141998-04-21 15:23:55 +00001056 MacInsetRect(&r,
1057 dh,
1058 dv);
Guido van Rossume56db431995-03-19 22:49:50 +00001059 _res = Py_BuildValue("O&",
1060 PyMac_BuildRect, &r);
1061 return _res;
1062}
1063
1064static PyObject *Qd_SectRect(_self, _args)
1065 PyObject *_self;
1066 PyObject *_args;
1067{
1068 PyObject *_res = NULL;
1069 Boolean _rv;
1070 Rect src1;
1071 Rect src2;
1072 Rect dstRect;
1073 if (!PyArg_ParseTuple(_args, "O&O&",
1074 PyMac_GetRect, &src1,
1075 PyMac_GetRect, &src2))
1076 return NULL;
1077 _rv = SectRect(&src1,
1078 &src2,
1079 &dstRect);
1080 _res = Py_BuildValue("bO&",
1081 _rv,
1082 PyMac_BuildRect, &dstRect);
1083 return _res;
1084}
1085
Jack Jansen1c4e6141998-04-21 15:23:55 +00001086static PyObject *Qd_MacUnionRect(_self, _args)
Guido van Rossume56db431995-03-19 22:49:50 +00001087 PyObject *_self;
1088 PyObject *_args;
1089{
1090 PyObject *_res = NULL;
1091 Rect src1;
1092 Rect src2;
1093 Rect dstRect;
1094 if (!PyArg_ParseTuple(_args, "O&O&",
1095 PyMac_GetRect, &src1,
1096 PyMac_GetRect, &src2))
1097 return NULL;
Jack Jansen1c4e6141998-04-21 15:23:55 +00001098 MacUnionRect(&src1,
1099 &src2,
1100 &dstRect);
Guido van Rossume56db431995-03-19 22:49:50 +00001101 _res = Py_BuildValue("O&",
1102 PyMac_BuildRect, &dstRect);
1103 return _res;
1104}
1105
Jack Jansen1c4e6141998-04-21 15:23:55 +00001106static PyObject *Qd_MacEqualRect(_self, _args)
Guido van Rossume56db431995-03-19 22:49:50 +00001107 PyObject *_self;
1108 PyObject *_args;
1109{
1110 PyObject *_res = NULL;
1111 Boolean _rv;
1112 Rect rect1;
1113 Rect rect2;
1114 if (!PyArg_ParseTuple(_args, "O&O&",
1115 PyMac_GetRect, &rect1,
1116 PyMac_GetRect, &rect2))
1117 return NULL;
Jack Jansen1c4e6141998-04-21 15:23:55 +00001118 _rv = MacEqualRect(&rect1,
1119 &rect2);
Guido van Rossume56db431995-03-19 22:49:50 +00001120 _res = Py_BuildValue("b",
1121 _rv);
1122 return _res;
1123}
1124
1125static PyObject *Qd_EmptyRect(_self, _args)
1126 PyObject *_self;
1127 PyObject *_args;
1128{
1129 PyObject *_res = NULL;
1130 Boolean _rv;
1131 Rect r;
1132 if (!PyArg_ParseTuple(_args, "O&",
1133 PyMac_GetRect, &r))
1134 return NULL;
1135 _rv = EmptyRect(&r);
1136 _res = Py_BuildValue("b",
1137 _rv);
1138 return _res;
1139}
1140
Jack Jansen1c4e6141998-04-21 15:23:55 +00001141static PyObject *Qd_MacFrameRect(_self, _args)
Guido van Rossume56db431995-03-19 22:49:50 +00001142 PyObject *_self;
1143 PyObject *_args;
1144{
1145 PyObject *_res = NULL;
1146 Rect r;
1147 if (!PyArg_ParseTuple(_args, "O&",
1148 PyMac_GetRect, &r))
1149 return NULL;
Jack Jansen1c4e6141998-04-21 15:23:55 +00001150 MacFrameRect(&r);
Guido van Rossume56db431995-03-19 22:49:50 +00001151 Py_INCREF(Py_None);
1152 _res = Py_None;
1153 return _res;
1154}
1155
1156static PyObject *Qd_PaintRect(_self, _args)
1157 PyObject *_self;
1158 PyObject *_args;
1159{
1160 PyObject *_res = NULL;
1161 Rect r;
1162 if (!PyArg_ParseTuple(_args, "O&",
1163 PyMac_GetRect, &r))
1164 return NULL;
1165 PaintRect(&r);
1166 Py_INCREF(Py_None);
1167 _res = Py_None;
1168 return _res;
1169}
1170
Guido van Rossum17448e21995-01-30 11:53:55 +00001171static PyObject *Qd_EraseRect(_self, _args)
1172 PyObject *_self;
1173 PyObject *_args;
1174{
1175 PyObject *_res = NULL;
1176 Rect r;
1177 if (!PyArg_ParseTuple(_args, "O&",
1178 PyMac_GetRect, &r))
1179 return NULL;
1180 EraseRect(&r);
1181 Py_INCREF(Py_None);
1182 _res = Py_None;
1183 return _res;
1184}
1185
Jack Jansen1c4e6141998-04-21 15:23:55 +00001186static PyObject *Qd_MacInvertRect(_self, _args)
Guido van Rossum17448e21995-01-30 11:53:55 +00001187 PyObject *_self;
1188 PyObject *_args;
1189{
1190 PyObject *_res = NULL;
Guido van Rossume56db431995-03-19 22:49:50 +00001191 Rect r;
Guido van Rossum17448e21995-01-30 11:53:55 +00001192 if (!PyArg_ParseTuple(_args, "O&",
Guido van Rossume56db431995-03-19 22:49:50 +00001193 PyMac_GetRect, &r))
Guido van Rossum17448e21995-01-30 11:53:55 +00001194 return NULL;
Jack Jansen1c4e6141998-04-21 15:23:55 +00001195 MacInvertRect(&r);
Guido van Rossum17448e21995-01-30 11:53:55 +00001196 Py_INCREF(Py_None);
1197 _res = Py_None;
1198 return _res;
1199}
1200
Jack Jansen1c4e6141998-04-21 15:23:55 +00001201static PyObject *Qd_MacFillRect(_self, _args)
Jack Jansen04a02e71996-01-06 17:12:58 +00001202 PyObject *_self;
1203 PyObject *_args;
1204{
1205 PyObject *_res = NULL;
1206 Rect r;
1207 Pattern *pat__in__;
1208 int pat__in_len__;
1209 if (!PyArg_ParseTuple(_args, "O&s#",
1210 PyMac_GetRect, &r,
1211 (char **)&pat__in__, &pat__in_len__))
1212 return NULL;
1213 if (pat__in_len__ != sizeof(Pattern))
1214 {
1215 PyErr_SetString(PyExc_TypeError, "buffer length should be sizeof(Pattern)");
1216 goto pat__error__;
1217 }
Jack Jansen1c4e6141998-04-21 15:23:55 +00001218 MacFillRect(&r,
1219 pat__in__);
Jack Jansen04a02e71996-01-06 17:12:58 +00001220 Py_INCREF(Py_None);
1221 _res = Py_None;
1222 pat__error__: ;
1223 return _res;
1224}
1225
Guido van Rossume56db431995-03-19 22:49:50 +00001226static PyObject *Qd_FrameOval(_self, _args)
1227 PyObject *_self;
1228 PyObject *_args;
1229{
1230 PyObject *_res = NULL;
1231 Rect r;
1232 if (!PyArg_ParseTuple(_args, "O&",
1233 PyMac_GetRect, &r))
1234 return NULL;
1235 FrameOval(&r);
1236 Py_INCREF(Py_None);
1237 _res = Py_None;
1238 return _res;
1239}
1240
1241static PyObject *Qd_PaintOval(_self, _args)
1242 PyObject *_self;
1243 PyObject *_args;
1244{
1245 PyObject *_res = NULL;
1246 Rect r;
1247 if (!PyArg_ParseTuple(_args, "O&",
1248 PyMac_GetRect, &r))
1249 return NULL;
1250 PaintOval(&r);
1251 Py_INCREF(Py_None);
1252 _res = Py_None;
1253 return _res;
1254}
1255
1256static PyObject *Qd_EraseOval(_self, _args)
1257 PyObject *_self;
1258 PyObject *_args;
1259{
1260 PyObject *_res = NULL;
1261 Rect r;
1262 if (!PyArg_ParseTuple(_args, "O&",
1263 PyMac_GetRect, &r))
1264 return NULL;
1265 EraseOval(&r);
1266 Py_INCREF(Py_None);
1267 _res = Py_None;
1268 return _res;
1269}
1270
1271static PyObject *Qd_InvertOval(_self, _args)
1272 PyObject *_self;
1273 PyObject *_args;
1274{
1275 PyObject *_res = NULL;
1276 Rect r;
1277 if (!PyArg_ParseTuple(_args, "O&",
1278 PyMac_GetRect, &r))
1279 return NULL;
1280 InvertOval(&r);
1281 Py_INCREF(Py_None);
1282 _res = Py_None;
1283 return _res;
1284}
1285
Jack Jansen04a02e71996-01-06 17:12:58 +00001286static PyObject *Qd_FillOval(_self, _args)
1287 PyObject *_self;
1288 PyObject *_args;
1289{
1290 PyObject *_res = NULL;
1291 Rect r;
1292 Pattern *pat__in__;
1293 int pat__in_len__;
1294 if (!PyArg_ParseTuple(_args, "O&s#",
1295 PyMac_GetRect, &r,
1296 (char **)&pat__in__, &pat__in_len__))
1297 return NULL;
1298 if (pat__in_len__ != sizeof(Pattern))
1299 {
1300 PyErr_SetString(PyExc_TypeError, "buffer length should be sizeof(Pattern)");
1301 goto pat__error__;
1302 }
1303 FillOval(&r,
1304 pat__in__);
1305 Py_INCREF(Py_None);
1306 _res = Py_None;
1307 pat__error__: ;
1308 return _res;
1309}
1310
Guido van Rossume56db431995-03-19 22:49:50 +00001311static PyObject *Qd_FrameRoundRect(_self, _args)
1312 PyObject *_self;
1313 PyObject *_args;
1314{
1315 PyObject *_res = NULL;
1316 Rect r;
1317 short ovalWidth;
1318 short ovalHeight;
1319 if (!PyArg_ParseTuple(_args, "O&hh",
1320 PyMac_GetRect, &r,
1321 &ovalWidth,
1322 &ovalHeight))
1323 return NULL;
1324 FrameRoundRect(&r,
1325 ovalWidth,
1326 ovalHeight);
1327 Py_INCREF(Py_None);
1328 _res = Py_None;
1329 return _res;
1330}
1331
1332static PyObject *Qd_PaintRoundRect(_self, _args)
1333 PyObject *_self;
1334 PyObject *_args;
1335{
1336 PyObject *_res = NULL;
1337 Rect r;
1338 short ovalWidth;
1339 short ovalHeight;
1340 if (!PyArg_ParseTuple(_args, "O&hh",
1341 PyMac_GetRect, &r,
1342 &ovalWidth,
1343 &ovalHeight))
1344 return NULL;
1345 PaintRoundRect(&r,
1346 ovalWidth,
1347 ovalHeight);
1348 Py_INCREF(Py_None);
1349 _res = Py_None;
1350 return _res;
1351}
1352
1353static PyObject *Qd_EraseRoundRect(_self, _args)
1354 PyObject *_self;
1355 PyObject *_args;
1356{
1357 PyObject *_res = NULL;
1358 Rect r;
1359 short ovalWidth;
1360 short ovalHeight;
1361 if (!PyArg_ParseTuple(_args, "O&hh",
1362 PyMac_GetRect, &r,
1363 &ovalWidth,
1364 &ovalHeight))
1365 return NULL;
1366 EraseRoundRect(&r,
1367 ovalWidth,
1368 ovalHeight);
1369 Py_INCREF(Py_None);
1370 _res = Py_None;
1371 return _res;
1372}
1373
1374static PyObject *Qd_InvertRoundRect(_self, _args)
1375 PyObject *_self;
1376 PyObject *_args;
1377{
1378 PyObject *_res = NULL;
1379 Rect r;
1380 short ovalWidth;
1381 short ovalHeight;
1382 if (!PyArg_ParseTuple(_args, "O&hh",
1383 PyMac_GetRect, &r,
1384 &ovalWidth,
1385 &ovalHeight))
1386 return NULL;
1387 InvertRoundRect(&r,
1388 ovalWidth,
1389 ovalHeight);
1390 Py_INCREF(Py_None);
1391 _res = Py_None;
1392 return _res;
1393}
1394
Jack Jansen04a02e71996-01-06 17:12:58 +00001395static PyObject *Qd_FillRoundRect(_self, _args)
1396 PyObject *_self;
1397 PyObject *_args;
1398{
1399 PyObject *_res = NULL;
1400 Rect r;
1401 short ovalWidth;
1402 short ovalHeight;
1403 Pattern *pat__in__;
1404 int pat__in_len__;
1405 if (!PyArg_ParseTuple(_args, "O&hhs#",
1406 PyMac_GetRect, &r,
1407 &ovalWidth,
1408 &ovalHeight,
1409 (char **)&pat__in__, &pat__in_len__))
1410 return NULL;
1411 if (pat__in_len__ != sizeof(Pattern))
1412 {
1413 PyErr_SetString(PyExc_TypeError, "buffer length should be sizeof(Pattern)");
1414 goto pat__error__;
1415 }
1416 FillRoundRect(&r,
1417 ovalWidth,
1418 ovalHeight,
1419 pat__in__);
1420 Py_INCREF(Py_None);
1421 _res = Py_None;
1422 pat__error__: ;
1423 return _res;
1424}
1425
Guido van Rossume56db431995-03-19 22:49:50 +00001426static PyObject *Qd_FrameArc(_self, _args)
1427 PyObject *_self;
1428 PyObject *_args;
1429{
1430 PyObject *_res = NULL;
1431 Rect r;
1432 short startAngle;
1433 short arcAngle;
1434 if (!PyArg_ParseTuple(_args, "O&hh",
1435 PyMac_GetRect, &r,
1436 &startAngle,
1437 &arcAngle))
1438 return NULL;
1439 FrameArc(&r,
1440 startAngle,
1441 arcAngle);
1442 Py_INCREF(Py_None);
1443 _res = Py_None;
1444 return _res;
1445}
1446
1447static PyObject *Qd_PaintArc(_self, _args)
1448 PyObject *_self;
1449 PyObject *_args;
1450{
1451 PyObject *_res = NULL;
1452 Rect r;
1453 short startAngle;
1454 short arcAngle;
1455 if (!PyArg_ParseTuple(_args, "O&hh",
1456 PyMac_GetRect, &r,
1457 &startAngle,
1458 &arcAngle))
1459 return NULL;
1460 PaintArc(&r,
1461 startAngle,
1462 arcAngle);
1463 Py_INCREF(Py_None);
1464 _res = Py_None;
1465 return _res;
1466}
1467
1468static PyObject *Qd_EraseArc(_self, _args)
1469 PyObject *_self;
1470 PyObject *_args;
1471{
1472 PyObject *_res = NULL;
1473 Rect r;
1474 short startAngle;
1475 short arcAngle;
1476 if (!PyArg_ParseTuple(_args, "O&hh",
1477 PyMac_GetRect, &r,
1478 &startAngle,
1479 &arcAngle))
1480 return NULL;
1481 EraseArc(&r,
1482 startAngle,
1483 arcAngle);
1484 Py_INCREF(Py_None);
1485 _res = Py_None;
1486 return _res;
1487}
1488
1489static PyObject *Qd_InvertArc(_self, _args)
1490 PyObject *_self;
1491 PyObject *_args;
1492{
1493 PyObject *_res = NULL;
1494 Rect r;
1495 short startAngle;
1496 short arcAngle;
1497 if (!PyArg_ParseTuple(_args, "O&hh",
1498 PyMac_GetRect, &r,
1499 &startAngle,
1500 &arcAngle))
1501 return NULL;
1502 InvertArc(&r,
1503 startAngle,
1504 arcAngle);
1505 Py_INCREF(Py_None);
1506 _res = Py_None;
1507 return _res;
1508}
1509
Jack Jansen04a02e71996-01-06 17:12:58 +00001510static PyObject *Qd_FillArc(_self, _args)
1511 PyObject *_self;
1512 PyObject *_args;
1513{
1514 PyObject *_res = NULL;
1515 Rect r;
1516 short startAngle;
1517 short arcAngle;
1518 Pattern *pat__in__;
1519 int pat__in_len__;
1520 if (!PyArg_ParseTuple(_args, "O&hhs#",
1521 PyMac_GetRect, &r,
1522 &startAngle,
1523 &arcAngle,
1524 (char **)&pat__in__, &pat__in_len__))
1525 return NULL;
1526 if (pat__in_len__ != sizeof(Pattern))
1527 {
1528 PyErr_SetString(PyExc_TypeError, "buffer length should be sizeof(Pattern)");
1529 goto pat__error__;
1530 }
1531 FillArc(&r,
1532 startAngle,
1533 arcAngle,
1534 pat__in__);
1535 Py_INCREF(Py_None);
1536 _res = Py_None;
1537 pat__error__: ;
1538 return _res;
1539}
1540
Guido van Rossume56db431995-03-19 22:49:50 +00001541static PyObject *Qd_NewRgn(_self, _args)
1542 PyObject *_self;
1543 PyObject *_args;
1544{
1545 PyObject *_res = NULL;
1546 RgnHandle _rv;
1547 if (!PyArg_ParseTuple(_args, ""))
1548 return NULL;
1549 _rv = NewRgn();
1550 _res = Py_BuildValue("O&",
1551 ResObj_New, _rv);
1552 return _res;
1553}
1554
1555static PyObject *Qd_OpenRgn(_self, _args)
1556 PyObject *_self;
1557 PyObject *_args;
1558{
1559 PyObject *_res = NULL;
1560 if (!PyArg_ParseTuple(_args, ""))
1561 return NULL;
1562 OpenRgn();
1563 Py_INCREF(Py_None);
1564 _res = Py_None;
1565 return _res;
1566}
1567
1568static PyObject *Qd_CloseRgn(_self, _args)
1569 PyObject *_self;
1570 PyObject *_args;
1571{
1572 PyObject *_res = NULL;
1573 RgnHandle dstRgn;
1574 if (!PyArg_ParseTuple(_args, "O&",
1575 ResObj_Convert, &dstRgn))
1576 return NULL;
1577 CloseRgn(dstRgn);
1578 Py_INCREF(Py_None);
1579 _res = Py_None;
1580 return _res;
1581}
1582
Jack Jansen41058c01995-11-16 22:48:29 +00001583static PyObject *Qd_BitMapToRegion(_self, _args)
1584 PyObject *_self;
1585 PyObject *_args;
1586{
1587 PyObject *_res = NULL;
1588 OSErr _err;
1589 RgnHandle region;
1590 BitMapPtr bMap;
1591 if (!PyArg_ParseTuple(_args, "O&O&",
1592 ResObj_Convert, &region,
1593 BMObj_Convert, &bMap))
1594 return NULL;
1595 _err = BitMapToRegion(region,
1596 bMap);
1597 if (_err != noErr) return PyMac_Error(_err);
1598 Py_INCREF(Py_None);
1599 _res = Py_None;
1600 return _res;
1601}
1602
Guido van Rossume56db431995-03-19 22:49:50 +00001603static PyObject *Qd_DisposeRgn(_self, _args)
1604 PyObject *_self;
1605 PyObject *_args;
1606{
1607 PyObject *_res = NULL;
1608 RgnHandle rgn;
1609 if (!PyArg_ParseTuple(_args, "O&",
1610 ResObj_Convert, &rgn))
1611 return NULL;
1612 DisposeRgn(rgn);
1613 Py_INCREF(Py_None);
1614 _res = Py_None;
1615 return _res;
1616}
1617
Jack Jansen1c4e6141998-04-21 15:23:55 +00001618static PyObject *Qd_MacCopyRgn(_self, _args)
Guido van Rossume56db431995-03-19 22:49:50 +00001619 PyObject *_self;
1620 PyObject *_args;
1621{
1622 PyObject *_res = NULL;
1623 RgnHandle srcRgn;
1624 RgnHandle dstRgn;
1625 if (!PyArg_ParseTuple(_args, "O&O&",
1626 ResObj_Convert, &srcRgn,
1627 ResObj_Convert, &dstRgn))
1628 return NULL;
Jack Jansen1c4e6141998-04-21 15:23:55 +00001629 MacCopyRgn(srcRgn,
1630 dstRgn);
Guido van Rossume56db431995-03-19 22:49:50 +00001631 Py_INCREF(Py_None);
1632 _res = Py_None;
1633 return _res;
1634}
1635
1636static PyObject *Qd_SetEmptyRgn(_self, _args)
1637 PyObject *_self;
1638 PyObject *_args;
1639{
1640 PyObject *_res = NULL;
1641 RgnHandle rgn;
1642 if (!PyArg_ParseTuple(_args, "O&",
1643 ResObj_Convert, &rgn))
1644 return NULL;
1645 SetEmptyRgn(rgn);
1646 Py_INCREF(Py_None);
1647 _res = Py_None;
1648 return _res;
1649}
1650
Jack Jansen1c4e6141998-04-21 15:23:55 +00001651static PyObject *Qd_MacSetRectRgn(_self, _args)
Guido van Rossume56db431995-03-19 22:49:50 +00001652 PyObject *_self;
1653 PyObject *_args;
1654{
1655 PyObject *_res = NULL;
1656 RgnHandle rgn;
1657 short left;
1658 short top;
1659 short right;
1660 short bottom;
1661 if (!PyArg_ParseTuple(_args, "O&hhhh",
1662 ResObj_Convert, &rgn,
1663 &left,
1664 &top,
1665 &right,
1666 &bottom))
1667 return NULL;
Jack Jansen1c4e6141998-04-21 15:23:55 +00001668 MacSetRectRgn(rgn,
1669 left,
1670 top,
1671 right,
1672 bottom);
Guido van Rossume56db431995-03-19 22:49:50 +00001673 Py_INCREF(Py_None);
1674 _res = Py_None;
1675 return _res;
1676}
1677
1678static PyObject *Qd_RectRgn(_self, _args)
1679 PyObject *_self;
1680 PyObject *_args;
1681{
1682 PyObject *_res = NULL;
1683 RgnHandle rgn;
1684 Rect r;
1685 if (!PyArg_ParseTuple(_args, "O&O&",
1686 ResObj_Convert, &rgn,
1687 PyMac_GetRect, &r))
1688 return NULL;
1689 RectRgn(rgn,
1690 &r);
1691 Py_INCREF(Py_None);
1692 _res = Py_None;
1693 return _res;
1694}
1695
Jack Jansen1c4e6141998-04-21 15:23:55 +00001696static PyObject *Qd_MacOffsetRgn(_self, _args)
Guido van Rossume56db431995-03-19 22:49:50 +00001697 PyObject *_self;
1698 PyObject *_args;
1699{
1700 PyObject *_res = NULL;
1701 RgnHandle rgn;
1702 short dh;
1703 short dv;
1704 if (!PyArg_ParseTuple(_args, "O&hh",
1705 ResObj_Convert, &rgn,
1706 &dh,
1707 &dv))
1708 return NULL;
Jack Jansen1c4e6141998-04-21 15:23:55 +00001709 MacOffsetRgn(rgn,
1710 dh,
1711 dv);
Guido van Rossume56db431995-03-19 22:49:50 +00001712 Py_INCREF(Py_None);
1713 _res = Py_None;
1714 return _res;
1715}
1716
1717static PyObject *Qd_InsetRgn(_self, _args)
1718 PyObject *_self;
1719 PyObject *_args;
1720{
1721 PyObject *_res = NULL;
1722 RgnHandle rgn;
1723 short dh;
1724 short dv;
1725 if (!PyArg_ParseTuple(_args, "O&hh",
1726 ResObj_Convert, &rgn,
1727 &dh,
1728 &dv))
1729 return NULL;
1730 InsetRgn(rgn,
1731 dh,
1732 dv);
1733 Py_INCREF(Py_None);
1734 _res = Py_None;
1735 return _res;
1736}
1737
1738static PyObject *Qd_SectRgn(_self, _args)
1739 PyObject *_self;
1740 PyObject *_args;
1741{
1742 PyObject *_res = NULL;
1743 RgnHandle srcRgnA;
1744 RgnHandle srcRgnB;
1745 RgnHandle dstRgn;
1746 if (!PyArg_ParseTuple(_args, "O&O&O&",
1747 ResObj_Convert, &srcRgnA,
1748 ResObj_Convert, &srcRgnB,
1749 ResObj_Convert, &dstRgn))
1750 return NULL;
1751 SectRgn(srcRgnA,
1752 srcRgnB,
1753 dstRgn);
1754 Py_INCREF(Py_None);
1755 _res = Py_None;
1756 return _res;
1757}
1758
Jack Jansen1c4e6141998-04-21 15:23:55 +00001759static PyObject *Qd_MacUnionRgn(_self, _args)
Guido van Rossume56db431995-03-19 22:49:50 +00001760 PyObject *_self;
1761 PyObject *_args;
1762{
1763 PyObject *_res = NULL;
1764 RgnHandle srcRgnA;
1765 RgnHandle srcRgnB;
1766 RgnHandle dstRgn;
1767 if (!PyArg_ParseTuple(_args, "O&O&O&",
1768 ResObj_Convert, &srcRgnA,
1769 ResObj_Convert, &srcRgnB,
1770 ResObj_Convert, &dstRgn))
1771 return NULL;
Jack Jansen1c4e6141998-04-21 15:23:55 +00001772 MacUnionRgn(srcRgnA,
1773 srcRgnB,
1774 dstRgn);
Guido van Rossume56db431995-03-19 22:49:50 +00001775 Py_INCREF(Py_None);
1776 _res = Py_None;
1777 return _res;
1778}
1779
1780static PyObject *Qd_DiffRgn(_self, _args)
1781 PyObject *_self;
1782 PyObject *_args;
1783{
1784 PyObject *_res = NULL;
1785 RgnHandle srcRgnA;
1786 RgnHandle srcRgnB;
1787 RgnHandle dstRgn;
1788 if (!PyArg_ParseTuple(_args, "O&O&O&",
1789 ResObj_Convert, &srcRgnA,
1790 ResObj_Convert, &srcRgnB,
1791 ResObj_Convert, &dstRgn))
1792 return NULL;
1793 DiffRgn(srcRgnA,
1794 srcRgnB,
1795 dstRgn);
1796 Py_INCREF(Py_None);
1797 _res = Py_None;
1798 return _res;
1799}
1800
Jack Jansen1c4e6141998-04-21 15:23:55 +00001801static PyObject *Qd_MacXorRgn(_self, _args)
Guido van Rossume56db431995-03-19 22:49:50 +00001802 PyObject *_self;
1803 PyObject *_args;
1804{
1805 PyObject *_res = NULL;
1806 RgnHandle srcRgnA;
1807 RgnHandle srcRgnB;
1808 RgnHandle dstRgn;
1809 if (!PyArg_ParseTuple(_args, "O&O&O&",
1810 ResObj_Convert, &srcRgnA,
1811 ResObj_Convert, &srcRgnB,
1812 ResObj_Convert, &dstRgn))
1813 return NULL;
Jack Jansen1c4e6141998-04-21 15:23:55 +00001814 MacXorRgn(srcRgnA,
1815 srcRgnB,
1816 dstRgn);
Guido van Rossume56db431995-03-19 22:49:50 +00001817 Py_INCREF(Py_None);
1818 _res = Py_None;
1819 return _res;
1820}
1821
1822static PyObject *Qd_RectInRgn(_self, _args)
1823 PyObject *_self;
1824 PyObject *_args;
1825{
1826 PyObject *_res = NULL;
1827 Boolean _rv;
1828 Rect r;
1829 RgnHandle rgn;
1830 if (!PyArg_ParseTuple(_args, "O&O&",
1831 PyMac_GetRect, &r,
1832 ResObj_Convert, &rgn))
1833 return NULL;
1834 _rv = RectInRgn(&r,
1835 rgn);
1836 _res = Py_BuildValue("b",
1837 _rv);
1838 return _res;
1839}
1840
Jack Jansen1c4e6141998-04-21 15:23:55 +00001841static PyObject *Qd_MacEqualRgn(_self, _args)
Guido van Rossume56db431995-03-19 22:49:50 +00001842 PyObject *_self;
1843 PyObject *_args;
1844{
1845 PyObject *_res = NULL;
1846 Boolean _rv;
1847 RgnHandle rgnA;
1848 RgnHandle rgnB;
1849 if (!PyArg_ParseTuple(_args, "O&O&",
1850 ResObj_Convert, &rgnA,
1851 ResObj_Convert, &rgnB))
1852 return NULL;
Jack Jansen1c4e6141998-04-21 15:23:55 +00001853 _rv = MacEqualRgn(rgnA,
1854 rgnB);
Guido van Rossume56db431995-03-19 22:49:50 +00001855 _res = Py_BuildValue("b",
1856 _rv);
1857 return _res;
1858}
1859
1860static PyObject *Qd_EmptyRgn(_self, _args)
1861 PyObject *_self;
1862 PyObject *_args;
1863{
1864 PyObject *_res = NULL;
1865 Boolean _rv;
1866 RgnHandle rgn;
1867 if (!PyArg_ParseTuple(_args, "O&",
1868 ResObj_Convert, &rgn))
1869 return NULL;
1870 _rv = EmptyRgn(rgn);
1871 _res = Py_BuildValue("b",
1872 _rv);
1873 return _res;
1874}
1875
Jack Jansen1c4e6141998-04-21 15:23:55 +00001876static PyObject *Qd_MacFrameRgn(_self, _args)
Guido van Rossume56db431995-03-19 22:49:50 +00001877 PyObject *_self;
1878 PyObject *_args;
1879{
1880 PyObject *_res = NULL;
1881 RgnHandle rgn;
1882 if (!PyArg_ParseTuple(_args, "O&",
1883 ResObj_Convert, &rgn))
1884 return NULL;
Jack Jansen1c4e6141998-04-21 15:23:55 +00001885 MacFrameRgn(rgn);
Guido van Rossume56db431995-03-19 22:49:50 +00001886 Py_INCREF(Py_None);
1887 _res = Py_None;
1888 return _res;
1889}
1890
Jack Jansen1c4e6141998-04-21 15:23:55 +00001891static PyObject *Qd_MacPaintRgn(_self, _args)
Guido van Rossume56db431995-03-19 22:49:50 +00001892 PyObject *_self;
1893 PyObject *_args;
1894{
1895 PyObject *_res = NULL;
1896 RgnHandle rgn;
1897 if (!PyArg_ParseTuple(_args, "O&",
1898 ResObj_Convert, &rgn))
1899 return NULL;
Jack Jansen1c4e6141998-04-21 15:23:55 +00001900 MacPaintRgn(rgn);
Guido van Rossume56db431995-03-19 22:49:50 +00001901 Py_INCREF(Py_None);
1902 _res = Py_None;
1903 return _res;
1904}
1905
1906static PyObject *Qd_EraseRgn(_self, _args)
1907 PyObject *_self;
1908 PyObject *_args;
1909{
1910 PyObject *_res = NULL;
1911 RgnHandle rgn;
1912 if (!PyArg_ParseTuple(_args, "O&",
1913 ResObj_Convert, &rgn))
1914 return NULL;
1915 EraseRgn(rgn);
1916 Py_INCREF(Py_None);
1917 _res = Py_None;
1918 return _res;
1919}
1920
Jack Jansen1c4e6141998-04-21 15:23:55 +00001921static PyObject *Qd_MacInvertRgn(_self, _args)
Guido van Rossume56db431995-03-19 22:49:50 +00001922 PyObject *_self;
1923 PyObject *_args;
1924{
1925 PyObject *_res = NULL;
1926 RgnHandle rgn;
1927 if (!PyArg_ParseTuple(_args, "O&",
1928 ResObj_Convert, &rgn))
1929 return NULL;
Jack Jansen1c4e6141998-04-21 15:23:55 +00001930 MacInvertRgn(rgn);
Guido van Rossume56db431995-03-19 22:49:50 +00001931 Py_INCREF(Py_None);
1932 _res = Py_None;
1933 return _res;
1934}
1935
Jack Jansen1c4e6141998-04-21 15:23:55 +00001936static PyObject *Qd_MacFillRgn(_self, _args)
Jack Jansen04a02e71996-01-06 17:12:58 +00001937 PyObject *_self;
1938 PyObject *_args;
1939{
1940 PyObject *_res = NULL;
1941 RgnHandle rgn;
1942 Pattern *pat__in__;
1943 int pat__in_len__;
1944 if (!PyArg_ParseTuple(_args, "O&s#",
1945 ResObj_Convert, &rgn,
1946 (char **)&pat__in__, &pat__in_len__))
1947 return NULL;
1948 if (pat__in_len__ != sizeof(Pattern))
1949 {
1950 PyErr_SetString(PyExc_TypeError, "buffer length should be sizeof(Pattern)");
1951 goto pat__error__;
1952 }
Jack Jansen1c4e6141998-04-21 15:23:55 +00001953 MacFillRgn(rgn,
1954 pat__in__);
Jack Jansen04a02e71996-01-06 17:12:58 +00001955 Py_INCREF(Py_None);
1956 _res = Py_None;
1957 pat__error__: ;
1958 return _res;
1959}
1960
Guido van Rossume56db431995-03-19 22:49:50 +00001961static PyObject *Qd_ScrollRect(_self, _args)
1962 PyObject *_self;
1963 PyObject *_args;
1964{
1965 PyObject *_res = NULL;
1966 Rect r;
1967 short dh;
1968 short dv;
1969 RgnHandle updateRgn;
1970 if (!PyArg_ParseTuple(_args, "O&hhO&",
1971 PyMac_GetRect, &r,
1972 &dh,
1973 &dv,
1974 ResObj_Convert, &updateRgn))
1975 return NULL;
1976 ScrollRect(&r,
1977 dh,
1978 dv,
1979 updateRgn);
1980 Py_INCREF(Py_None);
1981 _res = Py_None;
1982 return _res;
1983}
1984
Jack Jansen41058c01995-11-16 22:48:29 +00001985static PyObject *Qd_CopyBits(_self, _args)
1986 PyObject *_self;
1987 PyObject *_args;
1988{
1989 PyObject *_res = NULL;
1990 BitMapPtr srcBits;
1991 BitMapPtr dstBits;
1992 Rect srcRect;
1993 Rect dstRect;
1994 short mode;
1995 RgnHandle maskRgn;
1996 if (!PyArg_ParseTuple(_args, "O&O&O&O&hO&",
1997 BMObj_Convert, &srcBits,
1998 BMObj_Convert, &dstBits,
1999 PyMac_GetRect, &srcRect,
2000 PyMac_GetRect, &dstRect,
2001 &mode,
Jack Jansen425e9eb1995-12-12 15:02:03 +00002002 OptResObj_Convert, &maskRgn))
Jack Jansen41058c01995-11-16 22:48:29 +00002003 return NULL;
2004 CopyBits(srcBits,
2005 dstBits,
2006 &srcRect,
2007 &dstRect,
2008 mode,
2009 maskRgn);
2010 Py_INCREF(Py_None);
2011 _res = Py_None;
2012 return _res;
2013}
2014
2015static PyObject *Qd_CopyMask(_self, _args)
2016 PyObject *_self;
2017 PyObject *_args;
2018{
2019 PyObject *_res = NULL;
2020 BitMapPtr srcBits;
2021 BitMapPtr maskBits;
2022 BitMapPtr dstBits;
2023 Rect srcRect;
2024 Rect maskRect;
2025 Rect dstRect;
2026 if (!PyArg_ParseTuple(_args, "O&O&O&O&O&O&",
2027 BMObj_Convert, &srcBits,
2028 BMObj_Convert, &maskBits,
2029 BMObj_Convert, &dstBits,
2030 PyMac_GetRect, &srcRect,
2031 PyMac_GetRect, &maskRect,
2032 PyMac_GetRect, &dstRect))
2033 return NULL;
2034 CopyMask(srcBits,
2035 maskBits,
2036 dstBits,
2037 &srcRect,
2038 &maskRect,
2039 &dstRect);
2040 Py_INCREF(Py_None);
2041 _res = Py_None;
2042 return _res;
2043}
2044
Guido van Rossume56db431995-03-19 22:49:50 +00002045static PyObject *Qd_OpenPicture(_self, _args)
2046 PyObject *_self;
2047 PyObject *_args;
2048{
2049 PyObject *_res = NULL;
2050 PicHandle _rv;
2051 Rect picFrame;
2052 if (!PyArg_ParseTuple(_args, "O&",
2053 PyMac_GetRect, &picFrame))
2054 return NULL;
2055 _rv = OpenPicture(&picFrame);
2056 _res = Py_BuildValue("O&",
2057 ResObj_New, _rv);
2058 return _res;
2059}
2060
2061static PyObject *Qd_PicComment(_self, _args)
2062 PyObject *_self;
2063 PyObject *_args;
2064{
2065 PyObject *_res = NULL;
2066 short kind;
2067 short dataSize;
2068 Handle dataHandle;
2069 if (!PyArg_ParseTuple(_args, "hhO&",
2070 &kind,
2071 &dataSize,
2072 ResObj_Convert, &dataHandle))
2073 return NULL;
2074 PicComment(kind,
2075 dataSize,
2076 dataHandle);
2077 Py_INCREF(Py_None);
2078 _res = Py_None;
2079 return _res;
2080}
2081
2082static PyObject *Qd_ClosePicture(_self, _args)
2083 PyObject *_self;
2084 PyObject *_args;
2085{
2086 PyObject *_res = NULL;
2087 if (!PyArg_ParseTuple(_args, ""))
2088 return NULL;
2089 ClosePicture();
2090 Py_INCREF(Py_None);
2091 _res = Py_None;
2092 return _res;
2093}
2094
2095static PyObject *Qd_DrawPicture(_self, _args)
2096 PyObject *_self;
2097 PyObject *_args;
2098{
2099 PyObject *_res = NULL;
2100 PicHandle myPicture;
2101 Rect dstRect;
2102 if (!PyArg_ParseTuple(_args, "O&O&",
2103 ResObj_Convert, &myPicture,
2104 PyMac_GetRect, &dstRect))
2105 return NULL;
2106 DrawPicture(myPicture,
2107 &dstRect);
2108 Py_INCREF(Py_None);
2109 _res = Py_None;
2110 return _res;
2111}
2112
2113static PyObject *Qd_KillPicture(_self, _args)
2114 PyObject *_self;
2115 PyObject *_args;
2116{
2117 PyObject *_res = NULL;
2118 PicHandle myPicture;
2119 if (!PyArg_ParseTuple(_args, "O&",
2120 ResObj_Convert, &myPicture))
2121 return NULL;
2122 KillPicture(myPicture);
2123 Py_INCREF(Py_None);
2124 _res = Py_None;
2125 return _res;
2126}
2127
2128static PyObject *Qd_OpenPoly(_self, _args)
2129 PyObject *_self;
2130 PyObject *_args;
2131{
2132 PyObject *_res = NULL;
2133 PolyHandle _rv;
2134 if (!PyArg_ParseTuple(_args, ""))
2135 return NULL;
2136 _rv = OpenPoly();
2137 _res = Py_BuildValue("O&",
2138 ResObj_New, _rv);
2139 return _res;
2140}
2141
2142static PyObject *Qd_ClosePoly(_self, _args)
2143 PyObject *_self;
2144 PyObject *_args;
2145{
2146 PyObject *_res = NULL;
2147 if (!PyArg_ParseTuple(_args, ""))
2148 return NULL;
2149 ClosePoly();
2150 Py_INCREF(Py_None);
2151 _res = Py_None;
2152 return _res;
2153}
2154
2155static PyObject *Qd_KillPoly(_self, _args)
2156 PyObject *_self;
2157 PyObject *_args;
2158{
2159 PyObject *_res = NULL;
2160 PolyHandle poly;
2161 if (!PyArg_ParseTuple(_args, "O&",
2162 ResObj_Convert, &poly))
2163 return NULL;
2164 KillPoly(poly);
2165 Py_INCREF(Py_None);
2166 _res = Py_None;
2167 return _res;
2168}
2169
2170static PyObject *Qd_OffsetPoly(_self, _args)
2171 PyObject *_self;
2172 PyObject *_args;
2173{
2174 PyObject *_res = NULL;
2175 PolyHandle poly;
2176 short dh;
2177 short dv;
2178 if (!PyArg_ParseTuple(_args, "O&hh",
2179 ResObj_Convert, &poly,
2180 &dh,
2181 &dv))
2182 return NULL;
2183 OffsetPoly(poly,
2184 dh,
2185 dv);
2186 Py_INCREF(Py_None);
2187 _res = Py_None;
2188 return _res;
2189}
2190
2191static PyObject *Qd_FramePoly(_self, _args)
2192 PyObject *_self;
2193 PyObject *_args;
2194{
2195 PyObject *_res = NULL;
2196 PolyHandle poly;
2197 if (!PyArg_ParseTuple(_args, "O&",
2198 ResObj_Convert, &poly))
2199 return NULL;
2200 FramePoly(poly);
2201 Py_INCREF(Py_None);
2202 _res = Py_None;
2203 return _res;
2204}
2205
2206static PyObject *Qd_PaintPoly(_self, _args)
2207 PyObject *_self;
2208 PyObject *_args;
2209{
2210 PyObject *_res = NULL;
2211 PolyHandle poly;
2212 if (!PyArg_ParseTuple(_args, "O&",
2213 ResObj_Convert, &poly))
2214 return NULL;
2215 PaintPoly(poly);
2216 Py_INCREF(Py_None);
2217 _res = Py_None;
2218 return _res;
2219}
2220
2221static PyObject *Qd_ErasePoly(_self, _args)
2222 PyObject *_self;
2223 PyObject *_args;
2224{
2225 PyObject *_res = NULL;
2226 PolyHandle poly;
2227 if (!PyArg_ParseTuple(_args, "O&",
2228 ResObj_Convert, &poly))
2229 return NULL;
2230 ErasePoly(poly);
2231 Py_INCREF(Py_None);
2232 _res = Py_None;
2233 return _res;
2234}
2235
2236static PyObject *Qd_InvertPoly(_self, _args)
2237 PyObject *_self;
2238 PyObject *_args;
2239{
2240 PyObject *_res = NULL;
2241 PolyHandle poly;
2242 if (!PyArg_ParseTuple(_args, "O&",
2243 ResObj_Convert, &poly))
2244 return NULL;
2245 InvertPoly(poly);
2246 Py_INCREF(Py_None);
2247 _res = Py_None;
2248 return _res;
2249}
2250
Jack Jansen04a02e71996-01-06 17:12:58 +00002251static PyObject *Qd_FillPoly(_self, _args)
2252 PyObject *_self;
2253 PyObject *_args;
2254{
2255 PyObject *_res = NULL;
2256 PolyHandle poly;
2257 Pattern *pat__in__;
2258 int pat__in_len__;
2259 if (!PyArg_ParseTuple(_args, "O&s#",
2260 ResObj_Convert, &poly,
2261 (char **)&pat__in__, &pat__in_len__))
2262 return NULL;
2263 if (pat__in_len__ != sizeof(Pattern))
2264 {
2265 PyErr_SetString(PyExc_TypeError, "buffer length should be sizeof(Pattern)");
2266 goto pat__error__;
2267 }
2268 FillPoly(poly,
2269 pat__in__);
2270 Py_INCREF(Py_None);
2271 _res = Py_None;
2272 pat__error__: ;
2273 return _res;
2274}
2275
Guido van Rossume56db431995-03-19 22:49:50 +00002276static PyObject *Qd_SetPt(_self, _args)
2277 PyObject *_self;
2278 PyObject *_args;
2279{
2280 PyObject *_res = NULL;
2281 Point pt;
2282 short h;
2283 short v;
Jack Jansen1d8ede71996-01-08 23:47:31 +00002284 if (!PyArg_ParseTuple(_args, "hh",
Guido van Rossume56db431995-03-19 22:49:50 +00002285 &h,
2286 &v))
2287 return NULL;
2288 SetPt(&pt,
2289 h,
2290 v);
2291 _res = Py_BuildValue("O&",
2292 PyMac_BuildPoint, pt);
2293 return _res;
2294}
2295
2296static PyObject *Qd_LocalToGlobal(_self, _args)
2297 PyObject *_self;
2298 PyObject *_args;
2299{
2300 PyObject *_res = NULL;
2301 Point pt;
2302 if (!PyArg_ParseTuple(_args, "O&",
2303 PyMac_GetPoint, &pt))
2304 return NULL;
2305 LocalToGlobal(&pt);
2306 _res = Py_BuildValue("O&",
2307 PyMac_BuildPoint, pt);
2308 return _res;
2309}
2310
2311static PyObject *Qd_GlobalToLocal(_self, _args)
2312 PyObject *_self;
2313 PyObject *_args;
2314{
2315 PyObject *_res = NULL;
2316 Point pt;
2317 if (!PyArg_ParseTuple(_args, "O&",
2318 PyMac_GetPoint, &pt))
2319 return NULL;
2320 GlobalToLocal(&pt);
2321 _res = Py_BuildValue("O&",
2322 PyMac_BuildPoint, pt);
2323 return _res;
2324}
2325
2326static PyObject *Qd_Random(_self, _args)
2327 PyObject *_self;
2328 PyObject *_args;
2329{
2330 PyObject *_res = NULL;
2331 short _rv;
2332 if (!PyArg_ParseTuple(_args, ""))
2333 return NULL;
2334 _rv = Random();
2335 _res = Py_BuildValue("h",
2336 _rv);
2337 return _res;
2338}
2339
Jack Jansen1c4e6141998-04-21 15:23:55 +00002340static PyObject *Qd_MacGetPixel(_self, _args)
Guido van Rossume56db431995-03-19 22:49:50 +00002341 PyObject *_self;
2342 PyObject *_args;
2343{
2344 PyObject *_res = NULL;
2345 Boolean _rv;
2346 short h;
2347 short v;
2348 if (!PyArg_ParseTuple(_args, "hh",
2349 &h,
2350 &v))
2351 return NULL;
Jack Jansen1c4e6141998-04-21 15:23:55 +00002352 _rv = MacGetPixel(h,
2353 v);
Guido van Rossume56db431995-03-19 22:49:50 +00002354 _res = Py_BuildValue("b",
2355 _rv);
2356 return _res;
2357}
2358
2359static PyObject *Qd_ScalePt(_self, _args)
2360 PyObject *_self;
2361 PyObject *_args;
2362{
2363 PyObject *_res = NULL;
2364 Point pt;
2365 Rect srcRect;
2366 Rect dstRect;
2367 if (!PyArg_ParseTuple(_args, "O&O&O&",
2368 PyMac_GetPoint, &pt,
2369 PyMac_GetRect, &srcRect,
2370 PyMac_GetRect, &dstRect))
2371 return NULL;
2372 ScalePt(&pt,
2373 &srcRect,
2374 &dstRect);
2375 _res = Py_BuildValue("O&",
2376 PyMac_BuildPoint, pt);
2377 return _res;
2378}
2379
2380static PyObject *Qd_MapPt(_self, _args)
2381 PyObject *_self;
2382 PyObject *_args;
2383{
2384 PyObject *_res = NULL;
2385 Point pt;
2386 Rect srcRect;
2387 Rect dstRect;
2388 if (!PyArg_ParseTuple(_args, "O&O&O&",
2389 PyMac_GetPoint, &pt,
2390 PyMac_GetRect, &srcRect,
2391 PyMac_GetRect, &dstRect))
2392 return NULL;
2393 MapPt(&pt,
2394 &srcRect,
2395 &dstRect);
2396 _res = Py_BuildValue("O&",
2397 PyMac_BuildPoint, pt);
2398 return _res;
2399}
2400
2401static PyObject *Qd_MapRect(_self, _args)
2402 PyObject *_self;
2403 PyObject *_args;
2404{
2405 PyObject *_res = NULL;
2406 Rect r;
2407 Rect srcRect;
2408 Rect dstRect;
Jack Jansen54c8f7e1995-11-14 10:46:01 +00002409 if (!PyArg_ParseTuple(_args, "O&O&O&",
2410 PyMac_GetRect, &r,
Guido van Rossume56db431995-03-19 22:49:50 +00002411 PyMac_GetRect, &srcRect,
2412 PyMac_GetRect, &dstRect))
2413 return NULL;
2414 MapRect(&r,
2415 &srcRect,
2416 &dstRect);
2417 _res = Py_BuildValue("O&",
2418 PyMac_BuildRect, &r);
2419 return _res;
2420}
2421
2422static PyObject *Qd_MapRgn(_self, _args)
2423 PyObject *_self;
2424 PyObject *_args;
2425{
2426 PyObject *_res = NULL;
2427 RgnHandle rgn;
2428 Rect srcRect;
2429 Rect dstRect;
2430 if (!PyArg_ParseTuple(_args, "O&O&O&",
2431 ResObj_Convert, &rgn,
2432 PyMac_GetRect, &srcRect,
2433 PyMac_GetRect, &dstRect))
2434 return NULL;
2435 MapRgn(rgn,
2436 &srcRect,
2437 &dstRect);
2438 Py_INCREF(Py_None);
2439 _res = Py_None;
2440 return _res;
2441}
2442
2443static PyObject *Qd_MapPoly(_self, _args)
2444 PyObject *_self;
2445 PyObject *_args;
2446{
2447 PyObject *_res = NULL;
2448 PolyHandle poly;
2449 Rect srcRect;
2450 Rect dstRect;
2451 if (!PyArg_ParseTuple(_args, "O&O&O&",
2452 ResObj_Convert, &poly,
2453 PyMac_GetRect, &srcRect,
2454 PyMac_GetRect, &dstRect))
2455 return NULL;
2456 MapPoly(poly,
2457 &srcRect,
2458 &dstRect);
2459 Py_INCREF(Py_None);
2460 _res = Py_None;
2461 return _res;
2462}
2463
Jack Jansen41058c01995-11-16 22:48:29 +00002464static PyObject *Qd_StdBits(_self, _args)
2465 PyObject *_self;
2466 PyObject *_args;
2467{
2468 PyObject *_res = NULL;
2469 BitMapPtr srcBits;
2470 Rect srcRect;
2471 Rect dstRect;
2472 short mode;
2473 RgnHandle maskRgn;
2474 if (!PyArg_ParseTuple(_args, "O&O&O&hO&",
2475 BMObj_Convert, &srcBits,
2476 PyMac_GetRect, &srcRect,
2477 PyMac_GetRect, &dstRect,
2478 &mode,
Jack Jansen425e9eb1995-12-12 15:02:03 +00002479 OptResObj_Convert, &maskRgn))
Jack Jansen41058c01995-11-16 22:48:29 +00002480 return NULL;
2481 StdBits(srcBits,
2482 &srcRect,
2483 &dstRect,
2484 mode,
2485 maskRgn);
2486 Py_INCREF(Py_None);
2487 _res = Py_None;
2488 return _res;
2489}
2490
Guido van Rossume56db431995-03-19 22:49:50 +00002491static PyObject *Qd_AddPt(_self, _args)
2492 PyObject *_self;
2493 PyObject *_args;
2494{
2495 PyObject *_res = NULL;
2496 Point src;
2497 Point dst;
2498 if (!PyArg_ParseTuple(_args, "O&O&",
2499 PyMac_GetPoint, &src,
2500 PyMac_GetPoint, &dst))
2501 return NULL;
2502 AddPt(src,
2503 &dst);
2504 _res = Py_BuildValue("O&",
2505 PyMac_BuildPoint, dst);
2506 return _res;
2507}
2508
2509static PyObject *Qd_EqualPt(_self, _args)
2510 PyObject *_self;
2511 PyObject *_args;
2512{
2513 PyObject *_res = NULL;
2514 Boolean _rv;
2515 Point pt1;
2516 Point pt2;
2517 if (!PyArg_ParseTuple(_args, "O&O&",
2518 PyMac_GetPoint, &pt1,
2519 PyMac_GetPoint, &pt2))
2520 return NULL;
2521 _rv = EqualPt(pt1,
2522 pt2);
2523 _res = Py_BuildValue("b",
2524 _rv);
2525 return _res;
2526}
2527
Jack Jansen1c4e6141998-04-21 15:23:55 +00002528static PyObject *Qd_MacPtInRect(_self, _args)
Guido van Rossume56db431995-03-19 22:49:50 +00002529 PyObject *_self;
2530 PyObject *_args;
2531{
2532 PyObject *_res = NULL;
2533 Boolean _rv;
2534 Point pt;
2535 Rect r;
2536 if (!PyArg_ParseTuple(_args, "O&O&",
2537 PyMac_GetPoint, &pt,
2538 PyMac_GetRect, &r))
2539 return NULL;
Jack Jansen1c4e6141998-04-21 15:23:55 +00002540 _rv = MacPtInRect(pt,
2541 &r);
Guido van Rossume56db431995-03-19 22:49:50 +00002542 _res = Py_BuildValue("b",
2543 _rv);
2544 return _res;
2545}
2546
2547static PyObject *Qd_Pt2Rect(_self, _args)
2548 PyObject *_self;
2549 PyObject *_args;
2550{
2551 PyObject *_res = NULL;
2552 Point pt1;
2553 Point pt2;
2554 Rect dstRect;
2555 if (!PyArg_ParseTuple(_args, "O&O&",
2556 PyMac_GetPoint, &pt1,
2557 PyMac_GetPoint, &pt2))
2558 return NULL;
2559 Pt2Rect(pt1,
2560 pt2,
2561 &dstRect);
2562 _res = Py_BuildValue("O&",
2563 PyMac_BuildRect, &dstRect);
2564 return _res;
2565}
2566
2567static PyObject *Qd_PtToAngle(_self, _args)
2568 PyObject *_self;
2569 PyObject *_args;
2570{
2571 PyObject *_res = NULL;
2572 Rect r;
2573 Point pt;
2574 short angle;
2575 if (!PyArg_ParseTuple(_args, "O&O&",
2576 PyMac_GetRect, &r,
2577 PyMac_GetPoint, &pt))
2578 return NULL;
2579 PtToAngle(&r,
2580 pt,
2581 &angle);
2582 _res = Py_BuildValue("h",
2583 angle);
2584 return _res;
2585}
2586
Jack Jansenb81cf9d1995-06-06 13:08:40 +00002587static PyObject *Qd_SubPt(_self, _args)
2588 PyObject *_self;
2589 PyObject *_args;
2590{
2591 PyObject *_res = NULL;
2592 Point src;
2593 Point dst;
2594 if (!PyArg_ParseTuple(_args, "O&O&",
2595 PyMac_GetPoint, &src,
2596 PyMac_GetPoint, &dst))
2597 return NULL;
2598 SubPt(src,
2599 &dst);
2600 _res = Py_BuildValue("O&",
2601 PyMac_BuildPoint, dst);
2602 return _res;
2603}
2604
Guido van Rossume56db431995-03-19 22:49:50 +00002605static PyObject *Qd_PtInRgn(_self, _args)
2606 PyObject *_self;
2607 PyObject *_args;
2608{
2609 PyObject *_res = NULL;
2610 Boolean _rv;
2611 Point pt;
2612 RgnHandle rgn;
2613 if (!PyArg_ParseTuple(_args, "O&O&",
2614 PyMac_GetPoint, &pt,
2615 ResObj_Convert, &rgn))
2616 return NULL;
2617 _rv = PtInRgn(pt,
2618 rgn);
2619 _res = Py_BuildValue("b",
2620 _rv);
2621 return _res;
2622}
2623
2624static PyObject *Qd_NewPixMap(_self, _args)
2625 PyObject *_self;
2626 PyObject *_args;
2627{
2628 PyObject *_res = NULL;
2629 PixMapHandle _rv;
2630 if (!PyArg_ParseTuple(_args, ""))
2631 return NULL;
2632 _rv = NewPixMap();
2633 _res = Py_BuildValue("O&",
2634 ResObj_New, _rv);
2635 return _res;
2636}
2637
Guido van Rossume56db431995-03-19 22:49:50 +00002638static PyObject *Qd_DisposePixMap(_self, _args)
2639 PyObject *_self;
2640 PyObject *_args;
2641{
2642 PyObject *_res = NULL;
2643 PixMapHandle pm;
2644 if (!PyArg_ParseTuple(_args, "O&",
2645 ResObj_Convert, &pm))
2646 return NULL;
2647 DisposePixMap(pm);
2648 Py_INCREF(Py_None);
2649 _res = Py_None;
2650 return _res;
2651}
2652
2653static PyObject *Qd_CopyPixMap(_self, _args)
2654 PyObject *_self;
2655 PyObject *_args;
2656{
2657 PyObject *_res = NULL;
2658 PixMapHandle srcPM;
2659 PixMapHandle dstPM;
2660 if (!PyArg_ParseTuple(_args, "O&O&",
2661 ResObj_Convert, &srcPM,
2662 ResObj_Convert, &dstPM))
2663 return NULL;
2664 CopyPixMap(srcPM,
2665 dstPM);
2666 Py_INCREF(Py_None);
2667 _res = Py_None;
2668 return _res;
2669}
2670
2671static PyObject *Qd_NewPixPat(_self, _args)
2672 PyObject *_self;
2673 PyObject *_args;
2674{
2675 PyObject *_res = NULL;
2676 PixPatHandle _rv;
2677 if (!PyArg_ParseTuple(_args, ""))
2678 return NULL;
2679 _rv = NewPixPat();
2680 _res = Py_BuildValue("O&",
2681 ResObj_New, _rv);
2682 return _res;
2683}
2684
Guido van Rossume56db431995-03-19 22:49:50 +00002685static PyObject *Qd_DisposePixPat(_self, _args)
2686 PyObject *_self;
2687 PyObject *_args;
2688{
2689 PyObject *_res = NULL;
2690 PixPatHandle pp;
2691 if (!PyArg_ParseTuple(_args, "O&",
2692 ResObj_Convert, &pp))
2693 return NULL;
2694 DisposePixPat(pp);
2695 Py_INCREF(Py_None);
2696 _res = Py_None;
2697 return _res;
2698}
2699
2700static PyObject *Qd_CopyPixPat(_self, _args)
2701 PyObject *_self;
2702 PyObject *_args;
2703{
2704 PyObject *_res = NULL;
2705 PixPatHandle srcPP;
2706 PixPatHandle dstPP;
2707 if (!PyArg_ParseTuple(_args, "O&O&",
2708 ResObj_Convert, &srcPP,
2709 ResObj_Convert, &dstPP))
2710 return NULL;
2711 CopyPixPat(srcPP,
2712 dstPP);
2713 Py_INCREF(Py_None);
2714 _res = Py_None;
2715 return _res;
2716}
2717
2718static PyObject *Qd_PenPixPat(_self, _args)
2719 PyObject *_self;
2720 PyObject *_args;
2721{
2722 PyObject *_res = NULL;
2723 PixPatHandle pp;
2724 if (!PyArg_ParseTuple(_args, "O&",
2725 ResObj_Convert, &pp))
2726 return NULL;
2727 PenPixPat(pp);
2728 Py_INCREF(Py_None);
2729 _res = Py_None;
2730 return _res;
2731}
2732
2733static PyObject *Qd_BackPixPat(_self, _args)
2734 PyObject *_self;
2735 PyObject *_args;
2736{
2737 PyObject *_res = NULL;
2738 PixPatHandle pp;
2739 if (!PyArg_ParseTuple(_args, "O&",
2740 ResObj_Convert, &pp))
2741 return NULL;
2742 BackPixPat(pp);
2743 Py_INCREF(Py_None);
2744 _res = Py_None;
2745 return _res;
2746}
2747
2748static PyObject *Qd_GetPixPat(_self, _args)
2749 PyObject *_self;
2750 PyObject *_args;
2751{
2752 PyObject *_res = NULL;
2753 PixPatHandle _rv;
2754 short patID;
2755 if (!PyArg_ParseTuple(_args, "h",
2756 &patID))
2757 return NULL;
2758 _rv = GetPixPat(patID);
2759 _res = Py_BuildValue("O&",
2760 ResObj_New, _rv);
2761 return _res;
2762}
2763
Jack Jansen232f3cd1995-12-09 14:04:31 +00002764static PyObject *Qd_MakeRGBPat(_self, _args)
2765 PyObject *_self;
2766 PyObject *_args;
2767{
2768 PyObject *_res = NULL;
2769 PixPatHandle pp;
2770 RGBColor myColor;
2771 if (!PyArg_ParseTuple(_args, "O&O&",
2772 ResObj_Convert, &pp,
2773 QdRGB_Convert, &myColor))
2774 return NULL;
2775 MakeRGBPat(pp,
2776 &myColor);
2777 Py_INCREF(Py_None);
2778 _res = Py_None;
2779 return _res;
2780}
2781
Guido van Rossume56db431995-03-19 22:49:50 +00002782static PyObject *Qd_FillCRect(_self, _args)
2783 PyObject *_self;
2784 PyObject *_args;
2785{
2786 PyObject *_res = NULL;
2787 Rect r;
2788 PixPatHandle pp;
2789 if (!PyArg_ParseTuple(_args, "O&O&",
2790 PyMac_GetRect, &r,
2791 ResObj_Convert, &pp))
2792 return NULL;
2793 FillCRect(&r,
2794 pp);
2795 Py_INCREF(Py_None);
2796 _res = Py_None;
2797 return _res;
2798}
2799
2800static PyObject *Qd_FillCOval(_self, _args)
2801 PyObject *_self;
2802 PyObject *_args;
2803{
2804 PyObject *_res = NULL;
2805 Rect r;
2806 PixPatHandle pp;
2807 if (!PyArg_ParseTuple(_args, "O&O&",
2808 PyMac_GetRect, &r,
2809 ResObj_Convert, &pp))
2810 return NULL;
2811 FillCOval(&r,
2812 pp);
2813 Py_INCREF(Py_None);
2814 _res = Py_None;
2815 return _res;
2816}
2817
2818static PyObject *Qd_FillCRoundRect(_self, _args)
2819 PyObject *_self;
2820 PyObject *_args;
2821{
2822 PyObject *_res = NULL;
2823 Rect r;
2824 short ovalWidth;
2825 short ovalHeight;
2826 PixPatHandle pp;
2827 if (!PyArg_ParseTuple(_args, "O&hhO&",
2828 PyMac_GetRect, &r,
2829 &ovalWidth,
2830 &ovalHeight,
2831 ResObj_Convert, &pp))
2832 return NULL;
2833 FillCRoundRect(&r,
2834 ovalWidth,
2835 ovalHeight,
2836 pp);
2837 Py_INCREF(Py_None);
2838 _res = Py_None;
2839 return _res;
2840}
2841
2842static PyObject *Qd_FillCArc(_self, _args)
2843 PyObject *_self;
2844 PyObject *_args;
2845{
2846 PyObject *_res = NULL;
2847 Rect r;
2848 short startAngle;
2849 short arcAngle;
2850 PixPatHandle pp;
2851 if (!PyArg_ParseTuple(_args, "O&hhO&",
2852 PyMac_GetRect, &r,
2853 &startAngle,
2854 &arcAngle,
2855 ResObj_Convert, &pp))
2856 return NULL;
2857 FillCArc(&r,
2858 startAngle,
2859 arcAngle,
2860 pp);
2861 Py_INCREF(Py_None);
2862 _res = Py_None;
2863 return _res;
2864}
2865
2866static PyObject *Qd_FillCRgn(_self, _args)
2867 PyObject *_self;
2868 PyObject *_args;
2869{
2870 PyObject *_res = NULL;
2871 RgnHandle rgn;
2872 PixPatHandle pp;
2873 if (!PyArg_ParseTuple(_args, "O&O&",
2874 ResObj_Convert, &rgn,
2875 ResObj_Convert, &pp))
2876 return NULL;
2877 FillCRgn(rgn,
2878 pp);
2879 Py_INCREF(Py_None);
2880 _res = Py_None;
2881 return _res;
2882}
2883
2884static PyObject *Qd_FillCPoly(_self, _args)
2885 PyObject *_self;
2886 PyObject *_args;
2887{
2888 PyObject *_res = NULL;
2889 PolyHandle poly;
2890 PixPatHandle pp;
2891 if (!PyArg_ParseTuple(_args, "O&O&",
2892 ResObj_Convert, &poly,
2893 ResObj_Convert, &pp))
2894 return NULL;
2895 FillCPoly(poly,
2896 pp);
2897 Py_INCREF(Py_None);
2898 _res = Py_None;
2899 return _res;
2900}
2901
Jack Jansen232f3cd1995-12-09 14:04:31 +00002902static PyObject *Qd_RGBForeColor(_self, _args)
2903 PyObject *_self;
2904 PyObject *_args;
2905{
2906 PyObject *_res = NULL;
2907 RGBColor color;
2908 if (!PyArg_ParseTuple(_args, "O&",
2909 QdRGB_Convert, &color))
2910 return NULL;
2911 RGBForeColor(&color);
2912 Py_INCREF(Py_None);
2913 _res = Py_None;
2914 return _res;
2915}
2916
2917static PyObject *Qd_RGBBackColor(_self, _args)
2918 PyObject *_self;
2919 PyObject *_args;
2920{
2921 PyObject *_res = NULL;
2922 RGBColor color;
2923 if (!PyArg_ParseTuple(_args, "O&",
2924 QdRGB_Convert, &color))
2925 return NULL;
2926 RGBBackColor(&color);
2927 Py_INCREF(Py_None);
2928 _res = Py_None;
2929 return _res;
2930}
2931
2932static PyObject *Qd_SetCPixel(_self, _args)
2933 PyObject *_self;
2934 PyObject *_args;
2935{
2936 PyObject *_res = NULL;
2937 short h;
2938 short v;
2939 RGBColor cPix;
2940 if (!PyArg_ParseTuple(_args, "hhO&",
2941 &h,
2942 &v,
2943 QdRGB_Convert, &cPix))
2944 return NULL;
2945 SetCPixel(h,
2946 v,
2947 &cPix);
2948 Py_INCREF(Py_None);
2949 _res = Py_None;
2950 return _res;
2951}
2952
Guido van Rossume56db431995-03-19 22:49:50 +00002953static PyObject *Qd_SetPortPix(_self, _args)
2954 PyObject *_self;
2955 PyObject *_args;
2956{
2957 PyObject *_res = NULL;
2958 PixMapHandle pm;
2959 if (!PyArg_ParseTuple(_args, "O&",
2960 ResObj_Convert, &pm))
2961 return NULL;
2962 SetPortPix(pm);
2963 Py_INCREF(Py_None);
2964 _res = Py_None;
2965 return _res;
2966}
2967
Jack Jansen232f3cd1995-12-09 14:04:31 +00002968static PyObject *Qd_GetCPixel(_self, _args)
2969 PyObject *_self;
2970 PyObject *_args;
2971{
2972 PyObject *_res = NULL;
2973 short h;
2974 short v;
2975 RGBColor cPix;
2976 if (!PyArg_ParseTuple(_args, "hh",
2977 &h,
2978 &v))
2979 return NULL;
2980 GetCPixel(h,
2981 v,
2982 &cPix);
2983 _res = Py_BuildValue("O&",
2984 QdRGB_New, &cPix);
2985 return _res;
2986}
2987
2988static PyObject *Qd_GetForeColor(_self, _args)
2989 PyObject *_self;
2990 PyObject *_args;
2991{
2992 PyObject *_res = NULL;
2993 RGBColor color;
2994 if (!PyArg_ParseTuple(_args, ""))
2995 return NULL;
2996 GetForeColor(&color);
2997 _res = Py_BuildValue("O&",
2998 QdRGB_New, &color);
2999 return _res;
3000}
3001
3002static PyObject *Qd_GetBackColor(_self, _args)
3003 PyObject *_self;
3004 PyObject *_args;
3005{
3006 PyObject *_res = NULL;
3007 RGBColor color;
3008 if (!PyArg_ParseTuple(_args, ""))
3009 return NULL;
3010 GetBackColor(&color);
3011 _res = Py_BuildValue("O&",
3012 QdRGB_New, &color);
3013 return _res;
3014}
3015
3016static PyObject *Qd_OpColor(_self, _args)
3017 PyObject *_self;
3018 PyObject *_args;
3019{
3020 PyObject *_res = NULL;
3021 RGBColor color;
3022 if (!PyArg_ParseTuple(_args, "O&",
3023 QdRGB_Convert, &color))
3024 return NULL;
3025 OpColor(&color);
3026 Py_INCREF(Py_None);
3027 _res = Py_None;
3028 return _res;
3029}
3030
3031static PyObject *Qd_HiliteColor(_self, _args)
3032 PyObject *_self;
3033 PyObject *_args;
3034{
3035 PyObject *_res = NULL;
3036 RGBColor color;
3037 if (!PyArg_ParseTuple(_args, "O&",
3038 QdRGB_Convert, &color))
3039 return NULL;
3040 HiliteColor(&color);
3041 Py_INCREF(Py_None);
3042 _res = Py_None;
3043 return _res;
3044}
3045
Jack Jansen69b43ed1997-08-15 14:35:54 +00003046static PyObject *Qd_DisposeCTable(_self, _args)
3047 PyObject *_self;
3048 PyObject *_args;
3049{
3050 PyObject *_res = NULL;
3051 CTabHandle cTable;
3052 if (!PyArg_ParseTuple(_args, "O&",
3053 ResObj_Convert, &cTable))
3054 return NULL;
3055 DisposeCTable(cTable);
3056 Py_INCREF(Py_None);
3057 _res = Py_None;
3058 return _res;
3059}
3060
3061static PyObject *Qd_GetCTable(_self, _args)
3062 PyObject *_self;
3063 PyObject *_args;
3064{
3065 PyObject *_res = NULL;
3066 CTabHandle _rv;
3067 short ctID;
3068 if (!PyArg_ParseTuple(_args, "h",
3069 &ctID))
3070 return NULL;
3071 _rv = GetCTable(ctID);
3072 _res = Py_BuildValue("O&",
3073 ResObj_New, _rv);
3074 return _res;
3075}
3076
3077static PyObject *Qd_GetCCursor(_self, _args)
3078 PyObject *_self;
3079 PyObject *_args;
3080{
3081 PyObject *_res = NULL;
3082 CCrsrHandle _rv;
3083 short crsrID;
3084 if (!PyArg_ParseTuple(_args, "h",
3085 &crsrID))
3086 return NULL;
3087 _rv = GetCCursor(crsrID);
3088 _res = Py_BuildValue("O&",
3089 ResObj_New, _rv);
3090 return _res;
3091}
3092
3093static PyObject *Qd_SetCCursor(_self, _args)
3094 PyObject *_self;
3095 PyObject *_args;
3096{
3097 PyObject *_res = NULL;
3098 CCrsrHandle cCrsr;
3099 if (!PyArg_ParseTuple(_args, "O&",
3100 ResObj_Convert, &cCrsr))
3101 return NULL;
3102 SetCCursor(cCrsr);
3103 Py_INCREF(Py_None);
3104 _res = Py_None;
3105 return _res;
3106}
3107
Guido van Rossume56db431995-03-19 22:49:50 +00003108static PyObject *Qd_AllocCursor(_self, _args)
3109 PyObject *_self;
3110 PyObject *_args;
3111{
3112 PyObject *_res = NULL;
3113 if (!PyArg_ParseTuple(_args, ""))
3114 return NULL;
3115 AllocCursor();
3116 Py_INCREF(Py_None);
3117 _res = Py_None;
3118 return _res;
3119}
3120
Jack Jansen69b43ed1997-08-15 14:35:54 +00003121static PyObject *Qd_DisposeCCursor(_self, _args)
3122 PyObject *_self;
3123 PyObject *_args;
3124{
3125 PyObject *_res = NULL;
3126 CCrsrHandle cCrsr;
3127 if (!PyArg_ParseTuple(_args, "O&",
3128 ResObj_Convert, &cCrsr))
3129 return NULL;
3130 DisposeCCursor(cCrsr);
3131 Py_INCREF(Py_None);
3132 _res = Py_None;
3133 return _res;
3134}
3135
3136static PyObject *Qd_GetMaxDevice(_self, _args)
3137 PyObject *_self;
3138 PyObject *_args;
3139{
3140 PyObject *_res = NULL;
3141 GDHandle _rv;
3142 Rect globalRect;
3143 if (!PyArg_ParseTuple(_args, "O&",
3144 PyMac_GetRect, &globalRect))
3145 return NULL;
3146 _rv = GetMaxDevice(&globalRect);
3147 _res = Py_BuildValue("O&",
3148 ResObj_New, _rv);
3149 return _res;
3150}
3151
Guido van Rossume56db431995-03-19 22:49:50 +00003152static PyObject *Qd_GetCTSeed(_self, _args)
3153 PyObject *_self;
3154 PyObject *_args;
3155{
3156 PyObject *_res = NULL;
3157 long _rv;
3158 if (!PyArg_ParseTuple(_args, ""))
3159 return NULL;
3160 _rv = GetCTSeed();
3161 _res = Py_BuildValue("l",
3162 _rv);
3163 return _res;
3164}
3165
Jack Jansen69b43ed1997-08-15 14:35:54 +00003166static PyObject *Qd_GetDeviceList(_self, _args)
3167 PyObject *_self;
3168 PyObject *_args;
3169{
3170 PyObject *_res = NULL;
3171 GDHandle _rv;
3172 if (!PyArg_ParseTuple(_args, ""))
3173 return NULL;
3174 _rv = GetDeviceList();
3175 _res = Py_BuildValue("O&",
3176 ResObj_New, _rv);
3177 return _res;
3178}
3179
3180static PyObject *Qd_GetMainDevice(_self, _args)
3181 PyObject *_self;
3182 PyObject *_args;
3183{
3184 PyObject *_res = NULL;
3185 GDHandle _rv;
3186 if (!PyArg_ParseTuple(_args, ""))
3187 return NULL;
3188 _rv = GetMainDevice();
3189 _res = Py_BuildValue("O&",
3190 ResObj_New, _rv);
3191 return _res;
3192}
3193
3194static PyObject *Qd_GetNextDevice(_self, _args)
3195 PyObject *_self;
3196 PyObject *_args;
3197{
3198 PyObject *_res = NULL;
3199 GDHandle _rv;
3200 GDHandle curDevice;
3201 if (!PyArg_ParseTuple(_args, "O&",
3202 ResObj_Convert, &curDevice))
3203 return NULL;
3204 _rv = GetNextDevice(curDevice);
3205 _res = Py_BuildValue("O&",
3206 ResObj_New, _rv);
3207 return _res;
3208}
3209
3210static PyObject *Qd_TestDeviceAttribute(_self, _args)
3211 PyObject *_self;
3212 PyObject *_args;
3213{
3214 PyObject *_res = NULL;
3215 Boolean _rv;
3216 GDHandle gdh;
3217 short attribute;
3218 if (!PyArg_ParseTuple(_args, "O&h",
3219 ResObj_Convert, &gdh,
3220 &attribute))
3221 return NULL;
3222 _rv = TestDeviceAttribute(gdh,
3223 attribute);
3224 _res = Py_BuildValue("b",
3225 _rv);
3226 return _res;
3227}
3228
3229static PyObject *Qd_SetDeviceAttribute(_self, _args)
3230 PyObject *_self;
3231 PyObject *_args;
3232{
3233 PyObject *_res = NULL;
3234 GDHandle gdh;
3235 short attribute;
3236 Boolean value;
3237 if (!PyArg_ParseTuple(_args, "O&hb",
3238 ResObj_Convert, &gdh,
3239 &attribute,
3240 &value))
3241 return NULL;
3242 SetDeviceAttribute(gdh,
3243 attribute,
3244 value);
3245 Py_INCREF(Py_None);
3246 _res = Py_None;
3247 return _res;
3248}
3249
3250static PyObject *Qd_InitGDevice(_self, _args)
3251 PyObject *_self;
3252 PyObject *_args;
3253{
3254 PyObject *_res = NULL;
3255 short qdRefNum;
3256 long mode;
3257 GDHandle gdh;
3258 if (!PyArg_ParseTuple(_args, "hlO&",
3259 &qdRefNum,
3260 &mode,
3261 ResObj_Convert, &gdh))
3262 return NULL;
3263 InitGDevice(qdRefNum,
3264 mode,
3265 gdh);
3266 Py_INCREF(Py_None);
3267 _res = Py_None;
3268 return _res;
3269}
3270
3271static PyObject *Qd_NewGDevice(_self, _args)
3272 PyObject *_self;
3273 PyObject *_args;
3274{
3275 PyObject *_res = NULL;
3276 GDHandle _rv;
3277 short refNum;
3278 long mode;
3279 if (!PyArg_ParseTuple(_args, "hl",
3280 &refNum,
3281 &mode))
3282 return NULL;
3283 _rv = NewGDevice(refNum,
3284 mode);
3285 _res = Py_BuildValue("O&",
3286 ResObj_New, _rv);
3287 return _res;
3288}
3289
3290static PyObject *Qd_DisposeGDevice(_self, _args)
3291 PyObject *_self;
3292 PyObject *_args;
3293{
3294 PyObject *_res = NULL;
3295 GDHandle gdh;
3296 if (!PyArg_ParseTuple(_args, "O&",
3297 ResObj_Convert, &gdh))
3298 return NULL;
3299 DisposeGDevice(gdh);
3300 Py_INCREF(Py_None);
3301 _res = Py_None;
3302 return _res;
3303}
3304
3305static PyObject *Qd_SetGDevice(_self, _args)
3306 PyObject *_self;
3307 PyObject *_args;
3308{
3309 PyObject *_res = NULL;
3310 GDHandle gd;
3311 if (!PyArg_ParseTuple(_args, "O&",
3312 ResObj_Convert, &gd))
3313 return NULL;
3314 SetGDevice(gd);
3315 Py_INCREF(Py_None);
3316 _res = Py_None;
3317 return _res;
3318}
3319
3320static PyObject *Qd_GetGDevice(_self, _args)
3321 PyObject *_self;
3322 PyObject *_args;
3323{
3324 PyObject *_res = NULL;
3325 GDHandle _rv;
3326 if (!PyArg_ParseTuple(_args, ""))
3327 return NULL;
3328 _rv = GetGDevice();
3329 _res = Py_BuildValue("O&",
3330 ResObj_New, _rv);
3331 return _res;
3332}
3333
Jack Jansen232f3cd1995-12-09 14:04:31 +00003334static PyObject *Qd_Color2Index(_self, _args)
3335 PyObject *_self;
3336 PyObject *_args;
3337{
3338 PyObject *_res = NULL;
3339 long _rv;
3340 RGBColor myColor;
3341 if (!PyArg_ParseTuple(_args, "O&",
3342 QdRGB_Convert, &myColor))
3343 return NULL;
3344 _rv = Color2Index(&myColor);
3345 _res = Py_BuildValue("l",
3346 _rv);
3347 return _res;
3348}
3349
3350static PyObject *Qd_Index2Color(_self, _args)
3351 PyObject *_self;
3352 PyObject *_args;
3353{
3354 PyObject *_res = NULL;
3355 long index;
3356 RGBColor aColor;
3357 if (!PyArg_ParseTuple(_args, "l",
3358 &index))
3359 return NULL;
3360 Index2Color(index,
3361 &aColor);
3362 _res = Py_BuildValue("O&",
3363 QdRGB_New, &aColor);
3364 return _res;
3365}
3366
3367static PyObject *Qd_InvertColor(_self, _args)
3368 PyObject *_self;
3369 PyObject *_args;
3370{
3371 PyObject *_res = NULL;
3372 RGBColor myColor;
3373 if (!PyArg_ParseTuple(_args, ""))
3374 return NULL;
3375 InvertColor(&myColor);
3376 _res = Py_BuildValue("O&",
3377 QdRGB_New, &myColor);
3378 return _res;
3379}
3380
3381static PyObject *Qd_RealColor(_self, _args)
3382 PyObject *_self;
3383 PyObject *_args;
3384{
3385 PyObject *_res = NULL;
3386 Boolean _rv;
3387 RGBColor color;
3388 if (!PyArg_ParseTuple(_args, "O&",
3389 QdRGB_Convert, &color))
3390 return NULL;
3391 _rv = RealColor(&color);
3392 _res = Py_BuildValue("b",
3393 _rv);
3394 return _res;
3395}
3396
Jack Jansen69b43ed1997-08-15 14:35:54 +00003397static PyObject *Qd_GetSubTable(_self, _args)
3398 PyObject *_self;
3399 PyObject *_args;
3400{
3401 PyObject *_res = NULL;
3402 CTabHandle myColors;
3403 short iTabRes;
3404 CTabHandle targetTbl;
3405 if (!PyArg_ParseTuple(_args, "O&hO&",
3406 ResObj_Convert, &myColors,
3407 &iTabRes,
3408 ResObj_Convert, &targetTbl))
3409 return NULL;
3410 GetSubTable(myColors,
3411 iTabRes,
3412 targetTbl);
3413 Py_INCREF(Py_None);
3414 _res = Py_None;
3415 return _res;
3416}
3417
3418static PyObject *Qd_MakeITable(_self, _args)
3419 PyObject *_self;
3420 PyObject *_args;
3421{
3422 PyObject *_res = NULL;
3423 CTabHandle cTabH;
3424 ITabHandle iTabH;
3425 short res;
3426 if (!PyArg_ParseTuple(_args, "O&O&h",
3427 ResObj_Convert, &cTabH,
3428 ResObj_Convert, &iTabH,
3429 &res))
3430 return NULL;
3431 MakeITable(cTabH,
3432 iTabH,
3433 res);
3434 Py_INCREF(Py_None);
3435 _res = Py_None;
3436 return _res;
3437}
3438
Guido van Rossume56db431995-03-19 22:49:50 +00003439static PyObject *Qd_SetClientID(_self, _args)
3440 PyObject *_self;
3441 PyObject *_args;
3442{
3443 PyObject *_res = NULL;
3444 short id;
3445 if (!PyArg_ParseTuple(_args, "h",
3446 &id))
3447 return NULL;
3448 SetClientID(id);
3449 Py_INCREF(Py_None);
3450 _res = Py_None;
3451 return _res;
3452}
3453
3454static PyObject *Qd_ProtectEntry(_self, _args)
3455 PyObject *_self;
3456 PyObject *_args;
3457{
3458 PyObject *_res = NULL;
3459 short index;
3460 Boolean protect;
3461 if (!PyArg_ParseTuple(_args, "hb",
3462 &index,
3463 &protect))
3464 return NULL;
3465 ProtectEntry(index,
3466 protect);
3467 Py_INCREF(Py_None);
3468 _res = Py_None;
3469 return _res;
3470}
3471
3472static PyObject *Qd_ReserveEntry(_self, _args)
3473 PyObject *_self;
3474 PyObject *_args;
3475{
3476 PyObject *_res = NULL;
3477 short index;
3478 Boolean reserve;
3479 if (!PyArg_ParseTuple(_args, "hb",
3480 &index,
3481 &reserve))
3482 return NULL;
3483 ReserveEntry(index,
3484 reserve);
3485 Py_INCREF(Py_None);
3486 _res = Py_None;
3487 return _res;
3488}
3489
3490static PyObject *Qd_QDError(_self, _args)
3491 PyObject *_self;
3492 PyObject *_args;
3493{
3494 PyObject *_res = NULL;
3495 short _rv;
3496 if (!PyArg_ParseTuple(_args, ""))
3497 return NULL;
3498 _rv = QDError();
3499 _res = Py_BuildValue("h",
3500 _rv);
3501 return _res;
3502}
3503
Jack Jansen41058c01995-11-16 22:48:29 +00003504static PyObject *Qd_CopyDeepMask(_self, _args)
3505 PyObject *_self;
3506 PyObject *_args;
3507{
3508 PyObject *_res = NULL;
3509 BitMapPtr srcBits;
3510 BitMapPtr maskBits;
3511 BitMapPtr dstBits;
3512 Rect srcRect;
3513 Rect maskRect;
3514 Rect dstRect;
3515 short mode;
3516 RgnHandle maskRgn;
3517 if (!PyArg_ParseTuple(_args, "O&O&O&O&O&O&hO&",
3518 BMObj_Convert, &srcBits,
3519 BMObj_Convert, &maskBits,
3520 BMObj_Convert, &dstBits,
3521 PyMac_GetRect, &srcRect,
3522 PyMac_GetRect, &maskRect,
3523 PyMac_GetRect, &dstRect,
3524 &mode,
Jack Jansen425e9eb1995-12-12 15:02:03 +00003525 OptResObj_Convert, &maskRgn))
Jack Jansen41058c01995-11-16 22:48:29 +00003526 return NULL;
3527 CopyDeepMask(srcBits,
3528 maskBits,
3529 dstBits,
3530 &srcRect,
3531 &maskRect,
3532 &dstRect,
3533 mode,
3534 maskRgn);
3535 Py_INCREF(Py_None);
3536 _res = Py_None;
3537 return _res;
3538}
3539
Jack Jansen54c8f7e1995-11-14 10:46:01 +00003540static PyObject *Qd_GetPattern(_self, _args)
3541 PyObject *_self;
3542 PyObject *_args;
3543{
3544 PyObject *_res = NULL;
3545 PatHandle _rv;
3546 short patternID;
3547 if (!PyArg_ParseTuple(_args, "h",
3548 &patternID))
3549 return NULL;
3550 _rv = GetPattern(patternID);
3551 _res = Py_BuildValue("O&",
3552 ResObj_New, _rv);
3553 return _res;
3554}
3555
Jack Jansen1c4e6141998-04-21 15:23:55 +00003556static PyObject *Qd_MacGetCursor(_self, _args)
Jack Jansen54c8f7e1995-11-14 10:46:01 +00003557 PyObject *_self;
3558 PyObject *_args;
3559{
3560 PyObject *_res = NULL;
3561 CursHandle _rv;
3562 short cursorID;
3563 if (!PyArg_ParseTuple(_args, "h",
3564 &cursorID))
3565 return NULL;
Jack Jansen1c4e6141998-04-21 15:23:55 +00003566 _rv = MacGetCursor(cursorID);
Jack Jansen54c8f7e1995-11-14 10:46:01 +00003567 _res = Py_BuildValue("O&",
3568 ResObj_New, _rv);
3569 return _res;
3570}
3571
3572static PyObject *Qd_GetPicture(_self, _args)
3573 PyObject *_self;
3574 PyObject *_args;
3575{
3576 PyObject *_res = NULL;
3577 PicHandle _rv;
3578 short pictureID;
3579 if (!PyArg_ParseTuple(_args, "h",
3580 &pictureID))
3581 return NULL;
3582 _rv = GetPicture(pictureID);
3583 _res = Py_BuildValue("O&",
3584 ResObj_New, _rv);
3585 return _res;
3586}
3587
3588static PyObject *Qd_DeltaPoint(_self, _args)
3589 PyObject *_self;
3590 PyObject *_args;
3591{
3592 PyObject *_res = NULL;
3593 long _rv;
3594 Point ptA;
3595 Point ptB;
3596 if (!PyArg_ParseTuple(_args, "O&O&",
3597 PyMac_GetPoint, &ptA,
3598 PyMac_GetPoint, &ptB))
3599 return NULL;
3600 _rv = DeltaPoint(ptA,
3601 ptB);
3602 _res = Py_BuildValue("l",
3603 _rv);
3604 return _res;
3605}
3606
3607static PyObject *Qd_ShieldCursor(_self, _args)
3608 PyObject *_self;
3609 PyObject *_args;
3610{
3611 PyObject *_res = NULL;
3612 Rect shieldRect;
3613 Point offsetPt;
3614 if (!PyArg_ParseTuple(_args, "O&O&",
3615 PyMac_GetRect, &shieldRect,
3616 PyMac_GetPoint, &offsetPt))
3617 return NULL;
3618 ShieldCursor(&shieldRect,
3619 offsetPt);
3620 Py_INCREF(Py_None);
3621 _res = Py_None;
3622 return _res;
3623}
3624
3625static PyObject *Qd_ScreenRes(_self, _args)
3626 PyObject *_self;
3627 PyObject *_args;
3628{
3629 PyObject *_res = NULL;
3630 short scrnHRes;
3631 short scrnVRes;
3632 if (!PyArg_ParseTuple(_args, ""))
3633 return NULL;
3634 ScreenRes(&scrnHRes,
3635 &scrnVRes);
3636 _res = Py_BuildValue("hh",
3637 scrnHRes,
3638 scrnVRes);
3639 return _res;
3640}
3641
Jack Jansen04a02e71996-01-06 17:12:58 +00003642static PyObject *Qd_GetIndPattern(_self, _args)
3643 PyObject *_self;
3644 PyObject *_args;
3645{
3646 PyObject *_res = NULL;
3647 Pattern thePat__out__;
3648 short patternListID;
3649 short index;
3650 if (!PyArg_ParseTuple(_args, "hh",
3651 &patternListID,
3652 &index))
3653 return NULL;
3654 GetIndPattern(&thePat__out__,
3655 patternListID,
3656 index);
3657 _res = Py_BuildValue("s#",
3658 (char *)&thePat__out__, (int)sizeof(Pattern));
3659 thePat__error__: ;
3660 return _res;
3661}
3662
Jack Jansen21f96871998-02-20 16:02:09 +00003663static PyObject *Qd_SlopeFromAngle(_self, _args)
3664 PyObject *_self;
3665 PyObject *_args;
3666{
3667 PyObject *_res = NULL;
3668 Fixed _rv;
3669 short angle;
3670 if (!PyArg_ParseTuple(_args, "h",
3671 &angle))
3672 return NULL;
3673 _rv = SlopeFromAngle(angle);
3674 _res = Py_BuildValue("O&",
3675 PyMac_BuildFixed, _rv);
3676 return _res;
3677}
3678
3679static PyObject *Qd_AngleFromSlope(_self, _args)
3680 PyObject *_self;
3681 PyObject *_args;
3682{
3683 PyObject *_res = NULL;
3684 short _rv;
3685 Fixed slope;
3686 if (!PyArg_ParseTuple(_args, "O&",
3687 PyMac_GetFixed, &slope))
3688 return NULL;
3689 _rv = AngleFromSlope(slope);
3690 _res = Py_BuildValue("h",
3691 _rv);
3692 return _res;
3693}
3694
Jack Jansenb81cf9d1995-06-06 13:08:40 +00003695static PyObject *Qd_TextFont(_self, _args)
3696 PyObject *_self;
3697 PyObject *_args;
3698{
3699 PyObject *_res = NULL;
3700 short font;
3701 if (!PyArg_ParseTuple(_args, "h",
3702 &font))
3703 return NULL;
3704 TextFont(font);
3705 Py_INCREF(Py_None);
3706 _res = Py_None;
3707 return _res;
3708}
3709
3710static PyObject *Qd_TextFace(_self, _args)
3711 PyObject *_self;
3712 PyObject *_args;
3713{
3714 PyObject *_res = NULL;
Jack Jansene742a821998-02-25 15:46:50 +00003715 StyleParameter face;
Jack Jansenb81cf9d1995-06-06 13:08:40 +00003716 if (!PyArg_ParseTuple(_args, "h",
3717 &face))
3718 return NULL;
3719 TextFace(face);
3720 Py_INCREF(Py_None);
3721 _res = Py_None;
3722 return _res;
3723}
3724
3725static PyObject *Qd_TextMode(_self, _args)
3726 PyObject *_self;
3727 PyObject *_args;
3728{
3729 PyObject *_res = NULL;
3730 short mode;
3731 if (!PyArg_ParseTuple(_args, "h",
3732 &mode))
3733 return NULL;
3734 TextMode(mode);
3735 Py_INCREF(Py_None);
3736 _res = Py_None;
3737 return _res;
3738}
3739
3740static PyObject *Qd_TextSize(_self, _args)
3741 PyObject *_self;
3742 PyObject *_args;
3743{
3744 PyObject *_res = NULL;
3745 short size;
3746 if (!PyArg_ParseTuple(_args, "h",
3747 &size))
3748 return NULL;
3749 TextSize(size);
3750 Py_INCREF(Py_None);
3751 _res = Py_None;
3752 return _res;
3753}
3754
3755static PyObject *Qd_SpaceExtra(_self, _args)
3756 PyObject *_self;
3757 PyObject *_args;
3758{
3759 PyObject *_res = NULL;
Jack Jansen330381c1995-11-15 15:18:01 +00003760 Fixed extra;
3761 if (!PyArg_ParseTuple(_args, "O&",
3762 PyMac_GetFixed, &extra))
Jack Jansenb81cf9d1995-06-06 13:08:40 +00003763 return NULL;
3764 SpaceExtra(extra);
3765 Py_INCREF(Py_None);
3766 _res = Py_None;
3767 return _res;
3768}
3769
3770static PyObject *Qd_DrawChar(_self, _args)
3771 PyObject *_self;
3772 PyObject *_args;
3773{
3774 PyObject *_res = NULL;
Jack Jansen21f96871998-02-20 16:02:09 +00003775 CharParameter ch;
Jack Jansene742a821998-02-25 15:46:50 +00003776 if (!PyArg_ParseTuple(_args, "h",
Jack Jansenb81cf9d1995-06-06 13:08:40 +00003777 &ch))
3778 return NULL;
3779 DrawChar(ch);
3780 Py_INCREF(Py_None);
3781 _res = Py_None;
3782 return _res;
3783}
3784
3785static PyObject *Qd_DrawString(_self, _args)
3786 PyObject *_self;
3787 PyObject *_args;
3788{
3789 PyObject *_res = NULL;
3790 Str255 s;
3791 if (!PyArg_ParseTuple(_args, "O&",
3792 PyMac_GetStr255, s))
3793 return NULL;
3794 DrawString(s);
3795 Py_INCREF(Py_None);
3796 _res = Py_None;
3797 return _res;
3798}
3799
Jack Jansen1c4e6141998-04-21 15:23:55 +00003800static PyObject *Qd_MacDrawText(_self, _args)
Jack Jansenb81cf9d1995-06-06 13:08:40 +00003801 PyObject *_self;
3802 PyObject *_args;
3803{
3804 PyObject *_res = NULL;
3805 char *textBuf__in__;
3806 int textBuf__len__;
3807 int textBuf__in_len__;
3808 short firstByte;
3809 short byteCount;
3810 if (!PyArg_ParseTuple(_args, "s#hh",
3811 &textBuf__in__, &textBuf__in_len__,
3812 &firstByte,
3813 &byteCount))
3814 return NULL;
Jack Jansen1c4e6141998-04-21 15:23:55 +00003815 MacDrawText(textBuf__in__,
3816 firstByte,
3817 byteCount);
Jack Jansenb81cf9d1995-06-06 13:08:40 +00003818 Py_INCREF(Py_None);
3819 _res = Py_None;
3820 textBuf__error__: ;
3821 return _res;
3822}
3823
3824static PyObject *Qd_CharWidth(_self, _args)
3825 PyObject *_self;
3826 PyObject *_args;
3827{
3828 PyObject *_res = NULL;
3829 short _rv;
Jack Jansen21f96871998-02-20 16:02:09 +00003830 CharParameter ch;
Jack Jansene742a821998-02-25 15:46:50 +00003831 if (!PyArg_ParseTuple(_args, "h",
Jack Jansenb81cf9d1995-06-06 13:08:40 +00003832 &ch))
3833 return NULL;
3834 _rv = CharWidth(ch);
3835 _res = Py_BuildValue("h",
3836 _rv);
3837 return _res;
3838}
3839
3840static PyObject *Qd_StringWidth(_self, _args)
3841 PyObject *_self;
3842 PyObject *_args;
3843{
3844 PyObject *_res = NULL;
3845 short _rv;
3846 Str255 s;
3847 if (!PyArg_ParseTuple(_args, "O&",
3848 PyMac_GetStr255, s))
3849 return NULL;
3850 _rv = StringWidth(s);
3851 _res = Py_BuildValue("h",
3852 _rv);
3853 return _res;
3854}
3855
3856static PyObject *Qd_TextWidth(_self, _args)
3857 PyObject *_self;
3858 PyObject *_args;
3859{
3860 PyObject *_res = NULL;
3861 short _rv;
3862 char *textBuf__in__;
3863 int textBuf__len__;
3864 int textBuf__in_len__;
3865 short firstByte;
3866 short byteCount;
3867 if (!PyArg_ParseTuple(_args, "s#hh",
3868 &textBuf__in__, &textBuf__in_len__,
3869 &firstByte,
3870 &byteCount))
3871 return NULL;
3872 _rv = TextWidth(textBuf__in__,
3873 firstByte,
3874 byteCount);
3875 _res = Py_BuildValue("h",
3876 _rv);
3877 textBuf__error__: ;
3878 return _res;
3879}
3880
Jack Jansen3a50f8a1996-01-11 16:17:14 +00003881static PyObject *Qd_GetFontInfo(_self, _args)
3882 PyObject *_self;
3883 PyObject *_args;
3884{
3885 PyObject *_res = NULL;
3886 FontInfo info;
3887 if (!PyArg_ParseTuple(_args, ""))
3888 return NULL;
3889 GetFontInfo(&info);
3890 _res = Py_BuildValue("O&",
3891 QdFI_New, &info);
3892 return _res;
3893}
3894
Jack Jansenb81cf9d1995-06-06 13:08:40 +00003895static PyObject *Qd_CharExtra(_self, _args)
3896 PyObject *_self;
3897 PyObject *_args;
3898{
3899 PyObject *_res = NULL;
Jack Jansen330381c1995-11-15 15:18:01 +00003900 Fixed extra;
3901 if (!PyArg_ParseTuple(_args, "O&",
3902 PyMac_GetFixed, &extra))
Jack Jansenb81cf9d1995-06-06 13:08:40 +00003903 return NULL;
3904 CharExtra(extra);
3905 Py_INCREF(Py_None);
3906 _res = Py_None;
3907 return _res;
3908}
3909
Jack Jansen7f725e41998-04-23 13:21:09 +00003910static PyObject *Qd_SetPort(_self, _args)
3911 PyObject *_self;
3912 PyObject *_args;
3913{
3914 PyObject *_res = NULL;
Jack Jansen29bfea91998-04-27 15:09:36 +00003915 GrafPtr thePort;
Jack Jansen7f725e41998-04-23 13:21:09 +00003916 if (!PyArg_ParseTuple(_args, "O&",
Jack Jansen29bfea91998-04-27 15:09:36 +00003917 GrafObj_Convert, &thePort))
Jack Jansen7f725e41998-04-23 13:21:09 +00003918 return NULL;
3919 SetPort(thePort);
3920 Py_INCREF(Py_None);
3921 _res = Py_None;
3922 return _res;
3923}
3924
Jack Jansene180d991998-04-24 10:28:20 +00003925static PyObject *Qd_GetCursor(_self, _args)
Jack Jansen7f725e41998-04-23 13:21:09 +00003926 PyObject *_self;
3927 PyObject *_args;
3928{
3929 PyObject *_res = NULL;
Jack Jansene180d991998-04-24 10:28:20 +00003930 CursHandle _rv;
3931 short cursorID;
3932 if (!PyArg_ParseTuple(_args, "h",
3933 &cursorID))
Jack Jansen7f725e41998-04-23 13:21:09 +00003934 return NULL;
Jack Jansene180d991998-04-24 10:28:20 +00003935 _rv = GetCursor(cursorID);
3936 _res = Py_BuildValue("O&",
3937 ResObj_New, _rv);
3938 return _res;
3939}
3940
3941static PyObject *Qd_SetCursor(_self, _args)
3942 PyObject *_self;
3943 PyObject *_args;
3944{
3945 PyObject *_res = NULL;
3946 Cursor *crsr__in__;
3947 int crsr__in_len__;
3948 if (!PyArg_ParseTuple(_args, "s#",
3949 (char **)&crsr__in__, &crsr__in_len__))
3950 return NULL;
3951 if (crsr__in_len__ != sizeof(Cursor))
3952 {
3953 PyErr_SetString(PyExc_TypeError, "buffer length should be sizeof(Cursor)");
3954 goto crsr__error__;
3955 }
3956 SetCursor(crsr__in__);
Jack Jansen7f725e41998-04-23 13:21:09 +00003957 Py_INCREF(Py_None);
3958 _res = Py_None;
Jack Jansene180d991998-04-24 10:28:20 +00003959 crsr__error__: ;
3960 return _res;
3961}
3962
3963static PyObject *Qd_ShowCursor(_self, _args)
3964 PyObject *_self;
3965 PyObject *_args;
3966{
3967 PyObject *_res = NULL;
3968 if (!PyArg_ParseTuple(_args, ""))
3969 return NULL;
3970 ShowCursor();
3971 Py_INCREF(Py_None);
3972 _res = Py_None;
3973 return _res;
3974}
3975
3976static PyObject *Qd_LineTo(_self, _args)
3977 PyObject *_self;
3978 PyObject *_args;
3979{
3980 PyObject *_res = NULL;
3981 short h;
3982 short v;
3983 if (!PyArg_ParseTuple(_args, "hh",
3984 &h,
3985 &v))
3986 return NULL;
3987 LineTo(h,
3988 v);
3989 Py_INCREF(Py_None);
3990 _res = Py_None;
3991 return _res;
3992}
3993
3994static PyObject *Qd_SetRect(_self, _args)
3995 PyObject *_self;
3996 PyObject *_args;
3997{
3998 PyObject *_res = NULL;
3999 Rect r;
4000 short left;
4001 short top;
4002 short right;
4003 short bottom;
4004 if (!PyArg_ParseTuple(_args, "hhhh",
4005 &left,
4006 &top,
4007 &right,
4008 &bottom))
4009 return NULL;
4010 SetRect(&r,
4011 left,
4012 top,
4013 right,
4014 bottom);
4015 _res = Py_BuildValue("O&",
4016 PyMac_BuildRect, &r);
4017 return _res;
4018}
4019
4020static PyObject *Qd_OffsetRect(_self, _args)
4021 PyObject *_self;
4022 PyObject *_args;
4023{
4024 PyObject *_res = NULL;
4025 Rect r;
4026 short dh;
4027 short dv;
4028 if (!PyArg_ParseTuple(_args, "O&hh",
4029 PyMac_GetRect, &r,
4030 &dh,
4031 &dv))
4032 return NULL;
4033 OffsetRect(&r,
4034 dh,
4035 dv);
4036 _res = Py_BuildValue("O&",
4037 PyMac_BuildRect, &r);
4038 return _res;
4039}
4040
4041static PyObject *Qd_InsetRect(_self, _args)
4042 PyObject *_self;
4043 PyObject *_args;
4044{
4045 PyObject *_res = NULL;
4046 Rect r;
4047 short dh;
4048 short dv;
4049 if (!PyArg_ParseTuple(_args, "O&hh",
4050 PyMac_GetRect, &r,
4051 &dh,
4052 &dv))
4053 return NULL;
4054 InsetRect(&r,
4055 dh,
4056 dv);
4057 _res = Py_BuildValue("O&",
4058 PyMac_BuildRect, &r);
4059 return _res;
4060}
4061
4062static PyObject *Qd_UnionRect(_self, _args)
4063 PyObject *_self;
4064 PyObject *_args;
4065{
4066 PyObject *_res = NULL;
4067 Rect src1;
4068 Rect src2;
4069 Rect dstRect;
4070 if (!PyArg_ParseTuple(_args, "O&O&",
4071 PyMac_GetRect, &src1,
4072 PyMac_GetRect, &src2))
4073 return NULL;
4074 UnionRect(&src1,
4075 &src2,
4076 &dstRect);
4077 _res = Py_BuildValue("O&",
4078 PyMac_BuildRect, &dstRect);
4079 return _res;
4080}
4081
4082static PyObject *Qd_EqualRect(_self, _args)
4083 PyObject *_self;
4084 PyObject *_args;
4085{
4086 PyObject *_res = NULL;
4087 Boolean _rv;
4088 Rect rect1;
4089 Rect rect2;
4090 if (!PyArg_ParseTuple(_args, "O&O&",
4091 PyMac_GetRect, &rect1,
4092 PyMac_GetRect, &rect2))
4093 return NULL;
4094 _rv = EqualRect(&rect1,
4095 &rect2);
4096 _res = Py_BuildValue("b",
4097 _rv);
4098 return _res;
4099}
4100
4101static PyObject *Qd_FrameRect(_self, _args)
4102 PyObject *_self;
4103 PyObject *_args;
4104{
4105 PyObject *_res = NULL;
4106 Rect r;
4107 if (!PyArg_ParseTuple(_args, "O&",
4108 PyMac_GetRect, &r))
4109 return NULL;
4110 FrameRect(&r);
4111 Py_INCREF(Py_None);
4112 _res = Py_None;
4113 return _res;
4114}
4115
4116static PyObject *Qd_InvertRect(_self, _args)
4117 PyObject *_self;
4118 PyObject *_args;
4119{
4120 PyObject *_res = NULL;
4121 Rect r;
4122 if (!PyArg_ParseTuple(_args, "O&",
4123 PyMac_GetRect, &r))
4124 return NULL;
4125 InvertRect(&r);
4126 Py_INCREF(Py_None);
4127 _res = Py_None;
4128 return _res;
4129}
4130
4131static PyObject *Qd_FillRect(_self, _args)
4132 PyObject *_self;
4133 PyObject *_args;
4134{
4135 PyObject *_res = NULL;
4136 Rect r;
4137 Pattern *pat__in__;
4138 int pat__in_len__;
4139 if (!PyArg_ParseTuple(_args, "O&s#",
4140 PyMac_GetRect, &r,
4141 (char **)&pat__in__, &pat__in_len__))
4142 return NULL;
4143 if (pat__in_len__ != sizeof(Pattern))
4144 {
4145 PyErr_SetString(PyExc_TypeError, "buffer length should be sizeof(Pattern)");
4146 goto pat__error__;
4147 }
4148 FillRect(&r,
4149 pat__in__);
4150 Py_INCREF(Py_None);
4151 _res = Py_None;
4152 pat__error__: ;
4153 return _res;
4154}
4155
4156static PyObject *Qd_CopyRgn(_self, _args)
4157 PyObject *_self;
4158 PyObject *_args;
4159{
4160 PyObject *_res = NULL;
4161 RgnHandle srcRgn;
4162 RgnHandle dstRgn;
4163 if (!PyArg_ParseTuple(_args, "O&O&",
4164 ResObj_Convert, &srcRgn,
4165 ResObj_Convert, &dstRgn))
4166 return NULL;
4167 CopyRgn(srcRgn,
4168 dstRgn);
4169 Py_INCREF(Py_None);
4170 _res = Py_None;
4171 return _res;
4172}
4173
4174static PyObject *Qd_SetRectRgn(_self, _args)
4175 PyObject *_self;
4176 PyObject *_args;
4177{
4178 PyObject *_res = NULL;
4179 RgnHandle rgn;
4180 short left;
4181 short top;
4182 short right;
4183 short bottom;
4184 if (!PyArg_ParseTuple(_args, "O&hhhh",
4185 ResObj_Convert, &rgn,
4186 &left,
4187 &top,
4188 &right,
4189 &bottom))
4190 return NULL;
4191 SetRectRgn(rgn,
4192 left,
4193 top,
4194 right,
4195 bottom);
4196 Py_INCREF(Py_None);
4197 _res = Py_None;
4198 return _res;
4199}
4200
4201static PyObject *Qd_OffsetRgn(_self, _args)
4202 PyObject *_self;
4203 PyObject *_args;
4204{
4205 PyObject *_res = NULL;
4206 RgnHandle rgn;
4207 short dh;
4208 short dv;
4209 if (!PyArg_ParseTuple(_args, "O&hh",
4210 ResObj_Convert, &rgn,
4211 &dh,
4212 &dv))
4213 return NULL;
4214 OffsetRgn(rgn,
4215 dh,
4216 dv);
4217 Py_INCREF(Py_None);
4218 _res = Py_None;
4219 return _res;
4220}
4221
4222static PyObject *Qd_UnionRgn(_self, _args)
4223 PyObject *_self;
4224 PyObject *_args;
4225{
4226 PyObject *_res = NULL;
4227 RgnHandle srcRgnA;
4228 RgnHandle srcRgnB;
4229 RgnHandle dstRgn;
4230 if (!PyArg_ParseTuple(_args, "O&O&O&",
4231 ResObj_Convert, &srcRgnA,
4232 ResObj_Convert, &srcRgnB,
4233 ResObj_Convert, &dstRgn))
4234 return NULL;
4235 UnionRgn(srcRgnA,
4236 srcRgnB,
4237 dstRgn);
4238 Py_INCREF(Py_None);
4239 _res = Py_None;
4240 return _res;
4241}
4242
4243static PyObject *Qd_XorRgn(_self, _args)
4244 PyObject *_self;
4245 PyObject *_args;
4246{
4247 PyObject *_res = NULL;
4248 RgnHandle srcRgnA;
4249 RgnHandle srcRgnB;
4250 RgnHandle dstRgn;
4251 if (!PyArg_ParseTuple(_args, "O&O&O&",
4252 ResObj_Convert, &srcRgnA,
4253 ResObj_Convert, &srcRgnB,
4254 ResObj_Convert, &dstRgn))
4255 return NULL;
4256 XorRgn(srcRgnA,
4257 srcRgnB,
4258 dstRgn);
4259 Py_INCREF(Py_None);
4260 _res = Py_None;
4261 return _res;
4262}
4263
4264static PyObject *Qd_EqualRgn(_self, _args)
4265 PyObject *_self;
4266 PyObject *_args;
4267{
4268 PyObject *_res = NULL;
4269 Boolean _rv;
4270 RgnHandle rgnA;
4271 RgnHandle rgnB;
4272 if (!PyArg_ParseTuple(_args, "O&O&",
4273 ResObj_Convert, &rgnA,
4274 ResObj_Convert, &rgnB))
4275 return NULL;
4276 _rv = EqualRgn(rgnA,
4277 rgnB);
4278 _res = Py_BuildValue("b",
4279 _rv);
4280 return _res;
4281}
4282
4283static PyObject *Qd_FrameRgn(_self, _args)
4284 PyObject *_self;
4285 PyObject *_args;
4286{
4287 PyObject *_res = NULL;
4288 RgnHandle rgn;
4289 if (!PyArg_ParseTuple(_args, "O&",
4290 ResObj_Convert, &rgn))
4291 return NULL;
4292 FrameRgn(rgn);
4293 Py_INCREF(Py_None);
4294 _res = Py_None;
4295 return _res;
4296}
4297
4298static PyObject *Qd_PaintRgn(_self, _args)
4299 PyObject *_self;
4300 PyObject *_args;
4301{
4302 PyObject *_res = NULL;
4303 RgnHandle rgn;
4304 if (!PyArg_ParseTuple(_args, "O&",
4305 ResObj_Convert, &rgn))
4306 return NULL;
4307 PaintRgn(rgn);
4308 Py_INCREF(Py_None);
4309 _res = Py_None;
4310 return _res;
4311}
4312
4313static PyObject *Qd_InvertRgn(_self, _args)
4314 PyObject *_self;
4315 PyObject *_args;
4316{
4317 PyObject *_res = NULL;
4318 RgnHandle rgn;
4319 if (!PyArg_ParseTuple(_args, "O&",
4320 ResObj_Convert, &rgn))
4321 return NULL;
4322 InvertRgn(rgn);
4323 Py_INCREF(Py_None);
4324 _res = Py_None;
4325 return _res;
4326}
4327
4328static PyObject *Qd_FillRgn(_self, _args)
4329 PyObject *_self;
4330 PyObject *_args;
4331{
4332 PyObject *_res = NULL;
4333 RgnHandle rgn;
4334 Pattern *pat__in__;
4335 int pat__in_len__;
4336 if (!PyArg_ParseTuple(_args, "O&s#",
4337 ResObj_Convert, &rgn,
4338 (char **)&pat__in__, &pat__in_len__))
4339 return NULL;
4340 if (pat__in_len__ != sizeof(Pattern))
4341 {
4342 PyErr_SetString(PyExc_TypeError, "buffer length should be sizeof(Pattern)");
4343 goto pat__error__;
4344 }
4345 FillRgn(rgn,
4346 pat__in__);
4347 Py_INCREF(Py_None);
4348 _res = Py_None;
4349 pat__error__: ;
4350 return _res;
4351}
4352
4353static PyObject *Qd_GetPixel(_self, _args)
4354 PyObject *_self;
4355 PyObject *_args;
4356{
4357 PyObject *_res = NULL;
4358 Boolean _rv;
4359 short h;
4360 short v;
4361 if (!PyArg_ParseTuple(_args, "hh",
4362 &h,
4363 &v))
4364 return NULL;
4365 _rv = GetPixel(h,
4366 v);
4367 _res = Py_BuildValue("b",
4368 _rv);
4369 return _res;
4370}
4371
4372static PyObject *Qd_PtInRect(_self, _args)
4373 PyObject *_self;
4374 PyObject *_args;
4375{
4376 PyObject *_res = NULL;
4377 Boolean _rv;
4378 Point pt;
4379 Rect r;
4380 if (!PyArg_ParseTuple(_args, "O&O&",
4381 PyMac_GetPoint, &pt,
4382 PyMac_GetRect, &r))
4383 return NULL;
4384 _rv = PtInRect(pt,
4385 &r);
4386 _res = Py_BuildValue("b",
4387 _rv);
4388 return _res;
4389}
4390
4391static PyObject *Qd_DrawText(_self, _args)
4392 PyObject *_self;
4393 PyObject *_args;
4394{
4395 PyObject *_res = NULL;
4396 char *textBuf__in__;
4397 int textBuf__len__;
4398 int textBuf__in_len__;
4399 short firstByte;
4400 short byteCount;
4401 if (!PyArg_ParseTuple(_args, "s#hh",
4402 &textBuf__in__, &textBuf__in_len__,
4403 &firstByte,
4404 &byteCount))
4405 return NULL;
4406 DrawText(textBuf__in__,
4407 firstByte,
4408 byteCount);
4409 Py_INCREF(Py_None);
4410 _res = Py_None;
4411 textBuf__error__: ;
Jack Jansen7f725e41998-04-23 13:21:09 +00004412 return _res;
4413}
4414
Jack Jansen41058c01995-11-16 22:48:29 +00004415static PyObject *Qd_BitMap(_self, _args)
4416 PyObject *_self;
4417 PyObject *_args;
4418{
4419 PyObject *_res = NULL;
4420
4421 BitMap *ptr;
4422 PyObject *source;
4423 Rect bounds;
4424 int rowbytes;
4425 char *data;
4426
4427 if ( !PyArg_ParseTuple(_args, "O!iO&", &PyString_Type, &source, &rowbytes, PyMac_GetRect,
4428 &bounds) )
4429 return NULL;
4430 data = PyString_AsString(source);
4431 if ((ptr=(BitMap *)malloc(sizeof(BitMap))) == NULL )
4432 return PyErr_NoMemory();
4433 ptr->baseAddr = (Ptr)data;
4434 ptr->rowBytes = rowbytes;
4435 ptr->bounds = bounds;
4436 if ( (_res = BMObj_New(ptr)) == NULL ) {
4437 free(ptr);
4438 return NULL;
4439 }
4440 ((BitMapObject *)_res)->referred_object = source;
4441 Py_INCREF(source);
4442 ((BitMapObject *)_res)->referred_bitmap = ptr;
4443 return _res;
4444
4445}
4446
Jack Jansen425e9eb1995-12-12 15:02:03 +00004447static PyObject *Qd_RawBitMap(_self, _args)
4448 PyObject *_self;
4449 PyObject *_args;
4450{
4451 PyObject *_res = NULL;
4452
4453 BitMap *ptr;
4454 PyObject *source;
4455
4456 if ( !PyArg_ParseTuple(_args, "O!", &PyString_Type, &source) )
4457 return NULL;
4458 if ( PyString_Size(source) != sizeof(BitMap) && PyString_Size(source) != sizeof(PixMap) ) {
4459 PyErr_BadArgument();
4460 return NULL;
4461 }
4462 ptr = (BitMapPtr)PyString_AsString(source);
4463 if ( (_res = BMObj_New(ptr)) == NULL ) {
4464 return NULL;
4465 }
4466 ((BitMapObject *)_res)->referred_object = source;
4467 Py_INCREF(source);
4468 return _res;
4469
4470}
4471
Guido van Rossum17448e21995-01-30 11:53:55 +00004472static PyMethodDef Qd_methods[] = {
Jack Jansen1c4e6141998-04-21 15:23:55 +00004473 {"MacSetPort", (PyCFunction)Qd_MacSetPort, 1,
Jack Jansen330381c1995-11-15 15:18:01 +00004474 "(GrafPtr port) -> None"},
Guido van Rossume56db431995-03-19 22:49:50 +00004475 {"GetPort", (PyCFunction)Qd_GetPort, 1,
Jack Jansen330381c1995-11-15 15:18:01 +00004476 "() -> (GrafPtr port)"},
Guido van Rossume56db431995-03-19 22:49:50 +00004477 {"GrafDevice", (PyCFunction)Qd_GrafDevice, 1,
4478 "(short device) -> None"},
Jack Jansen41058c01995-11-16 22:48:29 +00004479 {"SetPortBits", (PyCFunction)Qd_SetPortBits, 1,
4480 "(BitMapPtr bm) -> None"},
Guido van Rossume56db431995-03-19 22:49:50 +00004481 {"PortSize", (PyCFunction)Qd_PortSize, 1,
4482 "(short width, short height) -> None"},
4483 {"MovePortTo", (PyCFunction)Qd_MovePortTo, 1,
4484 "(short leftGlobal, short topGlobal) -> None"},
4485 {"SetOrigin", (PyCFunction)Qd_SetOrigin, 1,
4486 "(short h, short v) -> None"},
4487 {"SetClip", (PyCFunction)Qd_SetClip, 1,
4488 "(RgnHandle rgn) -> None"},
4489 {"GetClip", (PyCFunction)Qd_GetClip, 1,
4490 "(RgnHandle rgn) -> None"},
Guido van Rossum17448e21995-01-30 11:53:55 +00004491 {"ClipRect", (PyCFunction)Qd_ClipRect, 1,
4492 "(Rect r) -> None"},
Jack Jansen04a02e71996-01-06 17:12:58 +00004493 {"BackPat", (PyCFunction)Qd_BackPat, 1,
4494 "(Pattern pat) -> None"},
Guido van Rossume56db431995-03-19 22:49:50 +00004495 {"InitCursor", (PyCFunction)Qd_InitCursor, 1,
4496 "() -> None"},
Jack Jansen1c4e6141998-04-21 15:23:55 +00004497 {"MacSetCursor", (PyCFunction)Qd_MacSetCursor, 1,
Jack Jansenb5394061996-01-05 18:06:41 +00004498 "(Cursor crsr) -> None"},
Guido van Rossume56db431995-03-19 22:49:50 +00004499 {"HideCursor", (PyCFunction)Qd_HideCursor, 1,
4500 "() -> None"},
Jack Jansen1c4e6141998-04-21 15:23:55 +00004501 {"MacShowCursor", (PyCFunction)Qd_MacShowCursor, 1,
Guido van Rossume56db431995-03-19 22:49:50 +00004502 "() -> None"},
4503 {"ObscureCursor", (PyCFunction)Qd_ObscureCursor, 1,
4504 "() -> None"},
4505 {"HidePen", (PyCFunction)Qd_HidePen, 1,
4506 "() -> None"},
4507 {"ShowPen", (PyCFunction)Qd_ShowPen, 1,
4508 "() -> None"},
4509 {"GetPen", (PyCFunction)Qd_GetPen, 1,
Jack Jansen1d8ede71996-01-08 23:47:31 +00004510 "() -> (Point pt)"},
Jack Jansen04a02e71996-01-06 17:12:58 +00004511 {"GetPenState", (PyCFunction)Qd_GetPenState, 1,
4512 "() -> (PenState pnState)"},
4513 {"SetPenState", (PyCFunction)Qd_SetPenState, 1,
4514 "(PenState pnState) -> None"},
Guido van Rossume56db431995-03-19 22:49:50 +00004515 {"PenSize", (PyCFunction)Qd_PenSize, 1,
4516 "(short width, short height) -> None"},
4517 {"PenMode", (PyCFunction)Qd_PenMode, 1,
4518 "(short mode) -> None"},
Jack Jansen04a02e71996-01-06 17:12:58 +00004519 {"PenPat", (PyCFunction)Qd_PenPat, 1,
4520 "(Pattern pat) -> None"},
Guido van Rossume56db431995-03-19 22:49:50 +00004521 {"PenNormal", (PyCFunction)Qd_PenNormal, 1,
4522 "() -> None"},
4523 {"MoveTo", (PyCFunction)Qd_MoveTo, 1,
4524 "(short h, short v) -> None"},
4525 {"Move", (PyCFunction)Qd_Move, 1,
4526 "(short dh, short dv) -> None"},
Jack Jansen1c4e6141998-04-21 15:23:55 +00004527 {"MacLineTo", (PyCFunction)Qd_MacLineTo, 1,
Guido van Rossume56db431995-03-19 22:49:50 +00004528 "(short h, short v) -> None"},
4529 {"Line", (PyCFunction)Qd_Line, 1,
4530 "(short dh, short dv) -> None"},
Guido van Rossume56db431995-03-19 22:49:50 +00004531 {"ForeColor", (PyCFunction)Qd_ForeColor, 1,
4532 "(long color) -> None"},
4533 {"BackColor", (PyCFunction)Qd_BackColor, 1,
4534 "(long color) -> None"},
4535 {"ColorBit", (PyCFunction)Qd_ColorBit, 1,
4536 "(short whichBit) -> None"},
Jack Jansen1c4e6141998-04-21 15:23:55 +00004537 {"MacSetRect", (PyCFunction)Qd_MacSetRect, 1,
Guido van Rossume56db431995-03-19 22:49:50 +00004538 "(short left, short top, short right, short bottom) -> (Rect r)"},
Jack Jansen1c4e6141998-04-21 15:23:55 +00004539 {"MacOffsetRect", (PyCFunction)Qd_MacOffsetRect, 1,
Jack Jansen54c8f7e1995-11-14 10:46:01 +00004540 "(Rect r, short dh, short dv) -> (Rect r)"},
Jack Jansen1c4e6141998-04-21 15:23:55 +00004541 {"MacInsetRect", (PyCFunction)Qd_MacInsetRect, 1,
Jack Jansen54c8f7e1995-11-14 10:46:01 +00004542 "(Rect r, short dh, short dv) -> (Rect r)"},
Guido van Rossume56db431995-03-19 22:49:50 +00004543 {"SectRect", (PyCFunction)Qd_SectRect, 1,
4544 "(Rect src1, Rect src2) -> (Boolean _rv, Rect dstRect)"},
Jack Jansen1c4e6141998-04-21 15:23:55 +00004545 {"MacUnionRect", (PyCFunction)Qd_MacUnionRect, 1,
Guido van Rossume56db431995-03-19 22:49:50 +00004546 "(Rect src1, Rect src2) -> (Rect dstRect)"},
Jack Jansen1c4e6141998-04-21 15:23:55 +00004547 {"MacEqualRect", (PyCFunction)Qd_MacEqualRect, 1,
Guido van Rossume56db431995-03-19 22:49:50 +00004548 "(Rect rect1, Rect rect2) -> (Boolean _rv)"},
4549 {"EmptyRect", (PyCFunction)Qd_EmptyRect, 1,
4550 "(Rect r) -> (Boolean _rv)"},
Jack Jansen1c4e6141998-04-21 15:23:55 +00004551 {"MacFrameRect", (PyCFunction)Qd_MacFrameRect, 1,
Guido van Rossume56db431995-03-19 22:49:50 +00004552 "(Rect r) -> None"},
4553 {"PaintRect", (PyCFunction)Qd_PaintRect, 1,
4554 "(Rect r) -> None"},
Guido van Rossum17448e21995-01-30 11:53:55 +00004555 {"EraseRect", (PyCFunction)Qd_EraseRect, 1,
4556 "(Rect r) -> None"},
Jack Jansen1c4e6141998-04-21 15:23:55 +00004557 {"MacInvertRect", (PyCFunction)Qd_MacInvertRect, 1,
Guido van Rossume56db431995-03-19 22:49:50 +00004558 "(Rect r) -> None"},
Jack Jansen1c4e6141998-04-21 15:23:55 +00004559 {"MacFillRect", (PyCFunction)Qd_MacFillRect, 1,
Jack Jansen04a02e71996-01-06 17:12:58 +00004560 "(Rect r, Pattern pat) -> None"},
Guido van Rossume56db431995-03-19 22:49:50 +00004561 {"FrameOval", (PyCFunction)Qd_FrameOval, 1,
4562 "(Rect r) -> None"},
4563 {"PaintOval", (PyCFunction)Qd_PaintOval, 1,
4564 "(Rect r) -> None"},
4565 {"EraseOval", (PyCFunction)Qd_EraseOval, 1,
4566 "(Rect r) -> None"},
4567 {"InvertOval", (PyCFunction)Qd_InvertOval, 1,
4568 "(Rect r) -> None"},
Jack Jansen04a02e71996-01-06 17:12:58 +00004569 {"FillOval", (PyCFunction)Qd_FillOval, 1,
4570 "(Rect r, Pattern pat) -> None"},
Guido van Rossume56db431995-03-19 22:49:50 +00004571 {"FrameRoundRect", (PyCFunction)Qd_FrameRoundRect, 1,
4572 "(Rect r, short ovalWidth, short ovalHeight) -> None"},
4573 {"PaintRoundRect", (PyCFunction)Qd_PaintRoundRect, 1,
4574 "(Rect r, short ovalWidth, short ovalHeight) -> None"},
4575 {"EraseRoundRect", (PyCFunction)Qd_EraseRoundRect, 1,
4576 "(Rect r, short ovalWidth, short ovalHeight) -> None"},
4577 {"InvertRoundRect", (PyCFunction)Qd_InvertRoundRect, 1,
4578 "(Rect r, short ovalWidth, short ovalHeight) -> None"},
Jack Jansen04a02e71996-01-06 17:12:58 +00004579 {"FillRoundRect", (PyCFunction)Qd_FillRoundRect, 1,
4580 "(Rect r, short ovalWidth, short ovalHeight, Pattern pat) -> None"},
Guido van Rossume56db431995-03-19 22:49:50 +00004581 {"FrameArc", (PyCFunction)Qd_FrameArc, 1,
4582 "(Rect r, short startAngle, short arcAngle) -> None"},
4583 {"PaintArc", (PyCFunction)Qd_PaintArc, 1,
4584 "(Rect r, short startAngle, short arcAngle) -> None"},
4585 {"EraseArc", (PyCFunction)Qd_EraseArc, 1,
4586 "(Rect r, short startAngle, short arcAngle) -> None"},
4587 {"InvertArc", (PyCFunction)Qd_InvertArc, 1,
4588 "(Rect r, short startAngle, short arcAngle) -> None"},
Jack Jansen04a02e71996-01-06 17:12:58 +00004589 {"FillArc", (PyCFunction)Qd_FillArc, 1,
4590 "(Rect r, short startAngle, short arcAngle, Pattern pat) -> None"},
Guido van Rossume56db431995-03-19 22:49:50 +00004591 {"NewRgn", (PyCFunction)Qd_NewRgn, 1,
4592 "() -> (RgnHandle _rv)"},
4593 {"OpenRgn", (PyCFunction)Qd_OpenRgn, 1,
4594 "() -> None"},
4595 {"CloseRgn", (PyCFunction)Qd_CloseRgn, 1,
4596 "(RgnHandle dstRgn) -> None"},
Jack Jansen41058c01995-11-16 22:48:29 +00004597 {"BitMapToRegion", (PyCFunction)Qd_BitMapToRegion, 1,
4598 "(RgnHandle region, BitMapPtr bMap) -> None"},
Guido van Rossume56db431995-03-19 22:49:50 +00004599 {"DisposeRgn", (PyCFunction)Qd_DisposeRgn, 1,
4600 "(RgnHandle rgn) -> None"},
Jack Jansen1c4e6141998-04-21 15:23:55 +00004601 {"MacCopyRgn", (PyCFunction)Qd_MacCopyRgn, 1,
Guido van Rossume56db431995-03-19 22:49:50 +00004602 "(RgnHandle srcRgn, RgnHandle dstRgn) -> None"},
4603 {"SetEmptyRgn", (PyCFunction)Qd_SetEmptyRgn, 1,
4604 "(RgnHandle rgn) -> None"},
Jack Jansen1c4e6141998-04-21 15:23:55 +00004605 {"MacSetRectRgn", (PyCFunction)Qd_MacSetRectRgn, 1,
Guido van Rossume56db431995-03-19 22:49:50 +00004606 "(RgnHandle rgn, short left, short top, short right, short bottom) -> None"},
4607 {"RectRgn", (PyCFunction)Qd_RectRgn, 1,
4608 "(RgnHandle rgn, Rect r) -> None"},
Jack Jansen1c4e6141998-04-21 15:23:55 +00004609 {"MacOffsetRgn", (PyCFunction)Qd_MacOffsetRgn, 1,
Guido van Rossume56db431995-03-19 22:49:50 +00004610 "(RgnHandle rgn, short dh, short dv) -> None"},
4611 {"InsetRgn", (PyCFunction)Qd_InsetRgn, 1,
4612 "(RgnHandle rgn, short dh, short dv) -> None"},
4613 {"SectRgn", (PyCFunction)Qd_SectRgn, 1,
4614 "(RgnHandle srcRgnA, RgnHandle srcRgnB, RgnHandle dstRgn) -> None"},
Jack Jansen1c4e6141998-04-21 15:23:55 +00004615 {"MacUnionRgn", (PyCFunction)Qd_MacUnionRgn, 1,
Guido van Rossume56db431995-03-19 22:49:50 +00004616 "(RgnHandle srcRgnA, RgnHandle srcRgnB, RgnHandle dstRgn) -> None"},
4617 {"DiffRgn", (PyCFunction)Qd_DiffRgn, 1,
4618 "(RgnHandle srcRgnA, RgnHandle srcRgnB, RgnHandle dstRgn) -> None"},
Jack Jansen1c4e6141998-04-21 15:23:55 +00004619 {"MacXorRgn", (PyCFunction)Qd_MacXorRgn, 1,
Guido van Rossume56db431995-03-19 22:49:50 +00004620 "(RgnHandle srcRgnA, RgnHandle srcRgnB, RgnHandle dstRgn) -> None"},
4621 {"RectInRgn", (PyCFunction)Qd_RectInRgn, 1,
4622 "(Rect r, RgnHandle rgn) -> (Boolean _rv)"},
Jack Jansen1c4e6141998-04-21 15:23:55 +00004623 {"MacEqualRgn", (PyCFunction)Qd_MacEqualRgn, 1,
Guido van Rossume56db431995-03-19 22:49:50 +00004624 "(RgnHandle rgnA, RgnHandle rgnB) -> (Boolean _rv)"},
4625 {"EmptyRgn", (PyCFunction)Qd_EmptyRgn, 1,
4626 "(RgnHandle rgn) -> (Boolean _rv)"},
Jack Jansen1c4e6141998-04-21 15:23:55 +00004627 {"MacFrameRgn", (PyCFunction)Qd_MacFrameRgn, 1,
Guido van Rossume56db431995-03-19 22:49:50 +00004628 "(RgnHandle rgn) -> None"},
Jack Jansen1c4e6141998-04-21 15:23:55 +00004629 {"MacPaintRgn", (PyCFunction)Qd_MacPaintRgn, 1,
Guido van Rossume56db431995-03-19 22:49:50 +00004630 "(RgnHandle rgn) -> None"},
4631 {"EraseRgn", (PyCFunction)Qd_EraseRgn, 1,
4632 "(RgnHandle rgn) -> None"},
Jack Jansen1c4e6141998-04-21 15:23:55 +00004633 {"MacInvertRgn", (PyCFunction)Qd_MacInvertRgn, 1,
Guido van Rossume56db431995-03-19 22:49:50 +00004634 "(RgnHandle rgn) -> None"},
Jack Jansen1c4e6141998-04-21 15:23:55 +00004635 {"MacFillRgn", (PyCFunction)Qd_MacFillRgn, 1,
Jack Jansen04a02e71996-01-06 17:12:58 +00004636 "(RgnHandle rgn, Pattern pat) -> None"},
Guido van Rossume56db431995-03-19 22:49:50 +00004637 {"ScrollRect", (PyCFunction)Qd_ScrollRect, 1,
4638 "(Rect r, short dh, short dv, RgnHandle updateRgn) -> None"},
Jack Jansen41058c01995-11-16 22:48:29 +00004639 {"CopyBits", (PyCFunction)Qd_CopyBits, 1,
4640 "(BitMapPtr srcBits, BitMapPtr dstBits, Rect srcRect, Rect dstRect, short mode, RgnHandle maskRgn) -> None"},
4641 {"CopyMask", (PyCFunction)Qd_CopyMask, 1,
4642 "(BitMapPtr srcBits, BitMapPtr maskBits, BitMapPtr dstBits, Rect srcRect, Rect maskRect, Rect dstRect) -> None"},
Guido van Rossume56db431995-03-19 22:49:50 +00004643 {"OpenPicture", (PyCFunction)Qd_OpenPicture, 1,
4644 "(Rect picFrame) -> (PicHandle _rv)"},
4645 {"PicComment", (PyCFunction)Qd_PicComment, 1,
4646 "(short kind, short dataSize, Handle dataHandle) -> None"},
4647 {"ClosePicture", (PyCFunction)Qd_ClosePicture, 1,
4648 "() -> None"},
4649 {"DrawPicture", (PyCFunction)Qd_DrawPicture, 1,
4650 "(PicHandle myPicture, Rect dstRect) -> None"},
4651 {"KillPicture", (PyCFunction)Qd_KillPicture, 1,
4652 "(PicHandle myPicture) -> None"},
4653 {"OpenPoly", (PyCFunction)Qd_OpenPoly, 1,
4654 "() -> (PolyHandle _rv)"},
4655 {"ClosePoly", (PyCFunction)Qd_ClosePoly, 1,
4656 "() -> None"},
4657 {"KillPoly", (PyCFunction)Qd_KillPoly, 1,
4658 "(PolyHandle poly) -> None"},
4659 {"OffsetPoly", (PyCFunction)Qd_OffsetPoly, 1,
4660 "(PolyHandle poly, short dh, short dv) -> None"},
4661 {"FramePoly", (PyCFunction)Qd_FramePoly, 1,
4662 "(PolyHandle poly) -> None"},
4663 {"PaintPoly", (PyCFunction)Qd_PaintPoly, 1,
4664 "(PolyHandle poly) -> None"},
4665 {"ErasePoly", (PyCFunction)Qd_ErasePoly, 1,
4666 "(PolyHandle poly) -> None"},
4667 {"InvertPoly", (PyCFunction)Qd_InvertPoly, 1,
4668 "(PolyHandle poly) -> None"},
Jack Jansen04a02e71996-01-06 17:12:58 +00004669 {"FillPoly", (PyCFunction)Qd_FillPoly, 1,
4670 "(PolyHandle poly, Pattern pat) -> None"},
Guido van Rossume56db431995-03-19 22:49:50 +00004671 {"SetPt", (PyCFunction)Qd_SetPt, 1,
Jack Jansen1d8ede71996-01-08 23:47:31 +00004672 "(short h, short v) -> (Point pt)"},
Guido van Rossume56db431995-03-19 22:49:50 +00004673 {"LocalToGlobal", (PyCFunction)Qd_LocalToGlobal, 1,
4674 "(Point pt) -> (Point pt)"},
4675 {"GlobalToLocal", (PyCFunction)Qd_GlobalToLocal, 1,
4676 "(Point pt) -> (Point pt)"},
4677 {"Random", (PyCFunction)Qd_Random, 1,
4678 "() -> (short _rv)"},
Jack Jansen1c4e6141998-04-21 15:23:55 +00004679 {"MacGetPixel", (PyCFunction)Qd_MacGetPixel, 1,
Guido van Rossume56db431995-03-19 22:49:50 +00004680 "(short h, short v) -> (Boolean _rv)"},
4681 {"ScalePt", (PyCFunction)Qd_ScalePt, 1,
4682 "(Point pt, Rect srcRect, Rect dstRect) -> (Point pt)"},
4683 {"MapPt", (PyCFunction)Qd_MapPt, 1,
4684 "(Point pt, Rect srcRect, Rect dstRect) -> (Point pt)"},
4685 {"MapRect", (PyCFunction)Qd_MapRect, 1,
Jack Jansen54c8f7e1995-11-14 10:46:01 +00004686 "(Rect r, Rect srcRect, Rect dstRect) -> (Rect r)"},
Guido van Rossume56db431995-03-19 22:49:50 +00004687 {"MapRgn", (PyCFunction)Qd_MapRgn, 1,
4688 "(RgnHandle rgn, Rect srcRect, Rect dstRect) -> None"},
4689 {"MapPoly", (PyCFunction)Qd_MapPoly, 1,
4690 "(PolyHandle poly, Rect srcRect, Rect dstRect) -> None"},
Jack Jansen41058c01995-11-16 22:48:29 +00004691 {"StdBits", (PyCFunction)Qd_StdBits, 1,
4692 "(BitMapPtr srcBits, Rect srcRect, Rect dstRect, short mode, RgnHandle maskRgn) -> None"},
Guido van Rossume56db431995-03-19 22:49:50 +00004693 {"AddPt", (PyCFunction)Qd_AddPt, 1,
4694 "(Point src, Point dst) -> (Point dst)"},
4695 {"EqualPt", (PyCFunction)Qd_EqualPt, 1,
4696 "(Point pt1, Point pt2) -> (Boolean _rv)"},
Jack Jansen1c4e6141998-04-21 15:23:55 +00004697 {"MacPtInRect", (PyCFunction)Qd_MacPtInRect, 1,
Guido van Rossume56db431995-03-19 22:49:50 +00004698 "(Point pt, Rect r) -> (Boolean _rv)"},
4699 {"Pt2Rect", (PyCFunction)Qd_Pt2Rect, 1,
4700 "(Point pt1, Point pt2) -> (Rect dstRect)"},
4701 {"PtToAngle", (PyCFunction)Qd_PtToAngle, 1,
4702 "(Rect r, Point pt) -> (short angle)"},
Jack Jansenb81cf9d1995-06-06 13:08:40 +00004703 {"SubPt", (PyCFunction)Qd_SubPt, 1,
4704 "(Point src, Point dst) -> (Point dst)"},
Guido van Rossume56db431995-03-19 22:49:50 +00004705 {"PtInRgn", (PyCFunction)Qd_PtInRgn, 1,
4706 "(Point pt, RgnHandle rgn) -> (Boolean _rv)"},
4707 {"NewPixMap", (PyCFunction)Qd_NewPixMap, 1,
4708 "() -> (PixMapHandle _rv)"},
Guido van Rossume56db431995-03-19 22:49:50 +00004709 {"DisposePixMap", (PyCFunction)Qd_DisposePixMap, 1,
4710 "(PixMapHandle pm) -> None"},
4711 {"CopyPixMap", (PyCFunction)Qd_CopyPixMap, 1,
4712 "(PixMapHandle srcPM, PixMapHandle dstPM) -> None"},
4713 {"NewPixPat", (PyCFunction)Qd_NewPixPat, 1,
4714 "() -> (PixPatHandle _rv)"},
Guido van Rossume56db431995-03-19 22:49:50 +00004715 {"DisposePixPat", (PyCFunction)Qd_DisposePixPat, 1,
4716 "(PixPatHandle pp) -> None"},
4717 {"CopyPixPat", (PyCFunction)Qd_CopyPixPat, 1,
4718 "(PixPatHandle srcPP, PixPatHandle dstPP) -> None"},
4719 {"PenPixPat", (PyCFunction)Qd_PenPixPat, 1,
4720 "(PixPatHandle pp) -> None"},
4721 {"BackPixPat", (PyCFunction)Qd_BackPixPat, 1,
4722 "(PixPatHandle pp) -> None"},
4723 {"GetPixPat", (PyCFunction)Qd_GetPixPat, 1,
4724 "(short patID) -> (PixPatHandle _rv)"},
Jack Jansen232f3cd1995-12-09 14:04:31 +00004725 {"MakeRGBPat", (PyCFunction)Qd_MakeRGBPat, 1,
4726 "(PixPatHandle pp, RGBColor myColor) -> None"},
Guido van Rossume56db431995-03-19 22:49:50 +00004727 {"FillCRect", (PyCFunction)Qd_FillCRect, 1,
4728 "(Rect r, PixPatHandle pp) -> None"},
4729 {"FillCOval", (PyCFunction)Qd_FillCOval, 1,
4730 "(Rect r, PixPatHandle pp) -> None"},
4731 {"FillCRoundRect", (PyCFunction)Qd_FillCRoundRect, 1,
4732 "(Rect r, short ovalWidth, short ovalHeight, PixPatHandle pp) -> None"},
4733 {"FillCArc", (PyCFunction)Qd_FillCArc, 1,
4734 "(Rect r, short startAngle, short arcAngle, PixPatHandle pp) -> None"},
4735 {"FillCRgn", (PyCFunction)Qd_FillCRgn, 1,
4736 "(RgnHandle rgn, PixPatHandle pp) -> None"},
4737 {"FillCPoly", (PyCFunction)Qd_FillCPoly, 1,
4738 "(PolyHandle poly, PixPatHandle pp) -> None"},
Jack Jansen232f3cd1995-12-09 14:04:31 +00004739 {"RGBForeColor", (PyCFunction)Qd_RGBForeColor, 1,
4740 "(RGBColor color) -> None"},
4741 {"RGBBackColor", (PyCFunction)Qd_RGBBackColor, 1,
4742 "(RGBColor color) -> None"},
4743 {"SetCPixel", (PyCFunction)Qd_SetCPixel, 1,
4744 "(short h, short v, RGBColor cPix) -> None"},
Guido van Rossume56db431995-03-19 22:49:50 +00004745 {"SetPortPix", (PyCFunction)Qd_SetPortPix, 1,
4746 "(PixMapHandle pm) -> None"},
Jack Jansen232f3cd1995-12-09 14:04:31 +00004747 {"GetCPixel", (PyCFunction)Qd_GetCPixel, 1,
4748 "(short h, short v) -> (RGBColor cPix)"},
4749 {"GetForeColor", (PyCFunction)Qd_GetForeColor, 1,
4750 "() -> (RGBColor color)"},
4751 {"GetBackColor", (PyCFunction)Qd_GetBackColor, 1,
4752 "() -> (RGBColor color)"},
4753 {"OpColor", (PyCFunction)Qd_OpColor, 1,
4754 "(RGBColor color) -> None"},
4755 {"HiliteColor", (PyCFunction)Qd_HiliteColor, 1,
4756 "(RGBColor color) -> None"},
Jack Jansen69b43ed1997-08-15 14:35:54 +00004757 {"DisposeCTable", (PyCFunction)Qd_DisposeCTable, 1,
4758 "(CTabHandle cTable) -> None"},
4759 {"GetCTable", (PyCFunction)Qd_GetCTable, 1,
4760 "(short ctID) -> (CTabHandle _rv)"},
4761 {"GetCCursor", (PyCFunction)Qd_GetCCursor, 1,
4762 "(short crsrID) -> (CCrsrHandle _rv)"},
4763 {"SetCCursor", (PyCFunction)Qd_SetCCursor, 1,
4764 "(CCrsrHandle cCrsr) -> None"},
Guido van Rossume56db431995-03-19 22:49:50 +00004765 {"AllocCursor", (PyCFunction)Qd_AllocCursor, 1,
4766 "() -> None"},
Jack Jansen69b43ed1997-08-15 14:35:54 +00004767 {"DisposeCCursor", (PyCFunction)Qd_DisposeCCursor, 1,
4768 "(CCrsrHandle cCrsr) -> None"},
4769 {"GetMaxDevice", (PyCFunction)Qd_GetMaxDevice, 1,
4770 "(Rect globalRect) -> (GDHandle _rv)"},
Guido van Rossume56db431995-03-19 22:49:50 +00004771 {"GetCTSeed", (PyCFunction)Qd_GetCTSeed, 1,
4772 "() -> (long _rv)"},
Jack Jansen69b43ed1997-08-15 14:35:54 +00004773 {"GetDeviceList", (PyCFunction)Qd_GetDeviceList, 1,
4774 "() -> (GDHandle _rv)"},
4775 {"GetMainDevice", (PyCFunction)Qd_GetMainDevice, 1,
4776 "() -> (GDHandle _rv)"},
4777 {"GetNextDevice", (PyCFunction)Qd_GetNextDevice, 1,
4778 "(GDHandle curDevice) -> (GDHandle _rv)"},
4779 {"TestDeviceAttribute", (PyCFunction)Qd_TestDeviceAttribute, 1,
4780 "(GDHandle gdh, short attribute) -> (Boolean _rv)"},
4781 {"SetDeviceAttribute", (PyCFunction)Qd_SetDeviceAttribute, 1,
4782 "(GDHandle gdh, short attribute, Boolean value) -> None"},
4783 {"InitGDevice", (PyCFunction)Qd_InitGDevice, 1,
4784 "(short qdRefNum, long mode, GDHandle gdh) -> None"},
4785 {"NewGDevice", (PyCFunction)Qd_NewGDevice, 1,
4786 "(short refNum, long mode) -> (GDHandle _rv)"},
4787 {"DisposeGDevice", (PyCFunction)Qd_DisposeGDevice, 1,
4788 "(GDHandle gdh) -> None"},
4789 {"SetGDevice", (PyCFunction)Qd_SetGDevice, 1,
4790 "(GDHandle gd) -> None"},
4791 {"GetGDevice", (PyCFunction)Qd_GetGDevice, 1,
4792 "() -> (GDHandle _rv)"},
Jack Jansen232f3cd1995-12-09 14:04:31 +00004793 {"Color2Index", (PyCFunction)Qd_Color2Index, 1,
4794 "(RGBColor myColor) -> (long _rv)"},
4795 {"Index2Color", (PyCFunction)Qd_Index2Color, 1,
4796 "(long index) -> (RGBColor aColor)"},
4797 {"InvertColor", (PyCFunction)Qd_InvertColor, 1,
4798 "() -> (RGBColor myColor)"},
4799 {"RealColor", (PyCFunction)Qd_RealColor, 1,
4800 "(RGBColor color) -> (Boolean _rv)"},
Jack Jansen69b43ed1997-08-15 14:35:54 +00004801 {"GetSubTable", (PyCFunction)Qd_GetSubTable, 1,
4802 "(CTabHandle myColors, short iTabRes, CTabHandle targetTbl) -> None"},
4803 {"MakeITable", (PyCFunction)Qd_MakeITable, 1,
4804 "(CTabHandle cTabH, ITabHandle iTabH, short res) -> None"},
Guido van Rossume56db431995-03-19 22:49:50 +00004805 {"SetClientID", (PyCFunction)Qd_SetClientID, 1,
4806 "(short id) -> None"},
4807 {"ProtectEntry", (PyCFunction)Qd_ProtectEntry, 1,
4808 "(short index, Boolean protect) -> None"},
4809 {"ReserveEntry", (PyCFunction)Qd_ReserveEntry, 1,
4810 "(short index, Boolean reserve) -> None"},
4811 {"QDError", (PyCFunction)Qd_QDError, 1,
4812 "() -> (short _rv)"},
Jack Jansen41058c01995-11-16 22:48:29 +00004813 {"CopyDeepMask", (PyCFunction)Qd_CopyDeepMask, 1,
4814 "(BitMapPtr srcBits, BitMapPtr maskBits, BitMapPtr dstBits, Rect srcRect, Rect maskRect, Rect dstRect, short mode, RgnHandle maskRgn) -> None"},
Jack Jansen54c8f7e1995-11-14 10:46:01 +00004815 {"GetPattern", (PyCFunction)Qd_GetPattern, 1,
4816 "(short patternID) -> (PatHandle _rv)"},
Jack Jansen1c4e6141998-04-21 15:23:55 +00004817 {"MacGetCursor", (PyCFunction)Qd_MacGetCursor, 1,
Jack Jansen54c8f7e1995-11-14 10:46:01 +00004818 "(short cursorID) -> (CursHandle _rv)"},
4819 {"GetPicture", (PyCFunction)Qd_GetPicture, 1,
4820 "(short pictureID) -> (PicHandle _rv)"},
4821 {"DeltaPoint", (PyCFunction)Qd_DeltaPoint, 1,
4822 "(Point ptA, Point ptB) -> (long _rv)"},
4823 {"ShieldCursor", (PyCFunction)Qd_ShieldCursor, 1,
4824 "(Rect shieldRect, Point offsetPt) -> None"},
4825 {"ScreenRes", (PyCFunction)Qd_ScreenRes, 1,
4826 "() -> (short scrnHRes, short scrnVRes)"},
Jack Jansen04a02e71996-01-06 17:12:58 +00004827 {"GetIndPattern", (PyCFunction)Qd_GetIndPattern, 1,
4828 "(short patternListID, short index) -> (Pattern thePat)"},
Jack Jansen21f96871998-02-20 16:02:09 +00004829 {"SlopeFromAngle", (PyCFunction)Qd_SlopeFromAngle, 1,
4830 "(short angle) -> (Fixed _rv)"},
4831 {"AngleFromSlope", (PyCFunction)Qd_AngleFromSlope, 1,
4832 "(Fixed slope) -> (short _rv)"},
Jack Jansenb81cf9d1995-06-06 13:08:40 +00004833 {"TextFont", (PyCFunction)Qd_TextFont, 1,
4834 "(short font) -> None"},
4835 {"TextFace", (PyCFunction)Qd_TextFace, 1,
Jack Jansene742a821998-02-25 15:46:50 +00004836 "(StyleParameter face) -> None"},
Jack Jansenb81cf9d1995-06-06 13:08:40 +00004837 {"TextMode", (PyCFunction)Qd_TextMode, 1,
4838 "(short mode) -> None"},
4839 {"TextSize", (PyCFunction)Qd_TextSize, 1,
4840 "(short size) -> None"},
4841 {"SpaceExtra", (PyCFunction)Qd_SpaceExtra, 1,
Jack Jansen330381c1995-11-15 15:18:01 +00004842 "(Fixed extra) -> None"},
Jack Jansenb81cf9d1995-06-06 13:08:40 +00004843 {"DrawChar", (PyCFunction)Qd_DrawChar, 1,
Jack Jansen21f96871998-02-20 16:02:09 +00004844 "(CharParameter ch) -> None"},
Jack Jansenb81cf9d1995-06-06 13:08:40 +00004845 {"DrawString", (PyCFunction)Qd_DrawString, 1,
4846 "(Str255 s) -> None"},
Jack Jansen1c4e6141998-04-21 15:23:55 +00004847 {"MacDrawText", (PyCFunction)Qd_MacDrawText, 1,
Jack Jansenb81cf9d1995-06-06 13:08:40 +00004848 "(Buffer textBuf, short firstByte, short byteCount) -> None"},
4849 {"CharWidth", (PyCFunction)Qd_CharWidth, 1,
Jack Jansen21f96871998-02-20 16:02:09 +00004850 "(CharParameter ch) -> (short _rv)"},
Jack Jansenb81cf9d1995-06-06 13:08:40 +00004851 {"StringWidth", (PyCFunction)Qd_StringWidth, 1,
4852 "(Str255 s) -> (short _rv)"},
4853 {"TextWidth", (PyCFunction)Qd_TextWidth, 1,
4854 "(Buffer textBuf, short firstByte, short byteCount) -> (short _rv)"},
Jack Jansen3a50f8a1996-01-11 16:17:14 +00004855 {"GetFontInfo", (PyCFunction)Qd_GetFontInfo, 1,
4856 "() -> (FontInfo info)"},
Jack Jansenb81cf9d1995-06-06 13:08:40 +00004857 {"CharExtra", (PyCFunction)Qd_CharExtra, 1,
Jack Jansen330381c1995-11-15 15:18:01 +00004858 "(Fixed extra) -> None"},
Jack Jansen7f725e41998-04-23 13:21:09 +00004859 {"SetPort", (PyCFunction)Qd_SetPort, 1,
Jack Jansen29bfea91998-04-27 15:09:36 +00004860 "(GrafPtr thePort) -> None"},
Jack Jansene180d991998-04-24 10:28:20 +00004861 {"GetCursor", (PyCFunction)Qd_GetCursor, 1,
4862 "(short cursorID) -> (CursHandle _rv)"},
4863 {"SetCursor", (PyCFunction)Qd_SetCursor, 1,
4864 "(Cursor crsr) -> None"},
4865 {"ShowCursor", (PyCFunction)Qd_ShowCursor, 1,
4866 "() -> None"},
4867 {"LineTo", (PyCFunction)Qd_LineTo, 1,
4868 "(short h, short v) -> None"},
4869 {"SetRect", (PyCFunction)Qd_SetRect, 1,
4870 "(short left, short top, short right, short bottom) -> (Rect r)"},
4871 {"OffsetRect", (PyCFunction)Qd_OffsetRect, 1,
4872 "(Rect r, short dh, short dv) -> (Rect r)"},
4873 {"InsetRect", (PyCFunction)Qd_InsetRect, 1,
4874 "(Rect r, short dh, short dv) -> (Rect r)"},
4875 {"UnionRect", (PyCFunction)Qd_UnionRect, 1,
4876 "(Rect src1, Rect src2) -> (Rect dstRect)"},
4877 {"EqualRect", (PyCFunction)Qd_EqualRect, 1,
4878 "(Rect rect1, Rect rect2) -> (Boolean _rv)"},
4879 {"FrameRect", (PyCFunction)Qd_FrameRect, 1,
4880 "(Rect r) -> None"},
4881 {"InvertRect", (PyCFunction)Qd_InvertRect, 1,
4882 "(Rect r) -> None"},
4883 {"FillRect", (PyCFunction)Qd_FillRect, 1,
4884 "(Rect r, Pattern pat) -> None"},
4885 {"CopyRgn", (PyCFunction)Qd_CopyRgn, 1,
4886 "(RgnHandle srcRgn, RgnHandle dstRgn) -> None"},
4887 {"SetRectRgn", (PyCFunction)Qd_SetRectRgn, 1,
4888 "(RgnHandle rgn, short left, short top, short right, short bottom) -> None"},
4889 {"OffsetRgn", (PyCFunction)Qd_OffsetRgn, 1,
4890 "(RgnHandle rgn, short dh, short dv) -> None"},
4891 {"UnionRgn", (PyCFunction)Qd_UnionRgn, 1,
4892 "(RgnHandle srcRgnA, RgnHandle srcRgnB, RgnHandle dstRgn) -> None"},
4893 {"XorRgn", (PyCFunction)Qd_XorRgn, 1,
4894 "(RgnHandle srcRgnA, RgnHandle srcRgnB, RgnHandle dstRgn) -> None"},
4895 {"EqualRgn", (PyCFunction)Qd_EqualRgn, 1,
4896 "(RgnHandle rgnA, RgnHandle rgnB) -> (Boolean _rv)"},
4897 {"FrameRgn", (PyCFunction)Qd_FrameRgn, 1,
4898 "(RgnHandle rgn) -> None"},
4899 {"PaintRgn", (PyCFunction)Qd_PaintRgn, 1,
4900 "(RgnHandle rgn) -> None"},
4901 {"InvertRgn", (PyCFunction)Qd_InvertRgn, 1,
4902 "(RgnHandle rgn) -> None"},
4903 {"FillRgn", (PyCFunction)Qd_FillRgn, 1,
4904 "(RgnHandle rgn, Pattern pat) -> None"},
4905 {"GetPixel", (PyCFunction)Qd_GetPixel, 1,
4906 "(short h, short v) -> (Boolean _rv)"},
4907 {"PtInRect", (PyCFunction)Qd_PtInRect, 1,
4908 "(Point pt, Rect r) -> (Boolean _rv)"},
4909 {"DrawText", (PyCFunction)Qd_DrawText, 1,
4910 "(Buffer textBuf, short firstByte, short byteCount) -> None"},
Jack Jansen41058c01995-11-16 22:48:29 +00004911 {"BitMap", (PyCFunction)Qd_BitMap, 1,
4912 "Take (string, int, Rect) argument and create BitMap"},
Jack Jansen425e9eb1995-12-12 15:02:03 +00004913 {"RawBitMap", (PyCFunction)Qd_RawBitMap, 1,
4914 "Take string BitMap and turn into BitMap object"},
Guido van Rossum17448e21995-01-30 11:53:55 +00004915 {NULL, NULL, 0}
4916};
4917
4918
4919
4920
4921void initQd()
4922{
4923 PyObject *m;
4924 PyObject *d;
4925
4926
4927
4928
4929 m = Py_InitModule("Qd", Qd_methods);
4930 d = PyModule_GetDict(m);
4931 Qd_Error = PyMac_GetOSErrException();
4932 if (Qd_Error == NULL ||
4933 PyDict_SetItemString(d, "Error", Qd_Error) != 0)
4934 Py_FatalError("can't initialize Qd.Error");
Jack Jansena755e681997-09-20 17:40:22 +00004935 GrafPort_Type.ob_type = &PyType_Type;
4936 Py_INCREF(&GrafPort_Type);
4937 if (PyDict_SetItemString(d, "GrafPortType", (PyObject *)&GrafPort_Type) != 0)
4938 Py_FatalError("can't initialize GrafPortType");
4939 BitMap_Type.ob_type = &PyType_Type;
4940 Py_INCREF(&BitMap_Type);
4941 if (PyDict_SetItemString(d, "BitMapType", (PyObject *)&BitMap_Type) != 0)
4942 Py_FatalError("can't initialize BitMapType");
4943 QDGlobalsAccess_Type.ob_type = &PyType_Type;
4944 Py_INCREF(&QDGlobalsAccess_Type);
4945 if (PyDict_SetItemString(d, "QDGlobalsAccessType", (PyObject *)&QDGlobalsAccess_Type) != 0)
4946 Py_FatalError("can't initialize QDGlobalsAccessType");
Jack Jansenb5394061996-01-05 18:06:41 +00004947
4948 {
4949 PyObject *o;
Jack Jansenbdd07471996-01-29 15:44:03 +00004950
4951 o = QDGA_New();
4952 if (o == NULL || PyDict_SetItemString(d, "qd", o) != 0)
4953 Py_FatalError("can't initialize Qd.qd");
Jack Jansenb5394061996-01-05 18:06:41 +00004954 }
4955
4956
Guido van Rossum17448e21995-01-30 11:53:55 +00004957}
4958
4959/* ========================= End module Qd ========================== */
4960