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