blob: b6ac737c496ac34d874a3567a0119983548015db [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);
Jack Jansend4c26461995-08-17 14:35:56 +000017extern PyObject *ResObj_OptNew(Handle);
Guido van Rossum17448e21995-01-30 11:53:55 +000018extern int ResObj_Convert(PyObject *, Handle *);
19
20extern PyObject *WinObj_New(WindowPtr);
21extern int WinObj_Convert(PyObject *, WindowPtr *);
Jack Jansen330381c1995-11-15 15:18:01 +000022extern PyTypeObject Window_Type;
23#define WinObj_Check(x) ((x)->ob_type == &Window_Type)
Guido van Rossum17448e21995-01-30 11:53:55 +000024
25extern PyObject *DlgObj_New(DialogPtr);
26extern int DlgObj_Convert(PyObject *, DialogPtr *);
27extern PyTypeObject Dialog_Type;
28#define DlgObj_Check(x) ((x)->ob_type == &Dialog_Type)
29
30extern PyObject *MenuObj_New(MenuHandle);
31extern int MenuObj_Convert(PyObject *, MenuHandle *);
32
33extern PyObject *CtlObj_New(ControlHandle);
34extern int CtlObj_Convert(PyObject *, ControlHandle *);
35
Jack Jansen330381c1995-11-15 15:18:01 +000036extern PyObject *GrafObj_New(GrafPtr);
37extern int GrafObj_Convert(PyObject *, GrafPtr *);
38
Jack Jansen41058c01995-11-16 22:48:29 +000039extern PyObject *BMObj_New(BitMapPtr);
40extern int BMObj_Convert(PyObject *, BitMapPtr *);
41
Guido van Rossum17448e21995-01-30 11:53:55 +000042extern PyObject *WinObj_WhichWindow(WindowPtr);
43
44#include <QuickDraw.h>
45#include <Desk.h>
46
47#define resNotFound -192 /* Can't include <Errors.h> because of Python's "errors.h" */
48
49static PyObject *Qd_Error;
50
Jack Jansen330381c1995-11-15 15:18:01 +000051/* ---------------------- Object type GrafPort ---------------------- */
52
53PyTypeObject GrafPort_Type;
54
55#define GrafObj_Check(x) ((x)->ob_type == &GrafPort_Type)
56
57typedef struct GrafPortObject {
58 PyObject_HEAD
59 GrafPtr ob_itself;
60} GrafPortObject;
61
62PyObject *GrafObj_New(itself)
63 GrafPtr itself;
Guido van Rossum17448e21995-01-30 11:53:55 +000064{
Jack Jansen330381c1995-11-15 15:18:01 +000065 GrafPortObject *it;
66 if (itself == NULL) return PyMac_Error(resNotFound);
67 it = PyObject_NEW(GrafPortObject, &GrafPort_Type);
68 if (it == NULL) return NULL;
69 it->ob_itself = itself;
70 return (PyObject *)it;
71}
72GrafObj_Convert(v, p_itself)
73 PyObject *v;
74 GrafPtr *p_itself;
75{
76 if (DlgObj_Check(v) || WinObj_Check(v)) {
77 *p_itself = ((GrafPortObject *)v)->ob_itself;
78 return 1;
79 }
80 if (!GrafObj_Check(v))
81 {
82 PyErr_SetString(PyExc_TypeError, "GrafPort required");
83 return 0;
84 }
85 *p_itself = ((GrafPortObject *)v)->ob_itself;
86 return 1;
Guido van Rossum17448e21995-01-30 11:53:55 +000087}
88
Jack Jansen330381c1995-11-15 15:18:01 +000089static void GrafObj_dealloc(self)
90 GrafPortObject *self;
Guido van Rossum17448e21995-01-30 11:53:55 +000091{
Jack Jansen330381c1995-11-15 15:18:01 +000092 /* Cleanup of self->ob_itself goes here */
93 PyMem_DEL(self);
Guido van Rossume56db431995-03-19 22:49:50 +000094}
95
Jack Jansen330381c1995-11-15 15:18:01 +000096static PyMethodDef GrafObj_methods[] = {
97 {NULL, NULL, 0}
98};
99
100PyMethodChain GrafObj_chain = { GrafObj_methods, NULL };
101
102static PyObject *GrafObj_getattr(self, name)
103 GrafPortObject *self;
104 char *name;
Guido van Rossume56db431995-03-19 22:49:50 +0000105{
Jack Jansen330381c1995-11-15 15:18:01 +0000106 if ( strcmp(name, "device") == 0 )
107 return PyInt_FromLong((long)self->ob_itself->device);
Jack Jansen41058c01995-11-16 22:48:29 +0000108 if ( strcmp(name, "portBits") == 0 )
109 return BMObj_New(&self->ob_itself->portBits);
Jack Jansen330381c1995-11-15 15:18:01 +0000110 if ( strcmp(name, "portRect") == 0 )
111 return Py_BuildValue("O&", PyMac_BuildRect, &self->ob_itself->portRect);
112 /* XXXX Add more, as needed */
113
114 return Py_FindMethodInChain(&GrafObj_chain, (PyObject *)self, name);
Guido van Rossum17448e21995-01-30 11:53:55 +0000115}
116
Jack Jansen330381c1995-11-15 15:18:01 +0000117#define GrafObj_setattr NULL
118
119PyTypeObject GrafPort_Type = {
120 PyObject_HEAD_INIT(&PyType_Type)
121 0, /*ob_size*/
122 "GrafPort", /*tp_name*/
123 sizeof(GrafPortObject), /*tp_basicsize*/
124 0, /*tp_itemsize*/
125 /* methods */
126 (destructor) GrafObj_dealloc, /*tp_dealloc*/
127 0, /*tp_print*/
128 (getattrfunc) GrafObj_getattr, /*tp_getattr*/
129 (setattrfunc) GrafObj_setattr, /*tp_setattr*/
130};
131
132/* -------------------- End object type GrafPort -------------------- */
133
134
Jack Jansen41058c01995-11-16 22:48:29 +0000135/* ----------------------- Object type BitMap ----------------------- */
136
137PyTypeObject BitMap_Type;
138
139#define BMObj_Check(x) ((x)->ob_type == &BitMap_Type)
140
141typedef struct BitMapObject {
142 PyObject_HEAD
143 BitMapPtr ob_itself;
144 PyObject *referred_object;
145 BitMap *referred_bitmap;
146} BitMapObject;
147
148PyObject *BMObj_New(itself)
149 BitMapPtr itself;
150{
151 BitMapObject *it;
152 if (itself == NULL) return PyMac_Error(resNotFound);
153 it = PyObject_NEW(BitMapObject, &BitMap_Type);
154 if (it == NULL) return NULL;
155 it->ob_itself = itself;
156 it->referred_object = NULL;
157 it->referred_bitmap = NULL;
158 return (PyObject *)it;
159}
160BMObj_Convert(v, p_itself)
161 PyObject *v;
162 BitMapPtr *p_itself;
163{
164 if (!BMObj_Check(v))
165 {
166 PyErr_SetString(PyExc_TypeError, "BitMap required");
167 return 0;
168 }
169 *p_itself = ((BitMapObject *)v)->ob_itself;
170 return 1;
171}
172
173static void BMObj_dealloc(self)
174 BitMapObject *self;
175{
176 Py_XDECREF(self->referred_object);
177 if (self->referred_bitmap) free(self->referred_bitmap);
178 PyMem_DEL(self);
179}
180
181static PyMethodDef BMObj_methods[] = {
182 {NULL, NULL, 0}
183};
184
185PyMethodChain BMObj_chain = { BMObj_methods, NULL };
186
187static PyObject *BMObj_getattr(self, name)
188 BitMapObject *self;
189 char *name;
190{
191 if ( strcmp(name, "baseAddr") == 0 )
192 return PyInt_FromLong((long)self->ob_itself->baseAddr);
193 if ( strcmp(name, "rowBytes") == 0 )
194 return PyInt_FromLong((long)self->ob_itself->rowBytes);
195 if ( strcmp(name, "bounds") == 0 )
196 return Py_BuildValue("O&", PyMac_BuildRect, &self->ob_itself->bounds);
197 /* XXXX Add more, as needed */
198
199 return Py_FindMethodInChain(&BMObj_chain, (PyObject *)self, name);
200}
201
202#define BMObj_setattr NULL
203
204PyTypeObject BitMap_Type = {
205 PyObject_HEAD_INIT(&PyType_Type)
206 0, /*ob_size*/
207 "BitMap", /*tp_name*/
208 sizeof(BitMapObject), /*tp_basicsize*/
209 0, /*tp_itemsize*/
210 /* methods */
211 (destructor) BMObj_dealloc, /*tp_dealloc*/
212 0, /*tp_print*/
213 (getattrfunc) BMObj_getattr, /*tp_getattr*/
214 (setattrfunc) BMObj_setattr, /*tp_setattr*/
215};
216
217/* --------------------- End object type BitMap --------------------- */
218
219
Guido van Rossum17448e21995-01-30 11:53:55 +0000220static PyObject *Qd_SetPort(_self, _args)
221 PyObject *_self;
222 PyObject *_args;
223{
224 PyObject *_res = NULL;
Jack Jansen330381c1995-11-15 15:18:01 +0000225 GrafPtr port;
Guido van Rossum17448e21995-01-30 11:53:55 +0000226 if (!PyArg_ParseTuple(_args, "O&",
Jack Jansen330381c1995-11-15 15:18:01 +0000227 GrafObj_Convert, &port))
Guido van Rossum17448e21995-01-30 11:53:55 +0000228 return NULL;
Guido van Rossume56db431995-03-19 22:49:50 +0000229 SetPort(port);
230 Py_INCREF(Py_None);
231 _res = Py_None;
232 return _res;
233}
234
235static PyObject *Qd_GetPort(_self, _args)
236 PyObject *_self;
237 PyObject *_args;
238{
239 PyObject *_res = NULL;
Jack Jansen330381c1995-11-15 15:18:01 +0000240 GrafPtr port;
Guido van Rossume56db431995-03-19 22:49:50 +0000241 if (!PyArg_ParseTuple(_args, ""))
242 return NULL;
243 GetPort(&port);
244 _res = Py_BuildValue("O&",
Jack Jansen330381c1995-11-15 15:18:01 +0000245 GrafObj_New, port);
Guido van Rossume56db431995-03-19 22:49:50 +0000246 return _res;
247}
248
249static PyObject *Qd_GrafDevice(_self, _args)
250 PyObject *_self;
251 PyObject *_args;
252{
253 PyObject *_res = NULL;
254 short device;
255 if (!PyArg_ParseTuple(_args, "h",
256 &device))
257 return NULL;
258 GrafDevice(device);
259 Py_INCREF(Py_None);
260 _res = Py_None;
261 return _res;
262}
263
Jack Jansen41058c01995-11-16 22:48:29 +0000264static PyObject *Qd_SetPortBits(_self, _args)
265 PyObject *_self;
266 PyObject *_args;
267{
268 PyObject *_res = NULL;
269 BitMapPtr bm;
270 if (!PyArg_ParseTuple(_args, "O&",
271 BMObj_Convert, &bm))
272 return NULL;
273 SetPortBits(bm);
274 Py_INCREF(Py_None);
275 _res = Py_None;
276 return _res;
277}
278
Guido van Rossume56db431995-03-19 22:49:50 +0000279static PyObject *Qd_PortSize(_self, _args)
280 PyObject *_self;
281 PyObject *_args;
282{
283 PyObject *_res = NULL;
284 short width;
285 short height;
286 if (!PyArg_ParseTuple(_args, "hh",
287 &width,
288 &height))
289 return NULL;
290 PortSize(width,
291 height);
292 Py_INCREF(Py_None);
293 _res = Py_None;
294 return _res;
295}
296
297static PyObject *Qd_MovePortTo(_self, _args)
298 PyObject *_self;
299 PyObject *_args;
300{
301 PyObject *_res = NULL;
302 short leftGlobal;
303 short topGlobal;
304 if (!PyArg_ParseTuple(_args, "hh",
305 &leftGlobal,
306 &topGlobal))
307 return NULL;
308 MovePortTo(leftGlobal,
309 topGlobal);
310 Py_INCREF(Py_None);
311 _res = Py_None;
312 return _res;
313}
314
315static PyObject *Qd_SetOrigin(_self, _args)
316 PyObject *_self;
317 PyObject *_args;
318{
319 PyObject *_res = NULL;
320 short h;
321 short v;
322 if (!PyArg_ParseTuple(_args, "hh",
323 &h,
324 &v))
325 return NULL;
326 SetOrigin(h,
327 v);
328 Py_INCREF(Py_None);
329 _res = Py_None;
330 return _res;
331}
332
333static PyObject *Qd_SetClip(_self, _args)
334 PyObject *_self;
335 PyObject *_args;
336{
337 PyObject *_res = NULL;
338 RgnHandle rgn;
339 if (!PyArg_ParseTuple(_args, "O&",
340 ResObj_Convert, &rgn))
341 return NULL;
342 SetClip(rgn);
343 Py_INCREF(Py_None);
344 _res = Py_None;
345 return _res;
346}
347
348static PyObject *Qd_GetClip(_self, _args)
349 PyObject *_self;
350 PyObject *_args;
351{
352 PyObject *_res = NULL;
353 RgnHandle rgn;
354 if (!PyArg_ParseTuple(_args, "O&",
355 ResObj_Convert, &rgn))
356 return NULL;
357 GetClip(rgn);
Guido van Rossum17448e21995-01-30 11:53:55 +0000358 Py_INCREF(Py_None);
359 _res = Py_None;
360 return _res;
361}
362
363static PyObject *Qd_ClipRect(_self, _args)
364 PyObject *_self;
365 PyObject *_args;
366{
367 PyObject *_res = NULL;
368 Rect r;
369 if (!PyArg_ParseTuple(_args, "O&",
370 PyMac_GetRect, &r))
371 return NULL;
372 ClipRect(&r);
373 Py_INCREF(Py_None);
374 _res = Py_None;
375 return _res;
376}
377
Guido van Rossume56db431995-03-19 22:49:50 +0000378static PyObject *Qd_InitCursor(_self, _args)
379 PyObject *_self;
380 PyObject *_args;
381{
382 PyObject *_res = NULL;
383 if (!PyArg_ParseTuple(_args, ""))
384 return NULL;
385 InitCursor();
386 Py_INCREF(Py_None);
387 _res = Py_None;
388 return _res;
389}
390
391static PyObject *Qd_HideCursor(_self, _args)
392 PyObject *_self;
393 PyObject *_args;
394{
395 PyObject *_res = NULL;
396 if (!PyArg_ParseTuple(_args, ""))
397 return NULL;
398 HideCursor();
399 Py_INCREF(Py_None);
400 _res = Py_None;
401 return _res;
402}
403
404static PyObject *Qd_ShowCursor(_self, _args)
405 PyObject *_self;
406 PyObject *_args;
407{
408 PyObject *_res = NULL;
409 if (!PyArg_ParseTuple(_args, ""))
410 return NULL;
411 ShowCursor();
412 Py_INCREF(Py_None);
413 _res = Py_None;
414 return _res;
415}
416
417static PyObject *Qd_ObscureCursor(_self, _args)
418 PyObject *_self;
419 PyObject *_args;
420{
421 PyObject *_res = NULL;
422 if (!PyArg_ParseTuple(_args, ""))
423 return NULL;
424 ObscureCursor();
425 Py_INCREF(Py_None);
426 _res = Py_None;
427 return _res;
428}
429
430static PyObject *Qd_HidePen(_self, _args)
431 PyObject *_self;
432 PyObject *_args;
433{
434 PyObject *_res = NULL;
435 if (!PyArg_ParseTuple(_args, ""))
436 return NULL;
437 HidePen();
438 Py_INCREF(Py_None);
439 _res = Py_None;
440 return _res;
441}
442
443static PyObject *Qd_ShowPen(_self, _args)
444 PyObject *_self;
445 PyObject *_args;
446{
447 PyObject *_res = NULL;
448 if (!PyArg_ParseTuple(_args, ""))
449 return NULL;
450 ShowPen();
451 Py_INCREF(Py_None);
452 _res = Py_None;
453 return _res;
454}
455
456static PyObject *Qd_GetPen(_self, _args)
457 PyObject *_self;
458 PyObject *_args;
459{
460 PyObject *_res = NULL;
461 Point pt;
462 if (!PyArg_ParseTuple(_args, "O&",
463 PyMac_GetPoint, &pt))
464 return NULL;
465 GetPen(&pt);
466 _res = Py_BuildValue("O&",
467 PyMac_BuildPoint, pt);
468 return _res;
469}
470
471static PyObject *Qd_PenSize(_self, _args)
472 PyObject *_self;
473 PyObject *_args;
474{
475 PyObject *_res = NULL;
476 short width;
477 short height;
478 if (!PyArg_ParseTuple(_args, "hh",
479 &width,
480 &height))
481 return NULL;
482 PenSize(width,
483 height);
484 Py_INCREF(Py_None);
485 _res = Py_None;
486 return _res;
487}
488
489static PyObject *Qd_PenMode(_self, _args)
490 PyObject *_self;
491 PyObject *_args;
492{
493 PyObject *_res = NULL;
494 short mode;
495 if (!PyArg_ParseTuple(_args, "h",
496 &mode))
497 return NULL;
498 PenMode(mode);
499 Py_INCREF(Py_None);
500 _res = Py_None;
501 return _res;
502}
503
504static PyObject *Qd_PenNormal(_self, _args)
505 PyObject *_self;
506 PyObject *_args;
507{
508 PyObject *_res = NULL;
509 if (!PyArg_ParseTuple(_args, ""))
510 return NULL;
511 PenNormal();
512 Py_INCREF(Py_None);
513 _res = Py_None;
514 return _res;
515}
516
517static PyObject *Qd_MoveTo(_self, _args)
518 PyObject *_self;
519 PyObject *_args;
520{
521 PyObject *_res = NULL;
522 short h;
523 short v;
524 if (!PyArg_ParseTuple(_args, "hh",
525 &h,
526 &v))
527 return NULL;
528 MoveTo(h,
529 v);
530 Py_INCREF(Py_None);
531 _res = Py_None;
532 return _res;
533}
534
535static PyObject *Qd_Move(_self, _args)
536 PyObject *_self;
537 PyObject *_args;
538{
539 PyObject *_res = NULL;
540 short dh;
541 short dv;
542 if (!PyArg_ParseTuple(_args, "hh",
543 &dh,
544 &dv))
545 return NULL;
546 Move(dh,
547 dv);
548 Py_INCREF(Py_None);
549 _res = Py_None;
550 return _res;
551}
552
553static PyObject *Qd_LineTo(_self, _args)
554 PyObject *_self;
555 PyObject *_args;
556{
557 PyObject *_res = NULL;
558 short h;
559 short v;
560 if (!PyArg_ParseTuple(_args, "hh",
561 &h,
562 &v))
563 return NULL;
564 LineTo(h,
565 v);
566 Py_INCREF(Py_None);
567 _res = Py_None;
568 return _res;
569}
570
571static PyObject *Qd_Line(_self, _args)
572 PyObject *_self;
573 PyObject *_args;
574{
575 PyObject *_res = NULL;
576 short dh;
577 short dv;
578 if (!PyArg_ParseTuple(_args, "hh",
579 &dh,
580 &dv))
581 return NULL;
582 Line(dh,
583 dv);
584 Py_INCREF(Py_None);
585 _res = Py_None;
586 return _res;
587}
588
Guido van Rossume56db431995-03-19 22:49:50 +0000589static PyObject *Qd_ForeColor(_self, _args)
590 PyObject *_self;
591 PyObject *_args;
592{
593 PyObject *_res = NULL;
594 long color;
595 if (!PyArg_ParseTuple(_args, "l",
596 &color))
597 return NULL;
598 ForeColor(color);
599 Py_INCREF(Py_None);
600 _res = Py_None;
601 return _res;
602}
603
604static PyObject *Qd_BackColor(_self, _args)
605 PyObject *_self;
606 PyObject *_args;
607{
608 PyObject *_res = NULL;
609 long color;
610 if (!PyArg_ParseTuple(_args, "l",
611 &color))
612 return NULL;
613 BackColor(color);
614 Py_INCREF(Py_None);
615 _res = Py_None;
616 return _res;
617}
618
619static PyObject *Qd_ColorBit(_self, _args)
620 PyObject *_self;
621 PyObject *_args;
622{
623 PyObject *_res = NULL;
624 short whichBit;
625 if (!PyArg_ParseTuple(_args, "h",
626 &whichBit))
627 return NULL;
628 ColorBit(whichBit);
629 Py_INCREF(Py_None);
630 _res = Py_None;
631 return _res;
632}
633
634static PyObject *Qd_SetRect(_self, _args)
635 PyObject *_self;
636 PyObject *_args;
637{
638 PyObject *_res = NULL;
639 Rect r;
640 short left;
641 short top;
642 short right;
643 short bottom;
644 if (!PyArg_ParseTuple(_args, "hhhh",
645 &left,
646 &top,
647 &right,
648 &bottom))
649 return NULL;
650 SetRect(&r,
651 left,
652 top,
653 right,
654 bottom);
655 _res = Py_BuildValue("O&",
656 PyMac_BuildRect, &r);
657 return _res;
658}
659
660static PyObject *Qd_OffsetRect(_self, _args)
661 PyObject *_self;
662 PyObject *_args;
663{
664 PyObject *_res = NULL;
665 Rect r;
666 short dh;
667 short dv;
Jack Jansen54c8f7e1995-11-14 10:46:01 +0000668 if (!PyArg_ParseTuple(_args, "O&hh",
669 PyMac_GetRect, &r,
Guido van Rossume56db431995-03-19 22:49:50 +0000670 &dh,
671 &dv))
672 return NULL;
673 OffsetRect(&r,
674 dh,
675 dv);
676 _res = Py_BuildValue("O&",
677 PyMac_BuildRect, &r);
678 return _res;
679}
680
681static PyObject *Qd_InsetRect(_self, _args)
682 PyObject *_self;
683 PyObject *_args;
684{
685 PyObject *_res = NULL;
686 Rect r;
687 short dh;
688 short dv;
Jack Jansen54c8f7e1995-11-14 10:46:01 +0000689 if (!PyArg_ParseTuple(_args, "O&hh",
690 PyMac_GetRect, &r,
Guido van Rossume56db431995-03-19 22:49:50 +0000691 &dh,
692 &dv))
693 return NULL;
694 InsetRect(&r,
695 dh,
696 dv);
697 _res = Py_BuildValue("O&",
698 PyMac_BuildRect, &r);
699 return _res;
700}
701
702static PyObject *Qd_SectRect(_self, _args)
703 PyObject *_self;
704 PyObject *_args;
705{
706 PyObject *_res = NULL;
707 Boolean _rv;
708 Rect src1;
709 Rect src2;
710 Rect dstRect;
711 if (!PyArg_ParseTuple(_args, "O&O&",
712 PyMac_GetRect, &src1,
713 PyMac_GetRect, &src2))
714 return NULL;
715 _rv = SectRect(&src1,
716 &src2,
717 &dstRect);
718 _res = Py_BuildValue("bO&",
719 _rv,
720 PyMac_BuildRect, &dstRect);
721 return _res;
722}
723
724static PyObject *Qd_UnionRect(_self, _args)
725 PyObject *_self;
726 PyObject *_args;
727{
728 PyObject *_res = NULL;
729 Rect src1;
730 Rect src2;
731 Rect dstRect;
732 if (!PyArg_ParseTuple(_args, "O&O&",
733 PyMac_GetRect, &src1,
734 PyMac_GetRect, &src2))
735 return NULL;
736 UnionRect(&src1,
737 &src2,
738 &dstRect);
739 _res = Py_BuildValue("O&",
740 PyMac_BuildRect, &dstRect);
741 return _res;
742}
743
744static PyObject *Qd_EqualRect(_self, _args)
745 PyObject *_self;
746 PyObject *_args;
747{
748 PyObject *_res = NULL;
749 Boolean _rv;
750 Rect rect1;
751 Rect rect2;
752 if (!PyArg_ParseTuple(_args, "O&O&",
753 PyMac_GetRect, &rect1,
754 PyMac_GetRect, &rect2))
755 return NULL;
756 _rv = EqualRect(&rect1,
757 &rect2);
758 _res = Py_BuildValue("b",
759 _rv);
760 return _res;
761}
762
763static PyObject *Qd_EmptyRect(_self, _args)
764 PyObject *_self;
765 PyObject *_args;
766{
767 PyObject *_res = NULL;
768 Boolean _rv;
769 Rect r;
770 if (!PyArg_ParseTuple(_args, "O&",
771 PyMac_GetRect, &r))
772 return NULL;
773 _rv = EmptyRect(&r);
774 _res = Py_BuildValue("b",
775 _rv);
776 return _res;
777}
778
779static PyObject *Qd_FrameRect(_self, _args)
780 PyObject *_self;
781 PyObject *_args;
782{
783 PyObject *_res = NULL;
784 Rect r;
785 if (!PyArg_ParseTuple(_args, "O&",
786 PyMac_GetRect, &r))
787 return NULL;
788 FrameRect(&r);
789 Py_INCREF(Py_None);
790 _res = Py_None;
791 return _res;
792}
793
794static PyObject *Qd_PaintRect(_self, _args)
795 PyObject *_self;
796 PyObject *_args;
797{
798 PyObject *_res = NULL;
799 Rect r;
800 if (!PyArg_ParseTuple(_args, "O&",
801 PyMac_GetRect, &r))
802 return NULL;
803 PaintRect(&r);
804 Py_INCREF(Py_None);
805 _res = Py_None;
806 return _res;
807}
808
Guido van Rossum17448e21995-01-30 11:53:55 +0000809static PyObject *Qd_EraseRect(_self, _args)
810 PyObject *_self;
811 PyObject *_args;
812{
813 PyObject *_res = NULL;
814 Rect r;
815 if (!PyArg_ParseTuple(_args, "O&",
816 PyMac_GetRect, &r))
817 return NULL;
818 EraseRect(&r);
819 Py_INCREF(Py_None);
820 _res = Py_None;
821 return _res;
822}
823
Guido van Rossume56db431995-03-19 22:49:50 +0000824static PyObject *Qd_InvertRect(_self, _args)
Guido van Rossum17448e21995-01-30 11:53:55 +0000825 PyObject *_self;
826 PyObject *_args;
827{
828 PyObject *_res = NULL;
Guido van Rossume56db431995-03-19 22:49:50 +0000829 Rect r;
Guido van Rossum17448e21995-01-30 11:53:55 +0000830 if (!PyArg_ParseTuple(_args, "O&",
Guido van Rossume56db431995-03-19 22:49:50 +0000831 PyMac_GetRect, &r))
Guido van Rossum17448e21995-01-30 11:53:55 +0000832 return NULL;
Guido van Rossume56db431995-03-19 22:49:50 +0000833 InvertRect(&r);
Guido van Rossum17448e21995-01-30 11:53:55 +0000834 Py_INCREF(Py_None);
835 _res = Py_None;
836 return _res;
837}
838
Guido van Rossume56db431995-03-19 22:49:50 +0000839static PyObject *Qd_FrameOval(_self, _args)
840 PyObject *_self;
841 PyObject *_args;
842{
843 PyObject *_res = NULL;
844 Rect r;
845 if (!PyArg_ParseTuple(_args, "O&",
846 PyMac_GetRect, &r))
847 return NULL;
848 FrameOval(&r);
849 Py_INCREF(Py_None);
850 _res = Py_None;
851 return _res;
852}
853
854static PyObject *Qd_PaintOval(_self, _args)
855 PyObject *_self;
856 PyObject *_args;
857{
858 PyObject *_res = NULL;
859 Rect r;
860 if (!PyArg_ParseTuple(_args, "O&",
861 PyMac_GetRect, &r))
862 return NULL;
863 PaintOval(&r);
864 Py_INCREF(Py_None);
865 _res = Py_None;
866 return _res;
867}
868
869static PyObject *Qd_EraseOval(_self, _args)
870 PyObject *_self;
871 PyObject *_args;
872{
873 PyObject *_res = NULL;
874 Rect r;
875 if (!PyArg_ParseTuple(_args, "O&",
876 PyMac_GetRect, &r))
877 return NULL;
878 EraseOval(&r);
879 Py_INCREF(Py_None);
880 _res = Py_None;
881 return _res;
882}
883
884static PyObject *Qd_InvertOval(_self, _args)
885 PyObject *_self;
886 PyObject *_args;
887{
888 PyObject *_res = NULL;
889 Rect r;
890 if (!PyArg_ParseTuple(_args, "O&",
891 PyMac_GetRect, &r))
892 return NULL;
893 InvertOval(&r);
894 Py_INCREF(Py_None);
895 _res = Py_None;
896 return _res;
897}
898
899static PyObject *Qd_FrameRoundRect(_self, _args)
900 PyObject *_self;
901 PyObject *_args;
902{
903 PyObject *_res = NULL;
904 Rect r;
905 short ovalWidth;
906 short ovalHeight;
907 if (!PyArg_ParseTuple(_args, "O&hh",
908 PyMac_GetRect, &r,
909 &ovalWidth,
910 &ovalHeight))
911 return NULL;
912 FrameRoundRect(&r,
913 ovalWidth,
914 ovalHeight);
915 Py_INCREF(Py_None);
916 _res = Py_None;
917 return _res;
918}
919
920static PyObject *Qd_PaintRoundRect(_self, _args)
921 PyObject *_self;
922 PyObject *_args;
923{
924 PyObject *_res = NULL;
925 Rect r;
926 short ovalWidth;
927 short ovalHeight;
928 if (!PyArg_ParseTuple(_args, "O&hh",
929 PyMac_GetRect, &r,
930 &ovalWidth,
931 &ovalHeight))
932 return NULL;
933 PaintRoundRect(&r,
934 ovalWidth,
935 ovalHeight);
936 Py_INCREF(Py_None);
937 _res = Py_None;
938 return _res;
939}
940
941static PyObject *Qd_EraseRoundRect(_self, _args)
942 PyObject *_self;
943 PyObject *_args;
944{
945 PyObject *_res = NULL;
946 Rect r;
947 short ovalWidth;
948 short ovalHeight;
949 if (!PyArg_ParseTuple(_args, "O&hh",
950 PyMac_GetRect, &r,
951 &ovalWidth,
952 &ovalHeight))
953 return NULL;
954 EraseRoundRect(&r,
955 ovalWidth,
956 ovalHeight);
957 Py_INCREF(Py_None);
958 _res = Py_None;
959 return _res;
960}
961
962static PyObject *Qd_InvertRoundRect(_self, _args)
963 PyObject *_self;
964 PyObject *_args;
965{
966 PyObject *_res = NULL;
967 Rect r;
968 short ovalWidth;
969 short ovalHeight;
970 if (!PyArg_ParseTuple(_args, "O&hh",
971 PyMac_GetRect, &r,
972 &ovalWidth,
973 &ovalHeight))
974 return NULL;
975 InvertRoundRect(&r,
976 ovalWidth,
977 ovalHeight);
978 Py_INCREF(Py_None);
979 _res = Py_None;
980 return _res;
981}
982
983static PyObject *Qd_FrameArc(_self, _args)
984 PyObject *_self;
985 PyObject *_args;
986{
987 PyObject *_res = NULL;
988 Rect r;
989 short startAngle;
990 short arcAngle;
991 if (!PyArg_ParseTuple(_args, "O&hh",
992 PyMac_GetRect, &r,
993 &startAngle,
994 &arcAngle))
995 return NULL;
996 FrameArc(&r,
997 startAngle,
998 arcAngle);
999 Py_INCREF(Py_None);
1000 _res = Py_None;
1001 return _res;
1002}
1003
1004static PyObject *Qd_PaintArc(_self, _args)
1005 PyObject *_self;
1006 PyObject *_args;
1007{
1008 PyObject *_res = NULL;
1009 Rect r;
1010 short startAngle;
1011 short arcAngle;
1012 if (!PyArg_ParseTuple(_args, "O&hh",
1013 PyMac_GetRect, &r,
1014 &startAngle,
1015 &arcAngle))
1016 return NULL;
1017 PaintArc(&r,
1018 startAngle,
1019 arcAngle);
1020 Py_INCREF(Py_None);
1021 _res = Py_None;
1022 return _res;
1023}
1024
1025static PyObject *Qd_EraseArc(_self, _args)
1026 PyObject *_self;
1027 PyObject *_args;
1028{
1029 PyObject *_res = NULL;
1030 Rect r;
1031 short startAngle;
1032 short arcAngle;
1033 if (!PyArg_ParseTuple(_args, "O&hh",
1034 PyMac_GetRect, &r,
1035 &startAngle,
1036 &arcAngle))
1037 return NULL;
1038 EraseArc(&r,
1039 startAngle,
1040 arcAngle);
1041 Py_INCREF(Py_None);
1042 _res = Py_None;
1043 return _res;
1044}
1045
1046static PyObject *Qd_InvertArc(_self, _args)
1047 PyObject *_self;
1048 PyObject *_args;
1049{
1050 PyObject *_res = NULL;
1051 Rect r;
1052 short startAngle;
1053 short arcAngle;
1054 if (!PyArg_ParseTuple(_args, "O&hh",
1055 PyMac_GetRect, &r,
1056 &startAngle,
1057 &arcAngle))
1058 return NULL;
1059 InvertArc(&r,
1060 startAngle,
1061 arcAngle);
1062 Py_INCREF(Py_None);
1063 _res = Py_None;
1064 return _res;
1065}
1066
1067static PyObject *Qd_NewRgn(_self, _args)
1068 PyObject *_self;
1069 PyObject *_args;
1070{
1071 PyObject *_res = NULL;
1072 RgnHandle _rv;
1073 if (!PyArg_ParseTuple(_args, ""))
1074 return NULL;
1075 _rv = NewRgn();
1076 _res = Py_BuildValue("O&",
1077 ResObj_New, _rv);
1078 return _res;
1079}
1080
1081static PyObject *Qd_OpenRgn(_self, _args)
1082 PyObject *_self;
1083 PyObject *_args;
1084{
1085 PyObject *_res = NULL;
1086 if (!PyArg_ParseTuple(_args, ""))
1087 return NULL;
1088 OpenRgn();
1089 Py_INCREF(Py_None);
1090 _res = Py_None;
1091 return _res;
1092}
1093
1094static PyObject *Qd_CloseRgn(_self, _args)
1095 PyObject *_self;
1096 PyObject *_args;
1097{
1098 PyObject *_res = NULL;
1099 RgnHandle dstRgn;
1100 if (!PyArg_ParseTuple(_args, "O&",
1101 ResObj_Convert, &dstRgn))
1102 return NULL;
1103 CloseRgn(dstRgn);
1104 Py_INCREF(Py_None);
1105 _res = Py_None;
1106 return _res;
1107}
1108
Jack Jansen41058c01995-11-16 22:48:29 +00001109static PyObject *Qd_BitMapToRegion(_self, _args)
1110 PyObject *_self;
1111 PyObject *_args;
1112{
1113 PyObject *_res = NULL;
1114 OSErr _err;
1115 RgnHandle region;
1116 BitMapPtr bMap;
1117 if (!PyArg_ParseTuple(_args, "O&O&",
1118 ResObj_Convert, &region,
1119 BMObj_Convert, &bMap))
1120 return NULL;
1121 _err = BitMapToRegion(region,
1122 bMap);
1123 if (_err != noErr) return PyMac_Error(_err);
1124 Py_INCREF(Py_None);
1125 _res = Py_None;
1126 return _res;
1127}
1128
Guido van Rossume56db431995-03-19 22:49:50 +00001129static PyObject *Qd_DisposeRgn(_self, _args)
1130 PyObject *_self;
1131 PyObject *_args;
1132{
1133 PyObject *_res = NULL;
1134 RgnHandle rgn;
1135 if (!PyArg_ParseTuple(_args, "O&",
1136 ResObj_Convert, &rgn))
1137 return NULL;
1138 DisposeRgn(rgn);
1139 Py_INCREF(Py_None);
1140 _res = Py_None;
1141 return _res;
1142}
1143
1144static PyObject *Qd_CopyRgn(_self, _args)
1145 PyObject *_self;
1146 PyObject *_args;
1147{
1148 PyObject *_res = NULL;
1149 RgnHandle srcRgn;
1150 RgnHandle dstRgn;
1151 if (!PyArg_ParseTuple(_args, "O&O&",
1152 ResObj_Convert, &srcRgn,
1153 ResObj_Convert, &dstRgn))
1154 return NULL;
1155 CopyRgn(srcRgn,
1156 dstRgn);
1157 Py_INCREF(Py_None);
1158 _res = Py_None;
1159 return _res;
1160}
1161
1162static PyObject *Qd_SetEmptyRgn(_self, _args)
1163 PyObject *_self;
1164 PyObject *_args;
1165{
1166 PyObject *_res = NULL;
1167 RgnHandle rgn;
1168 if (!PyArg_ParseTuple(_args, "O&",
1169 ResObj_Convert, &rgn))
1170 return NULL;
1171 SetEmptyRgn(rgn);
1172 Py_INCREF(Py_None);
1173 _res = Py_None;
1174 return _res;
1175}
1176
1177static PyObject *Qd_SetRectRgn(_self, _args)
1178 PyObject *_self;
1179 PyObject *_args;
1180{
1181 PyObject *_res = NULL;
1182 RgnHandle rgn;
1183 short left;
1184 short top;
1185 short right;
1186 short bottom;
1187 if (!PyArg_ParseTuple(_args, "O&hhhh",
1188 ResObj_Convert, &rgn,
1189 &left,
1190 &top,
1191 &right,
1192 &bottom))
1193 return NULL;
1194 SetRectRgn(rgn,
1195 left,
1196 top,
1197 right,
1198 bottom);
1199 Py_INCREF(Py_None);
1200 _res = Py_None;
1201 return _res;
1202}
1203
1204static PyObject *Qd_RectRgn(_self, _args)
1205 PyObject *_self;
1206 PyObject *_args;
1207{
1208 PyObject *_res = NULL;
1209 RgnHandle rgn;
1210 Rect r;
1211 if (!PyArg_ParseTuple(_args, "O&O&",
1212 ResObj_Convert, &rgn,
1213 PyMac_GetRect, &r))
1214 return NULL;
1215 RectRgn(rgn,
1216 &r);
1217 Py_INCREF(Py_None);
1218 _res = Py_None;
1219 return _res;
1220}
1221
1222static PyObject *Qd_OffsetRgn(_self, _args)
1223 PyObject *_self;
1224 PyObject *_args;
1225{
1226 PyObject *_res = NULL;
1227 RgnHandle rgn;
1228 short dh;
1229 short dv;
1230 if (!PyArg_ParseTuple(_args, "O&hh",
1231 ResObj_Convert, &rgn,
1232 &dh,
1233 &dv))
1234 return NULL;
1235 OffsetRgn(rgn,
1236 dh,
1237 dv);
1238 Py_INCREF(Py_None);
1239 _res = Py_None;
1240 return _res;
1241}
1242
1243static PyObject *Qd_InsetRgn(_self, _args)
1244 PyObject *_self;
1245 PyObject *_args;
1246{
1247 PyObject *_res = NULL;
1248 RgnHandle rgn;
1249 short dh;
1250 short dv;
1251 if (!PyArg_ParseTuple(_args, "O&hh",
1252 ResObj_Convert, &rgn,
1253 &dh,
1254 &dv))
1255 return NULL;
1256 InsetRgn(rgn,
1257 dh,
1258 dv);
1259 Py_INCREF(Py_None);
1260 _res = Py_None;
1261 return _res;
1262}
1263
1264static PyObject *Qd_SectRgn(_self, _args)
1265 PyObject *_self;
1266 PyObject *_args;
1267{
1268 PyObject *_res = NULL;
1269 RgnHandle srcRgnA;
1270 RgnHandle srcRgnB;
1271 RgnHandle dstRgn;
1272 if (!PyArg_ParseTuple(_args, "O&O&O&",
1273 ResObj_Convert, &srcRgnA,
1274 ResObj_Convert, &srcRgnB,
1275 ResObj_Convert, &dstRgn))
1276 return NULL;
1277 SectRgn(srcRgnA,
1278 srcRgnB,
1279 dstRgn);
1280 Py_INCREF(Py_None);
1281 _res = Py_None;
1282 return _res;
1283}
1284
1285static PyObject *Qd_UnionRgn(_self, _args)
1286 PyObject *_self;
1287 PyObject *_args;
1288{
1289 PyObject *_res = NULL;
1290 RgnHandle srcRgnA;
1291 RgnHandle srcRgnB;
1292 RgnHandle dstRgn;
1293 if (!PyArg_ParseTuple(_args, "O&O&O&",
1294 ResObj_Convert, &srcRgnA,
1295 ResObj_Convert, &srcRgnB,
1296 ResObj_Convert, &dstRgn))
1297 return NULL;
1298 UnionRgn(srcRgnA,
1299 srcRgnB,
1300 dstRgn);
1301 Py_INCREF(Py_None);
1302 _res = Py_None;
1303 return _res;
1304}
1305
1306static PyObject *Qd_DiffRgn(_self, _args)
1307 PyObject *_self;
1308 PyObject *_args;
1309{
1310 PyObject *_res = NULL;
1311 RgnHandle srcRgnA;
1312 RgnHandle srcRgnB;
1313 RgnHandle dstRgn;
1314 if (!PyArg_ParseTuple(_args, "O&O&O&",
1315 ResObj_Convert, &srcRgnA,
1316 ResObj_Convert, &srcRgnB,
1317 ResObj_Convert, &dstRgn))
1318 return NULL;
1319 DiffRgn(srcRgnA,
1320 srcRgnB,
1321 dstRgn);
1322 Py_INCREF(Py_None);
1323 _res = Py_None;
1324 return _res;
1325}
1326
1327static PyObject *Qd_XorRgn(_self, _args)
1328 PyObject *_self;
1329 PyObject *_args;
1330{
1331 PyObject *_res = NULL;
1332 RgnHandle srcRgnA;
1333 RgnHandle srcRgnB;
1334 RgnHandle dstRgn;
1335 if (!PyArg_ParseTuple(_args, "O&O&O&",
1336 ResObj_Convert, &srcRgnA,
1337 ResObj_Convert, &srcRgnB,
1338 ResObj_Convert, &dstRgn))
1339 return NULL;
1340 XorRgn(srcRgnA,
1341 srcRgnB,
1342 dstRgn);
1343 Py_INCREF(Py_None);
1344 _res = Py_None;
1345 return _res;
1346}
1347
1348static PyObject *Qd_RectInRgn(_self, _args)
1349 PyObject *_self;
1350 PyObject *_args;
1351{
1352 PyObject *_res = NULL;
1353 Boolean _rv;
1354 Rect r;
1355 RgnHandle rgn;
1356 if (!PyArg_ParseTuple(_args, "O&O&",
1357 PyMac_GetRect, &r,
1358 ResObj_Convert, &rgn))
1359 return NULL;
1360 _rv = RectInRgn(&r,
1361 rgn);
1362 _res = Py_BuildValue("b",
1363 _rv);
1364 return _res;
1365}
1366
1367static PyObject *Qd_EqualRgn(_self, _args)
1368 PyObject *_self;
1369 PyObject *_args;
1370{
1371 PyObject *_res = NULL;
1372 Boolean _rv;
1373 RgnHandle rgnA;
1374 RgnHandle rgnB;
1375 if (!PyArg_ParseTuple(_args, "O&O&",
1376 ResObj_Convert, &rgnA,
1377 ResObj_Convert, &rgnB))
1378 return NULL;
1379 _rv = EqualRgn(rgnA,
1380 rgnB);
1381 _res = Py_BuildValue("b",
1382 _rv);
1383 return _res;
1384}
1385
1386static PyObject *Qd_EmptyRgn(_self, _args)
1387 PyObject *_self;
1388 PyObject *_args;
1389{
1390 PyObject *_res = NULL;
1391 Boolean _rv;
1392 RgnHandle rgn;
1393 if (!PyArg_ParseTuple(_args, "O&",
1394 ResObj_Convert, &rgn))
1395 return NULL;
1396 _rv = EmptyRgn(rgn);
1397 _res = Py_BuildValue("b",
1398 _rv);
1399 return _res;
1400}
1401
1402static PyObject *Qd_FrameRgn(_self, _args)
1403 PyObject *_self;
1404 PyObject *_args;
1405{
1406 PyObject *_res = NULL;
1407 RgnHandle rgn;
1408 if (!PyArg_ParseTuple(_args, "O&",
1409 ResObj_Convert, &rgn))
1410 return NULL;
1411 FrameRgn(rgn);
1412 Py_INCREF(Py_None);
1413 _res = Py_None;
1414 return _res;
1415}
1416
1417static PyObject *Qd_PaintRgn(_self, _args)
1418 PyObject *_self;
1419 PyObject *_args;
1420{
1421 PyObject *_res = NULL;
1422 RgnHandle rgn;
1423 if (!PyArg_ParseTuple(_args, "O&",
1424 ResObj_Convert, &rgn))
1425 return NULL;
1426 PaintRgn(rgn);
1427 Py_INCREF(Py_None);
1428 _res = Py_None;
1429 return _res;
1430}
1431
1432static PyObject *Qd_EraseRgn(_self, _args)
1433 PyObject *_self;
1434 PyObject *_args;
1435{
1436 PyObject *_res = NULL;
1437 RgnHandle rgn;
1438 if (!PyArg_ParseTuple(_args, "O&",
1439 ResObj_Convert, &rgn))
1440 return NULL;
1441 EraseRgn(rgn);
1442 Py_INCREF(Py_None);
1443 _res = Py_None;
1444 return _res;
1445}
1446
1447static PyObject *Qd_InvertRgn(_self, _args)
1448 PyObject *_self;
1449 PyObject *_args;
1450{
1451 PyObject *_res = NULL;
1452 RgnHandle rgn;
1453 if (!PyArg_ParseTuple(_args, "O&",
1454 ResObj_Convert, &rgn))
1455 return NULL;
1456 InvertRgn(rgn);
1457 Py_INCREF(Py_None);
1458 _res = Py_None;
1459 return _res;
1460}
1461
1462static PyObject *Qd_ScrollRect(_self, _args)
1463 PyObject *_self;
1464 PyObject *_args;
1465{
1466 PyObject *_res = NULL;
1467 Rect r;
1468 short dh;
1469 short dv;
1470 RgnHandle updateRgn;
1471 if (!PyArg_ParseTuple(_args, "O&hhO&",
1472 PyMac_GetRect, &r,
1473 &dh,
1474 &dv,
1475 ResObj_Convert, &updateRgn))
1476 return NULL;
1477 ScrollRect(&r,
1478 dh,
1479 dv,
1480 updateRgn);
1481 Py_INCREF(Py_None);
1482 _res = Py_None;
1483 return _res;
1484}
1485
Jack Jansen41058c01995-11-16 22:48:29 +00001486static PyObject *Qd_CopyBits(_self, _args)
1487 PyObject *_self;
1488 PyObject *_args;
1489{
1490 PyObject *_res = NULL;
1491 BitMapPtr srcBits;
1492 BitMapPtr dstBits;
1493 Rect srcRect;
1494 Rect dstRect;
1495 short mode;
1496 RgnHandle maskRgn;
1497 if (!PyArg_ParseTuple(_args, "O&O&O&O&hO&",
1498 BMObj_Convert, &srcBits,
1499 BMObj_Convert, &dstBits,
1500 PyMac_GetRect, &srcRect,
1501 PyMac_GetRect, &dstRect,
1502 &mode,
1503 ResObj_Convert, &maskRgn))
1504 return NULL;
1505 CopyBits(srcBits,
1506 dstBits,
1507 &srcRect,
1508 &dstRect,
1509 mode,
1510 maskRgn);
1511 Py_INCREF(Py_None);
1512 _res = Py_None;
1513 return _res;
1514}
1515
1516static PyObject *Qd_CopyMask(_self, _args)
1517 PyObject *_self;
1518 PyObject *_args;
1519{
1520 PyObject *_res = NULL;
1521 BitMapPtr srcBits;
1522 BitMapPtr maskBits;
1523 BitMapPtr dstBits;
1524 Rect srcRect;
1525 Rect maskRect;
1526 Rect dstRect;
1527 if (!PyArg_ParseTuple(_args, "O&O&O&O&O&O&",
1528 BMObj_Convert, &srcBits,
1529 BMObj_Convert, &maskBits,
1530 BMObj_Convert, &dstBits,
1531 PyMac_GetRect, &srcRect,
1532 PyMac_GetRect, &maskRect,
1533 PyMac_GetRect, &dstRect))
1534 return NULL;
1535 CopyMask(srcBits,
1536 maskBits,
1537 dstBits,
1538 &srcRect,
1539 &maskRect,
1540 &dstRect);
1541 Py_INCREF(Py_None);
1542 _res = Py_None;
1543 return _res;
1544}
1545
Guido van Rossume56db431995-03-19 22:49:50 +00001546static PyObject *Qd_OpenPicture(_self, _args)
1547 PyObject *_self;
1548 PyObject *_args;
1549{
1550 PyObject *_res = NULL;
1551 PicHandle _rv;
1552 Rect picFrame;
1553 if (!PyArg_ParseTuple(_args, "O&",
1554 PyMac_GetRect, &picFrame))
1555 return NULL;
1556 _rv = OpenPicture(&picFrame);
1557 _res = Py_BuildValue("O&",
1558 ResObj_New, _rv);
1559 return _res;
1560}
1561
1562static PyObject *Qd_PicComment(_self, _args)
1563 PyObject *_self;
1564 PyObject *_args;
1565{
1566 PyObject *_res = NULL;
1567 short kind;
1568 short dataSize;
1569 Handle dataHandle;
1570 if (!PyArg_ParseTuple(_args, "hhO&",
1571 &kind,
1572 &dataSize,
1573 ResObj_Convert, &dataHandle))
1574 return NULL;
1575 PicComment(kind,
1576 dataSize,
1577 dataHandle);
1578 Py_INCREF(Py_None);
1579 _res = Py_None;
1580 return _res;
1581}
1582
1583static PyObject *Qd_ClosePicture(_self, _args)
1584 PyObject *_self;
1585 PyObject *_args;
1586{
1587 PyObject *_res = NULL;
1588 if (!PyArg_ParseTuple(_args, ""))
1589 return NULL;
1590 ClosePicture();
1591 Py_INCREF(Py_None);
1592 _res = Py_None;
1593 return _res;
1594}
1595
1596static PyObject *Qd_DrawPicture(_self, _args)
1597 PyObject *_self;
1598 PyObject *_args;
1599{
1600 PyObject *_res = NULL;
1601 PicHandle myPicture;
1602 Rect dstRect;
1603 if (!PyArg_ParseTuple(_args, "O&O&",
1604 ResObj_Convert, &myPicture,
1605 PyMac_GetRect, &dstRect))
1606 return NULL;
1607 DrawPicture(myPicture,
1608 &dstRect);
1609 Py_INCREF(Py_None);
1610 _res = Py_None;
1611 return _res;
1612}
1613
1614static PyObject *Qd_KillPicture(_self, _args)
1615 PyObject *_self;
1616 PyObject *_args;
1617{
1618 PyObject *_res = NULL;
1619 PicHandle myPicture;
1620 if (!PyArg_ParseTuple(_args, "O&",
1621 ResObj_Convert, &myPicture))
1622 return NULL;
1623 KillPicture(myPicture);
1624 Py_INCREF(Py_None);
1625 _res = Py_None;
1626 return _res;
1627}
1628
1629static PyObject *Qd_OpenPoly(_self, _args)
1630 PyObject *_self;
1631 PyObject *_args;
1632{
1633 PyObject *_res = NULL;
1634 PolyHandle _rv;
1635 if (!PyArg_ParseTuple(_args, ""))
1636 return NULL;
1637 _rv = OpenPoly();
1638 _res = Py_BuildValue("O&",
1639 ResObj_New, _rv);
1640 return _res;
1641}
1642
1643static PyObject *Qd_ClosePoly(_self, _args)
1644 PyObject *_self;
1645 PyObject *_args;
1646{
1647 PyObject *_res = NULL;
1648 if (!PyArg_ParseTuple(_args, ""))
1649 return NULL;
1650 ClosePoly();
1651 Py_INCREF(Py_None);
1652 _res = Py_None;
1653 return _res;
1654}
1655
1656static PyObject *Qd_KillPoly(_self, _args)
1657 PyObject *_self;
1658 PyObject *_args;
1659{
1660 PyObject *_res = NULL;
1661 PolyHandle poly;
1662 if (!PyArg_ParseTuple(_args, "O&",
1663 ResObj_Convert, &poly))
1664 return NULL;
1665 KillPoly(poly);
1666 Py_INCREF(Py_None);
1667 _res = Py_None;
1668 return _res;
1669}
1670
1671static PyObject *Qd_OffsetPoly(_self, _args)
1672 PyObject *_self;
1673 PyObject *_args;
1674{
1675 PyObject *_res = NULL;
1676 PolyHandle poly;
1677 short dh;
1678 short dv;
1679 if (!PyArg_ParseTuple(_args, "O&hh",
1680 ResObj_Convert, &poly,
1681 &dh,
1682 &dv))
1683 return NULL;
1684 OffsetPoly(poly,
1685 dh,
1686 dv);
1687 Py_INCREF(Py_None);
1688 _res = Py_None;
1689 return _res;
1690}
1691
1692static PyObject *Qd_FramePoly(_self, _args)
1693 PyObject *_self;
1694 PyObject *_args;
1695{
1696 PyObject *_res = NULL;
1697 PolyHandle poly;
1698 if (!PyArg_ParseTuple(_args, "O&",
1699 ResObj_Convert, &poly))
1700 return NULL;
1701 FramePoly(poly);
1702 Py_INCREF(Py_None);
1703 _res = Py_None;
1704 return _res;
1705}
1706
1707static PyObject *Qd_PaintPoly(_self, _args)
1708 PyObject *_self;
1709 PyObject *_args;
1710{
1711 PyObject *_res = NULL;
1712 PolyHandle poly;
1713 if (!PyArg_ParseTuple(_args, "O&",
1714 ResObj_Convert, &poly))
1715 return NULL;
1716 PaintPoly(poly);
1717 Py_INCREF(Py_None);
1718 _res = Py_None;
1719 return _res;
1720}
1721
1722static PyObject *Qd_ErasePoly(_self, _args)
1723 PyObject *_self;
1724 PyObject *_args;
1725{
1726 PyObject *_res = NULL;
1727 PolyHandle poly;
1728 if (!PyArg_ParseTuple(_args, "O&",
1729 ResObj_Convert, &poly))
1730 return NULL;
1731 ErasePoly(poly);
1732 Py_INCREF(Py_None);
1733 _res = Py_None;
1734 return _res;
1735}
1736
1737static PyObject *Qd_InvertPoly(_self, _args)
1738 PyObject *_self;
1739 PyObject *_args;
1740{
1741 PyObject *_res = NULL;
1742 PolyHandle poly;
1743 if (!PyArg_ParseTuple(_args, "O&",
1744 ResObj_Convert, &poly))
1745 return NULL;
1746 InvertPoly(poly);
1747 Py_INCREF(Py_None);
1748 _res = Py_None;
1749 return _res;
1750}
1751
1752static PyObject *Qd_SetPt(_self, _args)
1753 PyObject *_self;
1754 PyObject *_args;
1755{
1756 PyObject *_res = NULL;
1757 Point pt;
1758 short h;
1759 short v;
1760 if (!PyArg_ParseTuple(_args, "O&hh",
1761 PyMac_GetPoint, &pt,
1762 &h,
1763 &v))
1764 return NULL;
1765 SetPt(&pt,
1766 h,
1767 v);
1768 _res = Py_BuildValue("O&",
1769 PyMac_BuildPoint, pt);
1770 return _res;
1771}
1772
1773static PyObject *Qd_LocalToGlobal(_self, _args)
1774 PyObject *_self;
1775 PyObject *_args;
1776{
1777 PyObject *_res = NULL;
1778 Point pt;
1779 if (!PyArg_ParseTuple(_args, "O&",
1780 PyMac_GetPoint, &pt))
1781 return NULL;
1782 LocalToGlobal(&pt);
1783 _res = Py_BuildValue("O&",
1784 PyMac_BuildPoint, pt);
1785 return _res;
1786}
1787
1788static PyObject *Qd_GlobalToLocal(_self, _args)
1789 PyObject *_self;
1790 PyObject *_args;
1791{
1792 PyObject *_res = NULL;
1793 Point pt;
1794 if (!PyArg_ParseTuple(_args, "O&",
1795 PyMac_GetPoint, &pt))
1796 return NULL;
1797 GlobalToLocal(&pt);
1798 _res = Py_BuildValue("O&",
1799 PyMac_BuildPoint, pt);
1800 return _res;
1801}
1802
1803static PyObject *Qd_Random(_self, _args)
1804 PyObject *_self;
1805 PyObject *_args;
1806{
1807 PyObject *_res = NULL;
1808 short _rv;
1809 if (!PyArg_ParseTuple(_args, ""))
1810 return NULL;
1811 _rv = Random();
1812 _res = Py_BuildValue("h",
1813 _rv);
1814 return _res;
1815}
1816
1817static PyObject *Qd_GetPixel(_self, _args)
1818 PyObject *_self;
1819 PyObject *_args;
1820{
1821 PyObject *_res = NULL;
1822 Boolean _rv;
1823 short h;
1824 short v;
1825 if (!PyArg_ParseTuple(_args, "hh",
1826 &h,
1827 &v))
1828 return NULL;
1829 _rv = GetPixel(h,
1830 v);
1831 _res = Py_BuildValue("b",
1832 _rv);
1833 return _res;
1834}
1835
1836static PyObject *Qd_ScalePt(_self, _args)
1837 PyObject *_self;
1838 PyObject *_args;
1839{
1840 PyObject *_res = NULL;
1841 Point pt;
1842 Rect srcRect;
1843 Rect dstRect;
1844 if (!PyArg_ParseTuple(_args, "O&O&O&",
1845 PyMac_GetPoint, &pt,
1846 PyMac_GetRect, &srcRect,
1847 PyMac_GetRect, &dstRect))
1848 return NULL;
1849 ScalePt(&pt,
1850 &srcRect,
1851 &dstRect);
1852 _res = Py_BuildValue("O&",
1853 PyMac_BuildPoint, pt);
1854 return _res;
1855}
1856
1857static PyObject *Qd_MapPt(_self, _args)
1858 PyObject *_self;
1859 PyObject *_args;
1860{
1861 PyObject *_res = NULL;
1862 Point pt;
1863 Rect srcRect;
1864 Rect dstRect;
1865 if (!PyArg_ParseTuple(_args, "O&O&O&",
1866 PyMac_GetPoint, &pt,
1867 PyMac_GetRect, &srcRect,
1868 PyMac_GetRect, &dstRect))
1869 return NULL;
1870 MapPt(&pt,
1871 &srcRect,
1872 &dstRect);
1873 _res = Py_BuildValue("O&",
1874 PyMac_BuildPoint, pt);
1875 return _res;
1876}
1877
1878static PyObject *Qd_MapRect(_self, _args)
1879 PyObject *_self;
1880 PyObject *_args;
1881{
1882 PyObject *_res = NULL;
1883 Rect r;
1884 Rect srcRect;
1885 Rect dstRect;
Jack Jansen54c8f7e1995-11-14 10:46:01 +00001886 if (!PyArg_ParseTuple(_args, "O&O&O&",
1887 PyMac_GetRect, &r,
Guido van Rossume56db431995-03-19 22:49:50 +00001888 PyMac_GetRect, &srcRect,
1889 PyMac_GetRect, &dstRect))
1890 return NULL;
1891 MapRect(&r,
1892 &srcRect,
1893 &dstRect);
1894 _res = Py_BuildValue("O&",
1895 PyMac_BuildRect, &r);
1896 return _res;
1897}
1898
1899static PyObject *Qd_MapRgn(_self, _args)
1900 PyObject *_self;
1901 PyObject *_args;
1902{
1903 PyObject *_res = NULL;
1904 RgnHandle rgn;
1905 Rect srcRect;
1906 Rect dstRect;
1907 if (!PyArg_ParseTuple(_args, "O&O&O&",
1908 ResObj_Convert, &rgn,
1909 PyMac_GetRect, &srcRect,
1910 PyMac_GetRect, &dstRect))
1911 return NULL;
1912 MapRgn(rgn,
1913 &srcRect,
1914 &dstRect);
1915 Py_INCREF(Py_None);
1916 _res = Py_None;
1917 return _res;
1918}
1919
1920static PyObject *Qd_MapPoly(_self, _args)
1921 PyObject *_self;
1922 PyObject *_args;
1923{
1924 PyObject *_res = NULL;
1925 PolyHandle poly;
1926 Rect srcRect;
1927 Rect dstRect;
1928 if (!PyArg_ParseTuple(_args, "O&O&O&",
1929 ResObj_Convert, &poly,
1930 PyMac_GetRect, &srcRect,
1931 PyMac_GetRect, &dstRect))
1932 return NULL;
1933 MapPoly(poly,
1934 &srcRect,
1935 &dstRect);
1936 Py_INCREF(Py_None);
1937 _res = Py_None;
1938 return _res;
1939}
1940
Jack Jansen41058c01995-11-16 22:48:29 +00001941static PyObject *Qd_StdBits(_self, _args)
1942 PyObject *_self;
1943 PyObject *_args;
1944{
1945 PyObject *_res = NULL;
1946 BitMapPtr srcBits;
1947 Rect srcRect;
1948 Rect dstRect;
1949 short mode;
1950 RgnHandle maskRgn;
1951 if (!PyArg_ParseTuple(_args, "O&O&O&hO&",
1952 BMObj_Convert, &srcBits,
1953 PyMac_GetRect, &srcRect,
1954 PyMac_GetRect, &dstRect,
1955 &mode,
1956 ResObj_Convert, &maskRgn))
1957 return NULL;
1958 StdBits(srcBits,
1959 &srcRect,
1960 &dstRect,
1961 mode,
1962 maskRgn);
1963 Py_INCREF(Py_None);
1964 _res = Py_None;
1965 return _res;
1966}
1967
Guido van Rossume56db431995-03-19 22:49:50 +00001968static PyObject *Qd_AddPt(_self, _args)
1969 PyObject *_self;
1970 PyObject *_args;
1971{
1972 PyObject *_res = NULL;
1973 Point src;
1974 Point dst;
1975 if (!PyArg_ParseTuple(_args, "O&O&",
1976 PyMac_GetPoint, &src,
1977 PyMac_GetPoint, &dst))
1978 return NULL;
1979 AddPt(src,
1980 &dst);
1981 _res = Py_BuildValue("O&",
1982 PyMac_BuildPoint, dst);
1983 return _res;
1984}
1985
1986static PyObject *Qd_EqualPt(_self, _args)
1987 PyObject *_self;
1988 PyObject *_args;
1989{
1990 PyObject *_res = NULL;
1991 Boolean _rv;
1992 Point pt1;
1993 Point pt2;
1994 if (!PyArg_ParseTuple(_args, "O&O&",
1995 PyMac_GetPoint, &pt1,
1996 PyMac_GetPoint, &pt2))
1997 return NULL;
1998 _rv = EqualPt(pt1,
1999 pt2);
2000 _res = Py_BuildValue("b",
2001 _rv);
2002 return _res;
2003}
2004
2005static PyObject *Qd_PtInRect(_self, _args)
2006 PyObject *_self;
2007 PyObject *_args;
2008{
2009 PyObject *_res = NULL;
2010 Boolean _rv;
2011 Point pt;
2012 Rect r;
2013 if (!PyArg_ParseTuple(_args, "O&O&",
2014 PyMac_GetPoint, &pt,
2015 PyMac_GetRect, &r))
2016 return NULL;
2017 _rv = PtInRect(pt,
2018 &r);
2019 _res = Py_BuildValue("b",
2020 _rv);
2021 return _res;
2022}
2023
2024static PyObject *Qd_Pt2Rect(_self, _args)
2025 PyObject *_self;
2026 PyObject *_args;
2027{
2028 PyObject *_res = NULL;
2029 Point pt1;
2030 Point pt2;
2031 Rect dstRect;
2032 if (!PyArg_ParseTuple(_args, "O&O&",
2033 PyMac_GetPoint, &pt1,
2034 PyMac_GetPoint, &pt2))
2035 return NULL;
2036 Pt2Rect(pt1,
2037 pt2,
2038 &dstRect);
2039 _res = Py_BuildValue("O&",
2040 PyMac_BuildRect, &dstRect);
2041 return _res;
2042}
2043
2044static PyObject *Qd_PtToAngle(_self, _args)
2045 PyObject *_self;
2046 PyObject *_args;
2047{
2048 PyObject *_res = NULL;
2049 Rect r;
2050 Point pt;
2051 short angle;
2052 if (!PyArg_ParseTuple(_args, "O&O&",
2053 PyMac_GetRect, &r,
2054 PyMac_GetPoint, &pt))
2055 return NULL;
2056 PtToAngle(&r,
2057 pt,
2058 &angle);
2059 _res = Py_BuildValue("h",
2060 angle);
2061 return _res;
2062}
2063
Jack Jansenb81cf9d1995-06-06 13:08:40 +00002064static PyObject *Qd_SubPt(_self, _args)
2065 PyObject *_self;
2066 PyObject *_args;
2067{
2068 PyObject *_res = NULL;
2069 Point src;
2070 Point dst;
2071 if (!PyArg_ParseTuple(_args, "O&O&",
2072 PyMac_GetPoint, &src,
2073 PyMac_GetPoint, &dst))
2074 return NULL;
2075 SubPt(src,
2076 &dst);
2077 _res = Py_BuildValue("O&",
2078 PyMac_BuildPoint, dst);
2079 return _res;
2080}
2081
Guido van Rossume56db431995-03-19 22:49:50 +00002082static PyObject *Qd_PtInRgn(_self, _args)
2083 PyObject *_self;
2084 PyObject *_args;
2085{
2086 PyObject *_res = NULL;
2087 Boolean _rv;
2088 Point pt;
2089 RgnHandle rgn;
2090 if (!PyArg_ParseTuple(_args, "O&O&",
2091 PyMac_GetPoint, &pt,
2092 ResObj_Convert, &rgn))
2093 return NULL;
2094 _rv = PtInRgn(pt,
2095 rgn);
2096 _res = Py_BuildValue("b",
2097 _rv);
2098 return _res;
2099}
2100
2101static PyObject *Qd_NewPixMap(_self, _args)
2102 PyObject *_self;
2103 PyObject *_args;
2104{
2105 PyObject *_res = NULL;
2106 PixMapHandle _rv;
2107 if (!PyArg_ParseTuple(_args, ""))
2108 return NULL;
2109 _rv = NewPixMap();
2110 _res = Py_BuildValue("O&",
2111 ResObj_New, _rv);
2112 return _res;
2113}
2114
Guido van Rossume56db431995-03-19 22:49:50 +00002115static PyObject *Qd_DisposePixMap(_self, _args)
2116 PyObject *_self;
2117 PyObject *_args;
2118{
2119 PyObject *_res = NULL;
2120 PixMapHandle pm;
2121 if (!PyArg_ParseTuple(_args, "O&",
2122 ResObj_Convert, &pm))
2123 return NULL;
2124 DisposePixMap(pm);
2125 Py_INCREF(Py_None);
2126 _res = Py_None;
2127 return _res;
2128}
2129
2130static PyObject *Qd_CopyPixMap(_self, _args)
2131 PyObject *_self;
2132 PyObject *_args;
2133{
2134 PyObject *_res = NULL;
2135 PixMapHandle srcPM;
2136 PixMapHandle dstPM;
2137 if (!PyArg_ParseTuple(_args, "O&O&",
2138 ResObj_Convert, &srcPM,
2139 ResObj_Convert, &dstPM))
2140 return NULL;
2141 CopyPixMap(srcPM,
2142 dstPM);
2143 Py_INCREF(Py_None);
2144 _res = Py_None;
2145 return _res;
2146}
2147
2148static PyObject *Qd_NewPixPat(_self, _args)
2149 PyObject *_self;
2150 PyObject *_args;
2151{
2152 PyObject *_res = NULL;
2153 PixPatHandle _rv;
2154 if (!PyArg_ParseTuple(_args, ""))
2155 return NULL;
2156 _rv = NewPixPat();
2157 _res = Py_BuildValue("O&",
2158 ResObj_New, _rv);
2159 return _res;
2160}
2161
Guido van Rossume56db431995-03-19 22:49:50 +00002162static PyObject *Qd_DisposePixPat(_self, _args)
2163 PyObject *_self;
2164 PyObject *_args;
2165{
2166 PyObject *_res = NULL;
2167 PixPatHandle pp;
2168 if (!PyArg_ParseTuple(_args, "O&",
2169 ResObj_Convert, &pp))
2170 return NULL;
2171 DisposePixPat(pp);
2172 Py_INCREF(Py_None);
2173 _res = Py_None;
2174 return _res;
2175}
2176
2177static PyObject *Qd_CopyPixPat(_self, _args)
2178 PyObject *_self;
2179 PyObject *_args;
2180{
2181 PyObject *_res = NULL;
2182 PixPatHandle srcPP;
2183 PixPatHandle dstPP;
2184 if (!PyArg_ParseTuple(_args, "O&O&",
2185 ResObj_Convert, &srcPP,
2186 ResObj_Convert, &dstPP))
2187 return NULL;
2188 CopyPixPat(srcPP,
2189 dstPP);
2190 Py_INCREF(Py_None);
2191 _res = Py_None;
2192 return _res;
2193}
2194
2195static PyObject *Qd_PenPixPat(_self, _args)
2196 PyObject *_self;
2197 PyObject *_args;
2198{
2199 PyObject *_res = NULL;
2200 PixPatHandle pp;
2201 if (!PyArg_ParseTuple(_args, "O&",
2202 ResObj_Convert, &pp))
2203 return NULL;
2204 PenPixPat(pp);
2205 Py_INCREF(Py_None);
2206 _res = Py_None;
2207 return _res;
2208}
2209
2210static PyObject *Qd_BackPixPat(_self, _args)
2211 PyObject *_self;
2212 PyObject *_args;
2213{
2214 PyObject *_res = NULL;
2215 PixPatHandle pp;
2216 if (!PyArg_ParseTuple(_args, "O&",
2217 ResObj_Convert, &pp))
2218 return NULL;
2219 BackPixPat(pp);
2220 Py_INCREF(Py_None);
2221 _res = Py_None;
2222 return _res;
2223}
2224
2225static PyObject *Qd_GetPixPat(_self, _args)
2226 PyObject *_self;
2227 PyObject *_args;
2228{
2229 PyObject *_res = NULL;
2230 PixPatHandle _rv;
2231 short patID;
2232 if (!PyArg_ParseTuple(_args, "h",
2233 &patID))
2234 return NULL;
2235 _rv = GetPixPat(patID);
2236 _res = Py_BuildValue("O&",
2237 ResObj_New, _rv);
2238 return _res;
2239}
2240
2241static PyObject *Qd_FillCRect(_self, _args)
2242 PyObject *_self;
2243 PyObject *_args;
2244{
2245 PyObject *_res = NULL;
2246 Rect r;
2247 PixPatHandle pp;
2248 if (!PyArg_ParseTuple(_args, "O&O&",
2249 PyMac_GetRect, &r,
2250 ResObj_Convert, &pp))
2251 return NULL;
2252 FillCRect(&r,
2253 pp);
2254 Py_INCREF(Py_None);
2255 _res = Py_None;
2256 return _res;
2257}
2258
2259static PyObject *Qd_FillCOval(_self, _args)
2260 PyObject *_self;
2261 PyObject *_args;
2262{
2263 PyObject *_res = NULL;
2264 Rect r;
2265 PixPatHandle pp;
2266 if (!PyArg_ParseTuple(_args, "O&O&",
2267 PyMac_GetRect, &r,
2268 ResObj_Convert, &pp))
2269 return NULL;
2270 FillCOval(&r,
2271 pp);
2272 Py_INCREF(Py_None);
2273 _res = Py_None;
2274 return _res;
2275}
2276
2277static PyObject *Qd_FillCRoundRect(_self, _args)
2278 PyObject *_self;
2279 PyObject *_args;
2280{
2281 PyObject *_res = NULL;
2282 Rect r;
2283 short ovalWidth;
2284 short ovalHeight;
2285 PixPatHandle pp;
2286 if (!PyArg_ParseTuple(_args, "O&hhO&",
2287 PyMac_GetRect, &r,
2288 &ovalWidth,
2289 &ovalHeight,
2290 ResObj_Convert, &pp))
2291 return NULL;
2292 FillCRoundRect(&r,
2293 ovalWidth,
2294 ovalHeight,
2295 pp);
2296 Py_INCREF(Py_None);
2297 _res = Py_None;
2298 return _res;
2299}
2300
2301static PyObject *Qd_FillCArc(_self, _args)
2302 PyObject *_self;
2303 PyObject *_args;
2304{
2305 PyObject *_res = NULL;
2306 Rect r;
2307 short startAngle;
2308 short arcAngle;
2309 PixPatHandle pp;
2310 if (!PyArg_ParseTuple(_args, "O&hhO&",
2311 PyMac_GetRect, &r,
2312 &startAngle,
2313 &arcAngle,
2314 ResObj_Convert, &pp))
2315 return NULL;
2316 FillCArc(&r,
2317 startAngle,
2318 arcAngle,
2319 pp);
2320 Py_INCREF(Py_None);
2321 _res = Py_None;
2322 return _res;
2323}
2324
2325static PyObject *Qd_FillCRgn(_self, _args)
2326 PyObject *_self;
2327 PyObject *_args;
2328{
2329 PyObject *_res = NULL;
2330 RgnHandle rgn;
2331 PixPatHandle pp;
2332 if (!PyArg_ParseTuple(_args, "O&O&",
2333 ResObj_Convert, &rgn,
2334 ResObj_Convert, &pp))
2335 return NULL;
2336 FillCRgn(rgn,
2337 pp);
2338 Py_INCREF(Py_None);
2339 _res = Py_None;
2340 return _res;
2341}
2342
2343static PyObject *Qd_FillCPoly(_self, _args)
2344 PyObject *_self;
2345 PyObject *_args;
2346{
2347 PyObject *_res = NULL;
2348 PolyHandle poly;
2349 PixPatHandle pp;
2350 if (!PyArg_ParseTuple(_args, "O&O&",
2351 ResObj_Convert, &poly,
2352 ResObj_Convert, &pp))
2353 return NULL;
2354 FillCPoly(poly,
2355 pp);
2356 Py_INCREF(Py_None);
2357 _res = Py_None;
2358 return _res;
2359}
2360
2361static PyObject *Qd_SetPortPix(_self, _args)
2362 PyObject *_self;
2363 PyObject *_args;
2364{
2365 PyObject *_res = NULL;
2366 PixMapHandle pm;
2367 if (!PyArg_ParseTuple(_args, "O&",
2368 ResObj_Convert, &pm))
2369 return NULL;
2370 SetPortPix(pm);
2371 Py_INCREF(Py_None);
2372 _res = Py_None;
2373 return _res;
2374}
2375
2376static PyObject *Qd_AllocCursor(_self, _args)
2377 PyObject *_self;
2378 PyObject *_args;
2379{
2380 PyObject *_res = NULL;
2381 if (!PyArg_ParseTuple(_args, ""))
2382 return NULL;
2383 AllocCursor();
2384 Py_INCREF(Py_None);
2385 _res = Py_None;
2386 return _res;
2387}
2388
Guido van Rossume56db431995-03-19 22:49:50 +00002389static PyObject *Qd_GetCTSeed(_self, _args)
2390 PyObject *_self;
2391 PyObject *_args;
2392{
2393 PyObject *_res = NULL;
2394 long _rv;
2395 if (!PyArg_ParseTuple(_args, ""))
2396 return NULL;
2397 _rv = GetCTSeed();
2398 _res = Py_BuildValue("l",
2399 _rv);
2400 return _res;
2401}
2402
Guido van Rossume56db431995-03-19 22:49:50 +00002403static PyObject *Qd_SetClientID(_self, _args)
2404 PyObject *_self;
2405 PyObject *_args;
2406{
2407 PyObject *_res = NULL;
2408 short id;
2409 if (!PyArg_ParseTuple(_args, "h",
2410 &id))
2411 return NULL;
2412 SetClientID(id);
2413 Py_INCREF(Py_None);
2414 _res = Py_None;
2415 return _res;
2416}
2417
2418static PyObject *Qd_ProtectEntry(_self, _args)
2419 PyObject *_self;
2420 PyObject *_args;
2421{
2422 PyObject *_res = NULL;
2423 short index;
2424 Boolean protect;
2425 if (!PyArg_ParseTuple(_args, "hb",
2426 &index,
2427 &protect))
2428 return NULL;
2429 ProtectEntry(index,
2430 protect);
2431 Py_INCREF(Py_None);
2432 _res = Py_None;
2433 return _res;
2434}
2435
2436static PyObject *Qd_ReserveEntry(_self, _args)
2437 PyObject *_self;
2438 PyObject *_args;
2439{
2440 PyObject *_res = NULL;
2441 short index;
2442 Boolean reserve;
2443 if (!PyArg_ParseTuple(_args, "hb",
2444 &index,
2445 &reserve))
2446 return NULL;
2447 ReserveEntry(index,
2448 reserve);
2449 Py_INCREF(Py_None);
2450 _res = Py_None;
2451 return _res;
2452}
2453
2454static PyObject *Qd_QDError(_self, _args)
2455 PyObject *_self;
2456 PyObject *_args;
2457{
2458 PyObject *_res = NULL;
2459 short _rv;
2460 if (!PyArg_ParseTuple(_args, ""))
2461 return NULL;
2462 _rv = QDError();
2463 _res = Py_BuildValue("h",
2464 _rv);
2465 return _res;
2466}
2467
Jack Jansen41058c01995-11-16 22:48:29 +00002468static PyObject *Qd_CopyDeepMask(_self, _args)
2469 PyObject *_self;
2470 PyObject *_args;
2471{
2472 PyObject *_res = NULL;
2473 BitMapPtr srcBits;
2474 BitMapPtr maskBits;
2475 BitMapPtr dstBits;
2476 Rect srcRect;
2477 Rect maskRect;
2478 Rect dstRect;
2479 short mode;
2480 RgnHandle maskRgn;
2481 if (!PyArg_ParseTuple(_args, "O&O&O&O&O&O&hO&",
2482 BMObj_Convert, &srcBits,
2483 BMObj_Convert, &maskBits,
2484 BMObj_Convert, &dstBits,
2485 PyMac_GetRect, &srcRect,
2486 PyMac_GetRect, &maskRect,
2487 PyMac_GetRect, &dstRect,
2488 &mode,
2489 ResObj_Convert, &maskRgn))
2490 return NULL;
2491 CopyDeepMask(srcBits,
2492 maskBits,
2493 dstBits,
2494 &srcRect,
2495 &maskRect,
2496 &dstRect,
2497 mode,
2498 maskRgn);
2499 Py_INCREF(Py_None);
2500 _res = Py_None;
2501 return _res;
2502}
2503
Jack Jansen54c8f7e1995-11-14 10:46:01 +00002504static PyObject *Qd_GetPattern(_self, _args)
2505 PyObject *_self;
2506 PyObject *_args;
2507{
2508 PyObject *_res = NULL;
2509 PatHandle _rv;
2510 short patternID;
2511 if (!PyArg_ParseTuple(_args, "h",
2512 &patternID))
2513 return NULL;
2514 _rv = GetPattern(patternID);
2515 _res = Py_BuildValue("O&",
2516 ResObj_New, _rv);
2517 return _res;
2518}
2519
2520static PyObject *Qd_GetCursor(_self, _args)
2521 PyObject *_self;
2522 PyObject *_args;
2523{
2524 PyObject *_res = NULL;
2525 CursHandle _rv;
2526 short cursorID;
2527 if (!PyArg_ParseTuple(_args, "h",
2528 &cursorID))
2529 return NULL;
2530 _rv = GetCursor(cursorID);
2531 _res = Py_BuildValue("O&",
2532 ResObj_New, _rv);
2533 return _res;
2534}
2535
2536static PyObject *Qd_GetPicture(_self, _args)
2537 PyObject *_self;
2538 PyObject *_args;
2539{
2540 PyObject *_res = NULL;
2541 PicHandle _rv;
2542 short pictureID;
2543 if (!PyArg_ParseTuple(_args, "h",
2544 &pictureID))
2545 return NULL;
2546 _rv = GetPicture(pictureID);
2547 _res = Py_BuildValue("O&",
2548 ResObj_New, _rv);
2549 return _res;
2550}
2551
2552static PyObject *Qd_DeltaPoint(_self, _args)
2553 PyObject *_self;
2554 PyObject *_args;
2555{
2556 PyObject *_res = NULL;
2557 long _rv;
2558 Point ptA;
2559 Point ptB;
2560 if (!PyArg_ParseTuple(_args, "O&O&",
2561 PyMac_GetPoint, &ptA,
2562 PyMac_GetPoint, &ptB))
2563 return NULL;
2564 _rv = DeltaPoint(ptA,
2565 ptB);
2566 _res = Py_BuildValue("l",
2567 _rv);
2568 return _res;
2569}
2570
2571static PyObject *Qd_ShieldCursor(_self, _args)
2572 PyObject *_self;
2573 PyObject *_args;
2574{
2575 PyObject *_res = NULL;
2576 Rect shieldRect;
2577 Point offsetPt;
2578 if (!PyArg_ParseTuple(_args, "O&O&",
2579 PyMac_GetRect, &shieldRect,
2580 PyMac_GetPoint, &offsetPt))
2581 return NULL;
2582 ShieldCursor(&shieldRect,
2583 offsetPt);
2584 Py_INCREF(Py_None);
2585 _res = Py_None;
2586 return _res;
2587}
2588
2589static PyObject *Qd_ScreenRes(_self, _args)
2590 PyObject *_self;
2591 PyObject *_args;
2592{
2593 PyObject *_res = NULL;
2594 short scrnHRes;
2595 short scrnVRes;
2596 if (!PyArg_ParseTuple(_args, ""))
2597 return NULL;
2598 ScreenRes(&scrnHRes,
2599 &scrnVRes);
2600 _res = Py_BuildValue("hh",
2601 scrnHRes,
2602 scrnVRes);
2603 return _res;
2604}
2605
Jack Jansenb81cf9d1995-06-06 13:08:40 +00002606static PyObject *Qd_TextFont(_self, _args)
2607 PyObject *_self;
2608 PyObject *_args;
2609{
2610 PyObject *_res = NULL;
2611 short font;
2612 if (!PyArg_ParseTuple(_args, "h",
2613 &font))
2614 return NULL;
2615 TextFont(font);
2616 Py_INCREF(Py_None);
2617 _res = Py_None;
2618 return _res;
2619}
2620
2621static PyObject *Qd_TextFace(_self, _args)
2622 PyObject *_self;
2623 PyObject *_args;
2624{
2625 PyObject *_res = NULL;
2626 short face;
2627 if (!PyArg_ParseTuple(_args, "h",
2628 &face))
2629 return NULL;
2630 TextFace(face);
2631 Py_INCREF(Py_None);
2632 _res = Py_None;
2633 return _res;
2634}
2635
2636static PyObject *Qd_TextMode(_self, _args)
2637 PyObject *_self;
2638 PyObject *_args;
2639{
2640 PyObject *_res = NULL;
2641 short mode;
2642 if (!PyArg_ParseTuple(_args, "h",
2643 &mode))
2644 return NULL;
2645 TextMode(mode);
2646 Py_INCREF(Py_None);
2647 _res = Py_None;
2648 return _res;
2649}
2650
2651static PyObject *Qd_TextSize(_self, _args)
2652 PyObject *_self;
2653 PyObject *_args;
2654{
2655 PyObject *_res = NULL;
2656 short size;
2657 if (!PyArg_ParseTuple(_args, "h",
2658 &size))
2659 return NULL;
2660 TextSize(size);
2661 Py_INCREF(Py_None);
2662 _res = Py_None;
2663 return _res;
2664}
2665
2666static PyObject *Qd_SpaceExtra(_self, _args)
2667 PyObject *_self;
2668 PyObject *_args;
2669{
2670 PyObject *_res = NULL;
Jack Jansen330381c1995-11-15 15:18:01 +00002671 Fixed extra;
2672 if (!PyArg_ParseTuple(_args, "O&",
2673 PyMac_GetFixed, &extra))
Jack Jansenb81cf9d1995-06-06 13:08:40 +00002674 return NULL;
2675 SpaceExtra(extra);
2676 Py_INCREF(Py_None);
2677 _res = Py_None;
2678 return _res;
2679}
2680
2681static PyObject *Qd_DrawChar(_self, _args)
2682 PyObject *_self;
2683 PyObject *_args;
2684{
2685 PyObject *_res = NULL;
2686 short ch;
2687 if (!PyArg_ParseTuple(_args, "h",
2688 &ch))
2689 return NULL;
2690 DrawChar(ch);
2691 Py_INCREF(Py_None);
2692 _res = Py_None;
2693 return _res;
2694}
2695
2696static PyObject *Qd_DrawString(_self, _args)
2697 PyObject *_self;
2698 PyObject *_args;
2699{
2700 PyObject *_res = NULL;
2701 Str255 s;
2702 if (!PyArg_ParseTuple(_args, "O&",
2703 PyMac_GetStr255, s))
2704 return NULL;
2705 DrawString(s);
2706 Py_INCREF(Py_None);
2707 _res = Py_None;
2708 return _res;
2709}
2710
2711static PyObject *Qd_DrawText(_self, _args)
2712 PyObject *_self;
2713 PyObject *_args;
2714{
2715 PyObject *_res = NULL;
2716 char *textBuf__in__;
2717 int textBuf__len__;
2718 int textBuf__in_len__;
2719 short firstByte;
2720 short byteCount;
2721 if (!PyArg_ParseTuple(_args, "s#hh",
2722 &textBuf__in__, &textBuf__in_len__,
2723 &firstByte,
2724 &byteCount))
2725 return NULL;
2726 DrawText(textBuf__in__,
2727 firstByte,
2728 byteCount);
2729 Py_INCREF(Py_None);
2730 _res = Py_None;
2731 textBuf__error__: ;
2732 return _res;
2733}
2734
2735static PyObject *Qd_CharWidth(_self, _args)
2736 PyObject *_self;
2737 PyObject *_args;
2738{
2739 PyObject *_res = NULL;
2740 short _rv;
2741 short ch;
2742 if (!PyArg_ParseTuple(_args, "h",
2743 &ch))
2744 return NULL;
2745 _rv = CharWidth(ch);
2746 _res = Py_BuildValue("h",
2747 _rv);
2748 return _res;
2749}
2750
2751static PyObject *Qd_StringWidth(_self, _args)
2752 PyObject *_self;
2753 PyObject *_args;
2754{
2755 PyObject *_res = NULL;
2756 short _rv;
2757 Str255 s;
2758 if (!PyArg_ParseTuple(_args, "O&",
2759 PyMac_GetStr255, s))
2760 return NULL;
2761 _rv = StringWidth(s);
2762 _res = Py_BuildValue("h",
2763 _rv);
2764 return _res;
2765}
2766
2767static PyObject *Qd_TextWidth(_self, _args)
2768 PyObject *_self;
2769 PyObject *_args;
2770{
2771 PyObject *_res = NULL;
2772 short _rv;
2773 char *textBuf__in__;
2774 int textBuf__len__;
2775 int textBuf__in_len__;
2776 short firstByte;
2777 short byteCount;
2778 if (!PyArg_ParseTuple(_args, "s#hh",
2779 &textBuf__in__, &textBuf__in_len__,
2780 &firstByte,
2781 &byteCount))
2782 return NULL;
2783 _rv = TextWidth(textBuf__in__,
2784 firstByte,
2785 byteCount);
2786 _res = Py_BuildValue("h",
2787 _rv);
2788 textBuf__error__: ;
2789 return _res;
2790}
2791
2792static PyObject *Qd_CharExtra(_self, _args)
2793 PyObject *_self;
2794 PyObject *_args;
2795{
2796 PyObject *_res = NULL;
Jack Jansen330381c1995-11-15 15:18:01 +00002797 Fixed extra;
2798 if (!PyArg_ParseTuple(_args, "O&",
2799 PyMac_GetFixed, &extra))
Jack Jansenb81cf9d1995-06-06 13:08:40 +00002800 return NULL;
2801 CharExtra(extra);
2802 Py_INCREF(Py_None);
2803 _res = Py_None;
2804 return _res;
2805}
2806
Jack Jansen41058c01995-11-16 22:48:29 +00002807static PyObject *Qd_BitMap(_self, _args)
2808 PyObject *_self;
2809 PyObject *_args;
2810{
2811 PyObject *_res = NULL;
2812
2813 BitMap *ptr;
2814 PyObject *source;
2815 Rect bounds;
2816 int rowbytes;
2817 char *data;
2818
2819 if ( !PyArg_ParseTuple(_args, "O!iO&", &PyString_Type, &source, &rowbytes, PyMac_GetRect,
2820 &bounds) )
2821 return NULL;
2822 data = PyString_AsString(source);
2823 if ((ptr=(BitMap *)malloc(sizeof(BitMap))) == NULL )
2824 return PyErr_NoMemory();
2825 ptr->baseAddr = (Ptr)data;
2826 ptr->rowBytes = rowbytes;
2827 ptr->bounds = bounds;
2828 if ( (_res = BMObj_New(ptr)) == NULL ) {
2829 free(ptr);
2830 return NULL;
2831 }
2832 ((BitMapObject *)_res)->referred_object = source;
2833 Py_INCREF(source);
2834 ((BitMapObject *)_res)->referred_bitmap = ptr;
2835 return _res;
2836
2837}
2838
Guido van Rossum17448e21995-01-30 11:53:55 +00002839static PyMethodDef Qd_methods[] = {
Guido van Rossum17448e21995-01-30 11:53:55 +00002840 {"SetPort", (PyCFunction)Qd_SetPort, 1,
Jack Jansen330381c1995-11-15 15:18:01 +00002841 "(GrafPtr port) -> None"},
Guido van Rossume56db431995-03-19 22:49:50 +00002842 {"GetPort", (PyCFunction)Qd_GetPort, 1,
Jack Jansen330381c1995-11-15 15:18:01 +00002843 "() -> (GrafPtr port)"},
Guido van Rossume56db431995-03-19 22:49:50 +00002844 {"GrafDevice", (PyCFunction)Qd_GrafDevice, 1,
2845 "(short device) -> None"},
Jack Jansen41058c01995-11-16 22:48:29 +00002846 {"SetPortBits", (PyCFunction)Qd_SetPortBits, 1,
2847 "(BitMapPtr bm) -> None"},
Guido van Rossume56db431995-03-19 22:49:50 +00002848 {"PortSize", (PyCFunction)Qd_PortSize, 1,
2849 "(short width, short height) -> None"},
2850 {"MovePortTo", (PyCFunction)Qd_MovePortTo, 1,
2851 "(short leftGlobal, short topGlobal) -> None"},
2852 {"SetOrigin", (PyCFunction)Qd_SetOrigin, 1,
2853 "(short h, short v) -> None"},
2854 {"SetClip", (PyCFunction)Qd_SetClip, 1,
2855 "(RgnHandle rgn) -> None"},
2856 {"GetClip", (PyCFunction)Qd_GetClip, 1,
2857 "(RgnHandle rgn) -> None"},
Guido van Rossum17448e21995-01-30 11:53:55 +00002858 {"ClipRect", (PyCFunction)Qd_ClipRect, 1,
2859 "(Rect r) -> None"},
Guido van Rossume56db431995-03-19 22:49:50 +00002860 {"InitCursor", (PyCFunction)Qd_InitCursor, 1,
2861 "() -> None"},
2862 {"HideCursor", (PyCFunction)Qd_HideCursor, 1,
2863 "() -> None"},
2864 {"ShowCursor", (PyCFunction)Qd_ShowCursor, 1,
2865 "() -> None"},
2866 {"ObscureCursor", (PyCFunction)Qd_ObscureCursor, 1,
2867 "() -> None"},
2868 {"HidePen", (PyCFunction)Qd_HidePen, 1,
2869 "() -> None"},
2870 {"ShowPen", (PyCFunction)Qd_ShowPen, 1,
2871 "() -> None"},
2872 {"GetPen", (PyCFunction)Qd_GetPen, 1,
2873 "(Point pt) -> (Point pt)"},
2874 {"PenSize", (PyCFunction)Qd_PenSize, 1,
2875 "(short width, short height) -> None"},
2876 {"PenMode", (PyCFunction)Qd_PenMode, 1,
2877 "(short mode) -> None"},
2878 {"PenNormal", (PyCFunction)Qd_PenNormal, 1,
2879 "() -> None"},
2880 {"MoveTo", (PyCFunction)Qd_MoveTo, 1,
2881 "(short h, short v) -> None"},
2882 {"Move", (PyCFunction)Qd_Move, 1,
2883 "(short dh, short dv) -> None"},
2884 {"LineTo", (PyCFunction)Qd_LineTo, 1,
2885 "(short h, short v) -> None"},
2886 {"Line", (PyCFunction)Qd_Line, 1,
2887 "(short dh, short dv) -> None"},
Guido van Rossume56db431995-03-19 22:49:50 +00002888 {"ForeColor", (PyCFunction)Qd_ForeColor, 1,
2889 "(long color) -> None"},
2890 {"BackColor", (PyCFunction)Qd_BackColor, 1,
2891 "(long color) -> None"},
2892 {"ColorBit", (PyCFunction)Qd_ColorBit, 1,
2893 "(short whichBit) -> None"},
2894 {"SetRect", (PyCFunction)Qd_SetRect, 1,
2895 "(short left, short top, short right, short bottom) -> (Rect r)"},
2896 {"OffsetRect", (PyCFunction)Qd_OffsetRect, 1,
Jack Jansen54c8f7e1995-11-14 10:46:01 +00002897 "(Rect r, short dh, short dv) -> (Rect r)"},
Guido van Rossume56db431995-03-19 22:49:50 +00002898 {"InsetRect", (PyCFunction)Qd_InsetRect, 1,
Jack Jansen54c8f7e1995-11-14 10:46:01 +00002899 "(Rect r, short dh, short dv) -> (Rect r)"},
Guido van Rossume56db431995-03-19 22:49:50 +00002900 {"SectRect", (PyCFunction)Qd_SectRect, 1,
2901 "(Rect src1, Rect src2) -> (Boolean _rv, Rect dstRect)"},
2902 {"UnionRect", (PyCFunction)Qd_UnionRect, 1,
2903 "(Rect src1, Rect src2) -> (Rect dstRect)"},
2904 {"EqualRect", (PyCFunction)Qd_EqualRect, 1,
2905 "(Rect rect1, Rect rect2) -> (Boolean _rv)"},
2906 {"EmptyRect", (PyCFunction)Qd_EmptyRect, 1,
2907 "(Rect r) -> (Boolean _rv)"},
2908 {"FrameRect", (PyCFunction)Qd_FrameRect, 1,
2909 "(Rect r) -> None"},
2910 {"PaintRect", (PyCFunction)Qd_PaintRect, 1,
2911 "(Rect r) -> None"},
Guido van Rossum17448e21995-01-30 11:53:55 +00002912 {"EraseRect", (PyCFunction)Qd_EraseRect, 1,
2913 "(Rect r) -> None"},
Guido van Rossume56db431995-03-19 22:49:50 +00002914 {"InvertRect", (PyCFunction)Qd_InvertRect, 1,
2915 "(Rect r) -> None"},
2916 {"FrameOval", (PyCFunction)Qd_FrameOval, 1,
2917 "(Rect r) -> None"},
2918 {"PaintOval", (PyCFunction)Qd_PaintOval, 1,
2919 "(Rect r) -> None"},
2920 {"EraseOval", (PyCFunction)Qd_EraseOval, 1,
2921 "(Rect r) -> None"},
2922 {"InvertOval", (PyCFunction)Qd_InvertOval, 1,
2923 "(Rect r) -> None"},
2924 {"FrameRoundRect", (PyCFunction)Qd_FrameRoundRect, 1,
2925 "(Rect r, short ovalWidth, short ovalHeight) -> None"},
2926 {"PaintRoundRect", (PyCFunction)Qd_PaintRoundRect, 1,
2927 "(Rect r, short ovalWidth, short ovalHeight) -> None"},
2928 {"EraseRoundRect", (PyCFunction)Qd_EraseRoundRect, 1,
2929 "(Rect r, short ovalWidth, short ovalHeight) -> None"},
2930 {"InvertRoundRect", (PyCFunction)Qd_InvertRoundRect, 1,
2931 "(Rect r, short ovalWidth, short ovalHeight) -> None"},
2932 {"FrameArc", (PyCFunction)Qd_FrameArc, 1,
2933 "(Rect r, short startAngle, short arcAngle) -> None"},
2934 {"PaintArc", (PyCFunction)Qd_PaintArc, 1,
2935 "(Rect r, short startAngle, short arcAngle) -> None"},
2936 {"EraseArc", (PyCFunction)Qd_EraseArc, 1,
2937 "(Rect r, short startAngle, short arcAngle) -> None"},
2938 {"InvertArc", (PyCFunction)Qd_InvertArc, 1,
2939 "(Rect r, short startAngle, short arcAngle) -> None"},
2940 {"NewRgn", (PyCFunction)Qd_NewRgn, 1,
2941 "() -> (RgnHandle _rv)"},
2942 {"OpenRgn", (PyCFunction)Qd_OpenRgn, 1,
2943 "() -> None"},
2944 {"CloseRgn", (PyCFunction)Qd_CloseRgn, 1,
2945 "(RgnHandle dstRgn) -> None"},
Jack Jansen41058c01995-11-16 22:48:29 +00002946 {"BitMapToRegion", (PyCFunction)Qd_BitMapToRegion, 1,
2947 "(RgnHandle region, BitMapPtr bMap) -> None"},
Guido van Rossume56db431995-03-19 22:49:50 +00002948 {"DisposeRgn", (PyCFunction)Qd_DisposeRgn, 1,
2949 "(RgnHandle rgn) -> None"},
2950 {"CopyRgn", (PyCFunction)Qd_CopyRgn, 1,
2951 "(RgnHandle srcRgn, RgnHandle dstRgn) -> None"},
2952 {"SetEmptyRgn", (PyCFunction)Qd_SetEmptyRgn, 1,
2953 "(RgnHandle rgn) -> None"},
2954 {"SetRectRgn", (PyCFunction)Qd_SetRectRgn, 1,
2955 "(RgnHandle rgn, short left, short top, short right, short bottom) -> None"},
2956 {"RectRgn", (PyCFunction)Qd_RectRgn, 1,
2957 "(RgnHandle rgn, Rect r) -> None"},
2958 {"OffsetRgn", (PyCFunction)Qd_OffsetRgn, 1,
2959 "(RgnHandle rgn, short dh, short dv) -> None"},
2960 {"InsetRgn", (PyCFunction)Qd_InsetRgn, 1,
2961 "(RgnHandle rgn, short dh, short dv) -> None"},
2962 {"SectRgn", (PyCFunction)Qd_SectRgn, 1,
2963 "(RgnHandle srcRgnA, RgnHandle srcRgnB, RgnHandle dstRgn) -> None"},
2964 {"UnionRgn", (PyCFunction)Qd_UnionRgn, 1,
2965 "(RgnHandle srcRgnA, RgnHandle srcRgnB, RgnHandle dstRgn) -> None"},
2966 {"DiffRgn", (PyCFunction)Qd_DiffRgn, 1,
2967 "(RgnHandle srcRgnA, RgnHandle srcRgnB, RgnHandle dstRgn) -> None"},
2968 {"XorRgn", (PyCFunction)Qd_XorRgn, 1,
2969 "(RgnHandle srcRgnA, RgnHandle srcRgnB, RgnHandle dstRgn) -> None"},
2970 {"RectInRgn", (PyCFunction)Qd_RectInRgn, 1,
2971 "(Rect r, RgnHandle rgn) -> (Boolean _rv)"},
2972 {"EqualRgn", (PyCFunction)Qd_EqualRgn, 1,
2973 "(RgnHandle rgnA, RgnHandle rgnB) -> (Boolean _rv)"},
2974 {"EmptyRgn", (PyCFunction)Qd_EmptyRgn, 1,
2975 "(RgnHandle rgn) -> (Boolean _rv)"},
2976 {"FrameRgn", (PyCFunction)Qd_FrameRgn, 1,
2977 "(RgnHandle rgn) -> None"},
2978 {"PaintRgn", (PyCFunction)Qd_PaintRgn, 1,
2979 "(RgnHandle rgn) -> None"},
2980 {"EraseRgn", (PyCFunction)Qd_EraseRgn, 1,
2981 "(RgnHandle rgn) -> None"},
2982 {"InvertRgn", (PyCFunction)Qd_InvertRgn, 1,
2983 "(RgnHandle rgn) -> None"},
2984 {"ScrollRect", (PyCFunction)Qd_ScrollRect, 1,
2985 "(Rect r, short dh, short dv, RgnHandle updateRgn) -> None"},
Jack Jansen41058c01995-11-16 22:48:29 +00002986 {"CopyBits", (PyCFunction)Qd_CopyBits, 1,
2987 "(BitMapPtr srcBits, BitMapPtr dstBits, Rect srcRect, Rect dstRect, short mode, RgnHandle maskRgn) -> None"},
2988 {"CopyMask", (PyCFunction)Qd_CopyMask, 1,
2989 "(BitMapPtr srcBits, BitMapPtr maskBits, BitMapPtr dstBits, Rect srcRect, Rect maskRect, Rect dstRect) -> None"},
Guido van Rossume56db431995-03-19 22:49:50 +00002990 {"OpenPicture", (PyCFunction)Qd_OpenPicture, 1,
2991 "(Rect picFrame) -> (PicHandle _rv)"},
2992 {"PicComment", (PyCFunction)Qd_PicComment, 1,
2993 "(short kind, short dataSize, Handle dataHandle) -> None"},
2994 {"ClosePicture", (PyCFunction)Qd_ClosePicture, 1,
2995 "() -> None"},
2996 {"DrawPicture", (PyCFunction)Qd_DrawPicture, 1,
2997 "(PicHandle myPicture, Rect dstRect) -> None"},
2998 {"KillPicture", (PyCFunction)Qd_KillPicture, 1,
2999 "(PicHandle myPicture) -> None"},
3000 {"OpenPoly", (PyCFunction)Qd_OpenPoly, 1,
3001 "() -> (PolyHandle _rv)"},
3002 {"ClosePoly", (PyCFunction)Qd_ClosePoly, 1,
3003 "() -> None"},
3004 {"KillPoly", (PyCFunction)Qd_KillPoly, 1,
3005 "(PolyHandle poly) -> None"},
3006 {"OffsetPoly", (PyCFunction)Qd_OffsetPoly, 1,
3007 "(PolyHandle poly, short dh, short dv) -> None"},
3008 {"FramePoly", (PyCFunction)Qd_FramePoly, 1,
3009 "(PolyHandle poly) -> None"},
3010 {"PaintPoly", (PyCFunction)Qd_PaintPoly, 1,
3011 "(PolyHandle poly) -> None"},
3012 {"ErasePoly", (PyCFunction)Qd_ErasePoly, 1,
3013 "(PolyHandle poly) -> None"},
3014 {"InvertPoly", (PyCFunction)Qd_InvertPoly, 1,
3015 "(PolyHandle poly) -> None"},
3016 {"SetPt", (PyCFunction)Qd_SetPt, 1,
3017 "(Point pt, short h, short v) -> (Point pt)"},
3018 {"LocalToGlobal", (PyCFunction)Qd_LocalToGlobal, 1,
3019 "(Point pt) -> (Point pt)"},
3020 {"GlobalToLocal", (PyCFunction)Qd_GlobalToLocal, 1,
3021 "(Point pt) -> (Point pt)"},
3022 {"Random", (PyCFunction)Qd_Random, 1,
3023 "() -> (short _rv)"},
3024 {"GetPixel", (PyCFunction)Qd_GetPixel, 1,
3025 "(short h, short v) -> (Boolean _rv)"},
3026 {"ScalePt", (PyCFunction)Qd_ScalePt, 1,
3027 "(Point pt, Rect srcRect, Rect dstRect) -> (Point pt)"},
3028 {"MapPt", (PyCFunction)Qd_MapPt, 1,
3029 "(Point pt, Rect srcRect, Rect dstRect) -> (Point pt)"},
3030 {"MapRect", (PyCFunction)Qd_MapRect, 1,
Jack Jansen54c8f7e1995-11-14 10:46:01 +00003031 "(Rect r, Rect srcRect, Rect dstRect) -> (Rect r)"},
Guido van Rossume56db431995-03-19 22:49:50 +00003032 {"MapRgn", (PyCFunction)Qd_MapRgn, 1,
3033 "(RgnHandle rgn, Rect srcRect, Rect dstRect) -> None"},
3034 {"MapPoly", (PyCFunction)Qd_MapPoly, 1,
3035 "(PolyHandle poly, Rect srcRect, Rect dstRect) -> None"},
Jack Jansen41058c01995-11-16 22:48:29 +00003036 {"StdBits", (PyCFunction)Qd_StdBits, 1,
3037 "(BitMapPtr srcBits, Rect srcRect, Rect dstRect, short mode, RgnHandle maskRgn) -> None"},
Guido van Rossume56db431995-03-19 22:49:50 +00003038 {"AddPt", (PyCFunction)Qd_AddPt, 1,
3039 "(Point src, Point dst) -> (Point dst)"},
3040 {"EqualPt", (PyCFunction)Qd_EqualPt, 1,
3041 "(Point pt1, Point pt2) -> (Boolean _rv)"},
3042 {"PtInRect", (PyCFunction)Qd_PtInRect, 1,
3043 "(Point pt, Rect r) -> (Boolean _rv)"},
3044 {"Pt2Rect", (PyCFunction)Qd_Pt2Rect, 1,
3045 "(Point pt1, Point pt2) -> (Rect dstRect)"},
3046 {"PtToAngle", (PyCFunction)Qd_PtToAngle, 1,
3047 "(Rect r, Point pt) -> (short angle)"},
Jack Jansenb81cf9d1995-06-06 13:08:40 +00003048 {"SubPt", (PyCFunction)Qd_SubPt, 1,
3049 "(Point src, Point dst) -> (Point dst)"},
Guido van Rossume56db431995-03-19 22:49:50 +00003050 {"PtInRgn", (PyCFunction)Qd_PtInRgn, 1,
3051 "(Point pt, RgnHandle rgn) -> (Boolean _rv)"},
3052 {"NewPixMap", (PyCFunction)Qd_NewPixMap, 1,
3053 "() -> (PixMapHandle _rv)"},
Guido van Rossume56db431995-03-19 22:49:50 +00003054 {"DisposePixMap", (PyCFunction)Qd_DisposePixMap, 1,
3055 "(PixMapHandle pm) -> None"},
3056 {"CopyPixMap", (PyCFunction)Qd_CopyPixMap, 1,
3057 "(PixMapHandle srcPM, PixMapHandle dstPM) -> None"},
3058 {"NewPixPat", (PyCFunction)Qd_NewPixPat, 1,
3059 "() -> (PixPatHandle _rv)"},
Guido van Rossume56db431995-03-19 22:49:50 +00003060 {"DisposePixPat", (PyCFunction)Qd_DisposePixPat, 1,
3061 "(PixPatHandle pp) -> None"},
3062 {"CopyPixPat", (PyCFunction)Qd_CopyPixPat, 1,
3063 "(PixPatHandle srcPP, PixPatHandle dstPP) -> None"},
3064 {"PenPixPat", (PyCFunction)Qd_PenPixPat, 1,
3065 "(PixPatHandle pp) -> None"},
3066 {"BackPixPat", (PyCFunction)Qd_BackPixPat, 1,
3067 "(PixPatHandle pp) -> None"},
3068 {"GetPixPat", (PyCFunction)Qd_GetPixPat, 1,
3069 "(short patID) -> (PixPatHandle _rv)"},
3070 {"FillCRect", (PyCFunction)Qd_FillCRect, 1,
3071 "(Rect r, PixPatHandle pp) -> None"},
3072 {"FillCOval", (PyCFunction)Qd_FillCOval, 1,
3073 "(Rect r, PixPatHandle pp) -> None"},
3074 {"FillCRoundRect", (PyCFunction)Qd_FillCRoundRect, 1,
3075 "(Rect r, short ovalWidth, short ovalHeight, PixPatHandle pp) -> None"},
3076 {"FillCArc", (PyCFunction)Qd_FillCArc, 1,
3077 "(Rect r, short startAngle, short arcAngle, PixPatHandle pp) -> None"},
3078 {"FillCRgn", (PyCFunction)Qd_FillCRgn, 1,
3079 "(RgnHandle rgn, PixPatHandle pp) -> None"},
3080 {"FillCPoly", (PyCFunction)Qd_FillCPoly, 1,
3081 "(PolyHandle poly, PixPatHandle pp) -> None"},
3082 {"SetPortPix", (PyCFunction)Qd_SetPortPix, 1,
3083 "(PixMapHandle pm) -> None"},
3084 {"AllocCursor", (PyCFunction)Qd_AllocCursor, 1,
3085 "() -> None"},
Guido van Rossume56db431995-03-19 22:49:50 +00003086 {"GetCTSeed", (PyCFunction)Qd_GetCTSeed, 1,
3087 "() -> (long _rv)"},
Guido van Rossume56db431995-03-19 22:49:50 +00003088 {"SetClientID", (PyCFunction)Qd_SetClientID, 1,
3089 "(short id) -> None"},
3090 {"ProtectEntry", (PyCFunction)Qd_ProtectEntry, 1,
3091 "(short index, Boolean protect) -> None"},
3092 {"ReserveEntry", (PyCFunction)Qd_ReserveEntry, 1,
3093 "(short index, Boolean reserve) -> None"},
3094 {"QDError", (PyCFunction)Qd_QDError, 1,
3095 "() -> (short _rv)"},
Jack Jansen41058c01995-11-16 22:48:29 +00003096 {"CopyDeepMask", (PyCFunction)Qd_CopyDeepMask, 1,
3097 "(BitMapPtr srcBits, BitMapPtr maskBits, BitMapPtr dstBits, Rect srcRect, Rect maskRect, Rect dstRect, short mode, RgnHandle maskRgn) -> None"},
Jack Jansen54c8f7e1995-11-14 10:46:01 +00003098 {"GetPattern", (PyCFunction)Qd_GetPattern, 1,
3099 "(short patternID) -> (PatHandle _rv)"},
3100 {"GetCursor", (PyCFunction)Qd_GetCursor, 1,
3101 "(short cursorID) -> (CursHandle _rv)"},
3102 {"GetPicture", (PyCFunction)Qd_GetPicture, 1,
3103 "(short pictureID) -> (PicHandle _rv)"},
3104 {"DeltaPoint", (PyCFunction)Qd_DeltaPoint, 1,
3105 "(Point ptA, Point ptB) -> (long _rv)"},
3106 {"ShieldCursor", (PyCFunction)Qd_ShieldCursor, 1,
3107 "(Rect shieldRect, Point offsetPt) -> None"},
3108 {"ScreenRes", (PyCFunction)Qd_ScreenRes, 1,
3109 "() -> (short scrnHRes, short scrnVRes)"},
Jack Jansenb81cf9d1995-06-06 13:08:40 +00003110 {"TextFont", (PyCFunction)Qd_TextFont, 1,
3111 "(short font) -> None"},
3112 {"TextFace", (PyCFunction)Qd_TextFace, 1,
3113 "(short face) -> None"},
3114 {"TextMode", (PyCFunction)Qd_TextMode, 1,
3115 "(short mode) -> None"},
3116 {"TextSize", (PyCFunction)Qd_TextSize, 1,
3117 "(short size) -> None"},
3118 {"SpaceExtra", (PyCFunction)Qd_SpaceExtra, 1,
Jack Jansen330381c1995-11-15 15:18:01 +00003119 "(Fixed extra) -> None"},
Jack Jansenb81cf9d1995-06-06 13:08:40 +00003120 {"DrawChar", (PyCFunction)Qd_DrawChar, 1,
3121 "(short ch) -> None"},
3122 {"DrawString", (PyCFunction)Qd_DrawString, 1,
3123 "(Str255 s) -> None"},
3124 {"DrawText", (PyCFunction)Qd_DrawText, 1,
3125 "(Buffer textBuf, short firstByte, short byteCount) -> None"},
3126 {"CharWidth", (PyCFunction)Qd_CharWidth, 1,
3127 "(short ch) -> (short _rv)"},
3128 {"StringWidth", (PyCFunction)Qd_StringWidth, 1,
3129 "(Str255 s) -> (short _rv)"},
3130 {"TextWidth", (PyCFunction)Qd_TextWidth, 1,
3131 "(Buffer textBuf, short firstByte, short byteCount) -> (short _rv)"},
3132 {"CharExtra", (PyCFunction)Qd_CharExtra, 1,
Jack Jansen330381c1995-11-15 15:18:01 +00003133 "(Fixed extra) -> None"},
Jack Jansen41058c01995-11-16 22:48:29 +00003134 {"BitMap", (PyCFunction)Qd_BitMap, 1,
3135 "Take (string, int, Rect) argument and create BitMap"},
Guido van Rossum17448e21995-01-30 11:53:55 +00003136 {NULL, NULL, 0}
3137};
3138
3139
3140
3141
3142void initQd()
3143{
3144 PyObject *m;
3145 PyObject *d;
3146
3147
3148
3149
3150 m = Py_InitModule("Qd", Qd_methods);
3151 d = PyModule_GetDict(m);
3152 Qd_Error = PyMac_GetOSErrException();
3153 if (Qd_Error == NULL ||
3154 PyDict_SetItemString(d, "Error", Qd_Error) != 0)
3155 Py_FatalError("can't initialize Qd.Error");
3156}
3157
3158/* ========================= End module Qd ========================== */
3159