blob: a5e68715de219cac6e98cd9ac0ef02ed4286c1e7 [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 Jansene79dc762000-06-02 21:35:07 +0000144#ifndef TARGET_API_MAC_CARBON
Jack Jansen3a50f8a1996-01-11 16:17:14 +0000145
146 { CGrafPtr itself_color = (CGrafPtr)self->ob_itself;
Jack Jansen330381c1995-11-15 15:18:01 +0000147
Jack Jansen3a50f8a1996-01-11 16:17:14 +0000148 if ( strcmp(name, "data") == 0 )
149 return PyString_FromStringAndSize((char *)self->ob_itself, sizeof(GrafPort));
150
151 if ( (itself_color->portVersion&0xc000) == 0xc000 ) {
152 /* Color-only attributes */
153
154 if ( strcmp(name, "portBits") == 0 )
155 /* XXXX Do we need HLock() stuff here?? */
156 return BMObj_New((BitMapPtr)*itself_color->portPixMap);
157 if ( strcmp(name, "grafVars") == 0 )
158 return Py_BuildValue("O&", ResObj_New, (Handle)itself_color->visRgn);
159 if ( strcmp(name, "chExtra") == 0 )
160 return Py_BuildValue("h", itself_color->chExtra);
161 if ( strcmp(name, "pnLocHFrac") == 0 )
162 return Py_BuildValue("h", itself_color->pnLocHFrac);
Jack Jansen61f3df41996-01-15 14:39:56 +0000163 if ( strcmp(name, "bkPixPat") == 0 )
164 return Py_BuildValue("O&", ResObj_New, (Handle)itself_color->bkPixPat);
165 if ( strcmp(name, "rgbFgColor") == 0 )
166 return Py_BuildValue("O&", QdRGB_New, &itself_color->rgbFgColor);
167 if ( strcmp(name, "rgbBkColor") == 0 )
168 return Py_BuildValue("O&", QdRGB_New, &itself_color->rgbBkColor);
169 if ( strcmp(name, "pnPixPat") == 0 )
170 return Py_BuildValue("O&", ResObj_New, (Handle)itself_color->pnPixPat);
171 if ( strcmp(name, "fillPixPat") == 0 )
172 return Py_BuildValue("O&", ResObj_New, (Handle)itself_color->fillPixPat);
Jack Jansen3a50f8a1996-01-11 16:17:14 +0000173 } else {
174 /* Mono-only attributes */
175 if ( strcmp(name, "portBits") == 0 )
176 return BMObj_New(&self->ob_itself->portBits);
Jack Jansen61f3df41996-01-15 14:39:56 +0000177 if ( strcmp(name, "bkPat") == 0 )
178 return Py_BuildValue("s#", (char *)&self->ob_itself->bkPat, sizeof(Pattern));
179 if ( strcmp(name, "fillPat") == 0 )
180 return Py_BuildValue("s#", (char *)&self->ob_itself->fillPat, sizeof(Pattern));
181 if ( strcmp(name, "pnPat") == 0 )
182 return Py_BuildValue("s#", (char *)&self->ob_itself->pnPat, sizeof(Pattern));
Jack Jansen3a50f8a1996-01-11 16:17:14 +0000183 }
184 /*
185 ** Accessible for both color/mono windows.
186 ** portVersion is really color-only, but we put it here
187 ** for convenience
188 */
189 if ( strcmp(name, "portVersion") == 0 )
190 return Py_BuildValue("h", itself_color->portVersion);
191 if ( strcmp(name, "device") == 0 )
192 return PyInt_FromLong((long)self->ob_itself->device);
193 if ( strcmp(name, "portRect") == 0 )
194 return Py_BuildValue("O&", PyMac_BuildRect, &self->ob_itself->portRect);
195 if ( strcmp(name, "visRgn") == 0 )
196 return Py_BuildValue("O&", ResObj_New, (Handle)self->ob_itself->visRgn);
197 if ( strcmp(name, "clipRgn") == 0 )
198 return Py_BuildValue("O&", ResObj_New, (Handle)self->ob_itself->clipRgn);
Jack Jansen3a50f8a1996-01-11 16:17:14 +0000199 if ( strcmp(name, "pnLoc") == 0 )
200 return Py_BuildValue("O&", PyMac_BuildPoint, self->ob_itself->pnLoc);
201 if ( strcmp(name, "pnSize") == 0 )
202 return Py_BuildValue("O&", PyMac_BuildPoint, self->ob_itself->pnSize);
203 if ( strcmp(name, "pnMode") == 0 )
204 return Py_BuildValue("h", self->ob_itself->pnMode);
Jack Jansen3a50f8a1996-01-11 16:17:14 +0000205 if ( strcmp(name, "pnVis") == 0 )
206 return Py_BuildValue("h", self->ob_itself->pnVis);
207 if ( strcmp(name, "txFont") == 0 )
208 return Py_BuildValue("h", self->ob_itself->txFont);
209 if ( strcmp(name, "txFace") == 0 )
210 return Py_BuildValue("h", (short)self->ob_itself->txFace);
211 if ( strcmp(name, "txMode") == 0 )
212 return Py_BuildValue("h", self->ob_itself->txMode);
213 if ( strcmp(name, "txSize") == 0 )
214 return Py_BuildValue("h", self->ob_itself->txSize);
215 if ( strcmp(name, "spExtra") == 0 )
216 return Py_BuildValue("O&", PyMac_BuildFixed, self->ob_itself->spExtra);
217 /* XXXX Add more, as needed */
Jack Jansen3355be31996-05-08 15:33:20 +0000218 /* This one is so we can compare grafports: */
219 if ( strcmp(name, "_id") == 0 )
220 return Py_BuildValue("l", (long)self->ob_itself);
Jack Jansen3a50f8a1996-01-11 16:17:14 +0000221 }
Jack Jansene79dc762000-06-02 21:35:07 +0000222#endif
Jack Jansen330381c1995-11-15 15:18:01 +0000223 return Py_FindMethodInChain(&GrafObj_chain, (PyObject *)self, name);
Guido van Rossum17448e21995-01-30 11:53:55 +0000224}
225
Jack Jansen330381c1995-11-15 15:18:01 +0000226#define GrafObj_setattr NULL
227
Jack Jansena05ac601999-12-12 21:41:51 +0000228#define GrafObj_compare NULL
229
230#define GrafObj_repr NULL
231
232#define GrafObj_hash NULL
233
Jack Jansen330381c1995-11-15 15:18:01 +0000234PyTypeObject GrafPort_Type = {
235 PyObject_HEAD_INIT(&PyType_Type)
236 0, /*ob_size*/
237 "GrafPort", /*tp_name*/
238 sizeof(GrafPortObject), /*tp_basicsize*/
239 0, /*tp_itemsize*/
240 /* methods */
241 (destructor) GrafObj_dealloc, /*tp_dealloc*/
242 0, /*tp_print*/
243 (getattrfunc) GrafObj_getattr, /*tp_getattr*/
244 (setattrfunc) GrafObj_setattr, /*tp_setattr*/
Jack Jansena05ac601999-12-12 21:41:51 +0000245 (cmpfunc) GrafObj_compare, /*tp_compare*/
246 (reprfunc) GrafObj_repr, /*tp_repr*/
247 (PyNumberMethods *)0, /* tp_as_number */
248 (PySequenceMethods *)0, /* tp_as_sequence */
249 (PyMappingMethods *)0, /* tp_as_mapping */
250 (hashfunc) GrafObj_hash, /*tp_hash*/
Jack Jansen330381c1995-11-15 15:18:01 +0000251};
252
253/* -------------------- End object type GrafPort -------------------- */
254
255
Jack Jansen41058c01995-11-16 22:48:29 +0000256/* ----------------------- Object type BitMap ----------------------- */
257
258PyTypeObject BitMap_Type;
259
260#define BMObj_Check(x) ((x)->ob_type == &BitMap_Type)
261
262typedef struct BitMapObject {
263 PyObject_HEAD
264 BitMapPtr ob_itself;
265 PyObject *referred_object;
266 BitMap *referred_bitmap;
267} BitMapObject;
268
269PyObject *BMObj_New(itself)
270 BitMapPtr itself;
271{
272 BitMapObject *it;
273 if (itself == NULL) return PyMac_Error(resNotFound);
274 it = PyObject_NEW(BitMapObject, &BitMap_Type);
275 if (it == NULL) return NULL;
276 it->ob_itself = itself;
277 it->referred_object = NULL;
278 it->referred_bitmap = NULL;
279 return (PyObject *)it;
280}
281BMObj_Convert(v, p_itself)
282 PyObject *v;
283 BitMapPtr *p_itself;
284{
285 if (!BMObj_Check(v))
286 {
287 PyErr_SetString(PyExc_TypeError, "BitMap required");
288 return 0;
289 }
290 *p_itself = ((BitMapObject *)v)->ob_itself;
291 return 1;
292}
293
294static void BMObj_dealloc(self)
295 BitMapObject *self;
296{
297 Py_XDECREF(self->referred_object);
298 if (self->referred_bitmap) free(self->referred_bitmap);
299 PyMem_DEL(self);
300}
301
Jack Jansen484be612000-03-03 16:01:11 +0000302static PyObject *BMObj_getdata(_self, _args)
303 BitMapObject *_self;
304 PyObject *_args;
305{
306 PyObject *_res = NULL;
307
308 int from, length;
309 char *cp;
310
311 if ( !PyArg_ParseTuple(_args, "ii", &from, &length) )
312 return NULL;
313 cp = _self->ob_itself->baseAddr+from;
314 return PyString_FromStringAndSize(cp, length);
315
316}
317
318static PyObject *BMObj_putdata(_self, _args)
319 BitMapObject *_self;
320 PyObject *_args;
321{
322 PyObject *_res = NULL;
323
324 int from, length;
325 char *cp, *icp;
326
327 if ( !PyArg_ParseTuple(_args, "is#", &from, &icp, &length) )
328 return NULL;
329 cp = _self->ob_itself->baseAddr+from;
330 memcpy(cp, icp, length);
331 Py_INCREF(Py_None);
332 return Py_None;
333
334}
335
Jack Jansen41058c01995-11-16 22:48:29 +0000336static PyMethodDef BMObj_methods[] = {
Jack Jansen484be612000-03-03 16:01:11 +0000337 {"getdata", (PyCFunction)BMObj_getdata, 1,
338 "(int start, int size) -> string. Return bytes from the bitmap"},
339 {"putdata", (PyCFunction)BMObj_putdata, 1,
340 "(int start, string data). Store bytes into the bitmap"},
Jack Jansen41058c01995-11-16 22:48:29 +0000341 {NULL, NULL, 0}
342};
343
344PyMethodChain BMObj_chain = { BMObj_methods, NULL };
345
346static PyObject *BMObj_getattr(self, name)
347 BitMapObject *self;
348 char *name;
349{
350 if ( strcmp(name, "baseAddr") == 0 )
351 return PyInt_FromLong((long)self->ob_itself->baseAddr);
352 if ( strcmp(name, "rowBytes") == 0 )
353 return PyInt_FromLong((long)self->ob_itself->rowBytes);
354 if ( strcmp(name, "bounds") == 0 )
355 return Py_BuildValue("O&", PyMac_BuildRect, &self->ob_itself->bounds);
356 /* XXXX Add more, as needed */
Jack Jansen425e9eb1995-12-12 15:02:03 +0000357 if ( strcmp(name, "bitmap_data") == 0 )
358 return PyString_FromStringAndSize((char *)self->ob_itself, sizeof(BitMap));
359 if ( strcmp(name, "pixmap_data") == 0 )
360 return PyString_FromStringAndSize((char *)self->ob_itself, sizeof(PixMap));
Jack Jansen41058c01995-11-16 22:48:29 +0000361
362 return Py_FindMethodInChain(&BMObj_chain, (PyObject *)self, name);
363}
364
365#define BMObj_setattr NULL
366
Jack Jansena05ac601999-12-12 21:41:51 +0000367#define BMObj_compare NULL
368
369#define BMObj_repr NULL
370
371#define BMObj_hash NULL
372
Jack Jansen41058c01995-11-16 22:48:29 +0000373PyTypeObject BitMap_Type = {
374 PyObject_HEAD_INIT(&PyType_Type)
375 0, /*ob_size*/
376 "BitMap", /*tp_name*/
377 sizeof(BitMapObject), /*tp_basicsize*/
378 0, /*tp_itemsize*/
379 /* methods */
380 (destructor) BMObj_dealloc, /*tp_dealloc*/
381 0, /*tp_print*/
382 (getattrfunc) BMObj_getattr, /*tp_getattr*/
383 (setattrfunc) BMObj_setattr, /*tp_setattr*/
Jack Jansena05ac601999-12-12 21:41:51 +0000384 (cmpfunc) BMObj_compare, /*tp_compare*/
385 (reprfunc) BMObj_repr, /*tp_repr*/
386 (PyNumberMethods *)0, /* tp_as_number */
387 (PySequenceMethods *)0, /* tp_as_sequence */
388 (PyMappingMethods *)0, /* tp_as_mapping */
389 (hashfunc) BMObj_hash, /*tp_hash*/
Jack Jansen41058c01995-11-16 22:48:29 +0000390};
391
392/* --------------------- End object type BitMap --------------------- */
393
394
Jack Jansenbdd07471996-01-29 15:44:03 +0000395/* ------------------ Object type QDGlobalsAccess ------------------- */
396
397staticforward PyTypeObject QDGlobalsAccess_Type;
398
399#define QDGA_Check(x) ((x)->ob_type == &QDGlobalsAccess_Type)
400
401typedef struct QDGlobalsAccessObject {
402 PyObject_HEAD
403} QDGlobalsAccessObject;
404
405static PyObject *QDGA_New()
406{
407 QDGlobalsAccessObject *it;
408 it = PyObject_NEW(QDGlobalsAccessObject, &QDGlobalsAccess_Type);
409 if (it == NULL) return NULL;
410 return (PyObject *)it;
411}
412
413static void QDGA_dealloc(self)
414 QDGlobalsAccessObject *self;
415{
416 PyMem_DEL(self);
417}
418
419static PyMethodDef QDGA_methods[] = {
420 {NULL, NULL, 0}
421};
422
423static PyMethodChain QDGA_chain = { QDGA_methods, NULL };
424
425static PyObject *QDGA_getattr(self, name)
426 QDGlobalsAccessObject *self;
427 char *name;
428{
Jack Jansene79dc762000-06-02 21:35:07 +0000429#ifndef TARGET_API_MAC_CARBON
Jack Jansenbdd07471996-01-29 15:44:03 +0000430
431 if ( strcmp(name, "arrow") == 0 )
432 return PyString_FromStringAndSize((char *)&qd.arrow, sizeof(qd.arrow));
433 if ( strcmp(name, "black") == 0 )
434 return PyString_FromStringAndSize((char *)&qd.black, sizeof(qd.black));
435 if ( strcmp(name, "white") == 0 )
436 return PyString_FromStringAndSize((char *)&qd.white, sizeof(qd.white));
437 if ( strcmp(name, "gray") == 0 )
438 return PyString_FromStringAndSize((char *)&qd.gray, sizeof(qd.gray));
439 if ( strcmp(name, "ltGray") == 0 )
440 return PyString_FromStringAndSize((char *)&qd.ltGray, sizeof(qd.ltGray));
441 if ( strcmp(name, "dkGray") == 0 )
442 return PyString_FromStringAndSize((char *)&qd.dkGray, sizeof(qd.dkGray));
443 if ( strcmp(name, "screenBits") == 0 )
444 return BMObj_New(&qd.screenBits);
445 if ( strcmp(name, "thePort") == 0 )
446 return GrafObj_New(qd.thePort);
447 if ( strcmp(name, "randSeed") == 0 )
448 return Py_BuildValue("l", &qd.randSeed);
449
Jack Jansene79dc762000-06-02 21:35:07 +0000450#endif
Jack Jansenbdd07471996-01-29 15:44:03 +0000451 return Py_FindMethodInChain(&QDGA_chain, (PyObject *)self, name);
452}
453
454#define QDGA_setattr NULL
455
Jack Jansena05ac601999-12-12 21:41:51 +0000456#define QDGA_compare NULL
457
458#define QDGA_repr NULL
459
460#define QDGA_hash NULL
461
Jack Jansenbdd07471996-01-29 15:44:03 +0000462staticforward PyTypeObject QDGlobalsAccess_Type = {
463 PyObject_HEAD_INIT(&PyType_Type)
464 0, /*ob_size*/
465 "QDGlobalsAccess", /*tp_name*/
466 sizeof(QDGlobalsAccessObject), /*tp_basicsize*/
467 0, /*tp_itemsize*/
468 /* methods */
469 (destructor) QDGA_dealloc, /*tp_dealloc*/
470 0, /*tp_print*/
471 (getattrfunc) QDGA_getattr, /*tp_getattr*/
472 (setattrfunc) QDGA_setattr, /*tp_setattr*/
Jack Jansena05ac601999-12-12 21:41:51 +0000473 (cmpfunc) QDGA_compare, /*tp_compare*/
474 (reprfunc) QDGA_repr, /*tp_repr*/
475 (PyNumberMethods *)0, /* tp_as_number */
476 (PySequenceMethods *)0, /* tp_as_sequence */
477 (PyMappingMethods *)0, /* tp_as_mapping */
478 (hashfunc) QDGA_hash, /*tp_hash*/
Jack Jansenbdd07471996-01-29 15:44:03 +0000479};
480
481/* ---------------- End object type QDGlobalsAccess ----------------- */
482
483
Jack Jansen1c4e6141998-04-21 15:23:55 +0000484static PyObject *Qd_MacSetPort(_self, _args)
Guido van Rossum17448e21995-01-30 11:53:55 +0000485 PyObject *_self;
486 PyObject *_args;
487{
488 PyObject *_res = NULL;
Jack Jansen330381c1995-11-15 15:18:01 +0000489 GrafPtr port;
Guido van Rossum17448e21995-01-30 11:53:55 +0000490 if (!PyArg_ParseTuple(_args, "O&",
Jack Jansen330381c1995-11-15 15:18:01 +0000491 GrafObj_Convert, &port))
Guido van Rossum17448e21995-01-30 11:53:55 +0000492 return NULL;
Jack Jansen1c4e6141998-04-21 15:23:55 +0000493 MacSetPort(port);
Guido van Rossume56db431995-03-19 22:49:50 +0000494 Py_INCREF(Py_None);
495 _res = Py_None;
496 return _res;
497}
498
499static PyObject *Qd_GetPort(_self, _args)
500 PyObject *_self;
501 PyObject *_args;
502{
503 PyObject *_res = NULL;
Jack Jansen330381c1995-11-15 15:18:01 +0000504 GrafPtr port;
Guido van Rossume56db431995-03-19 22:49:50 +0000505 if (!PyArg_ParseTuple(_args, ""))
506 return NULL;
507 GetPort(&port);
508 _res = Py_BuildValue("O&",
Jack Jansen330381c1995-11-15 15:18:01 +0000509 GrafObj_New, port);
Guido van Rossume56db431995-03-19 22:49:50 +0000510 return _res;
511}
512
513static PyObject *Qd_GrafDevice(_self, _args)
514 PyObject *_self;
515 PyObject *_args;
516{
517 PyObject *_res = NULL;
518 short device;
519 if (!PyArg_ParseTuple(_args, "h",
520 &device))
521 return NULL;
522 GrafDevice(device);
523 Py_INCREF(Py_None);
524 _res = Py_None;
525 return _res;
526}
527
Jack Jansen41058c01995-11-16 22:48:29 +0000528static PyObject *Qd_SetPortBits(_self, _args)
529 PyObject *_self;
530 PyObject *_args;
531{
532 PyObject *_res = NULL;
533 BitMapPtr bm;
534 if (!PyArg_ParseTuple(_args, "O&",
535 BMObj_Convert, &bm))
536 return NULL;
537 SetPortBits(bm);
538 Py_INCREF(Py_None);
539 _res = Py_None;
540 return _res;
541}
542
Guido van Rossume56db431995-03-19 22:49:50 +0000543static PyObject *Qd_PortSize(_self, _args)
544 PyObject *_self;
545 PyObject *_args;
546{
547 PyObject *_res = NULL;
548 short width;
549 short height;
550 if (!PyArg_ParseTuple(_args, "hh",
551 &width,
552 &height))
553 return NULL;
554 PortSize(width,
555 height);
556 Py_INCREF(Py_None);
557 _res = Py_None;
558 return _res;
559}
560
561static PyObject *Qd_MovePortTo(_self, _args)
562 PyObject *_self;
563 PyObject *_args;
564{
565 PyObject *_res = NULL;
566 short leftGlobal;
567 short topGlobal;
568 if (!PyArg_ParseTuple(_args, "hh",
569 &leftGlobal,
570 &topGlobal))
571 return NULL;
572 MovePortTo(leftGlobal,
573 topGlobal);
574 Py_INCREF(Py_None);
575 _res = Py_None;
576 return _res;
577}
578
579static PyObject *Qd_SetOrigin(_self, _args)
580 PyObject *_self;
581 PyObject *_args;
582{
583 PyObject *_res = NULL;
584 short h;
585 short v;
586 if (!PyArg_ParseTuple(_args, "hh",
587 &h,
588 &v))
589 return NULL;
590 SetOrigin(h,
591 v);
592 Py_INCREF(Py_None);
593 _res = Py_None;
594 return _res;
595}
596
597static PyObject *Qd_SetClip(_self, _args)
598 PyObject *_self;
599 PyObject *_args;
600{
601 PyObject *_res = NULL;
602 RgnHandle rgn;
603 if (!PyArg_ParseTuple(_args, "O&",
604 ResObj_Convert, &rgn))
605 return NULL;
606 SetClip(rgn);
607 Py_INCREF(Py_None);
608 _res = Py_None;
609 return _res;
610}
611
612static PyObject *Qd_GetClip(_self, _args)
613 PyObject *_self;
614 PyObject *_args;
615{
616 PyObject *_res = NULL;
617 RgnHandle rgn;
618 if (!PyArg_ParseTuple(_args, "O&",
619 ResObj_Convert, &rgn))
620 return NULL;
621 GetClip(rgn);
Guido van Rossum17448e21995-01-30 11:53:55 +0000622 Py_INCREF(Py_None);
623 _res = Py_None;
624 return _res;
625}
626
627static PyObject *Qd_ClipRect(_self, _args)
628 PyObject *_self;
629 PyObject *_args;
630{
631 PyObject *_res = NULL;
632 Rect r;
633 if (!PyArg_ParseTuple(_args, "O&",
634 PyMac_GetRect, &r))
635 return NULL;
636 ClipRect(&r);
637 Py_INCREF(Py_None);
638 _res = Py_None;
639 return _res;
640}
641
Jack Jansen04a02e71996-01-06 17:12:58 +0000642static PyObject *Qd_BackPat(_self, _args)
643 PyObject *_self;
644 PyObject *_args;
645{
646 PyObject *_res = NULL;
647 Pattern *pat__in__;
648 int pat__in_len__;
649 if (!PyArg_ParseTuple(_args, "s#",
650 (char **)&pat__in__, &pat__in_len__))
651 return NULL;
652 if (pat__in_len__ != sizeof(Pattern))
653 {
654 PyErr_SetString(PyExc_TypeError, "buffer length should be sizeof(Pattern)");
655 goto pat__error__;
656 }
657 BackPat(pat__in__);
658 Py_INCREF(Py_None);
659 _res = Py_None;
660 pat__error__: ;
661 return _res;
662}
663
Guido van Rossume56db431995-03-19 22:49:50 +0000664static PyObject *Qd_InitCursor(_self, _args)
665 PyObject *_self;
666 PyObject *_args;
667{
668 PyObject *_res = NULL;
669 if (!PyArg_ParseTuple(_args, ""))
670 return NULL;
671 InitCursor();
672 Py_INCREF(Py_None);
673 _res = Py_None;
674 return _res;
675}
676
Jack Jansen1c4e6141998-04-21 15:23:55 +0000677static PyObject *Qd_MacSetCursor(_self, _args)
Jack Jansenb5394061996-01-05 18:06:41 +0000678 PyObject *_self;
679 PyObject *_args;
680{
681 PyObject *_res = NULL;
682 Cursor *crsr__in__;
683 int crsr__in_len__;
684 if (!PyArg_ParseTuple(_args, "s#",
685 (char **)&crsr__in__, &crsr__in_len__))
686 return NULL;
687 if (crsr__in_len__ != sizeof(Cursor))
688 {
689 PyErr_SetString(PyExc_TypeError, "buffer length should be sizeof(Cursor)");
690 goto crsr__error__;
691 }
Jack Jansen1c4e6141998-04-21 15:23:55 +0000692 MacSetCursor(crsr__in__);
Jack Jansenb5394061996-01-05 18:06:41 +0000693 Py_INCREF(Py_None);
694 _res = Py_None;
695 crsr__error__: ;
696 return _res;
697}
698
Guido van Rossume56db431995-03-19 22:49:50 +0000699static PyObject *Qd_HideCursor(_self, _args)
700 PyObject *_self;
701 PyObject *_args;
702{
703 PyObject *_res = NULL;
704 if (!PyArg_ParseTuple(_args, ""))
705 return NULL;
706 HideCursor();
707 Py_INCREF(Py_None);
708 _res = Py_None;
709 return _res;
710}
711
Jack Jansen1c4e6141998-04-21 15:23:55 +0000712static PyObject *Qd_MacShowCursor(_self, _args)
Guido van Rossume56db431995-03-19 22:49:50 +0000713 PyObject *_self;
714 PyObject *_args;
715{
716 PyObject *_res = NULL;
717 if (!PyArg_ParseTuple(_args, ""))
718 return NULL;
Jack Jansen1c4e6141998-04-21 15:23:55 +0000719 MacShowCursor();
Guido van Rossume56db431995-03-19 22:49:50 +0000720 Py_INCREF(Py_None);
721 _res = Py_None;
722 return _res;
723}
724
725static PyObject *Qd_ObscureCursor(_self, _args)
726 PyObject *_self;
727 PyObject *_args;
728{
729 PyObject *_res = NULL;
730 if (!PyArg_ParseTuple(_args, ""))
731 return NULL;
732 ObscureCursor();
733 Py_INCREF(Py_None);
734 _res = Py_None;
735 return _res;
736}
737
738static PyObject *Qd_HidePen(_self, _args)
739 PyObject *_self;
740 PyObject *_args;
741{
742 PyObject *_res = NULL;
743 if (!PyArg_ParseTuple(_args, ""))
744 return NULL;
745 HidePen();
746 Py_INCREF(Py_None);
747 _res = Py_None;
748 return _res;
749}
750
751static PyObject *Qd_ShowPen(_self, _args)
752 PyObject *_self;
753 PyObject *_args;
754{
755 PyObject *_res = NULL;
756 if (!PyArg_ParseTuple(_args, ""))
757 return NULL;
758 ShowPen();
759 Py_INCREF(Py_None);
760 _res = Py_None;
761 return _res;
762}
763
764static PyObject *Qd_GetPen(_self, _args)
765 PyObject *_self;
766 PyObject *_args;
767{
768 PyObject *_res = NULL;
769 Point pt;
Jack Jansen1d8ede71996-01-08 23:47:31 +0000770 if (!PyArg_ParseTuple(_args, ""))
Guido van Rossume56db431995-03-19 22:49:50 +0000771 return NULL;
772 GetPen(&pt);
773 _res = Py_BuildValue("O&",
774 PyMac_BuildPoint, pt);
775 return _res;
776}
777
Jack Jansen04a02e71996-01-06 17:12:58 +0000778static PyObject *Qd_GetPenState(_self, _args)
779 PyObject *_self;
780 PyObject *_args;
781{
782 PyObject *_res = NULL;
783 PenState pnState__out__;
784 if (!PyArg_ParseTuple(_args, ""))
785 return NULL;
786 GetPenState(&pnState__out__);
787 _res = Py_BuildValue("s#",
788 (char *)&pnState__out__, (int)sizeof(PenState));
789 pnState__error__: ;
790 return _res;
791}
792
793static PyObject *Qd_SetPenState(_self, _args)
794 PyObject *_self;
795 PyObject *_args;
796{
797 PyObject *_res = NULL;
798 PenState *pnState__in__;
799 int pnState__in_len__;
800 if (!PyArg_ParseTuple(_args, "s#",
801 (char **)&pnState__in__, &pnState__in_len__))
802 return NULL;
803 if (pnState__in_len__ != sizeof(PenState))
804 {
805 PyErr_SetString(PyExc_TypeError, "buffer length should be sizeof(PenState)");
806 goto pnState__error__;
807 }
808 SetPenState(pnState__in__);
809 Py_INCREF(Py_None);
810 _res = Py_None;
811 pnState__error__: ;
812 return _res;
813}
814
Guido van Rossume56db431995-03-19 22:49:50 +0000815static PyObject *Qd_PenSize(_self, _args)
816 PyObject *_self;
817 PyObject *_args;
818{
819 PyObject *_res = NULL;
820 short width;
821 short height;
822 if (!PyArg_ParseTuple(_args, "hh",
823 &width,
824 &height))
825 return NULL;
826 PenSize(width,
827 height);
828 Py_INCREF(Py_None);
829 _res = Py_None;
830 return _res;
831}
832
833static PyObject *Qd_PenMode(_self, _args)
834 PyObject *_self;
835 PyObject *_args;
836{
837 PyObject *_res = NULL;
838 short mode;
839 if (!PyArg_ParseTuple(_args, "h",
840 &mode))
841 return NULL;
842 PenMode(mode);
843 Py_INCREF(Py_None);
844 _res = Py_None;
845 return _res;
846}
847
Jack Jansen04a02e71996-01-06 17:12:58 +0000848static PyObject *Qd_PenPat(_self, _args)
849 PyObject *_self;
850 PyObject *_args;
851{
852 PyObject *_res = NULL;
853 Pattern *pat__in__;
854 int pat__in_len__;
855 if (!PyArg_ParseTuple(_args, "s#",
856 (char **)&pat__in__, &pat__in_len__))
857 return NULL;
858 if (pat__in_len__ != sizeof(Pattern))
859 {
860 PyErr_SetString(PyExc_TypeError, "buffer length should be sizeof(Pattern)");
861 goto pat__error__;
862 }
863 PenPat(pat__in__);
864 Py_INCREF(Py_None);
865 _res = Py_None;
866 pat__error__: ;
867 return _res;
868}
869
Guido van Rossume56db431995-03-19 22:49:50 +0000870static PyObject *Qd_PenNormal(_self, _args)
871 PyObject *_self;
872 PyObject *_args;
873{
874 PyObject *_res = NULL;
875 if (!PyArg_ParseTuple(_args, ""))
876 return NULL;
877 PenNormal();
878 Py_INCREF(Py_None);
879 _res = Py_None;
880 return _res;
881}
882
883static PyObject *Qd_MoveTo(_self, _args)
884 PyObject *_self;
885 PyObject *_args;
886{
887 PyObject *_res = NULL;
888 short h;
889 short v;
890 if (!PyArg_ParseTuple(_args, "hh",
891 &h,
892 &v))
893 return NULL;
894 MoveTo(h,
895 v);
896 Py_INCREF(Py_None);
897 _res = Py_None;
898 return _res;
899}
900
901static PyObject *Qd_Move(_self, _args)
902 PyObject *_self;
903 PyObject *_args;
904{
905 PyObject *_res = NULL;
906 short dh;
907 short dv;
908 if (!PyArg_ParseTuple(_args, "hh",
909 &dh,
910 &dv))
911 return NULL;
912 Move(dh,
913 dv);
914 Py_INCREF(Py_None);
915 _res = Py_None;
916 return _res;
917}
918
Jack Jansen1c4e6141998-04-21 15:23:55 +0000919static PyObject *Qd_MacLineTo(_self, _args)
Guido van Rossume56db431995-03-19 22:49:50 +0000920 PyObject *_self;
921 PyObject *_args;
922{
923 PyObject *_res = NULL;
924 short h;
925 short v;
926 if (!PyArg_ParseTuple(_args, "hh",
927 &h,
928 &v))
929 return NULL;
Jack Jansen1c4e6141998-04-21 15:23:55 +0000930 MacLineTo(h,
931 v);
Guido van Rossume56db431995-03-19 22:49:50 +0000932 Py_INCREF(Py_None);
933 _res = Py_None;
934 return _res;
935}
936
937static PyObject *Qd_Line(_self, _args)
938 PyObject *_self;
939 PyObject *_args;
940{
941 PyObject *_res = NULL;
942 short dh;
943 short dv;
944 if (!PyArg_ParseTuple(_args, "hh",
945 &dh,
946 &dv))
947 return NULL;
948 Line(dh,
949 dv);
950 Py_INCREF(Py_None);
951 _res = Py_None;
952 return _res;
953}
954
Guido van Rossume56db431995-03-19 22:49:50 +0000955static PyObject *Qd_ForeColor(_self, _args)
956 PyObject *_self;
957 PyObject *_args;
958{
959 PyObject *_res = NULL;
960 long color;
961 if (!PyArg_ParseTuple(_args, "l",
962 &color))
963 return NULL;
964 ForeColor(color);
965 Py_INCREF(Py_None);
966 _res = Py_None;
967 return _res;
968}
969
970static PyObject *Qd_BackColor(_self, _args)
971 PyObject *_self;
972 PyObject *_args;
973{
974 PyObject *_res = NULL;
975 long color;
976 if (!PyArg_ParseTuple(_args, "l",
977 &color))
978 return NULL;
979 BackColor(color);
980 Py_INCREF(Py_None);
981 _res = Py_None;
982 return _res;
983}
984
985static PyObject *Qd_ColorBit(_self, _args)
986 PyObject *_self;
987 PyObject *_args;
988{
989 PyObject *_res = NULL;
990 short whichBit;
991 if (!PyArg_ParseTuple(_args, "h",
992 &whichBit))
993 return NULL;
994 ColorBit(whichBit);
995 Py_INCREF(Py_None);
996 _res = Py_None;
997 return _res;
998}
999
Jack Jansen1c4e6141998-04-21 15:23:55 +00001000static PyObject *Qd_MacSetRect(_self, _args)
Guido van Rossume56db431995-03-19 22:49:50 +00001001 PyObject *_self;
1002 PyObject *_args;
1003{
1004 PyObject *_res = NULL;
1005 Rect r;
1006 short left;
1007 short top;
1008 short right;
1009 short bottom;
1010 if (!PyArg_ParseTuple(_args, "hhhh",
1011 &left,
1012 &top,
1013 &right,
1014 &bottom))
1015 return NULL;
Jack Jansen1c4e6141998-04-21 15:23:55 +00001016 MacSetRect(&r,
1017 left,
1018 top,
1019 right,
1020 bottom);
Guido van Rossume56db431995-03-19 22:49:50 +00001021 _res = Py_BuildValue("O&",
1022 PyMac_BuildRect, &r);
1023 return _res;
1024}
1025
Jack Jansen1c4e6141998-04-21 15:23:55 +00001026static PyObject *Qd_MacOffsetRect(_self, _args)
Guido van Rossume56db431995-03-19 22:49:50 +00001027 PyObject *_self;
1028 PyObject *_args;
1029{
1030 PyObject *_res = NULL;
1031 Rect r;
1032 short dh;
1033 short dv;
Jack Jansen54c8f7e1995-11-14 10:46:01 +00001034 if (!PyArg_ParseTuple(_args, "O&hh",
1035 PyMac_GetRect, &r,
Guido van Rossume56db431995-03-19 22:49:50 +00001036 &dh,
1037 &dv))
1038 return NULL;
Jack Jansen1c4e6141998-04-21 15:23:55 +00001039 MacOffsetRect(&r,
1040 dh,
1041 dv);
Guido van Rossume56db431995-03-19 22:49:50 +00001042 _res = Py_BuildValue("O&",
1043 PyMac_BuildRect, &r);
1044 return _res;
1045}
1046
Jack Jansen1c4e6141998-04-21 15:23:55 +00001047static PyObject *Qd_MacInsetRect(_self, _args)
Guido van Rossume56db431995-03-19 22:49:50 +00001048 PyObject *_self;
1049 PyObject *_args;
1050{
1051 PyObject *_res = NULL;
1052 Rect r;
1053 short dh;
1054 short dv;
Jack Jansen54c8f7e1995-11-14 10:46:01 +00001055 if (!PyArg_ParseTuple(_args, "O&hh",
1056 PyMac_GetRect, &r,
Guido van Rossume56db431995-03-19 22:49:50 +00001057 &dh,
1058 &dv))
1059 return NULL;
Jack Jansen1c4e6141998-04-21 15:23:55 +00001060 MacInsetRect(&r,
1061 dh,
1062 dv);
Guido van Rossume56db431995-03-19 22:49:50 +00001063 _res = Py_BuildValue("O&",
1064 PyMac_BuildRect, &r);
1065 return _res;
1066}
1067
1068static PyObject *Qd_SectRect(_self, _args)
1069 PyObject *_self;
1070 PyObject *_args;
1071{
1072 PyObject *_res = NULL;
1073 Boolean _rv;
1074 Rect src1;
1075 Rect src2;
1076 Rect dstRect;
1077 if (!PyArg_ParseTuple(_args, "O&O&",
1078 PyMac_GetRect, &src1,
1079 PyMac_GetRect, &src2))
1080 return NULL;
1081 _rv = SectRect(&src1,
1082 &src2,
1083 &dstRect);
1084 _res = Py_BuildValue("bO&",
1085 _rv,
1086 PyMac_BuildRect, &dstRect);
1087 return _res;
1088}
1089
Jack Jansen1c4e6141998-04-21 15:23:55 +00001090static PyObject *Qd_MacUnionRect(_self, _args)
Guido van Rossume56db431995-03-19 22:49:50 +00001091 PyObject *_self;
1092 PyObject *_args;
1093{
1094 PyObject *_res = NULL;
1095 Rect src1;
1096 Rect src2;
1097 Rect dstRect;
1098 if (!PyArg_ParseTuple(_args, "O&O&",
1099 PyMac_GetRect, &src1,
1100 PyMac_GetRect, &src2))
1101 return NULL;
Jack Jansen1c4e6141998-04-21 15:23:55 +00001102 MacUnionRect(&src1,
1103 &src2,
1104 &dstRect);
Guido van Rossume56db431995-03-19 22:49:50 +00001105 _res = Py_BuildValue("O&",
1106 PyMac_BuildRect, &dstRect);
1107 return _res;
1108}
1109
Jack Jansen1c4e6141998-04-21 15:23:55 +00001110static PyObject *Qd_MacEqualRect(_self, _args)
Guido van Rossume56db431995-03-19 22:49:50 +00001111 PyObject *_self;
1112 PyObject *_args;
1113{
1114 PyObject *_res = NULL;
1115 Boolean _rv;
1116 Rect rect1;
1117 Rect rect2;
1118 if (!PyArg_ParseTuple(_args, "O&O&",
1119 PyMac_GetRect, &rect1,
1120 PyMac_GetRect, &rect2))
1121 return NULL;
Jack Jansen1c4e6141998-04-21 15:23:55 +00001122 _rv = MacEqualRect(&rect1,
1123 &rect2);
Guido van Rossume56db431995-03-19 22:49:50 +00001124 _res = Py_BuildValue("b",
1125 _rv);
1126 return _res;
1127}
1128
1129static PyObject *Qd_EmptyRect(_self, _args)
1130 PyObject *_self;
1131 PyObject *_args;
1132{
1133 PyObject *_res = NULL;
1134 Boolean _rv;
1135 Rect r;
1136 if (!PyArg_ParseTuple(_args, "O&",
1137 PyMac_GetRect, &r))
1138 return NULL;
1139 _rv = EmptyRect(&r);
1140 _res = Py_BuildValue("b",
1141 _rv);
1142 return _res;
1143}
1144
Jack Jansen1c4e6141998-04-21 15:23:55 +00001145static PyObject *Qd_MacFrameRect(_self, _args)
Guido van Rossume56db431995-03-19 22:49:50 +00001146 PyObject *_self;
1147 PyObject *_args;
1148{
1149 PyObject *_res = NULL;
1150 Rect r;
1151 if (!PyArg_ParseTuple(_args, "O&",
1152 PyMac_GetRect, &r))
1153 return NULL;
Jack Jansen1c4e6141998-04-21 15:23:55 +00001154 MacFrameRect(&r);
Guido van Rossume56db431995-03-19 22:49:50 +00001155 Py_INCREF(Py_None);
1156 _res = Py_None;
1157 return _res;
1158}
1159
1160static PyObject *Qd_PaintRect(_self, _args)
1161 PyObject *_self;
1162 PyObject *_args;
1163{
1164 PyObject *_res = NULL;
1165 Rect r;
1166 if (!PyArg_ParseTuple(_args, "O&",
1167 PyMac_GetRect, &r))
1168 return NULL;
1169 PaintRect(&r);
1170 Py_INCREF(Py_None);
1171 _res = Py_None;
1172 return _res;
1173}
1174
Guido van Rossum17448e21995-01-30 11:53:55 +00001175static PyObject *Qd_EraseRect(_self, _args)
1176 PyObject *_self;
1177 PyObject *_args;
1178{
1179 PyObject *_res = NULL;
1180 Rect r;
1181 if (!PyArg_ParseTuple(_args, "O&",
1182 PyMac_GetRect, &r))
1183 return NULL;
1184 EraseRect(&r);
1185 Py_INCREF(Py_None);
1186 _res = Py_None;
1187 return _res;
1188}
1189
Jack Jansen1c4e6141998-04-21 15:23:55 +00001190static PyObject *Qd_MacInvertRect(_self, _args)
Guido van Rossum17448e21995-01-30 11:53:55 +00001191 PyObject *_self;
1192 PyObject *_args;
1193{
1194 PyObject *_res = NULL;
Guido van Rossume56db431995-03-19 22:49:50 +00001195 Rect r;
Guido van Rossum17448e21995-01-30 11:53:55 +00001196 if (!PyArg_ParseTuple(_args, "O&",
Guido van Rossume56db431995-03-19 22:49:50 +00001197 PyMac_GetRect, &r))
Guido van Rossum17448e21995-01-30 11:53:55 +00001198 return NULL;
Jack Jansen1c4e6141998-04-21 15:23:55 +00001199 MacInvertRect(&r);
Guido van Rossum17448e21995-01-30 11:53:55 +00001200 Py_INCREF(Py_None);
1201 _res = Py_None;
1202 return _res;
1203}
1204
Jack Jansen1c4e6141998-04-21 15:23:55 +00001205static PyObject *Qd_MacFillRect(_self, _args)
Jack Jansen04a02e71996-01-06 17:12:58 +00001206 PyObject *_self;
1207 PyObject *_args;
1208{
1209 PyObject *_res = NULL;
1210 Rect r;
1211 Pattern *pat__in__;
1212 int pat__in_len__;
1213 if (!PyArg_ParseTuple(_args, "O&s#",
1214 PyMac_GetRect, &r,
1215 (char **)&pat__in__, &pat__in_len__))
1216 return NULL;
1217 if (pat__in_len__ != sizeof(Pattern))
1218 {
1219 PyErr_SetString(PyExc_TypeError, "buffer length should be sizeof(Pattern)");
1220 goto pat__error__;
1221 }
Jack Jansen1c4e6141998-04-21 15:23:55 +00001222 MacFillRect(&r,
1223 pat__in__);
Jack Jansen04a02e71996-01-06 17:12:58 +00001224 Py_INCREF(Py_None);
1225 _res = Py_None;
1226 pat__error__: ;
1227 return _res;
1228}
1229
Guido van Rossume56db431995-03-19 22:49:50 +00001230static PyObject *Qd_FrameOval(_self, _args)
1231 PyObject *_self;
1232 PyObject *_args;
1233{
1234 PyObject *_res = NULL;
1235 Rect r;
1236 if (!PyArg_ParseTuple(_args, "O&",
1237 PyMac_GetRect, &r))
1238 return NULL;
1239 FrameOval(&r);
1240 Py_INCREF(Py_None);
1241 _res = Py_None;
1242 return _res;
1243}
1244
1245static PyObject *Qd_PaintOval(_self, _args)
1246 PyObject *_self;
1247 PyObject *_args;
1248{
1249 PyObject *_res = NULL;
1250 Rect r;
1251 if (!PyArg_ParseTuple(_args, "O&",
1252 PyMac_GetRect, &r))
1253 return NULL;
1254 PaintOval(&r);
1255 Py_INCREF(Py_None);
1256 _res = Py_None;
1257 return _res;
1258}
1259
1260static PyObject *Qd_EraseOval(_self, _args)
1261 PyObject *_self;
1262 PyObject *_args;
1263{
1264 PyObject *_res = NULL;
1265 Rect r;
1266 if (!PyArg_ParseTuple(_args, "O&",
1267 PyMac_GetRect, &r))
1268 return NULL;
1269 EraseOval(&r);
1270 Py_INCREF(Py_None);
1271 _res = Py_None;
1272 return _res;
1273}
1274
1275static PyObject *Qd_InvertOval(_self, _args)
1276 PyObject *_self;
1277 PyObject *_args;
1278{
1279 PyObject *_res = NULL;
1280 Rect r;
1281 if (!PyArg_ParseTuple(_args, "O&",
1282 PyMac_GetRect, &r))
1283 return NULL;
1284 InvertOval(&r);
1285 Py_INCREF(Py_None);
1286 _res = Py_None;
1287 return _res;
1288}
1289
Jack Jansen04a02e71996-01-06 17:12:58 +00001290static PyObject *Qd_FillOval(_self, _args)
1291 PyObject *_self;
1292 PyObject *_args;
1293{
1294 PyObject *_res = NULL;
1295 Rect r;
1296 Pattern *pat__in__;
1297 int pat__in_len__;
1298 if (!PyArg_ParseTuple(_args, "O&s#",
1299 PyMac_GetRect, &r,
1300 (char **)&pat__in__, &pat__in_len__))
1301 return NULL;
1302 if (pat__in_len__ != sizeof(Pattern))
1303 {
1304 PyErr_SetString(PyExc_TypeError, "buffer length should be sizeof(Pattern)");
1305 goto pat__error__;
1306 }
1307 FillOval(&r,
1308 pat__in__);
1309 Py_INCREF(Py_None);
1310 _res = Py_None;
1311 pat__error__: ;
1312 return _res;
1313}
1314
Guido van Rossume56db431995-03-19 22:49:50 +00001315static PyObject *Qd_FrameRoundRect(_self, _args)
1316 PyObject *_self;
1317 PyObject *_args;
1318{
1319 PyObject *_res = NULL;
1320 Rect r;
1321 short ovalWidth;
1322 short ovalHeight;
1323 if (!PyArg_ParseTuple(_args, "O&hh",
1324 PyMac_GetRect, &r,
1325 &ovalWidth,
1326 &ovalHeight))
1327 return NULL;
1328 FrameRoundRect(&r,
1329 ovalWidth,
1330 ovalHeight);
1331 Py_INCREF(Py_None);
1332 _res = Py_None;
1333 return _res;
1334}
1335
1336static PyObject *Qd_PaintRoundRect(_self, _args)
1337 PyObject *_self;
1338 PyObject *_args;
1339{
1340 PyObject *_res = NULL;
1341 Rect r;
1342 short ovalWidth;
1343 short ovalHeight;
1344 if (!PyArg_ParseTuple(_args, "O&hh",
1345 PyMac_GetRect, &r,
1346 &ovalWidth,
1347 &ovalHeight))
1348 return NULL;
1349 PaintRoundRect(&r,
1350 ovalWidth,
1351 ovalHeight);
1352 Py_INCREF(Py_None);
1353 _res = Py_None;
1354 return _res;
1355}
1356
1357static PyObject *Qd_EraseRoundRect(_self, _args)
1358 PyObject *_self;
1359 PyObject *_args;
1360{
1361 PyObject *_res = NULL;
1362 Rect r;
1363 short ovalWidth;
1364 short ovalHeight;
1365 if (!PyArg_ParseTuple(_args, "O&hh",
1366 PyMac_GetRect, &r,
1367 &ovalWidth,
1368 &ovalHeight))
1369 return NULL;
1370 EraseRoundRect(&r,
1371 ovalWidth,
1372 ovalHeight);
1373 Py_INCREF(Py_None);
1374 _res = Py_None;
1375 return _res;
1376}
1377
1378static PyObject *Qd_InvertRoundRect(_self, _args)
1379 PyObject *_self;
1380 PyObject *_args;
1381{
1382 PyObject *_res = NULL;
1383 Rect r;
1384 short ovalWidth;
1385 short ovalHeight;
1386 if (!PyArg_ParseTuple(_args, "O&hh",
1387 PyMac_GetRect, &r,
1388 &ovalWidth,
1389 &ovalHeight))
1390 return NULL;
1391 InvertRoundRect(&r,
1392 ovalWidth,
1393 ovalHeight);
1394 Py_INCREF(Py_None);
1395 _res = Py_None;
1396 return _res;
1397}
1398
Jack Jansen04a02e71996-01-06 17:12:58 +00001399static PyObject *Qd_FillRoundRect(_self, _args)
1400 PyObject *_self;
1401 PyObject *_args;
1402{
1403 PyObject *_res = NULL;
1404 Rect r;
1405 short ovalWidth;
1406 short ovalHeight;
1407 Pattern *pat__in__;
1408 int pat__in_len__;
1409 if (!PyArg_ParseTuple(_args, "O&hhs#",
1410 PyMac_GetRect, &r,
1411 &ovalWidth,
1412 &ovalHeight,
1413 (char **)&pat__in__, &pat__in_len__))
1414 return NULL;
1415 if (pat__in_len__ != sizeof(Pattern))
1416 {
1417 PyErr_SetString(PyExc_TypeError, "buffer length should be sizeof(Pattern)");
1418 goto pat__error__;
1419 }
1420 FillRoundRect(&r,
1421 ovalWidth,
1422 ovalHeight,
1423 pat__in__);
1424 Py_INCREF(Py_None);
1425 _res = Py_None;
1426 pat__error__: ;
1427 return _res;
1428}
1429
Guido van Rossume56db431995-03-19 22:49:50 +00001430static PyObject *Qd_FrameArc(_self, _args)
1431 PyObject *_self;
1432 PyObject *_args;
1433{
1434 PyObject *_res = NULL;
1435 Rect r;
1436 short startAngle;
1437 short arcAngle;
1438 if (!PyArg_ParseTuple(_args, "O&hh",
1439 PyMac_GetRect, &r,
1440 &startAngle,
1441 &arcAngle))
1442 return NULL;
1443 FrameArc(&r,
1444 startAngle,
1445 arcAngle);
1446 Py_INCREF(Py_None);
1447 _res = Py_None;
1448 return _res;
1449}
1450
1451static PyObject *Qd_PaintArc(_self, _args)
1452 PyObject *_self;
1453 PyObject *_args;
1454{
1455 PyObject *_res = NULL;
1456 Rect r;
1457 short startAngle;
1458 short arcAngle;
1459 if (!PyArg_ParseTuple(_args, "O&hh",
1460 PyMac_GetRect, &r,
1461 &startAngle,
1462 &arcAngle))
1463 return NULL;
1464 PaintArc(&r,
1465 startAngle,
1466 arcAngle);
1467 Py_INCREF(Py_None);
1468 _res = Py_None;
1469 return _res;
1470}
1471
1472static PyObject *Qd_EraseArc(_self, _args)
1473 PyObject *_self;
1474 PyObject *_args;
1475{
1476 PyObject *_res = NULL;
1477 Rect r;
1478 short startAngle;
1479 short arcAngle;
1480 if (!PyArg_ParseTuple(_args, "O&hh",
1481 PyMac_GetRect, &r,
1482 &startAngle,
1483 &arcAngle))
1484 return NULL;
1485 EraseArc(&r,
1486 startAngle,
1487 arcAngle);
1488 Py_INCREF(Py_None);
1489 _res = Py_None;
1490 return _res;
1491}
1492
1493static PyObject *Qd_InvertArc(_self, _args)
1494 PyObject *_self;
1495 PyObject *_args;
1496{
1497 PyObject *_res = NULL;
1498 Rect r;
1499 short startAngle;
1500 short arcAngle;
1501 if (!PyArg_ParseTuple(_args, "O&hh",
1502 PyMac_GetRect, &r,
1503 &startAngle,
1504 &arcAngle))
1505 return NULL;
1506 InvertArc(&r,
1507 startAngle,
1508 arcAngle);
1509 Py_INCREF(Py_None);
1510 _res = Py_None;
1511 return _res;
1512}
1513
Jack Jansen04a02e71996-01-06 17:12:58 +00001514static PyObject *Qd_FillArc(_self, _args)
1515 PyObject *_self;
1516 PyObject *_args;
1517{
1518 PyObject *_res = NULL;
1519 Rect r;
1520 short startAngle;
1521 short arcAngle;
1522 Pattern *pat__in__;
1523 int pat__in_len__;
1524 if (!PyArg_ParseTuple(_args, "O&hhs#",
1525 PyMac_GetRect, &r,
1526 &startAngle,
1527 &arcAngle,
1528 (char **)&pat__in__, &pat__in_len__))
1529 return NULL;
1530 if (pat__in_len__ != sizeof(Pattern))
1531 {
1532 PyErr_SetString(PyExc_TypeError, "buffer length should be sizeof(Pattern)");
1533 goto pat__error__;
1534 }
1535 FillArc(&r,
1536 startAngle,
1537 arcAngle,
1538 pat__in__);
1539 Py_INCREF(Py_None);
1540 _res = Py_None;
1541 pat__error__: ;
1542 return _res;
1543}
1544
Guido van Rossume56db431995-03-19 22:49:50 +00001545static PyObject *Qd_NewRgn(_self, _args)
1546 PyObject *_self;
1547 PyObject *_args;
1548{
1549 PyObject *_res = NULL;
1550 RgnHandle _rv;
1551 if (!PyArg_ParseTuple(_args, ""))
1552 return NULL;
1553 _rv = NewRgn();
1554 _res = Py_BuildValue("O&",
1555 ResObj_New, _rv);
1556 return _res;
1557}
1558
1559static PyObject *Qd_OpenRgn(_self, _args)
1560 PyObject *_self;
1561 PyObject *_args;
1562{
1563 PyObject *_res = NULL;
1564 if (!PyArg_ParseTuple(_args, ""))
1565 return NULL;
1566 OpenRgn();
1567 Py_INCREF(Py_None);
1568 _res = Py_None;
1569 return _res;
1570}
1571
1572static PyObject *Qd_CloseRgn(_self, _args)
1573 PyObject *_self;
1574 PyObject *_args;
1575{
1576 PyObject *_res = NULL;
1577 RgnHandle dstRgn;
1578 if (!PyArg_ParseTuple(_args, "O&",
1579 ResObj_Convert, &dstRgn))
1580 return NULL;
1581 CloseRgn(dstRgn);
1582 Py_INCREF(Py_None);
1583 _res = Py_None;
1584 return _res;
1585}
1586
Jack Jansen41058c01995-11-16 22:48:29 +00001587static PyObject *Qd_BitMapToRegion(_self, _args)
1588 PyObject *_self;
1589 PyObject *_args;
1590{
1591 PyObject *_res = NULL;
1592 OSErr _err;
1593 RgnHandle region;
1594 BitMapPtr bMap;
1595 if (!PyArg_ParseTuple(_args, "O&O&",
1596 ResObj_Convert, &region,
1597 BMObj_Convert, &bMap))
1598 return NULL;
1599 _err = BitMapToRegion(region,
1600 bMap);
1601 if (_err != noErr) return PyMac_Error(_err);
1602 Py_INCREF(Py_None);
1603 _res = Py_None;
1604 return _res;
1605}
1606
Guido van Rossume56db431995-03-19 22:49:50 +00001607static PyObject *Qd_DisposeRgn(_self, _args)
1608 PyObject *_self;
1609 PyObject *_args;
1610{
1611 PyObject *_res = NULL;
1612 RgnHandle rgn;
1613 if (!PyArg_ParseTuple(_args, "O&",
1614 ResObj_Convert, &rgn))
1615 return NULL;
1616 DisposeRgn(rgn);
1617 Py_INCREF(Py_None);
1618 _res = Py_None;
1619 return _res;
1620}
1621
Jack Jansen1c4e6141998-04-21 15:23:55 +00001622static PyObject *Qd_MacCopyRgn(_self, _args)
Guido van Rossume56db431995-03-19 22:49:50 +00001623 PyObject *_self;
1624 PyObject *_args;
1625{
1626 PyObject *_res = NULL;
1627 RgnHandle srcRgn;
1628 RgnHandle dstRgn;
1629 if (!PyArg_ParseTuple(_args, "O&O&",
1630 ResObj_Convert, &srcRgn,
1631 ResObj_Convert, &dstRgn))
1632 return NULL;
Jack Jansen1c4e6141998-04-21 15:23:55 +00001633 MacCopyRgn(srcRgn,
1634 dstRgn);
Guido van Rossume56db431995-03-19 22:49:50 +00001635 Py_INCREF(Py_None);
1636 _res = Py_None;
1637 return _res;
1638}
1639
1640static PyObject *Qd_SetEmptyRgn(_self, _args)
1641 PyObject *_self;
1642 PyObject *_args;
1643{
1644 PyObject *_res = NULL;
1645 RgnHandle rgn;
1646 if (!PyArg_ParseTuple(_args, "O&",
1647 ResObj_Convert, &rgn))
1648 return NULL;
1649 SetEmptyRgn(rgn);
1650 Py_INCREF(Py_None);
1651 _res = Py_None;
1652 return _res;
1653}
1654
Jack Jansen1c4e6141998-04-21 15:23:55 +00001655static PyObject *Qd_MacSetRectRgn(_self, _args)
Guido van Rossume56db431995-03-19 22:49:50 +00001656 PyObject *_self;
1657 PyObject *_args;
1658{
1659 PyObject *_res = NULL;
1660 RgnHandle rgn;
1661 short left;
1662 short top;
1663 short right;
1664 short bottom;
1665 if (!PyArg_ParseTuple(_args, "O&hhhh",
1666 ResObj_Convert, &rgn,
1667 &left,
1668 &top,
1669 &right,
1670 &bottom))
1671 return NULL;
Jack Jansen1c4e6141998-04-21 15:23:55 +00001672 MacSetRectRgn(rgn,
1673 left,
1674 top,
1675 right,
1676 bottom);
Guido van Rossume56db431995-03-19 22:49:50 +00001677 Py_INCREF(Py_None);
1678 _res = Py_None;
1679 return _res;
1680}
1681
1682static PyObject *Qd_RectRgn(_self, _args)
1683 PyObject *_self;
1684 PyObject *_args;
1685{
1686 PyObject *_res = NULL;
1687 RgnHandle rgn;
1688 Rect r;
1689 if (!PyArg_ParseTuple(_args, "O&O&",
1690 ResObj_Convert, &rgn,
1691 PyMac_GetRect, &r))
1692 return NULL;
1693 RectRgn(rgn,
1694 &r);
1695 Py_INCREF(Py_None);
1696 _res = Py_None;
1697 return _res;
1698}
1699
Jack Jansen1c4e6141998-04-21 15:23:55 +00001700static PyObject *Qd_MacOffsetRgn(_self, _args)
Guido van Rossume56db431995-03-19 22:49:50 +00001701 PyObject *_self;
1702 PyObject *_args;
1703{
1704 PyObject *_res = NULL;
1705 RgnHandle rgn;
1706 short dh;
1707 short dv;
1708 if (!PyArg_ParseTuple(_args, "O&hh",
1709 ResObj_Convert, &rgn,
1710 &dh,
1711 &dv))
1712 return NULL;
Jack Jansen1c4e6141998-04-21 15:23:55 +00001713 MacOffsetRgn(rgn,
1714 dh,
1715 dv);
Guido van Rossume56db431995-03-19 22:49:50 +00001716 Py_INCREF(Py_None);
1717 _res = Py_None;
1718 return _res;
1719}
1720
1721static PyObject *Qd_InsetRgn(_self, _args)
1722 PyObject *_self;
1723 PyObject *_args;
1724{
1725 PyObject *_res = NULL;
1726 RgnHandle rgn;
1727 short dh;
1728 short dv;
1729 if (!PyArg_ParseTuple(_args, "O&hh",
1730 ResObj_Convert, &rgn,
1731 &dh,
1732 &dv))
1733 return NULL;
1734 InsetRgn(rgn,
1735 dh,
1736 dv);
1737 Py_INCREF(Py_None);
1738 _res = Py_None;
1739 return _res;
1740}
1741
1742static PyObject *Qd_SectRgn(_self, _args)
1743 PyObject *_self;
1744 PyObject *_args;
1745{
1746 PyObject *_res = NULL;
1747 RgnHandle srcRgnA;
1748 RgnHandle srcRgnB;
1749 RgnHandle dstRgn;
1750 if (!PyArg_ParseTuple(_args, "O&O&O&",
1751 ResObj_Convert, &srcRgnA,
1752 ResObj_Convert, &srcRgnB,
1753 ResObj_Convert, &dstRgn))
1754 return NULL;
1755 SectRgn(srcRgnA,
1756 srcRgnB,
1757 dstRgn);
1758 Py_INCREF(Py_None);
1759 _res = Py_None;
1760 return _res;
1761}
1762
Jack Jansen1c4e6141998-04-21 15:23:55 +00001763static PyObject *Qd_MacUnionRgn(_self, _args)
Guido van Rossume56db431995-03-19 22:49:50 +00001764 PyObject *_self;
1765 PyObject *_args;
1766{
1767 PyObject *_res = NULL;
1768 RgnHandle srcRgnA;
1769 RgnHandle srcRgnB;
1770 RgnHandle dstRgn;
1771 if (!PyArg_ParseTuple(_args, "O&O&O&",
1772 ResObj_Convert, &srcRgnA,
1773 ResObj_Convert, &srcRgnB,
1774 ResObj_Convert, &dstRgn))
1775 return NULL;
Jack Jansen1c4e6141998-04-21 15:23:55 +00001776 MacUnionRgn(srcRgnA,
1777 srcRgnB,
1778 dstRgn);
Guido van Rossume56db431995-03-19 22:49:50 +00001779 Py_INCREF(Py_None);
1780 _res = Py_None;
1781 return _res;
1782}
1783
1784static PyObject *Qd_DiffRgn(_self, _args)
1785 PyObject *_self;
1786 PyObject *_args;
1787{
1788 PyObject *_res = NULL;
1789 RgnHandle srcRgnA;
1790 RgnHandle srcRgnB;
1791 RgnHandle dstRgn;
1792 if (!PyArg_ParseTuple(_args, "O&O&O&",
1793 ResObj_Convert, &srcRgnA,
1794 ResObj_Convert, &srcRgnB,
1795 ResObj_Convert, &dstRgn))
1796 return NULL;
1797 DiffRgn(srcRgnA,
1798 srcRgnB,
1799 dstRgn);
1800 Py_INCREF(Py_None);
1801 _res = Py_None;
1802 return _res;
1803}
1804
Jack Jansen1c4e6141998-04-21 15:23:55 +00001805static PyObject *Qd_MacXorRgn(_self, _args)
Guido van Rossume56db431995-03-19 22:49:50 +00001806 PyObject *_self;
1807 PyObject *_args;
1808{
1809 PyObject *_res = NULL;
1810 RgnHandle srcRgnA;
1811 RgnHandle srcRgnB;
1812 RgnHandle dstRgn;
1813 if (!PyArg_ParseTuple(_args, "O&O&O&",
1814 ResObj_Convert, &srcRgnA,
1815 ResObj_Convert, &srcRgnB,
1816 ResObj_Convert, &dstRgn))
1817 return NULL;
Jack Jansen1c4e6141998-04-21 15:23:55 +00001818 MacXorRgn(srcRgnA,
1819 srcRgnB,
1820 dstRgn);
Guido van Rossume56db431995-03-19 22:49:50 +00001821 Py_INCREF(Py_None);
1822 _res = Py_None;
1823 return _res;
1824}
1825
1826static PyObject *Qd_RectInRgn(_self, _args)
1827 PyObject *_self;
1828 PyObject *_args;
1829{
1830 PyObject *_res = NULL;
1831 Boolean _rv;
1832 Rect r;
1833 RgnHandle rgn;
1834 if (!PyArg_ParseTuple(_args, "O&O&",
1835 PyMac_GetRect, &r,
1836 ResObj_Convert, &rgn))
1837 return NULL;
1838 _rv = RectInRgn(&r,
1839 rgn);
1840 _res = Py_BuildValue("b",
1841 _rv);
1842 return _res;
1843}
1844
Jack Jansen1c4e6141998-04-21 15:23:55 +00001845static PyObject *Qd_MacEqualRgn(_self, _args)
Guido van Rossume56db431995-03-19 22:49:50 +00001846 PyObject *_self;
1847 PyObject *_args;
1848{
1849 PyObject *_res = NULL;
1850 Boolean _rv;
1851 RgnHandle rgnA;
1852 RgnHandle rgnB;
1853 if (!PyArg_ParseTuple(_args, "O&O&",
1854 ResObj_Convert, &rgnA,
1855 ResObj_Convert, &rgnB))
1856 return NULL;
Jack Jansen1c4e6141998-04-21 15:23:55 +00001857 _rv = MacEqualRgn(rgnA,
1858 rgnB);
Guido van Rossume56db431995-03-19 22:49:50 +00001859 _res = Py_BuildValue("b",
1860 _rv);
1861 return _res;
1862}
1863
1864static PyObject *Qd_EmptyRgn(_self, _args)
1865 PyObject *_self;
1866 PyObject *_args;
1867{
1868 PyObject *_res = NULL;
1869 Boolean _rv;
1870 RgnHandle rgn;
1871 if (!PyArg_ParseTuple(_args, "O&",
1872 ResObj_Convert, &rgn))
1873 return NULL;
1874 _rv = EmptyRgn(rgn);
1875 _res = Py_BuildValue("b",
1876 _rv);
1877 return _res;
1878}
1879
Jack Jansen1c4e6141998-04-21 15:23:55 +00001880static PyObject *Qd_MacFrameRgn(_self, _args)
Guido van Rossume56db431995-03-19 22:49:50 +00001881 PyObject *_self;
1882 PyObject *_args;
1883{
1884 PyObject *_res = NULL;
1885 RgnHandle rgn;
1886 if (!PyArg_ParseTuple(_args, "O&",
1887 ResObj_Convert, &rgn))
1888 return NULL;
Jack Jansen1c4e6141998-04-21 15:23:55 +00001889 MacFrameRgn(rgn);
Guido van Rossume56db431995-03-19 22:49:50 +00001890 Py_INCREF(Py_None);
1891 _res = Py_None;
1892 return _res;
1893}
1894
Jack Jansen1c4e6141998-04-21 15:23:55 +00001895static PyObject *Qd_MacPaintRgn(_self, _args)
Guido van Rossume56db431995-03-19 22:49:50 +00001896 PyObject *_self;
1897 PyObject *_args;
1898{
1899 PyObject *_res = NULL;
1900 RgnHandle rgn;
1901 if (!PyArg_ParseTuple(_args, "O&",
1902 ResObj_Convert, &rgn))
1903 return NULL;
Jack Jansen1c4e6141998-04-21 15:23:55 +00001904 MacPaintRgn(rgn);
Guido van Rossume56db431995-03-19 22:49:50 +00001905 Py_INCREF(Py_None);
1906 _res = Py_None;
1907 return _res;
1908}
1909
1910static PyObject *Qd_EraseRgn(_self, _args)
1911 PyObject *_self;
1912 PyObject *_args;
1913{
1914 PyObject *_res = NULL;
1915 RgnHandle rgn;
1916 if (!PyArg_ParseTuple(_args, "O&",
1917 ResObj_Convert, &rgn))
1918 return NULL;
1919 EraseRgn(rgn);
1920 Py_INCREF(Py_None);
1921 _res = Py_None;
1922 return _res;
1923}
1924
Jack Jansen1c4e6141998-04-21 15:23:55 +00001925static PyObject *Qd_MacInvertRgn(_self, _args)
Guido van Rossume56db431995-03-19 22:49:50 +00001926 PyObject *_self;
1927 PyObject *_args;
1928{
1929 PyObject *_res = NULL;
1930 RgnHandle rgn;
1931 if (!PyArg_ParseTuple(_args, "O&",
1932 ResObj_Convert, &rgn))
1933 return NULL;
Jack Jansen1c4e6141998-04-21 15:23:55 +00001934 MacInvertRgn(rgn);
Guido van Rossume56db431995-03-19 22:49:50 +00001935 Py_INCREF(Py_None);
1936 _res = Py_None;
1937 return _res;
1938}
1939
Jack Jansen1c4e6141998-04-21 15:23:55 +00001940static PyObject *Qd_MacFillRgn(_self, _args)
Jack Jansen04a02e71996-01-06 17:12:58 +00001941 PyObject *_self;
1942 PyObject *_args;
1943{
1944 PyObject *_res = NULL;
1945 RgnHandle rgn;
1946 Pattern *pat__in__;
1947 int pat__in_len__;
1948 if (!PyArg_ParseTuple(_args, "O&s#",
1949 ResObj_Convert, &rgn,
1950 (char **)&pat__in__, &pat__in_len__))
1951 return NULL;
1952 if (pat__in_len__ != sizeof(Pattern))
1953 {
1954 PyErr_SetString(PyExc_TypeError, "buffer length should be sizeof(Pattern)");
1955 goto pat__error__;
1956 }
Jack Jansen1c4e6141998-04-21 15:23:55 +00001957 MacFillRgn(rgn,
1958 pat__in__);
Jack Jansen04a02e71996-01-06 17:12:58 +00001959 Py_INCREF(Py_None);
1960 _res = Py_None;
1961 pat__error__: ;
1962 return _res;
1963}
1964
Guido van Rossume56db431995-03-19 22:49:50 +00001965static PyObject *Qd_ScrollRect(_self, _args)
1966 PyObject *_self;
1967 PyObject *_args;
1968{
1969 PyObject *_res = NULL;
1970 Rect r;
1971 short dh;
1972 short dv;
1973 RgnHandle updateRgn;
1974 if (!PyArg_ParseTuple(_args, "O&hhO&",
1975 PyMac_GetRect, &r,
1976 &dh,
1977 &dv,
1978 ResObj_Convert, &updateRgn))
1979 return NULL;
1980 ScrollRect(&r,
1981 dh,
1982 dv,
1983 updateRgn);
1984 Py_INCREF(Py_None);
1985 _res = Py_None;
1986 return _res;
1987}
1988
Jack Jansen41058c01995-11-16 22:48:29 +00001989static PyObject *Qd_CopyBits(_self, _args)
1990 PyObject *_self;
1991 PyObject *_args;
1992{
1993 PyObject *_res = NULL;
1994 BitMapPtr srcBits;
1995 BitMapPtr dstBits;
1996 Rect srcRect;
1997 Rect dstRect;
1998 short mode;
1999 RgnHandle maskRgn;
2000 if (!PyArg_ParseTuple(_args, "O&O&O&O&hO&",
2001 BMObj_Convert, &srcBits,
2002 BMObj_Convert, &dstBits,
2003 PyMac_GetRect, &srcRect,
2004 PyMac_GetRect, &dstRect,
2005 &mode,
Jack Jansen425e9eb1995-12-12 15:02:03 +00002006 OptResObj_Convert, &maskRgn))
Jack Jansen41058c01995-11-16 22:48:29 +00002007 return NULL;
2008 CopyBits(srcBits,
2009 dstBits,
2010 &srcRect,
2011 &dstRect,
2012 mode,
2013 maskRgn);
2014 Py_INCREF(Py_None);
2015 _res = Py_None;
2016 return _res;
2017}
2018
2019static PyObject *Qd_CopyMask(_self, _args)
2020 PyObject *_self;
2021 PyObject *_args;
2022{
2023 PyObject *_res = NULL;
2024 BitMapPtr srcBits;
2025 BitMapPtr maskBits;
2026 BitMapPtr dstBits;
2027 Rect srcRect;
2028 Rect maskRect;
2029 Rect dstRect;
2030 if (!PyArg_ParseTuple(_args, "O&O&O&O&O&O&",
2031 BMObj_Convert, &srcBits,
2032 BMObj_Convert, &maskBits,
2033 BMObj_Convert, &dstBits,
2034 PyMac_GetRect, &srcRect,
2035 PyMac_GetRect, &maskRect,
2036 PyMac_GetRect, &dstRect))
2037 return NULL;
2038 CopyMask(srcBits,
2039 maskBits,
2040 dstBits,
2041 &srcRect,
2042 &maskRect,
2043 &dstRect);
2044 Py_INCREF(Py_None);
2045 _res = Py_None;
2046 return _res;
2047}
2048
Guido van Rossume56db431995-03-19 22:49:50 +00002049static PyObject *Qd_OpenPicture(_self, _args)
2050 PyObject *_self;
2051 PyObject *_args;
2052{
2053 PyObject *_res = NULL;
2054 PicHandle _rv;
2055 Rect picFrame;
2056 if (!PyArg_ParseTuple(_args, "O&",
2057 PyMac_GetRect, &picFrame))
2058 return NULL;
2059 _rv = OpenPicture(&picFrame);
2060 _res = Py_BuildValue("O&",
2061 ResObj_New, _rv);
2062 return _res;
2063}
2064
2065static PyObject *Qd_PicComment(_self, _args)
2066 PyObject *_self;
2067 PyObject *_args;
2068{
2069 PyObject *_res = NULL;
2070 short kind;
2071 short dataSize;
2072 Handle dataHandle;
2073 if (!PyArg_ParseTuple(_args, "hhO&",
2074 &kind,
2075 &dataSize,
2076 ResObj_Convert, &dataHandle))
2077 return NULL;
2078 PicComment(kind,
2079 dataSize,
2080 dataHandle);
2081 Py_INCREF(Py_None);
2082 _res = Py_None;
2083 return _res;
2084}
2085
2086static PyObject *Qd_ClosePicture(_self, _args)
2087 PyObject *_self;
2088 PyObject *_args;
2089{
2090 PyObject *_res = NULL;
2091 if (!PyArg_ParseTuple(_args, ""))
2092 return NULL;
2093 ClosePicture();
2094 Py_INCREF(Py_None);
2095 _res = Py_None;
2096 return _res;
2097}
2098
2099static PyObject *Qd_DrawPicture(_self, _args)
2100 PyObject *_self;
2101 PyObject *_args;
2102{
2103 PyObject *_res = NULL;
2104 PicHandle myPicture;
2105 Rect dstRect;
2106 if (!PyArg_ParseTuple(_args, "O&O&",
2107 ResObj_Convert, &myPicture,
2108 PyMac_GetRect, &dstRect))
2109 return NULL;
2110 DrawPicture(myPicture,
2111 &dstRect);
2112 Py_INCREF(Py_None);
2113 _res = Py_None;
2114 return _res;
2115}
2116
2117static PyObject *Qd_KillPicture(_self, _args)
2118 PyObject *_self;
2119 PyObject *_args;
2120{
2121 PyObject *_res = NULL;
2122 PicHandle myPicture;
2123 if (!PyArg_ParseTuple(_args, "O&",
2124 ResObj_Convert, &myPicture))
2125 return NULL;
2126 KillPicture(myPicture);
2127 Py_INCREF(Py_None);
2128 _res = Py_None;
2129 return _res;
2130}
2131
2132static PyObject *Qd_OpenPoly(_self, _args)
2133 PyObject *_self;
2134 PyObject *_args;
2135{
2136 PyObject *_res = NULL;
2137 PolyHandle _rv;
2138 if (!PyArg_ParseTuple(_args, ""))
2139 return NULL;
2140 _rv = OpenPoly();
2141 _res = Py_BuildValue("O&",
2142 ResObj_New, _rv);
2143 return _res;
2144}
2145
2146static PyObject *Qd_ClosePoly(_self, _args)
2147 PyObject *_self;
2148 PyObject *_args;
2149{
2150 PyObject *_res = NULL;
2151 if (!PyArg_ParseTuple(_args, ""))
2152 return NULL;
2153 ClosePoly();
2154 Py_INCREF(Py_None);
2155 _res = Py_None;
2156 return _res;
2157}
2158
2159static PyObject *Qd_KillPoly(_self, _args)
2160 PyObject *_self;
2161 PyObject *_args;
2162{
2163 PyObject *_res = NULL;
2164 PolyHandle poly;
2165 if (!PyArg_ParseTuple(_args, "O&",
2166 ResObj_Convert, &poly))
2167 return NULL;
2168 KillPoly(poly);
2169 Py_INCREF(Py_None);
2170 _res = Py_None;
2171 return _res;
2172}
2173
2174static PyObject *Qd_OffsetPoly(_self, _args)
2175 PyObject *_self;
2176 PyObject *_args;
2177{
2178 PyObject *_res = NULL;
2179 PolyHandle poly;
2180 short dh;
2181 short dv;
2182 if (!PyArg_ParseTuple(_args, "O&hh",
2183 ResObj_Convert, &poly,
2184 &dh,
2185 &dv))
2186 return NULL;
2187 OffsetPoly(poly,
2188 dh,
2189 dv);
2190 Py_INCREF(Py_None);
2191 _res = Py_None;
2192 return _res;
2193}
2194
2195static PyObject *Qd_FramePoly(_self, _args)
2196 PyObject *_self;
2197 PyObject *_args;
2198{
2199 PyObject *_res = NULL;
2200 PolyHandle poly;
2201 if (!PyArg_ParseTuple(_args, "O&",
2202 ResObj_Convert, &poly))
2203 return NULL;
2204 FramePoly(poly);
2205 Py_INCREF(Py_None);
2206 _res = Py_None;
2207 return _res;
2208}
2209
2210static PyObject *Qd_PaintPoly(_self, _args)
2211 PyObject *_self;
2212 PyObject *_args;
2213{
2214 PyObject *_res = NULL;
2215 PolyHandle poly;
2216 if (!PyArg_ParseTuple(_args, "O&",
2217 ResObj_Convert, &poly))
2218 return NULL;
2219 PaintPoly(poly);
2220 Py_INCREF(Py_None);
2221 _res = Py_None;
2222 return _res;
2223}
2224
2225static PyObject *Qd_ErasePoly(_self, _args)
2226 PyObject *_self;
2227 PyObject *_args;
2228{
2229 PyObject *_res = NULL;
2230 PolyHandle poly;
2231 if (!PyArg_ParseTuple(_args, "O&",
2232 ResObj_Convert, &poly))
2233 return NULL;
2234 ErasePoly(poly);
2235 Py_INCREF(Py_None);
2236 _res = Py_None;
2237 return _res;
2238}
2239
2240static PyObject *Qd_InvertPoly(_self, _args)
2241 PyObject *_self;
2242 PyObject *_args;
2243{
2244 PyObject *_res = NULL;
2245 PolyHandle poly;
2246 if (!PyArg_ParseTuple(_args, "O&",
2247 ResObj_Convert, &poly))
2248 return NULL;
2249 InvertPoly(poly);
2250 Py_INCREF(Py_None);
2251 _res = Py_None;
2252 return _res;
2253}
2254
Jack Jansen04a02e71996-01-06 17:12:58 +00002255static PyObject *Qd_FillPoly(_self, _args)
2256 PyObject *_self;
2257 PyObject *_args;
2258{
2259 PyObject *_res = NULL;
2260 PolyHandle poly;
2261 Pattern *pat__in__;
2262 int pat__in_len__;
2263 if (!PyArg_ParseTuple(_args, "O&s#",
2264 ResObj_Convert, &poly,
2265 (char **)&pat__in__, &pat__in_len__))
2266 return NULL;
2267 if (pat__in_len__ != sizeof(Pattern))
2268 {
2269 PyErr_SetString(PyExc_TypeError, "buffer length should be sizeof(Pattern)");
2270 goto pat__error__;
2271 }
2272 FillPoly(poly,
2273 pat__in__);
2274 Py_INCREF(Py_None);
2275 _res = Py_None;
2276 pat__error__: ;
2277 return _res;
2278}
2279
Guido van Rossume56db431995-03-19 22:49:50 +00002280static PyObject *Qd_SetPt(_self, _args)
2281 PyObject *_self;
2282 PyObject *_args;
2283{
2284 PyObject *_res = NULL;
2285 Point pt;
2286 short h;
2287 short v;
Jack Jansen1d8ede71996-01-08 23:47:31 +00002288 if (!PyArg_ParseTuple(_args, "hh",
Guido van Rossume56db431995-03-19 22:49:50 +00002289 &h,
2290 &v))
2291 return NULL;
2292 SetPt(&pt,
2293 h,
2294 v);
2295 _res = Py_BuildValue("O&",
2296 PyMac_BuildPoint, pt);
2297 return _res;
2298}
2299
2300static PyObject *Qd_LocalToGlobal(_self, _args)
2301 PyObject *_self;
2302 PyObject *_args;
2303{
2304 PyObject *_res = NULL;
2305 Point pt;
2306 if (!PyArg_ParseTuple(_args, "O&",
2307 PyMac_GetPoint, &pt))
2308 return NULL;
2309 LocalToGlobal(&pt);
2310 _res = Py_BuildValue("O&",
2311 PyMac_BuildPoint, pt);
2312 return _res;
2313}
2314
2315static PyObject *Qd_GlobalToLocal(_self, _args)
2316 PyObject *_self;
2317 PyObject *_args;
2318{
2319 PyObject *_res = NULL;
2320 Point pt;
2321 if (!PyArg_ParseTuple(_args, "O&",
2322 PyMac_GetPoint, &pt))
2323 return NULL;
2324 GlobalToLocal(&pt);
2325 _res = Py_BuildValue("O&",
2326 PyMac_BuildPoint, pt);
2327 return _res;
2328}
2329
2330static PyObject *Qd_Random(_self, _args)
2331 PyObject *_self;
2332 PyObject *_args;
2333{
2334 PyObject *_res = NULL;
2335 short _rv;
2336 if (!PyArg_ParseTuple(_args, ""))
2337 return NULL;
2338 _rv = Random();
2339 _res = Py_BuildValue("h",
2340 _rv);
2341 return _res;
2342}
2343
Jack Jansen1c4e6141998-04-21 15:23:55 +00002344static PyObject *Qd_MacGetPixel(_self, _args)
Guido van Rossume56db431995-03-19 22:49:50 +00002345 PyObject *_self;
2346 PyObject *_args;
2347{
2348 PyObject *_res = NULL;
2349 Boolean _rv;
2350 short h;
2351 short v;
2352 if (!PyArg_ParseTuple(_args, "hh",
2353 &h,
2354 &v))
2355 return NULL;
Jack Jansen1c4e6141998-04-21 15:23:55 +00002356 _rv = MacGetPixel(h,
2357 v);
Guido van Rossume56db431995-03-19 22:49:50 +00002358 _res = Py_BuildValue("b",
2359 _rv);
2360 return _res;
2361}
2362
2363static PyObject *Qd_ScalePt(_self, _args)
2364 PyObject *_self;
2365 PyObject *_args;
2366{
2367 PyObject *_res = NULL;
2368 Point pt;
2369 Rect srcRect;
2370 Rect dstRect;
2371 if (!PyArg_ParseTuple(_args, "O&O&O&",
2372 PyMac_GetPoint, &pt,
2373 PyMac_GetRect, &srcRect,
2374 PyMac_GetRect, &dstRect))
2375 return NULL;
2376 ScalePt(&pt,
2377 &srcRect,
2378 &dstRect);
2379 _res = Py_BuildValue("O&",
2380 PyMac_BuildPoint, pt);
2381 return _res;
2382}
2383
2384static PyObject *Qd_MapPt(_self, _args)
2385 PyObject *_self;
2386 PyObject *_args;
2387{
2388 PyObject *_res = NULL;
2389 Point pt;
2390 Rect srcRect;
2391 Rect dstRect;
2392 if (!PyArg_ParseTuple(_args, "O&O&O&",
2393 PyMac_GetPoint, &pt,
2394 PyMac_GetRect, &srcRect,
2395 PyMac_GetRect, &dstRect))
2396 return NULL;
2397 MapPt(&pt,
2398 &srcRect,
2399 &dstRect);
2400 _res = Py_BuildValue("O&",
2401 PyMac_BuildPoint, pt);
2402 return _res;
2403}
2404
2405static PyObject *Qd_MapRect(_self, _args)
2406 PyObject *_self;
2407 PyObject *_args;
2408{
2409 PyObject *_res = NULL;
2410 Rect r;
2411 Rect srcRect;
2412 Rect dstRect;
Jack Jansen54c8f7e1995-11-14 10:46:01 +00002413 if (!PyArg_ParseTuple(_args, "O&O&O&",
2414 PyMac_GetRect, &r,
Guido van Rossume56db431995-03-19 22:49:50 +00002415 PyMac_GetRect, &srcRect,
2416 PyMac_GetRect, &dstRect))
2417 return NULL;
2418 MapRect(&r,
2419 &srcRect,
2420 &dstRect);
2421 _res = Py_BuildValue("O&",
2422 PyMac_BuildRect, &r);
2423 return _res;
2424}
2425
2426static PyObject *Qd_MapRgn(_self, _args)
2427 PyObject *_self;
2428 PyObject *_args;
2429{
2430 PyObject *_res = NULL;
2431 RgnHandle rgn;
2432 Rect srcRect;
2433 Rect dstRect;
2434 if (!PyArg_ParseTuple(_args, "O&O&O&",
2435 ResObj_Convert, &rgn,
2436 PyMac_GetRect, &srcRect,
2437 PyMac_GetRect, &dstRect))
2438 return NULL;
2439 MapRgn(rgn,
2440 &srcRect,
2441 &dstRect);
2442 Py_INCREF(Py_None);
2443 _res = Py_None;
2444 return _res;
2445}
2446
2447static PyObject *Qd_MapPoly(_self, _args)
2448 PyObject *_self;
2449 PyObject *_args;
2450{
2451 PyObject *_res = NULL;
2452 PolyHandle poly;
2453 Rect srcRect;
2454 Rect dstRect;
2455 if (!PyArg_ParseTuple(_args, "O&O&O&",
2456 ResObj_Convert, &poly,
2457 PyMac_GetRect, &srcRect,
2458 PyMac_GetRect, &dstRect))
2459 return NULL;
2460 MapPoly(poly,
2461 &srcRect,
2462 &dstRect);
2463 Py_INCREF(Py_None);
2464 _res = Py_None;
2465 return _res;
2466}
2467
Jack Jansen41058c01995-11-16 22:48:29 +00002468static PyObject *Qd_StdBits(_self, _args)
2469 PyObject *_self;
2470 PyObject *_args;
2471{
2472 PyObject *_res = NULL;
2473 BitMapPtr srcBits;
2474 Rect srcRect;
2475 Rect dstRect;
2476 short mode;
2477 RgnHandle maskRgn;
2478 if (!PyArg_ParseTuple(_args, "O&O&O&hO&",
2479 BMObj_Convert, &srcBits,
2480 PyMac_GetRect, &srcRect,
2481 PyMac_GetRect, &dstRect,
2482 &mode,
Jack Jansen425e9eb1995-12-12 15:02:03 +00002483 OptResObj_Convert, &maskRgn))
Jack Jansen41058c01995-11-16 22:48:29 +00002484 return NULL;
2485 StdBits(srcBits,
2486 &srcRect,
2487 &dstRect,
2488 mode,
2489 maskRgn);
2490 Py_INCREF(Py_None);
2491 _res = Py_None;
2492 return _res;
2493}
2494
Guido van Rossume56db431995-03-19 22:49:50 +00002495static PyObject *Qd_AddPt(_self, _args)
2496 PyObject *_self;
2497 PyObject *_args;
2498{
2499 PyObject *_res = NULL;
2500 Point src;
2501 Point dst;
2502 if (!PyArg_ParseTuple(_args, "O&O&",
2503 PyMac_GetPoint, &src,
2504 PyMac_GetPoint, &dst))
2505 return NULL;
2506 AddPt(src,
2507 &dst);
2508 _res = Py_BuildValue("O&",
2509 PyMac_BuildPoint, dst);
2510 return _res;
2511}
2512
2513static PyObject *Qd_EqualPt(_self, _args)
2514 PyObject *_self;
2515 PyObject *_args;
2516{
2517 PyObject *_res = NULL;
2518 Boolean _rv;
2519 Point pt1;
2520 Point pt2;
2521 if (!PyArg_ParseTuple(_args, "O&O&",
2522 PyMac_GetPoint, &pt1,
2523 PyMac_GetPoint, &pt2))
2524 return NULL;
2525 _rv = EqualPt(pt1,
2526 pt2);
2527 _res = Py_BuildValue("b",
2528 _rv);
2529 return _res;
2530}
2531
Jack Jansen1c4e6141998-04-21 15:23:55 +00002532static PyObject *Qd_MacPtInRect(_self, _args)
Guido van Rossume56db431995-03-19 22:49:50 +00002533 PyObject *_self;
2534 PyObject *_args;
2535{
2536 PyObject *_res = NULL;
2537 Boolean _rv;
2538 Point pt;
2539 Rect r;
2540 if (!PyArg_ParseTuple(_args, "O&O&",
2541 PyMac_GetPoint, &pt,
2542 PyMac_GetRect, &r))
2543 return NULL;
Jack Jansen1c4e6141998-04-21 15:23:55 +00002544 _rv = MacPtInRect(pt,
2545 &r);
Guido van Rossume56db431995-03-19 22:49:50 +00002546 _res = Py_BuildValue("b",
2547 _rv);
2548 return _res;
2549}
2550
2551static PyObject *Qd_Pt2Rect(_self, _args)
2552 PyObject *_self;
2553 PyObject *_args;
2554{
2555 PyObject *_res = NULL;
2556 Point pt1;
2557 Point pt2;
2558 Rect dstRect;
2559 if (!PyArg_ParseTuple(_args, "O&O&",
2560 PyMac_GetPoint, &pt1,
2561 PyMac_GetPoint, &pt2))
2562 return NULL;
2563 Pt2Rect(pt1,
2564 pt2,
2565 &dstRect);
2566 _res = Py_BuildValue("O&",
2567 PyMac_BuildRect, &dstRect);
2568 return _res;
2569}
2570
2571static PyObject *Qd_PtToAngle(_self, _args)
2572 PyObject *_self;
2573 PyObject *_args;
2574{
2575 PyObject *_res = NULL;
2576 Rect r;
2577 Point pt;
2578 short angle;
2579 if (!PyArg_ParseTuple(_args, "O&O&",
2580 PyMac_GetRect, &r,
2581 PyMac_GetPoint, &pt))
2582 return NULL;
2583 PtToAngle(&r,
2584 pt,
2585 &angle);
2586 _res = Py_BuildValue("h",
2587 angle);
2588 return _res;
2589}
2590
Jack Jansenb81cf9d1995-06-06 13:08:40 +00002591static PyObject *Qd_SubPt(_self, _args)
2592 PyObject *_self;
2593 PyObject *_args;
2594{
2595 PyObject *_res = NULL;
2596 Point src;
2597 Point dst;
2598 if (!PyArg_ParseTuple(_args, "O&O&",
2599 PyMac_GetPoint, &src,
2600 PyMac_GetPoint, &dst))
2601 return NULL;
2602 SubPt(src,
2603 &dst);
2604 _res = Py_BuildValue("O&",
2605 PyMac_BuildPoint, dst);
2606 return _res;
2607}
2608
Guido van Rossume56db431995-03-19 22:49:50 +00002609static PyObject *Qd_PtInRgn(_self, _args)
2610 PyObject *_self;
2611 PyObject *_args;
2612{
2613 PyObject *_res = NULL;
2614 Boolean _rv;
2615 Point pt;
2616 RgnHandle rgn;
2617 if (!PyArg_ParseTuple(_args, "O&O&",
2618 PyMac_GetPoint, &pt,
2619 ResObj_Convert, &rgn))
2620 return NULL;
2621 _rv = PtInRgn(pt,
2622 rgn);
2623 _res = Py_BuildValue("b",
2624 _rv);
2625 return _res;
2626}
2627
2628static PyObject *Qd_NewPixMap(_self, _args)
2629 PyObject *_self;
2630 PyObject *_args;
2631{
2632 PyObject *_res = NULL;
2633 PixMapHandle _rv;
2634 if (!PyArg_ParseTuple(_args, ""))
2635 return NULL;
2636 _rv = NewPixMap();
2637 _res = Py_BuildValue("O&",
2638 ResObj_New, _rv);
2639 return _res;
2640}
2641
Guido van Rossume56db431995-03-19 22:49:50 +00002642static PyObject *Qd_DisposePixMap(_self, _args)
2643 PyObject *_self;
2644 PyObject *_args;
2645{
2646 PyObject *_res = NULL;
2647 PixMapHandle pm;
2648 if (!PyArg_ParseTuple(_args, "O&",
2649 ResObj_Convert, &pm))
2650 return NULL;
2651 DisposePixMap(pm);
2652 Py_INCREF(Py_None);
2653 _res = Py_None;
2654 return _res;
2655}
2656
2657static PyObject *Qd_CopyPixMap(_self, _args)
2658 PyObject *_self;
2659 PyObject *_args;
2660{
2661 PyObject *_res = NULL;
2662 PixMapHandle srcPM;
2663 PixMapHandle dstPM;
2664 if (!PyArg_ParseTuple(_args, "O&O&",
2665 ResObj_Convert, &srcPM,
2666 ResObj_Convert, &dstPM))
2667 return NULL;
2668 CopyPixMap(srcPM,
2669 dstPM);
2670 Py_INCREF(Py_None);
2671 _res = Py_None;
2672 return _res;
2673}
2674
2675static PyObject *Qd_NewPixPat(_self, _args)
2676 PyObject *_self;
2677 PyObject *_args;
2678{
2679 PyObject *_res = NULL;
2680 PixPatHandle _rv;
2681 if (!PyArg_ParseTuple(_args, ""))
2682 return NULL;
2683 _rv = NewPixPat();
2684 _res = Py_BuildValue("O&",
2685 ResObj_New, _rv);
2686 return _res;
2687}
2688
Guido van Rossume56db431995-03-19 22:49:50 +00002689static PyObject *Qd_DisposePixPat(_self, _args)
2690 PyObject *_self;
2691 PyObject *_args;
2692{
2693 PyObject *_res = NULL;
2694 PixPatHandle pp;
2695 if (!PyArg_ParseTuple(_args, "O&",
2696 ResObj_Convert, &pp))
2697 return NULL;
2698 DisposePixPat(pp);
2699 Py_INCREF(Py_None);
2700 _res = Py_None;
2701 return _res;
2702}
2703
2704static PyObject *Qd_CopyPixPat(_self, _args)
2705 PyObject *_self;
2706 PyObject *_args;
2707{
2708 PyObject *_res = NULL;
2709 PixPatHandle srcPP;
2710 PixPatHandle dstPP;
2711 if (!PyArg_ParseTuple(_args, "O&O&",
2712 ResObj_Convert, &srcPP,
2713 ResObj_Convert, &dstPP))
2714 return NULL;
2715 CopyPixPat(srcPP,
2716 dstPP);
2717 Py_INCREF(Py_None);
2718 _res = Py_None;
2719 return _res;
2720}
2721
2722static PyObject *Qd_PenPixPat(_self, _args)
2723 PyObject *_self;
2724 PyObject *_args;
2725{
2726 PyObject *_res = NULL;
2727 PixPatHandle pp;
2728 if (!PyArg_ParseTuple(_args, "O&",
2729 ResObj_Convert, &pp))
2730 return NULL;
2731 PenPixPat(pp);
2732 Py_INCREF(Py_None);
2733 _res = Py_None;
2734 return _res;
2735}
2736
2737static PyObject *Qd_BackPixPat(_self, _args)
2738 PyObject *_self;
2739 PyObject *_args;
2740{
2741 PyObject *_res = NULL;
2742 PixPatHandle pp;
2743 if (!PyArg_ParseTuple(_args, "O&",
2744 ResObj_Convert, &pp))
2745 return NULL;
2746 BackPixPat(pp);
2747 Py_INCREF(Py_None);
2748 _res = Py_None;
2749 return _res;
2750}
2751
2752static PyObject *Qd_GetPixPat(_self, _args)
2753 PyObject *_self;
2754 PyObject *_args;
2755{
2756 PyObject *_res = NULL;
2757 PixPatHandle _rv;
2758 short patID;
2759 if (!PyArg_ParseTuple(_args, "h",
2760 &patID))
2761 return NULL;
2762 _rv = GetPixPat(patID);
2763 _res = Py_BuildValue("O&",
2764 ResObj_New, _rv);
2765 return _res;
2766}
2767
Jack Jansen232f3cd1995-12-09 14:04:31 +00002768static PyObject *Qd_MakeRGBPat(_self, _args)
2769 PyObject *_self;
2770 PyObject *_args;
2771{
2772 PyObject *_res = NULL;
2773 PixPatHandle pp;
2774 RGBColor myColor;
2775 if (!PyArg_ParseTuple(_args, "O&O&",
2776 ResObj_Convert, &pp,
2777 QdRGB_Convert, &myColor))
2778 return NULL;
2779 MakeRGBPat(pp,
2780 &myColor);
2781 Py_INCREF(Py_None);
2782 _res = Py_None;
2783 return _res;
2784}
2785
Guido van Rossume56db431995-03-19 22:49:50 +00002786static PyObject *Qd_FillCRect(_self, _args)
2787 PyObject *_self;
2788 PyObject *_args;
2789{
2790 PyObject *_res = NULL;
2791 Rect r;
2792 PixPatHandle pp;
2793 if (!PyArg_ParseTuple(_args, "O&O&",
2794 PyMac_GetRect, &r,
2795 ResObj_Convert, &pp))
2796 return NULL;
2797 FillCRect(&r,
2798 pp);
2799 Py_INCREF(Py_None);
2800 _res = Py_None;
2801 return _res;
2802}
2803
2804static PyObject *Qd_FillCOval(_self, _args)
2805 PyObject *_self;
2806 PyObject *_args;
2807{
2808 PyObject *_res = NULL;
2809 Rect r;
2810 PixPatHandle pp;
2811 if (!PyArg_ParseTuple(_args, "O&O&",
2812 PyMac_GetRect, &r,
2813 ResObj_Convert, &pp))
2814 return NULL;
2815 FillCOval(&r,
2816 pp);
2817 Py_INCREF(Py_None);
2818 _res = Py_None;
2819 return _res;
2820}
2821
2822static PyObject *Qd_FillCRoundRect(_self, _args)
2823 PyObject *_self;
2824 PyObject *_args;
2825{
2826 PyObject *_res = NULL;
2827 Rect r;
2828 short ovalWidth;
2829 short ovalHeight;
2830 PixPatHandle pp;
2831 if (!PyArg_ParseTuple(_args, "O&hhO&",
2832 PyMac_GetRect, &r,
2833 &ovalWidth,
2834 &ovalHeight,
2835 ResObj_Convert, &pp))
2836 return NULL;
2837 FillCRoundRect(&r,
2838 ovalWidth,
2839 ovalHeight,
2840 pp);
2841 Py_INCREF(Py_None);
2842 _res = Py_None;
2843 return _res;
2844}
2845
2846static PyObject *Qd_FillCArc(_self, _args)
2847 PyObject *_self;
2848 PyObject *_args;
2849{
2850 PyObject *_res = NULL;
2851 Rect r;
2852 short startAngle;
2853 short arcAngle;
2854 PixPatHandle pp;
2855 if (!PyArg_ParseTuple(_args, "O&hhO&",
2856 PyMac_GetRect, &r,
2857 &startAngle,
2858 &arcAngle,
2859 ResObj_Convert, &pp))
2860 return NULL;
2861 FillCArc(&r,
2862 startAngle,
2863 arcAngle,
2864 pp);
2865 Py_INCREF(Py_None);
2866 _res = Py_None;
2867 return _res;
2868}
2869
2870static PyObject *Qd_FillCRgn(_self, _args)
2871 PyObject *_self;
2872 PyObject *_args;
2873{
2874 PyObject *_res = NULL;
2875 RgnHandle rgn;
2876 PixPatHandle pp;
2877 if (!PyArg_ParseTuple(_args, "O&O&",
2878 ResObj_Convert, &rgn,
2879 ResObj_Convert, &pp))
2880 return NULL;
2881 FillCRgn(rgn,
2882 pp);
2883 Py_INCREF(Py_None);
2884 _res = Py_None;
2885 return _res;
2886}
2887
2888static PyObject *Qd_FillCPoly(_self, _args)
2889 PyObject *_self;
2890 PyObject *_args;
2891{
2892 PyObject *_res = NULL;
2893 PolyHandle poly;
2894 PixPatHandle pp;
2895 if (!PyArg_ParseTuple(_args, "O&O&",
2896 ResObj_Convert, &poly,
2897 ResObj_Convert, &pp))
2898 return NULL;
2899 FillCPoly(poly,
2900 pp);
2901 Py_INCREF(Py_None);
2902 _res = Py_None;
2903 return _res;
2904}
2905
Jack Jansen232f3cd1995-12-09 14:04:31 +00002906static PyObject *Qd_RGBForeColor(_self, _args)
2907 PyObject *_self;
2908 PyObject *_args;
2909{
2910 PyObject *_res = NULL;
2911 RGBColor color;
2912 if (!PyArg_ParseTuple(_args, "O&",
2913 QdRGB_Convert, &color))
2914 return NULL;
2915 RGBForeColor(&color);
2916 Py_INCREF(Py_None);
2917 _res = Py_None;
2918 return _res;
2919}
2920
2921static PyObject *Qd_RGBBackColor(_self, _args)
2922 PyObject *_self;
2923 PyObject *_args;
2924{
2925 PyObject *_res = NULL;
2926 RGBColor color;
2927 if (!PyArg_ParseTuple(_args, "O&",
2928 QdRGB_Convert, &color))
2929 return NULL;
2930 RGBBackColor(&color);
2931 Py_INCREF(Py_None);
2932 _res = Py_None;
2933 return _res;
2934}
2935
2936static PyObject *Qd_SetCPixel(_self, _args)
2937 PyObject *_self;
2938 PyObject *_args;
2939{
2940 PyObject *_res = NULL;
2941 short h;
2942 short v;
2943 RGBColor cPix;
2944 if (!PyArg_ParseTuple(_args, "hhO&",
2945 &h,
2946 &v,
2947 QdRGB_Convert, &cPix))
2948 return NULL;
2949 SetCPixel(h,
2950 v,
2951 &cPix);
2952 Py_INCREF(Py_None);
2953 _res = Py_None;
2954 return _res;
2955}
2956
Guido van Rossume56db431995-03-19 22:49:50 +00002957static PyObject *Qd_SetPortPix(_self, _args)
2958 PyObject *_self;
2959 PyObject *_args;
2960{
2961 PyObject *_res = NULL;
2962 PixMapHandle pm;
2963 if (!PyArg_ParseTuple(_args, "O&",
2964 ResObj_Convert, &pm))
2965 return NULL;
2966 SetPortPix(pm);
2967 Py_INCREF(Py_None);
2968 _res = Py_None;
2969 return _res;
2970}
2971
Jack Jansen232f3cd1995-12-09 14:04:31 +00002972static PyObject *Qd_GetCPixel(_self, _args)
2973 PyObject *_self;
2974 PyObject *_args;
2975{
2976 PyObject *_res = NULL;
2977 short h;
2978 short v;
2979 RGBColor cPix;
2980 if (!PyArg_ParseTuple(_args, "hh",
2981 &h,
2982 &v))
2983 return NULL;
2984 GetCPixel(h,
2985 v,
2986 &cPix);
2987 _res = Py_BuildValue("O&",
2988 QdRGB_New, &cPix);
2989 return _res;
2990}
2991
2992static PyObject *Qd_GetForeColor(_self, _args)
2993 PyObject *_self;
2994 PyObject *_args;
2995{
2996 PyObject *_res = NULL;
2997 RGBColor color;
2998 if (!PyArg_ParseTuple(_args, ""))
2999 return NULL;
3000 GetForeColor(&color);
3001 _res = Py_BuildValue("O&",
3002 QdRGB_New, &color);
3003 return _res;
3004}
3005
3006static PyObject *Qd_GetBackColor(_self, _args)
3007 PyObject *_self;
3008 PyObject *_args;
3009{
3010 PyObject *_res = NULL;
3011 RGBColor color;
3012 if (!PyArg_ParseTuple(_args, ""))
3013 return NULL;
3014 GetBackColor(&color);
3015 _res = Py_BuildValue("O&",
3016 QdRGB_New, &color);
3017 return _res;
3018}
3019
3020static PyObject *Qd_OpColor(_self, _args)
3021 PyObject *_self;
3022 PyObject *_args;
3023{
3024 PyObject *_res = NULL;
3025 RGBColor color;
3026 if (!PyArg_ParseTuple(_args, "O&",
3027 QdRGB_Convert, &color))
3028 return NULL;
3029 OpColor(&color);
3030 Py_INCREF(Py_None);
3031 _res = Py_None;
3032 return _res;
3033}
3034
3035static PyObject *Qd_HiliteColor(_self, _args)
3036 PyObject *_self;
3037 PyObject *_args;
3038{
3039 PyObject *_res = NULL;
3040 RGBColor color;
3041 if (!PyArg_ParseTuple(_args, "O&",
3042 QdRGB_Convert, &color))
3043 return NULL;
3044 HiliteColor(&color);
3045 Py_INCREF(Py_None);
3046 _res = Py_None;
3047 return _res;
3048}
3049
Jack Jansen69b43ed1997-08-15 14:35:54 +00003050static PyObject *Qd_DisposeCTable(_self, _args)
3051 PyObject *_self;
3052 PyObject *_args;
3053{
3054 PyObject *_res = NULL;
3055 CTabHandle cTable;
3056 if (!PyArg_ParseTuple(_args, "O&",
3057 ResObj_Convert, &cTable))
3058 return NULL;
3059 DisposeCTable(cTable);
3060 Py_INCREF(Py_None);
3061 _res = Py_None;
3062 return _res;
3063}
3064
3065static PyObject *Qd_GetCTable(_self, _args)
3066 PyObject *_self;
3067 PyObject *_args;
3068{
3069 PyObject *_res = NULL;
3070 CTabHandle _rv;
3071 short ctID;
3072 if (!PyArg_ParseTuple(_args, "h",
3073 &ctID))
3074 return NULL;
3075 _rv = GetCTable(ctID);
3076 _res = Py_BuildValue("O&",
3077 ResObj_New, _rv);
3078 return _res;
3079}
3080
3081static PyObject *Qd_GetCCursor(_self, _args)
3082 PyObject *_self;
3083 PyObject *_args;
3084{
3085 PyObject *_res = NULL;
3086 CCrsrHandle _rv;
3087 short crsrID;
3088 if (!PyArg_ParseTuple(_args, "h",
3089 &crsrID))
3090 return NULL;
3091 _rv = GetCCursor(crsrID);
3092 _res = Py_BuildValue("O&",
3093 ResObj_New, _rv);
3094 return _res;
3095}
3096
3097static PyObject *Qd_SetCCursor(_self, _args)
3098 PyObject *_self;
3099 PyObject *_args;
3100{
3101 PyObject *_res = NULL;
3102 CCrsrHandle cCrsr;
3103 if (!PyArg_ParseTuple(_args, "O&",
3104 ResObj_Convert, &cCrsr))
3105 return NULL;
3106 SetCCursor(cCrsr);
3107 Py_INCREF(Py_None);
3108 _res = Py_None;
3109 return _res;
3110}
3111
Guido van Rossume56db431995-03-19 22:49:50 +00003112static PyObject *Qd_AllocCursor(_self, _args)
3113 PyObject *_self;
3114 PyObject *_args;
3115{
3116 PyObject *_res = NULL;
3117 if (!PyArg_ParseTuple(_args, ""))
3118 return NULL;
3119 AllocCursor();
3120 Py_INCREF(Py_None);
3121 _res = Py_None;
3122 return _res;
3123}
3124
Jack Jansen69b43ed1997-08-15 14:35:54 +00003125static PyObject *Qd_DisposeCCursor(_self, _args)
3126 PyObject *_self;
3127 PyObject *_args;
3128{
3129 PyObject *_res = NULL;
3130 CCrsrHandle cCrsr;
3131 if (!PyArg_ParseTuple(_args, "O&",
3132 ResObj_Convert, &cCrsr))
3133 return NULL;
3134 DisposeCCursor(cCrsr);
3135 Py_INCREF(Py_None);
3136 _res = Py_None;
3137 return _res;
3138}
3139
3140static PyObject *Qd_GetMaxDevice(_self, _args)
3141 PyObject *_self;
3142 PyObject *_args;
3143{
3144 PyObject *_res = NULL;
3145 GDHandle _rv;
3146 Rect globalRect;
3147 if (!PyArg_ParseTuple(_args, "O&",
3148 PyMac_GetRect, &globalRect))
3149 return NULL;
3150 _rv = GetMaxDevice(&globalRect);
3151 _res = Py_BuildValue("O&",
3152 ResObj_New, _rv);
3153 return _res;
3154}
3155
Guido van Rossume56db431995-03-19 22:49:50 +00003156static PyObject *Qd_GetCTSeed(_self, _args)
3157 PyObject *_self;
3158 PyObject *_args;
3159{
3160 PyObject *_res = NULL;
3161 long _rv;
3162 if (!PyArg_ParseTuple(_args, ""))
3163 return NULL;
3164 _rv = GetCTSeed();
3165 _res = Py_BuildValue("l",
3166 _rv);
3167 return _res;
3168}
3169
Jack Jansen69b43ed1997-08-15 14:35:54 +00003170static PyObject *Qd_GetDeviceList(_self, _args)
3171 PyObject *_self;
3172 PyObject *_args;
3173{
3174 PyObject *_res = NULL;
3175 GDHandle _rv;
3176 if (!PyArg_ParseTuple(_args, ""))
3177 return NULL;
3178 _rv = GetDeviceList();
3179 _res = Py_BuildValue("O&",
3180 ResObj_New, _rv);
3181 return _res;
3182}
3183
3184static PyObject *Qd_GetMainDevice(_self, _args)
3185 PyObject *_self;
3186 PyObject *_args;
3187{
3188 PyObject *_res = NULL;
3189 GDHandle _rv;
3190 if (!PyArg_ParseTuple(_args, ""))
3191 return NULL;
3192 _rv = GetMainDevice();
3193 _res = Py_BuildValue("O&",
3194 ResObj_New, _rv);
3195 return _res;
3196}
3197
3198static PyObject *Qd_GetNextDevice(_self, _args)
3199 PyObject *_self;
3200 PyObject *_args;
3201{
3202 PyObject *_res = NULL;
3203 GDHandle _rv;
3204 GDHandle curDevice;
3205 if (!PyArg_ParseTuple(_args, "O&",
3206 ResObj_Convert, &curDevice))
3207 return NULL;
3208 _rv = GetNextDevice(curDevice);
3209 _res = Py_BuildValue("O&",
3210 ResObj_New, _rv);
3211 return _res;
3212}
3213
3214static PyObject *Qd_TestDeviceAttribute(_self, _args)
3215 PyObject *_self;
3216 PyObject *_args;
3217{
3218 PyObject *_res = NULL;
3219 Boolean _rv;
3220 GDHandle gdh;
3221 short attribute;
3222 if (!PyArg_ParseTuple(_args, "O&h",
3223 ResObj_Convert, &gdh,
3224 &attribute))
3225 return NULL;
3226 _rv = TestDeviceAttribute(gdh,
3227 attribute);
3228 _res = Py_BuildValue("b",
3229 _rv);
3230 return _res;
3231}
3232
3233static PyObject *Qd_SetDeviceAttribute(_self, _args)
3234 PyObject *_self;
3235 PyObject *_args;
3236{
3237 PyObject *_res = NULL;
3238 GDHandle gdh;
3239 short attribute;
3240 Boolean value;
3241 if (!PyArg_ParseTuple(_args, "O&hb",
3242 ResObj_Convert, &gdh,
3243 &attribute,
3244 &value))
3245 return NULL;
3246 SetDeviceAttribute(gdh,
3247 attribute,
3248 value);
3249 Py_INCREF(Py_None);
3250 _res = Py_None;
3251 return _res;
3252}
3253
3254static PyObject *Qd_InitGDevice(_self, _args)
3255 PyObject *_self;
3256 PyObject *_args;
3257{
3258 PyObject *_res = NULL;
3259 short qdRefNum;
3260 long mode;
3261 GDHandle gdh;
3262 if (!PyArg_ParseTuple(_args, "hlO&",
3263 &qdRefNum,
3264 &mode,
3265 ResObj_Convert, &gdh))
3266 return NULL;
3267 InitGDevice(qdRefNum,
3268 mode,
3269 gdh);
3270 Py_INCREF(Py_None);
3271 _res = Py_None;
3272 return _res;
3273}
3274
3275static PyObject *Qd_NewGDevice(_self, _args)
3276 PyObject *_self;
3277 PyObject *_args;
3278{
3279 PyObject *_res = NULL;
3280 GDHandle _rv;
3281 short refNum;
3282 long mode;
3283 if (!PyArg_ParseTuple(_args, "hl",
3284 &refNum,
3285 &mode))
3286 return NULL;
3287 _rv = NewGDevice(refNum,
3288 mode);
3289 _res = Py_BuildValue("O&",
3290 ResObj_New, _rv);
3291 return _res;
3292}
3293
3294static PyObject *Qd_DisposeGDevice(_self, _args)
3295 PyObject *_self;
3296 PyObject *_args;
3297{
3298 PyObject *_res = NULL;
3299 GDHandle gdh;
3300 if (!PyArg_ParseTuple(_args, "O&",
3301 ResObj_Convert, &gdh))
3302 return NULL;
3303 DisposeGDevice(gdh);
3304 Py_INCREF(Py_None);
3305 _res = Py_None;
3306 return _res;
3307}
3308
3309static PyObject *Qd_SetGDevice(_self, _args)
3310 PyObject *_self;
3311 PyObject *_args;
3312{
3313 PyObject *_res = NULL;
3314 GDHandle gd;
3315 if (!PyArg_ParseTuple(_args, "O&",
3316 ResObj_Convert, &gd))
3317 return NULL;
3318 SetGDevice(gd);
3319 Py_INCREF(Py_None);
3320 _res = Py_None;
3321 return _res;
3322}
3323
3324static PyObject *Qd_GetGDevice(_self, _args)
3325 PyObject *_self;
3326 PyObject *_args;
3327{
3328 PyObject *_res = NULL;
3329 GDHandle _rv;
3330 if (!PyArg_ParseTuple(_args, ""))
3331 return NULL;
3332 _rv = GetGDevice();
3333 _res = Py_BuildValue("O&",
3334 ResObj_New, _rv);
3335 return _res;
3336}
3337
Jack Jansen232f3cd1995-12-09 14:04:31 +00003338static PyObject *Qd_Color2Index(_self, _args)
3339 PyObject *_self;
3340 PyObject *_args;
3341{
3342 PyObject *_res = NULL;
3343 long _rv;
3344 RGBColor myColor;
3345 if (!PyArg_ParseTuple(_args, "O&",
3346 QdRGB_Convert, &myColor))
3347 return NULL;
3348 _rv = Color2Index(&myColor);
3349 _res = Py_BuildValue("l",
3350 _rv);
3351 return _res;
3352}
3353
3354static PyObject *Qd_Index2Color(_self, _args)
3355 PyObject *_self;
3356 PyObject *_args;
3357{
3358 PyObject *_res = NULL;
3359 long index;
3360 RGBColor aColor;
3361 if (!PyArg_ParseTuple(_args, "l",
3362 &index))
3363 return NULL;
3364 Index2Color(index,
3365 &aColor);
3366 _res = Py_BuildValue("O&",
3367 QdRGB_New, &aColor);
3368 return _res;
3369}
3370
3371static PyObject *Qd_InvertColor(_self, _args)
3372 PyObject *_self;
3373 PyObject *_args;
3374{
3375 PyObject *_res = NULL;
3376 RGBColor myColor;
3377 if (!PyArg_ParseTuple(_args, ""))
3378 return NULL;
3379 InvertColor(&myColor);
3380 _res = Py_BuildValue("O&",
3381 QdRGB_New, &myColor);
3382 return _res;
3383}
3384
3385static PyObject *Qd_RealColor(_self, _args)
3386 PyObject *_self;
3387 PyObject *_args;
3388{
3389 PyObject *_res = NULL;
3390 Boolean _rv;
3391 RGBColor color;
3392 if (!PyArg_ParseTuple(_args, "O&",
3393 QdRGB_Convert, &color))
3394 return NULL;
3395 _rv = RealColor(&color);
3396 _res = Py_BuildValue("b",
3397 _rv);
3398 return _res;
3399}
3400
Jack Jansen69b43ed1997-08-15 14:35:54 +00003401static PyObject *Qd_GetSubTable(_self, _args)
3402 PyObject *_self;
3403 PyObject *_args;
3404{
3405 PyObject *_res = NULL;
3406 CTabHandle myColors;
3407 short iTabRes;
3408 CTabHandle targetTbl;
3409 if (!PyArg_ParseTuple(_args, "O&hO&",
3410 ResObj_Convert, &myColors,
3411 &iTabRes,
3412 ResObj_Convert, &targetTbl))
3413 return NULL;
3414 GetSubTable(myColors,
3415 iTabRes,
3416 targetTbl);
3417 Py_INCREF(Py_None);
3418 _res = Py_None;
3419 return _res;
3420}
3421
3422static PyObject *Qd_MakeITable(_self, _args)
3423 PyObject *_self;
3424 PyObject *_args;
3425{
3426 PyObject *_res = NULL;
3427 CTabHandle cTabH;
3428 ITabHandle iTabH;
3429 short res;
3430 if (!PyArg_ParseTuple(_args, "O&O&h",
3431 ResObj_Convert, &cTabH,
3432 ResObj_Convert, &iTabH,
3433 &res))
3434 return NULL;
3435 MakeITable(cTabH,
3436 iTabH,
3437 res);
3438 Py_INCREF(Py_None);
3439 _res = Py_None;
3440 return _res;
3441}
3442
Guido van Rossume56db431995-03-19 22:49:50 +00003443static PyObject *Qd_SetClientID(_self, _args)
3444 PyObject *_self;
3445 PyObject *_args;
3446{
3447 PyObject *_res = NULL;
3448 short id;
3449 if (!PyArg_ParseTuple(_args, "h",
3450 &id))
3451 return NULL;
3452 SetClientID(id);
3453 Py_INCREF(Py_None);
3454 _res = Py_None;
3455 return _res;
3456}
3457
3458static PyObject *Qd_ProtectEntry(_self, _args)
3459 PyObject *_self;
3460 PyObject *_args;
3461{
3462 PyObject *_res = NULL;
3463 short index;
3464 Boolean protect;
3465 if (!PyArg_ParseTuple(_args, "hb",
3466 &index,
3467 &protect))
3468 return NULL;
3469 ProtectEntry(index,
3470 protect);
3471 Py_INCREF(Py_None);
3472 _res = Py_None;
3473 return _res;
3474}
3475
3476static PyObject *Qd_ReserveEntry(_self, _args)
3477 PyObject *_self;
3478 PyObject *_args;
3479{
3480 PyObject *_res = NULL;
3481 short index;
3482 Boolean reserve;
3483 if (!PyArg_ParseTuple(_args, "hb",
3484 &index,
3485 &reserve))
3486 return NULL;
3487 ReserveEntry(index,
3488 reserve);
3489 Py_INCREF(Py_None);
3490 _res = Py_None;
3491 return _res;
3492}
3493
3494static PyObject *Qd_QDError(_self, _args)
3495 PyObject *_self;
3496 PyObject *_args;
3497{
3498 PyObject *_res = NULL;
3499 short _rv;
3500 if (!PyArg_ParseTuple(_args, ""))
3501 return NULL;
3502 _rv = QDError();
3503 _res = Py_BuildValue("h",
3504 _rv);
3505 return _res;
3506}
3507
Jack Jansen41058c01995-11-16 22:48:29 +00003508static PyObject *Qd_CopyDeepMask(_self, _args)
3509 PyObject *_self;
3510 PyObject *_args;
3511{
3512 PyObject *_res = NULL;
3513 BitMapPtr srcBits;
3514 BitMapPtr maskBits;
3515 BitMapPtr dstBits;
3516 Rect srcRect;
3517 Rect maskRect;
3518 Rect dstRect;
3519 short mode;
3520 RgnHandle maskRgn;
3521 if (!PyArg_ParseTuple(_args, "O&O&O&O&O&O&hO&",
3522 BMObj_Convert, &srcBits,
3523 BMObj_Convert, &maskBits,
3524 BMObj_Convert, &dstBits,
3525 PyMac_GetRect, &srcRect,
3526 PyMac_GetRect, &maskRect,
3527 PyMac_GetRect, &dstRect,
3528 &mode,
Jack Jansen425e9eb1995-12-12 15:02:03 +00003529 OptResObj_Convert, &maskRgn))
Jack Jansen41058c01995-11-16 22:48:29 +00003530 return NULL;
3531 CopyDeepMask(srcBits,
3532 maskBits,
3533 dstBits,
3534 &srcRect,
3535 &maskRect,
3536 &dstRect,
3537 mode,
3538 maskRgn);
3539 Py_INCREF(Py_None);
3540 _res = Py_None;
3541 return _res;
3542}
3543
Jack Jansen54c8f7e1995-11-14 10:46:01 +00003544static PyObject *Qd_GetPattern(_self, _args)
3545 PyObject *_self;
3546 PyObject *_args;
3547{
3548 PyObject *_res = NULL;
3549 PatHandle _rv;
3550 short patternID;
3551 if (!PyArg_ParseTuple(_args, "h",
3552 &patternID))
3553 return NULL;
3554 _rv = GetPattern(patternID);
3555 _res = Py_BuildValue("O&",
3556 ResObj_New, _rv);
3557 return _res;
3558}
3559
Jack Jansen1c4e6141998-04-21 15:23:55 +00003560static PyObject *Qd_MacGetCursor(_self, _args)
Jack Jansen54c8f7e1995-11-14 10:46:01 +00003561 PyObject *_self;
3562 PyObject *_args;
3563{
3564 PyObject *_res = NULL;
3565 CursHandle _rv;
3566 short cursorID;
3567 if (!PyArg_ParseTuple(_args, "h",
3568 &cursorID))
3569 return NULL;
Jack Jansen1c4e6141998-04-21 15:23:55 +00003570 _rv = MacGetCursor(cursorID);
Jack Jansen54c8f7e1995-11-14 10:46:01 +00003571 _res = Py_BuildValue("O&",
3572 ResObj_New, _rv);
3573 return _res;
3574}
3575
3576static PyObject *Qd_GetPicture(_self, _args)
3577 PyObject *_self;
3578 PyObject *_args;
3579{
3580 PyObject *_res = NULL;
3581 PicHandle _rv;
3582 short pictureID;
3583 if (!PyArg_ParseTuple(_args, "h",
3584 &pictureID))
3585 return NULL;
3586 _rv = GetPicture(pictureID);
3587 _res = Py_BuildValue("O&",
3588 ResObj_New, _rv);
3589 return _res;
3590}
3591
3592static PyObject *Qd_DeltaPoint(_self, _args)
3593 PyObject *_self;
3594 PyObject *_args;
3595{
3596 PyObject *_res = NULL;
3597 long _rv;
3598 Point ptA;
3599 Point ptB;
3600 if (!PyArg_ParseTuple(_args, "O&O&",
3601 PyMac_GetPoint, &ptA,
3602 PyMac_GetPoint, &ptB))
3603 return NULL;
3604 _rv = DeltaPoint(ptA,
3605 ptB);
3606 _res = Py_BuildValue("l",
3607 _rv);
3608 return _res;
3609}
3610
3611static PyObject *Qd_ShieldCursor(_self, _args)
3612 PyObject *_self;
3613 PyObject *_args;
3614{
3615 PyObject *_res = NULL;
3616 Rect shieldRect;
3617 Point offsetPt;
3618 if (!PyArg_ParseTuple(_args, "O&O&",
3619 PyMac_GetRect, &shieldRect,
3620 PyMac_GetPoint, &offsetPt))
3621 return NULL;
3622 ShieldCursor(&shieldRect,
3623 offsetPt);
3624 Py_INCREF(Py_None);
3625 _res = Py_None;
3626 return _res;
3627}
3628
3629static PyObject *Qd_ScreenRes(_self, _args)
3630 PyObject *_self;
3631 PyObject *_args;
3632{
3633 PyObject *_res = NULL;
3634 short scrnHRes;
3635 short scrnVRes;
3636 if (!PyArg_ParseTuple(_args, ""))
3637 return NULL;
3638 ScreenRes(&scrnHRes,
3639 &scrnVRes);
3640 _res = Py_BuildValue("hh",
3641 scrnHRes,
3642 scrnVRes);
3643 return _res;
3644}
3645
Jack Jansen04a02e71996-01-06 17:12:58 +00003646static PyObject *Qd_GetIndPattern(_self, _args)
3647 PyObject *_self;
3648 PyObject *_args;
3649{
3650 PyObject *_res = NULL;
3651 Pattern thePat__out__;
3652 short patternListID;
3653 short index;
3654 if (!PyArg_ParseTuple(_args, "hh",
3655 &patternListID,
3656 &index))
3657 return NULL;
3658 GetIndPattern(&thePat__out__,
3659 patternListID,
3660 index);
3661 _res = Py_BuildValue("s#",
3662 (char *)&thePat__out__, (int)sizeof(Pattern));
3663 thePat__error__: ;
3664 return _res;
3665}
3666
Jack Jansen21f96871998-02-20 16:02:09 +00003667static PyObject *Qd_SlopeFromAngle(_self, _args)
3668 PyObject *_self;
3669 PyObject *_args;
3670{
3671 PyObject *_res = NULL;
3672 Fixed _rv;
3673 short angle;
3674 if (!PyArg_ParseTuple(_args, "h",
3675 &angle))
3676 return NULL;
3677 _rv = SlopeFromAngle(angle);
3678 _res = Py_BuildValue("O&",
3679 PyMac_BuildFixed, _rv);
3680 return _res;
3681}
3682
3683static PyObject *Qd_AngleFromSlope(_self, _args)
3684 PyObject *_self;
3685 PyObject *_args;
3686{
3687 PyObject *_res = NULL;
3688 short _rv;
3689 Fixed slope;
3690 if (!PyArg_ParseTuple(_args, "O&",
3691 PyMac_GetFixed, &slope))
3692 return NULL;
3693 _rv = AngleFromSlope(slope);
3694 _res = Py_BuildValue("h",
3695 _rv);
3696 return _res;
3697}
3698
Jack Jansenb81cf9d1995-06-06 13:08:40 +00003699static PyObject *Qd_TextFont(_self, _args)
3700 PyObject *_self;
3701 PyObject *_args;
3702{
3703 PyObject *_res = NULL;
3704 short font;
3705 if (!PyArg_ParseTuple(_args, "h",
3706 &font))
3707 return NULL;
3708 TextFont(font);
3709 Py_INCREF(Py_None);
3710 _res = Py_None;
3711 return _res;
3712}
3713
3714static PyObject *Qd_TextFace(_self, _args)
3715 PyObject *_self;
3716 PyObject *_args;
3717{
3718 PyObject *_res = NULL;
Jack Jansene742a821998-02-25 15:46:50 +00003719 StyleParameter face;
Jack Jansenb81cf9d1995-06-06 13:08:40 +00003720 if (!PyArg_ParseTuple(_args, "h",
3721 &face))
3722 return NULL;
3723 TextFace(face);
3724 Py_INCREF(Py_None);
3725 _res = Py_None;
3726 return _res;
3727}
3728
3729static PyObject *Qd_TextMode(_self, _args)
3730 PyObject *_self;
3731 PyObject *_args;
3732{
3733 PyObject *_res = NULL;
3734 short mode;
3735 if (!PyArg_ParseTuple(_args, "h",
3736 &mode))
3737 return NULL;
3738 TextMode(mode);
3739 Py_INCREF(Py_None);
3740 _res = Py_None;
3741 return _res;
3742}
3743
3744static PyObject *Qd_TextSize(_self, _args)
3745 PyObject *_self;
3746 PyObject *_args;
3747{
3748 PyObject *_res = NULL;
3749 short size;
3750 if (!PyArg_ParseTuple(_args, "h",
3751 &size))
3752 return NULL;
3753 TextSize(size);
3754 Py_INCREF(Py_None);
3755 _res = Py_None;
3756 return _res;
3757}
3758
3759static PyObject *Qd_SpaceExtra(_self, _args)
3760 PyObject *_self;
3761 PyObject *_args;
3762{
3763 PyObject *_res = NULL;
Jack Jansen330381c1995-11-15 15:18:01 +00003764 Fixed extra;
3765 if (!PyArg_ParseTuple(_args, "O&",
3766 PyMac_GetFixed, &extra))
Jack Jansenb81cf9d1995-06-06 13:08:40 +00003767 return NULL;
3768 SpaceExtra(extra);
3769 Py_INCREF(Py_None);
3770 _res = Py_None;
3771 return _res;
3772}
3773
3774static PyObject *Qd_DrawChar(_self, _args)
3775 PyObject *_self;
3776 PyObject *_args;
3777{
3778 PyObject *_res = NULL;
Jack Jansen21f96871998-02-20 16:02:09 +00003779 CharParameter ch;
Jack Jansene742a821998-02-25 15:46:50 +00003780 if (!PyArg_ParseTuple(_args, "h",
Jack Jansenb81cf9d1995-06-06 13:08:40 +00003781 &ch))
3782 return NULL;
3783 DrawChar(ch);
3784 Py_INCREF(Py_None);
3785 _res = Py_None;
3786 return _res;
3787}
3788
3789static PyObject *Qd_DrawString(_self, _args)
3790 PyObject *_self;
3791 PyObject *_args;
3792{
3793 PyObject *_res = NULL;
3794 Str255 s;
3795 if (!PyArg_ParseTuple(_args, "O&",
3796 PyMac_GetStr255, s))
3797 return NULL;
3798 DrawString(s);
3799 Py_INCREF(Py_None);
3800 _res = Py_None;
3801 return _res;
3802}
3803
Jack Jansen1c4e6141998-04-21 15:23:55 +00003804static PyObject *Qd_MacDrawText(_self, _args)
Jack Jansenb81cf9d1995-06-06 13:08:40 +00003805 PyObject *_self;
3806 PyObject *_args;
3807{
3808 PyObject *_res = NULL;
3809 char *textBuf__in__;
3810 int textBuf__len__;
3811 int textBuf__in_len__;
3812 short firstByte;
3813 short byteCount;
3814 if (!PyArg_ParseTuple(_args, "s#hh",
3815 &textBuf__in__, &textBuf__in_len__,
3816 &firstByte,
3817 &byteCount))
3818 return NULL;
Jack Jansen1c4e6141998-04-21 15:23:55 +00003819 MacDrawText(textBuf__in__,
3820 firstByte,
3821 byteCount);
Jack Jansenb81cf9d1995-06-06 13:08:40 +00003822 Py_INCREF(Py_None);
3823 _res = Py_None;
3824 textBuf__error__: ;
3825 return _res;
3826}
3827
3828static PyObject *Qd_CharWidth(_self, _args)
3829 PyObject *_self;
3830 PyObject *_args;
3831{
3832 PyObject *_res = NULL;
3833 short _rv;
Jack Jansen21f96871998-02-20 16:02:09 +00003834 CharParameter ch;
Jack Jansene742a821998-02-25 15:46:50 +00003835 if (!PyArg_ParseTuple(_args, "h",
Jack Jansenb81cf9d1995-06-06 13:08:40 +00003836 &ch))
3837 return NULL;
3838 _rv = CharWidth(ch);
3839 _res = Py_BuildValue("h",
3840 _rv);
3841 return _res;
3842}
3843
3844static PyObject *Qd_StringWidth(_self, _args)
3845 PyObject *_self;
3846 PyObject *_args;
3847{
3848 PyObject *_res = NULL;
3849 short _rv;
3850 Str255 s;
3851 if (!PyArg_ParseTuple(_args, "O&",
3852 PyMac_GetStr255, s))
3853 return NULL;
3854 _rv = StringWidth(s);
3855 _res = Py_BuildValue("h",
3856 _rv);
3857 return _res;
3858}
3859
3860static PyObject *Qd_TextWidth(_self, _args)
3861 PyObject *_self;
3862 PyObject *_args;
3863{
3864 PyObject *_res = NULL;
3865 short _rv;
3866 char *textBuf__in__;
3867 int textBuf__len__;
3868 int textBuf__in_len__;
3869 short firstByte;
3870 short byteCount;
3871 if (!PyArg_ParseTuple(_args, "s#hh",
3872 &textBuf__in__, &textBuf__in_len__,
3873 &firstByte,
3874 &byteCount))
3875 return NULL;
3876 _rv = TextWidth(textBuf__in__,
3877 firstByte,
3878 byteCount);
3879 _res = Py_BuildValue("h",
3880 _rv);
3881 textBuf__error__: ;
3882 return _res;
3883}
3884
Jack Jansen3a50f8a1996-01-11 16:17:14 +00003885static PyObject *Qd_GetFontInfo(_self, _args)
3886 PyObject *_self;
3887 PyObject *_args;
3888{
3889 PyObject *_res = NULL;
3890 FontInfo info;
3891 if (!PyArg_ParseTuple(_args, ""))
3892 return NULL;
3893 GetFontInfo(&info);
3894 _res = Py_BuildValue("O&",
3895 QdFI_New, &info);
3896 return _res;
3897}
3898
Jack Jansenb81cf9d1995-06-06 13:08:40 +00003899static PyObject *Qd_CharExtra(_self, _args)
3900 PyObject *_self;
3901 PyObject *_args;
3902{
3903 PyObject *_res = NULL;
Jack Jansen330381c1995-11-15 15:18:01 +00003904 Fixed extra;
3905 if (!PyArg_ParseTuple(_args, "O&",
3906 PyMac_GetFixed, &extra))
Jack Jansenb81cf9d1995-06-06 13:08:40 +00003907 return NULL;
3908 CharExtra(extra);
3909 Py_INCREF(Py_None);
3910 _res = Py_None;
3911 return _res;
3912}
3913
Jack Jansen7f725e41998-04-23 13:21:09 +00003914static PyObject *Qd_SetPort(_self, _args)
3915 PyObject *_self;
3916 PyObject *_args;
3917{
3918 PyObject *_res = NULL;
Jack Jansen29bfea91998-04-27 15:09:36 +00003919 GrafPtr thePort;
Jack Jansen7f725e41998-04-23 13:21:09 +00003920 if (!PyArg_ParseTuple(_args, "O&",
Jack Jansen29bfea91998-04-27 15:09:36 +00003921 GrafObj_Convert, &thePort))
Jack Jansen7f725e41998-04-23 13:21:09 +00003922 return NULL;
3923 SetPort(thePort);
3924 Py_INCREF(Py_None);
3925 _res = Py_None;
3926 return _res;
3927}
3928
Jack Jansene180d991998-04-24 10:28:20 +00003929static PyObject *Qd_GetCursor(_self, _args)
Jack Jansen7f725e41998-04-23 13:21:09 +00003930 PyObject *_self;
3931 PyObject *_args;
3932{
3933 PyObject *_res = NULL;
Jack Jansene180d991998-04-24 10:28:20 +00003934 CursHandle _rv;
3935 short cursorID;
3936 if (!PyArg_ParseTuple(_args, "h",
3937 &cursorID))
Jack Jansen7f725e41998-04-23 13:21:09 +00003938 return NULL;
Jack Jansene180d991998-04-24 10:28:20 +00003939 _rv = GetCursor(cursorID);
3940 _res = Py_BuildValue("O&",
3941 ResObj_New, _rv);
3942 return _res;
3943}
3944
3945static PyObject *Qd_SetCursor(_self, _args)
3946 PyObject *_self;
3947 PyObject *_args;
3948{
3949 PyObject *_res = NULL;
3950 Cursor *crsr__in__;
3951 int crsr__in_len__;
3952 if (!PyArg_ParseTuple(_args, "s#",
3953 (char **)&crsr__in__, &crsr__in_len__))
3954 return NULL;
3955 if (crsr__in_len__ != sizeof(Cursor))
3956 {
3957 PyErr_SetString(PyExc_TypeError, "buffer length should be sizeof(Cursor)");
3958 goto crsr__error__;
3959 }
3960 SetCursor(crsr__in__);
Jack Jansen7f725e41998-04-23 13:21:09 +00003961 Py_INCREF(Py_None);
3962 _res = Py_None;
Jack Jansene180d991998-04-24 10:28:20 +00003963 crsr__error__: ;
3964 return _res;
3965}
3966
3967static PyObject *Qd_ShowCursor(_self, _args)
3968 PyObject *_self;
3969 PyObject *_args;
3970{
3971 PyObject *_res = NULL;
3972 if (!PyArg_ParseTuple(_args, ""))
3973 return NULL;
3974 ShowCursor();
3975 Py_INCREF(Py_None);
3976 _res = Py_None;
3977 return _res;
3978}
3979
3980static PyObject *Qd_LineTo(_self, _args)
3981 PyObject *_self;
3982 PyObject *_args;
3983{
3984 PyObject *_res = NULL;
3985 short h;
3986 short v;
3987 if (!PyArg_ParseTuple(_args, "hh",
3988 &h,
3989 &v))
3990 return NULL;
3991 LineTo(h,
3992 v);
3993 Py_INCREF(Py_None);
3994 _res = Py_None;
3995 return _res;
3996}
3997
3998static PyObject *Qd_SetRect(_self, _args)
3999 PyObject *_self;
4000 PyObject *_args;
4001{
4002 PyObject *_res = NULL;
4003 Rect r;
4004 short left;
4005 short top;
4006 short right;
4007 short bottom;
4008 if (!PyArg_ParseTuple(_args, "hhhh",
4009 &left,
4010 &top,
4011 &right,
4012 &bottom))
4013 return NULL;
4014 SetRect(&r,
4015 left,
4016 top,
4017 right,
4018 bottom);
4019 _res = Py_BuildValue("O&",
4020 PyMac_BuildRect, &r);
4021 return _res;
4022}
4023
4024static PyObject *Qd_OffsetRect(_self, _args)
4025 PyObject *_self;
4026 PyObject *_args;
4027{
4028 PyObject *_res = NULL;
4029 Rect r;
4030 short dh;
4031 short dv;
4032 if (!PyArg_ParseTuple(_args, "O&hh",
4033 PyMac_GetRect, &r,
4034 &dh,
4035 &dv))
4036 return NULL;
4037 OffsetRect(&r,
4038 dh,
4039 dv);
4040 _res = Py_BuildValue("O&",
4041 PyMac_BuildRect, &r);
4042 return _res;
4043}
4044
4045static PyObject *Qd_InsetRect(_self, _args)
4046 PyObject *_self;
4047 PyObject *_args;
4048{
4049 PyObject *_res = NULL;
4050 Rect r;
4051 short dh;
4052 short dv;
4053 if (!PyArg_ParseTuple(_args, "O&hh",
4054 PyMac_GetRect, &r,
4055 &dh,
4056 &dv))
4057 return NULL;
4058 InsetRect(&r,
4059 dh,
4060 dv);
4061 _res = Py_BuildValue("O&",
4062 PyMac_BuildRect, &r);
4063 return _res;
4064}
4065
4066static PyObject *Qd_UnionRect(_self, _args)
4067 PyObject *_self;
4068 PyObject *_args;
4069{
4070 PyObject *_res = NULL;
4071 Rect src1;
4072 Rect src2;
4073 Rect dstRect;
4074 if (!PyArg_ParseTuple(_args, "O&O&",
4075 PyMac_GetRect, &src1,
4076 PyMac_GetRect, &src2))
4077 return NULL;
4078 UnionRect(&src1,
4079 &src2,
4080 &dstRect);
4081 _res = Py_BuildValue("O&",
4082 PyMac_BuildRect, &dstRect);
4083 return _res;
4084}
4085
4086static PyObject *Qd_EqualRect(_self, _args)
4087 PyObject *_self;
4088 PyObject *_args;
4089{
4090 PyObject *_res = NULL;
4091 Boolean _rv;
4092 Rect rect1;
4093 Rect rect2;
4094 if (!PyArg_ParseTuple(_args, "O&O&",
4095 PyMac_GetRect, &rect1,
4096 PyMac_GetRect, &rect2))
4097 return NULL;
4098 _rv = EqualRect(&rect1,
4099 &rect2);
4100 _res = Py_BuildValue("b",
4101 _rv);
4102 return _res;
4103}
4104
4105static PyObject *Qd_FrameRect(_self, _args)
4106 PyObject *_self;
4107 PyObject *_args;
4108{
4109 PyObject *_res = NULL;
4110 Rect r;
4111 if (!PyArg_ParseTuple(_args, "O&",
4112 PyMac_GetRect, &r))
4113 return NULL;
4114 FrameRect(&r);
4115 Py_INCREF(Py_None);
4116 _res = Py_None;
4117 return _res;
4118}
4119
4120static PyObject *Qd_InvertRect(_self, _args)
4121 PyObject *_self;
4122 PyObject *_args;
4123{
4124 PyObject *_res = NULL;
4125 Rect r;
4126 if (!PyArg_ParseTuple(_args, "O&",
4127 PyMac_GetRect, &r))
4128 return NULL;
4129 InvertRect(&r);
4130 Py_INCREF(Py_None);
4131 _res = Py_None;
4132 return _res;
4133}
4134
4135static PyObject *Qd_FillRect(_self, _args)
4136 PyObject *_self;
4137 PyObject *_args;
4138{
4139 PyObject *_res = NULL;
4140 Rect r;
4141 Pattern *pat__in__;
4142 int pat__in_len__;
4143 if (!PyArg_ParseTuple(_args, "O&s#",
4144 PyMac_GetRect, &r,
4145 (char **)&pat__in__, &pat__in_len__))
4146 return NULL;
4147 if (pat__in_len__ != sizeof(Pattern))
4148 {
4149 PyErr_SetString(PyExc_TypeError, "buffer length should be sizeof(Pattern)");
4150 goto pat__error__;
4151 }
4152 FillRect(&r,
4153 pat__in__);
4154 Py_INCREF(Py_None);
4155 _res = Py_None;
4156 pat__error__: ;
4157 return _res;
4158}
4159
4160static PyObject *Qd_CopyRgn(_self, _args)
4161 PyObject *_self;
4162 PyObject *_args;
4163{
4164 PyObject *_res = NULL;
4165 RgnHandle srcRgn;
4166 RgnHandle dstRgn;
4167 if (!PyArg_ParseTuple(_args, "O&O&",
4168 ResObj_Convert, &srcRgn,
4169 ResObj_Convert, &dstRgn))
4170 return NULL;
4171 CopyRgn(srcRgn,
4172 dstRgn);
4173 Py_INCREF(Py_None);
4174 _res = Py_None;
4175 return _res;
4176}
4177
4178static PyObject *Qd_SetRectRgn(_self, _args)
4179 PyObject *_self;
4180 PyObject *_args;
4181{
4182 PyObject *_res = NULL;
4183 RgnHandle rgn;
4184 short left;
4185 short top;
4186 short right;
4187 short bottom;
4188 if (!PyArg_ParseTuple(_args, "O&hhhh",
4189 ResObj_Convert, &rgn,
4190 &left,
4191 &top,
4192 &right,
4193 &bottom))
4194 return NULL;
4195 SetRectRgn(rgn,
4196 left,
4197 top,
4198 right,
4199 bottom);
4200 Py_INCREF(Py_None);
4201 _res = Py_None;
4202 return _res;
4203}
4204
4205static PyObject *Qd_OffsetRgn(_self, _args)
4206 PyObject *_self;
4207 PyObject *_args;
4208{
4209 PyObject *_res = NULL;
4210 RgnHandle rgn;
4211 short dh;
4212 short dv;
4213 if (!PyArg_ParseTuple(_args, "O&hh",
4214 ResObj_Convert, &rgn,
4215 &dh,
4216 &dv))
4217 return NULL;
4218 OffsetRgn(rgn,
4219 dh,
4220 dv);
4221 Py_INCREF(Py_None);
4222 _res = Py_None;
4223 return _res;
4224}
4225
4226static PyObject *Qd_UnionRgn(_self, _args)
4227 PyObject *_self;
4228 PyObject *_args;
4229{
4230 PyObject *_res = NULL;
4231 RgnHandle srcRgnA;
4232 RgnHandle srcRgnB;
4233 RgnHandle dstRgn;
4234 if (!PyArg_ParseTuple(_args, "O&O&O&",
4235 ResObj_Convert, &srcRgnA,
4236 ResObj_Convert, &srcRgnB,
4237 ResObj_Convert, &dstRgn))
4238 return NULL;
4239 UnionRgn(srcRgnA,
4240 srcRgnB,
4241 dstRgn);
4242 Py_INCREF(Py_None);
4243 _res = Py_None;
4244 return _res;
4245}
4246
4247static PyObject *Qd_XorRgn(_self, _args)
4248 PyObject *_self;
4249 PyObject *_args;
4250{
4251 PyObject *_res = NULL;
4252 RgnHandle srcRgnA;
4253 RgnHandle srcRgnB;
4254 RgnHandle dstRgn;
4255 if (!PyArg_ParseTuple(_args, "O&O&O&",
4256 ResObj_Convert, &srcRgnA,
4257 ResObj_Convert, &srcRgnB,
4258 ResObj_Convert, &dstRgn))
4259 return NULL;
4260 XorRgn(srcRgnA,
4261 srcRgnB,
4262 dstRgn);
4263 Py_INCREF(Py_None);
4264 _res = Py_None;
4265 return _res;
4266}
4267
4268static PyObject *Qd_EqualRgn(_self, _args)
4269 PyObject *_self;
4270 PyObject *_args;
4271{
4272 PyObject *_res = NULL;
4273 Boolean _rv;
4274 RgnHandle rgnA;
4275 RgnHandle rgnB;
4276 if (!PyArg_ParseTuple(_args, "O&O&",
4277 ResObj_Convert, &rgnA,
4278 ResObj_Convert, &rgnB))
4279 return NULL;
4280 _rv = EqualRgn(rgnA,
4281 rgnB);
4282 _res = Py_BuildValue("b",
4283 _rv);
4284 return _res;
4285}
4286
4287static PyObject *Qd_FrameRgn(_self, _args)
4288 PyObject *_self;
4289 PyObject *_args;
4290{
4291 PyObject *_res = NULL;
4292 RgnHandle rgn;
4293 if (!PyArg_ParseTuple(_args, "O&",
4294 ResObj_Convert, &rgn))
4295 return NULL;
4296 FrameRgn(rgn);
4297 Py_INCREF(Py_None);
4298 _res = Py_None;
4299 return _res;
4300}
4301
4302static PyObject *Qd_PaintRgn(_self, _args)
4303 PyObject *_self;
4304 PyObject *_args;
4305{
4306 PyObject *_res = NULL;
4307 RgnHandle rgn;
4308 if (!PyArg_ParseTuple(_args, "O&",
4309 ResObj_Convert, &rgn))
4310 return NULL;
4311 PaintRgn(rgn);
4312 Py_INCREF(Py_None);
4313 _res = Py_None;
4314 return _res;
4315}
4316
4317static PyObject *Qd_InvertRgn(_self, _args)
4318 PyObject *_self;
4319 PyObject *_args;
4320{
4321 PyObject *_res = NULL;
4322 RgnHandle rgn;
4323 if (!PyArg_ParseTuple(_args, "O&",
4324 ResObj_Convert, &rgn))
4325 return NULL;
4326 InvertRgn(rgn);
4327 Py_INCREF(Py_None);
4328 _res = Py_None;
4329 return _res;
4330}
4331
4332static PyObject *Qd_FillRgn(_self, _args)
4333 PyObject *_self;
4334 PyObject *_args;
4335{
4336 PyObject *_res = NULL;
4337 RgnHandle rgn;
4338 Pattern *pat__in__;
4339 int pat__in_len__;
4340 if (!PyArg_ParseTuple(_args, "O&s#",
4341 ResObj_Convert, &rgn,
4342 (char **)&pat__in__, &pat__in_len__))
4343 return NULL;
4344 if (pat__in_len__ != sizeof(Pattern))
4345 {
4346 PyErr_SetString(PyExc_TypeError, "buffer length should be sizeof(Pattern)");
4347 goto pat__error__;
4348 }
4349 FillRgn(rgn,
4350 pat__in__);
4351 Py_INCREF(Py_None);
4352 _res = Py_None;
4353 pat__error__: ;
4354 return _res;
4355}
4356
4357static PyObject *Qd_GetPixel(_self, _args)
4358 PyObject *_self;
4359 PyObject *_args;
4360{
4361 PyObject *_res = NULL;
4362 Boolean _rv;
4363 short h;
4364 short v;
4365 if (!PyArg_ParseTuple(_args, "hh",
4366 &h,
4367 &v))
4368 return NULL;
4369 _rv = GetPixel(h,
4370 v);
4371 _res = Py_BuildValue("b",
4372 _rv);
4373 return _res;
4374}
4375
4376static PyObject *Qd_PtInRect(_self, _args)
4377 PyObject *_self;
4378 PyObject *_args;
4379{
4380 PyObject *_res = NULL;
4381 Boolean _rv;
4382 Point pt;
4383 Rect r;
4384 if (!PyArg_ParseTuple(_args, "O&O&",
4385 PyMac_GetPoint, &pt,
4386 PyMac_GetRect, &r))
4387 return NULL;
4388 _rv = PtInRect(pt,
4389 &r);
4390 _res = Py_BuildValue("b",
4391 _rv);
4392 return _res;
4393}
4394
4395static PyObject *Qd_DrawText(_self, _args)
4396 PyObject *_self;
4397 PyObject *_args;
4398{
4399 PyObject *_res = NULL;
4400 char *textBuf__in__;
4401 int textBuf__len__;
4402 int textBuf__in_len__;
4403 short firstByte;
4404 short byteCount;
4405 if (!PyArg_ParseTuple(_args, "s#hh",
4406 &textBuf__in__, &textBuf__in_len__,
4407 &firstByte,
4408 &byteCount))
4409 return NULL;
4410 DrawText(textBuf__in__,
4411 firstByte,
4412 byteCount);
4413 Py_INCREF(Py_None);
4414 _res = Py_None;
4415 textBuf__error__: ;
Jack Jansen7f725e41998-04-23 13:21:09 +00004416 return _res;
4417}
4418
Jack Jansen41058c01995-11-16 22:48:29 +00004419static PyObject *Qd_BitMap(_self, _args)
4420 PyObject *_self;
4421 PyObject *_args;
4422{
4423 PyObject *_res = NULL;
4424
4425 BitMap *ptr;
4426 PyObject *source;
4427 Rect bounds;
4428 int rowbytes;
4429 char *data;
4430
4431 if ( !PyArg_ParseTuple(_args, "O!iO&", &PyString_Type, &source, &rowbytes, PyMac_GetRect,
4432 &bounds) )
4433 return NULL;
4434 data = PyString_AsString(source);
4435 if ((ptr=(BitMap *)malloc(sizeof(BitMap))) == NULL )
4436 return PyErr_NoMemory();
4437 ptr->baseAddr = (Ptr)data;
4438 ptr->rowBytes = rowbytes;
4439 ptr->bounds = bounds;
4440 if ( (_res = BMObj_New(ptr)) == NULL ) {
4441 free(ptr);
4442 return NULL;
4443 }
4444 ((BitMapObject *)_res)->referred_object = source;
4445 Py_INCREF(source);
4446 ((BitMapObject *)_res)->referred_bitmap = ptr;
4447 return _res;
4448
4449}
4450
Jack Jansen425e9eb1995-12-12 15:02:03 +00004451static PyObject *Qd_RawBitMap(_self, _args)
4452 PyObject *_self;
4453 PyObject *_args;
4454{
4455 PyObject *_res = NULL;
4456
4457 BitMap *ptr;
4458 PyObject *source;
4459
4460 if ( !PyArg_ParseTuple(_args, "O!", &PyString_Type, &source) )
4461 return NULL;
4462 if ( PyString_Size(source) != sizeof(BitMap) && PyString_Size(source) != sizeof(PixMap) ) {
4463 PyErr_BadArgument();
4464 return NULL;
4465 }
4466 ptr = (BitMapPtr)PyString_AsString(source);
4467 if ( (_res = BMObj_New(ptr)) == NULL ) {
4468 return NULL;
4469 }
4470 ((BitMapObject *)_res)->referred_object = source;
4471 Py_INCREF(source);
4472 return _res;
4473
4474}
4475
Guido van Rossum17448e21995-01-30 11:53:55 +00004476static PyMethodDef Qd_methods[] = {
Jack Jansen1c4e6141998-04-21 15:23:55 +00004477 {"MacSetPort", (PyCFunction)Qd_MacSetPort, 1,
Jack Jansen330381c1995-11-15 15:18:01 +00004478 "(GrafPtr port) -> None"},
Guido van Rossume56db431995-03-19 22:49:50 +00004479 {"GetPort", (PyCFunction)Qd_GetPort, 1,
Jack Jansen330381c1995-11-15 15:18:01 +00004480 "() -> (GrafPtr port)"},
Guido van Rossume56db431995-03-19 22:49:50 +00004481 {"GrafDevice", (PyCFunction)Qd_GrafDevice, 1,
4482 "(short device) -> None"},
Jack Jansen41058c01995-11-16 22:48:29 +00004483 {"SetPortBits", (PyCFunction)Qd_SetPortBits, 1,
4484 "(BitMapPtr bm) -> None"},
Guido van Rossume56db431995-03-19 22:49:50 +00004485 {"PortSize", (PyCFunction)Qd_PortSize, 1,
4486 "(short width, short height) -> None"},
4487 {"MovePortTo", (PyCFunction)Qd_MovePortTo, 1,
4488 "(short leftGlobal, short topGlobal) -> None"},
4489 {"SetOrigin", (PyCFunction)Qd_SetOrigin, 1,
4490 "(short h, short v) -> None"},
4491 {"SetClip", (PyCFunction)Qd_SetClip, 1,
4492 "(RgnHandle rgn) -> None"},
4493 {"GetClip", (PyCFunction)Qd_GetClip, 1,
4494 "(RgnHandle rgn) -> None"},
Guido van Rossum17448e21995-01-30 11:53:55 +00004495 {"ClipRect", (PyCFunction)Qd_ClipRect, 1,
4496 "(Rect r) -> None"},
Jack Jansen04a02e71996-01-06 17:12:58 +00004497 {"BackPat", (PyCFunction)Qd_BackPat, 1,
4498 "(Pattern pat) -> None"},
Guido van Rossume56db431995-03-19 22:49:50 +00004499 {"InitCursor", (PyCFunction)Qd_InitCursor, 1,
4500 "() -> None"},
Jack Jansen1c4e6141998-04-21 15:23:55 +00004501 {"MacSetCursor", (PyCFunction)Qd_MacSetCursor, 1,
Jack Jansenb5394061996-01-05 18:06:41 +00004502 "(Cursor crsr) -> None"},
Guido van Rossume56db431995-03-19 22:49:50 +00004503 {"HideCursor", (PyCFunction)Qd_HideCursor, 1,
4504 "() -> None"},
Jack Jansen1c4e6141998-04-21 15:23:55 +00004505 {"MacShowCursor", (PyCFunction)Qd_MacShowCursor, 1,
Guido van Rossume56db431995-03-19 22:49:50 +00004506 "() -> None"},
4507 {"ObscureCursor", (PyCFunction)Qd_ObscureCursor, 1,
4508 "() -> None"},
4509 {"HidePen", (PyCFunction)Qd_HidePen, 1,
4510 "() -> None"},
4511 {"ShowPen", (PyCFunction)Qd_ShowPen, 1,
4512 "() -> None"},
4513 {"GetPen", (PyCFunction)Qd_GetPen, 1,
Jack Jansen1d8ede71996-01-08 23:47:31 +00004514 "() -> (Point pt)"},
Jack Jansen04a02e71996-01-06 17:12:58 +00004515 {"GetPenState", (PyCFunction)Qd_GetPenState, 1,
4516 "() -> (PenState pnState)"},
4517 {"SetPenState", (PyCFunction)Qd_SetPenState, 1,
4518 "(PenState pnState) -> None"},
Guido van Rossume56db431995-03-19 22:49:50 +00004519 {"PenSize", (PyCFunction)Qd_PenSize, 1,
4520 "(short width, short height) -> None"},
4521 {"PenMode", (PyCFunction)Qd_PenMode, 1,
4522 "(short mode) -> None"},
Jack Jansen04a02e71996-01-06 17:12:58 +00004523 {"PenPat", (PyCFunction)Qd_PenPat, 1,
4524 "(Pattern pat) -> None"},
Guido van Rossume56db431995-03-19 22:49:50 +00004525 {"PenNormal", (PyCFunction)Qd_PenNormal, 1,
4526 "() -> None"},
4527 {"MoveTo", (PyCFunction)Qd_MoveTo, 1,
4528 "(short h, short v) -> None"},
4529 {"Move", (PyCFunction)Qd_Move, 1,
4530 "(short dh, short dv) -> None"},
Jack Jansen1c4e6141998-04-21 15:23:55 +00004531 {"MacLineTo", (PyCFunction)Qd_MacLineTo, 1,
Guido van Rossume56db431995-03-19 22:49:50 +00004532 "(short h, short v) -> None"},
4533 {"Line", (PyCFunction)Qd_Line, 1,
4534 "(short dh, short dv) -> None"},
Guido van Rossume56db431995-03-19 22:49:50 +00004535 {"ForeColor", (PyCFunction)Qd_ForeColor, 1,
4536 "(long color) -> None"},
4537 {"BackColor", (PyCFunction)Qd_BackColor, 1,
4538 "(long color) -> None"},
4539 {"ColorBit", (PyCFunction)Qd_ColorBit, 1,
4540 "(short whichBit) -> None"},
Jack Jansen1c4e6141998-04-21 15:23:55 +00004541 {"MacSetRect", (PyCFunction)Qd_MacSetRect, 1,
Guido van Rossume56db431995-03-19 22:49:50 +00004542 "(short left, short top, short right, short bottom) -> (Rect r)"},
Jack Jansen1c4e6141998-04-21 15:23:55 +00004543 {"MacOffsetRect", (PyCFunction)Qd_MacOffsetRect, 1,
Jack Jansen54c8f7e1995-11-14 10:46:01 +00004544 "(Rect r, short dh, short dv) -> (Rect r)"},
Jack Jansen1c4e6141998-04-21 15:23:55 +00004545 {"MacInsetRect", (PyCFunction)Qd_MacInsetRect, 1,
Jack Jansen54c8f7e1995-11-14 10:46:01 +00004546 "(Rect r, short dh, short dv) -> (Rect r)"},
Guido van Rossume56db431995-03-19 22:49:50 +00004547 {"SectRect", (PyCFunction)Qd_SectRect, 1,
4548 "(Rect src1, Rect src2) -> (Boolean _rv, Rect dstRect)"},
Jack Jansen1c4e6141998-04-21 15:23:55 +00004549 {"MacUnionRect", (PyCFunction)Qd_MacUnionRect, 1,
Guido van Rossume56db431995-03-19 22:49:50 +00004550 "(Rect src1, Rect src2) -> (Rect dstRect)"},
Jack Jansen1c4e6141998-04-21 15:23:55 +00004551 {"MacEqualRect", (PyCFunction)Qd_MacEqualRect, 1,
Guido van Rossume56db431995-03-19 22:49:50 +00004552 "(Rect rect1, Rect rect2) -> (Boolean _rv)"},
4553 {"EmptyRect", (PyCFunction)Qd_EmptyRect, 1,
4554 "(Rect r) -> (Boolean _rv)"},
Jack Jansen1c4e6141998-04-21 15:23:55 +00004555 {"MacFrameRect", (PyCFunction)Qd_MacFrameRect, 1,
Guido van Rossume56db431995-03-19 22:49:50 +00004556 "(Rect r) -> None"},
4557 {"PaintRect", (PyCFunction)Qd_PaintRect, 1,
4558 "(Rect r) -> None"},
Guido van Rossum17448e21995-01-30 11:53:55 +00004559 {"EraseRect", (PyCFunction)Qd_EraseRect, 1,
4560 "(Rect r) -> None"},
Jack Jansen1c4e6141998-04-21 15:23:55 +00004561 {"MacInvertRect", (PyCFunction)Qd_MacInvertRect, 1,
Guido van Rossume56db431995-03-19 22:49:50 +00004562 "(Rect r) -> None"},
Jack Jansen1c4e6141998-04-21 15:23:55 +00004563 {"MacFillRect", (PyCFunction)Qd_MacFillRect, 1,
Jack Jansen04a02e71996-01-06 17:12:58 +00004564 "(Rect r, Pattern pat) -> None"},
Guido van Rossume56db431995-03-19 22:49:50 +00004565 {"FrameOval", (PyCFunction)Qd_FrameOval, 1,
4566 "(Rect r) -> None"},
4567 {"PaintOval", (PyCFunction)Qd_PaintOval, 1,
4568 "(Rect r) -> None"},
4569 {"EraseOval", (PyCFunction)Qd_EraseOval, 1,
4570 "(Rect r) -> None"},
4571 {"InvertOval", (PyCFunction)Qd_InvertOval, 1,
4572 "(Rect r) -> None"},
Jack Jansen04a02e71996-01-06 17:12:58 +00004573 {"FillOval", (PyCFunction)Qd_FillOval, 1,
4574 "(Rect r, Pattern pat) -> None"},
Guido van Rossume56db431995-03-19 22:49:50 +00004575 {"FrameRoundRect", (PyCFunction)Qd_FrameRoundRect, 1,
4576 "(Rect r, short ovalWidth, short ovalHeight) -> None"},
4577 {"PaintRoundRect", (PyCFunction)Qd_PaintRoundRect, 1,
4578 "(Rect r, short ovalWidth, short ovalHeight) -> None"},
4579 {"EraseRoundRect", (PyCFunction)Qd_EraseRoundRect, 1,
4580 "(Rect r, short ovalWidth, short ovalHeight) -> None"},
4581 {"InvertRoundRect", (PyCFunction)Qd_InvertRoundRect, 1,
4582 "(Rect r, short ovalWidth, short ovalHeight) -> None"},
Jack Jansen04a02e71996-01-06 17:12:58 +00004583 {"FillRoundRect", (PyCFunction)Qd_FillRoundRect, 1,
4584 "(Rect r, short ovalWidth, short ovalHeight, Pattern pat) -> None"},
Guido van Rossume56db431995-03-19 22:49:50 +00004585 {"FrameArc", (PyCFunction)Qd_FrameArc, 1,
4586 "(Rect r, short startAngle, short arcAngle) -> None"},
4587 {"PaintArc", (PyCFunction)Qd_PaintArc, 1,
4588 "(Rect r, short startAngle, short arcAngle) -> None"},
4589 {"EraseArc", (PyCFunction)Qd_EraseArc, 1,
4590 "(Rect r, short startAngle, short arcAngle) -> None"},
4591 {"InvertArc", (PyCFunction)Qd_InvertArc, 1,
4592 "(Rect r, short startAngle, short arcAngle) -> None"},
Jack Jansen04a02e71996-01-06 17:12:58 +00004593 {"FillArc", (PyCFunction)Qd_FillArc, 1,
4594 "(Rect r, short startAngle, short arcAngle, Pattern pat) -> None"},
Guido van Rossume56db431995-03-19 22:49:50 +00004595 {"NewRgn", (PyCFunction)Qd_NewRgn, 1,
4596 "() -> (RgnHandle _rv)"},
4597 {"OpenRgn", (PyCFunction)Qd_OpenRgn, 1,
4598 "() -> None"},
4599 {"CloseRgn", (PyCFunction)Qd_CloseRgn, 1,
4600 "(RgnHandle dstRgn) -> None"},
Jack Jansen41058c01995-11-16 22:48:29 +00004601 {"BitMapToRegion", (PyCFunction)Qd_BitMapToRegion, 1,
4602 "(RgnHandle region, BitMapPtr bMap) -> None"},
Guido van Rossume56db431995-03-19 22:49:50 +00004603 {"DisposeRgn", (PyCFunction)Qd_DisposeRgn, 1,
4604 "(RgnHandle rgn) -> None"},
Jack Jansen1c4e6141998-04-21 15:23:55 +00004605 {"MacCopyRgn", (PyCFunction)Qd_MacCopyRgn, 1,
Guido van Rossume56db431995-03-19 22:49:50 +00004606 "(RgnHandle srcRgn, RgnHandle dstRgn) -> None"},
4607 {"SetEmptyRgn", (PyCFunction)Qd_SetEmptyRgn, 1,
4608 "(RgnHandle rgn) -> None"},
Jack Jansen1c4e6141998-04-21 15:23:55 +00004609 {"MacSetRectRgn", (PyCFunction)Qd_MacSetRectRgn, 1,
Guido van Rossume56db431995-03-19 22:49:50 +00004610 "(RgnHandle rgn, short left, short top, short right, short bottom) -> None"},
4611 {"RectRgn", (PyCFunction)Qd_RectRgn, 1,
4612 "(RgnHandle rgn, Rect r) -> None"},
Jack Jansen1c4e6141998-04-21 15:23:55 +00004613 {"MacOffsetRgn", (PyCFunction)Qd_MacOffsetRgn, 1,
Guido van Rossume56db431995-03-19 22:49:50 +00004614 "(RgnHandle rgn, short dh, short dv) -> None"},
4615 {"InsetRgn", (PyCFunction)Qd_InsetRgn, 1,
4616 "(RgnHandle rgn, short dh, short dv) -> None"},
4617 {"SectRgn", (PyCFunction)Qd_SectRgn, 1,
4618 "(RgnHandle srcRgnA, RgnHandle srcRgnB, RgnHandle dstRgn) -> None"},
Jack Jansen1c4e6141998-04-21 15:23:55 +00004619 {"MacUnionRgn", (PyCFunction)Qd_MacUnionRgn, 1,
Guido van Rossume56db431995-03-19 22:49:50 +00004620 "(RgnHandle srcRgnA, RgnHandle srcRgnB, RgnHandle dstRgn) -> None"},
4621 {"DiffRgn", (PyCFunction)Qd_DiffRgn, 1,
4622 "(RgnHandle srcRgnA, RgnHandle srcRgnB, RgnHandle dstRgn) -> None"},
Jack Jansen1c4e6141998-04-21 15:23:55 +00004623 {"MacXorRgn", (PyCFunction)Qd_MacXorRgn, 1,
Guido van Rossume56db431995-03-19 22:49:50 +00004624 "(RgnHandle srcRgnA, RgnHandle srcRgnB, RgnHandle dstRgn) -> None"},
4625 {"RectInRgn", (PyCFunction)Qd_RectInRgn, 1,
4626 "(Rect r, RgnHandle rgn) -> (Boolean _rv)"},
Jack Jansen1c4e6141998-04-21 15:23:55 +00004627 {"MacEqualRgn", (PyCFunction)Qd_MacEqualRgn, 1,
Guido van Rossume56db431995-03-19 22:49:50 +00004628 "(RgnHandle rgnA, RgnHandle rgnB) -> (Boolean _rv)"},
4629 {"EmptyRgn", (PyCFunction)Qd_EmptyRgn, 1,
4630 "(RgnHandle rgn) -> (Boolean _rv)"},
Jack Jansen1c4e6141998-04-21 15:23:55 +00004631 {"MacFrameRgn", (PyCFunction)Qd_MacFrameRgn, 1,
Guido van Rossume56db431995-03-19 22:49:50 +00004632 "(RgnHandle rgn) -> None"},
Jack Jansen1c4e6141998-04-21 15:23:55 +00004633 {"MacPaintRgn", (PyCFunction)Qd_MacPaintRgn, 1,
Guido van Rossume56db431995-03-19 22:49:50 +00004634 "(RgnHandle rgn) -> None"},
4635 {"EraseRgn", (PyCFunction)Qd_EraseRgn, 1,
4636 "(RgnHandle rgn) -> None"},
Jack Jansen1c4e6141998-04-21 15:23:55 +00004637 {"MacInvertRgn", (PyCFunction)Qd_MacInvertRgn, 1,
Guido van Rossume56db431995-03-19 22:49:50 +00004638 "(RgnHandle rgn) -> None"},
Jack Jansen1c4e6141998-04-21 15:23:55 +00004639 {"MacFillRgn", (PyCFunction)Qd_MacFillRgn, 1,
Jack Jansen04a02e71996-01-06 17:12:58 +00004640 "(RgnHandle rgn, Pattern pat) -> None"},
Guido van Rossume56db431995-03-19 22:49:50 +00004641 {"ScrollRect", (PyCFunction)Qd_ScrollRect, 1,
4642 "(Rect r, short dh, short dv, RgnHandle updateRgn) -> None"},
Jack Jansen41058c01995-11-16 22:48:29 +00004643 {"CopyBits", (PyCFunction)Qd_CopyBits, 1,
4644 "(BitMapPtr srcBits, BitMapPtr dstBits, Rect srcRect, Rect dstRect, short mode, RgnHandle maskRgn) -> None"},
4645 {"CopyMask", (PyCFunction)Qd_CopyMask, 1,
4646 "(BitMapPtr srcBits, BitMapPtr maskBits, BitMapPtr dstBits, Rect srcRect, Rect maskRect, Rect dstRect) -> None"},
Guido van Rossume56db431995-03-19 22:49:50 +00004647 {"OpenPicture", (PyCFunction)Qd_OpenPicture, 1,
4648 "(Rect picFrame) -> (PicHandle _rv)"},
4649 {"PicComment", (PyCFunction)Qd_PicComment, 1,
4650 "(short kind, short dataSize, Handle dataHandle) -> None"},
4651 {"ClosePicture", (PyCFunction)Qd_ClosePicture, 1,
4652 "() -> None"},
4653 {"DrawPicture", (PyCFunction)Qd_DrawPicture, 1,
4654 "(PicHandle myPicture, Rect dstRect) -> None"},
4655 {"KillPicture", (PyCFunction)Qd_KillPicture, 1,
4656 "(PicHandle myPicture) -> None"},
4657 {"OpenPoly", (PyCFunction)Qd_OpenPoly, 1,
4658 "() -> (PolyHandle _rv)"},
4659 {"ClosePoly", (PyCFunction)Qd_ClosePoly, 1,
4660 "() -> None"},
4661 {"KillPoly", (PyCFunction)Qd_KillPoly, 1,
4662 "(PolyHandle poly) -> None"},
4663 {"OffsetPoly", (PyCFunction)Qd_OffsetPoly, 1,
4664 "(PolyHandle poly, short dh, short dv) -> None"},
4665 {"FramePoly", (PyCFunction)Qd_FramePoly, 1,
4666 "(PolyHandle poly) -> None"},
4667 {"PaintPoly", (PyCFunction)Qd_PaintPoly, 1,
4668 "(PolyHandle poly) -> None"},
4669 {"ErasePoly", (PyCFunction)Qd_ErasePoly, 1,
4670 "(PolyHandle poly) -> None"},
4671 {"InvertPoly", (PyCFunction)Qd_InvertPoly, 1,
4672 "(PolyHandle poly) -> None"},
Jack Jansen04a02e71996-01-06 17:12:58 +00004673 {"FillPoly", (PyCFunction)Qd_FillPoly, 1,
4674 "(PolyHandle poly, Pattern pat) -> None"},
Guido van Rossume56db431995-03-19 22:49:50 +00004675 {"SetPt", (PyCFunction)Qd_SetPt, 1,
Jack Jansen1d8ede71996-01-08 23:47:31 +00004676 "(short h, short v) -> (Point pt)"},
Guido van Rossume56db431995-03-19 22:49:50 +00004677 {"LocalToGlobal", (PyCFunction)Qd_LocalToGlobal, 1,
4678 "(Point pt) -> (Point pt)"},
4679 {"GlobalToLocal", (PyCFunction)Qd_GlobalToLocal, 1,
4680 "(Point pt) -> (Point pt)"},
4681 {"Random", (PyCFunction)Qd_Random, 1,
4682 "() -> (short _rv)"},
Jack Jansen1c4e6141998-04-21 15:23:55 +00004683 {"MacGetPixel", (PyCFunction)Qd_MacGetPixel, 1,
Guido van Rossume56db431995-03-19 22:49:50 +00004684 "(short h, short v) -> (Boolean _rv)"},
4685 {"ScalePt", (PyCFunction)Qd_ScalePt, 1,
4686 "(Point pt, Rect srcRect, Rect dstRect) -> (Point pt)"},
4687 {"MapPt", (PyCFunction)Qd_MapPt, 1,
4688 "(Point pt, Rect srcRect, Rect dstRect) -> (Point pt)"},
4689 {"MapRect", (PyCFunction)Qd_MapRect, 1,
Jack Jansen54c8f7e1995-11-14 10:46:01 +00004690 "(Rect r, Rect srcRect, Rect dstRect) -> (Rect r)"},
Guido van Rossume56db431995-03-19 22:49:50 +00004691 {"MapRgn", (PyCFunction)Qd_MapRgn, 1,
4692 "(RgnHandle rgn, Rect srcRect, Rect dstRect) -> None"},
4693 {"MapPoly", (PyCFunction)Qd_MapPoly, 1,
4694 "(PolyHandle poly, Rect srcRect, Rect dstRect) -> None"},
Jack Jansen41058c01995-11-16 22:48:29 +00004695 {"StdBits", (PyCFunction)Qd_StdBits, 1,
4696 "(BitMapPtr srcBits, Rect srcRect, Rect dstRect, short mode, RgnHandle maskRgn) -> None"},
Guido van Rossume56db431995-03-19 22:49:50 +00004697 {"AddPt", (PyCFunction)Qd_AddPt, 1,
4698 "(Point src, Point dst) -> (Point dst)"},
4699 {"EqualPt", (PyCFunction)Qd_EqualPt, 1,
4700 "(Point pt1, Point pt2) -> (Boolean _rv)"},
Jack Jansen1c4e6141998-04-21 15:23:55 +00004701 {"MacPtInRect", (PyCFunction)Qd_MacPtInRect, 1,
Guido van Rossume56db431995-03-19 22:49:50 +00004702 "(Point pt, Rect r) -> (Boolean _rv)"},
4703 {"Pt2Rect", (PyCFunction)Qd_Pt2Rect, 1,
4704 "(Point pt1, Point pt2) -> (Rect dstRect)"},
4705 {"PtToAngle", (PyCFunction)Qd_PtToAngle, 1,
4706 "(Rect r, Point pt) -> (short angle)"},
Jack Jansenb81cf9d1995-06-06 13:08:40 +00004707 {"SubPt", (PyCFunction)Qd_SubPt, 1,
4708 "(Point src, Point dst) -> (Point dst)"},
Guido van Rossume56db431995-03-19 22:49:50 +00004709 {"PtInRgn", (PyCFunction)Qd_PtInRgn, 1,
4710 "(Point pt, RgnHandle rgn) -> (Boolean _rv)"},
4711 {"NewPixMap", (PyCFunction)Qd_NewPixMap, 1,
4712 "() -> (PixMapHandle _rv)"},
Guido van Rossume56db431995-03-19 22:49:50 +00004713 {"DisposePixMap", (PyCFunction)Qd_DisposePixMap, 1,
4714 "(PixMapHandle pm) -> None"},
4715 {"CopyPixMap", (PyCFunction)Qd_CopyPixMap, 1,
4716 "(PixMapHandle srcPM, PixMapHandle dstPM) -> None"},
4717 {"NewPixPat", (PyCFunction)Qd_NewPixPat, 1,
4718 "() -> (PixPatHandle _rv)"},
Guido van Rossume56db431995-03-19 22:49:50 +00004719 {"DisposePixPat", (PyCFunction)Qd_DisposePixPat, 1,
4720 "(PixPatHandle pp) -> None"},
4721 {"CopyPixPat", (PyCFunction)Qd_CopyPixPat, 1,
4722 "(PixPatHandle srcPP, PixPatHandle dstPP) -> None"},
4723 {"PenPixPat", (PyCFunction)Qd_PenPixPat, 1,
4724 "(PixPatHandle pp) -> None"},
4725 {"BackPixPat", (PyCFunction)Qd_BackPixPat, 1,
4726 "(PixPatHandle pp) -> None"},
4727 {"GetPixPat", (PyCFunction)Qd_GetPixPat, 1,
4728 "(short patID) -> (PixPatHandle _rv)"},
Jack Jansen232f3cd1995-12-09 14:04:31 +00004729 {"MakeRGBPat", (PyCFunction)Qd_MakeRGBPat, 1,
4730 "(PixPatHandle pp, RGBColor myColor) -> None"},
Guido van Rossume56db431995-03-19 22:49:50 +00004731 {"FillCRect", (PyCFunction)Qd_FillCRect, 1,
4732 "(Rect r, PixPatHandle pp) -> None"},
4733 {"FillCOval", (PyCFunction)Qd_FillCOval, 1,
4734 "(Rect r, PixPatHandle pp) -> None"},
4735 {"FillCRoundRect", (PyCFunction)Qd_FillCRoundRect, 1,
4736 "(Rect r, short ovalWidth, short ovalHeight, PixPatHandle pp) -> None"},
4737 {"FillCArc", (PyCFunction)Qd_FillCArc, 1,
4738 "(Rect r, short startAngle, short arcAngle, PixPatHandle pp) -> None"},
4739 {"FillCRgn", (PyCFunction)Qd_FillCRgn, 1,
4740 "(RgnHandle rgn, PixPatHandle pp) -> None"},
4741 {"FillCPoly", (PyCFunction)Qd_FillCPoly, 1,
4742 "(PolyHandle poly, PixPatHandle pp) -> None"},
Jack Jansen232f3cd1995-12-09 14:04:31 +00004743 {"RGBForeColor", (PyCFunction)Qd_RGBForeColor, 1,
4744 "(RGBColor color) -> None"},
4745 {"RGBBackColor", (PyCFunction)Qd_RGBBackColor, 1,
4746 "(RGBColor color) -> None"},
4747 {"SetCPixel", (PyCFunction)Qd_SetCPixel, 1,
4748 "(short h, short v, RGBColor cPix) -> None"},
Guido van Rossume56db431995-03-19 22:49:50 +00004749 {"SetPortPix", (PyCFunction)Qd_SetPortPix, 1,
4750 "(PixMapHandle pm) -> None"},
Jack Jansen232f3cd1995-12-09 14:04:31 +00004751 {"GetCPixel", (PyCFunction)Qd_GetCPixel, 1,
4752 "(short h, short v) -> (RGBColor cPix)"},
4753 {"GetForeColor", (PyCFunction)Qd_GetForeColor, 1,
4754 "() -> (RGBColor color)"},
4755 {"GetBackColor", (PyCFunction)Qd_GetBackColor, 1,
4756 "() -> (RGBColor color)"},
4757 {"OpColor", (PyCFunction)Qd_OpColor, 1,
4758 "(RGBColor color) -> None"},
4759 {"HiliteColor", (PyCFunction)Qd_HiliteColor, 1,
4760 "(RGBColor color) -> None"},
Jack Jansen69b43ed1997-08-15 14:35:54 +00004761 {"DisposeCTable", (PyCFunction)Qd_DisposeCTable, 1,
4762 "(CTabHandle cTable) -> None"},
4763 {"GetCTable", (PyCFunction)Qd_GetCTable, 1,
4764 "(short ctID) -> (CTabHandle _rv)"},
4765 {"GetCCursor", (PyCFunction)Qd_GetCCursor, 1,
4766 "(short crsrID) -> (CCrsrHandle _rv)"},
4767 {"SetCCursor", (PyCFunction)Qd_SetCCursor, 1,
4768 "(CCrsrHandle cCrsr) -> None"},
Guido van Rossume56db431995-03-19 22:49:50 +00004769 {"AllocCursor", (PyCFunction)Qd_AllocCursor, 1,
4770 "() -> None"},
Jack Jansen69b43ed1997-08-15 14:35:54 +00004771 {"DisposeCCursor", (PyCFunction)Qd_DisposeCCursor, 1,
4772 "(CCrsrHandle cCrsr) -> None"},
4773 {"GetMaxDevice", (PyCFunction)Qd_GetMaxDevice, 1,
4774 "(Rect globalRect) -> (GDHandle _rv)"},
Guido van Rossume56db431995-03-19 22:49:50 +00004775 {"GetCTSeed", (PyCFunction)Qd_GetCTSeed, 1,
4776 "() -> (long _rv)"},
Jack Jansen69b43ed1997-08-15 14:35:54 +00004777 {"GetDeviceList", (PyCFunction)Qd_GetDeviceList, 1,
4778 "() -> (GDHandle _rv)"},
4779 {"GetMainDevice", (PyCFunction)Qd_GetMainDevice, 1,
4780 "() -> (GDHandle _rv)"},
4781 {"GetNextDevice", (PyCFunction)Qd_GetNextDevice, 1,
4782 "(GDHandle curDevice) -> (GDHandle _rv)"},
4783 {"TestDeviceAttribute", (PyCFunction)Qd_TestDeviceAttribute, 1,
4784 "(GDHandle gdh, short attribute) -> (Boolean _rv)"},
4785 {"SetDeviceAttribute", (PyCFunction)Qd_SetDeviceAttribute, 1,
4786 "(GDHandle gdh, short attribute, Boolean value) -> None"},
4787 {"InitGDevice", (PyCFunction)Qd_InitGDevice, 1,
4788 "(short qdRefNum, long mode, GDHandle gdh) -> None"},
4789 {"NewGDevice", (PyCFunction)Qd_NewGDevice, 1,
4790 "(short refNum, long mode) -> (GDHandle _rv)"},
4791 {"DisposeGDevice", (PyCFunction)Qd_DisposeGDevice, 1,
4792 "(GDHandle gdh) -> None"},
4793 {"SetGDevice", (PyCFunction)Qd_SetGDevice, 1,
4794 "(GDHandle gd) -> None"},
4795 {"GetGDevice", (PyCFunction)Qd_GetGDevice, 1,
4796 "() -> (GDHandle _rv)"},
Jack Jansen232f3cd1995-12-09 14:04:31 +00004797 {"Color2Index", (PyCFunction)Qd_Color2Index, 1,
4798 "(RGBColor myColor) -> (long _rv)"},
4799 {"Index2Color", (PyCFunction)Qd_Index2Color, 1,
4800 "(long index) -> (RGBColor aColor)"},
4801 {"InvertColor", (PyCFunction)Qd_InvertColor, 1,
4802 "() -> (RGBColor myColor)"},
4803 {"RealColor", (PyCFunction)Qd_RealColor, 1,
4804 "(RGBColor color) -> (Boolean _rv)"},
Jack Jansen69b43ed1997-08-15 14:35:54 +00004805 {"GetSubTable", (PyCFunction)Qd_GetSubTable, 1,
4806 "(CTabHandle myColors, short iTabRes, CTabHandle targetTbl) -> None"},
4807 {"MakeITable", (PyCFunction)Qd_MakeITable, 1,
4808 "(CTabHandle cTabH, ITabHandle iTabH, short res) -> None"},
Guido van Rossume56db431995-03-19 22:49:50 +00004809 {"SetClientID", (PyCFunction)Qd_SetClientID, 1,
4810 "(short id) -> None"},
4811 {"ProtectEntry", (PyCFunction)Qd_ProtectEntry, 1,
4812 "(short index, Boolean protect) -> None"},
4813 {"ReserveEntry", (PyCFunction)Qd_ReserveEntry, 1,
4814 "(short index, Boolean reserve) -> None"},
4815 {"QDError", (PyCFunction)Qd_QDError, 1,
4816 "() -> (short _rv)"},
Jack Jansen41058c01995-11-16 22:48:29 +00004817 {"CopyDeepMask", (PyCFunction)Qd_CopyDeepMask, 1,
4818 "(BitMapPtr srcBits, BitMapPtr maskBits, BitMapPtr dstBits, Rect srcRect, Rect maskRect, Rect dstRect, short mode, RgnHandle maskRgn) -> None"},
Jack Jansen54c8f7e1995-11-14 10:46:01 +00004819 {"GetPattern", (PyCFunction)Qd_GetPattern, 1,
4820 "(short patternID) -> (PatHandle _rv)"},
Jack Jansen1c4e6141998-04-21 15:23:55 +00004821 {"MacGetCursor", (PyCFunction)Qd_MacGetCursor, 1,
Jack Jansen54c8f7e1995-11-14 10:46:01 +00004822 "(short cursorID) -> (CursHandle _rv)"},
4823 {"GetPicture", (PyCFunction)Qd_GetPicture, 1,
4824 "(short pictureID) -> (PicHandle _rv)"},
4825 {"DeltaPoint", (PyCFunction)Qd_DeltaPoint, 1,
4826 "(Point ptA, Point ptB) -> (long _rv)"},
4827 {"ShieldCursor", (PyCFunction)Qd_ShieldCursor, 1,
4828 "(Rect shieldRect, Point offsetPt) -> None"},
4829 {"ScreenRes", (PyCFunction)Qd_ScreenRes, 1,
4830 "() -> (short scrnHRes, short scrnVRes)"},
Jack Jansen04a02e71996-01-06 17:12:58 +00004831 {"GetIndPattern", (PyCFunction)Qd_GetIndPattern, 1,
4832 "(short patternListID, short index) -> (Pattern thePat)"},
Jack Jansen21f96871998-02-20 16:02:09 +00004833 {"SlopeFromAngle", (PyCFunction)Qd_SlopeFromAngle, 1,
4834 "(short angle) -> (Fixed _rv)"},
4835 {"AngleFromSlope", (PyCFunction)Qd_AngleFromSlope, 1,
4836 "(Fixed slope) -> (short _rv)"},
Jack Jansenb81cf9d1995-06-06 13:08:40 +00004837 {"TextFont", (PyCFunction)Qd_TextFont, 1,
4838 "(short font) -> None"},
4839 {"TextFace", (PyCFunction)Qd_TextFace, 1,
Jack Jansene742a821998-02-25 15:46:50 +00004840 "(StyleParameter face) -> None"},
Jack Jansenb81cf9d1995-06-06 13:08:40 +00004841 {"TextMode", (PyCFunction)Qd_TextMode, 1,
4842 "(short mode) -> None"},
4843 {"TextSize", (PyCFunction)Qd_TextSize, 1,
4844 "(short size) -> None"},
4845 {"SpaceExtra", (PyCFunction)Qd_SpaceExtra, 1,
Jack Jansen330381c1995-11-15 15:18:01 +00004846 "(Fixed extra) -> None"},
Jack Jansenb81cf9d1995-06-06 13:08:40 +00004847 {"DrawChar", (PyCFunction)Qd_DrawChar, 1,
Jack Jansen21f96871998-02-20 16:02:09 +00004848 "(CharParameter ch) -> None"},
Jack Jansenb81cf9d1995-06-06 13:08:40 +00004849 {"DrawString", (PyCFunction)Qd_DrawString, 1,
4850 "(Str255 s) -> None"},
Jack Jansen1c4e6141998-04-21 15:23:55 +00004851 {"MacDrawText", (PyCFunction)Qd_MacDrawText, 1,
Jack Jansenb81cf9d1995-06-06 13:08:40 +00004852 "(Buffer textBuf, short firstByte, short byteCount) -> None"},
4853 {"CharWidth", (PyCFunction)Qd_CharWidth, 1,
Jack Jansen21f96871998-02-20 16:02:09 +00004854 "(CharParameter ch) -> (short _rv)"},
Jack Jansenb81cf9d1995-06-06 13:08:40 +00004855 {"StringWidth", (PyCFunction)Qd_StringWidth, 1,
4856 "(Str255 s) -> (short _rv)"},
4857 {"TextWidth", (PyCFunction)Qd_TextWidth, 1,
4858 "(Buffer textBuf, short firstByte, short byteCount) -> (short _rv)"},
Jack Jansen3a50f8a1996-01-11 16:17:14 +00004859 {"GetFontInfo", (PyCFunction)Qd_GetFontInfo, 1,
4860 "() -> (FontInfo info)"},
Jack Jansenb81cf9d1995-06-06 13:08:40 +00004861 {"CharExtra", (PyCFunction)Qd_CharExtra, 1,
Jack Jansen330381c1995-11-15 15:18:01 +00004862 "(Fixed extra) -> None"},
Jack Jansen7f725e41998-04-23 13:21:09 +00004863 {"SetPort", (PyCFunction)Qd_SetPort, 1,
Jack Jansen29bfea91998-04-27 15:09:36 +00004864 "(GrafPtr thePort) -> None"},
Jack Jansene180d991998-04-24 10:28:20 +00004865 {"GetCursor", (PyCFunction)Qd_GetCursor, 1,
4866 "(short cursorID) -> (CursHandle _rv)"},
4867 {"SetCursor", (PyCFunction)Qd_SetCursor, 1,
4868 "(Cursor crsr) -> None"},
4869 {"ShowCursor", (PyCFunction)Qd_ShowCursor, 1,
4870 "() -> None"},
4871 {"LineTo", (PyCFunction)Qd_LineTo, 1,
4872 "(short h, short v) -> None"},
4873 {"SetRect", (PyCFunction)Qd_SetRect, 1,
4874 "(short left, short top, short right, short bottom) -> (Rect r)"},
4875 {"OffsetRect", (PyCFunction)Qd_OffsetRect, 1,
4876 "(Rect r, short dh, short dv) -> (Rect r)"},
4877 {"InsetRect", (PyCFunction)Qd_InsetRect, 1,
4878 "(Rect r, short dh, short dv) -> (Rect r)"},
4879 {"UnionRect", (PyCFunction)Qd_UnionRect, 1,
4880 "(Rect src1, Rect src2) -> (Rect dstRect)"},
4881 {"EqualRect", (PyCFunction)Qd_EqualRect, 1,
4882 "(Rect rect1, Rect rect2) -> (Boolean _rv)"},
4883 {"FrameRect", (PyCFunction)Qd_FrameRect, 1,
4884 "(Rect r) -> None"},
4885 {"InvertRect", (PyCFunction)Qd_InvertRect, 1,
4886 "(Rect r) -> None"},
4887 {"FillRect", (PyCFunction)Qd_FillRect, 1,
4888 "(Rect r, Pattern pat) -> None"},
4889 {"CopyRgn", (PyCFunction)Qd_CopyRgn, 1,
4890 "(RgnHandle srcRgn, RgnHandle dstRgn) -> None"},
4891 {"SetRectRgn", (PyCFunction)Qd_SetRectRgn, 1,
4892 "(RgnHandle rgn, short left, short top, short right, short bottom) -> None"},
4893 {"OffsetRgn", (PyCFunction)Qd_OffsetRgn, 1,
4894 "(RgnHandle rgn, short dh, short dv) -> None"},
4895 {"UnionRgn", (PyCFunction)Qd_UnionRgn, 1,
4896 "(RgnHandle srcRgnA, RgnHandle srcRgnB, RgnHandle dstRgn) -> None"},
4897 {"XorRgn", (PyCFunction)Qd_XorRgn, 1,
4898 "(RgnHandle srcRgnA, RgnHandle srcRgnB, RgnHandle dstRgn) -> None"},
4899 {"EqualRgn", (PyCFunction)Qd_EqualRgn, 1,
4900 "(RgnHandle rgnA, RgnHandle rgnB) -> (Boolean _rv)"},
4901 {"FrameRgn", (PyCFunction)Qd_FrameRgn, 1,
4902 "(RgnHandle rgn) -> None"},
4903 {"PaintRgn", (PyCFunction)Qd_PaintRgn, 1,
4904 "(RgnHandle rgn) -> None"},
4905 {"InvertRgn", (PyCFunction)Qd_InvertRgn, 1,
4906 "(RgnHandle rgn) -> None"},
4907 {"FillRgn", (PyCFunction)Qd_FillRgn, 1,
4908 "(RgnHandle rgn, Pattern pat) -> None"},
4909 {"GetPixel", (PyCFunction)Qd_GetPixel, 1,
4910 "(short h, short v) -> (Boolean _rv)"},
4911 {"PtInRect", (PyCFunction)Qd_PtInRect, 1,
4912 "(Point pt, Rect r) -> (Boolean _rv)"},
4913 {"DrawText", (PyCFunction)Qd_DrawText, 1,
4914 "(Buffer textBuf, short firstByte, short byteCount) -> None"},
Jack Jansen41058c01995-11-16 22:48:29 +00004915 {"BitMap", (PyCFunction)Qd_BitMap, 1,
4916 "Take (string, int, Rect) argument and create BitMap"},
Jack Jansen425e9eb1995-12-12 15:02:03 +00004917 {"RawBitMap", (PyCFunction)Qd_RawBitMap, 1,
4918 "Take string BitMap and turn into BitMap object"},
Guido van Rossum17448e21995-01-30 11:53:55 +00004919 {NULL, NULL, 0}
4920};
4921
4922
4923
4924
4925void initQd()
4926{
4927 PyObject *m;
4928 PyObject *d;
4929
4930
4931
4932
4933 m = Py_InitModule("Qd", Qd_methods);
4934 d = PyModule_GetDict(m);
4935 Qd_Error = PyMac_GetOSErrException();
4936 if (Qd_Error == NULL ||
4937 PyDict_SetItemString(d, "Error", Qd_Error) != 0)
4938 Py_FatalError("can't initialize Qd.Error");
Jack Jansena755e681997-09-20 17:40:22 +00004939 GrafPort_Type.ob_type = &PyType_Type;
4940 Py_INCREF(&GrafPort_Type);
4941 if (PyDict_SetItemString(d, "GrafPortType", (PyObject *)&GrafPort_Type) != 0)
4942 Py_FatalError("can't initialize GrafPortType");
4943 BitMap_Type.ob_type = &PyType_Type;
4944 Py_INCREF(&BitMap_Type);
4945 if (PyDict_SetItemString(d, "BitMapType", (PyObject *)&BitMap_Type) != 0)
4946 Py_FatalError("can't initialize BitMapType");
4947 QDGlobalsAccess_Type.ob_type = &PyType_Type;
4948 Py_INCREF(&QDGlobalsAccess_Type);
4949 if (PyDict_SetItemString(d, "QDGlobalsAccessType", (PyObject *)&QDGlobalsAccess_Type) != 0)
4950 Py_FatalError("can't initialize QDGlobalsAccessType");
Jack Jansenb5394061996-01-05 18:06:41 +00004951
4952 {
4953 PyObject *o;
Jack Jansenbdd07471996-01-29 15:44:03 +00004954
4955 o = QDGA_New();
4956 if (o == NULL || PyDict_SetItemString(d, "qd", o) != 0)
4957 Py_FatalError("can't initialize Qd.qd");
Jack Jansenb5394061996-01-05 18:06:41 +00004958 }
4959
4960
Guido van Rossum17448e21995-01-30 11:53:55 +00004961}
4962
4963/* ========================= End module Qd ========================== */
4964