blob: 13caf5f36f23af3880e0586798efba6e66dae68b [file] [log] [blame]
Guido van Rossum17448e21995-01-30 11:53:55 +00001
2/* =========================== Module Qd ============================ */
3
4#include "Python.h"
5
6
7
8#define SystemSevenOrLater 1
9
10#include "macglue.h"
11#include <Memory.h>
12#include <Dialogs.h>
13#include <Menus.h>
14#include <Controls.h>
15
16extern PyObject *ResObj_New(Handle);
17extern int ResObj_Convert(PyObject *, Handle *);
Jack Jansen425e9eb1995-12-12 15:02:03 +000018extern PyObject *OptResObj_New(Handle);
19extern int OptResObj_Convert(PyObject *, Handle *);
Guido van Rossum17448e21995-01-30 11:53:55 +000020
21extern PyObject *WinObj_New(WindowPtr);
22extern int WinObj_Convert(PyObject *, WindowPtr *);
Jack Jansen330381c1995-11-15 15:18:01 +000023extern PyTypeObject Window_Type;
24#define WinObj_Check(x) ((x)->ob_type == &Window_Type)
Guido van Rossum17448e21995-01-30 11:53:55 +000025
26extern PyObject *DlgObj_New(DialogPtr);
27extern int DlgObj_Convert(PyObject *, DialogPtr *);
28extern PyTypeObject Dialog_Type;
29#define DlgObj_Check(x) ((x)->ob_type == &Dialog_Type)
30
31extern PyObject *MenuObj_New(MenuHandle);
32extern int MenuObj_Convert(PyObject *, MenuHandle *);
33
34extern PyObject *CtlObj_New(ControlHandle);
35extern int CtlObj_Convert(PyObject *, ControlHandle *);
36
Jack Jansen330381c1995-11-15 15:18:01 +000037extern PyObject *GrafObj_New(GrafPtr);
38extern int GrafObj_Convert(PyObject *, GrafPtr *);
39
Jack Jansen41058c01995-11-16 22:48:29 +000040extern PyObject *BMObj_New(BitMapPtr);
41extern int BMObj_Convert(PyObject *, BitMapPtr *);
42
Guido van Rossum17448e21995-01-30 11:53:55 +000043extern PyObject *WinObj_WhichWindow(WindowPtr);
44
45#include <QuickDraw.h>
Guido van Rossum17448e21995-01-30 11:53:55 +000046
47#define resNotFound -192 /* Can't include <Errors.h> because of Python's "errors.h" */
48
Jack Jansen232f3cd1995-12-09 14:04:31 +000049/*
50** Parse/generate RGB records
51*/
52PyObject *QdRGB_New(itself)
53 RGBColorPtr itself;
54{
55
56 return Py_BuildValue("lll", (long)itself->red, (long)itself->green, (long)itself->blue);
57}
58
59QdRGB_Convert(v, p_itself)
60 PyObject *v;
61 RGBColorPtr p_itself;
62{
63 long red, green, blue;
64
65 if( !PyArg_ParseTuple(v, "lll", &red, &green, &blue) )
66 return 0;
67 p_itself->red = (unsigned short)red;
68 p_itself->green = (unsigned short)green;
69 p_itself->blue = (unsigned short)blue;
70 return 1;
71}
72
Jack Jansen3a50f8a1996-01-11 16:17:14 +000073/*
74** Generate FontInfo records
75*/
76static
77PyObject *QdFI_New(itself)
78 FontInfo *itself;
79{
80
81 return Py_BuildValue("hhhh", itself->ascent, itself->descent,
82 itself->widMax, itself->leading);
83}
84
85
Jack Jansen232f3cd1995-12-09 14:04:31 +000086
Guido van Rossum17448e21995-01-30 11:53:55 +000087static PyObject *Qd_Error;
88
Jack Jansen330381c1995-11-15 15:18:01 +000089/* ---------------------- Object type GrafPort ---------------------- */
90
91PyTypeObject GrafPort_Type;
92
93#define GrafObj_Check(x) ((x)->ob_type == &GrafPort_Type)
94
95typedef struct GrafPortObject {
96 PyObject_HEAD
97 GrafPtr ob_itself;
98} GrafPortObject;
99
100PyObject *GrafObj_New(itself)
101 GrafPtr itself;
Guido van Rossum17448e21995-01-30 11:53:55 +0000102{
Jack Jansen330381c1995-11-15 15:18:01 +0000103 GrafPortObject *it;
104 if (itself == NULL) return PyMac_Error(resNotFound);
105 it = PyObject_NEW(GrafPortObject, &GrafPort_Type);
106 if (it == NULL) return NULL;
107 it->ob_itself = itself;
108 return (PyObject *)it;
109}
110GrafObj_Convert(v, p_itself)
111 PyObject *v;
112 GrafPtr *p_itself;
113{
114 if (DlgObj_Check(v) || WinObj_Check(v)) {
115 *p_itself = ((GrafPortObject *)v)->ob_itself;
116 return 1;
117 }
118 if (!GrafObj_Check(v))
119 {
120 PyErr_SetString(PyExc_TypeError, "GrafPort required");
121 return 0;
122 }
123 *p_itself = ((GrafPortObject *)v)->ob_itself;
124 return 1;
Guido van Rossum17448e21995-01-30 11:53:55 +0000125}
126
Jack Jansen330381c1995-11-15 15:18:01 +0000127static void GrafObj_dealloc(self)
128 GrafPortObject *self;
Guido van Rossum17448e21995-01-30 11:53:55 +0000129{
Jack Jansen330381c1995-11-15 15:18:01 +0000130 /* Cleanup of self->ob_itself goes here */
131 PyMem_DEL(self);
Guido van Rossume56db431995-03-19 22:49:50 +0000132}
133
Jack Jansen330381c1995-11-15 15:18:01 +0000134static PyMethodDef GrafObj_methods[] = {
135 {NULL, NULL, 0}
136};
137
138PyMethodChain GrafObj_chain = { GrafObj_methods, NULL };
139
140static PyObject *GrafObj_getattr(self, name)
141 GrafPortObject *self;
142 char *name;
Guido van Rossume56db431995-03-19 22:49:50 +0000143{
Jack Jansen3a50f8a1996-01-11 16:17:14 +0000144
145 { CGrafPtr itself_color = (CGrafPtr)self->ob_itself;
Jack Jansen330381c1995-11-15 15:18:01 +0000146
Jack Jansen3a50f8a1996-01-11 16:17:14 +0000147 if ( strcmp(name, "data") == 0 )
148 return PyString_FromStringAndSize((char *)self->ob_itself, sizeof(GrafPort));
149
150 if ( (itself_color->portVersion&0xc000) == 0xc000 ) {
151 /* Color-only attributes */
152
153 if ( strcmp(name, "portBits") == 0 )
154 /* XXXX Do we need HLock() stuff here?? */
155 return BMObj_New((BitMapPtr)*itself_color->portPixMap);
156 if ( strcmp(name, "grafVars") == 0 )
157 return Py_BuildValue("O&", ResObj_New, (Handle)itself_color->visRgn);
158 if ( strcmp(name, "chExtra") == 0 )
159 return Py_BuildValue("h", itself_color->chExtra);
160 if ( strcmp(name, "pnLocHFrac") == 0 )
161 return Py_BuildValue("h", itself_color->pnLocHFrac);
Jack Jansen61f3df41996-01-15 14:39:56 +0000162 if ( strcmp(name, "bkPixPat") == 0 )
163 return Py_BuildValue("O&", ResObj_New, (Handle)itself_color->bkPixPat);
164 if ( strcmp(name, "rgbFgColor") == 0 )
165 return Py_BuildValue("O&", QdRGB_New, &itself_color->rgbFgColor);
166 if ( strcmp(name, "rgbBkColor") == 0 )
167 return Py_BuildValue("O&", QdRGB_New, &itself_color->rgbBkColor);
168 if ( strcmp(name, "pnPixPat") == 0 )
169 return Py_BuildValue("O&", ResObj_New, (Handle)itself_color->pnPixPat);
170 if ( strcmp(name, "fillPixPat") == 0 )
171 return Py_BuildValue("O&", ResObj_New, (Handle)itself_color->fillPixPat);
Jack Jansen3a50f8a1996-01-11 16:17:14 +0000172 } else {
173 /* Mono-only attributes */
174 if ( strcmp(name, "portBits") == 0 )
175 return BMObj_New(&self->ob_itself->portBits);
Jack Jansen61f3df41996-01-15 14:39:56 +0000176 if ( strcmp(name, "bkPat") == 0 )
177 return Py_BuildValue("s#", (char *)&self->ob_itself->bkPat, sizeof(Pattern));
178 if ( strcmp(name, "fillPat") == 0 )
179 return Py_BuildValue("s#", (char *)&self->ob_itself->fillPat, sizeof(Pattern));
180 if ( strcmp(name, "pnPat") == 0 )
181 return Py_BuildValue("s#", (char *)&self->ob_itself->pnPat, sizeof(Pattern));
Jack Jansen3a50f8a1996-01-11 16:17:14 +0000182 }
183 /*
184 ** Accessible for both color/mono windows.
185 ** portVersion is really color-only, but we put it here
186 ** for convenience
187 */
188 if ( strcmp(name, "portVersion") == 0 )
189 return Py_BuildValue("h", itself_color->portVersion);
190 if ( strcmp(name, "device") == 0 )
191 return PyInt_FromLong((long)self->ob_itself->device);
192 if ( strcmp(name, "portRect") == 0 )
193 return Py_BuildValue("O&", PyMac_BuildRect, &self->ob_itself->portRect);
194 if ( strcmp(name, "visRgn") == 0 )
195 return Py_BuildValue("O&", ResObj_New, (Handle)self->ob_itself->visRgn);
196 if ( strcmp(name, "clipRgn") == 0 )
197 return Py_BuildValue("O&", ResObj_New, (Handle)self->ob_itself->clipRgn);
Jack Jansen3a50f8a1996-01-11 16:17:14 +0000198 if ( strcmp(name, "pnLoc") == 0 )
199 return Py_BuildValue("O&", PyMac_BuildPoint, self->ob_itself->pnLoc);
200 if ( strcmp(name, "pnSize") == 0 )
201 return Py_BuildValue("O&", PyMac_BuildPoint, self->ob_itself->pnSize);
202 if ( strcmp(name, "pnMode") == 0 )
203 return Py_BuildValue("h", self->ob_itself->pnMode);
Jack Jansen3a50f8a1996-01-11 16:17:14 +0000204 if ( strcmp(name, "pnVis") == 0 )
205 return Py_BuildValue("h", self->ob_itself->pnVis);
206 if ( strcmp(name, "txFont") == 0 )
207 return Py_BuildValue("h", self->ob_itself->txFont);
208 if ( strcmp(name, "txFace") == 0 )
209 return Py_BuildValue("h", (short)self->ob_itself->txFace);
210 if ( strcmp(name, "txMode") == 0 )
211 return Py_BuildValue("h", self->ob_itself->txMode);
212 if ( strcmp(name, "txSize") == 0 )
213 return Py_BuildValue("h", self->ob_itself->txSize);
214 if ( strcmp(name, "spExtra") == 0 )
215 return Py_BuildValue("O&", PyMac_BuildFixed, self->ob_itself->spExtra);
216 /* XXXX Add more, as needed */
Jack Jansen3355be31996-05-08 15:33:20 +0000217 /* This one is so we can compare grafports: */
218 if ( strcmp(name, "_id") == 0 )
219 return Py_BuildValue("l", (long)self->ob_itself);
Jack Jansen3a50f8a1996-01-11 16:17:14 +0000220 }
Jack Jansen330381c1995-11-15 15:18:01 +0000221 return Py_FindMethodInChain(&GrafObj_chain, (PyObject *)self, name);
Guido van Rossum17448e21995-01-30 11:53:55 +0000222}
223
Jack Jansen330381c1995-11-15 15:18:01 +0000224#define GrafObj_setattr NULL
225
226PyTypeObject GrafPort_Type = {
227 PyObject_HEAD_INIT(&PyType_Type)
228 0, /*ob_size*/
229 "GrafPort", /*tp_name*/
230 sizeof(GrafPortObject), /*tp_basicsize*/
231 0, /*tp_itemsize*/
232 /* methods */
233 (destructor) GrafObj_dealloc, /*tp_dealloc*/
234 0, /*tp_print*/
235 (getattrfunc) GrafObj_getattr, /*tp_getattr*/
236 (setattrfunc) GrafObj_setattr, /*tp_setattr*/
237};
238
239/* -------------------- End object type GrafPort -------------------- */
240
241
Jack Jansen41058c01995-11-16 22:48:29 +0000242/* ----------------------- Object type BitMap ----------------------- */
243
244PyTypeObject BitMap_Type;
245
246#define BMObj_Check(x) ((x)->ob_type == &BitMap_Type)
247
248typedef struct BitMapObject {
249 PyObject_HEAD
250 BitMapPtr ob_itself;
251 PyObject *referred_object;
252 BitMap *referred_bitmap;
253} BitMapObject;
254
255PyObject *BMObj_New(itself)
256 BitMapPtr itself;
257{
258 BitMapObject *it;
259 if (itself == NULL) return PyMac_Error(resNotFound);
260 it = PyObject_NEW(BitMapObject, &BitMap_Type);
261 if (it == NULL) return NULL;
262 it->ob_itself = itself;
263 it->referred_object = NULL;
264 it->referred_bitmap = NULL;
265 return (PyObject *)it;
266}
267BMObj_Convert(v, p_itself)
268 PyObject *v;
269 BitMapPtr *p_itself;
270{
271 if (!BMObj_Check(v))
272 {
273 PyErr_SetString(PyExc_TypeError, "BitMap required");
274 return 0;
275 }
276 *p_itself = ((BitMapObject *)v)->ob_itself;
277 return 1;
278}
279
280static void BMObj_dealloc(self)
281 BitMapObject *self;
282{
283 Py_XDECREF(self->referred_object);
284 if (self->referred_bitmap) free(self->referred_bitmap);
285 PyMem_DEL(self);
286}
287
288static PyMethodDef BMObj_methods[] = {
289 {NULL, NULL, 0}
290};
291
292PyMethodChain BMObj_chain = { BMObj_methods, NULL };
293
294static PyObject *BMObj_getattr(self, name)
295 BitMapObject *self;
296 char *name;
297{
298 if ( strcmp(name, "baseAddr") == 0 )
299 return PyInt_FromLong((long)self->ob_itself->baseAddr);
300 if ( strcmp(name, "rowBytes") == 0 )
301 return PyInt_FromLong((long)self->ob_itself->rowBytes);
302 if ( strcmp(name, "bounds") == 0 )
303 return Py_BuildValue("O&", PyMac_BuildRect, &self->ob_itself->bounds);
304 /* XXXX Add more, as needed */
Jack Jansen425e9eb1995-12-12 15:02:03 +0000305 if ( strcmp(name, "bitmap_data") == 0 )
306 return PyString_FromStringAndSize((char *)self->ob_itself, sizeof(BitMap));
307 if ( strcmp(name, "pixmap_data") == 0 )
308 return PyString_FromStringAndSize((char *)self->ob_itself, sizeof(PixMap));
Jack Jansen41058c01995-11-16 22:48:29 +0000309
310 return Py_FindMethodInChain(&BMObj_chain, (PyObject *)self, name);
311}
312
313#define BMObj_setattr NULL
314
315PyTypeObject BitMap_Type = {
316 PyObject_HEAD_INIT(&PyType_Type)
317 0, /*ob_size*/
318 "BitMap", /*tp_name*/
319 sizeof(BitMapObject), /*tp_basicsize*/
320 0, /*tp_itemsize*/
321 /* methods */
322 (destructor) BMObj_dealloc, /*tp_dealloc*/
323 0, /*tp_print*/
324 (getattrfunc) BMObj_getattr, /*tp_getattr*/
325 (setattrfunc) BMObj_setattr, /*tp_setattr*/
326};
327
328/* --------------------- End object type BitMap --------------------- */
329
330
Jack Jansenbdd07471996-01-29 15:44:03 +0000331/* ------------------ Object type QDGlobalsAccess ------------------- */
332
333staticforward PyTypeObject QDGlobalsAccess_Type;
334
335#define QDGA_Check(x) ((x)->ob_type == &QDGlobalsAccess_Type)
336
337typedef struct QDGlobalsAccessObject {
338 PyObject_HEAD
339} QDGlobalsAccessObject;
340
341static PyObject *QDGA_New()
342{
343 QDGlobalsAccessObject *it;
344 it = PyObject_NEW(QDGlobalsAccessObject, &QDGlobalsAccess_Type);
345 if (it == NULL) return NULL;
346 return (PyObject *)it;
347}
348
349static void QDGA_dealloc(self)
350 QDGlobalsAccessObject *self;
351{
352 PyMem_DEL(self);
353}
354
355static PyMethodDef QDGA_methods[] = {
356 {NULL, NULL, 0}
357};
358
359static PyMethodChain QDGA_chain = { QDGA_methods, NULL };
360
361static PyObject *QDGA_getattr(self, name)
362 QDGlobalsAccessObject *self;
363 char *name;
364{
365
366 if ( strcmp(name, "arrow") == 0 )
367 return PyString_FromStringAndSize((char *)&qd.arrow, sizeof(qd.arrow));
368 if ( strcmp(name, "black") == 0 )
369 return PyString_FromStringAndSize((char *)&qd.black, sizeof(qd.black));
370 if ( strcmp(name, "white") == 0 )
371 return PyString_FromStringAndSize((char *)&qd.white, sizeof(qd.white));
372 if ( strcmp(name, "gray") == 0 )
373 return PyString_FromStringAndSize((char *)&qd.gray, sizeof(qd.gray));
374 if ( strcmp(name, "ltGray") == 0 )
375 return PyString_FromStringAndSize((char *)&qd.ltGray, sizeof(qd.ltGray));
376 if ( strcmp(name, "dkGray") == 0 )
377 return PyString_FromStringAndSize((char *)&qd.dkGray, sizeof(qd.dkGray));
378 if ( strcmp(name, "screenBits") == 0 )
379 return BMObj_New(&qd.screenBits);
380 if ( strcmp(name, "thePort") == 0 )
381 return GrafObj_New(qd.thePort);
382 if ( strcmp(name, "randSeed") == 0 )
383 return Py_BuildValue("l", &qd.randSeed);
384
385 return Py_FindMethodInChain(&QDGA_chain, (PyObject *)self, name);
386}
387
388#define QDGA_setattr NULL
389
390staticforward PyTypeObject QDGlobalsAccess_Type = {
391 PyObject_HEAD_INIT(&PyType_Type)
392 0, /*ob_size*/
393 "QDGlobalsAccess", /*tp_name*/
394 sizeof(QDGlobalsAccessObject), /*tp_basicsize*/
395 0, /*tp_itemsize*/
396 /* methods */
397 (destructor) QDGA_dealloc, /*tp_dealloc*/
398 0, /*tp_print*/
399 (getattrfunc) QDGA_getattr, /*tp_getattr*/
400 (setattrfunc) QDGA_setattr, /*tp_setattr*/
401};
402
403/* ---------------- End object type QDGlobalsAccess ----------------- */
404
405
Jack Jansen1c4e6141998-04-21 15:23:55 +0000406static PyObject *Qd_MacSetPort(_self, _args)
Guido van Rossum17448e21995-01-30 11:53:55 +0000407 PyObject *_self;
408 PyObject *_args;
409{
410 PyObject *_res = NULL;
Jack Jansen330381c1995-11-15 15:18:01 +0000411 GrafPtr port;
Guido van Rossum17448e21995-01-30 11:53:55 +0000412 if (!PyArg_ParseTuple(_args, "O&",
Jack Jansen330381c1995-11-15 15:18:01 +0000413 GrafObj_Convert, &port))
Guido van Rossum17448e21995-01-30 11:53:55 +0000414 return NULL;
Jack Jansen1c4e6141998-04-21 15:23:55 +0000415 MacSetPort(port);
Guido van Rossume56db431995-03-19 22:49:50 +0000416 Py_INCREF(Py_None);
417 _res = Py_None;
418 return _res;
419}
420
421static PyObject *Qd_GetPort(_self, _args)
422 PyObject *_self;
423 PyObject *_args;
424{
425 PyObject *_res = NULL;
Jack Jansen330381c1995-11-15 15:18:01 +0000426 GrafPtr port;
Guido van Rossume56db431995-03-19 22:49:50 +0000427 if (!PyArg_ParseTuple(_args, ""))
428 return NULL;
429 GetPort(&port);
430 _res = Py_BuildValue("O&",
Jack Jansen330381c1995-11-15 15:18:01 +0000431 GrafObj_New, port);
Guido van Rossume56db431995-03-19 22:49:50 +0000432 return _res;
433}
434
435static PyObject *Qd_GrafDevice(_self, _args)
436 PyObject *_self;
437 PyObject *_args;
438{
439 PyObject *_res = NULL;
440 short device;
441 if (!PyArg_ParseTuple(_args, "h",
442 &device))
443 return NULL;
444 GrafDevice(device);
445 Py_INCREF(Py_None);
446 _res = Py_None;
447 return _res;
448}
449
Jack Jansen41058c01995-11-16 22:48:29 +0000450static PyObject *Qd_SetPortBits(_self, _args)
451 PyObject *_self;
452 PyObject *_args;
453{
454 PyObject *_res = NULL;
455 BitMapPtr bm;
456 if (!PyArg_ParseTuple(_args, "O&",
457 BMObj_Convert, &bm))
458 return NULL;
459 SetPortBits(bm);
460 Py_INCREF(Py_None);
461 _res = Py_None;
462 return _res;
463}
464
Guido van Rossume56db431995-03-19 22:49:50 +0000465static PyObject *Qd_PortSize(_self, _args)
466 PyObject *_self;
467 PyObject *_args;
468{
469 PyObject *_res = NULL;
470 short width;
471 short height;
472 if (!PyArg_ParseTuple(_args, "hh",
473 &width,
474 &height))
475 return NULL;
476 PortSize(width,
477 height);
478 Py_INCREF(Py_None);
479 _res = Py_None;
480 return _res;
481}
482
483static PyObject *Qd_MovePortTo(_self, _args)
484 PyObject *_self;
485 PyObject *_args;
486{
487 PyObject *_res = NULL;
488 short leftGlobal;
489 short topGlobal;
490 if (!PyArg_ParseTuple(_args, "hh",
491 &leftGlobal,
492 &topGlobal))
493 return NULL;
494 MovePortTo(leftGlobal,
495 topGlobal);
496 Py_INCREF(Py_None);
497 _res = Py_None;
498 return _res;
499}
500
501static PyObject *Qd_SetOrigin(_self, _args)
502 PyObject *_self;
503 PyObject *_args;
504{
505 PyObject *_res = NULL;
506 short h;
507 short v;
508 if (!PyArg_ParseTuple(_args, "hh",
509 &h,
510 &v))
511 return NULL;
512 SetOrigin(h,
513 v);
514 Py_INCREF(Py_None);
515 _res = Py_None;
516 return _res;
517}
518
519static PyObject *Qd_SetClip(_self, _args)
520 PyObject *_self;
521 PyObject *_args;
522{
523 PyObject *_res = NULL;
524 RgnHandle rgn;
525 if (!PyArg_ParseTuple(_args, "O&",
526 ResObj_Convert, &rgn))
527 return NULL;
528 SetClip(rgn);
529 Py_INCREF(Py_None);
530 _res = Py_None;
531 return _res;
532}
533
534static PyObject *Qd_GetClip(_self, _args)
535 PyObject *_self;
536 PyObject *_args;
537{
538 PyObject *_res = NULL;
539 RgnHandle rgn;
540 if (!PyArg_ParseTuple(_args, "O&",
541 ResObj_Convert, &rgn))
542 return NULL;
543 GetClip(rgn);
Guido van Rossum17448e21995-01-30 11:53:55 +0000544 Py_INCREF(Py_None);
545 _res = Py_None;
546 return _res;
547}
548
549static PyObject *Qd_ClipRect(_self, _args)
550 PyObject *_self;
551 PyObject *_args;
552{
553 PyObject *_res = NULL;
554 Rect r;
555 if (!PyArg_ParseTuple(_args, "O&",
556 PyMac_GetRect, &r))
557 return NULL;
558 ClipRect(&r);
559 Py_INCREF(Py_None);
560 _res = Py_None;
561 return _res;
562}
563
Jack Jansen04a02e71996-01-06 17:12:58 +0000564static PyObject *Qd_BackPat(_self, _args)
565 PyObject *_self;
566 PyObject *_args;
567{
568 PyObject *_res = NULL;
569 Pattern *pat__in__;
570 int pat__in_len__;
571 if (!PyArg_ParseTuple(_args, "s#",
572 (char **)&pat__in__, &pat__in_len__))
573 return NULL;
574 if (pat__in_len__ != sizeof(Pattern))
575 {
576 PyErr_SetString(PyExc_TypeError, "buffer length should be sizeof(Pattern)");
577 goto pat__error__;
578 }
579 BackPat(pat__in__);
580 Py_INCREF(Py_None);
581 _res = Py_None;
582 pat__error__: ;
583 return _res;
584}
585
Guido van Rossume56db431995-03-19 22:49:50 +0000586static PyObject *Qd_InitCursor(_self, _args)
587 PyObject *_self;
588 PyObject *_args;
589{
590 PyObject *_res = NULL;
591 if (!PyArg_ParseTuple(_args, ""))
592 return NULL;
593 InitCursor();
594 Py_INCREF(Py_None);
595 _res = Py_None;
596 return _res;
597}
598
Jack Jansen1c4e6141998-04-21 15:23:55 +0000599static PyObject *Qd_MacSetCursor(_self, _args)
Jack Jansenb5394061996-01-05 18:06:41 +0000600 PyObject *_self;
601 PyObject *_args;
602{
603 PyObject *_res = NULL;
604 Cursor *crsr__in__;
605 int crsr__in_len__;
606 if (!PyArg_ParseTuple(_args, "s#",
607 (char **)&crsr__in__, &crsr__in_len__))
608 return NULL;
609 if (crsr__in_len__ != sizeof(Cursor))
610 {
611 PyErr_SetString(PyExc_TypeError, "buffer length should be sizeof(Cursor)");
612 goto crsr__error__;
613 }
Jack Jansen1c4e6141998-04-21 15:23:55 +0000614 MacSetCursor(crsr__in__);
Jack Jansenb5394061996-01-05 18:06:41 +0000615 Py_INCREF(Py_None);
616 _res = Py_None;
617 crsr__error__: ;
618 return _res;
619}
620
Guido van Rossume56db431995-03-19 22:49:50 +0000621static PyObject *Qd_HideCursor(_self, _args)
622 PyObject *_self;
623 PyObject *_args;
624{
625 PyObject *_res = NULL;
626 if (!PyArg_ParseTuple(_args, ""))
627 return NULL;
628 HideCursor();
629 Py_INCREF(Py_None);
630 _res = Py_None;
631 return _res;
632}
633
Jack Jansen1c4e6141998-04-21 15:23:55 +0000634static PyObject *Qd_MacShowCursor(_self, _args)
Guido van Rossume56db431995-03-19 22:49:50 +0000635 PyObject *_self;
636 PyObject *_args;
637{
638 PyObject *_res = NULL;
639 if (!PyArg_ParseTuple(_args, ""))
640 return NULL;
Jack Jansen1c4e6141998-04-21 15:23:55 +0000641 MacShowCursor();
Guido van Rossume56db431995-03-19 22:49:50 +0000642 Py_INCREF(Py_None);
643 _res = Py_None;
644 return _res;
645}
646
647static PyObject *Qd_ObscureCursor(_self, _args)
648 PyObject *_self;
649 PyObject *_args;
650{
651 PyObject *_res = NULL;
652 if (!PyArg_ParseTuple(_args, ""))
653 return NULL;
654 ObscureCursor();
655 Py_INCREF(Py_None);
656 _res = Py_None;
657 return _res;
658}
659
660static PyObject *Qd_HidePen(_self, _args)
661 PyObject *_self;
662 PyObject *_args;
663{
664 PyObject *_res = NULL;
665 if (!PyArg_ParseTuple(_args, ""))
666 return NULL;
667 HidePen();
668 Py_INCREF(Py_None);
669 _res = Py_None;
670 return _res;
671}
672
673static PyObject *Qd_ShowPen(_self, _args)
674 PyObject *_self;
675 PyObject *_args;
676{
677 PyObject *_res = NULL;
678 if (!PyArg_ParseTuple(_args, ""))
679 return NULL;
680 ShowPen();
681 Py_INCREF(Py_None);
682 _res = Py_None;
683 return _res;
684}
685
686static PyObject *Qd_GetPen(_self, _args)
687 PyObject *_self;
688 PyObject *_args;
689{
690 PyObject *_res = NULL;
691 Point pt;
Jack Jansen1d8ede71996-01-08 23:47:31 +0000692 if (!PyArg_ParseTuple(_args, ""))
Guido van Rossume56db431995-03-19 22:49:50 +0000693 return NULL;
694 GetPen(&pt);
695 _res = Py_BuildValue("O&",
696 PyMac_BuildPoint, pt);
697 return _res;
698}
699
Jack Jansen04a02e71996-01-06 17:12:58 +0000700static PyObject *Qd_GetPenState(_self, _args)
701 PyObject *_self;
702 PyObject *_args;
703{
704 PyObject *_res = NULL;
705 PenState pnState__out__;
706 if (!PyArg_ParseTuple(_args, ""))
707 return NULL;
708 GetPenState(&pnState__out__);
709 _res = Py_BuildValue("s#",
710 (char *)&pnState__out__, (int)sizeof(PenState));
711 pnState__error__: ;
712 return _res;
713}
714
715static PyObject *Qd_SetPenState(_self, _args)
716 PyObject *_self;
717 PyObject *_args;
718{
719 PyObject *_res = NULL;
720 PenState *pnState__in__;
721 int pnState__in_len__;
722 if (!PyArg_ParseTuple(_args, "s#",
723 (char **)&pnState__in__, &pnState__in_len__))
724 return NULL;
725 if (pnState__in_len__ != sizeof(PenState))
726 {
727 PyErr_SetString(PyExc_TypeError, "buffer length should be sizeof(PenState)");
728 goto pnState__error__;
729 }
730 SetPenState(pnState__in__);
731 Py_INCREF(Py_None);
732 _res = Py_None;
733 pnState__error__: ;
734 return _res;
735}
736
Guido van Rossume56db431995-03-19 22:49:50 +0000737static PyObject *Qd_PenSize(_self, _args)
738 PyObject *_self;
739 PyObject *_args;
740{
741 PyObject *_res = NULL;
742 short width;
743 short height;
744 if (!PyArg_ParseTuple(_args, "hh",
745 &width,
746 &height))
747 return NULL;
748 PenSize(width,
749 height);
750 Py_INCREF(Py_None);
751 _res = Py_None;
752 return _res;
753}
754
755static PyObject *Qd_PenMode(_self, _args)
756 PyObject *_self;
757 PyObject *_args;
758{
759 PyObject *_res = NULL;
760 short mode;
761 if (!PyArg_ParseTuple(_args, "h",
762 &mode))
763 return NULL;
764 PenMode(mode);
765 Py_INCREF(Py_None);
766 _res = Py_None;
767 return _res;
768}
769
Jack Jansen04a02e71996-01-06 17:12:58 +0000770static PyObject *Qd_PenPat(_self, _args)
771 PyObject *_self;
772 PyObject *_args;
773{
774 PyObject *_res = NULL;
775 Pattern *pat__in__;
776 int pat__in_len__;
777 if (!PyArg_ParseTuple(_args, "s#",
778 (char **)&pat__in__, &pat__in_len__))
779 return NULL;
780 if (pat__in_len__ != sizeof(Pattern))
781 {
782 PyErr_SetString(PyExc_TypeError, "buffer length should be sizeof(Pattern)");
783 goto pat__error__;
784 }
785 PenPat(pat__in__);
786 Py_INCREF(Py_None);
787 _res = Py_None;
788 pat__error__: ;
789 return _res;
790}
791
Guido van Rossume56db431995-03-19 22:49:50 +0000792static PyObject *Qd_PenNormal(_self, _args)
793 PyObject *_self;
794 PyObject *_args;
795{
796 PyObject *_res = NULL;
797 if (!PyArg_ParseTuple(_args, ""))
798 return NULL;
799 PenNormal();
800 Py_INCREF(Py_None);
801 _res = Py_None;
802 return _res;
803}
804
805static PyObject *Qd_MoveTo(_self, _args)
806 PyObject *_self;
807 PyObject *_args;
808{
809 PyObject *_res = NULL;
810 short h;
811 short v;
812 if (!PyArg_ParseTuple(_args, "hh",
813 &h,
814 &v))
815 return NULL;
816 MoveTo(h,
817 v);
818 Py_INCREF(Py_None);
819 _res = Py_None;
820 return _res;
821}
822
823static PyObject *Qd_Move(_self, _args)
824 PyObject *_self;
825 PyObject *_args;
826{
827 PyObject *_res = NULL;
828 short dh;
829 short dv;
830 if (!PyArg_ParseTuple(_args, "hh",
831 &dh,
832 &dv))
833 return NULL;
834 Move(dh,
835 dv);
836 Py_INCREF(Py_None);
837 _res = Py_None;
838 return _res;
839}
840
Jack Jansen1c4e6141998-04-21 15:23:55 +0000841static PyObject *Qd_MacLineTo(_self, _args)
Guido van Rossume56db431995-03-19 22:49:50 +0000842 PyObject *_self;
843 PyObject *_args;
844{
845 PyObject *_res = NULL;
846 short h;
847 short v;
848 if (!PyArg_ParseTuple(_args, "hh",
849 &h,
850 &v))
851 return NULL;
Jack Jansen1c4e6141998-04-21 15:23:55 +0000852 MacLineTo(h,
853 v);
Guido van Rossume56db431995-03-19 22:49:50 +0000854 Py_INCREF(Py_None);
855 _res = Py_None;
856 return _res;
857}
858
859static PyObject *Qd_Line(_self, _args)
860 PyObject *_self;
861 PyObject *_args;
862{
863 PyObject *_res = NULL;
864 short dh;
865 short dv;
866 if (!PyArg_ParseTuple(_args, "hh",
867 &dh,
868 &dv))
869 return NULL;
870 Line(dh,
871 dv);
872 Py_INCREF(Py_None);
873 _res = Py_None;
874 return _res;
875}
876
Guido van Rossume56db431995-03-19 22:49:50 +0000877static PyObject *Qd_ForeColor(_self, _args)
878 PyObject *_self;
879 PyObject *_args;
880{
881 PyObject *_res = NULL;
882 long color;
883 if (!PyArg_ParseTuple(_args, "l",
884 &color))
885 return NULL;
886 ForeColor(color);
887 Py_INCREF(Py_None);
888 _res = Py_None;
889 return _res;
890}
891
892static PyObject *Qd_BackColor(_self, _args)
893 PyObject *_self;
894 PyObject *_args;
895{
896 PyObject *_res = NULL;
897 long color;
898 if (!PyArg_ParseTuple(_args, "l",
899 &color))
900 return NULL;
901 BackColor(color);
902 Py_INCREF(Py_None);
903 _res = Py_None;
904 return _res;
905}
906
907static PyObject *Qd_ColorBit(_self, _args)
908 PyObject *_self;
909 PyObject *_args;
910{
911 PyObject *_res = NULL;
912 short whichBit;
913 if (!PyArg_ParseTuple(_args, "h",
914 &whichBit))
915 return NULL;
916 ColorBit(whichBit);
917 Py_INCREF(Py_None);
918 _res = Py_None;
919 return _res;
920}
921
Jack Jansen1c4e6141998-04-21 15:23:55 +0000922static PyObject *Qd_MacSetRect(_self, _args)
Guido van Rossume56db431995-03-19 22:49:50 +0000923 PyObject *_self;
924 PyObject *_args;
925{
926 PyObject *_res = NULL;
927 Rect r;
928 short left;
929 short top;
930 short right;
931 short bottom;
932 if (!PyArg_ParseTuple(_args, "hhhh",
933 &left,
934 &top,
935 &right,
936 &bottom))
937 return NULL;
Jack Jansen1c4e6141998-04-21 15:23:55 +0000938 MacSetRect(&r,
939 left,
940 top,
941 right,
942 bottom);
Guido van Rossume56db431995-03-19 22:49:50 +0000943 _res = Py_BuildValue("O&",
944 PyMac_BuildRect, &r);
945 return _res;
946}
947
Jack Jansen1c4e6141998-04-21 15:23:55 +0000948static PyObject *Qd_MacOffsetRect(_self, _args)
Guido van Rossume56db431995-03-19 22:49:50 +0000949 PyObject *_self;
950 PyObject *_args;
951{
952 PyObject *_res = NULL;
953 Rect r;
954 short dh;
955 short dv;
Jack Jansen54c8f7e1995-11-14 10:46:01 +0000956 if (!PyArg_ParseTuple(_args, "O&hh",
957 PyMac_GetRect, &r,
Guido van Rossume56db431995-03-19 22:49:50 +0000958 &dh,
959 &dv))
960 return NULL;
Jack Jansen1c4e6141998-04-21 15:23:55 +0000961 MacOffsetRect(&r,
962 dh,
963 dv);
Guido van Rossume56db431995-03-19 22:49:50 +0000964 _res = Py_BuildValue("O&",
965 PyMac_BuildRect, &r);
966 return _res;
967}
968
Jack Jansen1c4e6141998-04-21 15:23:55 +0000969static PyObject *Qd_MacInsetRect(_self, _args)
Guido van Rossume56db431995-03-19 22:49:50 +0000970 PyObject *_self;
971 PyObject *_args;
972{
973 PyObject *_res = NULL;
974 Rect r;
975 short dh;
976 short dv;
Jack Jansen54c8f7e1995-11-14 10:46:01 +0000977 if (!PyArg_ParseTuple(_args, "O&hh",
978 PyMac_GetRect, &r,
Guido van Rossume56db431995-03-19 22:49:50 +0000979 &dh,
980 &dv))
981 return NULL;
Jack Jansen1c4e6141998-04-21 15:23:55 +0000982 MacInsetRect(&r,
983 dh,
984 dv);
Guido van Rossume56db431995-03-19 22:49:50 +0000985 _res = Py_BuildValue("O&",
986 PyMac_BuildRect, &r);
987 return _res;
988}
989
990static PyObject *Qd_SectRect(_self, _args)
991 PyObject *_self;
992 PyObject *_args;
993{
994 PyObject *_res = NULL;
995 Boolean _rv;
996 Rect src1;
997 Rect src2;
998 Rect dstRect;
999 if (!PyArg_ParseTuple(_args, "O&O&",
1000 PyMac_GetRect, &src1,
1001 PyMac_GetRect, &src2))
1002 return NULL;
1003 _rv = SectRect(&src1,
1004 &src2,
1005 &dstRect);
1006 _res = Py_BuildValue("bO&",
1007 _rv,
1008 PyMac_BuildRect, &dstRect);
1009 return _res;
1010}
1011
Jack Jansen1c4e6141998-04-21 15:23:55 +00001012static PyObject *Qd_MacUnionRect(_self, _args)
Guido van Rossume56db431995-03-19 22:49:50 +00001013 PyObject *_self;
1014 PyObject *_args;
1015{
1016 PyObject *_res = NULL;
1017 Rect src1;
1018 Rect src2;
1019 Rect dstRect;
1020 if (!PyArg_ParseTuple(_args, "O&O&",
1021 PyMac_GetRect, &src1,
1022 PyMac_GetRect, &src2))
1023 return NULL;
Jack Jansen1c4e6141998-04-21 15:23:55 +00001024 MacUnionRect(&src1,
1025 &src2,
1026 &dstRect);
Guido van Rossume56db431995-03-19 22:49:50 +00001027 _res = Py_BuildValue("O&",
1028 PyMac_BuildRect, &dstRect);
1029 return _res;
1030}
1031
Jack Jansen1c4e6141998-04-21 15:23:55 +00001032static PyObject *Qd_MacEqualRect(_self, _args)
Guido van Rossume56db431995-03-19 22:49:50 +00001033 PyObject *_self;
1034 PyObject *_args;
1035{
1036 PyObject *_res = NULL;
1037 Boolean _rv;
1038 Rect rect1;
1039 Rect rect2;
1040 if (!PyArg_ParseTuple(_args, "O&O&",
1041 PyMac_GetRect, &rect1,
1042 PyMac_GetRect, &rect2))
1043 return NULL;
Jack Jansen1c4e6141998-04-21 15:23:55 +00001044 _rv = MacEqualRect(&rect1,
1045 &rect2);
Guido van Rossume56db431995-03-19 22:49:50 +00001046 _res = Py_BuildValue("b",
1047 _rv);
1048 return _res;
1049}
1050
1051static PyObject *Qd_EmptyRect(_self, _args)
1052 PyObject *_self;
1053 PyObject *_args;
1054{
1055 PyObject *_res = NULL;
1056 Boolean _rv;
1057 Rect r;
1058 if (!PyArg_ParseTuple(_args, "O&",
1059 PyMac_GetRect, &r))
1060 return NULL;
1061 _rv = EmptyRect(&r);
1062 _res = Py_BuildValue("b",
1063 _rv);
1064 return _res;
1065}
1066
Jack Jansen1c4e6141998-04-21 15:23:55 +00001067static PyObject *Qd_MacFrameRect(_self, _args)
Guido van Rossume56db431995-03-19 22:49:50 +00001068 PyObject *_self;
1069 PyObject *_args;
1070{
1071 PyObject *_res = NULL;
1072 Rect r;
1073 if (!PyArg_ParseTuple(_args, "O&",
1074 PyMac_GetRect, &r))
1075 return NULL;
Jack Jansen1c4e6141998-04-21 15:23:55 +00001076 MacFrameRect(&r);
Guido van Rossume56db431995-03-19 22:49:50 +00001077 Py_INCREF(Py_None);
1078 _res = Py_None;
1079 return _res;
1080}
1081
1082static PyObject *Qd_PaintRect(_self, _args)
1083 PyObject *_self;
1084 PyObject *_args;
1085{
1086 PyObject *_res = NULL;
1087 Rect r;
1088 if (!PyArg_ParseTuple(_args, "O&",
1089 PyMac_GetRect, &r))
1090 return NULL;
1091 PaintRect(&r);
1092 Py_INCREF(Py_None);
1093 _res = Py_None;
1094 return _res;
1095}
1096
Guido van Rossum17448e21995-01-30 11:53:55 +00001097static PyObject *Qd_EraseRect(_self, _args)
1098 PyObject *_self;
1099 PyObject *_args;
1100{
1101 PyObject *_res = NULL;
1102 Rect r;
1103 if (!PyArg_ParseTuple(_args, "O&",
1104 PyMac_GetRect, &r))
1105 return NULL;
1106 EraseRect(&r);
1107 Py_INCREF(Py_None);
1108 _res = Py_None;
1109 return _res;
1110}
1111
Jack Jansen1c4e6141998-04-21 15:23:55 +00001112static PyObject *Qd_MacInvertRect(_self, _args)
Guido van Rossum17448e21995-01-30 11:53:55 +00001113 PyObject *_self;
1114 PyObject *_args;
1115{
1116 PyObject *_res = NULL;
Guido van Rossume56db431995-03-19 22:49:50 +00001117 Rect r;
Guido van Rossum17448e21995-01-30 11:53:55 +00001118 if (!PyArg_ParseTuple(_args, "O&",
Guido van Rossume56db431995-03-19 22:49:50 +00001119 PyMac_GetRect, &r))
Guido van Rossum17448e21995-01-30 11:53:55 +00001120 return NULL;
Jack Jansen1c4e6141998-04-21 15:23:55 +00001121 MacInvertRect(&r);
Guido van Rossum17448e21995-01-30 11:53:55 +00001122 Py_INCREF(Py_None);
1123 _res = Py_None;
1124 return _res;
1125}
1126
Jack Jansen1c4e6141998-04-21 15:23:55 +00001127static PyObject *Qd_MacFillRect(_self, _args)
Jack Jansen04a02e71996-01-06 17:12:58 +00001128 PyObject *_self;
1129 PyObject *_args;
1130{
1131 PyObject *_res = NULL;
1132 Rect r;
1133 Pattern *pat__in__;
1134 int pat__in_len__;
1135 if (!PyArg_ParseTuple(_args, "O&s#",
1136 PyMac_GetRect, &r,
1137 (char **)&pat__in__, &pat__in_len__))
1138 return NULL;
1139 if (pat__in_len__ != sizeof(Pattern))
1140 {
1141 PyErr_SetString(PyExc_TypeError, "buffer length should be sizeof(Pattern)");
1142 goto pat__error__;
1143 }
Jack Jansen1c4e6141998-04-21 15:23:55 +00001144 MacFillRect(&r,
1145 pat__in__);
Jack Jansen04a02e71996-01-06 17:12:58 +00001146 Py_INCREF(Py_None);
1147 _res = Py_None;
1148 pat__error__: ;
1149 return _res;
1150}
1151
Guido van Rossume56db431995-03-19 22:49:50 +00001152static PyObject *Qd_FrameOval(_self, _args)
1153 PyObject *_self;
1154 PyObject *_args;
1155{
1156 PyObject *_res = NULL;
1157 Rect r;
1158 if (!PyArg_ParseTuple(_args, "O&",
1159 PyMac_GetRect, &r))
1160 return NULL;
1161 FrameOval(&r);
1162 Py_INCREF(Py_None);
1163 _res = Py_None;
1164 return _res;
1165}
1166
1167static PyObject *Qd_PaintOval(_self, _args)
1168 PyObject *_self;
1169 PyObject *_args;
1170{
1171 PyObject *_res = NULL;
1172 Rect r;
1173 if (!PyArg_ParseTuple(_args, "O&",
1174 PyMac_GetRect, &r))
1175 return NULL;
1176 PaintOval(&r);
1177 Py_INCREF(Py_None);
1178 _res = Py_None;
1179 return _res;
1180}
1181
1182static PyObject *Qd_EraseOval(_self, _args)
1183 PyObject *_self;
1184 PyObject *_args;
1185{
1186 PyObject *_res = NULL;
1187 Rect r;
1188 if (!PyArg_ParseTuple(_args, "O&",
1189 PyMac_GetRect, &r))
1190 return NULL;
1191 EraseOval(&r);
1192 Py_INCREF(Py_None);
1193 _res = Py_None;
1194 return _res;
1195}
1196
1197static PyObject *Qd_InvertOval(_self, _args)
1198 PyObject *_self;
1199 PyObject *_args;
1200{
1201 PyObject *_res = NULL;
1202 Rect r;
1203 if (!PyArg_ParseTuple(_args, "O&",
1204 PyMac_GetRect, &r))
1205 return NULL;
1206 InvertOval(&r);
1207 Py_INCREF(Py_None);
1208 _res = Py_None;
1209 return _res;
1210}
1211
Jack Jansen04a02e71996-01-06 17:12:58 +00001212static PyObject *Qd_FillOval(_self, _args)
1213 PyObject *_self;
1214 PyObject *_args;
1215{
1216 PyObject *_res = NULL;
1217 Rect r;
1218 Pattern *pat__in__;
1219 int pat__in_len__;
1220 if (!PyArg_ParseTuple(_args, "O&s#",
1221 PyMac_GetRect, &r,
1222 (char **)&pat__in__, &pat__in_len__))
1223 return NULL;
1224 if (pat__in_len__ != sizeof(Pattern))
1225 {
1226 PyErr_SetString(PyExc_TypeError, "buffer length should be sizeof(Pattern)");
1227 goto pat__error__;
1228 }
1229 FillOval(&r,
1230 pat__in__);
1231 Py_INCREF(Py_None);
1232 _res = Py_None;
1233 pat__error__: ;
1234 return _res;
1235}
1236
Guido van Rossume56db431995-03-19 22:49:50 +00001237static PyObject *Qd_FrameRoundRect(_self, _args)
1238 PyObject *_self;
1239 PyObject *_args;
1240{
1241 PyObject *_res = NULL;
1242 Rect r;
1243 short ovalWidth;
1244 short ovalHeight;
1245 if (!PyArg_ParseTuple(_args, "O&hh",
1246 PyMac_GetRect, &r,
1247 &ovalWidth,
1248 &ovalHeight))
1249 return NULL;
1250 FrameRoundRect(&r,
1251 ovalWidth,
1252 ovalHeight);
1253 Py_INCREF(Py_None);
1254 _res = Py_None;
1255 return _res;
1256}
1257
1258static PyObject *Qd_PaintRoundRect(_self, _args)
1259 PyObject *_self;
1260 PyObject *_args;
1261{
1262 PyObject *_res = NULL;
1263 Rect r;
1264 short ovalWidth;
1265 short ovalHeight;
1266 if (!PyArg_ParseTuple(_args, "O&hh",
1267 PyMac_GetRect, &r,
1268 &ovalWidth,
1269 &ovalHeight))
1270 return NULL;
1271 PaintRoundRect(&r,
1272 ovalWidth,
1273 ovalHeight);
1274 Py_INCREF(Py_None);
1275 _res = Py_None;
1276 return _res;
1277}
1278
1279static PyObject *Qd_EraseRoundRect(_self, _args)
1280 PyObject *_self;
1281 PyObject *_args;
1282{
1283 PyObject *_res = NULL;
1284 Rect r;
1285 short ovalWidth;
1286 short ovalHeight;
1287 if (!PyArg_ParseTuple(_args, "O&hh",
1288 PyMac_GetRect, &r,
1289 &ovalWidth,
1290 &ovalHeight))
1291 return NULL;
1292 EraseRoundRect(&r,
1293 ovalWidth,
1294 ovalHeight);
1295 Py_INCREF(Py_None);
1296 _res = Py_None;
1297 return _res;
1298}
1299
1300static PyObject *Qd_InvertRoundRect(_self, _args)
1301 PyObject *_self;
1302 PyObject *_args;
1303{
1304 PyObject *_res = NULL;
1305 Rect r;
1306 short ovalWidth;
1307 short ovalHeight;
1308 if (!PyArg_ParseTuple(_args, "O&hh",
1309 PyMac_GetRect, &r,
1310 &ovalWidth,
1311 &ovalHeight))
1312 return NULL;
1313 InvertRoundRect(&r,
1314 ovalWidth,
1315 ovalHeight);
1316 Py_INCREF(Py_None);
1317 _res = Py_None;
1318 return _res;
1319}
1320
Jack Jansen04a02e71996-01-06 17:12:58 +00001321static PyObject *Qd_FillRoundRect(_self, _args)
1322 PyObject *_self;
1323 PyObject *_args;
1324{
1325 PyObject *_res = NULL;
1326 Rect r;
1327 short ovalWidth;
1328 short ovalHeight;
1329 Pattern *pat__in__;
1330 int pat__in_len__;
1331 if (!PyArg_ParseTuple(_args, "O&hhs#",
1332 PyMac_GetRect, &r,
1333 &ovalWidth,
1334 &ovalHeight,
1335 (char **)&pat__in__, &pat__in_len__))
1336 return NULL;
1337 if (pat__in_len__ != sizeof(Pattern))
1338 {
1339 PyErr_SetString(PyExc_TypeError, "buffer length should be sizeof(Pattern)");
1340 goto pat__error__;
1341 }
1342 FillRoundRect(&r,
1343 ovalWidth,
1344 ovalHeight,
1345 pat__in__);
1346 Py_INCREF(Py_None);
1347 _res = Py_None;
1348 pat__error__: ;
1349 return _res;
1350}
1351
Guido van Rossume56db431995-03-19 22:49:50 +00001352static PyObject *Qd_FrameArc(_self, _args)
1353 PyObject *_self;
1354 PyObject *_args;
1355{
1356 PyObject *_res = NULL;
1357 Rect r;
1358 short startAngle;
1359 short arcAngle;
1360 if (!PyArg_ParseTuple(_args, "O&hh",
1361 PyMac_GetRect, &r,
1362 &startAngle,
1363 &arcAngle))
1364 return NULL;
1365 FrameArc(&r,
1366 startAngle,
1367 arcAngle);
1368 Py_INCREF(Py_None);
1369 _res = Py_None;
1370 return _res;
1371}
1372
1373static PyObject *Qd_PaintArc(_self, _args)
1374 PyObject *_self;
1375 PyObject *_args;
1376{
1377 PyObject *_res = NULL;
1378 Rect r;
1379 short startAngle;
1380 short arcAngle;
1381 if (!PyArg_ParseTuple(_args, "O&hh",
1382 PyMac_GetRect, &r,
1383 &startAngle,
1384 &arcAngle))
1385 return NULL;
1386 PaintArc(&r,
1387 startAngle,
1388 arcAngle);
1389 Py_INCREF(Py_None);
1390 _res = Py_None;
1391 return _res;
1392}
1393
1394static PyObject *Qd_EraseArc(_self, _args)
1395 PyObject *_self;
1396 PyObject *_args;
1397{
1398 PyObject *_res = NULL;
1399 Rect r;
1400 short startAngle;
1401 short arcAngle;
1402 if (!PyArg_ParseTuple(_args, "O&hh",
1403 PyMac_GetRect, &r,
1404 &startAngle,
1405 &arcAngle))
1406 return NULL;
1407 EraseArc(&r,
1408 startAngle,
1409 arcAngle);
1410 Py_INCREF(Py_None);
1411 _res = Py_None;
1412 return _res;
1413}
1414
1415static PyObject *Qd_InvertArc(_self, _args)
1416 PyObject *_self;
1417 PyObject *_args;
1418{
1419 PyObject *_res = NULL;
1420 Rect r;
1421 short startAngle;
1422 short arcAngle;
1423 if (!PyArg_ParseTuple(_args, "O&hh",
1424 PyMac_GetRect, &r,
1425 &startAngle,
1426 &arcAngle))
1427 return NULL;
1428 InvertArc(&r,
1429 startAngle,
1430 arcAngle);
1431 Py_INCREF(Py_None);
1432 _res = Py_None;
1433 return _res;
1434}
1435
Jack Jansen04a02e71996-01-06 17:12:58 +00001436static PyObject *Qd_FillArc(_self, _args)
1437 PyObject *_self;
1438 PyObject *_args;
1439{
1440 PyObject *_res = NULL;
1441 Rect r;
1442 short startAngle;
1443 short arcAngle;
1444 Pattern *pat__in__;
1445 int pat__in_len__;
1446 if (!PyArg_ParseTuple(_args, "O&hhs#",
1447 PyMac_GetRect, &r,
1448 &startAngle,
1449 &arcAngle,
1450 (char **)&pat__in__, &pat__in_len__))
1451 return NULL;
1452 if (pat__in_len__ != sizeof(Pattern))
1453 {
1454 PyErr_SetString(PyExc_TypeError, "buffer length should be sizeof(Pattern)");
1455 goto pat__error__;
1456 }
1457 FillArc(&r,
1458 startAngle,
1459 arcAngle,
1460 pat__in__);
1461 Py_INCREF(Py_None);
1462 _res = Py_None;
1463 pat__error__: ;
1464 return _res;
1465}
1466
Guido van Rossume56db431995-03-19 22:49:50 +00001467static PyObject *Qd_NewRgn(_self, _args)
1468 PyObject *_self;
1469 PyObject *_args;
1470{
1471 PyObject *_res = NULL;
1472 RgnHandle _rv;
1473 if (!PyArg_ParseTuple(_args, ""))
1474 return NULL;
1475 _rv = NewRgn();
1476 _res = Py_BuildValue("O&",
1477 ResObj_New, _rv);
1478 return _res;
1479}
1480
1481static PyObject *Qd_OpenRgn(_self, _args)
1482 PyObject *_self;
1483 PyObject *_args;
1484{
1485 PyObject *_res = NULL;
1486 if (!PyArg_ParseTuple(_args, ""))
1487 return NULL;
1488 OpenRgn();
1489 Py_INCREF(Py_None);
1490 _res = Py_None;
1491 return _res;
1492}
1493
1494static PyObject *Qd_CloseRgn(_self, _args)
1495 PyObject *_self;
1496 PyObject *_args;
1497{
1498 PyObject *_res = NULL;
1499 RgnHandle dstRgn;
1500 if (!PyArg_ParseTuple(_args, "O&",
1501 ResObj_Convert, &dstRgn))
1502 return NULL;
1503 CloseRgn(dstRgn);
1504 Py_INCREF(Py_None);
1505 _res = Py_None;
1506 return _res;
1507}
1508
Jack Jansen41058c01995-11-16 22:48:29 +00001509static PyObject *Qd_BitMapToRegion(_self, _args)
1510 PyObject *_self;
1511 PyObject *_args;
1512{
1513 PyObject *_res = NULL;
1514 OSErr _err;
1515 RgnHandle region;
1516 BitMapPtr bMap;
1517 if (!PyArg_ParseTuple(_args, "O&O&",
1518 ResObj_Convert, &region,
1519 BMObj_Convert, &bMap))
1520 return NULL;
1521 _err = BitMapToRegion(region,
1522 bMap);
1523 if (_err != noErr) return PyMac_Error(_err);
1524 Py_INCREF(Py_None);
1525 _res = Py_None;
1526 return _res;
1527}
1528
Guido van Rossume56db431995-03-19 22:49:50 +00001529static PyObject *Qd_DisposeRgn(_self, _args)
1530 PyObject *_self;
1531 PyObject *_args;
1532{
1533 PyObject *_res = NULL;
1534 RgnHandle rgn;
1535 if (!PyArg_ParseTuple(_args, "O&",
1536 ResObj_Convert, &rgn))
1537 return NULL;
1538 DisposeRgn(rgn);
1539 Py_INCREF(Py_None);
1540 _res = Py_None;
1541 return _res;
1542}
1543
Jack Jansen1c4e6141998-04-21 15:23:55 +00001544static PyObject *Qd_MacCopyRgn(_self, _args)
Guido van Rossume56db431995-03-19 22:49:50 +00001545 PyObject *_self;
1546 PyObject *_args;
1547{
1548 PyObject *_res = NULL;
1549 RgnHandle srcRgn;
1550 RgnHandle dstRgn;
1551 if (!PyArg_ParseTuple(_args, "O&O&",
1552 ResObj_Convert, &srcRgn,
1553 ResObj_Convert, &dstRgn))
1554 return NULL;
Jack Jansen1c4e6141998-04-21 15:23:55 +00001555 MacCopyRgn(srcRgn,
1556 dstRgn);
Guido van Rossume56db431995-03-19 22:49:50 +00001557 Py_INCREF(Py_None);
1558 _res = Py_None;
1559 return _res;
1560}
1561
1562static PyObject *Qd_SetEmptyRgn(_self, _args)
1563 PyObject *_self;
1564 PyObject *_args;
1565{
1566 PyObject *_res = NULL;
1567 RgnHandle rgn;
1568 if (!PyArg_ParseTuple(_args, "O&",
1569 ResObj_Convert, &rgn))
1570 return NULL;
1571 SetEmptyRgn(rgn);
1572 Py_INCREF(Py_None);
1573 _res = Py_None;
1574 return _res;
1575}
1576
Jack Jansen1c4e6141998-04-21 15:23:55 +00001577static PyObject *Qd_MacSetRectRgn(_self, _args)
Guido van Rossume56db431995-03-19 22:49:50 +00001578 PyObject *_self;
1579 PyObject *_args;
1580{
1581 PyObject *_res = NULL;
1582 RgnHandle rgn;
1583 short left;
1584 short top;
1585 short right;
1586 short bottom;
1587 if (!PyArg_ParseTuple(_args, "O&hhhh",
1588 ResObj_Convert, &rgn,
1589 &left,
1590 &top,
1591 &right,
1592 &bottom))
1593 return NULL;
Jack Jansen1c4e6141998-04-21 15:23:55 +00001594 MacSetRectRgn(rgn,
1595 left,
1596 top,
1597 right,
1598 bottom);
Guido van Rossume56db431995-03-19 22:49:50 +00001599 Py_INCREF(Py_None);
1600 _res = Py_None;
1601 return _res;
1602}
1603
1604static PyObject *Qd_RectRgn(_self, _args)
1605 PyObject *_self;
1606 PyObject *_args;
1607{
1608 PyObject *_res = NULL;
1609 RgnHandle rgn;
1610 Rect r;
1611 if (!PyArg_ParseTuple(_args, "O&O&",
1612 ResObj_Convert, &rgn,
1613 PyMac_GetRect, &r))
1614 return NULL;
1615 RectRgn(rgn,
1616 &r);
1617 Py_INCREF(Py_None);
1618 _res = Py_None;
1619 return _res;
1620}
1621
Jack Jansen1c4e6141998-04-21 15:23:55 +00001622static PyObject *Qd_MacOffsetRgn(_self, _args)
Guido van Rossume56db431995-03-19 22:49:50 +00001623 PyObject *_self;
1624 PyObject *_args;
1625{
1626 PyObject *_res = NULL;
1627 RgnHandle rgn;
1628 short dh;
1629 short dv;
1630 if (!PyArg_ParseTuple(_args, "O&hh",
1631 ResObj_Convert, &rgn,
1632 &dh,
1633 &dv))
1634 return NULL;
Jack Jansen1c4e6141998-04-21 15:23:55 +00001635 MacOffsetRgn(rgn,
1636 dh,
1637 dv);
Guido van Rossume56db431995-03-19 22:49:50 +00001638 Py_INCREF(Py_None);
1639 _res = Py_None;
1640 return _res;
1641}
1642
1643static PyObject *Qd_InsetRgn(_self, _args)
1644 PyObject *_self;
1645 PyObject *_args;
1646{
1647 PyObject *_res = NULL;
1648 RgnHandle rgn;
1649 short dh;
1650 short dv;
1651 if (!PyArg_ParseTuple(_args, "O&hh",
1652 ResObj_Convert, &rgn,
1653 &dh,
1654 &dv))
1655 return NULL;
1656 InsetRgn(rgn,
1657 dh,
1658 dv);
1659 Py_INCREF(Py_None);
1660 _res = Py_None;
1661 return _res;
1662}
1663
1664static PyObject *Qd_SectRgn(_self, _args)
1665 PyObject *_self;
1666 PyObject *_args;
1667{
1668 PyObject *_res = NULL;
1669 RgnHandle srcRgnA;
1670 RgnHandle srcRgnB;
1671 RgnHandle dstRgn;
1672 if (!PyArg_ParseTuple(_args, "O&O&O&",
1673 ResObj_Convert, &srcRgnA,
1674 ResObj_Convert, &srcRgnB,
1675 ResObj_Convert, &dstRgn))
1676 return NULL;
1677 SectRgn(srcRgnA,
1678 srcRgnB,
1679 dstRgn);
1680 Py_INCREF(Py_None);
1681 _res = Py_None;
1682 return _res;
1683}
1684
Jack Jansen1c4e6141998-04-21 15:23:55 +00001685static PyObject *Qd_MacUnionRgn(_self, _args)
Guido van Rossume56db431995-03-19 22:49:50 +00001686 PyObject *_self;
1687 PyObject *_args;
1688{
1689 PyObject *_res = NULL;
1690 RgnHandle srcRgnA;
1691 RgnHandle srcRgnB;
1692 RgnHandle dstRgn;
1693 if (!PyArg_ParseTuple(_args, "O&O&O&",
1694 ResObj_Convert, &srcRgnA,
1695 ResObj_Convert, &srcRgnB,
1696 ResObj_Convert, &dstRgn))
1697 return NULL;
Jack Jansen1c4e6141998-04-21 15:23:55 +00001698 MacUnionRgn(srcRgnA,
1699 srcRgnB,
1700 dstRgn);
Guido van Rossume56db431995-03-19 22:49:50 +00001701 Py_INCREF(Py_None);
1702 _res = Py_None;
1703 return _res;
1704}
1705
1706static PyObject *Qd_DiffRgn(_self, _args)
1707 PyObject *_self;
1708 PyObject *_args;
1709{
1710 PyObject *_res = NULL;
1711 RgnHandle srcRgnA;
1712 RgnHandle srcRgnB;
1713 RgnHandle dstRgn;
1714 if (!PyArg_ParseTuple(_args, "O&O&O&",
1715 ResObj_Convert, &srcRgnA,
1716 ResObj_Convert, &srcRgnB,
1717 ResObj_Convert, &dstRgn))
1718 return NULL;
1719 DiffRgn(srcRgnA,
1720 srcRgnB,
1721 dstRgn);
1722 Py_INCREF(Py_None);
1723 _res = Py_None;
1724 return _res;
1725}
1726
Jack Jansen1c4e6141998-04-21 15:23:55 +00001727static PyObject *Qd_MacXorRgn(_self, _args)
Guido van Rossume56db431995-03-19 22:49:50 +00001728 PyObject *_self;
1729 PyObject *_args;
1730{
1731 PyObject *_res = NULL;
1732 RgnHandle srcRgnA;
1733 RgnHandle srcRgnB;
1734 RgnHandle dstRgn;
1735 if (!PyArg_ParseTuple(_args, "O&O&O&",
1736 ResObj_Convert, &srcRgnA,
1737 ResObj_Convert, &srcRgnB,
1738 ResObj_Convert, &dstRgn))
1739 return NULL;
Jack Jansen1c4e6141998-04-21 15:23:55 +00001740 MacXorRgn(srcRgnA,
1741 srcRgnB,
1742 dstRgn);
Guido van Rossume56db431995-03-19 22:49:50 +00001743 Py_INCREF(Py_None);
1744 _res = Py_None;
1745 return _res;
1746}
1747
1748static PyObject *Qd_RectInRgn(_self, _args)
1749 PyObject *_self;
1750 PyObject *_args;
1751{
1752 PyObject *_res = NULL;
1753 Boolean _rv;
1754 Rect r;
1755 RgnHandle rgn;
1756 if (!PyArg_ParseTuple(_args, "O&O&",
1757 PyMac_GetRect, &r,
1758 ResObj_Convert, &rgn))
1759 return NULL;
1760 _rv = RectInRgn(&r,
1761 rgn);
1762 _res = Py_BuildValue("b",
1763 _rv);
1764 return _res;
1765}
1766
Jack Jansen1c4e6141998-04-21 15:23:55 +00001767static PyObject *Qd_MacEqualRgn(_self, _args)
Guido van Rossume56db431995-03-19 22:49:50 +00001768 PyObject *_self;
1769 PyObject *_args;
1770{
1771 PyObject *_res = NULL;
1772 Boolean _rv;
1773 RgnHandle rgnA;
1774 RgnHandle rgnB;
1775 if (!PyArg_ParseTuple(_args, "O&O&",
1776 ResObj_Convert, &rgnA,
1777 ResObj_Convert, &rgnB))
1778 return NULL;
Jack Jansen1c4e6141998-04-21 15:23:55 +00001779 _rv = MacEqualRgn(rgnA,
1780 rgnB);
Guido van Rossume56db431995-03-19 22:49:50 +00001781 _res = Py_BuildValue("b",
1782 _rv);
1783 return _res;
1784}
1785
1786static PyObject *Qd_EmptyRgn(_self, _args)
1787 PyObject *_self;
1788 PyObject *_args;
1789{
1790 PyObject *_res = NULL;
1791 Boolean _rv;
1792 RgnHandle rgn;
1793 if (!PyArg_ParseTuple(_args, "O&",
1794 ResObj_Convert, &rgn))
1795 return NULL;
1796 _rv = EmptyRgn(rgn);
1797 _res = Py_BuildValue("b",
1798 _rv);
1799 return _res;
1800}
1801
Jack Jansen1c4e6141998-04-21 15:23:55 +00001802static PyObject *Qd_MacFrameRgn(_self, _args)
Guido van Rossume56db431995-03-19 22:49:50 +00001803 PyObject *_self;
1804 PyObject *_args;
1805{
1806 PyObject *_res = NULL;
1807 RgnHandle rgn;
1808 if (!PyArg_ParseTuple(_args, "O&",
1809 ResObj_Convert, &rgn))
1810 return NULL;
Jack Jansen1c4e6141998-04-21 15:23:55 +00001811 MacFrameRgn(rgn);
Guido van Rossume56db431995-03-19 22:49:50 +00001812 Py_INCREF(Py_None);
1813 _res = Py_None;
1814 return _res;
1815}
1816
Jack Jansen1c4e6141998-04-21 15:23:55 +00001817static PyObject *Qd_MacPaintRgn(_self, _args)
Guido van Rossume56db431995-03-19 22:49:50 +00001818 PyObject *_self;
1819 PyObject *_args;
1820{
1821 PyObject *_res = NULL;
1822 RgnHandle rgn;
1823 if (!PyArg_ParseTuple(_args, "O&",
1824 ResObj_Convert, &rgn))
1825 return NULL;
Jack Jansen1c4e6141998-04-21 15:23:55 +00001826 MacPaintRgn(rgn);
Guido van Rossume56db431995-03-19 22:49:50 +00001827 Py_INCREF(Py_None);
1828 _res = Py_None;
1829 return _res;
1830}
1831
1832static PyObject *Qd_EraseRgn(_self, _args)
1833 PyObject *_self;
1834 PyObject *_args;
1835{
1836 PyObject *_res = NULL;
1837 RgnHandle rgn;
1838 if (!PyArg_ParseTuple(_args, "O&",
1839 ResObj_Convert, &rgn))
1840 return NULL;
1841 EraseRgn(rgn);
1842 Py_INCREF(Py_None);
1843 _res = Py_None;
1844 return _res;
1845}
1846
Jack Jansen1c4e6141998-04-21 15:23:55 +00001847static PyObject *Qd_MacInvertRgn(_self, _args)
Guido van Rossume56db431995-03-19 22:49:50 +00001848 PyObject *_self;
1849 PyObject *_args;
1850{
1851 PyObject *_res = NULL;
1852 RgnHandle rgn;
1853 if (!PyArg_ParseTuple(_args, "O&",
1854 ResObj_Convert, &rgn))
1855 return NULL;
Jack Jansen1c4e6141998-04-21 15:23:55 +00001856 MacInvertRgn(rgn);
Guido van Rossume56db431995-03-19 22:49:50 +00001857 Py_INCREF(Py_None);
1858 _res = Py_None;
1859 return _res;
1860}
1861
Jack Jansen1c4e6141998-04-21 15:23:55 +00001862static PyObject *Qd_MacFillRgn(_self, _args)
Jack Jansen04a02e71996-01-06 17:12:58 +00001863 PyObject *_self;
1864 PyObject *_args;
1865{
1866 PyObject *_res = NULL;
1867 RgnHandle rgn;
1868 Pattern *pat__in__;
1869 int pat__in_len__;
1870 if (!PyArg_ParseTuple(_args, "O&s#",
1871 ResObj_Convert, &rgn,
1872 (char **)&pat__in__, &pat__in_len__))
1873 return NULL;
1874 if (pat__in_len__ != sizeof(Pattern))
1875 {
1876 PyErr_SetString(PyExc_TypeError, "buffer length should be sizeof(Pattern)");
1877 goto pat__error__;
1878 }
Jack Jansen1c4e6141998-04-21 15:23:55 +00001879 MacFillRgn(rgn,
1880 pat__in__);
Jack Jansen04a02e71996-01-06 17:12:58 +00001881 Py_INCREF(Py_None);
1882 _res = Py_None;
1883 pat__error__: ;
1884 return _res;
1885}
1886
Guido van Rossume56db431995-03-19 22:49:50 +00001887static PyObject *Qd_ScrollRect(_self, _args)
1888 PyObject *_self;
1889 PyObject *_args;
1890{
1891 PyObject *_res = NULL;
1892 Rect r;
1893 short dh;
1894 short dv;
1895 RgnHandle updateRgn;
1896 if (!PyArg_ParseTuple(_args, "O&hhO&",
1897 PyMac_GetRect, &r,
1898 &dh,
1899 &dv,
1900 ResObj_Convert, &updateRgn))
1901 return NULL;
1902 ScrollRect(&r,
1903 dh,
1904 dv,
1905 updateRgn);
1906 Py_INCREF(Py_None);
1907 _res = Py_None;
1908 return _res;
1909}
1910
Jack Jansen41058c01995-11-16 22:48:29 +00001911static PyObject *Qd_CopyBits(_self, _args)
1912 PyObject *_self;
1913 PyObject *_args;
1914{
1915 PyObject *_res = NULL;
1916 BitMapPtr srcBits;
1917 BitMapPtr dstBits;
1918 Rect srcRect;
1919 Rect dstRect;
1920 short mode;
1921 RgnHandle maskRgn;
1922 if (!PyArg_ParseTuple(_args, "O&O&O&O&hO&",
1923 BMObj_Convert, &srcBits,
1924 BMObj_Convert, &dstBits,
1925 PyMac_GetRect, &srcRect,
1926 PyMac_GetRect, &dstRect,
1927 &mode,
Jack Jansen425e9eb1995-12-12 15:02:03 +00001928 OptResObj_Convert, &maskRgn))
Jack Jansen41058c01995-11-16 22:48:29 +00001929 return NULL;
1930 CopyBits(srcBits,
1931 dstBits,
1932 &srcRect,
1933 &dstRect,
1934 mode,
1935 maskRgn);
1936 Py_INCREF(Py_None);
1937 _res = Py_None;
1938 return _res;
1939}
1940
1941static PyObject *Qd_CopyMask(_self, _args)
1942 PyObject *_self;
1943 PyObject *_args;
1944{
1945 PyObject *_res = NULL;
1946 BitMapPtr srcBits;
1947 BitMapPtr maskBits;
1948 BitMapPtr dstBits;
1949 Rect srcRect;
1950 Rect maskRect;
1951 Rect dstRect;
1952 if (!PyArg_ParseTuple(_args, "O&O&O&O&O&O&",
1953 BMObj_Convert, &srcBits,
1954 BMObj_Convert, &maskBits,
1955 BMObj_Convert, &dstBits,
1956 PyMac_GetRect, &srcRect,
1957 PyMac_GetRect, &maskRect,
1958 PyMac_GetRect, &dstRect))
1959 return NULL;
1960 CopyMask(srcBits,
1961 maskBits,
1962 dstBits,
1963 &srcRect,
1964 &maskRect,
1965 &dstRect);
1966 Py_INCREF(Py_None);
1967 _res = Py_None;
1968 return _res;
1969}
1970
Guido van Rossume56db431995-03-19 22:49:50 +00001971static PyObject *Qd_OpenPicture(_self, _args)
1972 PyObject *_self;
1973 PyObject *_args;
1974{
1975 PyObject *_res = NULL;
1976 PicHandle _rv;
1977 Rect picFrame;
1978 if (!PyArg_ParseTuple(_args, "O&",
1979 PyMac_GetRect, &picFrame))
1980 return NULL;
1981 _rv = OpenPicture(&picFrame);
1982 _res = Py_BuildValue("O&",
1983 ResObj_New, _rv);
1984 return _res;
1985}
1986
1987static PyObject *Qd_PicComment(_self, _args)
1988 PyObject *_self;
1989 PyObject *_args;
1990{
1991 PyObject *_res = NULL;
1992 short kind;
1993 short dataSize;
1994 Handle dataHandle;
1995 if (!PyArg_ParseTuple(_args, "hhO&",
1996 &kind,
1997 &dataSize,
1998 ResObj_Convert, &dataHandle))
1999 return NULL;
2000 PicComment(kind,
2001 dataSize,
2002 dataHandle);
2003 Py_INCREF(Py_None);
2004 _res = Py_None;
2005 return _res;
2006}
2007
2008static PyObject *Qd_ClosePicture(_self, _args)
2009 PyObject *_self;
2010 PyObject *_args;
2011{
2012 PyObject *_res = NULL;
2013 if (!PyArg_ParseTuple(_args, ""))
2014 return NULL;
2015 ClosePicture();
2016 Py_INCREF(Py_None);
2017 _res = Py_None;
2018 return _res;
2019}
2020
2021static PyObject *Qd_DrawPicture(_self, _args)
2022 PyObject *_self;
2023 PyObject *_args;
2024{
2025 PyObject *_res = NULL;
2026 PicHandle myPicture;
2027 Rect dstRect;
2028 if (!PyArg_ParseTuple(_args, "O&O&",
2029 ResObj_Convert, &myPicture,
2030 PyMac_GetRect, &dstRect))
2031 return NULL;
2032 DrawPicture(myPicture,
2033 &dstRect);
2034 Py_INCREF(Py_None);
2035 _res = Py_None;
2036 return _res;
2037}
2038
2039static PyObject *Qd_KillPicture(_self, _args)
2040 PyObject *_self;
2041 PyObject *_args;
2042{
2043 PyObject *_res = NULL;
2044 PicHandle myPicture;
2045 if (!PyArg_ParseTuple(_args, "O&",
2046 ResObj_Convert, &myPicture))
2047 return NULL;
2048 KillPicture(myPicture);
2049 Py_INCREF(Py_None);
2050 _res = Py_None;
2051 return _res;
2052}
2053
2054static PyObject *Qd_OpenPoly(_self, _args)
2055 PyObject *_self;
2056 PyObject *_args;
2057{
2058 PyObject *_res = NULL;
2059 PolyHandle _rv;
2060 if (!PyArg_ParseTuple(_args, ""))
2061 return NULL;
2062 _rv = OpenPoly();
2063 _res = Py_BuildValue("O&",
2064 ResObj_New, _rv);
2065 return _res;
2066}
2067
2068static PyObject *Qd_ClosePoly(_self, _args)
2069 PyObject *_self;
2070 PyObject *_args;
2071{
2072 PyObject *_res = NULL;
2073 if (!PyArg_ParseTuple(_args, ""))
2074 return NULL;
2075 ClosePoly();
2076 Py_INCREF(Py_None);
2077 _res = Py_None;
2078 return _res;
2079}
2080
2081static PyObject *Qd_KillPoly(_self, _args)
2082 PyObject *_self;
2083 PyObject *_args;
2084{
2085 PyObject *_res = NULL;
2086 PolyHandle poly;
2087 if (!PyArg_ParseTuple(_args, "O&",
2088 ResObj_Convert, &poly))
2089 return NULL;
2090 KillPoly(poly);
2091 Py_INCREF(Py_None);
2092 _res = Py_None;
2093 return _res;
2094}
2095
2096static PyObject *Qd_OffsetPoly(_self, _args)
2097 PyObject *_self;
2098 PyObject *_args;
2099{
2100 PyObject *_res = NULL;
2101 PolyHandle poly;
2102 short dh;
2103 short dv;
2104 if (!PyArg_ParseTuple(_args, "O&hh",
2105 ResObj_Convert, &poly,
2106 &dh,
2107 &dv))
2108 return NULL;
2109 OffsetPoly(poly,
2110 dh,
2111 dv);
2112 Py_INCREF(Py_None);
2113 _res = Py_None;
2114 return _res;
2115}
2116
2117static PyObject *Qd_FramePoly(_self, _args)
2118 PyObject *_self;
2119 PyObject *_args;
2120{
2121 PyObject *_res = NULL;
2122 PolyHandle poly;
2123 if (!PyArg_ParseTuple(_args, "O&",
2124 ResObj_Convert, &poly))
2125 return NULL;
2126 FramePoly(poly);
2127 Py_INCREF(Py_None);
2128 _res = Py_None;
2129 return _res;
2130}
2131
2132static PyObject *Qd_PaintPoly(_self, _args)
2133 PyObject *_self;
2134 PyObject *_args;
2135{
2136 PyObject *_res = NULL;
2137 PolyHandle poly;
2138 if (!PyArg_ParseTuple(_args, "O&",
2139 ResObj_Convert, &poly))
2140 return NULL;
2141 PaintPoly(poly);
2142 Py_INCREF(Py_None);
2143 _res = Py_None;
2144 return _res;
2145}
2146
2147static PyObject *Qd_ErasePoly(_self, _args)
2148 PyObject *_self;
2149 PyObject *_args;
2150{
2151 PyObject *_res = NULL;
2152 PolyHandle poly;
2153 if (!PyArg_ParseTuple(_args, "O&",
2154 ResObj_Convert, &poly))
2155 return NULL;
2156 ErasePoly(poly);
2157 Py_INCREF(Py_None);
2158 _res = Py_None;
2159 return _res;
2160}
2161
2162static PyObject *Qd_InvertPoly(_self, _args)
2163 PyObject *_self;
2164 PyObject *_args;
2165{
2166 PyObject *_res = NULL;
2167 PolyHandle poly;
2168 if (!PyArg_ParseTuple(_args, "O&",
2169 ResObj_Convert, &poly))
2170 return NULL;
2171 InvertPoly(poly);
2172 Py_INCREF(Py_None);
2173 _res = Py_None;
2174 return _res;
2175}
2176
Jack Jansen04a02e71996-01-06 17:12:58 +00002177static PyObject *Qd_FillPoly(_self, _args)
2178 PyObject *_self;
2179 PyObject *_args;
2180{
2181 PyObject *_res = NULL;
2182 PolyHandle poly;
2183 Pattern *pat__in__;
2184 int pat__in_len__;
2185 if (!PyArg_ParseTuple(_args, "O&s#",
2186 ResObj_Convert, &poly,
2187 (char **)&pat__in__, &pat__in_len__))
2188 return NULL;
2189 if (pat__in_len__ != sizeof(Pattern))
2190 {
2191 PyErr_SetString(PyExc_TypeError, "buffer length should be sizeof(Pattern)");
2192 goto pat__error__;
2193 }
2194 FillPoly(poly,
2195 pat__in__);
2196 Py_INCREF(Py_None);
2197 _res = Py_None;
2198 pat__error__: ;
2199 return _res;
2200}
2201
Guido van Rossume56db431995-03-19 22:49:50 +00002202static PyObject *Qd_SetPt(_self, _args)
2203 PyObject *_self;
2204 PyObject *_args;
2205{
2206 PyObject *_res = NULL;
2207 Point pt;
2208 short h;
2209 short v;
Jack Jansen1d8ede71996-01-08 23:47:31 +00002210 if (!PyArg_ParseTuple(_args, "hh",
Guido van Rossume56db431995-03-19 22:49:50 +00002211 &h,
2212 &v))
2213 return NULL;
2214 SetPt(&pt,
2215 h,
2216 v);
2217 _res = Py_BuildValue("O&",
2218 PyMac_BuildPoint, pt);
2219 return _res;
2220}
2221
2222static PyObject *Qd_LocalToGlobal(_self, _args)
2223 PyObject *_self;
2224 PyObject *_args;
2225{
2226 PyObject *_res = NULL;
2227 Point pt;
2228 if (!PyArg_ParseTuple(_args, "O&",
2229 PyMac_GetPoint, &pt))
2230 return NULL;
2231 LocalToGlobal(&pt);
2232 _res = Py_BuildValue("O&",
2233 PyMac_BuildPoint, pt);
2234 return _res;
2235}
2236
2237static PyObject *Qd_GlobalToLocal(_self, _args)
2238 PyObject *_self;
2239 PyObject *_args;
2240{
2241 PyObject *_res = NULL;
2242 Point pt;
2243 if (!PyArg_ParseTuple(_args, "O&",
2244 PyMac_GetPoint, &pt))
2245 return NULL;
2246 GlobalToLocal(&pt);
2247 _res = Py_BuildValue("O&",
2248 PyMac_BuildPoint, pt);
2249 return _res;
2250}
2251
2252static PyObject *Qd_Random(_self, _args)
2253 PyObject *_self;
2254 PyObject *_args;
2255{
2256 PyObject *_res = NULL;
2257 short _rv;
2258 if (!PyArg_ParseTuple(_args, ""))
2259 return NULL;
2260 _rv = Random();
2261 _res = Py_BuildValue("h",
2262 _rv);
2263 return _res;
2264}
2265
Jack Jansen1c4e6141998-04-21 15:23:55 +00002266static PyObject *Qd_MacGetPixel(_self, _args)
Guido van Rossume56db431995-03-19 22:49:50 +00002267 PyObject *_self;
2268 PyObject *_args;
2269{
2270 PyObject *_res = NULL;
2271 Boolean _rv;
2272 short h;
2273 short v;
2274 if (!PyArg_ParseTuple(_args, "hh",
2275 &h,
2276 &v))
2277 return NULL;
Jack Jansen1c4e6141998-04-21 15:23:55 +00002278 _rv = MacGetPixel(h,
2279 v);
Guido van Rossume56db431995-03-19 22:49:50 +00002280 _res = Py_BuildValue("b",
2281 _rv);
2282 return _res;
2283}
2284
2285static PyObject *Qd_ScalePt(_self, _args)
2286 PyObject *_self;
2287 PyObject *_args;
2288{
2289 PyObject *_res = NULL;
2290 Point pt;
2291 Rect srcRect;
2292 Rect dstRect;
2293 if (!PyArg_ParseTuple(_args, "O&O&O&",
2294 PyMac_GetPoint, &pt,
2295 PyMac_GetRect, &srcRect,
2296 PyMac_GetRect, &dstRect))
2297 return NULL;
2298 ScalePt(&pt,
2299 &srcRect,
2300 &dstRect);
2301 _res = Py_BuildValue("O&",
2302 PyMac_BuildPoint, pt);
2303 return _res;
2304}
2305
2306static PyObject *Qd_MapPt(_self, _args)
2307 PyObject *_self;
2308 PyObject *_args;
2309{
2310 PyObject *_res = NULL;
2311 Point pt;
2312 Rect srcRect;
2313 Rect dstRect;
2314 if (!PyArg_ParseTuple(_args, "O&O&O&",
2315 PyMac_GetPoint, &pt,
2316 PyMac_GetRect, &srcRect,
2317 PyMac_GetRect, &dstRect))
2318 return NULL;
2319 MapPt(&pt,
2320 &srcRect,
2321 &dstRect);
2322 _res = Py_BuildValue("O&",
2323 PyMac_BuildPoint, pt);
2324 return _res;
2325}
2326
2327static PyObject *Qd_MapRect(_self, _args)
2328 PyObject *_self;
2329 PyObject *_args;
2330{
2331 PyObject *_res = NULL;
2332 Rect r;
2333 Rect srcRect;
2334 Rect dstRect;
Jack Jansen54c8f7e1995-11-14 10:46:01 +00002335 if (!PyArg_ParseTuple(_args, "O&O&O&",
2336 PyMac_GetRect, &r,
Guido van Rossume56db431995-03-19 22:49:50 +00002337 PyMac_GetRect, &srcRect,
2338 PyMac_GetRect, &dstRect))
2339 return NULL;
2340 MapRect(&r,
2341 &srcRect,
2342 &dstRect);
2343 _res = Py_BuildValue("O&",
2344 PyMac_BuildRect, &r);
2345 return _res;
2346}
2347
2348static PyObject *Qd_MapRgn(_self, _args)
2349 PyObject *_self;
2350 PyObject *_args;
2351{
2352 PyObject *_res = NULL;
2353 RgnHandle rgn;
2354 Rect srcRect;
2355 Rect dstRect;
2356 if (!PyArg_ParseTuple(_args, "O&O&O&",
2357 ResObj_Convert, &rgn,
2358 PyMac_GetRect, &srcRect,
2359 PyMac_GetRect, &dstRect))
2360 return NULL;
2361 MapRgn(rgn,
2362 &srcRect,
2363 &dstRect);
2364 Py_INCREF(Py_None);
2365 _res = Py_None;
2366 return _res;
2367}
2368
2369static PyObject *Qd_MapPoly(_self, _args)
2370 PyObject *_self;
2371 PyObject *_args;
2372{
2373 PyObject *_res = NULL;
2374 PolyHandle poly;
2375 Rect srcRect;
2376 Rect dstRect;
2377 if (!PyArg_ParseTuple(_args, "O&O&O&",
2378 ResObj_Convert, &poly,
2379 PyMac_GetRect, &srcRect,
2380 PyMac_GetRect, &dstRect))
2381 return NULL;
2382 MapPoly(poly,
2383 &srcRect,
2384 &dstRect);
2385 Py_INCREF(Py_None);
2386 _res = Py_None;
2387 return _res;
2388}
2389
Jack Jansen41058c01995-11-16 22:48:29 +00002390static PyObject *Qd_StdBits(_self, _args)
2391 PyObject *_self;
2392 PyObject *_args;
2393{
2394 PyObject *_res = NULL;
2395 BitMapPtr srcBits;
2396 Rect srcRect;
2397 Rect dstRect;
2398 short mode;
2399 RgnHandle maskRgn;
2400 if (!PyArg_ParseTuple(_args, "O&O&O&hO&",
2401 BMObj_Convert, &srcBits,
2402 PyMac_GetRect, &srcRect,
2403 PyMac_GetRect, &dstRect,
2404 &mode,
Jack Jansen425e9eb1995-12-12 15:02:03 +00002405 OptResObj_Convert, &maskRgn))
Jack Jansen41058c01995-11-16 22:48:29 +00002406 return NULL;
2407 StdBits(srcBits,
2408 &srcRect,
2409 &dstRect,
2410 mode,
2411 maskRgn);
2412 Py_INCREF(Py_None);
2413 _res = Py_None;
2414 return _res;
2415}
2416
Guido van Rossume56db431995-03-19 22:49:50 +00002417static PyObject *Qd_AddPt(_self, _args)
2418 PyObject *_self;
2419 PyObject *_args;
2420{
2421 PyObject *_res = NULL;
2422 Point src;
2423 Point dst;
2424 if (!PyArg_ParseTuple(_args, "O&O&",
2425 PyMac_GetPoint, &src,
2426 PyMac_GetPoint, &dst))
2427 return NULL;
2428 AddPt(src,
2429 &dst);
2430 _res = Py_BuildValue("O&",
2431 PyMac_BuildPoint, dst);
2432 return _res;
2433}
2434
2435static PyObject *Qd_EqualPt(_self, _args)
2436 PyObject *_self;
2437 PyObject *_args;
2438{
2439 PyObject *_res = NULL;
2440 Boolean _rv;
2441 Point pt1;
2442 Point pt2;
2443 if (!PyArg_ParseTuple(_args, "O&O&",
2444 PyMac_GetPoint, &pt1,
2445 PyMac_GetPoint, &pt2))
2446 return NULL;
2447 _rv = EqualPt(pt1,
2448 pt2);
2449 _res = Py_BuildValue("b",
2450 _rv);
2451 return _res;
2452}
2453
Jack Jansen1c4e6141998-04-21 15:23:55 +00002454static PyObject *Qd_MacPtInRect(_self, _args)
Guido van Rossume56db431995-03-19 22:49:50 +00002455 PyObject *_self;
2456 PyObject *_args;
2457{
2458 PyObject *_res = NULL;
2459 Boolean _rv;
2460 Point pt;
2461 Rect r;
2462 if (!PyArg_ParseTuple(_args, "O&O&",
2463 PyMac_GetPoint, &pt,
2464 PyMac_GetRect, &r))
2465 return NULL;
Jack Jansen1c4e6141998-04-21 15:23:55 +00002466 _rv = MacPtInRect(pt,
2467 &r);
Guido van Rossume56db431995-03-19 22:49:50 +00002468 _res = Py_BuildValue("b",
2469 _rv);
2470 return _res;
2471}
2472
2473static PyObject *Qd_Pt2Rect(_self, _args)
2474 PyObject *_self;
2475 PyObject *_args;
2476{
2477 PyObject *_res = NULL;
2478 Point pt1;
2479 Point pt2;
2480 Rect dstRect;
2481 if (!PyArg_ParseTuple(_args, "O&O&",
2482 PyMac_GetPoint, &pt1,
2483 PyMac_GetPoint, &pt2))
2484 return NULL;
2485 Pt2Rect(pt1,
2486 pt2,
2487 &dstRect);
2488 _res = Py_BuildValue("O&",
2489 PyMac_BuildRect, &dstRect);
2490 return _res;
2491}
2492
2493static PyObject *Qd_PtToAngle(_self, _args)
2494 PyObject *_self;
2495 PyObject *_args;
2496{
2497 PyObject *_res = NULL;
2498 Rect r;
2499 Point pt;
2500 short angle;
2501 if (!PyArg_ParseTuple(_args, "O&O&",
2502 PyMac_GetRect, &r,
2503 PyMac_GetPoint, &pt))
2504 return NULL;
2505 PtToAngle(&r,
2506 pt,
2507 &angle);
2508 _res = Py_BuildValue("h",
2509 angle);
2510 return _res;
2511}
2512
Jack Jansenb81cf9d1995-06-06 13:08:40 +00002513static PyObject *Qd_SubPt(_self, _args)
2514 PyObject *_self;
2515 PyObject *_args;
2516{
2517 PyObject *_res = NULL;
2518 Point src;
2519 Point dst;
2520 if (!PyArg_ParseTuple(_args, "O&O&",
2521 PyMac_GetPoint, &src,
2522 PyMac_GetPoint, &dst))
2523 return NULL;
2524 SubPt(src,
2525 &dst);
2526 _res = Py_BuildValue("O&",
2527 PyMac_BuildPoint, dst);
2528 return _res;
2529}
2530
Guido van Rossume56db431995-03-19 22:49:50 +00002531static PyObject *Qd_PtInRgn(_self, _args)
2532 PyObject *_self;
2533 PyObject *_args;
2534{
2535 PyObject *_res = NULL;
2536 Boolean _rv;
2537 Point pt;
2538 RgnHandle rgn;
2539 if (!PyArg_ParseTuple(_args, "O&O&",
2540 PyMac_GetPoint, &pt,
2541 ResObj_Convert, &rgn))
2542 return NULL;
2543 _rv = PtInRgn(pt,
2544 rgn);
2545 _res = Py_BuildValue("b",
2546 _rv);
2547 return _res;
2548}
2549
2550static PyObject *Qd_NewPixMap(_self, _args)
2551 PyObject *_self;
2552 PyObject *_args;
2553{
2554 PyObject *_res = NULL;
2555 PixMapHandle _rv;
2556 if (!PyArg_ParseTuple(_args, ""))
2557 return NULL;
2558 _rv = NewPixMap();
2559 _res = Py_BuildValue("O&",
2560 ResObj_New, _rv);
2561 return _res;
2562}
2563
Guido van Rossume56db431995-03-19 22:49:50 +00002564static PyObject *Qd_DisposePixMap(_self, _args)
2565 PyObject *_self;
2566 PyObject *_args;
2567{
2568 PyObject *_res = NULL;
2569 PixMapHandle pm;
2570 if (!PyArg_ParseTuple(_args, "O&",
2571 ResObj_Convert, &pm))
2572 return NULL;
2573 DisposePixMap(pm);
2574 Py_INCREF(Py_None);
2575 _res = Py_None;
2576 return _res;
2577}
2578
2579static PyObject *Qd_CopyPixMap(_self, _args)
2580 PyObject *_self;
2581 PyObject *_args;
2582{
2583 PyObject *_res = NULL;
2584 PixMapHandle srcPM;
2585 PixMapHandle dstPM;
2586 if (!PyArg_ParseTuple(_args, "O&O&",
2587 ResObj_Convert, &srcPM,
2588 ResObj_Convert, &dstPM))
2589 return NULL;
2590 CopyPixMap(srcPM,
2591 dstPM);
2592 Py_INCREF(Py_None);
2593 _res = Py_None;
2594 return _res;
2595}
2596
2597static PyObject *Qd_NewPixPat(_self, _args)
2598 PyObject *_self;
2599 PyObject *_args;
2600{
2601 PyObject *_res = NULL;
2602 PixPatHandle _rv;
2603 if (!PyArg_ParseTuple(_args, ""))
2604 return NULL;
2605 _rv = NewPixPat();
2606 _res = Py_BuildValue("O&",
2607 ResObj_New, _rv);
2608 return _res;
2609}
2610
Guido van Rossume56db431995-03-19 22:49:50 +00002611static PyObject *Qd_DisposePixPat(_self, _args)
2612 PyObject *_self;
2613 PyObject *_args;
2614{
2615 PyObject *_res = NULL;
2616 PixPatHandle pp;
2617 if (!PyArg_ParseTuple(_args, "O&",
2618 ResObj_Convert, &pp))
2619 return NULL;
2620 DisposePixPat(pp);
2621 Py_INCREF(Py_None);
2622 _res = Py_None;
2623 return _res;
2624}
2625
2626static PyObject *Qd_CopyPixPat(_self, _args)
2627 PyObject *_self;
2628 PyObject *_args;
2629{
2630 PyObject *_res = NULL;
2631 PixPatHandle srcPP;
2632 PixPatHandle dstPP;
2633 if (!PyArg_ParseTuple(_args, "O&O&",
2634 ResObj_Convert, &srcPP,
2635 ResObj_Convert, &dstPP))
2636 return NULL;
2637 CopyPixPat(srcPP,
2638 dstPP);
2639 Py_INCREF(Py_None);
2640 _res = Py_None;
2641 return _res;
2642}
2643
2644static PyObject *Qd_PenPixPat(_self, _args)
2645 PyObject *_self;
2646 PyObject *_args;
2647{
2648 PyObject *_res = NULL;
2649 PixPatHandle pp;
2650 if (!PyArg_ParseTuple(_args, "O&",
2651 ResObj_Convert, &pp))
2652 return NULL;
2653 PenPixPat(pp);
2654 Py_INCREF(Py_None);
2655 _res = Py_None;
2656 return _res;
2657}
2658
2659static PyObject *Qd_BackPixPat(_self, _args)
2660 PyObject *_self;
2661 PyObject *_args;
2662{
2663 PyObject *_res = NULL;
2664 PixPatHandle pp;
2665 if (!PyArg_ParseTuple(_args, "O&",
2666 ResObj_Convert, &pp))
2667 return NULL;
2668 BackPixPat(pp);
2669 Py_INCREF(Py_None);
2670 _res = Py_None;
2671 return _res;
2672}
2673
2674static PyObject *Qd_GetPixPat(_self, _args)
2675 PyObject *_self;
2676 PyObject *_args;
2677{
2678 PyObject *_res = NULL;
2679 PixPatHandle _rv;
2680 short patID;
2681 if (!PyArg_ParseTuple(_args, "h",
2682 &patID))
2683 return NULL;
2684 _rv = GetPixPat(patID);
2685 _res = Py_BuildValue("O&",
2686 ResObj_New, _rv);
2687 return _res;
2688}
2689
Jack Jansen232f3cd1995-12-09 14:04:31 +00002690static PyObject *Qd_MakeRGBPat(_self, _args)
2691 PyObject *_self;
2692 PyObject *_args;
2693{
2694 PyObject *_res = NULL;
2695 PixPatHandle pp;
2696 RGBColor myColor;
2697 if (!PyArg_ParseTuple(_args, "O&O&",
2698 ResObj_Convert, &pp,
2699 QdRGB_Convert, &myColor))
2700 return NULL;
2701 MakeRGBPat(pp,
2702 &myColor);
2703 Py_INCREF(Py_None);
2704 _res = Py_None;
2705 return _res;
2706}
2707
Guido van Rossume56db431995-03-19 22:49:50 +00002708static PyObject *Qd_FillCRect(_self, _args)
2709 PyObject *_self;
2710 PyObject *_args;
2711{
2712 PyObject *_res = NULL;
2713 Rect r;
2714 PixPatHandle pp;
2715 if (!PyArg_ParseTuple(_args, "O&O&",
2716 PyMac_GetRect, &r,
2717 ResObj_Convert, &pp))
2718 return NULL;
2719 FillCRect(&r,
2720 pp);
2721 Py_INCREF(Py_None);
2722 _res = Py_None;
2723 return _res;
2724}
2725
2726static PyObject *Qd_FillCOval(_self, _args)
2727 PyObject *_self;
2728 PyObject *_args;
2729{
2730 PyObject *_res = NULL;
2731 Rect r;
2732 PixPatHandle pp;
2733 if (!PyArg_ParseTuple(_args, "O&O&",
2734 PyMac_GetRect, &r,
2735 ResObj_Convert, &pp))
2736 return NULL;
2737 FillCOval(&r,
2738 pp);
2739 Py_INCREF(Py_None);
2740 _res = Py_None;
2741 return _res;
2742}
2743
2744static PyObject *Qd_FillCRoundRect(_self, _args)
2745 PyObject *_self;
2746 PyObject *_args;
2747{
2748 PyObject *_res = NULL;
2749 Rect r;
2750 short ovalWidth;
2751 short ovalHeight;
2752 PixPatHandle pp;
2753 if (!PyArg_ParseTuple(_args, "O&hhO&",
2754 PyMac_GetRect, &r,
2755 &ovalWidth,
2756 &ovalHeight,
2757 ResObj_Convert, &pp))
2758 return NULL;
2759 FillCRoundRect(&r,
2760 ovalWidth,
2761 ovalHeight,
2762 pp);
2763 Py_INCREF(Py_None);
2764 _res = Py_None;
2765 return _res;
2766}
2767
2768static PyObject *Qd_FillCArc(_self, _args)
2769 PyObject *_self;
2770 PyObject *_args;
2771{
2772 PyObject *_res = NULL;
2773 Rect r;
2774 short startAngle;
2775 short arcAngle;
2776 PixPatHandle pp;
2777 if (!PyArg_ParseTuple(_args, "O&hhO&",
2778 PyMac_GetRect, &r,
2779 &startAngle,
2780 &arcAngle,
2781 ResObj_Convert, &pp))
2782 return NULL;
2783 FillCArc(&r,
2784 startAngle,
2785 arcAngle,
2786 pp);
2787 Py_INCREF(Py_None);
2788 _res = Py_None;
2789 return _res;
2790}
2791
2792static PyObject *Qd_FillCRgn(_self, _args)
2793 PyObject *_self;
2794 PyObject *_args;
2795{
2796 PyObject *_res = NULL;
2797 RgnHandle rgn;
2798 PixPatHandle pp;
2799 if (!PyArg_ParseTuple(_args, "O&O&",
2800 ResObj_Convert, &rgn,
2801 ResObj_Convert, &pp))
2802 return NULL;
2803 FillCRgn(rgn,
2804 pp);
2805 Py_INCREF(Py_None);
2806 _res = Py_None;
2807 return _res;
2808}
2809
2810static PyObject *Qd_FillCPoly(_self, _args)
2811 PyObject *_self;
2812 PyObject *_args;
2813{
2814 PyObject *_res = NULL;
2815 PolyHandle poly;
2816 PixPatHandle pp;
2817 if (!PyArg_ParseTuple(_args, "O&O&",
2818 ResObj_Convert, &poly,
2819 ResObj_Convert, &pp))
2820 return NULL;
2821 FillCPoly(poly,
2822 pp);
2823 Py_INCREF(Py_None);
2824 _res = Py_None;
2825 return _res;
2826}
2827
Jack Jansen232f3cd1995-12-09 14:04:31 +00002828static PyObject *Qd_RGBForeColor(_self, _args)
2829 PyObject *_self;
2830 PyObject *_args;
2831{
2832 PyObject *_res = NULL;
2833 RGBColor color;
2834 if (!PyArg_ParseTuple(_args, "O&",
2835 QdRGB_Convert, &color))
2836 return NULL;
2837 RGBForeColor(&color);
2838 Py_INCREF(Py_None);
2839 _res = Py_None;
2840 return _res;
2841}
2842
2843static PyObject *Qd_RGBBackColor(_self, _args)
2844 PyObject *_self;
2845 PyObject *_args;
2846{
2847 PyObject *_res = NULL;
2848 RGBColor color;
2849 if (!PyArg_ParseTuple(_args, "O&",
2850 QdRGB_Convert, &color))
2851 return NULL;
2852 RGBBackColor(&color);
2853 Py_INCREF(Py_None);
2854 _res = Py_None;
2855 return _res;
2856}
2857
2858static PyObject *Qd_SetCPixel(_self, _args)
2859 PyObject *_self;
2860 PyObject *_args;
2861{
2862 PyObject *_res = NULL;
2863 short h;
2864 short v;
2865 RGBColor cPix;
2866 if (!PyArg_ParseTuple(_args, "hhO&",
2867 &h,
2868 &v,
2869 QdRGB_Convert, &cPix))
2870 return NULL;
2871 SetCPixel(h,
2872 v,
2873 &cPix);
2874 Py_INCREF(Py_None);
2875 _res = Py_None;
2876 return _res;
2877}
2878
Guido van Rossume56db431995-03-19 22:49:50 +00002879static PyObject *Qd_SetPortPix(_self, _args)
2880 PyObject *_self;
2881 PyObject *_args;
2882{
2883 PyObject *_res = NULL;
2884 PixMapHandle pm;
2885 if (!PyArg_ParseTuple(_args, "O&",
2886 ResObj_Convert, &pm))
2887 return NULL;
2888 SetPortPix(pm);
2889 Py_INCREF(Py_None);
2890 _res = Py_None;
2891 return _res;
2892}
2893
Jack Jansen232f3cd1995-12-09 14:04:31 +00002894static PyObject *Qd_GetCPixel(_self, _args)
2895 PyObject *_self;
2896 PyObject *_args;
2897{
2898 PyObject *_res = NULL;
2899 short h;
2900 short v;
2901 RGBColor cPix;
2902 if (!PyArg_ParseTuple(_args, "hh",
2903 &h,
2904 &v))
2905 return NULL;
2906 GetCPixel(h,
2907 v,
2908 &cPix);
2909 _res = Py_BuildValue("O&",
2910 QdRGB_New, &cPix);
2911 return _res;
2912}
2913
2914static PyObject *Qd_GetForeColor(_self, _args)
2915 PyObject *_self;
2916 PyObject *_args;
2917{
2918 PyObject *_res = NULL;
2919 RGBColor color;
2920 if (!PyArg_ParseTuple(_args, ""))
2921 return NULL;
2922 GetForeColor(&color);
2923 _res = Py_BuildValue("O&",
2924 QdRGB_New, &color);
2925 return _res;
2926}
2927
2928static PyObject *Qd_GetBackColor(_self, _args)
2929 PyObject *_self;
2930 PyObject *_args;
2931{
2932 PyObject *_res = NULL;
2933 RGBColor color;
2934 if (!PyArg_ParseTuple(_args, ""))
2935 return NULL;
2936 GetBackColor(&color);
2937 _res = Py_BuildValue("O&",
2938 QdRGB_New, &color);
2939 return _res;
2940}
2941
2942static PyObject *Qd_OpColor(_self, _args)
2943 PyObject *_self;
2944 PyObject *_args;
2945{
2946 PyObject *_res = NULL;
2947 RGBColor color;
2948 if (!PyArg_ParseTuple(_args, "O&",
2949 QdRGB_Convert, &color))
2950 return NULL;
2951 OpColor(&color);
2952 Py_INCREF(Py_None);
2953 _res = Py_None;
2954 return _res;
2955}
2956
2957static PyObject *Qd_HiliteColor(_self, _args)
2958 PyObject *_self;
2959 PyObject *_args;
2960{
2961 PyObject *_res = NULL;
2962 RGBColor color;
2963 if (!PyArg_ParseTuple(_args, "O&",
2964 QdRGB_Convert, &color))
2965 return NULL;
2966 HiliteColor(&color);
2967 Py_INCREF(Py_None);
2968 _res = Py_None;
2969 return _res;
2970}
2971
Jack Jansen69b43ed1997-08-15 14:35:54 +00002972static PyObject *Qd_DisposeCTable(_self, _args)
2973 PyObject *_self;
2974 PyObject *_args;
2975{
2976 PyObject *_res = NULL;
2977 CTabHandle cTable;
2978 if (!PyArg_ParseTuple(_args, "O&",
2979 ResObj_Convert, &cTable))
2980 return NULL;
2981 DisposeCTable(cTable);
2982 Py_INCREF(Py_None);
2983 _res = Py_None;
2984 return _res;
2985}
2986
2987static PyObject *Qd_GetCTable(_self, _args)
2988 PyObject *_self;
2989 PyObject *_args;
2990{
2991 PyObject *_res = NULL;
2992 CTabHandle _rv;
2993 short ctID;
2994 if (!PyArg_ParseTuple(_args, "h",
2995 &ctID))
2996 return NULL;
2997 _rv = GetCTable(ctID);
2998 _res = Py_BuildValue("O&",
2999 ResObj_New, _rv);
3000 return _res;
3001}
3002
3003static PyObject *Qd_GetCCursor(_self, _args)
3004 PyObject *_self;
3005 PyObject *_args;
3006{
3007 PyObject *_res = NULL;
3008 CCrsrHandle _rv;
3009 short crsrID;
3010 if (!PyArg_ParseTuple(_args, "h",
3011 &crsrID))
3012 return NULL;
3013 _rv = GetCCursor(crsrID);
3014 _res = Py_BuildValue("O&",
3015 ResObj_New, _rv);
3016 return _res;
3017}
3018
3019static PyObject *Qd_SetCCursor(_self, _args)
3020 PyObject *_self;
3021 PyObject *_args;
3022{
3023 PyObject *_res = NULL;
3024 CCrsrHandle cCrsr;
3025 if (!PyArg_ParseTuple(_args, "O&",
3026 ResObj_Convert, &cCrsr))
3027 return NULL;
3028 SetCCursor(cCrsr);
3029 Py_INCREF(Py_None);
3030 _res = Py_None;
3031 return _res;
3032}
3033
Guido van Rossume56db431995-03-19 22:49:50 +00003034static PyObject *Qd_AllocCursor(_self, _args)
3035 PyObject *_self;
3036 PyObject *_args;
3037{
3038 PyObject *_res = NULL;
3039 if (!PyArg_ParseTuple(_args, ""))
3040 return NULL;
3041 AllocCursor();
3042 Py_INCREF(Py_None);
3043 _res = Py_None;
3044 return _res;
3045}
3046
Jack Jansen69b43ed1997-08-15 14:35:54 +00003047static PyObject *Qd_DisposeCCursor(_self, _args)
3048 PyObject *_self;
3049 PyObject *_args;
3050{
3051 PyObject *_res = NULL;
3052 CCrsrHandle cCrsr;
3053 if (!PyArg_ParseTuple(_args, "O&",
3054 ResObj_Convert, &cCrsr))
3055 return NULL;
3056 DisposeCCursor(cCrsr);
3057 Py_INCREF(Py_None);
3058 _res = Py_None;
3059 return _res;
3060}
3061
3062static PyObject *Qd_GetMaxDevice(_self, _args)
3063 PyObject *_self;
3064 PyObject *_args;
3065{
3066 PyObject *_res = NULL;
3067 GDHandle _rv;
3068 Rect globalRect;
3069 if (!PyArg_ParseTuple(_args, "O&",
3070 PyMac_GetRect, &globalRect))
3071 return NULL;
3072 _rv = GetMaxDevice(&globalRect);
3073 _res = Py_BuildValue("O&",
3074 ResObj_New, _rv);
3075 return _res;
3076}
3077
Guido van Rossume56db431995-03-19 22:49:50 +00003078static PyObject *Qd_GetCTSeed(_self, _args)
3079 PyObject *_self;
3080 PyObject *_args;
3081{
3082 PyObject *_res = NULL;
3083 long _rv;
3084 if (!PyArg_ParseTuple(_args, ""))
3085 return NULL;
3086 _rv = GetCTSeed();
3087 _res = Py_BuildValue("l",
3088 _rv);
3089 return _res;
3090}
3091
Jack Jansen69b43ed1997-08-15 14:35:54 +00003092static PyObject *Qd_GetDeviceList(_self, _args)
3093 PyObject *_self;
3094 PyObject *_args;
3095{
3096 PyObject *_res = NULL;
3097 GDHandle _rv;
3098 if (!PyArg_ParseTuple(_args, ""))
3099 return NULL;
3100 _rv = GetDeviceList();
3101 _res = Py_BuildValue("O&",
3102 ResObj_New, _rv);
3103 return _res;
3104}
3105
3106static PyObject *Qd_GetMainDevice(_self, _args)
3107 PyObject *_self;
3108 PyObject *_args;
3109{
3110 PyObject *_res = NULL;
3111 GDHandle _rv;
3112 if (!PyArg_ParseTuple(_args, ""))
3113 return NULL;
3114 _rv = GetMainDevice();
3115 _res = Py_BuildValue("O&",
3116 ResObj_New, _rv);
3117 return _res;
3118}
3119
3120static PyObject *Qd_GetNextDevice(_self, _args)
3121 PyObject *_self;
3122 PyObject *_args;
3123{
3124 PyObject *_res = NULL;
3125 GDHandle _rv;
3126 GDHandle curDevice;
3127 if (!PyArg_ParseTuple(_args, "O&",
3128 ResObj_Convert, &curDevice))
3129 return NULL;
3130 _rv = GetNextDevice(curDevice);
3131 _res = Py_BuildValue("O&",
3132 ResObj_New, _rv);
3133 return _res;
3134}
3135
3136static PyObject *Qd_TestDeviceAttribute(_self, _args)
3137 PyObject *_self;
3138 PyObject *_args;
3139{
3140 PyObject *_res = NULL;
3141 Boolean _rv;
3142 GDHandle gdh;
3143 short attribute;
3144 if (!PyArg_ParseTuple(_args, "O&h",
3145 ResObj_Convert, &gdh,
3146 &attribute))
3147 return NULL;
3148 _rv = TestDeviceAttribute(gdh,
3149 attribute);
3150 _res = Py_BuildValue("b",
3151 _rv);
3152 return _res;
3153}
3154
3155static PyObject *Qd_SetDeviceAttribute(_self, _args)
3156 PyObject *_self;
3157 PyObject *_args;
3158{
3159 PyObject *_res = NULL;
3160 GDHandle gdh;
3161 short attribute;
3162 Boolean value;
3163 if (!PyArg_ParseTuple(_args, "O&hb",
3164 ResObj_Convert, &gdh,
3165 &attribute,
3166 &value))
3167 return NULL;
3168 SetDeviceAttribute(gdh,
3169 attribute,
3170 value);
3171 Py_INCREF(Py_None);
3172 _res = Py_None;
3173 return _res;
3174}
3175
3176static PyObject *Qd_InitGDevice(_self, _args)
3177 PyObject *_self;
3178 PyObject *_args;
3179{
3180 PyObject *_res = NULL;
3181 short qdRefNum;
3182 long mode;
3183 GDHandle gdh;
3184 if (!PyArg_ParseTuple(_args, "hlO&",
3185 &qdRefNum,
3186 &mode,
3187 ResObj_Convert, &gdh))
3188 return NULL;
3189 InitGDevice(qdRefNum,
3190 mode,
3191 gdh);
3192 Py_INCREF(Py_None);
3193 _res = Py_None;
3194 return _res;
3195}
3196
3197static PyObject *Qd_NewGDevice(_self, _args)
3198 PyObject *_self;
3199 PyObject *_args;
3200{
3201 PyObject *_res = NULL;
3202 GDHandle _rv;
3203 short refNum;
3204 long mode;
3205 if (!PyArg_ParseTuple(_args, "hl",
3206 &refNum,
3207 &mode))
3208 return NULL;
3209 _rv = NewGDevice(refNum,
3210 mode);
3211 _res = Py_BuildValue("O&",
3212 ResObj_New, _rv);
3213 return _res;
3214}
3215
3216static PyObject *Qd_DisposeGDevice(_self, _args)
3217 PyObject *_self;
3218 PyObject *_args;
3219{
3220 PyObject *_res = NULL;
3221 GDHandle gdh;
3222 if (!PyArg_ParseTuple(_args, "O&",
3223 ResObj_Convert, &gdh))
3224 return NULL;
3225 DisposeGDevice(gdh);
3226 Py_INCREF(Py_None);
3227 _res = Py_None;
3228 return _res;
3229}
3230
3231static PyObject *Qd_SetGDevice(_self, _args)
3232 PyObject *_self;
3233 PyObject *_args;
3234{
3235 PyObject *_res = NULL;
3236 GDHandle gd;
3237 if (!PyArg_ParseTuple(_args, "O&",
3238 ResObj_Convert, &gd))
3239 return NULL;
3240 SetGDevice(gd);
3241 Py_INCREF(Py_None);
3242 _res = Py_None;
3243 return _res;
3244}
3245
3246static PyObject *Qd_GetGDevice(_self, _args)
3247 PyObject *_self;
3248 PyObject *_args;
3249{
3250 PyObject *_res = NULL;
3251 GDHandle _rv;
3252 if (!PyArg_ParseTuple(_args, ""))
3253 return NULL;
3254 _rv = GetGDevice();
3255 _res = Py_BuildValue("O&",
3256 ResObj_New, _rv);
3257 return _res;
3258}
3259
Jack Jansen232f3cd1995-12-09 14:04:31 +00003260static PyObject *Qd_Color2Index(_self, _args)
3261 PyObject *_self;
3262 PyObject *_args;
3263{
3264 PyObject *_res = NULL;
3265 long _rv;
3266 RGBColor myColor;
3267 if (!PyArg_ParseTuple(_args, "O&",
3268 QdRGB_Convert, &myColor))
3269 return NULL;
3270 _rv = Color2Index(&myColor);
3271 _res = Py_BuildValue("l",
3272 _rv);
3273 return _res;
3274}
3275
3276static PyObject *Qd_Index2Color(_self, _args)
3277 PyObject *_self;
3278 PyObject *_args;
3279{
3280 PyObject *_res = NULL;
3281 long index;
3282 RGBColor aColor;
3283 if (!PyArg_ParseTuple(_args, "l",
3284 &index))
3285 return NULL;
3286 Index2Color(index,
3287 &aColor);
3288 _res = Py_BuildValue("O&",
3289 QdRGB_New, &aColor);
3290 return _res;
3291}
3292
3293static PyObject *Qd_InvertColor(_self, _args)
3294 PyObject *_self;
3295 PyObject *_args;
3296{
3297 PyObject *_res = NULL;
3298 RGBColor myColor;
3299 if (!PyArg_ParseTuple(_args, ""))
3300 return NULL;
3301 InvertColor(&myColor);
3302 _res = Py_BuildValue("O&",
3303 QdRGB_New, &myColor);
3304 return _res;
3305}
3306
3307static PyObject *Qd_RealColor(_self, _args)
3308 PyObject *_self;
3309 PyObject *_args;
3310{
3311 PyObject *_res = NULL;
3312 Boolean _rv;
3313 RGBColor color;
3314 if (!PyArg_ParseTuple(_args, "O&",
3315 QdRGB_Convert, &color))
3316 return NULL;
3317 _rv = RealColor(&color);
3318 _res = Py_BuildValue("b",
3319 _rv);
3320 return _res;
3321}
3322
Jack Jansen69b43ed1997-08-15 14:35:54 +00003323static PyObject *Qd_GetSubTable(_self, _args)
3324 PyObject *_self;
3325 PyObject *_args;
3326{
3327 PyObject *_res = NULL;
3328 CTabHandle myColors;
3329 short iTabRes;
3330 CTabHandle targetTbl;
3331 if (!PyArg_ParseTuple(_args, "O&hO&",
3332 ResObj_Convert, &myColors,
3333 &iTabRes,
3334 ResObj_Convert, &targetTbl))
3335 return NULL;
3336 GetSubTable(myColors,
3337 iTabRes,
3338 targetTbl);
3339 Py_INCREF(Py_None);
3340 _res = Py_None;
3341 return _res;
3342}
3343
3344static PyObject *Qd_MakeITable(_self, _args)
3345 PyObject *_self;
3346 PyObject *_args;
3347{
3348 PyObject *_res = NULL;
3349 CTabHandle cTabH;
3350 ITabHandle iTabH;
3351 short res;
3352 if (!PyArg_ParseTuple(_args, "O&O&h",
3353 ResObj_Convert, &cTabH,
3354 ResObj_Convert, &iTabH,
3355 &res))
3356 return NULL;
3357 MakeITable(cTabH,
3358 iTabH,
3359 res);
3360 Py_INCREF(Py_None);
3361 _res = Py_None;
3362 return _res;
3363}
3364
Guido van Rossume56db431995-03-19 22:49:50 +00003365static PyObject *Qd_SetClientID(_self, _args)
3366 PyObject *_self;
3367 PyObject *_args;
3368{
3369 PyObject *_res = NULL;
3370 short id;
3371 if (!PyArg_ParseTuple(_args, "h",
3372 &id))
3373 return NULL;
3374 SetClientID(id);
3375 Py_INCREF(Py_None);
3376 _res = Py_None;
3377 return _res;
3378}
3379
3380static PyObject *Qd_ProtectEntry(_self, _args)
3381 PyObject *_self;
3382 PyObject *_args;
3383{
3384 PyObject *_res = NULL;
3385 short index;
3386 Boolean protect;
3387 if (!PyArg_ParseTuple(_args, "hb",
3388 &index,
3389 &protect))
3390 return NULL;
3391 ProtectEntry(index,
3392 protect);
3393 Py_INCREF(Py_None);
3394 _res = Py_None;
3395 return _res;
3396}
3397
3398static PyObject *Qd_ReserveEntry(_self, _args)
3399 PyObject *_self;
3400 PyObject *_args;
3401{
3402 PyObject *_res = NULL;
3403 short index;
3404 Boolean reserve;
3405 if (!PyArg_ParseTuple(_args, "hb",
3406 &index,
3407 &reserve))
3408 return NULL;
3409 ReserveEntry(index,
3410 reserve);
3411 Py_INCREF(Py_None);
3412 _res = Py_None;
3413 return _res;
3414}
3415
3416static PyObject *Qd_QDError(_self, _args)
3417 PyObject *_self;
3418 PyObject *_args;
3419{
3420 PyObject *_res = NULL;
3421 short _rv;
3422 if (!PyArg_ParseTuple(_args, ""))
3423 return NULL;
3424 _rv = QDError();
3425 _res = Py_BuildValue("h",
3426 _rv);
3427 return _res;
3428}
3429
Jack Jansen41058c01995-11-16 22:48:29 +00003430static PyObject *Qd_CopyDeepMask(_self, _args)
3431 PyObject *_self;
3432 PyObject *_args;
3433{
3434 PyObject *_res = NULL;
3435 BitMapPtr srcBits;
3436 BitMapPtr maskBits;
3437 BitMapPtr dstBits;
3438 Rect srcRect;
3439 Rect maskRect;
3440 Rect dstRect;
3441 short mode;
3442 RgnHandle maskRgn;
3443 if (!PyArg_ParseTuple(_args, "O&O&O&O&O&O&hO&",
3444 BMObj_Convert, &srcBits,
3445 BMObj_Convert, &maskBits,
3446 BMObj_Convert, &dstBits,
3447 PyMac_GetRect, &srcRect,
3448 PyMac_GetRect, &maskRect,
3449 PyMac_GetRect, &dstRect,
3450 &mode,
Jack Jansen425e9eb1995-12-12 15:02:03 +00003451 OptResObj_Convert, &maskRgn))
Jack Jansen41058c01995-11-16 22:48:29 +00003452 return NULL;
3453 CopyDeepMask(srcBits,
3454 maskBits,
3455 dstBits,
3456 &srcRect,
3457 &maskRect,
3458 &dstRect,
3459 mode,
3460 maskRgn);
3461 Py_INCREF(Py_None);
3462 _res = Py_None;
3463 return _res;
3464}
3465
Jack Jansen54c8f7e1995-11-14 10:46:01 +00003466static PyObject *Qd_GetPattern(_self, _args)
3467 PyObject *_self;
3468 PyObject *_args;
3469{
3470 PyObject *_res = NULL;
3471 PatHandle _rv;
3472 short patternID;
3473 if (!PyArg_ParseTuple(_args, "h",
3474 &patternID))
3475 return NULL;
3476 _rv = GetPattern(patternID);
3477 _res = Py_BuildValue("O&",
3478 ResObj_New, _rv);
3479 return _res;
3480}
3481
Jack Jansen1c4e6141998-04-21 15:23:55 +00003482static PyObject *Qd_MacGetCursor(_self, _args)
Jack Jansen54c8f7e1995-11-14 10:46:01 +00003483 PyObject *_self;
3484 PyObject *_args;
3485{
3486 PyObject *_res = NULL;
3487 CursHandle _rv;
3488 short cursorID;
3489 if (!PyArg_ParseTuple(_args, "h",
3490 &cursorID))
3491 return NULL;
Jack Jansen1c4e6141998-04-21 15:23:55 +00003492 _rv = MacGetCursor(cursorID);
Jack Jansen54c8f7e1995-11-14 10:46:01 +00003493 _res = Py_BuildValue("O&",
3494 ResObj_New, _rv);
3495 return _res;
3496}
3497
3498static PyObject *Qd_GetPicture(_self, _args)
3499 PyObject *_self;
3500 PyObject *_args;
3501{
3502 PyObject *_res = NULL;
3503 PicHandle _rv;
3504 short pictureID;
3505 if (!PyArg_ParseTuple(_args, "h",
3506 &pictureID))
3507 return NULL;
3508 _rv = GetPicture(pictureID);
3509 _res = Py_BuildValue("O&",
3510 ResObj_New, _rv);
3511 return _res;
3512}
3513
3514static PyObject *Qd_DeltaPoint(_self, _args)
3515 PyObject *_self;
3516 PyObject *_args;
3517{
3518 PyObject *_res = NULL;
3519 long _rv;
3520 Point ptA;
3521 Point ptB;
3522 if (!PyArg_ParseTuple(_args, "O&O&",
3523 PyMac_GetPoint, &ptA,
3524 PyMac_GetPoint, &ptB))
3525 return NULL;
3526 _rv = DeltaPoint(ptA,
3527 ptB);
3528 _res = Py_BuildValue("l",
3529 _rv);
3530 return _res;
3531}
3532
3533static PyObject *Qd_ShieldCursor(_self, _args)
3534 PyObject *_self;
3535 PyObject *_args;
3536{
3537 PyObject *_res = NULL;
3538 Rect shieldRect;
3539 Point offsetPt;
3540 if (!PyArg_ParseTuple(_args, "O&O&",
3541 PyMac_GetRect, &shieldRect,
3542 PyMac_GetPoint, &offsetPt))
3543 return NULL;
3544 ShieldCursor(&shieldRect,
3545 offsetPt);
3546 Py_INCREF(Py_None);
3547 _res = Py_None;
3548 return _res;
3549}
3550
3551static PyObject *Qd_ScreenRes(_self, _args)
3552 PyObject *_self;
3553 PyObject *_args;
3554{
3555 PyObject *_res = NULL;
3556 short scrnHRes;
3557 short scrnVRes;
3558 if (!PyArg_ParseTuple(_args, ""))
3559 return NULL;
3560 ScreenRes(&scrnHRes,
3561 &scrnVRes);
3562 _res = Py_BuildValue("hh",
3563 scrnHRes,
3564 scrnVRes);
3565 return _res;
3566}
3567
Jack Jansen04a02e71996-01-06 17:12:58 +00003568static PyObject *Qd_GetIndPattern(_self, _args)
3569 PyObject *_self;
3570 PyObject *_args;
3571{
3572 PyObject *_res = NULL;
3573 Pattern thePat__out__;
3574 short patternListID;
3575 short index;
3576 if (!PyArg_ParseTuple(_args, "hh",
3577 &patternListID,
3578 &index))
3579 return NULL;
3580 GetIndPattern(&thePat__out__,
3581 patternListID,
3582 index);
3583 _res = Py_BuildValue("s#",
3584 (char *)&thePat__out__, (int)sizeof(Pattern));
3585 thePat__error__: ;
3586 return _res;
3587}
3588
Jack Jansen21f96871998-02-20 16:02:09 +00003589static PyObject *Qd_SlopeFromAngle(_self, _args)
3590 PyObject *_self;
3591 PyObject *_args;
3592{
3593 PyObject *_res = NULL;
3594 Fixed _rv;
3595 short angle;
3596 if (!PyArg_ParseTuple(_args, "h",
3597 &angle))
3598 return NULL;
3599 _rv = SlopeFromAngle(angle);
3600 _res = Py_BuildValue("O&",
3601 PyMac_BuildFixed, _rv);
3602 return _res;
3603}
3604
3605static PyObject *Qd_AngleFromSlope(_self, _args)
3606 PyObject *_self;
3607 PyObject *_args;
3608{
3609 PyObject *_res = NULL;
3610 short _rv;
3611 Fixed slope;
3612 if (!PyArg_ParseTuple(_args, "O&",
3613 PyMac_GetFixed, &slope))
3614 return NULL;
3615 _rv = AngleFromSlope(slope);
3616 _res = Py_BuildValue("h",
3617 _rv);
3618 return _res;
3619}
3620
Jack Jansenb81cf9d1995-06-06 13:08:40 +00003621static PyObject *Qd_TextFont(_self, _args)
3622 PyObject *_self;
3623 PyObject *_args;
3624{
3625 PyObject *_res = NULL;
3626 short font;
3627 if (!PyArg_ParseTuple(_args, "h",
3628 &font))
3629 return NULL;
3630 TextFont(font);
3631 Py_INCREF(Py_None);
3632 _res = Py_None;
3633 return _res;
3634}
3635
3636static PyObject *Qd_TextFace(_self, _args)
3637 PyObject *_self;
3638 PyObject *_args;
3639{
3640 PyObject *_res = NULL;
Jack Jansene742a821998-02-25 15:46:50 +00003641 StyleParameter face;
Jack Jansenb81cf9d1995-06-06 13:08:40 +00003642 if (!PyArg_ParseTuple(_args, "h",
3643 &face))
3644 return NULL;
3645 TextFace(face);
3646 Py_INCREF(Py_None);
3647 _res = Py_None;
3648 return _res;
3649}
3650
3651static PyObject *Qd_TextMode(_self, _args)
3652 PyObject *_self;
3653 PyObject *_args;
3654{
3655 PyObject *_res = NULL;
3656 short mode;
3657 if (!PyArg_ParseTuple(_args, "h",
3658 &mode))
3659 return NULL;
3660 TextMode(mode);
3661 Py_INCREF(Py_None);
3662 _res = Py_None;
3663 return _res;
3664}
3665
3666static PyObject *Qd_TextSize(_self, _args)
3667 PyObject *_self;
3668 PyObject *_args;
3669{
3670 PyObject *_res = NULL;
3671 short size;
3672 if (!PyArg_ParseTuple(_args, "h",
3673 &size))
3674 return NULL;
3675 TextSize(size);
3676 Py_INCREF(Py_None);
3677 _res = Py_None;
3678 return _res;
3679}
3680
3681static PyObject *Qd_SpaceExtra(_self, _args)
3682 PyObject *_self;
3683 PyObject *_args;
3684{
3685 PyObject *_res = NULL;
Jack Jansen330381c1995-11-15 15:18:01 +00003686 Fixed extra;
3687 if (!PyArg_ParseTuple(_args, "O&",
3688 PyMac_GetFixed, &extra))
Jack Jansenb81cf9d1995-06-06 13:08:40 +00003689 return NULL;
3690 SpaceExtra(extra);
3691 Py_INCREF(Py_None);
3692 _res = Py_None;
3693 return _res;
3694}
3695
3696static PyObject *Qd_DrawChar(_self, _args)
3697 PyObject *_self;
3698 PyObject *_args;
3699{
3700 PyObject *_res = NULL;
Jack Jansen21f96871998-02-20 16:02:09 +00003701 CharParameter ch;
Jack Jansene742a821998-02-25 15:46:50 +00003702 if (!PyArg_ParseTuple(_args, "h",
Jack Jansenb81cf9d1995-06-06 13:08:40 +00003703 &ch))
3704 return NULL;
3705 DrawChar(ch);
3706 Py_INCREF(Py_None);
3707 _res = Py_None;
3708 return _res;
3709}
3710
3711static PyObject *Qd_DrawString(_self, _args)
3712 PyObject *_self;
3713 PyObject *_args;
3714{
3715 PyObject *_res = NULL;
3716 Str255 s;
3717 if (!PyArg_ParseTuple(_args, "O&",
3718 PyMac_GetStr255, s))
3719 return NULL;
3720 DrawString(s);
3721 Py_INCREF(Py_None);
3722 _res = Py_None;
3723 return _res;
3724}
3725
Jack Jansen1c4e6141998-04-21 15:23:55 +00003726static PyObject *Qd_MacDrawText(_self, _args)
Jack Jansenb81cf9d1995-06-06 13:08:40 +00003727 PyObject *_self;
3728 PyObject *_args;
3729{
3730 PyObject *_res = NULL;
3731 char *textBuf__in__;
3732 int textBuf__len__;
3733 int textBuf__in_len__;
3734 short firstByte;
3735 short byteCount;
3736 if (!PyArg_ParseTuple(_args, "s#hh",
3737 &textBuf__in__, &textBuf__in_len__,
3738 &firstByte,
3739 &byteCount))
3740 return NULL;
Jack Jansen1c4e6141998-04-21 15:23:55 +00003741 MacDrawText(textBuf__in__,
3742 firstByte,
3743 byteCount);
Jack Jansenb81cf9d1995-06-06 13:08:40 +00003744 Py_INCREF(Py_None);
3745 _res = Py_None;
3746 textBuf__error__: ;
3747 return _res;
3748}
3749
3750static PyObject *Qd_CharWidth(_self, _args)
3751 PyObject *_self;
3752 PyObject *_args;
3753{
3754 PyObject *_res = NULL;
3755 short _rv;
Jack Jansen21f96871998-02-20 16:02:09 +00003756 CharParameter ch;
Jack Jansene742a821998-02-25 15:46:50 +00003757 if (!PyArg_ParseTuple(_args, "h",
Jack Jansenb81cf9d1995-06-06 13:08:40 +00003758 &ch))
3759 return NULL;
3760 _rv = CharWidth(ch);
3761 _res = Py_BuildValue("h",
3762 _rv);
3763 return _res;
3764}
3765
3766static PyObject *Qd_StringWidth(_self, _args)
3767 PyObject *_self;
3768 PyObject *_args;
3769{
3770 PyObject *_res = NULL;
3771 short _rv;
3772 Str255 s;
3773 if (!PyArg_ParseTuple(_args, "O&",
3774 PyMac_GetStr255, s))
3775 return NULL;
3776 _rv = StringWidth(s);
3777 _res = Py_BuildValue("h",
3778 _rv);
3779 return _res;
3780}
3781
3782static PyObject *Qd_TextWidth(_self, _args)
3783 PyObject *_self;
3784 PyObject *_args;
3785{
3786 PyObject *_res = NULL;
3787 short _rv;
3788 char *textBuf__in__;
3789 int textBuf__len__;
3790 int textBuf__in_len__;
3791 short firstByte;
3792 short byteCount;
3793 if (!PyArg_ParseTuple(_args, "s#hh",
3794 &textBuf__in__, &textBuf__in_len__,
3795 &firstByte,
3796 &byteCount))
3797 return NULL;
3798 _rv = TextWidth(textBuf__in__,
3799 firstByte,
3800 byteCount);
3801 _res = Py_BuildValue("h",
3802 _rv);
3803 textBuf__error__: ;
3804 return _res;
3805}
3806
Jack Jansen3a50f8a1996-01-11 16:17:14 +00003807static PyObject *Qd_GetFontInfo(_self, _args)
3808 PyObject *_self;
3809 PyObject *_args;
3810{
3811 PyObject *_res = NULL;
3812 FontInfo info;
3813 if (!PyArg_ParseTuple(_args, ""))
3814 return NULL;
3815 GetFontInfo(&info);
3816 _res = Py_BuildValue("O&",
3817 QdFI_New, &info);
3818 return _res;
3819}
3820
Jack Jansenb81cf9d1995-06-06 13:08:40 +00003821static PyObject *Qd_CharExtra(_self, _args)
3822 PyObject *_self;
3823 PyObject *_args;
3824{
3825 PyObject *_res = NULL;
Jack Jansen330381c1995-11-15 15:18:01 +00003826 Fixed extra;
3827 if (!PyArg_ParseTuple(_args, "O&",
3828 PyMac_GetFixed, &extra))
Jack Jansenb81cf9d1995-06-06 13:08:40 +00003829 return NULL;
3830 CharExtra(extra);
3831 Py_INCREF(Py_None);
3832 _res = Py_None;
3833 return _res;
3834}
3835
Jack Jansen7f725e41998-04-23 13:21:09 +00003836static PyObject *Qd_SetPort(_self, _args)
3837 PyObject *_self;
3838 PyObject *_args;
3839{
3840 PyObject *_res = NULL;
Jack Jansen29bfea91998-04-27 15:09:36 +00003841 GrafPtr thePort;
Jack Jansen7f725e41998-04-23 13:21:09 +00003842 if (!PyArg_ParseTuple(_args, "O&",
Jack Jansen29bfea91998-04-27 15:09:36 +00003843 GrafObj_Convert, &thePort))
Jack Jansen7f725e41998-04-23 13:21:09 +00003844 return NULL;
3845 SetPort(thePort);
3846 Py_INCREF(Py_None);
3847 _res = Py_None;
3848 return _res;
3849}
3850
Jack Jansene180d991998-04-24 10:28:20 +00003851static PyObject *Qd_GetCursor(_self, _args)
Jack Jansen7f725e41998-04-23 13:21:09 +00003852 PyObject *_self;
3853 PyObject *_args;
3854{
3855 PyObject *_res = NULL;
Jack Jansene180d991998-04-24 10:28:20 +00003856 CursHandle _rv;
3857 short cursorID;
3858 if (!PyArg_ParseTuple(_args, "h",
3859 &cursorID))
Jack Jansen7f725e41998-04-23 13:21:09 +00003860 return NULL;
Jack Jansene180d991998-04-24 10:28:20 +00003861 _rv = GetCursor(cursorID);
3862 _res = Py_BuildValue("O&",
3863 ResObj_New, _rv);
3864 return _res;
3865}
3866
3867static PyObject *Qd_SetCursor(_self, _args)
3868 PyObject *_self;
3869 PyObject *_args;
3870{
3871 PyObject *_res = NULL;
3872 Cursor *crsr__in__;
3873 int crsr__in_len__;
3874 if (!PyArg_ParseTuple(_args, "s#",
3875 (char **)&crsr__in__, &crsr__in_len__))
3876 return NULL;
3877 if (crsr__in_len__ != sizeof(Cursor))
3878 {
3879 PyErr_SetString(PyExc_TypeError, "buffer length should be sizeof(Cursor)");
3880 goto crsr__error__;
3881 }
3882 SetCursor(crsr__in__);
Jack Jansen7f725e41998-04-23 13:21:09 +00003883 Py_INCREF(Py_None);
3884 _res = Py_None;
Jack Jansene180d991998-04-24 10:28:20 +00003885 crsr__error__: ;
3886 return _res;
3887}
3888
3889static PyObject *Qd_ShowCursor(_self, _args)
3890 PyObject *_self;
3891 PyObject *_args;
3892{
3893 PyObject *_res = NULL;
3894 if (!PyArg_ParseTuple(_args, ""))
3895 return NULL;
3896 ShowCursor();
3897 Py_INCREF(Py_None);
3898 _res = Py_None;
3899 return _res;
3900}
3901
3902static PyObject *Qd_LineTo(_self, _args)
3903 PyObject *_self;
3904 PyObject *_args;
3905{
3906 PyObject *_res = NULL;
3907 short h;
3908 short v;
3909 if (!PyArg_ParseTuple(_args, "hh",
3910 &h,
3911 &v))
3912 return NULL;
3913 LineTo(h,
3914 v);
3915 Py_INCREF(Py_None);
3916 _res = Py_None;
3917 return _res;
3918}
3919
3920static PyObject *Qd_SetRect(_self, _args)
3921 PyObject *_self;
3922 PyObject *_args;
3923{
3924 PyObject *_res = NULL;
3925 Rect r;
3926 short left;
3927 short top;
3928 short right;
3929 short bottom;
3930 if (!PyArg_ParseTuple(_args, "hhhh",
3931 &left,
3932 &top,
3933 &right,
3934 &bottom))
3935 return NULL;
3936 SetRect(&r,
3937 left,
3938 top,
3939 right,
3940 bottom);
3941 _res = Py_BuildValue("O&",
3942 PyMac_BuildRect, &r);
3943 return _res;
3944}
3945
3946static PyObject *Qd_OffsetRect(_self, _args)
3947 PyObject *_self;
3948 PyObject *_args;
3949{
3950 PyObject *_res = NULL;
3951 Rect r;
3952 short dh;
3953 short dv;
3954 if (!PyArg_ParseTuple(_args, "O&hh",
3955 PyMac_GetRect, &r,
3956 &dh,
3957 &dv))
3958 return NULL;
3959 OffsetRect(&r,
3960 dh,
3961 dv);
3962 _res = Py_BuildValue("O&",
3963 PyMac_BuildRect, &r);
3964 return _res;
3965}
3966
3967static PyObject *Qd_InsetRect(_self, _args)
3968 PyObject *_self;
3969 PyObject *_args;
3970{
3971 PyObject *_res = NULL;
3972 Rect r;
3973 short dh;
3974 short dv;
3975 if (!PyArg_ParseTuple(_args, "O&hh",
3976 PyMac_GetRect, &r,
3977 &dh,
3978 &dv))
3979 return NULL;
3980 InsetRect(&r,
3981 dh,
3982 dv);
3983 _res = Py_BuildValue("O&",
3984 PyMac_BuildRect, &r);
3985 return _res;
3986}
3987
3988static PyObject *Qd_UnionRect(_self, _args)
3989 PyObject *_self;
3990 PyObject *_args;
3991{
3992 PyObject *_res = NULL;
3993 Rect src1;
3994 Rect src2;
3995 Rect dstRect;
3996 if (!PyArg_ParseTuple(_args, "O&O&",
3997 PyMac_GetRect, &src1,
3998 PyMac_GetRect, &src2))
3999 return NULL;
4000 UnionRect(&src1,
4001 &src2,
4002 &dstRect);
4003 _res = Py_BuildValue("O&",
4004 PyMac_BuildRect, &dstRect);
4005 return _res;
4006}
4007
4008static PyObject *Qd_EqualRect(_self, _args)
4009 PyObject *_self;
4010 PyObject *_args;
4011{
4012 PyObject *_res = NULL;
4013 Boolean _rv;
4014 Rect rect1;
4015 Rect rect2;
4016 if (!PyArg_ParseTuple(_args, "O&O&",
4017 PyMac_GetRect, &rect1,
4018 PyMac_GetRect, &rect2))
4019 return NULL;
4020 _rv = EqualRect(&rect1,
4021 &rect2);
4022 _res = Py_BuildValue("b",
4023 _rv);
4024 return _res;
4025}
4026
4027static PyObject *Qd_FrameRect(_self, _args)
4028 PyObject *_self;
4029 PyObject *_args;
4030{
4031 PyObject *_res = NULL;
4032 Rect r;
4033 if (!PyArg_ParseTuple(_args, "O&",
4034 PyMac_GetRect, &r))
4035 return NULL;
4036 FrameRect(&r);
4037 Py_INCREF(Py_None);
4038 _res = Py_None;
4039 return _res;
4040}
4041
4042static PyObject *Qd_InvertRect(_self, _args)
4043 PyObject *_self;
4044 PyObject *_args;
4045{
4046 PyObject *_res = NULL;
4047 Rect r;
4048 if (!PyArg_ParseTuple(_args, "O&",
4049 PyMac_GetRect, &r))
4050 return NULL;
4051 InvertRect(&r);
4052 Py_INCREF(Py_None);
4053 _res = Py_None;
4054 return _res;
4055}
4056
4057static PyObject *Qd_FillRect(_self, _args)
4058 PyObject *_self;
4059 PyObject *_args;
4060{
4061 PyObject *_res = NULL;
4062 Rect r;
4063 Pattern *pat__in__;
4064 int pat__in_len__;
4065 if (!PyArg_ParseTuple(_args, "O&s#",
4066 PyMac_GetRect, &r,
4067 (char **)&pat__in__, &pat__in_len__))
4068 return NULL;
4069 if (pat__in_len__ != sizeof(Pattern))
4070 {
4071 PyErr_SetString(PyExc_TypeError, "buffer length should be sizeof(Pattern)");
4072 goto pat__error__;
4073 }
4074 FillRect(&r,
4075 pat__in__);
4076 Py_INCREF(Py_None);
4077 _res = Py_None;
4078 pat__error__: ;
4079 return _res;
4080}
4081
4082static PyObject *Qd_CopyRgn(_self, _args)
4083 PyObject *_self;
4084 PyObject *_args;
4085{
4086 PyObject *_res = NULL;
4087 RgnHandle srcRgn;
4088 RgnHandle dstRgn;
4089 if (!PyArg_ParseTuple(_args, "O&O&",
4090 ResObj_Convert, &srcRgn,
4091 ResObj_Convert, &dstRgn))
4092 return NULL;
4093 CopyRgn(srcRgn,
4094 dstRgn);
4095 Py_INCREF(Py_None);
4096 _res = Py_None;
4097 return _res;
4098}
4099
4100static PyObject *Qd_SetRectRgn(_self, _args)
4101 PyObject *_self;
4102 PyObject *_args;
4103{
4104 PyObject *_res = NULL;
4105 RgnHandle rgn;
4106 short left;
4107 short top;
4108 short right;
4109 short bottom;
4110 if (!PyArg_ParseTuple(_args, "O&hhhh",
4111 ResObj_Convert, &rgn,
4112 &left,
4113 &top,
4114 &right,
4115 &bottom))
4116 return NULL;
4117 SetRectRgn(rgn,
4118 left,
4119 top,
4120 right,
4121 bottom);
4122 Py_INCREF(Py_None);
4123 _res = Py_None;
4124 return _res;
4125}
4126
4127static PyObject *Qd_OffsetRgn(_self, _args)
4128 PyObject *_self;
4129 PyObject *_args;
4130{
4131 PyObject *_res = NULL;
4132 RgnHandle rgn;
4133 short dh;
4134 short dv;
4135 if (!PyArg_ParseTuple(_args, "O&hh",
4136 ResObj_Convert, &rgn,
4137 &dh,
4138 &dv))
4139 return NULL;
4140 OffsetRgn(rgn,
4141 dh,
4142 dv);
4143 Py_INCREF(Py_None);
4144 _res = Py_None;
4145 return _res;
4146}
4147
4148static PyObject *Qd_UnionRgn(_self, _args)
4149 PyObject *_self;
4150 PyObject *_args;
4151{
4152 PyObject *_res = NULL;
4153 RgnHandle srcRgnA;
4154 RgnHandle srcRgnB;
4155 RgnHandle dstRgn;
4156 if (!PyArg_ParseTuple(_args, "O&O&O&",
4157 ResObj_Convert, &srcRgnA,
4158 ResObj_Convert, &srcRgnB,
4159 ResObj_Convert, &dstRgn))
4160 return NULL;
4161 UnionRgn(srcRgnA,
4162 srcRgnB,
4163 dstRgn);
4164 Py_INCREF(Py_None);
4165 _res = Py_None;
4166 return _res;
4167}
4168
4169static PyObject *Qd_XorRgn(_self, _args)
4170 PyObject *_self;
4171 PyObject *_args;
4172{
4173 PyObject *_res = NULL;
4174 RgnHandle srcRgnA;
4175 RgnHandle srcRgnB;
4176 RgnHandle dstRgn;
4177 if (!PyArg_ParseTuple(_args, "O&O&O&",
4178 ResObj_Convert, &srcRgnA,
4179 ResObj_Convert, &srcRgnB,
4180 ResObj_Convert, &dstRgn))
4181 return NULL;
4182 XorRgn(srcRgnA,
4183 srcRgnB,
4184 dstRgn);
4185 Py_INCREF(Py_None);
4186 _res = Py_None;
4187 return _res;
4188}
4189
4190static PyObject *Qd_EqualRgn(_self, _args)
4191 PyObject *_self;
4192 PyObject *_args;
4193{
4194 PyObject *_res = NULL;
4195 Boolean _rv;
4196 RgnHandle rgnA;
4197 RgnHandle rgnB;
4198 if (!PyArg_ParseTuple(_args, "O&O&",
4199 ResObj_Convert, &rgnA,
4200 ResObj_Convert, &rgnB))
4201 return NULL;
4202 _rv = EqualRgn(rgnA,
4203 rgnB);
4204 _res = Py_BuildValue("b",
4205 _rv);
4206 return _res;
4207}
4208
4209static PyObject *Qd_FrameRgn(_self, _args)
4210 PyObject *_self;
4211 PyObject *_args;
4212{
4213 PyObject *_res = NULL;
4214 RgnHandle rgn;
4215 if (!PyArg_ParseTuple(_args, "O&",
4216 ResObj_Convert, &rgn))
4217 return NULL;
4218 FrameRgn(rgn);
4219 Py_INCREF(Py_None);
4220 _res = Py_None;
4221 return _res;
4222}
4223
4224static PyObject *Qd_PaintRgn(_self, _args)
4225 PyObject *_self;
4226 PyObject *_args;
4227{
4228 PyObject *_res = NULL;
4229 RgnHandle rgn;
4230 if (!PyArg_ParseTuple(_args, "O&",
4231 ResObj_Convert, &rgn))
4232 return NULL;
4233 PaintRgn(rgn);
4234 Py_INCREF(Py_None);
4235 _res = Py_None;
4236 return _res;
4237}
4238
4239static PyObject *Qd_InvertRgn(_self, _args)
4240 PyObject *_self;
4241 PyObject *_args;
4242{
4243 PyObject *_res = NULL;
4244 RgnHandle rgn;
4245 if (!PyArg_ParseTuple(_args, "O&",
4246 ResObj_Convert, &rgn))
4247 return NULL;
4248 InvertRgn(rgn);
4249 Py_INCREF(Py_None);
4250 _res = Py_None;
4251 return _res;
4252}
4253
4254static PyObject *Qd_FillRgn(_self, _args)
4255 PyObject *_self;
4256 PyObject *_args;
4257{
4258 PyObject *_res = NULL;
4259 RgnHandle rgn;
4260 Pattern *pat__in__;
4261 int pat__in_len__;
4262 if (!PyArg_ParseTuple(_args, "O&s#",
4263 ResObj_Convert, &rgn,
4264 (char **)&pat__in__, &pat__in_len__))
4265 return NULL;
4266 if (pat__in_len__ != sizeof(Pattern))
4267 {
4268 PyErr_SetString(PyExc_TypeError, "buffer length should be sizeof(Pattern)");
4269 goto pat__error__;
4270 }
4271 FillRgn(rgn,
4272 pat__in__);
4273 Py_INCREF(Py_None);
4274 _res = Py_None;
4275 pat__error__: ;
4276 return _res;
4277}
4278
4279static PyObject *Qd_GetPixel(_self, _args)
4280 PyObject *_self;
4281 PyObject *_args;
4282{
4283 PyObject *_res = NULL;
4284 Boolean _rv;
4285 short h;
4286 short v;
4287 if (!PyArg_ParseTuple(_args, "hh",
4288 &h,
4289 &v))
4290 return NULL;
4291 _rv = GetPixel(h,
4292 v);
4293 _res = Py_BuildValue("b",
4294 _rv);
4295 return _res;
4296}
4297
4298static PyObject *Qd_PtInRect(_self, _args)
4299 PyObject *_self;
4300 PyObject *_args;
4301{
4302 PyObject *_res = NULL;
4303 Boolean _rv;
4304 Point pt;
4305 Rect r;
4306 if (!PyArg_ParseTuple(_args, "O&O&",
4307 PyMac_GetPoint, &pt,
4308 PyMac_GetRect, &r))
4309 return NULL;
4310 _rv = PtInRect(pt,
4311 &r);
4312 _res = Py_BuildValue("b",
4313 _rv);
4314 return _res;
4315}
4316
4317static PyObject *Qd_DrawText(_self, _args)
4318 PyObject *_self;
4319 PyObject *_args;
4320{
4321 PyObject *_res = NULL;
4322 char *textBuf__in__;
4323 int textBuf__len__;
4324 int textBuf__in_len__;
4325 short firstByte;
4326 short byteCount;
4327 if (!PyArg_ParseTuple(_args, "s#hh",
4328 &textBuf__in__, &textBuf__in_len__,
4329 &firstByte,
4330 &byteCount))
4331 return NULL;
4332 DrawText(textBuf__in__,
4333 firstByte,
4334 byteCount);
4335 Py_INCREF(Py_None);
4336 _res = Py_None;
4337 textBuf__error__: ;
Jack Jansen7f725e41998-04-23 13:21:09 +00004338 return _res;
4339}
4340
Jack Jansen41058c01995-11-16 22:48:29 +00004341static PyObject *Qd_BitMap(_self, _args)
4342 PyObject *_self;
4343 PyObject *_args;
4344{
4345 PyObject *_res = NULL;
4346
4347 BitMap *ptr;
4348 PyObject *source;
4349 Rect bounds;
4350 int rowbytes;
4351 char *data;
4352
4353 if ( !PyArg_ParseTuple(_args, "O!iO&", &PyString_Type, &source, &rowbytes, PyMac_GetRect,
4354 &bounds) )
4355 return NULL;
4356 data = PyString_AsString(source);
4357 if ((ptr=(BitMap *)malloc(sizeof(BitMap))) == NULL )
4358 return PyErr_NoMemory();
4359 ptr->baseAddr = (Ptr)data;
4360 ptr->rowBytes = rowbytes;
4361 ptr->bounds = bounds;
4362 if ( (_res = BMObj_New(ptr)) == NULL ) {
4363 free(ptr);
4364 return NULL;
4365 }
4366 ((BitMapObject *)_res)->referred_object = source;
4367 Py_INCREF(source);
4368 ((BitMapObject *)_res)->referred_bitmap = ptr;
4369 return _res;
4370
4371}
4372
Jack Jansen425e9eb1995-12-12 15:02:03 +00004373static PyObject *Qd_RawBitMap(_self, _args)
4374 PyObject *_self;
4375 PyObject *_args;
4376{
4377 PyObject *_res = NULL;
4378
4379 BitMap *ptr;
4380 PyObject *source;
4381
4382 if ( !PyArg_ParseTuple(_args, "O!", &PyString_Type, &source) )
4383 return NULL;
4384 if ( PyString_Size(source) != sizeof(BitMap) && PyString_Size(source) != sizeof(PixMap) ) {
4385 PyErr_BadArgument();
4386 return NULL;
4387 }
4388 ptr = (BitMapPtr)PyString_AsString(source);
4389 if ( (_res = BMObj_New(ptr)) == NULL ) {
4390 return NULL;
4391 }
4392 ((BitMapObject *)_res)->referred_object = source;
4393 Py_INCREF(source);
4394 return _res;
4395
4396}
4397
Guido van Rossum17448e21995-01-30 11:53:55 +00004398static PyMethodDef Qd_methods[] = {
Jack Jansen1c4e6141998-04-21 15:23:55 +00004399 {"MacSetPort", (PyCFunction)Qd_MacSetPort, 1,
Jack Jansen330381c1995-11-15 15:18:01 +00004400 "(GrafPtr port) -> None"},
Guido van Rossume56db431995-03-19 22:49:50 +00004401 {"GetPort", (PyCFunction)Qd_GetPort, 1,
Jack Jansen330381c1995-11-15 15:18:01 +00004402 "() -> (GrafPtr port)"},
Guido van Rossume56db431995-03-19 22:49:50 +00004403 {"GrafDevice", (PyCFunction)Qd_GrafDevice, 1,
4404 "(short device) -> None"},
Jack Jansen41058c01995-11-16 22:48:29 +00004405 {"SetPortBits", (PyCFunction)Qd_SetPortBits, 1,
4406 "(BitMapPtr bm) -> None"},
Guido van Rossume56db431995-03-19 22:49:50 +00004407 {"PortSize", (PyCFunction)Qd_PortSize, 1,
4408 "(short width, short height) -> None"},
4409 {"MovePortTo", (PyCFunction)Qd_MovePortTo, 1,
4410 "(short leftGlobal, short topGlobal) -> None"},
4411 {"SetOrigin", (PyCFunction)Qd_SetOrigin, 1,
4412 "(short h, short v) -> None"},
4413 {"SetClip", (PyCFunction)Qd_SetClip, 1,
4414 "(RgnHandle rgn) -> None"},
4415 {"GetClip", (PyCFunction)Qd_GetClip, 1,
4416 "(RgnHandle rgn) -> None"},
Guido van Rossum17448e21995-01-30 11:53:55 +00004417 {"ClipRect", (PyCFunction)Qd_ClipRect, 1,
4418 "(Rect r) -> None"},
Jack Jansen04a02e71996-01-06 17:12:58 +00004419 {"BackPat", (PyCFunction)Qd_BackPat, 1,
4420 "(Pattern pat) -> None"},
Guido van Rossume56db431995-03-19 22:49:50 +00004421 {"InitCursor", (PyCFunction)Qd_InitCursor, 1,
4422 "() -> None"},
Jack Jansen1c4e6141998-04-21 15:23:55 +00004423 {"MacSetCursor", (PyCFunction)Qd_MacSetCursor, 1,
Jack Jansenb5394061996-01-05 18:06:41 +00004424 "(Cursor crsr) -> None"},
Guido van Rossume56db431995-03-19 22:49:50 +00004425 {"HideCursor", (PyCFunction)Qd_HideCursor, 1,
4426 "() -> None"},
Jack Jansen1c4e6141998-04-21 15:23:55 +00004427 {"MacShowCursor", (PyCFunction)Qd_MacShowCursor, 1,
Guido van Rossume56db431995-03-19 22:49:50 +00004428 "() -> None"},
4429 {"ObscureCursor", (PyCFunction)Qd_ObscureCursor, 1,
4430 "() -> None"},
4431 {"HidePen", (PyCFunction)Qd_HidePen, 1,
4432 "() -> None"},
4433 {"ShowPen", (PyCFunction)Qd_ShowPen, 1,
4434 "() -> None"},
4435 {"GetPen", (PyCFunction)Qd_GetPen, 1,
Jack Jansen1d8ede71996-01-08 23:47:31 +00004436 "() -> (Point pt)"},
Jack Jansen04a02e71996-01-06 17:12:58 +00004437 {"GetPenState", (PyCFunction)Qd_GetPenState, 1,
4438 "() -> (PenState pnState)"},
4439 {"SetPenState", (PyCFunction)Qd_SetPenState, 1,
4440 "(PenState pnState) -> None"},
Guido van Rossume56db431995-03-19 22:49:50 +00004441 {"PenSize", (PyCFunction)Qd_PenSize, 1,
4442 "(short width, short height) -> None"},
4443 {"PenMode", (PyCFunction)Qd_PenMode, 1,
4444 "(short mode) -> None"},
Jack Jansen04a02e71996-01-06 17:12:58 +00004445 {"PenPat", (PyCFunction)Qd_PenPat, 1,
4446 "(Pattern pat) -> None"},
Guido van Rossume56db431995-03-19 22:49:50 +00004447 {"PenNormal", (PyCFunction)Qd_PenNormal, 1,
4448 "() -> None"},
4449 {"MoveTo", (PyCFunction)Qd_MoveTo, 1,
4450 "(short h, short v) -> None"},
4451 {"Move", (PyCFunction)Qd_Move, 1,
4452 "(short dh, short dv) -> None"},
Jack Jansen1c4e6141998-04-21 15:23:55 +00004453 {"MacLineTo", (PyCFunction)Qd_MacLineTo, 1,
Guido van Rossume56db431995-03-19 22:49:50 +00004454 "(short h, short v) -> None"},
4455 {"Line", (PyCFunction)Qd_Line, 1,
4456 "(short dh, short dv) -> None"},
Guido van Rossume56db431995-03-19 22:49:50 +00004457 {"ForeColor", (PyCFunction)Qd_ForeColor, 1,
4458 "(long color) -> None"},
4459 {"BackColor", (PyCFunction)Qd_BackColor, 1,
4460 "(long color) -> None"},
4461 {"ColorBit", (PyCFunction)Qd_ColorBit, 1,
4462 "(short whichBit) -> None"},
Jack Jansen1c4e6141998-04-21 15:23:55 +00004463 {"MacSetRect", (PyCFunction)Qd_MacSetRect, 1,
Guido van Rossume56db431995-03-19 22:49:50 +00004464 "(short left, short top, short right, short bottom) -> (Rect r)"},
Jack Jansen1c4e6141998-04-21 15:23:55 +00004465 {"MacOffsetRect", (PyCFunction)Qd_MacOffsetRect, 1,
Jack Jansen54c8f7e1995-11-14 10:46:01 +00004466 "(Rect r, short dh, short dv) -> (Rect r)"},
Jack Jansen1c4e6141998-04-21 15:23:55 +00004467 {"MacInsetRect", (PyCFunction)Qd_MacInsetRect, 1,
Jack Jansen54c8f7e1995-11-14 10:46:01 +00004468 "(Rect r, short dh, short dv) -> (Rect r)"},
Guido van Rossume56db431995-03-19 22:49:50 +00004469 {"SectRect", (PyCFunction)Qd_SectRect, 1,
4470 "(Rect src1, Rect src2) -> (Boolean _rv, Rect dstRect)"},
Jack Jansen1c4e6141998-04-21 15:23:55 +00004471 {"MacUnionRect", (PyCFunction)Qd_MacUnionRect, 1,
Guido van Rossume56db431995-03-19 22:49:50 +00004472 "(Rect src1, Rect src2) -> (Rect dstRect)"},
Jack Jansen1c4e6141998-04-21 15:23:55 +00004473 {"MacEqualRect", (PyCFunction)Qd_MacEqualRect, 1,
Guido van Rossume56db431995-03-19 22:49:50 +00004474 "(Rect rect1, Rect rect2) -> (Boolean _rv)"},
4475 {"EmptyRect", (PyCFunction)Qd_EmptyRect, 1,
4476 "(Rect r) -> (Boolean _rv)"},
Jack Jansen1c4e6141998-04-21 15:23:55 +00004477 {"MacFrameRect", (PyCFunction)Qd_MacFrameRect, 1,
Guido van Rossume56db431995-03-19 22:49:50 +00004478 "(Rect r) -> None"},
4479 {"PaintRect", (PyCFunction)Qd_PaintRect, 1,
4480 "(Rect r) -> None"},
Guido van Rossum17448e21995-01-30 11:53:55 +00004481 {"EraseRect", (PyCFunction)Qd_EraseRect, 1,
4482 "(Rect r) -> None"},
Jack Jansen1c4e6141998-04-21 15:23:55 +00004483 {"MacInvertRect", (PyCFunction)Qd_MacInvertRect, 1,
Guido van Rossume56db431995-03-19 22:49:50 +00004484 "(Rect r) -> None"},
Jack Jansen1c4e6141998-04-21 15:23:55 +00004485 {"MacFillRect", (PyCFunction)Qd_MacFillRect, 1,
Jack Jansen04a02e71996-01-06 17:12:58 +00004486 "(Rect r, Pattern pat) -> None"},
Guido van Rossume56db431995-03-19 22:49:50 +00004487 {"FrameOval", (PyCFunction)Qd_FrameOval, 1,
4488 "(Rect r) -> None"},
4489 {"PaintOval", (PyCFunction)Qd_PaintOval, 1,
4490 "(Rect r) -> None"},
4491 {"EraseOval", (PyCFunction)Qd_EraseOval, 1,
4492 "(Rect r) -> None"},
4493 {"InvertOval", (PyCFunction)Qd_InvertOval, 1,
4494 "(Rect r) -> None"},
Jack Jansen04a02e71996-01-06 17:12:58 +00004495 {"FillOval", (PyCFunction)Qd_FillOval, 1,
4496 "(Rect r, Pattern pat) -> None"},
Guido van Rossume56db431995-03-19 22:49:50 +00004497 {"FrameRoundRect", (PyCFunction)Qd_FrameRoundRect, 1,
4498 "(Rect r, short ovalWidth, short ovalHeight) -> None"},
4499 {"PaintRoundRect", (PyCFunction)Qd_PaintRoundRect, 1,
4500 "(Rect r, short ovalWidth, short ovalHeight) -> None"},
4501 {"EraseRoundRect", (PyCFunction)Qd_EraseRoundRect, 1,
4502 "(Rect r, short ovalWidth, short ovalHeight) -> None"},
4503 {"InvertRoundRect", (PyCFunction)Qd_InvertRoundRect, 1,
4504 "(Rect r, short ovalWidth, short ovalHeight) -> None"},
Jack Jansen04a02e71996-01-06 17:12:58 +00004505 {"FillRoundRect", (PyCFunction)Qd_FillRoundRect, 1,
4506 "(Rect r, short ovalWidth, short ovalHeight, Pattern pat) -> None"},
Guido van Rossume56db431995-03-19 22:49:50 +00004507 {"FrameArc", (PyCFunction)Qd_FrameArc, 1,
4508 "(Rect r, short startAngle, short arcAngle) -> None"},
4509 {"PaintArc", (PyCFunction)Qd_PaintArc, 1,
4510 "(Rect r, short startAngle, short arcAngle) -> None"},
4511 {"EraseArc", (PyCFunction)Qd_EraseArc, 1,
4512 "(Rect r, short startAngle, short arcAngle) -> None"},
4513 {"InvertArc", (PyCFunction)Qd_InvertArc, 1,
4514 "(Rect r, short startAngle, short arcAngle) -> None"},
Jack Jansen04a02e71996-01-06 17:12:58 +00004515 {"FillArc", (PyCFunction)Qd_FillArc, 1,
4516 "(Rect r, short startAngle, short arcAngle, Pattern pat) -> None"},
Guido van Rossume56db431995-03-19 22:49:50 +00004517 {"NewRgn", (PyCFunction)Qd_NewRgn, 1,
4518 "() -> (RgnHandle _rv)"},
4519 {"OpenRgn", (PyCFunction)Qd_OpenRgn, 1,
4520 "() -> None"},
4521 {"CloseRgn", (PyCFunction)Qd_CloseRgn, 1,
4522 "(RgnHandle dstRgn) -> None"},
Jack Jansen41058c01995-11-16 22:48:29 +00004523 {"BitMapToRegion", (PyCFunction)Qd_BitMapToRegion, 1,
4524 "(RgnHandle region, BitMapPtr bMap) -> None"},
Guido van Rossume56db431995-03-19 22:49:50 +00004525 {"DisposeRgn", (PyCFunction)Qd_DisposeRgn, 1,
4526 "(RgnHandle rgn) -> None"},
Jack Jansen1c4e6141998-04-21 15:23:55 +00004527 {"MacCopyRgn", (PyCFunction)Qd_MacCopyRgn, 1,
Guido van Rossume56db431995-03-19 22:49:50 +00004528 "(RgnHandle srcRgn, RgnHandle dstRgn) -> None"},
4529 {"SetEmptyRgn", (PyCFunction)Qd_SetEmptyRgn, 1,
4530 "(RgnHandle rgn) -> None"},
Jack Jansen1c4e6141998-04-21 15:23:55 +00004531 {"MacSetRectRgn", (PyCFunction)Qd_MacSetRectRgn, 1,
Guido van Rossume56db431995-03-19 22:49:50 +00004532 "(RgnHandle rgn, short left, short top, short right, short bottom) -> None"},
4533 {"RectRgn", (PyCFunction)Qd_RectRgn, 1,
4534 "(RgnHandle rgn, Rect r) -> None"},
Jack Jansen1c4e6141998-04-21 15:23:55 +00004535 {"MacOffsetRgn", (PyCFunction)Qd_MacOffsetRgn, 1,
Guido van Rossume56db431995-03-19 22:49:50 +00004536 "(RgnHandle rgn, short dh, short dv) -> None"},
4537 {"InsetRgn", (PyCFunction)Qd_InsetRgn, 1,
4538 "(RgnHandle rgn, short dh, short dv) -> None"},
4539 {"SectRgn", (PyCFunction)Qd_SectRgn, 1,
4540 "(RgnHandle srcRgnA, RgnHandle srcRgnB, RgnHandle dstRgn) -> None"},
Jack Jansen1c4e6141998-04-21 15:23:55 +00004541 {"MacUnionRgn", (PyCFunction)Qd_MacUnionRgn, 1,
Guido van Rossume56db431995-03-19 22:49:50 +00004542 "(RgnHandle srcRgnA, RgnHandle srcRgnB, RgnHandle dstRgn) -> None"},
4543 {"DiffRgn", (PyCFunction)Qd_DiffRgn, 1,
4544 "(RgnHandle srcRgnA, RgnHandle srcRgnB, RgnHandle dstRgn) -> None"},
Jack Jansen1c4e6141998-04-21 15:23:55 +00004545 {"MacXorRgn", (PyCFunction)Qd_MacXorRgn, 1,
Guido van Rossume56db431995-03-19 22:49:50 +00004546 "(RgnHandle srcRgnA, RgnHandle srcRgnB, RgnHandle dstRgn) -> None"},
4547 {"RectInRgn", (PyCFunction)Qd_RectInRgn, 1,
4548 "(Rect r, RgnHandle rgn) -> (Boolean _rv)"},
Jack Jansen1c4e6141998-04-21 15:23:55 +00004549 {"MacEqualRgn", (PyCFunction)Qd_MacEqualRgn, 1,
Guido van Rossume56db431995-03-19 22:49:50 +00004550 "(RgnHandle rgnA, RgnHandle rgnB) -> (Boolean _rv)"},
4551 {"EmptyRgn", (PyCFunction)Qd_EmptyRgn, 1,
4552 "(RgnHandle rgn) -> (Boolean _rv)"},
Jack Jansen1c4e6141998-04-21 15:23:55 +00004553 {"MacFrameRgn", (PyCFunction)Qd_MacFrameRgn, 1,
Guido van Rossume56db431995-03-19 22:49:50 +00004554 "(RgnHandle rgn) -> None"},
Jack Jansen1c4e6141998-04-21 15:23:55 +00004555 {"MacPaintRgn", (PyCFunction)Qd_MacPaintRgn, 1,
Guido van Rossume56db431995-03-19 22:49:50 +00004556 "(RgnHandle rgn) -> None"},
4557 {"EraseRgn", (PyCFunction)Qd_EraseRgn, 1,
4558 "(RgnHandle rgn) -> None"},
Jack Jansen1c4e6141998-04-21 15:23:55 +00004559 {"MacInvertRgn", (PyCFunction)Qd_MacInvertRgn, 1,
Guido van Rossume56db431995-03-19 22:49:50 +00004560 "(RgnHandle rgn) -> None"},
Jack Jansen1c4e6141998-04-21 15:23:55 +00004561 {"MacFillRgn", (PyCFunction)Qd_MacFillRgn, 1,
Jack Jansen04a02e71996-01-06 17:12:58 +00004562 "(RgnHandle rgn, Pattern pat) -> None"},
Guido van Rossume56db431995-03-19 22:49:50 +00004563 {"ScrollRect", (PyCFunction)Qd_ScrollRect, 1,
4564 "(Rect r, short dh, short dv, RgnHandle updateRgn) -> None"},
Jack Jansen41058c01995-11-16 22:48:29 +00004565 {"CopyBits", (PyCFunction)Qd_CopyBits, 1,
4566 "(BitMapPtr srcBits, BitMapPtr dstBits, Rect srcRect, Rect dstRect, short mode, RgnHandle maskRgn) -> None"},
4567 {"CopyMask", (PyCFunction)Qd_CopyMask, 1,
4568 "(BitMapPtr srcBits, BitMapPtr maskBits, BitMapPtr dstBits, Rect srcRect, Rect maskRect, Rect dstRect) -> None"},
Guido van Rossume56db431995-03-19 22:49:50 +00004569 {"OpenPicture", (PyCFunction)Qd_OpenPicture, 1,
4570 "(Rect picFrame) -> (PicHandle _rv)"},
4571 {"PicComment", (PyCFunction)Qd_PicComment, 1,
4572 "(short kind, short dataSize, Handle dataHandle) -> None"},
4573 {"ClosePicture", (PyCFunction)Qd_ClosePicture, 1,
4574 "() -> None"},
4575 {"DrawPicture", (PyCFunction)Qd_DrawPicture, 1,
4576 "(PicHandle myPicture, Rect dstRect) -> None"},
4577 {"KillPicture", (PyCFunction)Qd_KillPicture, 1,
4578 "(PicHandle myPicture) -> None"},
4579 {"OpenPoly", (PyCFunction)Qd_OpenPoly, 1,
4580 "() -> (PolyHandle _rv)"},
4581 {"ClosePoly", (PyCFunction)Qd_ClosePoly, 1,
4582 "() -> None"},
4583 {"KillPoly", (PyCFunction)Qd_KillPoly, 1,
4584 "(PolyHandle poly) -> None"},
4585 {"OffsetPoly", (PyCFunction)Qd_OffsetPoly, 1,
4586 "(PolyHandle poly, short dh, short dv) -> None"},
4587 {"FramePoly", (PyCFunction)Qd_FramePoly, 1,
4588 "(PolyHandle poly) -> None"},
4589 {"PaintPoly", (PyCFunction)Qd_PaintPoly, 1,
4590 "(PolyHandle poly) -> None"},
4591 {"ErasePoly", (PyCFunction)Qd_ErasePoly, 1,
4592 "(PolyHandle poly) -> None"},
4593 {"InvertPoly", (PyCFunction)Qd_InvertPoly, 1,
4594 "(PolyHandle poly) -> None"},
Jack Jansen04a02e71996-01-06 17:12:58 +00004595 {"FillPoly", (PyCFunction)Qd_FillPoly, 1,
4596 "(PolyHandle poly, Pattern pat) -> None"},
Guido van Rossume56db431995-03-19 22:49:50 +00004597 {"SetPt", (PyCFunction)Qd_SetPt, 1,
Jack Jansen1d8ede71996-01-08 23:47:31 +00004598 "(short h, short v) -> (Point pt)"},
Guido van Rossume56db431995-03-19 22:49:50 +00004599 {"LocalToGlobal", (PyCFunction)Qd_LocalToGlobal, 1,
4600 "(Point pt) -> (Point pt)"},
4601 {"GlobalToLocal", (PyCFunction)Qd_GlobalToLocal, 1,
4602 "(Point pt) -> (Point pt)"},
4603 {"Random", (PyCFunction)Qd_Random, 1,
4604 "() -> (short _rv)"},
Jack Jansen1c4e6141998-04-21 15:23:55 +00004605 {"MacGetPixel", (PyCFunction)Qd_MacGetPixel, 1,
Guido van Rossume56db431995-03-19 22:49:50 +00004606 "(short h, short v) -> (Boolean _rv)"},
4607 {"ScalePt", (PyCFunction)Qd_ScalePt, 1,
4608 "(Point pt, Rect srcRect, Rect dstRect) -> (Point pt)"},
4609 {"MapPt", (PyCFunction)Qd_MapPt, 1,
4610 "(Point pt, Rect srcRect, Rect dstRect) -> (Point pt)"},
4611 {"MapRect", (PyCFunction)Qd_MapRect, 1,
Jack Jansen54c8f7e1995-11-14 10:46:01 +00004612 "(Rect r, Rect srcRect, Rect dstRect) -> (Rect r)"},
Guido van Rossume56db431995-03-19 22:49:50 +00004613 {"MapRgn", (PyCFunction)Qd_MapRgn, 1,
4614 "(RgnHandle rgn, Rect srcRect, Rect dstRect) -> None"},
4615 {"MapPoly", (PyCFunction)Qd_MapPoly, 1,
4616 "(PolyHandle poly, Rect srcRect, Rect dstRect) -> None"},
Jack Jansen41058c01995-11-16 22:48:29 +00004617 {"StdBits", (PyCFunction)Qd_StdBits, 1,
4618 "(BitMapPtr srcBits, Rect srcRect, Rect dstRect, short mode, RgnHandle maskRgn) -> None"},
Guido van Rossume56db431995-03-19 22:49:50 +00004619 {"AddPt", (PyCFunction)Qd_AddPt, 1,
4620 "(Point src, Point dst) -> (Point dst)"},
4621 {"EqualPt", (PyCFunction)Qd_EqualPt, 1,
4622 "(Point pt1, Point pt2) -> (Boolean _rv)"},
Jack Jansen1c4e6141998-04-21 15:23:55 +00004623 {"MacPtInRect", (PyCFunction)Qd_MacPtInRect, 1,
Guido van Rossume56db431995-03-19 22:49:50 +00004624 "(Point pt, Rect r) -> (Boolean _rv)"},
4625 {"Pt2Rect", (PyCFunction)Qd_Pt2Rect, 1,
4626 "(Point pt1, Point pt2) -> (Rect dstRect)"},
4627 {"PtToAngle", (PyCFunction)Qd_PtToAngle, 1,
4628 "(Rect r, Point pt) -> (short angle)"},
Jack Jansenb81cf9d1995-06-06 13:08:40 +00004629 {"SubPt", (PyCFunction)Qd_SubPt, 1,
4630 "(Point src, Point dst) -> (Point dst)"},
Guido van Rossume56db431995-03-19 22:49:50 +00004631 {"PtInRgn", (PyCFunction)Qd_PtInRgn, 1,
4632 "(Point pt, RgnHandle rgn) -> (Boolean _rv)"},
4633 {"NewPixMap", (PyCFunction)Qd_NewPixMap, 1,
4634 "() -> (PixMapHandle _rv)"},
Guido van Rossume56db431995-03-19 22:49:50 +00004635 {"DisposePixMap", (PyCFunction)Qd_DisposePixMap, 1,
4636 "(PixMapHandle pm) -> None"},
4637 {"CopyPixMap", (PyCFunction)Qd_CopyPixMap, 1,
4638 "(PixMapHandle srcPM, PixMapHandle dstPM) -> None"},
4639 {"NewPixPat", (PyCFunction)Qd_NewPixPat, 1,
4640 "() -> (PixPatHandle _rv)"},
Guido van Rossume56db431995-03-19 22:49:50 +00004641 {"DisposePixPat", (PyCFunction)Qd_DisposePixPat, 1,
4642 "(PixPatHandle pp) -> None"},
4643 {"CopyPixPat", (PyCFunction)Qd_CopyPixPat, 1,
4644 "(PixPatHandle srcPP, PixPatHandle dstPP) -> None"},
4645 {"PenPixPat", (PyCFunction)Qd_PenPixPat, 1,
4646 "(PixPatHandle pp) -> None"},
4647 {"BackPixPat", (PyCFunction)Qd_BackPixPat, 1,
4648 "(PixPatHandle pp) -> None"},
4649 {"GetPixPat", (PyCFunction)Qd_GetPixPat, 1,
4650 "(short patID) -> (PixPatHandle _rv)"},
Jack Jansen232f3cd1995-12-09 14:04:31 +00004651 {"MakeRGBPat", (PyCFunction)Qd_MakeRGBPat, 1,
4652 "(PixPatHandle pp, RGBColor myColor) -> None"},
Guido van Rossume56db431995-03-19 22:49:50 +00004653 {"FillCRect", (PyCFunction)Qd_FillCRect, 1,
4654 "(Rect r, PixPatHandle pp) -> None"},
4655 {"FillCOval", (PyCFunction)Qd_FillCOval, 1,
4656 "(Rect r, PixPatHandle pp) -> None"},
4657 {"FillCRoundRect", (PyCFunction)Qd_FillCRoundRect, 1,
4658 "(Rect r, short ovalWidth, short ovalHeight, PixPatHandle pp) -> None"},
4659 {"FillCArc", (PyCFunction)Qd_FillCArc, 1,
4660 "(Rect r, short startAngle, short arcAngle, PixPatHandle pp) -> None"},
4661 {"FillCRgn", (PyCFunction)Qd_FillCRgn, 1,
4662 "(RgnHandle rgn, PixPatHandle pp) -> None"},
4663 {"FillCPoly", (PyCFunction)Qd_FillCPoly, 1,
4664 "(PolyHandle poly, PixPatHandle pp) -> None"},
Jack Jansen232f3cd1995-12-09 14:04:31 +00004665 {"RGBForeColor", (PyCFunction)Qd_RGBForeColor, 1,
4666 "(RGBColor color) -> None"},
4667 {"RGBBackColor", (PyCFunction)Qd_RGBBackColor, 1,
4668 "(RGBColor color) -> None"},
4669 {"SetCPixel", (PyCFunction)Qd_SetCPixel, 1,
4670 "(short h, short v, RGBColor cPix) -> None"},
Guido van Rossume56db431995-03-19 22:49:50 +00004671 {"SetPortPix", (PyCFunction)Qd_SetPortPix, 1,
4672 "(PixMapHandle pm) -> None"},
Jack Jansen232f3cd1995-12-09 14:04:31 +00004673 {"GetCPixel", (PyCFunction)Qd_GetCPixel, 1,
4674 "(short h, short v) -> (RGBColor cPix)"},
4675 {"GetForeColor", (PyCFunction)Qd_GetForeColor, 1,
4676 "() -> (RGBColor color)"},
4677 {"GetBackColor", (PyCFunction)Qd_GetBackColor, 1,
4678 "() -> (RGBColor color)"},
4679 {"OpColor", (PyCFunction)Qd_OpColor, 1,
4680 "(RGBColor color) -> None"},
4681 {"HiliteColor", (PyCFunction)Qd_HiliteColor, 1,
4682 "(RGBColor color) -> None"},
Jack Jansen69b43ed1997-08-15 14:35:54 +00004683 {"DisposeCTable", (PyCFunction)Qd_DisposeCTable, 1,
4684 "(CTabHandle cTable) -> None"},
4685 {"GetCTable", (PyCFunction)Qd_GetCTable, 1,
4686 "(short ctID) -> (CTabHandle _rv)"},
4687 {"GetCCursor", (PyCFunction)Qd_GetCCursor, 1,
4688 "(short crsrID) -> (CCrsrHandle _rv)"},
4689 {"SetCCursor", (PyCFunction)Qd_SetCCursor, 1,
4690 "(CCrsrHandle cCrsr) -> None"},
Guido van Rossume56db431995-03-19 22:49:50 +00004691 {"AllocCursor", (PyCFunction)Qd_AllocCursor, 1,
4692 "() -> None"},
Jack Jansen69b43ed1997-08-15 14:35:54 +00004693 {"DisposeCCursor", (PyCFunction)Qd_DisposeCCursor, 1,
4694 "(CCrsrHandle cCrsr) -> None"},
4695 {"GetMaxDevice", (PyCFunction)Qd_GetMaxDevice, 1,
4696 "(Rect globalRect) -> (GDHandle _rv)"},
Guido van Rossume56db431995-03-19 22:49:50 +00004697 {"GetCTSeed", (PyCFunction)Qd_GetCTSeed, 1,
4698 "() -> (long _rv)"},
Jack Jansen69b43ed1997-08-15 14:35:54 +00004699 {"GetDeviceList", (PyCFunction)Qd_GetDeviceList, 1,
4700 "() -> (GDHandle _rv)"},
4701 {"GetMainDevice", (PyCFunction)Qd_GetMainDevice, 1,
4702 "() -> (GDHandle _rv)"},
4703 {"GetNextDevice", (PyCFunction)Qd_GetNextDevice, 1,
4704 "(GDHandle curDevice) -> (GDHandle _rv)"},
4705 {"TestDeviceAttribute", (PyCFunction)Qd_TestDeviceAttribute, 1,
4706 "(GDHandle gdh, short attribute) -> (Boolean _rv)"},
4707 {"SetDeviceAttribute", (PyCFunction)Qd_SetDeviceAttribute, 1,
4708 "(GDHandle gdh, short attribute, Boolean value) -> None"},
4709 {"InitGDevice", (PyCFunction)Qd_InitGDevice, 1,
4710 "(short qdRefNum, long mode, GDHandle gdh) -> None"},
4711 {"NewGDevice", (PyCFunction)Qd_NewGDevice, 1,
4712 "(short refNum, long mode) -> (GDHandle _rv)"},
4713 {"DisposeGDevice", (PyCFunction)Qd_DisposeGDevice, 1,
4714 "(GDHandle gdh) -> None"},
4715 {"SetGDevice", (PyCFunction)Qd_SetGDevice, 1,
4716 "(GDHandle gd) -> None"},
4717 {"GetGDevice", (PyCFunction)Qd_GetGDevice, 1,
4718 "() -> (GDHandle _rv)"},
Jack Jansen232f3cd1995-12-09 14:04:31 +00004719 {"Color2Index", (PyCFunction)Qd_Color2Index, 1,
4720 "(RGBColor myColor) -> (long _rv)"},
4721 {"Index2Color", (PyCFunction)Qd_Index2Color, 1,
4722 "(long index) -> (RGBColor aColor)"},
4723 {"InvertColor", (PyCFunction)Qd_InvertColor, 1,
4724 "() -> (RGBColor myColor)"},
4725 {"RealColor", (PyCFunction)Qd_RealColor, 1,
4726 "(RGBColor color) -> (Boolean _rv)"},
Jack Jansen69b43ed1997-08-15 14:35:54 +00004727 {"GetSubTable", (PyCFunction)Qd_GetSubTable, 1,
4728 "(CTabHandle myColors, short iTabRes, CTabHandle targetTbl) -> None"},
4729 {"MakeITable", (PyCFunction)Qd_MakeITable, 1,
4730 "(CTabHandle cTabH, ITabHandle iTabH, short res) -> None"},
Guido van Rossume56db431995-03-19 22:49:50 +00004731 {"SetClientID", (PyCFunction)Qd_SetClientID, 1,
4732 "(short id) -> None"},
4733 {"ProtectEntry", (PyCFunction)Qd_ProtectEntry, 1,
4734 "(short index, Boolean protect) -> None"},
4735 {"ReserveEntry", (PyCFunction)Qd_ReserveEntry, 1,
4736 "(short index, Boolean reserve) -> None"},
4737 {"QDError", (PyCFunction)Qd_QDError, 1,
4738 "() -> (short _rv)"},
Jack Jansen41058c01995-11-16 22:48:29 +00004739 {"CopyDeepMask", (PyCFunction)Qd_CopyDeepMask, 1,
4740 "(BitMapPtr srcBits, BitMapPtr maskBits, BitMapPtr dstBits, Rect srcRect, Rect maskRect, Rect dstRect, short mode, RgnHandle maskRgn) -> None"},
Jack Jansen54c8f7e1995-11-14 10:46:01 +00004741 {"GetPattern", (PyCFunction)Qd_GetPattern, 1,
4742 "(short patternID) -> (PatHandle _rv)"},
Jack Jansen1c4e6141998-04-21 15:23:55 +00004743 {"MacGetCursor", (PyCFunction)Qd_MacGetCursor, 1,
Jack Jansen54c8f7e1995-11-14 10:46:01 +00004744 "(short cursorID) -> (CursHandle _rv)"},
4745 {"GetPicture", (PyCFunction)Qd_GetPicture, 1,
4746 "(short pictureID) -> (PicHandle _rv)"},
4747 {"DeltaPoint", (PyCFunction)Qd_DeltaPoint, 1,
4748 "(Point ptA, Point ptB) -> (long _rv)"},
4749 {"ShieldCursor", (PyCFunction)Qd_ShieldCursor, 1,
4750 "(Rect shieldRect, Point offsetPt) -> None"},
4751 {"ScreenRes", (PyCFunction)Qd_ScreenRes, 1,
4752 "() -> (short scrnHRes, short scrnVRes)"},
Jack Jansen04a02e71996-01-06 17:12:58 +00004753 {"GetIndPattern", (PyCFunction)Qd_GetIndPattern, 1,
4754 "(short patternListID, short index) -> (Pattern thePat)"},
Jack Jansen21f96871998-02-20 16:02:09 +00004755 {"SlopeFromAngle", (PyCFunction)Qd_SlopeFromAngle, 1,
4756 "(short angle) -> (Fixed _rv)"},
4757 {"AngleFromSlope", (PyCFunction)Qd_AngleFromSlope, 1,
4758 "(Fixed slope) -> (short _rv)"},
Jack Jansenb81cf9d1995-06-06 13:08:40 +00004759 {"TextFont", (PyCFunction)Qd_TextFont, 1,
4760 "(short font) -> None"},
4761 {"TextFace", (PyCFunction)Qd_TextFace, 1,
Jack Jansene742a821998-02-25 15:46:50 +00004762 "(StyleParameter face) -> None"},
Jack Jansenb81cf9d1995-06-06 13:08:40 +00004763 {"TextMode", (PyCFunction)Qd_TextMode, 1,
4764 "(short mode) -> None"},
4765 {"TextSize", (PyCFunction)Qd_TextSize, 1,
4766 "(short size) -> None"},
4767 {"SpaceExtra", (PyCFunction)Qd_SpaceExtra, 1,
Jack Jansen330381c1995-11-15 15:18:01 +00004768 "(Fixed extra) -> None"},
Jack Jansenb81cf9d1995-06-06 13:08:40 +00004769 {"DrawChar", (PyCFunction)Qd_DrawChar, 1,
Jack Jansen21f96871998-02-20 16:02:09 +00004770 "(CharParameter ch) -> None"},
Jack Jansenb81cf9d1995-06-06 13:08:40 +00004771 {"DrawString", (PyCFunction)Qd_DrawString, 1,
4772 "(Str255 s) -> None"},
Jack Jansen1c4e6141998-04-21 15:23:55 +00004773 {"MacDrawText", (PyCFunction)Qd_MacDrawText, 1,
Jack Jansenb81cf9d1995-06-06 13:08:40 +00004774 "(Buffer textBuf, short firstByte, short byteCount) -> None"},
4775 {"CharWidth", (PyCFunction)Qd_CharWidth, 1,
Jack Jansen21f96871998-02-20 16:02:09 +00004776 "(CharParameter ch) -> (short _rv)"},
Jack Jansenb81cf9d1995-06-06 13:08:40 +00004777 {"StringWidth", (PyCFunction)Qd_StringWidth, 1,
4778 "(Str255 s) -> (short _rv)"},
4779 {"TextWidth", (PyCFunction)Qd_TextWidth, 1,
4780 "(Buffer textBuf, short firstByte, short byteCount) -> (short _rv)"},
Jack Jansen3a50f8a1996-01-11 16:17:14 +00004781 {"GetFontInfo", (PyCFunction)Qd_GetFontInfo, 1,
4782 "() -> (FontInfo info)"},
Jack Jansenb81cf9d1995-06-06 13:08:40 +00004783 {"CharExtra", (PyCFunction)Qd_CharExtra, 1,
Jack Jansen330381c1995-11-15 15:18:01 +00004784 "(Fixed extra) -> None"},
Jack Jansen7f725e41998-04-23 13:21:09 +00004785 {"SetPort", (PyCFunction)Qd_SetPort, 1,
Jack Jansen29bfea91998-04-27 15:09:36 +00004786 "(GrafPtr thePort) -> None"},
Jack Jansene180d991998-04-24 10:28:20 +00004787 {"GetCursor", (PyCFunction)Qd_GetCursor, 1,
4788 "(short cursorID) -> (CursHandle _rv)"},
4789 {"SetCursor", (PyCFunction)Qd_SetCursor, 1,
4790 "(Cursor crsr) -> None"},
4791 {"ShowCursor", (PyCFunction)Qd_ShowCursor, 1,
4792 "() -> None"},
4793 {"LineTo", (PyCFunction)Qd_LineTo, 1,
4794 "(short h, short v) -> None"},
4795 {"SetRect", (PyCFunction)Qd_SetRect, 1,
4796 "(short left, short top, short right, short bottom) -> (Rect r)"},
4797 {"OffsetRect", (PyCFunction)Qd_OffsetRect, 1,
4798 "(Rect r, short dh, short dv) -> (Rect r)"},
4799 {"InsetRect", (PyCFunction)Qd_InsetRect, 1,
4800 "(Rect r, short dh, short dv) -> (Rect r)"},
4801 {"UnionRect", (PyCFunction)Qd_UnionRect, 1,
4802 "(Rect src1, Rect src2) -> (Rect dstRect)"},
4803 {"EqualRect", (PyCFunction)Qd_EqualRect, 1,
4804 "(Rect rect1, Rect rect2) -> (Boolean _rv)"},
4805 {"FrameRect", (PyCFunction)Qd_FrameRect, 1,
4806 "(Rect r) -> None"},
4807 {"InvertRect", (PyCFunction)Qd_InvertRect, 1,
4808 "(Rect r) -> None"},
4809 {"FillRect", (PyCFunction)Qd_FillRect, 1,
4810 "(Rect r, Pattern pat) -> None"},
4811 {"CopyRgn", (PyCFunction)Qd_CopyRgn, 1,
4812 "(RgnHandle srcRgn, RgnHandle dstRgn) -> None"},
4813 {"SetRectRgn", (PyCFunction)Qd_SetRectRgn, 1,
4814 "(RgnHandle rgn, short left, short top, short right, short bottom) -> None"},
4815 {"OffsetRgn", (PyCFunction)Qd_OffsetRgn, 1,
4816 "(RgnHandle rgn, short dh, short dv) -> None"},
4817 {"UnionRgn", (PyCFunction)Qd_UnionRgn, 1,
4818 "(RgnHandle srcRgnA, RgnHandle srcRgnB, RgnHandle dstRgn) -> None"},
4819 {"XorRgn", (PyCFunction)Qd_XorRgn, 1,
4820 "(RgnHandle srcRgnA, RgnHandle srcRgnB, RgnHandle dstRgn) -> None"},
4821 {"EqualRgn", (PyCFunction)Qd_EqualRgn, 1,
4822 "(RgnHandle rgnA, RgnHandle rgnB) -> (Boolean _rv)"},
4823 {"FrameRgn", (PyCFunction)Qd_FrameRgn, 1,
4824 "(RgnHandle rgn) -> None"},
4825 {"PaintRgn", (PyCFunction)Qd_PaintRgn, 1,
4826 "(RgnHandle rgn) -> None"},
4827 {"InvertRgn", (PyCFunction)Qd_InvertRgn, 1,
4828 "(RgnHandle rgn) -> None"},
4829 {"FillRgn", (PyCFunction)Qd_FillRgn, 1,
4830 "(RgnHandle rgn, Pattern pat) -> None"},
4831 {"GetPixel", (PyCFunction)Qd_GetPixel, 1,
4832 "(short h, short v) -> (Boolean _rv)"},
4833 {"PtInRect", (PyCFunction)Qd_PtInRect, 1,
4834 "(Point pt, Rect r) -> (Boolean _rv)"},
4835 {"DrawText", (PyCFunction)Qd_DrawText, 1,
4836 "(Buffer textBuf, short firstByte, short byteCount) -> None"},
Jack Jansen41058c01995-11-16 22:48:29 +00004837 {"BitMap", (PyCFunction)Qd_BitMap, 1,
4838 "Take (string, int, Rect) argument and create BitMap"},
Jack Jansen425e9eb1995-12-12 15:02:03 +00004839 {"RawBitMap", (PyCFunction)Qd_RawBitMap, 1,
4840 "Take string BitMap and turn into BitMap object"},
Guido van Rossum17448e21995-01-30 11:53:55 +00004841 {NULL, NULL, 0}
4842};
4843
4844
4845
4846
4847void initQd()
4848{
4849 PyObject *m;
4850 PyObject *d;
4851
4852
4853
4854
4855 m = Py_InitModule("Qd", Qd_methods);
4856 d = PyModule_GetDict(m);
4857 Qd_Error = PyMac_GetOSErrException();
4858 if (Qd_Error == NULL ||
4859 PyDict_SetItemString(d, "Error", Qd_Error) != 0)
4860 Py_FatalError("can't initialize Qd.Error");
Jack Jansena755e681997-09-20 17:40:22 +00004861 GrafPort_Type.ob_type = &PyType_Type;
4862 Py_INCREF(&GrafPort_Type);
4863 if (PyDict_SetItemString(d, "GrafPortType", (PyObject *)&GrafPort_Type) != 0)
4864 Py_FatalError("can't initialize GrafPortType");
4865 BitMap_Type.ob_type = &PyType_Type;
4866 Py_INCREF(&BitMap_Type);
4867 if (PyDict_SetItemString(d, "BitMapType", (PyObject *)&BitMap_Type) != 0)
4868 Py_FatalError("can't initialize BitMapType");
4869 QDGlobalsAccess_Type.ob_type = &PyType_Type;
4870 Py_INCREF(&QDGlobalsAccess_Type);
4871 if (PyDict_SetItemString(d, "QDGlobalsAccessType", (PyObject *)&QDGlobalsAccess_Type) != 0)
4872 Py_FatalError("can't initialize QDGlobalsAccessType");
Jack Jansenb5394061996-01-05 18:06:41 +00004873
4874 {
4875 PyObject *o;
Jack Jansenbdd07471996-01-29 15:44:03 +00004876
4877 o = QDGA_New();
4878 if (o == NULL || PyDict_SetItemString(d, "qd", o) != 0)
4879 Py_FatalError("can't initialize Qd.qd");
Jack Jansenb5394061996-01-05 18:06:41 +00004880 }
4881
4882
Guido van Rossum17448e21995-01-30 11:53:55 +00004883}
4884
4885/* ========================= End module Qd ========================== */
4886