blob: c1e5c8ef674367bcf86a9c7ed610d8e2f3607363 [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 *);
18
19extern PyObject *WinObj_New(WindowPtr);
20extern int WinObj_Convert(PyObject *, WindowPtr *);
21
22extern PyObject *DlgObj_New(DialogPtr);
23extern int DlgObj_Convert(PyObject *, DialogPtr *);
24extern PyTypeObject Dialog_Type;
25#define DlgObj_Check(x) ((x)->ob_type == &Dialog_Type)
26
27extern PyObject *MenuObj_New(MenuHandle);
28extern int MenuObj_Convert(PyObject *, MenuHandle *);
29
30extern PyObject *CtlObj_New(ControlHandle);
31extern int CtlObj_Convert(PyObject *, ControlHandle *);
32
33extern PyObject *WinObj_WhichWindow(WindowPtr);
34
35#include <QuickDraw.h>
36#include <Desk.h>
37
38#define resNotFound -192 /* Can't include <Errors.h> because of Python's "errors.h" */
39
40static PyObject *Qd_Error;
41
Guido van Rossume56db431995-03-19 22:49:50 +000042static PyObject *Qd_OpenPort(_self, _args)
Guido van Rossum17448e21995-01-30 11:53:55 +000043 PyObject *_self;
44 PyObject *_args;
45{
46 PyObject *_res = NULL;
Guido van Rossume56db431995-03-19 22:49:50 +000047 WindowPtr port;
Guido van Rossum17448e21995-01-30 11:53:55 +000048 if (!PyArg_ParseTuple(_args, "O&",
Guido van Rossume56db431995-03-19 22:49:50 +000049 WinObj_Convert, &port))
Guido van Rossum17448e21995-01-30 11:53:55 +000050 return NULL;
Guido van Rossume56db431995-03-19 22:49:50 +000051 OpenPort(port);
52 Py_INCREF(Py_None);
53 _res = Py_None;
Guido van Rossum17448e21995-01-30 11:53:55 +000054 return _res;
55}
56
Guido van Rossume56db431995-03-19 22:49:50 +000057static PyObject *Qd_InitPort(_self, _args)
Guido van Rossum17448e21995-01-30 11:53:55 +000058 PyObject *_self;
59 PyObject *_args;
60{
61 PyObject *_res = NULL;
Guido van Rossume56db431995-03-19 22:49:50 +000062 WindowPtr port;
Guido van Rossum17448e21995-01-30 11:53:55 +000063 if (!PyArg_ParseTuple(_args, "O&",
Guido van Rossume56db431995-03-19 22:49:50 +000064 WinObj_Convert, &port))
Guido van Rossum17448e21995-01-30 11:53:55 +000065 return NULL;
Guido van Rossume56db431995-03-19 22:49:50 +000066 InitPort(port);
67 Py_INCREF(Py_None);
68 _res = Py_None;
69 return _res;
70}
71
72static PyObject *Qd_ClosePort(_self, _args)
73 PyObject *_self;
74 PyObject *_args;
75{
76 PyObject *_res = NULL;
77 WindowPtr port;
78 if (!PyArg_ParseTuple(_args, "O&",
79 WinObj_Convert, &port))
80 return NULL;
81 ClosePort(port);
82 Py_INCREF(Py_None);
83 _res = Py_None;
Guido van Rossum17448e21995-01-30 11:53:55 +000084 return _res;
85}
86
87static PyObject *Qd_SetPort(_self, _args)
88 PyObject *_self;
89 PyObject *_args;
90{
91 PyObject *_res = NULL;
Guido van Rossume56db431995-03-19 22:49:50 +000092 WindowPtr port;
Guido van Rossum17448e21995-01-30 11:53:55 +000093 if (!PyArg_ParseTuple(_args, "O&",
Guido van Rossume56db431995-03-19 22:49:50 +000094 WinObj_Convert, &port))
Guido van Rossum17448e21995-01-30 11:53:55 +000095 return NULL;
Guido van Rossume56db431995-03-19 22:49:50 +000096 SetPort(port);
97 Py_INCREF(Py_None);
98 _res = Py_None;
99 return _res;
100}
101
102static PyObject *Qd_GetPort(_self, _args)
103 PyObject *_self;
104 PyObject *_args;
105{
106 PyObject *_res = NULL;
107 WindowPtr port;
108 if (!PyArg_ParseTuple(_args, ""))
109 return NULL;
110 GetPort(&port);
111 _res = Py_BuildValue("O&",
112 WinObj_New, port);
113 return _res;
114}
115
116static PyObject *Qd_GrafDevice(_self, _args)
117 PyObject *_self;
118 PyObject *_args;
119{
120 PyObject *_res = NULL;
121 short device;
122 if (!PyArg_ParseTuple(_args, "h",
123 &device))
124 return NULL;
125 GrafDevice(device);
126 Py_INCREF(Py_None);
127 _res = Py_None;
128 return _res;
129}
130
131static PyObject *Qd_PortSize(_self, _args)
132 PyObject *_self;
133 PyObject *_args;
134{
135 PyObject *_res = NULL;
136 short width;
137 short height;
138 if (!PyArg_ParseTuple(_args, "hh",
139 &width,
140 &height))
141 return NULL;
142 PortSize(width,
143 height);
144 Py_INCREF(Py_None);
145 _res = Py_None;
146 return _res;
147}
148
149static PyObject *Qd_MovePortTo(_self, _args)
150 PyObject *_self;
151 PyObject *_args;
152{
153 PyObject *_res = NULL;
154 short leftGlobal;
155 short topGlobal;
156 if (!PyArg_ParseTuple(_args, "hh",
157 &leftGlobal,
158 &topGlobal))
159 return NULL;
160 MovePortTo(leftGlobal,
161 topGlobal);
162 Py_INCREF(Py_None);
163 _res = Py_None;
164 return _res;
165}
166
167static PyObject *Qd_SetOrigin(_self, _args)
168 PyObject *_self;
169 PyObject *_args;
170{
171 PyObject *_res = NULL;
172 short h;
173 short v;
174 if (!PyArg_ParseTuple(_args, "hh",
175 &h,
176 &v))
177 return NULL;
178 SetOrigin(h,
179 v);
180 Py_INCREF(Py_None);
181 _res = Py_None;
182 return _res;
183}
184
185static PyObject *Qd_SetClip(_self, _args)
186 PyObject *_self;
187 PyObject *_args;
188{
189 PyObject *_res = NULL;
190 RgnHandle rgn;
191 if (!PyArg_ParseTuple(_args, "O&",
192 ResObj_Convert, &rgn))
193 return NULL;
194 SetClip(rgn);
195 Py_INCREF(Py_None);
196 _res = Py_None;
197 return _res;
198}
199
200static PyObject *Qd_GetClip(_self, _args)
201 PyObject *_self;
202 PyObject *_args;
203{
204 PyObject *_res = NULL;
205 RgnHandle rgn;
206 if (!PyArg_ParseTuple(_args, "O&",
207 ResObj_Convert, &rgn))
208 return NULL;
209 GetClip(rgn);
Guido van Rossum17448e21995-01-30 11:53:55 +0000210 Py_INCREF(Py_None);
211 _res = Py_None;
212 return _res;
213}
214
215static PyObject *Qd_ClipRect(_self, _args)
216 PyObject *_self;
217 PyObject *_args;
218{
219 PyObject *_res = NULL;
220 Rect r;
221 if (!PyArg_ParseTuple(_args, "O&",
222 PyMac_GetRect, &r))
223 return NULL;
224 ClipRect(&r);
225 Py_INCREF(Py_None);
226 _res = Py_None;
227 return _res;
228}
229
Guido van Rossume56db431995-03-19 22:49:50 +0000230static PyObject *Qd_InitCursor(_self, _args)
231 PyObject *_self;
232 PyObject *_args;
233{
234 PyObject *_res = NULL;
235 if (!PyArg_ParseTuple(_args, ""))
236 return NULL;
237 InitCursor();
238 Py_INCREF(Py_None);
239 _res = Py_None;
240 return _res;
241}
242
243static PyObject *Qd_HideCursor(_self, _args)
244 PyObject *_self;
245 PyObject *_args;
246{
247 PyObject *_res = NULL;
248 if (!PyArg_ParseTuple(_args, ""))
249 return NULL;
250 HideCursor();
251 Py_INCREF(Py_None);
252 _res = Py_None;
253 return _res;
254}
255
256static PyObject *Qd_ShowCursor(_self, _args)
257 PyObject *_self;
258 PyObject *_args;
259{
260 PyObject *_res = NULL;
261 if (!PyArg_ParseTuple(_args, ""))
262 return NULL;
263 ShowCursor();
264 Py_INCREF(Py_None);
265 _res = Py_None;
266 return _res;
267}
268
269static PyObject *Qd_ObscureCursor(_self, _args)
270 PyObject *_self;
271 PyObject *_args;
272{
273 PyObject *_res = NULL;
274 if (!PyArg_ParseTuple(_args, ""))
275 return NULL;
276 ObscureCursor();
277 Py_INCREF(Py_None);
278 _res = Py_None;
279 return _res;
280}
281
282static PyObject *Qd_HidePen(_self, _args)
283 PyObject *_self;
284 PyObject *_args;
285{
286 PyObject *_res = NULL;
287 if (!PyArg_ParseTuple(_args, ""))
288 return NULL;
289 HidePen();
290 Py_INCREF(Py_None);
291 _res = Py_None;
292 return _res;
293}
294
295static PyObject *Qd_ShowPen(_self, _args)
296 PyObject *_self;
297 PyObject *_args;
298{
299 PyObject *_res = NULL;
300 if (!PyArg_ParseTuple(_args, ""))
301 return NULL;
302 ShowPen();
303 Py_INCREF(Py_None);
304 _res = Py_None;
305 return _res;
306}
307
308static PyObject *Qd_GetPen(_self, _args)
309 PyObject *_self;
310 PyObject *_args;
311{
312 PyObject *_res = NULL;
313 Point pt;
314 if (!PyArg_ParseTuple(_args, "O&",
315 PyMac_GetPoint, &pt))
316 return NULL;
317 GetPen(&pt);
318 _res = Py_BuildValue("O&",
319 PyMac_BuildPoint, pt);
320 return _res;
321}
322
323static PyObject *Qd_PenSize(_self, _args)
324 PyObject *_self;
325 PyObject *_args;
326{
327 PyObject *_res = NULL;
328 short width;
329 short height;
330 if (!PyArg_ParseTuple(_args, "hh",
331 &width,
332 &height))
333 return NULL;
334 PenSize(width,
335 height);
336 Py_INCREF(Py_None);
337 _res = Py_None;
338 return _res;
339}
340
341static PyObject *Qd_PenMode(_self, _args)
342 PyObject *_self;
343 PyObject *_args;
344{
345 PyObject *_res = NULL;
346 short mode;
347 if (!PyArg_ParseTuple(_args, "h",
348 &mode))
349 return NULL;
350 PenMode(mode);
351 Py_INCREF(Py_None);
352 _res = Py_None;
353 return _res;
354}
355
356static PyObject *Qd_PenNormal(_self, _args)
357 PyObject *_self;
358 PyObject *_args;
359{
360 PyObject *_res = NULL;
361 if (!PyArg_ParseTuple(_args, ""))
362 return NULL;
363 PenNormal();
364 Py_INCREF(Py_None);
365 _res = Py_None;
366 return _res;
367}
368
369static PyObject *Qd_MoveTo(_self, _args)
370 PyObject *_self;
371 PyObject *_args;
372{
373 PyObject *_res = NULL;
374 short h;
375 short v;
376 if (!PyArg_ParseTuple(_args, "hh",
377 &h,
378 &v))
379 return NULL;
380 MoveTo(h,
381 v);
382 Py_INCREF(Py_None);
383 _res = Py_None;
384 return _res;
385}
386
387static PyObject *Qd_Move(_self, _args)
388 PyObject *_self;
389 PyObject *_args;
390{
391 PyObject *_res = NULL;
392 short dh;
393 short dv;
394 if (!PyArg_ParseTuple(_args, "hh",
395 &dh,
396 &dv))
397 return NULL;
398 Move(dh,
399 dv);
400 Py_INCREF(Py_None);
401 _res = Py_None;
402 return _res;
403}
404
405static PyObject *Qd_LineTo(_self, _args)
406 PyObject *_self;
407 PyObject *_args;
408{
409 PyObject *_res = NULL;
410 short h;
411 short v;
412 if (!PyArg_ParseTuple(_args, "hh",
413 &h,
414 &v))
415 return NULL;
416 LineTo(h,
417 v);
418 Py_INCREF(Py_None);
419 _res = Py_None;
420 return _res;
421}
422
423static PyObject *Qd_Line(_self, _args)
424 PyObject *_self;
425 PyObject *_args;
426{
427 PyObject *_res = NULL;
428 short dh;
429 short dv;
430 if (!PyArg_ParseTuple(_args, "hh",
431 &dh,
432 &dv))
433 return NULL;
434 Line(dh,
435 dv);
436 Py_INCREF(Py_None);
437 _res = Py_None;
438 return _res;
439}
440
Guido van Rossume56db431995-03-19 22:49:50 +0000441static PyObject *Qd_ForeColor(_self, _args)
442 PyObject *_self;
443 PyObject *_args;
444{
445 PyObject *_res = NULL;
446 long color;
447 if (!PyArg_ParseTuple(_args, "l",
448 &color))
449 return NULL;
450 ForeColor(color);
451 Py_INCREF(Py_None);
452 _res = Py_None;
453 return _res;
454}
455
456static PyObject *Qd_BackColor(_self, _args)
457 PyObject *_self;
458 PyObject *_args;
459{
460 PyObject *_res = NULL;
461 long color;
462 if (!PyArg_ParseTuple(_args, "l",
463 &color))
464 return NULL;
465 BackColor(color);
466 Py_INCREF(Py_None);
467 _res = Py_None;
468 return _res;
469}
470
471static PyObject *Qd_ColorBit(_self, _args)
472 PyObject *_self;
473 PyObject *_args;
474{
475 PyObject *_res = NULL;
476 short whichBit;
477 if (!PyArg_ParseTuple(_args, "h",
478 &whichBit))
479 return NULL;
480 ColorBit(whichBit);
481 Py_INCREF(Py_None);
482 _res = Py_None;
483 return _res;
484}
485
486static PyObject *Qd_SetRect(_self, _args)
487 PyObject *_self;
488 PyObject *_args;
489{
490 PyObject *_res = NULL;
491 Rect r;
492 short left;
493 short top;
494 short right;
495 short bottom;
496 if (!PyArg_ParseTuple(_args, "hhhh",
497 &left,
498 &top,
499 &right,
500 &bottom))
501 return NULL;
502 SetRect(&r,
503 left,
504 top,
505 right,
506 bottom);
507 _res = Py_BuildValue("O&",
508 PyMac_BuildRect, &r);
509 return _res;
510}
511
512static PyObject *Qd_OffsetRect(_self, _args)
513 PyObject *_self;
514 PyObject *_args;
515{
516 PyObject *_res = NULL;
517 Rect r;
518 short dh;
519 short dv;
520 if (!PyArg_ParseTuple(_args, "hh",
521 &dh,
522 &dv))
523 return NULL;
524 OffsetRect(&r,
525 dh,
526 dv);
527 _res = Py_BuildValue("O&",
528 PyMac_BuildRect, &r);
529 return _res;
530}
531
532static PyObject *Qd_InsetRect(_self, _args)
533 PyObject *_self;
534 PyObject *_args;
535{
536 PyObject *_res = NULL;
537 Rect r;
538 short dh;
539 short dv;
540 if (!PyArg_ParseTuple(_args, "hh",
541 &dh,
542 &dv))
543 return NULL;
544 InsetRect(&r,
545 dh,
546 dv);
547 _res = Py_BuildValue("O&",
548 PyMac_BuildRect, &r);
549 return _res;
550}
551
552static PyObject *Qd_SectRect(_self, _args)
553 PyObject *_self;
554 PyObject *_args;
555{
556 PyObject *_res = NULL;
557 Boolean _rv;
558 Rect src1;
559 Rect src2;
560 Rect dstRect;
561 if (!PyArg_ParseTuple(_args, "O&O&",
562 PyMac_GetRect, &src1,
563 PyMac_GetRect, &src2))
564 return NULL;
565 _rv = SectRect(&src1,
566 &src2,
567 &dstRect);
568 _res = Py_BuildValue("bO&",
569 _rv,
570 PyMac_BuildRect, &dstRect);
571 return _res;
572}
573
574static PyObject *Qd_UnionRect(_self, _args)
575 PyObject *_self;
576 PyObject *_args;
577{
578 PyObject *_res = NULL;
579 Rect src1;
580 Rect src2;
581 Rect dstRect;
582 if (!PyArg_ParseTuple(_args, "O&O&",
583 PyMac_GetRect, &src1,
584 PyMac_GetRect, &src2))
585 return NULL;
586 UnionRect(&src1,
587 &src2,
588 &dstRect);
589 _res = Py_BuildValue("O&",
590 PyMac_BuildRect, &dstRect);
591 return _res;
592}
593
594static PyObject *Qd_EqualRect(_self, _args)
595 PyObject *_self;
596 PyObject *_args;
597{
598 PyObject *_res = NULL;
599 Boolean _rv;
600 Rect rect1;
601 Rect rect2;
602 if (!PyArg_ParseTuple(_args, "O&O&",
603 PyMac_GetRect, &rect1,
604 PyMac_GetRect, &rect2))
605 return NULL;
606 _rv = EqualRect(&rect1,
607 &rect2);
608 _res = Py_BuildValue("b",
609 _rv);
610 return _res;
611}
612
613static PyObject *Qd_EmptyRect(_self, _args)
614 PyObject *_self;
615 PyObject *_args;
616{
617 PyObject *_res = NULL;
618 Boolean _rv;
619 Rect r;
620 if (!PyArg_ParseTuple(_args, "O&",
621 PyMac_GetRect, &r))
622 return NULL;
623 _rv = EmptyRect(&r);
624 _res = Py_BuildValue("b",
625 _rv);
626 return _res;
627}
628
629static PyObject *Qd_FrameRect(_self, _args)
630 PyObject *_self;
631 PyObject *_args;
632{
633 PyObject *_res = NULL;
634 Rect r;
635 if (!PyArg_ParseTuple(_args, "O&",
636 PyMac_GetRect, &r))
637 return NULL;
638 FrameRect(&r);
639 Py_INCREF(Py_None);
640 _res = Py_None;
641 return _res;
642}
643
644static PyObject *Qd_PaintRect(_self, _args)
645 PyObject *_self;
646 PyObject *_args;
647{
648 PyObject *_res = NULL;
649 Rect r;
650 if (!PyArg_ParseTuple(_args, "O&",
651 PyMac_GetRect, &r))
652 return NULL;
653 PaintRect(&r);
654 Py_INCREF(Py_None);
655 _res = Py_None;
656 return _res;
657}
658
Guido van Rossum17448e21995-01-30 11:53:55 +0000659static PyObject *Qd_EraseRect(_self, _args)
660 PyObject *_self;
661 PyObject *_args;
662{
663 PyObject *_res = NULL;
664 Rect r;
665 if (!PyArg_ParseTuple(_args, "O&",
666 PyMac_GetRect, &r))
667 return NULL;
668 EraseRect(&r);
669 Py_INCREF(Py_None);
670 _res = Py_None;
671 return _res;
672}
673
Guido van Rossume56db431995-03-19 22:49:50 +0000674static PyObject *Qd_InvertRect(_self, _args)
Guido van Rossum17448e21995-01-30 11:53:55 +0000675 PyObject *_self;
676 PyObject *_args;
677{
678 PyObject *_res = NULL;
Guido van Rossume56db431995-03-19 22:49:50 +0000679 Rect r;
Guido van Rossum17448e21995-01-30 11:53:55 +0000680 if (!PyArg_ParseTuple(_args, "O&",
Guido van Rossume56db431995-03-19 22:49:50 +0000681 PyMac_GetRect, &r))
Guido van Rossum17448e21995-01-30 11:53:55 +0000682 return NULL;
Guido van Rossume56db431995-03-19 22:49:50 +0000683 InvertRect(&r);
Guido van Rossum17448e21995-01-30 11:53:55 +0000684 Py_INCREF(Py_None);
685 _res = Py_None;
686 return _res;
687}
688
Guido van Rossume56db431995-03-19 22:49:50 +0000689static PyObject *Qd_FrameOval(_self, _args)
690 PyObject *_self;
691 PyObject *_args;
692{
693 PyObject *_res = NULL;
694 Rect r;
695 if (!PyArg_ParseTuple(_args, "O&",
696 PyMac_GetRect, &r))
697 return NULL;
698 FrameOval(&r);
699 Py_INCREF(Py_None);
700 _res = Py_None;
701 return _res;
702}
703
704static PyObject *Qd_PaintOval(_self, _args)
705 PyObject *_self;
706 PyObject *_args;
707{
708 PyObject *_res = NULL;
709 Rect r;
710 if (!PyArg_ParseTuple(_args, "O&",
711 PyMac_GetRect, &r))
712 return NULL;
713 PaintOval(&r);
714 Py_INCREF(Py_None);
715 _res = Py_None;
716 return _res;
717}
718
719static PyObject *Qd_EraseOval(_self, _args)
720 PyObject *_self;
721 PyObject *_args;
722{
723 PyObject *_res = NULL;
724 Rect r;
725 if (!PyArg_ParseTuple(_args, "O&",
726 PyMac_GetRect, &r))
727 return NULL;
728 EraseOval(&r);
729 Py_INCREF(Py_None);
730 _res = Py_None;
731 return _res;
732}
733
734static PyObject *Qd_InvertOval(_self, _args)
735 PyObject *_self;
736 PyObject *_args;
737{
738 PyObject *_res = NULL;
739 Rect r;
740 if (!PyArg_ParseTuple(_args, "O&",
741 PyMac_GetRect, &r))
742 return NULL;
743 InvertOval(&r);
744 Py_INCREF(Py_None);
745 _res = Py_None;
746 return _res;
747}
748
749static PyObject *Qd_FrameRoundRect(_self, _args)
750 PyObject *_self;
751 PyObject *_args;
752{
753 PyObject *_res = NULL;
754 Rect r;
755 short ovalWidth;
756 short ovalHeight;
757 if (!PyArg_ParseTuple(_args, "O&hh",
758 PyMac_GetRect, &r,
759 &ovalWidth,
760 &ovalHeight))
761 return NULL;
762 FrameRoundRect(&r,
763 ovalWidth,
764 ovalHeight);
765 Py_INCREF(Py_None);
766 _res = Py_None;
767 return _res;
768}
769
770static PyObject *Qd_PaintRoundRect(_self, _args)
771 PyObject *_self;
772 PyObject *_args;
773{
774 PyObject *_res = NULL;
775 Rect r;
776 short ovalWidth;
777 short ovalHeight;
778 if (!PyArg_ParseTuple(_args, "O&hh",
779 PyMac_GetRect, &r,
780 &ovalWidth,
781 &ovalHeight))
782 return NULL;
783 PaintRoundRect(&r,
784 ovalWidth,
785 ovalHeight);
786 Py_INCREF(Py_None);
787 _res = Py_None;
788 return _res;
789}
790
791static PyObject *Qd_EraseRoundRect(_self, _args)
792 PyObject *_self;
793 PyObject *_args;
794{
795 PyObject *_res = NULL;
796 Rect r;
797 short ovalWidth;
798 short ovalHeight;
799 if (!PyArg_ParseTuple(_args, "O&hh",
800 PyMac_GetRect, &r,
801 &ovalWidth,
802 &ovalHeight))
803 return NULL;
804 EraseRoundRect(&r,
805 ovalWidth,
806 ovalHeight);
807 Py_INCREF(Py_None);
808 _res = Py_None;
809 return _res;
810}
811
812static PyObject *Qd_InvertRoundRect(_self, _args)
813 PyObject *_self;
814 PyObject *_args;
815{
816 PyObject *_res = NULL;
817 Rect r;
818 short ovalWidth;
819 short ovalHeight;
820 if (!PyArg_ParseTuple(_args, "O&hh",
821 PyMac_GetRect, &r,
822 &ovalWidth,
823 &ovalHeight))
824 return NULL;
825 InvertRoundRect(&r,
826 ovalWidth,
827 ovalHeight);
828 Py_INCREF(Py_None);
829 _res = Py_None;
830 return _res;
831}
832
833static PyObject *Qd_FrameArc(_self, _args)
834 PyObject *_self;
835 PyObject *_args;
836{
837 PyObject *_res = NULL;
838 Rect r;
839 short startAngle;
840 short arcAngle;
841 if (!PyArg_ParseTuple(_args, "O&hh",
842 PyMac_GetRect, &r,
843 &startAngle,
844 &arcAngle))
845 return NULL;
846 FrameArc(&r,
847 startAngle,
848 arcAngle);
849 Py_INCREF(Py_None);
850 _res = Py_None;
851 return _res;
852}
853
854static PyObject *Qd_PaintArc(_self, _args)
855 PyObject *_self;
856 PyObject *_args;
857{
858 PyObject *_res = NULL;
859 Rect r;
860 short startAngle;
861 short arcAngle;
862 if (!PyArg_ParseTuple(_args, "O&hh",
863 PyMac_GetRect, &r,
864 &startAngle,
865 &arcAngle))
866 return NULL;
867 PaintArc(&r,
868 startAngle,
869 arcAngle);
870 Py_INCREF(Py_None);
871 _res = Py_None;
872 return _res;
873}
874
875static PyObject *Qd_EraseArc(_self, _args)
876 PyObject *_self;
877 PyObject *_args;
878{
879 PyObject *_res = NULL;
880 Rect r;
881 short startAngle;
882 short arcAngle;
883 if (!PyArg_ParseTuple(_args, "O&hh",
884 PyMac_GetRect, &r,
885 &startAngle,
886 &arcAngle))
887 return NULL;
888 EraseArc(&r,
889 startAngle,
890 arcAngle);
891 Py_INCREF(Py_None);
892 _res = Py_None;
893 return _res;
894}
895
896static PyObject *Qd_InvertArc(_self, _args)
897 PyObject *_self;
898 PyObject *_args;
899{
900 PyObject *_res = NULL;
901 Rect r;
902 short startAngle;
903 short arcAngle;
904 if (!PyArg_ParseTuple(_args, "O&hh",
905 PyMac_GetRect, &r,
906 &startAngle,
907 &arcAngle))
908 return NULL;
909 InvertArc(&r,
910 startAngle,
911 arcAngle);
912 Py_INCREF(Py_None);
913 _res = Py_None;
914 return _res;
915}
916
917static PyObject *Qd_NewRgn(_self, _args)
918 PyObject *_self;
919 PyObject *_args;
920{
921 PyObject *_res = NULL;
922 RgnHandle _rv;
923 if (!PyArg_ParseTuple(_args, ""))
924 return NULL;
925 _rv = NewRgn();
926 _res = Py_BuildValue("O&",
927 ResObj_New, _rv);
928 return _res;
929}
930
931static PyObject *Qd_OpenRgn(_self, _args)
932 PyObject *_self;
933 PyObject *_args;
934{
935 PyObject *_res = NULL;
936 if (!PyArg_ParseTuple(_args, ""))
937 return NULL;
938 OpenRgn();
939 Py_INCREF(Py_None);
940 _res = Py_None;
941 return _res;
942}
943
944static PyObject *Qd_CloseRgn(_self, _args)
945 PyObject *_self;
946 PyObject *_args;
947{
948 PyObject *_res = NULL;
949 RgnHandle dstRgn;
950 if (!PyArg_ParseTuple(_args, "O&",
951 ResObj_Convert, &dstRgn))
952 return NULL;
953 CloseRgn(dstRgn);
954 Py_INCREF(Py_None);
955 _res = Py_None;
956 return _res;
957}
958
959static PyObject *Qd_DisposeRgn(_self, _args)
960 PyObject *_self;
961 PyObject *_args;
962{
963 PyObject *_res = NULL;
964 RgnHandle rgn;
965 if (!PyArg_ParseTuple(_args, "O&",
966 ResObj_Convert, &rgn))
967 return NULL;
968 DisposeRgn(rgn);
969 Py_INCREF(Py_None);
970 _res = Py_None;
971 return _res;
972}
973
974static PyObject *Qd_CopyRgn(_self, _args)
975 PyObject *_self;
976 PyObject *_args;
977{
978 PyObject *_res = NULL;
979 RgnHandle srcRgn;
980 RgnHandle dstRgn;
981 if (!PyArg_ParseTuple(_args, "O&O&",
982 ResObj_Convert, &srcRgn,
983 ResObj_Convert, &dstRgn))
984 return NULL;
985 CopyRgn(srcRgn,
986 dstRgn);
987 Py_INCREF(Py_None);
988 _res = Py_None;
989 return _res;
990}
991
992static PyObject *Qd_SetEmptyRgn(_self, _args)
993 PyObject *_self;
994 PyObject *_args;
995{
996 PyObject *_res = NULL;
997 RgnHandle rgn;
998 if (!PyArg_ParseTuple(_args, "O&",
999 ResObj_Convert, &rgn))
1000 return NULL;
1001 SetEmptyRgn(rgn);
1002 Py_INCREF(Py_None);
1003 _res = Py_None;
1004 return _res;
1005}
1006
1007static PyObject *Qd_SetRectRgn(_self, _args)
1008 PyObject *_self;
1009 PyObject *_args;
1010{
1011 PyObject *_res = NULL;
1012 RgnHandle rgn;
1013 short left;
1014 short top;
1015 short right;
1016 short bottom;
1017 if (!PyArg_ParseTuple(_args, "O&hhhh",
1018 ResObj_Convert, &rgn,
1019 &left,
1020 &top,
1021 &right,
1022 &bottom))
1023 return NULL;
1024 SetRectRgn(rgn,
1025 left,
1026 top,
1027 right,
1028 bottom);
1029 Py_INCREF(Py_None);
1030 _res = Py_None;
1031 return _res;
1032}
1033
1034static PyObject *Qd_RectRgn(_self, _args)
1035 PyObject *_self;
1036 PyObject *_args;
1037{
1038 PyObject *_res = NULL;
1039 RgnHandle rgn;
1040 Rect r;
1041 if (!PyArg_ParseTuple(_args, "O&O&",
1042 ResObj_Convert, &rgn,
1043 PyMac_GetRect, &r))
1044 return NULL;
1045 RectRgn(rgn,
1046 &r);
1047 Py_INCREF(Py_None);
1048 _res = Py_None;
1049 return _res;
1050}
1051
1052static PyObject *Qd_OffsetRgn(_self, _args)
1053 PyObject *_self;
1054 PyObject *_args;
1055{
1056 PyObject *_res = NULL;
1057 RgnHandle rgn;
1058 short dh;
1059 short dv;
1060 if (!PyArg_ParseTuple(_args, "O&hh",
1061 ResObj_Convert, &rgn,
1062 &dh,
1063 &dv))
1064 return NULL;
1065 OffsetRgn(rgn,
1066 dh,
1067 dv);
1068 Py_INCREF(Py_None);
1069 _res = Py_None;
1070 return _res;
1071}
1072
1073static PyObject *Qd_InsetRgn(_self, _args)
1074 PyObject *_self;
1075 PyObject *_args;
1076{
1077 PyObject *_res = NULL;
1078 RgnHandle rgn;
1079 short dh;
1080 short dv;
1081 if (!PyArg_ParseTuple(_args, "O&hh",
1082 ResObj_Convert, &rgn,
1083 &dh,
1084 &dv))
1085 return NULL;
1086 InsetRgn(rgn,
1087 dh,
1088 dv);
1089 Py_INCREF(Py_None);
1090 _res = Py_None;
1091 return _res;
1092}
1093
1094static PyObject *Qd_SectRgn(_self, _args)
1095 PyObject *_self;
1096 PyObject *_args;
1097{
1098 PyObject *_res = NULL;
1099 RgnHandle srcRgnA;
1100 RgnHandle srcRgnB;
1101 RgnHandle dstRgn;
1102 if (!PyArg_ParseTuple(_args, "O&O&O&",
1103 ResObj_Convert, &srcRgnA,
1104 ResObj_Convert, &srcRgnB,
1105 ResObj_Convert, &dstRgn))
1106 return NULL;
1107 SectRgn(srcRgnA,
1108 srcRgnB,
1109 dstRgn);
1110 Py_INCREF(Py_None);
1111 _res = Py_None;
1112 return _res;
1113}
1114
1115static PyObject *Qd_UnionRgn(_self, _args)
1116 PyObject *_self;
1117 PyObject *_args;
1118{
1119 PyObject *_res = NULL;
1120 RgnHandle srcRgnA;
1121 RgnHandle srcRgnB;
1122 RgnHandle dstRgn;
1123 if (!PyArg_ParseTuple(_args, "O&O&O&",
1124 ResObj_Convert, &srcRgnA,
1125 ResObj_Convert, &srcRgnB,
1126 ResObj_Convert, &dstRgn))
1127 return NULL;
1128 UnionRgn(srcRgnA,
1129 srcRgnB,
1130 dstRgn);
1131 Py_INCREF(Py_None);
1132 _res = Py_None;
1133 return _res;
1134}
1135
1136static PyObject *Qd_DiffRgn(_self, _args)
1137 PyObject *_self;
1138 PyObject *_args;
1139{
1140 PyObject *_res = NULL;
1141 RgnHandle srcRgnA;
1142 RgnHandle srcRgnB;
1143 RgnHandle dstRgn;
1144 if (!PyArg_ParseTuple(_args, "O&O&O&",
1145 ResObj_Convert, &srcRgnA,
1146 ResObj_Convert, &srcRgnB,
1147 ResObj_Convert, &dstRgn))
1148 return NULL;
1149 DiffRgn(srcRgnA,
1150 srcRgnB,
1151 dstRgn);
1152 Py_INCREF(Py_None);
1153 _res = Py_None;
1154 return _res;
1155}
1156
1157static PyObject *Qd_XorRgn(_self, _args)
1158 PyObject *_self;
1159 PyObject *_args;
1160{
1161 PyObject *_res = NULL;
1162 RgnHandle srcRgnA;
1163 RgnHandle srcRgnB;
1164 RgnHandle dstRgn;
1165 if (!PyArg_ParseTuple(_args, "O&O&O&",
1166 ResObj_Convert, &srcRgnA,
1167 ResObj_Convert, &srcRgnB,
1168 ResObj_Convert, &dstRgn))
1169 return NULL;
1170 XorRgn(srcRgnA,
1171 srcRgnB,
1172 dstRgn);
1173 Py_INCREF(Py_None);
1174 _res = Py_None;
1175 return _res;
1176}
1177
1178static PyObject *Qd_RectInRgn(_self, _args)
1179 PyObject *_self;
1180 PyObject *_args;
1181{
1182 PyObject *_res = NULL;
1183 Boolean _rv;
1184 Rect r;
1185 RgnHandle rgn;
1186 if (!PyArg_ParseTuple(_args, "O&O&",
1187 PyMac_GetRect, &r,
1188 ResObj_Convert, &rgn))
1189 return NULL;
1190 _rv = RectInRgn(&r,
1191 rgn);
1192 _res = Py_BuildValue("b",
1193 _rv);
1194 return _res;
1195}
1196
1197static PyObject *Qd_EqualRgn(_self, _args)
1198 PyObject *_self;
1199 PyObject *_args;
1200{
1201 PyObject *_res = NULL;
1202 Boolean _rv;
1203 RgnHandle rgnA;
1204 RgnHandle rgnB;
1205 if (!PyArg_ParseTuple(_args, "O&O&",
1206 ResObj_Convert, &rgnA,
1207 ResObj_Convert, &rgnB))
1208 return NULL;
1209 _rv = EqualRgn(rgnA,
1210 rgnB);
1211 _res = Py_BuildValue("b",
1212 _rv);
1213 return _res;
1214}
1215
1216static PyObject *Qd_EmptyRgn(_self, _args)
1217 PyObject *_self;
1218 PyObject *_args;
1219{
1220 PyObject *_res = NULL;
1221 Boolean _rv;
1222 RgnHandle rgn;
1223 if (!PyArg_ParseTuple(_args, "O&",
1224 ResObj_Convert, &rgn))
1225 return NULL;
1226 _rv = EmptyRgn(rgn);
1227 _res = Py_BuildValue("b",
1228 _rv);
1229 return _res;
1230}
1231
1232static PyObject *Qd_FrameRgn(_self, _args)
1233 PyObject *_self;
1234 PyObject *_args;
1235{
1236 PyObject *_res = NULL;
1237 RgnHandle rgn;
1238 if (!PyArg_ParseTuple(_args, "O&",
1239 ResObj_Convert, &rgn))
1240 return NULL;
1241 FrameRgn(rgn);
1242 Py_INCREF(Py_None);
1243 _res = Py_None;
1244 return _res;
1245}
1246
1247static PyObject *Qd_PaintRgn(_self, _args)
1248 PyObject *_self;
1249 PyObject *_args;
1250{
1251 PyObject *_res = NULL;
1252 RgnHandle rgn;
1253 if (!PyArg_ParseTuple(_args, "O&",
1254 ResObj_Convert, &rgn))
1255 return NULL;
1256 PaintRgn(rgn);
1257 Py_INCREF(Py_None);
1258 _res = Py_None;
1259 return _res;
1260}
1261
1262static PyObject *Qd_EraseRgn(_self, _args)
1263 PyObject *_self;
1264 PyObject *_args;
1265{
1266 PyObject *_res = NULL;
1267 RgnHandle rgn;
1268 if (!PyArg_ParseTuple(_args, "O&",
1269 ResObj_Convert, &rgn))
1270 return NULL;
1271 EraseRgn(rgn);
1272 Py_INCREF(Py_None);
1273 _res = Py_None;
1274 return _res;
1275}
1276
1277static PyObject *Qd_InvertRgn(_self, _args)
1278 PyObject *_self;
1279 PyObject *_args;
1280{
1281 PyObject *_res = NULL;
1282 RgnHandle rgn;
1283 if (!PyArg_ParseTuple(_args, "O&",
1284 ResObj_Convert, &rgn))
1285 return NULL;
1286 InvertRgn(rgn);
1287 Py_INCREF(Py_None);
1288 _res = Py_None;
1289 return _res;
1290}
1291
1292static PyObject *Qd_ScrollRect(_self, _args)
1293 PyObject *_self;
1294 PyObject *_args;
1295{
1296 PyObject *_res = NULL;
1297 Rect r;
1298 short dh;
1299 short dv;
1300 RgnHandle updateRgn;
1301 if (!PyArg_ParseTuple(_args, "O&hhO&",
1302 PyMac_GetRect, &r,
1303 &dh,
1304 &dv,
1305 ResObj_Convert, &updateRgn))
1306 return NULL;
1307 ScrollRect(&r,
1308 dh,
1309 dv,
1310 updateRgn);
1311 Py_INCREF(Py_None);
1312 _res = Py_None;
1313 return _res;
1314}
1315
1316static PyObject *Qd_OpenPicture(_self, _args)
1317 PyObject *_self;
1318 PyObject *_args;
1319{
1320 PyObject *_res = NULL;
1321 PicHandle _rv;
1322 Rect picFrame;
1323 if (!PyArg_ParseTuple(_args, "O&",
1324 PyMac_GetRect, &picFrame))
1325 return NULL;
1326 _rv = OpenPicture(&picFrame);
1327 _res = Py_BuildValue("O&",
1328 ResObj_New, _rv);
1329 return _res;
1330}
1331
1332static PyObject *Qd_PicComment(_self, _args)
1333 PyObject *_self;
1334 PyObject *_args;
1335{
1336 PyObject *_res = NULL;
1337 short kind;
1338 short dataSize;
1339 Handle dataHandle;
1340 if (!PyArg_ParseTuple(_args, "hhO&",
1341 &kind,
1342 &dataSize,
1343 ResObj_Convert, &dataHandle))
1344 return NULL;
1345 PicComment(kind,
1346 dataSize,
1347 dataHandle);
1348 Py_INCREF(Py_None);
1349 _res = Py_None;
1350 return _res;
1351}
1352
1353static PyObject *Qd_ClosePicture(_self, _args)
1354 PyObject *_self;
1355 PyObject *_args;
1356{
1357 PyObject *_res = NULL;
1358 if (!PyArg_ParseTuple(_args, ""))
1359 return NULL;
1360 ClosePicture();
1361 Py_INCREF(Py_None);
1362 _res = Py_None;
1363 return _res;
1364}
1365
1366static PyObject *Qd_DrawPicture(_self, _args)
1367 PyObject *_self;
1368 PyObject *_args;
1369{
1370 PyObject *_res = NULL;
1371 PicHandle myPicture;
1372 Rect dstRect;
1373 if (!PyArg_ParseTuple(_args, "O&O&",
1374 ResObj_Convert, &myPicture,
1375 PyMac_GetRect, &dstRect))
1376 return NULL;
1377 DrawPicture(myPicture,
1378 &dstRect);
1379 Py_INCREF(Py_None);
1380 _res = Py_None;
1381 return _res;
1382}
1383
1384static PyObject *Qd_KillPicture(_self, _args)
1385 PyObject *_self;
1386 PyObject *_args;
1387{
1388 PyObject *_res = NULL;
1389 PicHandle myPicture;
1390 if (!PyArg_ParseTuple(_args, "O&",
1391 ResObj_Convert, &myPicture))
1392 return NULL;
1393 KillPicture(myPicture);
1394 Py_INCREF(Py_None);
1395 _res = Py_None;
1396 return _res;
1397}
1398
1399static PyObject *Qd_OpenPoly(_self, _args)
1400 PyObject *_self;
1401 PyObject *_args;
1402{
1403 PyObject *_res = NULL;
1404 PolyHandle _rv;
1405 if (!PyArg_ParseTuple(_args, ""))
1406 return NULL;
1407 _rv = OpenPoly();
1408 _res = Py_BuildValue("O&",
1409 ResObj_New, _rv);
1410 return _res;
1411}
1412
1413static PyObject *Qd_ClosePoly(_self, _args)
1414 PyObject *_self;
1415 PyObject *_args;
1416{
1417 PyObject *_res = NULL;
1418 if (!PyArg_ParseTuple(_args, ""))
1419 return NULL;
1420 ClosePoly();
1421 Py_INCREF(Py_None);
1422 _res = Py_None;
1423 return _res;
1424}
1425
1426static PyObject *Qd_KillPoly(_self, _args)
1427 PyObject *_self;
1428 PyObject *_args;
1429{
1430 PyObject *_res = NULL;
1431 PolyHandle poly;
1432 if (!PyArg_ParseTuple(_args, "O&",
1433 ResObj_Convert, &poly))
1434 return NULL;
1435 KillPoly(poly);
1436 Py_INCREF(Py_None);
1437 _res = Py_None;
1438 return _res;
1439}
1440
1441static PyObject *Qd_OffsetPoly(_self, _args)
1442 PyObject *_self;
1443 PyObject *_args;
1444{
1445 PyObject *_res = NULL;
1446 PolyHandle poly;
1447 short dh;
1448 short dv;
1449 if (!PyArg_ParseTuple(_args, "O&hh",
1450 ResObj_Convert, &poly,
1451 &dh,
1452 &dv))
1453 return NULL;
1454 OffsetPoly(poly,
1455 dh,
1456 dv);
1457 Py_INCREF(Py_None);
1458 _res = Py_None;
1459 return _res;
1460}
1461
1462static PyObject *Qd_FramePoly(_self, _args)
1463 PyObject *_self;
1464 PyObject *_args;
1465{
1466 PyObject *_res = NULL;
1467 PolyHandle poly;
1468 if (!PyArg_ParseTuple(_args, "O&",
1469 ResObj_Convert, &poly))
1470 return NULL;
1471 FramePoly(poly);
1472 Py_INCREF(Py_None);
1473 _res = Py_None;
1474 return _res;
1475}
1476
1477static PyObject *Qd_PaintPoly(_self, _args)
1478 PyObject *_self;
1479 PyObject *_args;
1480{
1481 PyObject *_res = NULL;
1482 PolyHandle poly;
1483 if (!PyArg_ParseTuple(_args, "O&",
1484 ResObj_Convert, &poly))
1485 return NULL;
1486 PaintPoly(poly);
1487 Py_INCREF(Py_None);
1488 _res = Py_None;
1489 return _res;
1490}
1491
1492static PyObject *Qd_ErasePoly(_self, _args)
1493 PyObject *_self;
1494 PyObject *_args;
1495{
1496 PyObject *_res = NULL;
1497 PolyHandle poly;
1498 if (!PyArg_ParseTuple(_args, "O&",
1499 ResObj_Convert, &poly))
1500 return NULL;
1501 ErasePoly(poly);
1502 Py_INCREF(Py_None);
1503 _res = Py_None;
1504 return _res;
1505}
1506
1507static PyObject *Qd_InvertPoly(_self, _args)
1508 PyObject *_self;
1509 PyObject *_args;
1510{
1511 PyObject *_res = NULL;
1512 PolyHandle poly;
1513 if (!PyArg_ParseTuple(_args, "O&",
1514 ResObj_Convert, &poly))
1515 return NULL;
1516 InvertPoly(poly);
1517 Py_INCREF(Py_None);
1518 _res = Py_None;
1519 return _res;
1520}
1521
1522static PyObject *Qd_SetPt(_self, _args)
1523 PyObject *_self;
1524 PyObject *_args;
1525{
1526 PyObject *_res = NULL;
1527 Point pt;
1528 short h;
1529 short v;
1530 if (!PyArg_ParseTuple(_args, "O&hh",
1531 PyMac_GetPoint, &pt,
1532 &h,
1533 &v))
1534 return NULL;
1535 SetPt(&pt,
1536 h,
1537 v);
1538 _res = Py_BuildValue("O&",
1539 PyMac_BuildPoint, pt);
1540 return _res;
1541}
1542
1543static PyObject *Qd_LocalToGlobal(_self, _args)
1544 PyObject *_self;
1545 PyObject *_args;
1546{
1547 PyObject *_res = NULL;
1548 Point pt;
1549 if (!PyArg_ParseTuple(_args, "O&",
1550 PyMac_GetPoint, &pt))
1551 return NULL;
1552 LocalToGlobal(&pt);
1553 _res = Py_BuildValue("O&",
1554 PyMac_BuildPoint, pt);
1555 return _res;
1556}
1557
1558static PyObject *Qd_GlobalToLocal(_self, _args)
1559 PyObject *_self;
1560 PyObject *_args;
1561{
1562 PyObject *_res = NULL;
1563 Point pt;
1564 if (!PyArg_ParseTuple(_args, "O&",
1565 PyMac_GetPoint, &pt))
1566 return NULL;
1567 GlobalToLocal(&pt);
1568 _res = Py_BuildValue("O&",
1569 PyMac_BuildPoint, pt);
1570 return _res;
1571}
1572
1573static PyObject *Qd_Random(_self, _args)
1574 PyObject *_self;
1575 PyObject *_args;
1576{
1577 PyObject *_res = NULL;
1578 short _rv;
1579 if (!PyArg_ParseTuple(_args, ""))
1580 return NULL;
1581 _rv = Random();
1582 _res = Py_BuildValue("h",
1583 _rv);
1584 return _res;
1585}
1586
1587static PyObject *Qd_GetPixel(_self, _args)
1588 PyObject *_self;
1589 PyObject *_args;
1590{
1591 PyObject *_res = NULL;
1592 Boolean _rv;
1593 short h;
1594 short v;
1595 if (!PyArg_ParseTuple(_args, "hh",
1596 &h,
1597 &v))
1598 return NULL;
1599 _rv = GetPixel(h,
1600 v);
1601 _res = Py_BuildValue("b",
1602 _rv);
1603 return _res;
1604}
1605
1606static PyObject *Qd_ScalePt(_self, _args)
1607 PyObject *_self;
1608 PyObject *_args;
1609{
1610 PyObject *_res = NULL;
1611 Point pt;
1612 Rect srcRect;
1613 Rect dstRect;
1614 if (!PyArg_ParseTuple(_args, "O&O&O&",
1615 PyMac_GetPoint, &pt,
1616 PyMac_GetRect, &srcRect,
1617 PyMac_GetRect, &dstRect))
1618 return NULL;
1619 ScalePt(&pt,
1620 &srcRect,
1621 &dstRect);
1622 _res = Py_BuildValue("O&",
1623 PyMac_BuildPoint, pt);
1624 return _res;
1625}
1626
1627static PyObject *Qd_MapPt(_self, _args)
1628 PyObject *_self;
1629 PyObject *_args;
1630{
1631 PyObject *_res = NULL;
1632 Point pt;
1633 Rect srcRect;
1634 Rect dstRect;
1635 if (!PyArg_ParseTuple(_args, "O&O&O&",
1636 PyMac_GetPoint, &pt,
1637 PyMac_GetRect, &srcRect,
1638 PyMac_GetRect, &dstRect))
1639 return NULL;
1640 MapPt(&pt,
1641 &srcRect,
1642 &dstRect);
1643 _res = Py_BuildValue("O&",
1644 PyMac_BuildPoint, pt);
1645 return _res;
1646}
1647
1648static PyObject *Qd_MapRect(_self, _args)
1649 PyObject *_self;
1650 PyObject *_args;
1651{
1652 PyObject *_res = NULL;
1653 Rect r;
1654 Rect srcRect;
1655 Rect dstRect;
1656 if (!PyArg_ParseTuple(_args, "O&O&",
1657 PyMac_GetRect, &srcRect,
1658 PyMac_GetRect, &dstRect))
1659 return NULL;
1660 MapRect(&r,
1661 &srcRect,
1662 &dstRect);
1663 _res = Py_BuildValue("O&",
1664 PyMac_BuildRect, &r);
1665 return _res;
1666}
1667
1668static PyObject *Qd_MapRgn(_self, _args)
1669 PyObject *_self;
1670 PyObject *_args;
1671{
1672 PyObject *_res = NULL;
1673 RgnHandle rgn;
1674 Rect srcRect;
1675 Rect dstRect;
1676 if (!PyArg_ParseTuple(_args, "O&O&O&",
1677 ResObj_Convert, &rgn,
1678 PyMac_GetRect, &srcRect,
1679 PyMac_GetRect, &dstRect))
1680 return NULL;
1681 MapRgn(rgn,
1682 &srcRect,
1683 &dstRect);
1684 Py_INCREF(Py_None);
1685 _res = Py_None;
1686 return _res;
1687}
1688
1689static PyObject *Qd_MapPoly(_self, _args)
1690 PyObject *_self;
1691 PyObject *_args;
1692{
1693 PyObject *_res = NULL;
1694 PolyHandle poly;
1695 Rect srcRect;
1696 Rect dstRect;
1697 if (!PyArg_ParseTuple(_args, "O&O&O&",
1698 ResObj_Convert, &poly,
1699 PyMac_GetRect, &srcRect,
1700 PyMac_GetRect, &dstRect))
1701 return NULL;
1702 MapPoly(poly,
1703 &srcRect,
1704 &dstRect);
1705 Py_INCREF(Py_None);
1706 _res = Py_None;
1707 return _res;
1708}
1709
1710static PyObject *Qd_AddPt(_self, _args)
1711 PyObject *_self;
1712 PyObject *_args;
1713{
1714 PyObject *_res = NULL;
1715 Point src;
1716 Point dst;
1717 if (!PyArg_ParseTuple(_args, "O&O&",
1718 PyMac_GetPoint, &src,
1719 PyMac_GetPoint, &dst))
1720 return NULL;
1721 AddPt(src,
1722 &dst);
1723 _res = Py_BuildValue("O&",
1724 PyMac_BuildPoint, dst);
1725 return _res;
1726}
1727
1728static PyObject *Qd_EqualPt(_self, _args)
1729 PyObject *_self;
1730 PyObject *_args;
1731{
1732 PyObject *_res = NULL;
1733 Boolean _rv;
1734 Point pt1;
1735 Point pt2;
1736 if (!PyArg_ParseTuple(_args, "O&O&",
1737 PyMac_GetPoint, &pt1,
1738 PyMac_GetPoint, &pt2))
1739 return NULL;
1740 _rv = EqualPt(pt1,
1741 pt2);
1742 _res = Py_BuildValue("b",
1743 _rv);
1744 return _res;
1745}
1746
1747static PyObject *Qd_PtInRect(_self, _args)
1748 PyObject *_self;
1749 PyObject *_args;
1750{
1751 PyObject *_res = NULL;
1752 Boolean _rv;
1753 Point pt;
1754 Rect r;
1755 if (!PyArg_ParseTuple(_args, "O&O&",
1756 PyMac_GetPoint, &pt,
1757 PyMac_GetRect, &r))
1758 return NULL;
1759 _rv = PtInRect(pt,
1760 &r);
1761 _res = Py_BuildValue("b",
1762 _rv);
1763 return _res;
1764}
1765
1766static PyObject *Qd_Pt2Rect(_self, _args)
1767 PyObject *_self;
1768 PyObject *_args;
1769{
1770 PyObject *_res = NULL;
1771 Point pt1;
1772 Point pt2;
1773 Rect dstRect;
1774 if (!PyArg_ParseTuple(_args, "O&O&",
1775 PyMac_GetPoint, &pt1,
1776 PyMac_GetPoint, &pt2))
1777 return NULL;
1778 Pt2Rect(pt1,
1779 pt2,
1780 &dstRect);
1781 _res = Py_BuildValue("O&",
1782 PyMac_BuildRect, &dstRect);
1783 return _res;
1784}
1785
1786static PyObject *Qd_PtToAngle(_self, _args)
1787 PyObject *_self;
1788 PyObject *_args;
1789{
1790 PyObject *_res = NULL;
1791 Rect r;
1792 Point pt;
1793 short angle;
1794 if (!PyArg_ParseTuple(_args, "O&O&",
1795 PyMac_GetRect, &r,
1796 PyMac_GetPoint, &pt))
1797 return NULL;
1798 PtToAngle(&r,
1799 pt,
1800 &angle);
1801 _res = Py_BuildValue("h",
1802 angle);
1803 return _res;
1804}
1805
Jack Jansenb81cf9d1995-06-06 13:08:40 +00001806static PyObject *Qd_SubPt(_self, _args)
1807 PyObject *_self;
1808 PyObject *_args;
1809{
1810 PyObject *_res = NULL;
1811 Point src;
1812 Point dst;
1813 if (!PyArg_ParseTuple(_args, "O&O&",
1814 PyMac_GetPoint, &src,
1815 PyMac_GetPoint, &dst))
1816 return NULL;
1817 SubPt(src,
1818 &dst);
1819 _res = Py_BuildValue("O&",
1820 PyMac_BuildPoint, dst);
1821 return _res;
1822}
1823
Guido van Rossume56db431995-03-19 22:49:50 +00001824static PyObject *Qd_PtInRgn(_self, _args)
1825 PyObject *_self;
1826 PyObject *_args;
1827{
1828 PyObject *_res = NULL;
1829 Boolean _rv;
1830 Point pt;
1831 RgnHandle rgn;
1832 if (!PyArg_ParseTuple(_args, "O&O&",
1833 PyMac_GetPoint, &pt,
1834 ResObj_Convert, &rgn))
1835 return NULL;
1836 _rv = PtInRgn(pt,
1837 rgn);
1838 _res = Py_BuildValue("b",
1839 _rv);
1840 return _res;
1841}
1842
1843static PyObject *Qd_NewPixMap(_self, _args)
1844 PyObject *_self;
1845 PyObject *_args;
1846{
1847 PyObject *_res = NULL;
1848 PixMapHandle _rv;
1849 if (!PyArg_ParseTuple(_args, ""))
1850 return NULL;
1851 _rv = NewPixMap();
1852 _res = Py_BuildValue("O&",
1853 ResObj_New, _rv);
1854 return _res;
1855}
1856
Guido van Rossume56db431995-03-19 22:49:50 +00001857static PyObject *Qd_DisposePixMap(_self, _args)
1858 PyObject *_self;
1859 PyObject *_args;
1860{
1861 PyObject *_res = NULL;
1862 PixMapHandle pm;
1863 if (!PyArg_ParseTuple(_args, "O&",
1864 ResObj_Convert, &pm))
1865 return NULL;
1866 DisposePixMap(pm);
1867 Py_INCREF(Py_None);
1868 _res = Py_None;
1869 return _res;
1870}
1871
1872static PyObject *Qd_CopyPixMap(_self, _args)
1873 PyObject *_self;
1874 PyObject *_args;
1875{
1876 PyObject *_res = NULL;
1877 PixMapHandle srcPM;
1878 PixMapHandle dstPM;
1879 if (!PyArg_ParseTuple(_args, "O&O&",
1880 ResObj_Convert, &srcPM,
1881 ResObj_Convert, &dstPM))
1882 return NULL;
1883 CopyPixMap(srcPM,
1884 dstPM);
1885 Py_INCREF(Py_None);
1886 _res = Py_None;
1887 return _res;
1888}
1889
1890static PyObject *Qd_NewPixPat(_self, _args)
1891 PyObject *_self;
1892 PyObject *_args;
1893{
1894 PyObject *_res = NULL;
1895 PixPatHandle _rv;
1896 if (!PyArg_ParseTuple(_args, ""))
1897 return NULL;
1898 _rv = NewPixPat();
1899 _res = Py_BuildValue("O&",
1900 ResObj_New, _rv);
1901 return _res;
1902}
1903
Guido van Rossume56db431995-03-19 22:49:50 +00001904static PyObject *Qd_DisposePixPat(_self, _args)
1905 PyObject *_self;
1906 PyObject *_args;
1907{
1908 PyObject *_res = NULL;
1909 PixPatHandle pp;
1910 if (!PyArg_ParseTuple(_args, "O&",
1911 ResObj_Convert, &pp))
1912 return NULL;
1913 DisposePixPat(pp);
1914 Py_INCREF(Py_None);
1915 _res = Py_None;
1916 return _res;
1917}
1918
1919static PyObject *Qd_CopyPixPat(_self, _args)
1920 PyObject *_self;
1921 PyObject *_args;
1922{
1923 PyObject *_res = NULL;
1924 PixPatHandle srcPP;
1925 PixPatHandle dstPP;
1926 if (!PyArg_ParseTuple(_args, "O&O&",
1927 ResObj_Convert, &srcPP,
1928 ResObj_Convert, &dstPP))
1929 return NULL;
1930 CopyPixPat(srcPP,
1931 dstPP);
1932 Py_INCREF(Py_None);
1933 _res = Py_None;
1934 return _res;
1935}
1936
1937static PyObject *Qd_PenPixPat(_self, _args)
1938 PyObject *_self;
1939 PyObject *_args;
1940{
1941 PyObject *_res = NULL;
1942 PixPatHandle pp;
1943 if (!PyArg_ParseTuple(_args, "O&",
1944 ResObj_Convert, &pp))
1945 return NULL;
1946 PenPixPat(pp);
1947 Py_INCREF(Py_None);
1948 _res = Py_None;
1949 return _res;
1950}
1951
1952static PyObject *Qd_BackPixPat(_self, _args)
1953 PyObject *_self;
1954 PyObject *_args;
1955{
1956 PyObject *_res = NULL;
1957 PixPatHandle pp;
1958 if (!PyArg_ParseTuple(_args, "O&",
1959 ResObj_Convert, &pp))
1960 return NULL;
1961 BackPixPat(pp);
1962 Py_INCREF(Py_None);
1963 _res = Py_None;
1964 return _res;
1965}
1966
1967static PyObject *Qd_GetPixPat(_self, _args)
1968 PyObject *_self;
1969 PyObject *_args;
1970{
1971 PyObject *_res = NULL;
1972 PixPatHandle _rv;
1973 short patID;
1974 if (!PyArg_ParseTuple(_args, "h",
1975 &patID))
1976 return NULL;
1977 _rv = GetPixPat(patID);
1978 _res = Py_BuildValue("O&",
1979 ResObj_New, _rv);
1980 return _res;
1981}
1982
1983static PyObject *Qd_FillCRect(_self, _args)
1984 PyObject *_self;
1985 PyObject *_args;
1986{
1987 PyObject *_res = NULL;
1988 Rect r;
1989 PixPatHandle pp;
1990 if (!PyArg_ParseTuple(_args, "O&O&",
1991 PyMac_GetRect, &r,
1992 ResObj_Convert, &pp))
1993 return NULL;
1994 FillCRect(&r,
1995 pp);
1996 Py_INCREF(Py_None);
1997 _res = Py_None;
1998 return _res;
1999}
2000
2001static PyObject *Qd_FillCOval(_self, _args)
2002 PyObject *_self;
2003 PyObject *_args;
2004{
2005 PyObject *_res = NULL;
2006 Rect r;
2007 PixPatHandle pp;
2008 if (!PyArg_ParseTuple(_args, "O&O&",
2009 PyMac_GetRect, &r,
2010 ResObj_Convert, &pp))
2011 return NULL;
2012 FillCOval(&r,
2013 pp);
2014 Py_INCREF(Py_None);
2015 _res = Py_None;
2016 return _res;
2017}
2018
2019static PyObject *Qd_FillCRoundRect(_self, _args)
2020 PyObject *_self;
2021 PyObject *_args;
2022{
2023 PyObject *_res = NULL;
2024 Rect r;
2025 short ovalWidth;
2026 short ovalHeight;
2027 PixPatHandle pp;
2028 if (!PyArg_ParseTuple(_args, "O&hhO&",
2029 PyMac_GetRect, &r,
2030 &ovalWidth,
2031 &ovalHeight,
2032 ResObj_Convert, &pp))
2033 return NULL;
2034 FillCRoundRect(&r,
2035 ovalWidth,
2036 ovalHeight,
2037 pp);
2038 Py_INCREF(Py_None);
2039 _res = Py_None;
2040 return _res;
2041}
2042
2043static PyObject *Qd_FillCArc(_self, _args)
2044 PyObject *_self;
2045 PyObject *_args;
2046{
2047 PyObject *_res = NULL;
2048 Rect r;
2049 short startAngle;
2050 short arcAngle;
2051 PixPatHandle pp;
2052 if (!PyArg_ParseTuple(_args, "O&hhO&",
2053 PyMac_GetRect, &r,
2054 &startAngle,
2055 &arcAngle,
2056 ResObj_Convert, &pp))
2057 return NULL;
2058 FillCArc(&r,
2059 startAngle,
2060 arcAngle,
2061 pp);
2062 Py_INCREF(Py_None);
2063 _res = Py_None;
2064 return _res;
2065}
2066
2067static PyObject *Qd_FillCRgn(_self, _args)
2068 PyObject *_self;
2069 PyObject *_args;
2070{
2071 PyObject *_res = NULL;
2072 RgnHandle rgn;
2073 PixPatHandle pp;
2074 if (!PyArg_ParseTuple(_args, "O&O&",
2075 ResObj_Convert, &rgn,
2076 ResObj_Convert, &pp))
2077 return NULL;
2078 FillCRgn(rgn,
2079 pp);
2080 Py_INCREF(Py_None);
2081 _res = Py_None;
2082 return _res;
2083}
2084
2085static PyObject *Qd_FillCPoly(_self, _args)
2086 PyObject *_self;
2087 PyObject *_args;
2088{
2089 PyObject *_res = NULL;
2090 PolyHandle poly;
2091 PixPatHandle pp;
2092 if (!PyArg_ParseTuple(_args, "O&O&",
2093 ResObj_Convert, &poly,
2094 ResObj_Convert, &pp))
2095 return NULL;
2096 FillCPoly(poly,
2097 pp);
2098 Py_INCREF(Py_None);
2099 _res = Py_None;
2100 return _res;
2101}
2102
2103static PyObject *Qd_SetPortPix(_self, _args)
2104 PyObject *_self;
2105 PyObject *_args;
2106{
2107 PyObject *_res = NULL;
2108 PixMapHandle pm;
2109 if (!PyArg_ParseTuple(_args, "O&",
2110 ResObj_Convert, &pm))
2111 return NULL;
2112 SetPortPix(pm);
2113 Py_INCREF(Py_None);
2114 _res = Py_None;
2115 return _res;
2116}
2117
2118static PyObject *Qd_AllocCursor(_self, _args)
2119 PyObject *_self;
2120 PyObject *_args;
2121{
2122 PyObject *_res = NULL;
2123 if (!PyArg_ParseTuple(_args, ""))
2124 return NULL;
2125 AllocCursor();
2126 Py_INCREF(Py_None);
2127 _res = Py_None;
2128 return _res;
2129}
2130
Guido van Rossume56db431995-03-19 22:49:50 +00002131static PyObject *Qd_GetCTSeed(_self, _args)
2132 PyObject *_self;
2133 PyObject *_args;
2134{
2135 PyObject *_res = NULL;
2136 long _rv;
2137 if (!PyArg_ParseTuple(_args, ""))
2138 return NULL;
2139 _rv = GetCTSeed();
2140 _res = Py_BuildValue("l",
2141 _rv);
2142 return _res;
2143}
2144
Guido van Rossume56db431995-03-19 22:49:50 +00002145static PyObject *Qd_SetClientID(_self, _args)
2146 PyObject *_self;
2147 PyObject *_args;
2148{
2149 PyObject *_res = NULL;
2150 short id;
2151 if (!PyArg_ParseTuple(_args, "h",
2152 &id))
2153 return NULL;
2154 SetClientID(id);
2155 Py_INCREF(Py_None);
2156 _res = Py_None;
2157 return _res;
2158}
2159
2160static PyObject *Qd_ProtectEntry(_self, _args)
2161 PyObject *_self;
2162 PyObject *_args;
2163{
2164 PyObject *_res = NULL;
2165 short index;
2166 Boolean protect;
2167 if (!PyArg_ParseTuple(_args, "hb",
2168 &index,
2169 &protect))
2170 return NULL;
2171 ProtectEntry(index,
2172 protect);
2173 Py_INCREF(Py_None);
2174 _res = Py_None;
2175 return _res;
2176}
2177
2178static PyObject *Qd_ReserveEntry(_self, _args)
2179 PyObject *_self;
2180 PyObject *_args;
2181{
2182 PyObject *_res = NULL;
2183 short index;
2184 Boolean reserve;
2185 if (!PyArg_ParseTuple(_args, "hb",
2186 &index,
2187 &reserve))
2188 return NULL;
2189 ReserveEntry(index,
2190 reserve);
2191 Py_INCREF(Py_None);
2192 _res = Py_None;
2193 return _res;
2194}
2195
2196static PyObject *Qd_QDError(_self, _args)
2197 PyObject *_self;
2198 PyObject *_args;
2199{
2200 PyObject *_res = NULL;
2201 short _rv;
2202 if (!PyArg_ParseTuple(_args, ""))
2203 return NULL;
2204 _rv = QDError();
2205 _res = Py_BuildValue("h",
2206 _rv);
2207 return _res;
2208}
2209
Jack Jansenb81cf9d1995-06-06 13:08:40 +00002210static PyObject *Qd_TextFont(_self, _args)
2211 PyObject *_self;
2212 PyObject *_args;
2213{
2214 PyObject *_res = NULL;
2215 short font;
2216 if (!PyArg_ParseTuple(_args, "h",
2217 &font))
2218 return NULL;
2219 TextFont(font);
2220 Py_INCREF(Py_None);
2221 _res = Py_None;
2222 return _res;
2223}
2224
2225static PyObject *Qd_TextFace(_self, _args)
2226 PyObject *_self;
2227 PyObject *_args;
2228{
2229 PyObject *_res = NULL;
2230 short face;
2231 if (!PyArg_ParseTuple(_args, "h",
2232 &face))
2233 return NULL;
2234 TextFace(face);
2235 Py_INCREF(Py_None);
2236 _res = Py_None;
2237 return _res;
2238}
2239
2240static PyObject *Qd_TextMode(_self, _args)
2241 PyObject *_self;
2242 PyObject *_args;
2243{
2244 PyObject *_res = NULL;
2245 short mode;
2246 if (!PyArg_ParseTuple(_args, "h",
2247 &mode))
2248 return NULL;
2249 TextMode(mode);
2250 Py_INCREF(Py_None);
2251 _res = Py_None;
2252 return _res;
2253}
2254
2255static PyObject *Qd_TextSize(_self, _args)
2256 PyObject *_self;
2257 PyObject *_args;
2258{
2259 PyObject *_res = NULL;
2260 short size;
2261 if (!PyArg_ParseTuple(_args, "h",
2262 &size))
2263 return NULL;
2264 TextSize(size);
2265 Py_INCREF(Py_None);
2266 _res = Py_None;
2267 return _res;
2268}
2269
2270static PyObject *Qd_SpaceExtra(_self, _args)
2271 PyObject *_self;
2272 PyObject *_args;
2273{
2274 PyObject *_res = NULL;
2275 long extra;
2276 if (!PyArg_ParseTuple(_args, "l",
2277 &extra))
2278 return NULL;
2279 SpaceExtra(extra);
2280 Py_INCREF(Py_None);
2281 _res = Py_None;
2282 return _res;
2283}
2284
2285static PyObject *Qd_DrawChar(_self, _args)
2286 PyObject *_self;
2287 PyObject *_args;
2288{
2289 PyObject *_res = NULL;
2290 short ch;
2291 if (!PyArg_ParseTuple(_args, "h",
2292 &ch))
2293 return NULL;
2294 DrawChar(ch);
2295 Py_INCREF(Py_None);
2296 _res = Py_None;
2297 return _res;
2298}
2299
2300static PyObject *Qd_DrawString(_self, _args)
2301 PyObject *_self;
2302 PyObject *_args;
2303{
2304 PyObject *_res = NULL;
2305 Str255 s;
2306 if (!PyArg_ParseTuple(_args, "O&",
2307 PyMac_GetStr255, s))
2308 return NULL;
2309 DrawString(s);
2310 Py_INCREF(Py_None);
2311 _res = Py_None;
2312 return _res;
2313}
2314
2315static PyObject *Qd_DrawText(_self, _args)
2316 PyObject *_self;
2317 PyObject *_args;
2318{
2319 PyObject *_res = NULL;
2320 char *textBuf__in__;
2321 int textBuf__len__;
2322 int textBuf__in_len__;
2323 short firstByte;
2324 short byteCount;
2325 if (!PyArg_ParseTuple(_args, "s#hh",
2326 &textBuf__in__, &textBuf__in_len__,
2327 &firstByte,
2328 &byteCount))
2329 return NULL;
2330 DrawText(textBuf__in__,
2331 firstByte,
2332 byteCount);
2333 Py_INCREF(Py_None);
2334 _res = Py_None;
2335 textBuf__error__: ;
2336 return _res;
2337}
2338
2339static PyObject *Qd_CharWidth(_self, _args)
2340 PyObject *_self;
2341 PyObject *_args;
2342{
2343 PyObject *_res = NULL;
2344 short _rv;
2345 short ch;
2346 if (!PyArg_ParseTuple(_args, "h",
2347 &ch))
2348 return NULL;
2349 _rv = CharWidth(ch);
2350 _res = Py_BuildValue("h",
2351 _rv);
2352 return _res;
2353}
2354
2355static PyObject *Qd_StringWidth(_self, _args)
2356 PyObject *_self;
2357 PyObject *_args;
2358{
2359 PyObject *_res = NULL;
2360 short _rv;
2361 Str255 s;
2362 if (!PyArg_ParseTuple(_args, "O&",
2363 PyMac_GetStr255, s))
2364 return NULL;
2365 _rv = StringWidth(s);
2366 _res = Py_BuildValue("h",
2367 _rv);
2368 return _res;
2369}
2370
2371static PyObject *Qd_TextWidth(_self, _args)
2372 PyObject *_self;
2373 PyObject *_args;
2374{
2375 PyObject *_res = NULL;
2376 short _rv;
2377 char *textBuf__in__;
2378 int textBuf__len__;
2379 int textBuf__in_len__;
2380 short firstByte;
2381 short byteCount;
2382 if (!PyArg_ParseTuple(_args, "s#hh",
2383 &textBuf__in__, &textBuf__in_len__,
2384 &firstByte,
2385 &byteCount))
2386 return NULL;
2387 _rv = TextWidth(textBuf__in__,
2388 firstByte,
2389 byteCount);
2390 _res = Py_BuildValue("h",
2391 _rv);
2392 textBuf__error__: ;
2393 return _res;
2394}
2395
2396static PyObject *Qd_CharExtra(_self, _args)
2397 PyObject *_self;
2398 PyObject *_args;
2399{
2400 PyObject *_res = NULL;
2401 long extra;
2402 if (!PyArg_ParseTuple(_args, "l",
2403 &extra))
2404 return NULL;
2405 CharExtra(extra);
2406 Py_INCREF(Py_None);
2407 _res = Py_None;
2408 return _res;
2409}
2410
Guido van Rossum17448e21995-01-30 11:53:55 +00002411static PyMethodDef Qd_methods[] = {
Guido van Rossume56db431995-03-19 22:49:50 +00002412 {"OpenPort", (PyCFunction)Qd_OpenPort, 1,
2413 "(WindowPtr port) -> None"},
2414 {"InitPort", (PyCFunction)Qd_InitPort, 1,
2415 "(WindowPtr port) -> None"},
2416 {"ClosePort", (PyCFunction)Qd_ClosePort, 1,
2417 "(WindowPtr port) -> None"},
Guido van Rossum17448e21995-01-30 11:53:55 +00002418 {"SetPort", (PyCFunction)Qd_SetPort, 1,
Guido van Rossume56db431995-03-19 22:49:50 +00002419 "(WindowPtr port) -> None"},
2420 {"GetPort", (PyCFunction)Qd_GetPort, 1,
2421 "() -> (WindowPtr port)"},
2422 {"GrafDevice", (PyCFunction)Qd_GrafDevice, 1,
2423 "(short device) -> None"},
2424 {"PortSize", (PyCFunction)Qd_PortSize, 1,
2425 "(short width, short height) -> None"},
2426 {"MovePortTo", (PyCFunction)Qd_MovePortTo, 1,
2427 "(short leftGlobal, short topGlobal) -> None"},
2428 {"SetOrigin", (PyCFunction)Qd_SetOrigin, 1,
2429 "(short h, short v) -> None"},
2430 {"SetClip", (PyCFunction)Qd_SetClip, 1,
2431 "(RgnHandle rgn) -> None"},
2432 {"GetClip", (PyCFunction)Qd_GetClip, 1,
2433 "(RgnHandle rgn) -> None"},
Guido van Rossum17448e21995-01-30 11:53:55 +00002434 {"ClipRect", (PyCFunction)Qd_ClipRect, 1,
2435 "(Rect r) -> None"},
Guido van Rossume56db431995-03-19 22:49:50 +00002436 {"InitCursor", (PyCFunction)Qd_InitCursor, 1,
2437 "() -> None"},
2438 {"HideCursor", (PyCFunction)Qd_HideCursor, 1,
2439 "() -> None"},
2440 {"ShowCursor", (PyCFunction)Qd_ShowCursor, 1,
2441 "() -> None"},
2442 {"ObscureCursor", (PyCFunction)Qd_ObscureCursor, 1,
2443 "() -> None"},
2444 {"HidePen", (PyCFunction)Qd_HidePen, 1,
2445 "() -> None"},
2446 {"ShowPen", (PyCFunction)Qd_ShowPen, 1,
2447 "() -> None"},
2448 {"GetPen", (PyCFunction)Qd_GetPen, 1,
2449 "(Point pt) -> (Point pt)"},
2450 {"PenSize", (PyCFunction)Qd_PenSize, 1,
2451 "(short width, short height) -> None"},
2452 {"PenMode", (PyCFunction)Qd_PenMode, 1,
2453 "(short mode) -> None"},
2454 {"PenNormal", (PyCFunction)Qd_PenNormal, 1,
2455 "() -> None"},
2456 {"MoveTo", (PyCFunction)Qd_MoveTo, 1,
2457 "(short h, short v) -> None"},
2458 {"Move", (PyCFunction)Qd_Move, 1,
2459 "(short dh, short dv) -> None"},
2460 {"LineTo", (PyCFunction)Qd_LineTo, 1,
2461 "(short h, short v) -> None"},
2462 {"Line", (PyCFunction)Qd_Line, 1,
2463 "(short dh, short dv) -> None"},
Guido van Rossume56db431995-03-19 22:49:50 +00002464 {"ForeColor", (PyCFunction)Qd_ForeColor, 1,
2465 "(long color) -> None"},
2466 {"BackColor", (PyCFunction)Qd_BackColor, 1,
2467 "(long color) -> None"},
2468 {"ColorBit", (PyCFunction)Qd_ColorBit, 1,
2469 "(short whichBit) -> None"},
2470 {"SetRect", (PyCFunction)Qd_SetRect, 1,
2471 "(short left, short top, short right, short bottom) -> (Rect r)"},
2472 {"OffsetRect", (PyCFunction)Qd_OffsetRect, 1,
2473 "(short dh, short dv) -> (Rect r)"},
2474 {"InsetRect", (PyCFunction)Qd_InsetRect, 1,
2475 "(short dh, short dv) -> (Rect r)"},
2476 {"SectRect", (PyCFunction)Qd_SectRect, 1,
2477 "(Rect src1, Rect src2) -> (Boolean _rv, Rect dstRect)"},
2478 {"UnionRect", (PyCFunction)Qd_UnionRect, 1,
2479 "(Rect src1, Rect src2) -> (Rect dstRect)"},
2480 {"EqualRect", (PyCFunction)Qd_EqualRect, 1,
2481 "(Rect rect1, Rect rect2) -> (Boolean _rv)"},
2482 {"EmptyRect", (PyCFunction)Qd_EmptyRect, 1,
2483 "(Rect r) -> (Boolean _rv)"},
2484 {"FrameRect", (PyCFunction)Qd_FrameRect, 1,
2485 "(Rect r) -> None"},
2486 {"PaintRect", (PyCFunction)Qd_PaintRect, 1,
2487 "(Rect r) -> None"},
Guido van Rossum17448e21995-01-30 11:53:55 +00002488 {"EraseRect", (PyCFunction)Qd_EraseRect, 1,
2489 "(Rect r) -> None"},
Guido van Rossume56db431995-03-19 22:49:50 +00002490 {"InvertRect", (PyCFunction)Qd_InvertRect, 1,
2491 "(Rect r) -> None"},
2492 {"FrameOval", (PyCFunction)Qd_FrameOval, 1,
2493 "(Rect r) -> None"},
2494 {"PaintOval", (PyCFunction)Qd_PaintOval, 1,
2495 "(Rect r) -> None"},
2496 {"EraseOval", (PyCFunction)Qd_EraseOval, 1,
2497 "(Rect r) -> None"},
2498 {"InvertOval", (PyCFunction)Qd_InvertOval, 1,
2499 "(Rect r) -> None"},
2500 {"FrameRoundRect", (PyCFunction)Qd_FrameRoundRect, 1,
2501 "(Rect r, short ovalWidth, short ovalHeight) -> None"},
2502 {"PaintRoundRect", (PyCFunction)Qd_PaintRoundRect, 1,
2503 "(Rect r, short ovalWidth, short ovalHeight) -> None"},
2504 {"EraseRoundRect", (PyCFunction)Qd_EraseRoundRect, 1,
2505 "(Rect r, short ovalWidth, short ovalHeight) -> None"},
2506 {"InvertRoundRect", (PyCFunction)Qd_InvertRoundRect, 1,
2507 "(Rect r, short ovalWidth, short ovalHeight) -> None"},
2508 {"FrameArc", (PyCFunction)Qd_FrameArc, 1,
2509 "(Rect r, short startAngle, short arcAngle) -> None"},
2510 {"PaintArc", (PyCFunction)Qd_PaintArc, 1,
2511 "(Rect r, short startAngle, short arcAngle) -> None"},
2512 {"EraseArc", (PyCFunction)Qd_EraseArc, 1,
2513 "(Rect r, short startAngle, short arcAngle) -> None"},
2514 {"InvertArc", (PyCFunction)Qd_InvertArc, 1,
2515 "(Rect r, short startAngle, short arcAngle) -> None"},
2516 {"NewRgn", (PyCFunction)Qd_NewRgn, 1,
2517 "() -> (RgnHandle _rv)"},
2518 {"OpenRgn", (PyCFunction)Qd_OpenRgn, 1,
2519 "() -> None"},
2520 {"CloseRgn", (PyCFunction)Qd_CloseRgn, 1,
2521 "(RgnHandle dstRgn) -> None"},
2522 {"DisposeRgn", (PyCFunction)Qd_DisposeRgn, 1,
2523 "(RgnHandle rgn) -> None"},
2524 {"CopyRgn", (PyCFunction)Qd_CopyRgn, 1,
2525 "(RgnHandle srcRgn, RgnHandle dstRgn) -> None"},
2526 {"SetEmptyRgn", (PyCFunction)Qd_SetEmptyRgn, 1,
2527 "(RgnHandle rgn) -> None"},
2528 {"SetRectRgn", (PyCFunction)Qd_SetRectRgn, 1,
2529 "(RgnHandle rgn, short left, short top, short right, short bottom) -> None"},
2530 {"RectRgn", (PyCFunction)Qd_RectRgn, 1,
2531 "(RgnHandle rgn, Rect r) -> None"},
2532 {"OffsetRgn", (PyCFunction)Qd_OffsetRgn, 1,
2533 "(RgnHandle rgn, short dh, short dv) -> None"},
2534 {"InsetRgn", (PyCFunction)Qd_InsetRgn, 1,
2535 "(RgnHandle rgn, short dh, short dv) -> None"},
2536 {"SectRgn", (PyCFunction)Qd_SectRgn, 1,
2537 "(RgnHandle srcRgnA, RgnHandle srcRgnB, RgnHandle dstRgn) -> None"},
2538 {"UnionRgn", (PyCFunction)Qd_UnionRgn, 1,
2539 "(RgnHandle srcRgnA, RgnHandle srcRgnB, RgnHandle dstRgn) -> None"},
2540 {"DiffRgn", (PyCFunction)Qd_DiffRgn, 1,
2541 "(RgnHandle srcRgnA, RgnHandle srcRgnB, RgnHandle dstRgn) -> None"},
2542 {"XorRgn", (PyCFunction)Qd_XorRgn, 1,
2543 "(RgnHandle srcRgnA, RgnHandle srcRgnB, RgnHandle dstRgn) -> None"},
2544 {"RectInRgn", (PyCFunction)Qd_RectInRgn, 1,
2545 "(Rect r, RgnHandle rgn) -> (Boolean _rv)"},
2546 {"EqualRgn", (PyCFunction)Qd_EqualRgn, 1,
2547 "(RgnHandle rgnA, RgnHandle rgnB) -> (Boolean _rv)"},
2548 {"EmptyRgn", (PyCFunction)Qd_EmptyRgn, 1,
2549 "(RgnHandle rgn) -> (Boolean _rv)"},
2550 {"FrameRgn", (PyCFunction)Qd_FrameRgn, 1,
2551 "(RgnHandle rgn) -> None"},
2552 {"PaintRgn", (PyCFunction)Qd_PaintRgn, 1,
2553 "(RgnHandle rgn) -> None"},
2554 {"EraseRgn", (PyCFunction)Qd_EraseRgn, 1,
2555 "(RgnHandle rgn) -> None"},
2556 {"InvertRgn", (PyCFunction)Qd_InvertRgn, 1,
2557 "(RgnHandle rgn) -> None"},
2558 {"ScrollRect", (PyCFunction)Qd_ScrollRect, 1,
2559 "(Rect r, short dh, short dv, RgnHandle updateRgn) -> None"},
2560 {"OpenPicture", (PyCFunction)Qd_OpenPicture, 1,
2561 "(Rect picFrame) -> (PicHandle _rv)"},
2562 {"PicComment", (PyCFunction)Qd_PicComment, 1,
2563 "(short kind, short dataSize, Handle dataHandle) -> None"},
2564 {"ClosePicture", (PyCFunction)Qd_ClosePicture, 1,
2565 "() -> None"},
2566 {"DrawPicture", (PyCFunction)Qd_DrawPicture, 1,
2567 "(PicHandle myPicture, Rect dstRect) -> None"},
2568 {"KillPicture", (PyCFunction)Qd_KillPicture, 1,
2569 "(PicHandle myPicture) -> None"},
2570 {"OpenPoly", (PyCFunction)Qd_OpenPoly, 1,
2571 "() -> (PolyHandle _rv)"},
2572 {"ClosePoly", (PyCFunction)Qd_ClosePoly, 1,
2573 "() -> None"},
2574 {"KillPoly", (PyCFunction)Qd_KillPoly, 1,
2575 "(PolyHandle poly) -> None"},
2576 {"OffsetPoly", (PyCFunction)Qd_OffsetPoly, 1,
2577 "(PolyHandle poly, short dh, short dv) -> None"},
2578 {"FramePoly", (PyCFunction)Qd_FramePoly, 1,
2579 "(PolyHandle poly) -> None"},
2580 {"PaintPoly", (PyCFunction)Qd_PaintPoly, 1,
2581 "(PolyHandle poly) -> None"},
2582 {"ErasePoly", (PyCFunction)Qd_ErasePoly, 1,
2583 "(PolyHandle poly) -> None"},
2584 {"InvertPoly", (PyCFunction)Qd_InvertPoly, 1,
2585 "(PolyHandle poly) -> None"},
2586 {"SetPt", (PyCFunction)Qd_SetPt, 1,
2587 "(Point pt, short h, short v) -> (Point pt)"},
2588 {"LocalToGlobal", (PyCFunction)Qd_LocalToGlobal, 1,
2589 "(Point pt) -> (Point pt)"},
2590 {"GlobalToLocal", (PyCFunction)Qd_GlobalToLocal, 1,
2591 "(Point pt) -> (Point pt)"},
2592 {"Random", (PyCFunction)Qd_Random, 1,
2593 "() -> (short _rv)"},
2594 {"GetPixel", (PyCFunction)Qd_GetPixel, 1,
2595 "(short h, short v) -> (Boolean _rv)"},
2596 {"ScalePt", (PyCFunction)Qd_ScalePt, 1,
2597 "(Point pt, Rect srcRect, Rect dstRect) -> (Point pt)"},
2598 {"MapPt", (PyCFunction)Qd_MapPt, 1,
2599 "(Point pt, Rect srcRect, Rect dstRect) -> (Point pt)"},
2600 {"MapRect", (PyCFunction)Qd_MapRect, 1,
2601 "(Rect srcRect, Rect dstRect) -> (Rect r)"},
2602 {"MapRgn", (PyCFunction)Qd_MapRgn, 1,
2603 "(RgnHandle rgn, Rect srcRect, Rect dstRect) -> None"},
2604 {"MapPoly", (PyCFunction)Qd_MapPoly, 1,
2605 "(PolyHandle poly, Rect srcRect, Rect dstRect) -> None"},
2606 {"AddPt", (PyCFunction)Qd_AddPt, 1,
2607 "(Point src, Point dst) -> (Point dst)"},
2608 {"EqualPt", (PyCFunction)Qd_EqualPt, 1,
2609 "(Point pt1, Point pt2) -> (Boolean _rv)"},
2610 {"PtInRect", (PyCFunction)Qd_PtInRect, 1,
2611 "(Point pt, Rect r) -> (Boolean _rv)"},
2612 {"Pt2Rect", (PyCFunction)Qd_Pt2Rect, 1,
2613 "(Point pt1, Point pt2) -> (Rect dstRect)"},
2614 {"PtToAngle", (PyCFunction)Qd_PtToAngle, 1,
2615 "(Rect r, Point pt) -> (short angle)"},
Jack Jansenb81cf9d1995-06-06 13:08:40 +00002616 {"SubPt", (PyCFunction)Qd_SubPt, 1,
2617 "(Point src, Point dst) -> (Point dst)"},
Guido van Rossume56db431995-03-19 22:49:50 +00002618 {"PtInRgn", (PyCFunction)Qd_PtInRgn, 1,
2619 "(Point pt, RgnHandle rgn) -> (Boolean _rv)"},
2620 {"NewPixMap", (PyCFunction)Qd_NewPixMap, 1,
2621 "() -> (PixMapHandle _rv)"},
Guido van Rossume56db431995-03-19 22:49:50 +00002622 {"DisposePixMap", (PyCFunction)Qd_DisposePixMap, 1,
2623 "(PixMapHandle pm) -> None"},
2624 {"CopyPixMap", (PyCFunction)Qd_CopyPixMap, 1,
2625 "(PixMapHandle srcPM, PixMapHandle dstPM) -> None"},
2626 {"NewPixPat", (PyCFunction)Qd_NewPixPat, 1,
2627 "() -> (PixPatHandle _rv)"},
Guido van Rossume56db431995-03-19 22:49:50 +00002628 {"DisposePixPat", (PyCFunction)Qd_DisposePixPat, 1,
2629 "(PixPatHandle pp) -> None"},
2630 {"CopyPixPat", (PyCFunction)Qd_CopyPixPat, 1,
2631 "(PixPatHandle srcPP, PixPatHandle dstPP) -> None"},
2632 {"PenPixPat", (PyCFunction)Qd_PenPixPat, 1,
2633 "(PixPatHandle pp) -> None"},
2634 {"BackPixPat", (PyCFunction)Qd_BackPixPat, 1,
2635 "(PixPatHandle pp) -> None"},
2636 {"GetPixPat", (PyCFunction)Qd_GetPixPat, 1,
2637 "(short patID) -> (PixPatHandle _rv)"},
2638 {"FillCRect", (PyCFunction)Qd_FillCRect, 1,
2639 "(Rect r, PixPatHandle pp) -> None"},
2640 {"FillCOval", (PyCFunction)Qd_FillCOval, 1,
2641 "(Rect r, PixPatHandle pp) -> None"},
2642 {"FillCRoundRect", (PyCFunction)Qd_FillCRoundRect, 1,
2643 "(Rect r, short ovalWidth, short ovalHeight, PixPatHandle pp) -> None"},
2644 {"FillCArc", (PyCFunction)Qd_FillCArc, 1,
2645 "(Rect r, short startAngle, short arcAngle, PixPatHandle pp) -> None"},
2646 {"FillCRgn", (PyCFunction)Qd_FillCRgn, 1,
2647 "(RgnHandle rgn, PixPatHandle pp) -> None"},
2648 {"FillCPoly", (PyCFunction)Qd_FillCPoly, 1,
2649 "(PolyHandle poly, PixPatHandle pp) -> None"},
2650 {"SetPortPix", (PyCFunction)Qd_SetPortPix, 1,
2651 "(PixMapHandle pm) -> None"},
2652 {"AllocCursor", (PyCFunction)Qd_AllocCursor, 1,
2653 "() -> None"},
Guido van Rossume56db431995-03-19 22:49:50 +00002654 {"GetCTSeed", (PyCFunction)Qd_GetCTSeed, 1,
2655 "() -> (long _rv)"},
Guido van Rossume56db431995-03-19 22:49:50 +00002656 {"SetClientID", (PyCFunction)Qd_SetClientID, 1,
2657 "(short id) -> None"},
2658 {"ProtectEntry", (PyCFunction)Qd_ProtectEntry, 1,
2659 "(short index, Boolean protect) -> None"},
2660 {"ReserveEntry", (PyCFunction)Qd_ReserveEntry, 1,
2661 "(short index, Boolean reserve) -> None"},
2662 {"QDError", (PyCFunction)Qd_QDError, 1,
2663 "() -> (short _rv)"},
Jack Jansenb81cf9d1995-06-06 13:08:40 +00002664 {"TextFont", (PyCFunction)Qd_TextFont, 1,
2665 "(short font) -> None"},
2666 {"TextFace", (PyCFunction)Qd_TextFace, 1,
2667 "(short face) -> None"},
2668 {"TextMode", (PyCFunction)Qd_TextMode, 1,
2669 "(short mode) -> None"},
2670 {"TextSize", (PyCFunction)Qd_TextSize, 1,
2671 "(short size) -> None"},
2672 {"SpaceExtra", (PyCFunction)Qd_SpaceExtra, 1,
2673 "(long extra) -> None"},
2674 {"DrawChar", (PyCFunction)Qd_DrawChar, 1,
2675 "(short ch) -> None"},
2676 {"DrawString", (PyCFunction)Qd_DrawString, 1,
2677 "(Str255 s) -> None"},
2678 {"DrawText", (PyCFunction)Qd_DrawText, 1,
2679 "(Buffer textBuf, short firstByte, short byteCount) -> None"},
2680 {"CharWidth", (PyCFunction)Qd_CharWidth, 1,
2681 "(short ch) -> (short _rv)"},
2682 {"StringWidth", (PyCFunction)Qd_StringWidth, 1,
2683 "(Str255 s) -> (short _rv)"},
2684 {"TextWidth", (PyCFunction)Qd_TextWidth, 1,
2685 "(Buffer textBuf, short firstByte, short byteCount) -> (short _rv)"},
2686 {"CharExtra", (PyCFunction)Qd_CharExtra, 1,
2687 "(long extra) -> None"},
Guido van Rossum17448e21995-01-30 11:53:55 +00002688 {NULL, NULL, 0}
2689};
2690
2691
2692
2693
2694void initQd()
2695{
2696 PyObject *m;
2697 PyObject *d;
2698
2699
2700
2701
2702 m = Py_InitModule("Qd", Qd_methods);
2703 d = PyModule_GetDict(m);
2704 Qd_Error = PyMac_GetOSErrException();
2705 if (Qd_Error == NULL ||
2706 PyDict_SetItemString(d, "Error", Qd_Error) != 0)
2707 Py_FatalError("can't initialize Qd.Error");
2708}
2709
2710/* ========================= End module Qd ========================== */
2711