blob: 843e301d7f01c8391eb8a21fb963154341df1043 [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
Guido van Rossum17448e21995-01-30 11:53:55 +0000406static PyObject *Qd_SetPort(_self, _args)
407 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;
Guido van Rossume56db431995-03-19 22:49:50 +0000415 SetPort(port);
416 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 Jansenb5394061996-01-05 18:06:41 +0000599static PyObject *Qd_SetCursor(_self, _args)
600 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 }
614 SetCursor(crsr__in__);
615 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
634static PyObject *Qd_ShowCursor(_self, _args)
635 PyObject *_self;
636 PyObject *_args;
637{
638 PyObject *_res = NULL;
639 if (!PyArg_ParseTuple(_args, ""))
640 return NULL;
641 ShowCursor();
642 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
841static PyObject *Qd_LineTo(_self, _args)
842 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;
852 LineTo(h,
853 v);
854 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
922static PyObject *Qd_SetRect(_self, _args)
923 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;
938 SetRect(&r,
939 left,
940 top,
941 right,
942 bottom);
943 _res = Py_BuildValue("O&",
944 PyMac_BuildRect, &r);
945 return _res;
946}
947
948static PyObject *Qd_OffsetRect(_self, _args)
949 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;
961 OffsetRect(&r,
962 dh,
963 dv);
964 _res = Py_BuildValue("O&",
965 PyMac_BuildRect, &r);
966 return _res;
967}
968
969static PyObject *Qd_InsetRect(_self, _args)
970 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;
982 InsetRect(&r,
983 dh,
984 dv);
985 _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
1012static PyObject *Qd_UnionRect(_self, _args)
1013 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;
1024 UnionRect(&src1,
1025 &src2,
1026 &dstRect);
1027 _res = Py_BuildValue("O&",
1028 PyMac_BuildRect, &dstRect);
1029 return _res;
1030}
1031
1032static PyObject *Qd_EqualRect(_self, _args)
1033 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;
1044 _rv = EqualRect(&rect1,
1045 &rect2);
1046 _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
1067static PyObject *Qd_FrameRect(_self, _args)
1068 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;
1076 FrameRect(&r);
1077 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
Guido van Rossume56db431995-03-19 22:49:50 +00001112static PyObject *Qd_InvertRect(_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;
Guido van Rossume56db431995-03-19 22:49:50 +00001121 InvertRect(&r);
Guido van Rossum17448e21995-01-30 11:53:55 +00001122 Py_INCREF(Py_None);
1123 _res = Py_None;
1124 return _res;
1125}
1126
Jack Jansen04a02e71996-01-06 17:12:58 +00001127static PyObject *Qd_FillRect(_self, _args)
1128 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 }
1144 FillRect(&r,
1145 pat__in__);
1146 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
1544static PyObject *Qd_CopyRgn(_self, _args)
1545 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;
1555 CopyRgn(srcRgn,
1556 dstRgn);
1557 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
1577static PyObject *Qd_SetRectRgn(_self, _args)
1578 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;
1594 SetRectRgn(rgn,
1595 left,
1596 top,
1597 right,
1598 bottom);
1599 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
1622static PyObject *Qd_OffsetRgn(_self, _args)
1623 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;
1635 OffsetRgn(rgn,
1636 dh,
1637 dv);
1638 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
1685static PyObject *Qd_UnionRgn(_self, _args)
1686 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;
1698 UnionRgn(srcRgnA,
1699 srcRgnB,
1700 dstRgn);
1701 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
1727static PyObject *Qd_XorRgn(_self, _args)
1728 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;
1740 XorRgn(srcRgnA,
1741 srcRgnB,
1742 dstRgn);
1743 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
1767static PyObject *Qd_EqualRgn(_self, _args)
1768 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;
1779 _rv = EqualRgn(rgnA,
1780 rgnB);
1781 _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
1802static PyObject *Qd_FrameRgn(_self, _args)
1803 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;
1811 FrameRgn(rgn);
1812 Py_INCREF(Py_None);
1813 _res = Py_None;
1814 return _res;
1815}
1816
1817static PyObject *Qd_PaintRgn(_self, _args)
1818 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;
1826 PaintRgn(rgn);
1827 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
1847static PyObject *Qd_InvertRgn(_self, _args)
1848 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;
1856 InvertRgn(rgn);
1857 Py_INCREF(Py_None);
1858 _res = Py_None;
1859 return _res;
1860}
1861
Jack Jansen04a02e71996-01-06 17:12:58 +00001862static PyObject *Qd_FillRgn(_self, _args)
1863 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 }
1879 FillRgn(rgn,
1880 pat__in__);
1881 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
2266static PyObject *Qd_GetPixel(_self, _args)
2267 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;
2278 _rv = GetPixel(h,
2279 v);
2280 _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
2454static PyObject *Qd_PtInRect(_self, _args)
2455 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;
2466 _rv = PtInRect(pt,
2467 &r);
2468 _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
Guido van Rossume56db431995-03-19 22:49:50 +00002972static PyObject *Qd_AllocCursor(_self, _args)
2973 PyObject *_self;
2974 PyObject *_args;
2975{
2976 PyObject *_res = NULL;
2977 if (!PyArg_ParseTuple(_args, ""))
2978 return NULL;
2979 AllocCursor();
2980 Py_INCREF(Py_None);
2981 _res = Py_None;
2982 return _res;
2983}
2984
Guido van Rossume56db431995-03-19 22:49:50 +00002985static PyObject *Qd_GetCTSeed(_self, _args)
2986 PyObject *_self;
2987 PyObject *_args;
2988{
2989 PyObject *_res = NULL;
2990 long _rv;
2991 if (!PyArg_ParseTuple(_args, ""))
2992 return NULL;
2993 _rv = GetCTSeed();
2994 _res = Py_BuildValue("l",
2995 _rv);
2996 return _res;
2997}
2998
Jack Jansen232f3cd1995-12-09 14:04:31 +00002999static PyObject *Qd_Color2Index(_self, _args)
3000 PyObject *_self;
3001 PyObject *_args;
3002{
3003 PyObject *_res = NULL;
3004 long _rv;
3005 RGBColor myColor;
3006 if (!PyArg_ParseTuple(_args, "O&",
3007 QdRGB_Convert, &myColor))
3008 return NULL;
3009 _rv = Color2Index(&myColor);
3010 _res = Py_BuildValue("l",
3011 _rv);
3012 return _res;
3013}
3014
3015static PyObject *Qd_Index2Color(_self, _args)
3016 PyObject *_self;
3017 PyObject *_args;
3018{
3019 PyObject *_res = NULL;
3020 long index;
3021 RGBColor aColor;
3022 if (!PyArg_ParseTuple(_args, "l",
3023 &index))
3024 return NULL;
3025 Index2Color(index,
3026 &aColor);
3027 _res = Py_BuildValue("O&",
3028 QdRGB_New, &aColor);
3029 return _res;
3030}
3031
3032static PyObject *Qd_InvertColor(_self, _args)
3033 PyObject *_self;
3034 PyObject *_args;
3035{
3036 PyObject *_res = NULL;
3037 RGBColor myColor;
3038 if (!PyArg_ParseTuple(_args, ""))
3039 return NULL;
3040 InvertColor(&myColor);
3041 _res = Py_BuildValue("O&",
3042 QdRGB_New, &myColor);
3043 return _res;
3044}
3045
3046static PyObject *Qd_RealColor(_self, _args)
3047 PyObject *_self;
3048 PyObject *_args;
3049{
3050 PyObject *_res = NULL;
3051 Boolean _rv;
3052 RGBColor color;
3053 if (!PyArg_ParseTuple(_args, "O&",
3054 QdRGB_Convert, &color))
3055 return NULL;
3056 _rv = RealColor(&color);
3057 _res = Py_BuildValue("b",
3058 _rv);
3059 return _res;
3060}
3061
Guido van Rossume56db431995-03-19 22:49:50 +00003062static PyObject *Qd_SetClientID(_self, _args)
3063 PyObject *_self;
3064 PyObject *_args;
3065{
3066 PyObject *_res = NULL;
3067 short id;
3068 if (!PyArg_ParseTuple(_args, "h",
3069 &id))
3070 return NULL;
3071 SetClientID(id);
3072 Py_INCREF(Py_None);
3073 _res = Py_None;
3074 return _res;
3075}
3076
3077static PyObject *Qd_ProtectEntry(_self, _args)
3078 PyObject *_self;
3079 PyObject *_args;
3080{
3081 PyObject *_res = NULL;
3082 short index;
3083 Boolean protect;
3084 if (!PyArg_ParseTuple(_args, "hb",
3085 &index,
3086 &protect))
3087 return NULL;
3088 ProtectEntry(index,
3089 protect);
3090 Py_INCREF(Py_None);
3091 _res = Py_None;
3092 return _res;
3093}
3094
3095static PyObject *Qd_ReserveEntry(_self, _args)
3096 PyObject *_self;
3097 PyObject *_args;
3098{
3099 PyObject *_res = NULL;
3100 short index;
3101 Boolean reserve;
3102 if (!PyArg_ParseTuple(_args, "hb",
3103 &index,
3104 &reserve))
3105 return NULL;
3106 ReserveEntry(index,
3107 reserve);
3108 Py_INCREF(Py_None);
3109 _res = Py_None;
3110 return _res;
3111}
3112
3113static PyObject *Qd_QDError(_self, _args)
3114 PyObject *_self;
3115 PyObject *_args;
3116{
3117 PyObject *_res = NULL;
3118 short _rv;
3119 if (!PyArg_ParseTuple(_args, ""))
3120 return NULL;
3121 _rv = QDError();
3122 _res = Py_BuildValue("h",
3123 _rv);
3124 return _res;
3125}
3126
Jack Jansen41058c01995-11-16 22:48:29 +00003127static PyObject *Qd_CopyDeepMask(_self, _args)
3128 PyObject *_self;
3129 PyObject *_args;
3130{
3131 PyObject *_res = NULL;
3132 BitMapPtr srcBits;
3133 BitMapPtr maskBits;
3134 BitMapPtr dstBits;
3135 Rect srcRect;
3136 Rect maskRect;
3137 Rect dstRect;
3138 short mode;
3139 RgnHandle maskRgn;
3140 if (!PyArg_ParseTuple(_args, "O&O&O&O&O&O&hO&",
3141 BMObj_Convert, &srcBits,
3142 BMObj_Convert, &maskBits,
3143 BMObj_Convert, &dstBits,
3144 PyMac_GetRect, &srcRect,
3145 PyMac_GetRect, &maskRect,
3146 PyMac_GetRect, &dstRect,
3147 &mode,
Jack Jansen425e9eb1995-12-12 15:02:03 +00003148 OptResObj_Convert, &maskRgn))
Jack Jansen41058c01995-11-16 22:48:29 +00003149 return NULL;
3150 CopyDeepMask(srcBits,
3151 maskBits,
3152 dstBits,
3153 &srcRect,
3154 &maskRect,
3155 &dstRect,
3156 mode,
3157 maskRgn);
3158 Py_INCREF(Py_None);
3159 _res = Py_None;
3160 return _res;
3161}
3162
Jack Jansen54c8f7e1995-11-14 10:46:01 +00003163static PyObject *Qd_GetPattern(_self, _args)
3164 PyObject *_self;
3165 PyObject *_args;
3166{
3167 PyObject *_res = NULL;
3168 PatHandle _rv;
3169 short patternID;
3170 if (!PyArg_ParseTuple(_args, "h",
3171 &patternID))
3172 return NULL;
3173 _rv = GetPattern(patternID);
3174 _res = Py_BuildValue("O&",
3175 ResObj_New, _rv);
3176 return _res;
3177}
3178
3179static PyObject *Qd_GetCursor(_self, _args)
3180 PyObject *_self;
3181 PyObject *_args;
3182{
3183 PyObject *_res = NULL;
3184 CursHandle _rv;
3185 short cursorID;
3186 if (!PyArg_ParseTuple(_args, "h",
3187 &cursorID))
3188 return NULL;
3189 _rv = GetCursor(cursorID);
3190 _res = Py_BuildValue("O&",
3191 ResObj_New, _rv);
3192 return _res;
3193}
3194
3195static PyObject *Qd_GetPicture(_self, _args)
3196 PyObject *_self;
3197 PyObject *_args;
3198{
3199 PyObject *_res = NULL;
3200 PicHandle _rv;
3201 short pictureID;
3202 if (!PyArg_ParseTuple(_args, "h",
3203 &pictureID))
3204 return NULL;
3205 _rv = GetPicture(pictureID);
3206 _res = Py_BuildValue("O&",
3207 ResObj_New, _rv);
3208 return _res;
3209}
3210
3211static PyObject *Qd_DeltaPoint(_self, _args)
3212 PyObject *_self;
3213 PyObject *_args;
3214{
3215 PyObject *_res = NULL;
3216 long _rv;
3217 Point ptA;
3218 Point ptB;
3219 if (!PyArg_ParseTuple(_args, "O&O&",
3220 PyMac_GetPoint, &ptA,
3221 PyMac_GetPoint, &ptB))
3222 return NULL;
3223 _rv = DeltaPoint(ptA,
3224 ptB);
3225 _res = Py_BuildValue("l",
3226 _rv);
3227 return _res;
3228}
3229
3230static PyObject *Qd_ShieldCursor(_self, _args)
3231 PyObject *_self;
3232 PyObject *_args;
3233{
3234 PyObject *_res = NULL;
3235 Rect shieldRect;
3236 Point offsetPt;
3237 if (!PyArg_ParseTuple(_args, "O&O&",
3238 PyMac_GetRect, &shieldRect,
3239 PyMac_GetPoint, &offsetPt))
3240 return NULL;
3241 ShieldCursor(&shieldRect,
3242 offsetPt);
3243 Py_INCREF(Py_None);
3244 _res = Py_None;
3245 return _res;
3246}
3247
3248static PyObject *Qd_ScreenRes(_self, _args)
3249 PyObject *_self;
3250 PyObject *_args;
3251{
3252 PyObject *_res = NULL;
3253 short scrnHRes;
3254 short scrnVRes;
3255 if (!PyArg_ParseTuple(_args, ""))
3256 return NULL;
3257 ScreenRes(&scrnHRes,
3258 &scrnVRes);
3259 _res = Py_BuildValue("hh",
3260 scrnHRes,
3261 scrnVRes);
3262 return _res;
3263}
3264
Jack Jansen04a02e71996-01-06 17:12:58 +00003265static PyObject *Qd_GetIndPattern(_self, _args)
3266 PyObject *_self;
3267 PyObject *_args;
3268{
3269 PyObject *_res = NULL;
3270 Pattern thePat__out__;
3271 short patternListID;
3272 short index;
3273 if (!PyArg_ParseTuple(_args, "hh",
3274 &patternListID,
3275 &index))
3276 return NULL;
3277 GetIndPattern(&thePat__out__,
3278 patternListID,
3279 index);
3280 _res = Py_BuildValue("s#",
3281 (char *)&thePat__out__, (int)sizeof(Pattern));
3282 thePat__error__: ;
3283 return _res;
3284}
3285
Jack Jansenb81cf9d1995-06-06 13:08:40 +00003286static PyObject *Qd_TextFont(_self, _args)
3287 PyObject *_self;
3288 PyObject *_args;
3289{
3290 PyObject *_res = NULL;
3291 short font;
3292 if (!PyArg_ParseTuple(_args, "h",
3293 &font))
3294 return NULL;
3295 TextFont(font);
3296 Py_INCREF(Py_None);
3297 _res = Py_None;
3298 return _res;
3299}
3300
3301static PyObject *Qd_TextFace(_self, _args)
3302 PyObject *_self;
3303 PyObject *_args;
3304{
3305 PyObject *_res = NULL;
3306 short face;
3307 if (!PyArg_ParseTuple(_args, "h",
3308 &face))
3309 return NULL;
3310 TextFace(face);
3311 Py_INCREF(Py_None);
3312 _res = Py_None;
3313 return _res;
3314}
3315
3316static PyObject *Qd_TextMode(_self, _args)
3317 PyObject *_self;
3318 PyObject *_args;
3319{
3320 PyObject *_res = NULL;
3321 short mode;
3322 if (!PyArg_ParseTuple(_args, "h",
3323 &mode))
3324 return NULL;
3325 TextMode(mode);
3326 Py_INCREF(Py_None);
3327 _res = Py_None;
3328 return _res;
3329}
3330
3331static PyObject *Qd_TextSize(_self, _args)
3332 PyObject *_self;
3333 PyObject *_args;
3334{
3335 PyObject *_res = NULL;
3336 short size;
3337 if (!PyArg_ParseTuple(_args, "h",
3338 &size))
3339 return NULL;
3340 TextSize(size);
3341 Py_INCREF(Py_None);
3342 _res = Py_None;
3343 return _res;
3344}
3345
3346static PyObject *Qd_SpaceExtra(_self, _args)
3347 PyObject *_self;
3348 PyObject *_args;
3349{
3350 PyObject *_res = NULL;
Jack Jansen330381c1995-11-15 15:18:01 +00003351 Fixed extra;
3352 if (!PyArg_ParseTuple(_args, "O&",
3353 PyMac_GetFixed, &extra))
Jack Jansenb81cf9d1995-06-06 13:08:40 +00003354 return NULL;
3355 SpaceExtra(extra);
3356 Py_INCREF(Py_None);
3357 _res = Py_None;
3358 return _res;
3359}
3360
3361static PyObject *Qd_DrawChar(_self, _args)
3362 PyObject *_self;
3363 PyObject *_args;
3364{
3365 PyObject *_res = NULL;
3366 short ch;
3367 if (!PyArg_ParseTuple(_args, "h",
3368 &ch))
3369 return NULL;
3370 DrawChar(ch);
3371 Py_INCREF(Py_None);
3372 _res = Py_None;
3373 return _res;
3374}
3375
3376static PyObject *Qd_DrawString(_self, _args)
3377 PyObject *_self;
3378 PyObject *_args;
3379{
3380 PyObject *_res = NULL;
3381 Str255 s;
3382 if (!PyArg_ParseTuple(_args, "O&",
3383 PyMac_GetStr255, s))
3384 return NULL;
3385 DrawString(s);
3386 Py_INCREF(Py_None);
3387 _res = Py_None;
3388 return _res;
3389}
3390
3391static PyObject *Qd_DrawText(_self, _args)
3392 PyObject *_self;
3393 PyObject *_args;
3394{
3395 PyObject *_res = NULL;
3396 char *textBuf__in__;
3397 int textBuf__len__;
3398 int textBuf__in_len__;
3399 short firstByte;
3400 short byteCount;
3401 if (!PyArg_ParseTuple(_args, "s#hh",
3402 &textBuf__in__, &textBuf__in_len__,
3403 &firstByte,
3404 &byteCount))
3405 return NULL;
3406 DrawText(textBuf__in__,
3407 firstByte,
3408 byteCount);
3409 Py_INCREF(Py_None);
3410 _res = Py_None;
3411 textBuf__error__: ;
3412 return _res;
3413}
3414
3415static PyObject *Qd_CharWidth(_self, _args)
3416 PyObject *_self;
3417 PyObject *_args;
3418{
3419 PyObject *_res = NULL;
3420 short _rv;
3421 short ch;
3422 if (!PyArg_ParseTuple(_args, "h",
3423 &ch))
3424 return NULL;
3425 _rv = CharWidth(ch);
3426 _res = Py_BuildValue("h",
3427 _rv);
3428 return _res;
3429}
3430
3431static PyObject *Qd_StringWidth(_self, _args)
3432 PyObject *_self;
3433 PyObject *_args;
3434{
3435 PyObject *_res = NULL;
3436 short _rv;
3437 Str255 s;
3438 if (!PyArg_ParseTuple(_args, "O&",
3439 PyMac_GetStr255, s))
3440 return NULL;
3441 _rv = StringWidth(s);
3442 _res = Py_BuildValue("h",
3443 _rv);
3444 return _res;
3445}
3446
3447static PyObject *Qd_TextWidth(_self, _args)
3448 PyObject *_self;
3449 PyObject *_args;
3450{
3451 PyObject *_res = NULL;
3452 short _rv;
3453 char *textBuf__in__;
3454 int textBuf__len__;
3455 int textBuf__in_len__;
3456 short firstByte;
3457 short byteCount;
3458 if (!PyArg_ParseTuple(_args, "s#hh",
3459 &textBuf__in__, &textBuf__in_len__,
3460 &firstByte,
3461 &byteCount))
3462 return NULL;
3463 _rv = TextWidth(textBuf__in__,
3464 firstByte,
3465 byteCount);
3466 _res = Py_BuildValue("h",
3467 _rv);
3468 textBuf__error__: ;
3469 return _res;
3470}
3471
Jack Jansen3a50f8a1996-01-11 16:17:14 +00003472static PyObject *Qd_GetFontInfo(_self, _args)
3473 PyObject *_self;
3474 PyObject *_args;
3475{
3476 PyObject *_res = NULL;
3477 FontInfo info;
3478 if (!PyArg_ParseTuple(_args, ""))
3479 return NULL;
3480 GetFontInfo(&info);
3481 _res = Py_BuildValue("O&",
3482 QdFI_New, &info);
3483 return _res;
3484}
3485
Jack Jansenb81cf9d1995-06-06 13:08:40 +00003486static PyObject *Qd_CharExtra(_self, _args)
3487 PyObject *_self;
3488 PyObject *_args;
3489{
3490 PyObject *_res = NULL;
Jack Jansen330381c1995-11-15 15:18:01 +00003491 Fixed extra;
3492 if (!PyArg_ParseTuple(_args, "O&",
3493 PyMac_GetFixed, &extra))
Jack Jansenb81cf9d1995-06-06 13:08:40 +00003494 return NULL;
3495 CharExtra(extra);
3496 Py_INCREF(Py_None);
3497 _res = Py_None;
3498 return _res;
3499}
3500
Jack Jansen41058c01995-11-16 22:48:29 +00003501static PyObject *Qd_BitMap(_self, _args)
3502 PyObject *_self;
3503 PyObject *_args;
3504{
3505 PyObject *_res = NULL;
3506
3507 BitMap *ptr;
3508 PyObject *source;
3509 Rect bounds;
3510 int rowbytes;
3511 char *data;
3512
3513 if ( !PyArg_ParseTuple(_args, "O!iO&", &PyString_Type, &source, &rowbytes, PyMac_GetRect,
3514 &bounds) )
3515 return NULL;
3516 data = PyString_AsString(source);
3517 if ((ptr=(BitMap *)malloc(sizeof(BitMap))) == NULL )
3518 return PyErr_NoMemory();
3519 ptr->baseAddr = (Ptr)data;
3520 ptr->rowBytes = rowbytes;
3521 ptr->bounds = bounds;
3522 if ( (_res = BMObj_New(ptr)) == NULL ) {
3523 free(ptr);
3524 return NULL;
3525 }
3526 ((BitMapObject *)_res)->referred_object = source;
3527 Py_INCREF(source);
3528 ((BitMapObject *)_res)->referred_bitmap = ptr;
3529 return _res;
3530
3531}
3532
Jack Jansen425e9eb1995-12-12 15:02:03 +00003533static PyObject *Qd_RawBitMap(_self, _args)
3534 PyObject *_self;
3535 PyObject *_args;
3536{
3537 PyObject *_res = NULL;
3538
3539 BitMap *ptr;
3540 PyObject *source;
3541
3542 if ( !PyArg_ParseTuple(_args, "O!", &PyString_Type, &source) )
3543 return NULL;
3544 if ( PyString_Size(source) != sizeof(BitMap) && PyString_Size(source) != sizeof(PixMap) ) {
3545 PyErr_BadArgument();
3546 return NULL;
3547 }
3548 ptr = (BitMapPtr)PyString_AsString(source);
3549 if ( (_res = BMObj_New(ptr)) == NULL ) {
3550 return NULL;
3551 }
3552 ((BitMapObject *)_res)->referred_object = source;
3553 Py_INCREF(source);
3554 return _res;
3555
3556}
3557
Guido van Rossum17448e21995-01-30 11:53:55 +00003558static PyMethodDef Qd_methods[] = {
Guido van Rossum17448e21995-01-30 11:53:55 +00003559 {"SetPort", (PyCFunction)Qd_SetPort, 1,
Jack Jansen330381c1995-11-15 15:18:01 +00003560 "(GrafPtr port) -> None"},
Guido van Rossume56db431995-03-19 22:49:50 +00003561 {"GetPort", (PyCFunction)Qd_GetPort, 1,
Jack Jansen330381c1995-11-15 15:18:01 +00003562 "() -> (GrafPtr port)"},
Guido van Rossume56db431995-03-19 22:49:50 +00003563 {"GrafDevice", (PyCFunction)Qd_GrafDevice, 1,
3564 "(short device) -> None"},
Jack Jansen41058c01995-11-16 22:48:29 +00003565 {"SetPortBits", (PyCFunction)Qd_SetPortBits, 1,
3566 "(BitMapPtr bm) -> None"},
Guido van Rossume56db431995-03-19 22:49:50 +00003567 {"PortSize", (PyCFunction)Qd_PortSize, 1,
3568 "(short width, short height) -> None"},
3569 {"MovePortTo", (PyCFunction)Qd_MovePortTo, 1,
3570 "(short leftGlobal, short topGlobal) -> None"},
3571 {"SetOrigin", (PyCFunction)Qd_SetOrigin, 1,
3572 "(short h, short v) -> None"},
3573 {"SetClip", (PyCFunction)Qd_SetClip, 1,
3574 "(RgnHandle rgn) -> None"},
3575 {"GetClip", (PyCFunction)Qd_GetClip, 1,
3576 "(RgnHandle rgn) -> None"},
Guido van Rossum17448e21995-01-30 11:53:55 +00003577 {"ClipRect", (PyCFunction)Qd_ClipRect, 1,
3578 "(Rect r) -> None"},
Jack Jansen04a02e71996-01-06 17:12:58 +00003579 {"BackPat", (PyCFunction)Qd_BackPat, 1,
3580 "(Pattern pat) -> None"},
Guido van Rossume56db431995-03-19 22:49:50 +00003581 {"InitCursor", (PyCFunction)Qd_InitCursor, 1,
3582 "() -> None"},
Jack Jansenb5394061996-01-05 18:06:41 +00003583 {"SetCursor", (PyCFunction)Qd_SetCursor, 1,
3584 "(Cursor crsr) -> None"},
Guido van Rossume56db431995-03-19 22:49:50 +00003585 {"HideCursor", (PyCFunction)Qd_HideCursor, 1,
3586 "() -> None"},
3587 {"ShowCursor", (PyCFunction)Qd_ShowCursor, 1,
3588 "() -> None"},
3589 {"ObscureCursor", (PyCFunction)Qd_ObscureCursor, 1,
3590 "() -> None"},
3591 {"HidePen", (PyCFunction)Qd_HidePen, 1,
3592 "() -> None"},
3593 {"ShowPen", (PyCFunction)Qd_ShowPen, 1,
3594 "() -> None"},
3595 {"GetPen", (PyCFunction)Qd_GetPen, 1,
Jack Jansen1d8ede71996-01-08 23:47:31 +00003596 "() -> (Point pt)"},
Jack Jansen04a02e71996-01-06 17:12:58 +00003597 {"GetPenState", (PyCFunction)Qd_GetPenState, 1,
3598 "() -> (PenState pnState)"},
3599 {"SetPenState", (PyCFunction)Qd_SetPenState, 1,
3600 "(PenState pnState) -> None"},
Guido van Rossume56db431995-03-19 22:49:50 +00003601 {"PenSize", (PyCFunction)Qd_PenSize, 1,
3602 "(short width, short height) -> None"},
3603 {"PenMode", (PyCFunction)Qd_PenMode, 1,
3604 "(short mode) -> None"},
Jack Jansen04a02e71996-01-06 17:12:58 +00003605 {"PenPat", (PyCFunction)Qd_PenPat, 1,
3606 "(Pattern pat) -> None"},
Guido van Rossume56db431995-03-19 22:49:50 +00003607 {"PenNormal", (PyCFunction)Qd_PenNormal, 1,
3608 "() -> None"},
3609 {"MoveTo", (PyCFunction)Qd_MoveTo, 1,
3610 "(short h, short v) -> None"},
3611 {"Move", (PyCFunction)Qd_Move, 1,
3612 "(short dh, short dv) -> None"},
3613 {"LineTo", (PyCFunction)Qd_LineTo, 1,
3614 "(short h, short v) -> None"},
3615 {"Line", (PyCFunction)Qd_Line, 1,
3616 "(short dh, short dv) -> None"},
Guido van Rossume56db431995-03-19 22:49:50 +00003617 {"ForeColor", (PyCFunction)Qd_ForeColor, 1,
3618 "(long color) -> None"},
3619 {"BackColor", (PyCFunction)Qd_BackColor, 1,
3620 "(long color) -> None"},
3621 {"ColorBit", (PyCFunction)Qd_ColorBit, 1,
3622 "(short whichBit) -> None"},
3623 {"SetRect", (PyCFunction)Qd_SetRect, 1,
3624 "(short left, short top, short right, short bottom) -> (Rect r)"},
3625 {"OffsetRect", (PyCFunction)Qd_OffsetRect, 1,
Jack Jansen54c8f7e1995-11-14 10:46:01 +00003626 "(Rect r, short dh, short dv) -> (Rect r)"},
Guido van Rossume56db431995-03-19 22:49:50 +00003627 {"InsetRect", (PyCFunction)Qd_InsetRect, 1,
Jack Jansen54c8f7e1995-11-14 10:46:01 +00003628 "(Rect r, short dh, short dv) -> (Rect r)"},
Guido van Rossume56db431995-03-19 22:49:50 +00003629 {"SectRect", (PyCFunction)Qd_SectRect, 1,
3630 "(Rect src1, Rect src2) -> (Boolean _rv, Rect dstRect)"},
3631 {"UnionRect", (PyCFunction)Qd_UnionRect, 1,
3632 "(Rect src1, Rect src2) -> (Rect dstRect)"},
3633 {"EqualRect", (PyCFunction)Qd_EqualRect, 1,
3634 "(Rect rect1, Rect rect2) -> (Boolean _rv)"},
3635 {"EmptyRect", (PyCFunction)Qd_EmptyRect, 1,
3636 "(Rect r) -> (Boolean _rv)"},
3637 {"FrameRect", (PyCFunction)Qd_FrameRect, 1,
3638 "(Rect r) -> None"},
3639 {"PaintRect", (PyCFunction)Qd_PaintRect, 1,
3640 "(Rect r) -> None"},
Guido van Rossum17448e21995-01-30 11:53:55 +00003641 {"EraseRect", (PyCFunction)Qd_EraseRect, 1,
3642 "(Rect r) -> None"},
Guido van Rossume56db431995-03-19 22:49:50 +00003643 {"InvertRect", (PyCFunction)Qd_InvertRect, 1,
3644 "(Rect r) -> None"},
Jack Jansen04a02e71996-01-06 17:12:58 +00003645 {"FillRect", (PyCFunction)Qd_FillRect, 1,
3646 "(Rect r, Pattern pat) -> None"},
Guido van Rossume56db431995-03-19 22:49:50 +00003647 {"FrameOval", (PyCFunction)Qd_FrameOval, 1,
3648 "(Rect r) -> None"},
3649 {"PaintOval", (PyCFunction)Qd_PaintOval, 1,
3650 "(Rect r) -> None"},
3651 {"EraseOval", (PyCFunction)Qd_EraseOval, 1,
3652 "(Rect r) -> None"},
3653 {"InvertOval", (PyCFunction)Qd_InvertOval, 1,
3654 "(Rect r) -> None"},
Jack Jansen04a02e71996-01-06 17:12:58 +00003655 {"FillOval", (PyCFunction)Qd_FillOval, 1,
3656 "(Rect r, Pattern pat) -> None"},
Guido van Rossume56db431995-03-19 22:49:50 +00003657 {"FrameRoundRect", (PyCFunction)Qd_FrameRoundRect, 1,
3658 "(Rect r, short ovalWidth, short ovalHeight) -> None"},
3659 {"PaintRoundRect", (PyCFunction)Qd_PaintRoundRect, 1,
3660 "(Rect r, short ovalWidth, short ovalHeight) -> None"},
3661 {"EraseRoundRect", (PyCFunction)Qd_EraseRoundRect, 1,
3662 "(Rect r, short ovalWidth, short ovalHeight) -> None"},
3663 {"InvertRoundRect", (PyCFunction)Qd_InvertRoundRect, 1,
3664 "(Rect r, short ovalWidth, short ovalHeight) -> None"},
Jack Jansen04a02e71996-01-06 17:12:58 +00003665 {"FillRoundRect", (PyCFunction)Qd_FillRoundRect, 1,
3666 "(Rect r, short ovalWidth, short ovalHeight, Pattern pat) -> None"},
Guido van Rossume56db431995-03-19 22:49:50 +00003667 {"FrameArc", (PyCFunction)Qd_FrameArc, 1,
3668 "(Rect r, short startAngle, short arcAngle) -> None"},
3669 {"PaintArc", (PyCFunction)Qd_PaintArc, 1,
3670 "(Rect r, short startAngle, short arcAngle) -> None"},
3671 {"EraseArc", (PyCFunction)Qd_EraseArc, 1,
3672 "(Rect r, short startAngle, short arcAngle) -> None"},
3673 {"InvertArc", (PyCFunction)Qd_InvertArc, 1,
3674 "(Rect r, short startAngle, short arcAngle) -> None"},
Jack Jansen04a02e71996-01-06 17:12:58 +00003675 {"FillArc", (PyCFunction)Qd_FillArc, 1,
3676 "(Rect r, short startAngle, short arcAngle, Pattern pat) -> None"},
Guido van Rossume56db431995-03-19 22:49:50 +00003677 {"NewRgn", (PyCFunction)Qd_NewRgn, 1,
3678 "() -> (RgnHandle _rv)"},
3679 {"OpenRgn", (PyCFunction)Qd_OpenRgn, 1,
3680 "() -> None"},
3681 {"CloseRgn", (PyCFunction)Qd_CloseRgn, 1,
3682 "(RgnHandle dstRgn) -> None"},
Jack Jansen41058c01995-11-16 22:48:29 +00003683 {"BitMapToRegion", (PyCFunction)Qd_BitMapToRegion, 1,
3684 "(RgnHandle region, BitMapPtr bMap) -> None"},
Guido van Rossume56db431995-03-19 22:49:50 +00003685 {"DisposeRgn", (PyCFunction)Qd_DisposeRgn, 1,
3686 "(RgnHandle rgn) -> None"},
3687 {"CopyRgn", (PyCFunction)Qd_CopyRgn, 1,
3688 "(RgnHandle srcRgn, RgnHandle dstRgn) -> None"},
3689 {"SetEmptyRgn", (PyCFunction)Qd_SetEmptyRgn, 1,
3690 "(RgnHandle rgn) -> None"},
3691 {"SetRectRgn", (PyCFunction)Qd_SetRectRgn, 1,
3692 "(RgnHandle rgn, short left, short top, short right, short bottom) -> None"},
3693 {"RectRgn", (PyCFunction)Qd_RectRgn, 1,
3694 "(RgnHandle rgn, Rect r) -> None"},
3695 {"OffsetRgn", (PyCFunction)Qd_OffsetRgn, 1,
3696 "(RgnHandle rgn, short dh, short dv) -> None"},
3697 {"InsetRgn", (PyCFunction)Qd_InsetRgn, 1,
3698 "(RgnHandle rgn, short dh, short dv) -> None"},
3699 {"SectRgn", (PyCFunction)Qd_SectRgn, 1,
3700 "(RgnHandle srcRgnA, RgnHandle srcRgnB, RgnHandle dstRgn) -> None"},
3701 {"UnionRgn", (PyCFunction)Qd_UnionRgn, 1,
3702 "(RgnHandle srcRgnA, RgnHandle srcRgnB, RgnHandle dstRgn) -> None"},
3703 {"DiffRgn", (PyCFunction)Qd_DiffRgn, 1,
3704 "(RgnHandle srcRgnA, RgnHandle srcRgnB, RgnHandle dstRgn) -> None"},
3705 {"XorRgn", (PyCFunction)Qd_XorRgn, 1,
3706 "(RgnHandle srcRgnA, RgnHandle srcRgnB, RgnHandle dstRgn) -> None"},
3707 {"RectInRgn", (PyCFunction)Qd_RectInRgn, 1,
3708 "(Rect r, RgnHandle rgn) -> (Boolean _rv)"},
3709 {"EqualRgn", (PyCFunction)Qd_EqualRgn, 1,
3710 "(RgnHandle rgnA, RgnHandle rgnB) -> (Boolean _rv)"},
3711 {"EmptyRgn", (PyCFunction)Qd_EmptyRgn, 1,
3712 "(RgnHandle rgn) -> (Boolean _rv)"},
3713 {"FrameRgn", (PyCFunction)Qd_FrameRgn, 1,
3714 "(RgnHandle rgn) -> None"},
3715 {"PaintRgn", (PyCFunction)Qd_PaintRgn, 1,
3716 "(RgnHandle rgn) -> None"},
3717 {"EraseRgn", (PyCFunction)Qd_EraseRgn, 1,
3718 "(RgnHandle rgn) -> None"},
3719 {"InvertRgn", (PyCFunction)Qd_InvertRgn, 1,
3720 "(RgnHandle rgn) -> None"},
Jack Jansen04a02e71996-01-06 17:12:58 +00003721 {"FillRgn", (PyCFunction)Qd_FillRgn, 1,
3722 "(RgnHandle rgn, Pattern pat) -> None"},
Guido van Rossume56db431995-03-19 22:49:50 +00003723 {"ScrollRect", (PyCFunction)Qd_ScrollRect, 1,
3724 "(Rect r, short dh, short dv, RgnHandle updateRgn) -> None"},
Jack Jansen41058c01995-11-16 22:48:29 +00003725 {"CopyBits", (PyCFunction)Qd_CopyBits, 1,
3726 "(BitMapPtr srcBits, BitMapPtr dstBits, Rect srcRect, Rect dstRect, short mode, RgnHandle maskRgn) -> None"},
3727 {"CopyMask", (PyCFunction)Qd_CopyMask, 1,
3728 "(BitMapPtr srcBits, BitMapPtr maskBits, BitMapPtr dstBits, Rect srcRect, Rect maskRect, Rect dstRect) -> None"},
Guido van Rossume56db431995-03-19 22:49:50 +00003729 {"OpenPicture", (PyCFunction)Qd_OpenPicture, 1,
3730 "(Rect picFrame) -> (PicHandle _rv)"},
3731 {"PicComment", (PyCFunction)Qd_PicComment, 1,
3732 "(short kind, short dataSize, Handle dataHandle) -> None"},
3733 {"ClosePicture", (PyCFunction)Qd_ClosePicture, 1,
3734 "() -> None"},
3735 {"DrawPicture", (PyCFunction)Qd_DrawPicture, 1,
3736 "(PicHandle myPicture, Rect dstRect) -> None"},
3737 {"KillPicture", (PyCFunction)Qd_KillPicture, 1,
3738 "(PicHandle myPicture) -> None"},
3739 {"OpenPoly", (PyCFunction)Qd_OpenPoly, 1,
3740 "() -> (PolyHandle _rv)"},
3741 {"ClosePoly", (PyCFunction)Qd_ClosePoly, 1,
3742 "() -> None"},
3743 {"KillPoly", (PyCFunction)Qd_KillPoly, 1,
3744 "(PolyHandle poly) -> None"},
3745 {"OffsetPoly", (PyCFunction)Qd_OffsetPoly, 1,
3746 "(PolyHandle poly, short dh, short dv) -> None"},
3747 {"FramePoly", (PyCFunction)Qd_FramePoly, 1,
3748 "(PolyHandle poly) -> None"},
3749 {"PaintPoly", (PyCFunction)Qd_PaintPoly, 1,
3750 "(PolyHandle poly) -> None"},
3751 {"ErasePoly", (PyCFunction)Qd_ErasePoly, 1,
3752 "(PolyHandle poly) -> None"},
3753 {"InvertPoly", (PyCFunction)Qd_InvertPoly, 1,
3754 "(PolyHandle poly) -> None"},
Jack Jansen04a02e71996-01-06 17:12:58 +00003755 {"FillPoly", (PyCFunction)Qd_FillPoly, 1,
3756 "(PolyHandle poly, Pattern pat) -> None"},
Guido van Rossume56db431995-03-19 22:49:50 +00003757 {"SetPt", (PyCFunction)Qd_SetPt, 1,
Jack Jansen1d8ede71996-01-08 23:47:31 +00003758 "(short h, short v) -> (Point pt)"},
Guido van Rossume56db431995-03-19 22:49:50 +00003759 {"LocalToGlobal", (PyCFunction)Qd_LocalToGlobal, 1,
3760 "(Point pt) -> (Point pt)"},
3761 {"GlobalToLocal", (PyCFunction)Qd_GlobalToLocal, 1,
3762 "(Point pt) -> (Point pt)"},
3763 {"Random", (PyCFunction)Qd_Random, 1,
3764 "() -> (short _rv)"},
3765 {"GetPixel", (PyCFunction)Qd_GetPixel, 1,
3766 "(short h, short v) -> (Boolean _rv)"},
3767 {"ScalePt", (PyCFunction)Qd_ScalePt, 1,
3768 "(Point pt, Rect srcRect, Rect dstRect) -> (Point pt)"},
3769 {"MapPt", (PyCFunction)Qd_MapPt, 1,
3770 "(Point pt, Rect srcRect, Rect dstRect) -> (Point pt)"},
3771 {"MapRect", (PyCFunction)Qd_MapRect, 1,
Jack Jansen54c8f7e1995-11-14 10:46:01 +00003772 "(Rect r, Rect srcRect, Rect dstRect) -> (Rect r)"},
Guido van Rossume56db431995-03-19 22:49:50 +00003773 {"MapRgn", (PyCFunction)Qd_MapRgn, 1,
3774 "(RgnHandle rgn, Rect srcRect, Rect dstRect) -> None"},
3775 {"MapPoly", (PyCFunction)Qd_MapPoly, 1,
3776 "(PolyHandle poly, Rect srcRect, Rect dstRect) -> None"},
Jack Jansen41058c01995-11-16 22:48:29 +00003777 {"StdBits", (PyCFunction)Qd_StdBits, 1,
3778 "(BitMapPtr srcBits, Rect srcRect, Rect dstRect, short mode, RgnHandle maskRgn) -> None"},
Guido van Rossume56db431995-03-19 22:49:50 +00003779 {"AddPt", (PyCFunction)Qd_AddPt, 1,
3780 "(Point src, Point dst) -> (Point dst)"},
3781 {"EqualPt", (PyCFunction)Qd_EqualPt, 1,
3782 "(Point pt1, Point pt2) -> (Boolean _rv)"},
3783 {"PtInRect", (PyCFunction)Qd_PtInRect, 1,
3784 "(Point pt, Rect r) -> (Boolean _rv)"},
3785 {"Pt2Rect", (PyCFunction)Qd_Pt2Rect, 1,
3786 "(Point pt1, Point pt2) -> (Rect dstRect)"},
3787 {"PtToAngle", (PyCFunction)Qd_PtToAngle, 1,
3788 "(Rect r, Point pt) -> (short angle)"},
Jack Jansenb81cf9d1995-06-06 13:08:40 +00003789 {"SubPt", (PyCFunction)Qd_SubPt, 1,
3790 "(Point src, Point dst) -> (Point dst)"},
Guido van Rossume56db431995-03-19 22:49:50 +00003791 {"PtInRgn", (PyCFunction)Qd_PtInRgn, 1,
3792 "(Point pt, RgnHandle rgn) -> (Boolean _rv)"},
3793 {"NewPixMap", (PyCFunction)Qd_NewPixMap, 1,
3794 "() -> (PixMapHandle _rv)"},
Guido van Rossume56db431995-03-19 22:49:50 +00003795 {"DisposePixMap", (PyCFunction)Qd_DisposePixMap, 1,
3796 "(PixMapHandle pm) -> None"},
3797 {"CopyPixMap", (PyCFunction)Qd_CopyPixMap, 1,
3798 "(PixMapHandle srcPM, PixMapHandle dstPM) -> None"},
3799 {"NewPixPat", (PyCFunction)Qd_NewPixPat, 1,
3800 "() -> (PixPatHandle _rv)"},
Guido van Rossume56db431995-03-19 22:49:50 +00003801 {"DisposePixPat", (PyCFunction)Qd_DisposePixPat, 1,
3802 "(PixPatHandle pp) -> None"},
3803 {"CopyPixPat", (PyCFunction)Qd_CopyPixPat, 1,
3804 "(PixPatHandle srcPP, PixPatHandle dstPP) -> None"},
3805 {"PenPixPat", (PyCFunction)Qd_PenPixPat, 1,
3806 "(PixPatHandle pp) -> None"},
3807 {"BackPixPat", (PyCFunction)Qd_BackPixPat, 1,
3808 "(PixPatHandle pp) -> None"},
3809 {"GetPixPat", (PyCFunction)Qd_GetPixPat, 1,
3810 "(short patID) -> (PixPatHandle _rv)"},
Jack Jansen232f3cd1995-12-09 14:04:31 +00003811 {"MakeRGBPat", (PyCFunction)Qd_MakeRGBPat, 1,
3812 "(PixPatHandle pp, RGBColor myColor) -> None"},
Guido van Rossume56db431995-03-19 22:49:50 +00003813 {"FillCRect", (PyCFunction)Qd_FillCRect, 1,
3814 "(Rect r, PixPatHandle pp) -> None"},
3815 {"FillCOval", (PyCFunction)Qd_FillCOval, 1,
3816 "(Rect r, PixPatHandle pp) -> None"},
3817 {"FillCRoundRect", (PyCFunction)Qd_FillCRoundRect, 1,
3818 "(Rect r, short ovalWidth, short ovalHeight, PixPatHandle pp) -> None"},
3819 {"FillCArc", (PyCFunction)Qd_FillCArc, 1,
3820 "(Rect r, short startAngle, short arcAngle, PixPatHandle pp) -> None"},
3821 {"FillCRgn", (PyCFunction)Qd_FillCRgn, 1,
3822 "(RgnHandle rgn, PixPatHandle pp) -> None"},
3823 {"FillCPoly", (PyCFunction)Qd_FillCPoly, 1,
3824 "(PolyHandle poly, PixPatHandle pp) -> None"},
Jack Jansen232f3cd1995-12-09 14:04:31 +00003825 {"RGBForeColor", (PyCFunction)Qd_RGBForeColor, 1,
3826 "(RGBColor color) -> None"},
3827 {"RGBBackColor", (PyCFunction)Qd_RGBBackColor, 1,
3828 "(RGBColor color) -> None"},
3829 {"SetCPixel", (PyCFunction)Qd_SetCPixel, 1,
3830 "(short h, short v, RGBColor cPix) -> None"},
Guido van Rossume56db431995-03-19 22:49:50 +00003831 {"SetPortPix", (PyCFunction)Qd_SetPortPix, 1,
3832 "(PixMapHandle pm) -> None"},
Jack Jansen232f3cd1995-12-09 14:04:31 +00003833 {"GetCPixel", (PyCFunction)Qd_GetCPixel, 1,
3834 "(short h, short v) -> (RGBColor cPix)"},
3835 {"GetForeColor", (PyCFunction)Qd_GetForeColor, 1,
3836 "() -> (RGBColor color)"},
3837 {"GetBackColor", (PyCFunction)Qd_GetBackColor, 1,
3838 "() -> (RGBColor color)"},
3839 {"OpColor", (PyCFunction)Qd_OpColor, 1,
3840 "(RGBColor color) -> None"},
3841 {"HiliteColor", (PyCFunction)Qd_HiliteColor, 1,
3842 "(RGBColor color) -> None"},
Guido van Rossume56db431995-03-19 22:49:50 +00003843 {"AllocCursor", (PyCFunction)Qd_AllocCursor, 1,
3844 "() -> None"},
Guido van Rossume56db431995-03-19 22:49:50 +00003845 {"GetCTSeed", (PyCFunction)Qd_GetCTSeed, 1,
3846 "() -> (long _rv)"},
Jack Jansen232f3cd1995-12-09 14:04:31 +00003847 {"Color2Index", (PyCFunction)Qd_Color2Index, 1,
3848 "(RGBColor myColor) -> (long _rv)"},
3849 {"Index2Color", (PyCFunction)Qd_Index2Color, 1,
3850 "(long index) -> (RGBColor aColor)"},
3851 {"InvertColor", (PyCFunction)Qd_InvertColor, 1,
3852 "() -> (RGBColor myColor)"},
3853 {"RealColor", (PyCFunction)Qd_RealColor, 1,
3854 "(RGBColor color) -> (Boolean _rv)"},
Guido van Rossume56db431995-03-19 22:49:50 +00003855 {"SetClientID", (PyCFunction)Qd_SetClientID, 1,
3856 "(short id) -> None"},
3857 {"ProtectEntry", (PyCFunction)Qd_ProtectEntry, 1,
3858 "(short index, Boolean protect) -> None"},
3859 {"ReserveEntry", (PyCFunction)Qd_ReserveEntry, 1,
3860 "(short index, Boolean reserve) -> None"},
3861 {"QDError", (PyCFunction)Qd_QDError, 1,
3862 "() -> (short _rv)"},
Jack Jansen41058c01995-11-16 22:48:29 +00003863 {"CopyDeepMask", (PyCFunction)Qd_CopyDeepMask, 1,
3864 "(BitMapPtr srcBits, BitMapPtr maskBits, BitMapPtr dstBits, Rect srcRect, Rect maskRect, Rect dstRect, short mode, RgnHandle maskRgn) -> None"},
Jack Jansen54c8f7e1995-11-14 10:46:01 +00003865 {"GetPattern", (PyCFunction)Qd_GetPattern, 1,
3866 "(short patternID) -> (PatHandle _rv)"},
3867 {"GetCursor", (PyCFunction)Qd_GetCursor, 1,
3868 "(short cursorID) -> (CursHandle _rv)"},
3869 {"GetPicture", (PyCFunction)Qd_GetPicture, 1,
3870 "(short pictureID) -> (PicHandle _rv)"},
3871 {"DeltaPoint", (PyCFunction)Qd_DeltaPoint, 1,
3872 "(Point ptA, Point ptB) -> (long _rv)"},
3873 {"ShieldCursor", (PyCFunction)Qd_ShieldCursor, 1,
3874 "(Rect shieldRect, Point offsetPt) -> None"},
3875 {"ScreenRes", (PyCFunction)Qd_ScreenRes, 1,
3876 "() -> (short scrnHRes, short scrnVRes)"},
Jack Jansen04a02e71996-01-06 17:12:58 +00003877 {"GetIndPattern", (PyCFunction)Qd_GetIndPattern, 1,
3878 "(short patternListID, short index) -> (Pattern thePat)"},
Jack Jansenb81cf9d1995-06-06 13:08:40 +00003879 {"TextFont", (PyCFunction)Qd_TextFont, 1,
3880 "(short font) -> None"},
3881 {"TextFace", (PyCFunction)Qd_TextFace, 1,
3882 "(short face) -> None"},
3883 {"TextMode", (PyCFunction)Qd_TextMode, 1,
3884 "(short mode) -> None"},
3885 {"TextSize", (PyCFunction)Qd_TextSize, 1,
3886 "(short size) -> None"},
3887 {"SpaceExtra", (PyCFunction)Qd_SpaceExtra, 1,
Jack Jansen330381c1995-11-15 15:18:01 +00003888 "(Fixed extra) -> None"},
Jack Jansenb81cf9d1995-06-06 13:08:40 +00003889 {"DrawChar", (PyCFunction)Qd_DrawChar, 1,
3890 "(short ch) -> None"},
3891 {"DrawString", (PyCFunction)Qd_DrawString, 1,
3892 "(Str255 s) -> None"},
3893 {"DrawText", (PyCFunction)Qd_DrawText, 1,
3894 "(Buffer textBuf, short firstByte, short byteCount) -> None"},
3895 {"CharWidth", (PyCFunction)Qd_CharWidth, 1,
3896 "(short ch) -> (short _rv)"},
3897 {"StringWidth", (PyCFunction)Qd_StringWidth, 1,
3898 "(Str255 s) -> (short _rv)"},
3899 {"TextWidth", (PyCFunction)Qd_TextWidth, 1,
3900 "(Buffer textBuf, short firstByte, short byteCount) -> (short _rv)"},
Jack Jansen3a50f8a1996-01-11 16:17:14 +00003901 {"GetFontInfo", (PyCFunction)Qd_GetFontInfo, 1,
3902 "() -> (FontInfo info)"},
Jack Jansenb81cf9d1995-06-06 13:08:40 +00003903 {"CharExtra", (PyCFunction)Qd_CharExtra, 1,
Jack Jansen330381c1995-11-15 15:18:01 +00003904 "(Fixed extra) -> None"},
Jack Jansen41058c01995-11-16 22:48:29 +00003905 {"BitMap", (PyCFunction)Qd_BitMap, 1,
3906 "Take (string, int, Rect) argument and create BitMap"},
Jack Jansen425e9eb1995-12-12 15:02:03 +00003907 {"RawBitMap", (PyCFunction)Qd_RawBitMap, 1,
3908 "Take string BitMap and turn into BitMap object"},
Guido van Rossum17448e21995-01-30 11:53:55 +00003909 {NULL, NULL, 0}
3910};
3911
3912
3913
3914
3915void initQd()
3916{
3917 PyObject *m;
3918 PyObject *d;
3919
3920
3921
3922
3923 m = Py_InitModule("Qd", Qd_methods);
3924 d = PyModule_GetDict(m);
3925 Qd_Error = PyMac_GetOSErrException();
3926 if (Qd_Error == NULL ||
3927 PyDict_SetItemString(d, "Error", Qd_Error) != 0)
3928 Py_FatalError("can't initialize Qd.Error");
Jack Jansenb5394061996-01-05 18:06:41 +00003929
3930 {
3931 PyObject *o;
Jack Jansenbdd07471996-01-29 15:44:03 +00003932
3933 o = QDGA_New();
3934 if (o == NULL || PyDict_SetItemString(d, "qd", o) != 0)
3935 Py_FatalError("can't initialize Qd.qd");
Jack Jansenb5394061996-01-05 18:06:41 +00003936 }
3937
3938
Guido van Rossum17448e21995-01-30 11:53:55 +00003939}
3940
3941/* ========================= End module Qd ========================== */
3942