2 /* =========================== Module Qd ============================ */
9 #include "pymactoolbox.h"
11 #include <QuickDraw.h>
14 ** Parse/generate RGB records
16 PyObject
*QdRGB_New(itself
)
20 return Py_BuildValue("lll", (long)itself
->red
, (long)itself
->green
, (long)itself
->blue
);
23 QdRGB_Convert(v
, p_itself
)
27 long red
, green
, blue
;
29 if( !PyArg_ParseTuple(v
, "lll", &red
, &green
, &blue
) )
31 p_itself
->red
= (unsigned short)red
;
32 p_itself
->green
= (unsigned short)green
;
33 p_itself
->blue
= (unsigned short)blue
;
38 ** Generate FontInfo records
41 PyObject
*QdFI_New(itself
)
45 return Py_BuildValue("hhhh", itself
->ascent
, itself
->descent
,
46 itself
->widMax
, itself
->leading
);
51 static PyObject
*Qd_Error
;
53 /* ---------------------- Object type GrafPort ---------------------- */
55 PyTypeObject GrafPort_Type
;
57 #define GrafObj_Check(x) ((x)->ob_type == &GrafPort_Type)
59 typedef struct GrafPortObject
{
64 PyObject
*GrafObj_New(itself
)
68 if (itself
== NULL
) return PyMac_Error(resNotFound
);
69 it
= PyObject_NEW(GrafPortObject
, &GrafPort_Type
);
70 if (it
== NULL
) return NULL
;
71 it
->ob_itself
= itself
;
72 return (PyObject
*)it
;
74 GrafObj_Convert(v
, p_itself
)
78 if (DlgObj_Check(v
) || WinObj_Check(v
)) {
79 *p_itself
= ((GrafPortObject
*)v
)->ob_itself
;
82 if (!GrafObj_Check(v
))
84 PyErr_SetString(PyExc_TypeError
, "GrafPort required");
87 *p_itself
= ((GrafPortObject
*)v
)->ob_itself
;
91 static void GrafObj_dealloc(self
)
94 /* Cleanup of self->ob_itself goes here */
98 static PyMethodDef GrafObj_methods
[] = {
102 PyMethodChain GrafObj_chain
= { GrafObj_methods
, NULL
};
104 static PyObject
*GrafObj_getattr(self
, name
)
105 GrafPortObject
*self
;
108 #if !TARGET_API_MAC_CARBON
110 { CGrafPtr itself_color
= (CGrafPtr
)self
->ob_itself
;
112 if ( strcmp(name
, "data") == 0 )
113 return PyString_FromStringAndSize((char *)self
->ob_itself
, sizeof(GrafPort
));
115 if ( (itself_color
->portVersion
&0xc000) == 0xc000 ) {
116 /* Color-only attributes */
118 if ( strcmp(name
, "portBits") == 0 )
119 /* XXXX Do we need HLock() stuff here?? */
120 return BMObj_New((BitMapPtr
)*itself_color
->portPixMap
);
121 if ( strcmp(name
, "grafVars") == 0 )
122 return Py_BuildValue("O&", ResObj_New
, (Handle
)itself_color
->visRgn
);
123 if ( strcmp(name
, "chExtra") == 0 )
124 return Py_BuildValue("h", itself_color
->chExtra
);
125 if ( strcmp(name
, "pnLocHFrac") == 0 )
126 return Py_BuildValue("h", itself_color
->pnLocHFrac
);
127 if ( strcmp(name
, "bkPixPat") == 0 )
128 return Py_BuildValue("O&", ResObj_New
, (Handle
)itself_color
->bkPixPat
);
129 if ( strcmp(name
, "rgbFgColor") == 0 )
130 return Py_BuildValue("O&", QdRGB_New
, &itself_color
->rgbFgColor
);
131 if ( strcmp(name
, "rgbBkColor") == 0 )
132 return Py_BuildValue("O&", QdRGB_New
, &itself_color
->rgbBkColor
);
133 if ( strcmp(name
, "pnPixPat") == 0 )
134 return Py_BuildValue("O&", ResObj_New
, (Handle
)itself_color
->pnPixPat
);
135 if ( strcmp(name
, "fillPixPat") == 0 )
136 return Py_BuildValue("O&", ResObj_New
, (Handle
)itself_color
->fillPixPat
);
138 /* Mono-only attributes */
139 if ( strcmp(name
, "portBits") == 0 )
140 return BMObj_New(&self
->ob_itself
->portBits
);
141 if ( strcmp(name
, "bkPat") == 0 )
142 return Py_BuildValue("s#", (char *)&self
->ob_itself
->bkPat
, sizeof(Pattern
));
143 if ( strcmp(name
, "fillPat") == 0 )
144 return Py_BuildValue("s#", (char *)&self
->ob_itself
->fillPat
, sizeof(Pattern
));
145 if ( strcmp(name
, "pnPat") == 0 )
146 return Py_BuildValue("s#", (char *)&self
->ob_itself
->pnPat
, sizeof(Pattern
));
149 ** Accessible for both color/mono windows.
150 ** portVersion is really color-only, but we put it here
153 if ( strcmp(name
, "portVersion") == 0 )
154 return Py_BuildValue("h", itself_color
->portVersion
);
155 if ( strcmp(name
, "device") == 0 )
156 return PyInt_FromLong((long)self
->ob_itself
->device
);
157 if ( strcmp(name
, "portRect") == 0 )
158 return Py_BuildValue("O&", PyMac_BuildRect
, &self
->ob_itself
->portRect
);
159 if ( strcmp(name
, "visRgn") == 0 )
160 return Py_BuildValue("O&", ResObj_New
, (Handle
)self
->ob_itself
->visRgn
);
161 if ( strcmp(name
, "clipRgn") == 0 )
162 return Py_BuildValue("O&", ResObj_New
, (Handle
)self
->ob_itself
->clipRgn
);
163 if ( strcmp(name
, "pnLoc") == 0 )
164 return Py_BuildValue("O&", PyMac_BuildPoint
, self
->ob_itself
->pnLoc
);
165 if ( strcmp(name
, "pnSize") == 0 )
166 return Py_BuildValue("O&", PyMac_BuildPoint
, self
->ob_itself
->pnSize
);
167 if ( strcmp(name
, "pnMode") == 0 )
168 return Py_BuildValue("h", self
->ob_itself
->pnMode
);
169 if ( strcmp(name
, "pnVis") == 0 )
170 return Py_BuildValue("h", self
->ob_itself
->pnVis
);
171 if ( strcmp(name
, "txFont") == 0 )
172 return Py_BuildValue("h", self
->ob_itself
->txFont
);
173 if ( strcmp(name
, "txFace") == 0 )
174 return Py_BuildValue("h", (short)self
->ob_itself
->txFace
);
175 if ( strcmp(name
, "txMode") == 0 )
176 return Py_BuildValue("h", self
->ob_itself
->txMode
);
177 if ( strcmp(name
, "txSize") == 0 )
178 return Py_BuildValue("h", self
->ob_itself
->txSize
);
179 if ( strcmp(name
, "spExtra") == 0 )
180 return Py_BuildValue("O&", PyMac_BuildFixed
, self
->ob_itself
->spExtra
);
181 /* XXXX Add more, as needed */
182 /* This one is so we can compare grafports: */
183 if ( strcmp(name
, "_id") == 0 )
184 return Py_BuildValue("l", (long)self
->ob_itself
);
187 return Py_FindMethodInChain(&GrafObj_chain
, (PyObject
*)self
, name
);
190 #define GrafObj_setattr NULL
192 #define GrafObj_compare NULL
194 #define GrafObj_repr NULL
196 #define GrafObj_hash NULL
198 PyTypeObject GrafPort_Type
= {
199 PyObject_HEAD_INIT(&PyType_Type
)
201 "GrafPort", /*tp_name*/
202 sizeof(GrafPortObject
), /*tp_basicsize*/
205 (destructor
) GrafObj_dealloc
, /*tp_dealloc*/
207 (getattrfunc
) GrafObj_getattr
, /*tp_getattr*/
208 (setattrfunc
) GrafObj_setattr
, /*tp_setattr*/
209 (cmpfunc
) GrafObj_compare
, /*tp_compare*/
210 (reprfunc
) GrafObj_repr
, /*tp_repr*/
211 (PyNumberMethods
*)0, /* tp_as_number */
212 (PySequenceMethods
*)0, /* tp_as_sequence */
213 (PyMappingMethods
*)0, /* tp_as_mapping */
214 (hashfunc
) GrafObj_hash
, /*tp_hash*/
217 /* -------------------- End object type GrafPort -------------------- */
220 /* ----------------------- Object type BitMap ----------------------- */
222 PyTypeObject BitMap_Type
;
224 #define BMObj_Check(x) ((x)->ob_type == &BitMap_Type)
226 typedef struct BitMapObject
{
229 PyObject
*referred_object
;
230 BitMap
*referred_bitmap
;
233 PyObject
*BMObj_New(itself
)
237 if (itself
== NULL
) return PyMac_Error(resNotFound
);
238 it
= PyObject_NEW(BitMapObject
, &BitMap_Type
);
239 if (it
== NULL
) return NULL
;
240 it
->ob_itself
= itself
;
241 it
->referred_object
= NULL
;
242 it
->referred_bitmap
= NULL
;
243 return (PyObject
*)it
;
245 BMObj_Convert(v
, p_itself
)
251 PyErr_SetString(PyExc_TypeError
, "BitMap required");
254 *p_itself
= ((BitMapObject
*)v
)->ob_itself
;
258 static void BMObj_dealloc(self
)
261 Py_XDECREF(self
->referred_object
);
262 if (self
->referred_bitmap
) free(self
->referred_bitmap
);
266 static PyObject
*BMObj_getdata(_self
, _args
)
270 PyObject
*_res
= NULL
;
275 if ( !PyArg_ParseTuple(_args
, "ii", &from
, &length
) )
277 cp
= _self
->ob_itself
->baseAddr
+from
;
278 return PyString_FromStringAndSize(cp
, length
);
282 static PyObject
*BMObj_putdata(_self
, _args
)
286 PyObject
*_res
= NULL
;
291 if ( !PyArg_ParseTuple(_args
, "is#", &from
, &icp
, &length
) )
293 cp
= _self
->ob_itself
->baseAddr
+from
;
294 memcpy(cp
, icp
, length
);
300 static PyMethodDef BMObj_methods
[] = {
301 {"getdata", (PyCFunction
)BMObj_getdata
, 1,
302 "(int start, int size) -> string. Return bytes from the bitmap"},
303 {"putdata", (PyCFunction
)BMObj_putdata
, 1,
304 "(int start, string data). Store bytes into the bitmap"},
308 PyMethodChain BMObj_chain
= { BMObj_methods
, NULL
};
310 static PyObject
*BMObj_getattr(self
, name
)
314 if ( strcmp(name
, "baseAddr") == 0 )
315 return PyInt_FromLong((long)self
->ob_itself
->baseAddr
);
316 if ( strcmp(name
, "rowBytes") == 0 )
317 return PyInt_FromLong((long)self
->ob_itself
->rowBytes
);
318 if ( strcmp(name
, "bounds") == 0 )
319 return Py_BuildValue("O&", PyMac_BuildRect
, &self
->ob_itself
->bounds
);
320 /* XXXX Add more, as needed */
321 if ( strcmp(name
, "bitmap_data") == 0 )
322 return PyString_FromStringAndSize((char *)self
->ob_itself
, sizeof(BitMap
));
323 if ( strcmp(name
, "pixmap_data") == 0 )
324 return PyString_FromStringAndSize((char *)self
->ob_itself
, sizeof(PixMap
));
326 return Py_FindMethodInChain(&BMObj_chain
, (PyObject
*)self
, name
);
329 #define BMObj_setattr NULL
331 #define BMObj_compare NULL
333 #define BMObj_repr NULL
335 #define BMObj_hash NULL
337 PyTypeObject BitMap_Type
= {
338 PyObject_HEAD_INIT(&PyType_Type
)
340 "BitMap", /*tp_name*/
341 sizeof(BitMapObject
), /*tp_basicsize*/
344 (destructor
) BMObj_dealloc
, /*tp_dealloc*/
346 (getattrfunc
) BMObj_getattr
, /*tp_getattr*/
347 (setattrfunc
) BMObj_setattr
, /*tp_setattr*/
348 (cmpfunc
) BMObj_compare
, /*tp_compare*/
349 (reprfunc
) BMObj_repr
, /*tp_repr*/
350 (PyNumberMethods
*)0, /* tp_as_number */
351 (PySequenceMethods
*)0, /* tp_as_sequence */
352 (PyMappingMethods
*)0, /* tp_as_mapping */
353 (hashfunc
) BMObj_hash
, /*tp_hash*/
356 /* --------------------- End object type BitMap --------------------- */
359 /* ------------------ Object type QDGlobalsAccess ------------------- */
361 staticforward PyTypeObject QDGlobalsAccess_Type
;
363 #define QDGA_Check(x) ((x)->ob_type == &QDGlobalsAccess_Type)
365 typedef struct QDGlobalsAccessObject
{
367 } QDGlobalsAccessObject
;
369 static PyObject
*QDGA_New()
371 QDGlobalsAccessObject
*it
;
372 it
= PyObject_NEW(QDGlobalsAccessObject
, &QDGlobalsAccess_Type
);
373 if (it
== NULL
) return NULL
;
374 return (PyObject
*)it
;
377 static void QDGA_dealloc(self
)
378 QDGlobalsAccessObject
*self
;
383 static PyMethodDef QDGA_methods
[] = {
387 static PyMethodChain QDGA_chain
= { QDGA_methods
, NULL
};
389 static PyObject
*QDGA_getattr(self
, name
)
390 QDGlobalsAccessObject
*self
;
393 #if !TARGET_API_MAC_CARBON
395 if ( strcmp(name
, "arrow") == 0 )
396 return PyString_FromStringAndSize((char *)&qd
.arrow
, sizeof(qd
.arrow
));
397 if ( strcmp(name
, "black") == 0 )
398 return PyString_FromStringAndSize((char *)&qd
.black
, sizeof(qd
.black
));
399 if ( strcmp(name
, "white") == 0 )
400 return PyString_FromStringAndSize((char *)&qd
.white
, sizeof(qd
.white
));
401 if ( strcmp(name
, "gray") == 0 )
402 return PyString_FromStringAndSize((char *)&qd
.gray
, sizeof(qd
.gray
));
403 if ( strcmp(name
, "ltGray") == 0 )
404 return PyString_FromStringAndSize((char *)&qd
.ltGray
, sizeof(qd
.ltGray
));
405 if ( strcmp(name
, "dkGray") == 0 )
406 return PyString_FromStringAndSize((char *)&qd
.dkGray
, sizeof(qd
.dkGray
));
407 if ( strcmp(name
, "screenBits") == 0 )
408 return BMObj_New(&qd
.screenBits
);
409 if ( strcmp(name
, "thePort") == 0 )
410 return GrafObj_New(qd
.thePort
);
411 if ( strcmp(name
, "randSeed") == 0 )
412 return Py_BuildValue("l", &qd
.randSeed
);
416 if ( strcmp(name
, "arrow") == 0 ) {
418 GetQDGlobalsArrow(&rv
);
419 return PyString_FromStringAndSize((char *)&rv
, sizeof(rv
));
421 if ( strcmp(name
, "black") == 0 ) {
423 GetQDGlobalsBlack(&rv
);
424 return PyString_FromStringAndSize((char *)&rv
, sizeof(rv
));
426 if ( strcmp(name
, "white") == 0 ) {
428 GetQDGlobalsWhite(&rv
);
429 return PyString_FromStringAndSize((char *)&rv
, sizeof(rv
));
431 if ( strcmp(name
, "gray") == 0 ) {
433 GetQDGlobalsGray(&rv
);
434 return PyString_FromStringAndSize((char *)&rv
, sizeof(rv
));
436 if ( strcmp(name
, "ltGray") == 0 ) {
438 GetQDGlobalsLightGray(&rv
);
439 return PyString_FromStringAndSize((char *)&rv
, sizeof(rv
));
441 if ( strcmp(name
, "dkGray") == 0 ) {
443 GetQDGlobalsDarkGray(&rv
);
444 return PyString_FromStringAndSize((char *)&rv
, sizeof(rv
));
446 if ( strcmp(name
, "screenBits") == 0 ) {
448 GetQDGlobalsScreenBits(&rv
);
449 return BMObj_New(&rv
);
451 if ( strcmp(name
, "thePort") == 0 )
452 return GrafObj_New(GetQDGlobalsThePort());
453 if ( strcmp(name
, "randSeed") == 0 )
454 return Py_BuildValue("l", GetQDGlobalsRandomSeed());
457 return Py_FindMethodInChain(&QDGA_chain
, (PyObject
*)self
, name
);
460 #define QDGA_setattr NULL
462 #define QDGA_compare NULL
464 #define QDGA_repr NULL
466 #define QDGA_hash NULL
468 staticforward PyTypeObject QDGlobalsAccess_Type
= {
469 PyObject_HEAD_INIT(&PyType_Type
)
471 "QDGlobalsAccess", /*tp_name*/
472 sizeof(QDGlobalsAccessObject
), /*tp_basicsize*/
475 (destructor
) QDGA_dealloc
, /*tp_dealloc*/
477 (getattrfunc
) QDGA_getattr
, /*tp_getattr*/
478 (setattrfunc
) QDGA_setattr
, /*tp_setattr*/
479 (cmpfunc
) QDGA_compare
, /*tp_compare*/
480 (reprfunc
) QDGA_repr
, /*tp_repr*/
481 (PyNumberMethods
*)0, /* tp_as_number */
482 (PySequenceMethods
*)0, /* tp_as_sequence */
483 (PyMappingMethods
*)0, /* tp_as_mapping */
484 (hashfunc
) QDGA_hash
, /*tp_hash*/
487 /* ---------------- End object type QDGlobalsAccess ----------------- */
490 static PyObject
*Qd_MacSetPort(_self
, _args
)
494 PyObject
*_res
= NULL
;
496 if (!PyArg_ParseTuple(_args
, "O&",
497 GrafObj_Convert
, &port
))
505 static PyObject
*Qd_GetPort(_self
, _args
)
509 PyObject
*_res
= NULL
;
511 if (!PyArg_ParseTuple(_args
, ""))
514 _res
= Py_BuildValue("O&",
519 static PyObject
*Qd_GrafDevice(_self
, _args
)
523 PyObject
*_res
= NULL
;
525 if (!PyArg_ParseTuple(_args
, "h",
534 static PyObject
*Qd_SetPortBits(_self
, _args
)
538 PyObject
*_res
= NULL
;
540 if (!PyArg_ParseTuple(_args
, "O&",
549 static PyObject
*Qd_PortSize(_self
, _args
)
553 PyObject
*_res
= NULL
;
556 if (!PyArg_ParseTuple(_args
, "hh",
567 static PyObject
*Qd_MovePortTo(_self
, _args
)
571 PyObject
*_res
= NULL
;
574 if (!PyArg_ParseTuple(_args
, "hh",
578 MovePortTo(leftGlobal
,
585 static PyObject
*Qd_SetOrigin(_self
, _args
)
589 PyObject
*_res
= NULL
;
592 if (!PyArg_ParseTuple(_args
, "hh",
603 static PyObject
*Qd_SetClip(_self
, _args
)
607 PyObject
*_res
= NULL
;
609 if (!PyArg_ParseTuple(_args
, "O&",
610 ResObj_Convert
, &rgn
))
618 static PyObject
*Qd_GetClip(_self
, _args
)
622 PyObject
*_res
= NULL
;
624 if (!PyArg_ParseTuple(_args
, "O&",
625 ResObj_Convert
, &rgn
))
633 static PyObject
*Qd_ClipRect(_self
, _args
)
637 PyObject
*_res
= NULL
;
639 if (!PyArg_ParseTuple(_args
, "O&",
648 static PyObject
*Qd_BackPat(_self
, _args
)
652 PyObject
*_res
= NULL
;
655 if (!PyArg_ParseTuple(_args
, "s#",
656 (char **)&pat__in__
, &pat__in_len__
))
658 if (pat__in_len__
!= sizeof(Pattern
))
660 PyErr_SetString(PyExc_TypeError
, "buffer length should be sizeof(Pattern)");
670 static PyObject
*Qd_InitCursor(_self
, _args
)
674 PyObject
*_res
= NULL
;
675 if (!PyArg_ParseTuple(_args
, ""))
683 static PyObject
*Qd_MacSetCursor(_self
, _args
)
687 PyObject
*_res
= NULL
;
690 if (!PyArg_ParseTuple(_args
, "s#",
691 (char **)&crsr__in__
, &crsr__in_len__
))
693 if (crsr__in_len__
!= sizeof(Cursor
))
695 PyErr_SetString(PyExc_TypeError
, "buffer length should be sizeof(Cursor)");
698 MacSetCursor(crsr__in__
);
705 static PyObject
*Qd_HideCursor(_self
, _args
)
709 PyObject
*_res
= NULL
;
710 if (!PyArg_ParseTuple(_args
, ""))
718 static PyObject
*Qd_MacShowCursor(_self
, _args
)
722 PyObject
*_res
= NULL
;
723 if (!PyArg_ParseTuple(_args
, ""))
731 static PyObject
*Qd_ObscureCursor(_self
, _args
)
735 PyObject
*_res
= NULL
;
736 if (!PyArg_ParseTuple(_args
, ""))
744 static PyObject
*Qd_HidePen(_self
, _args
)
748 PyObject
*_res
= NULL
;
749 if (!PyArg_ParseTuple(_args
, ""))
757 static PyObject
*Qd_ShowPen(_self
, _args
)
761 PyObject
*_res
= NULL
;
762 if (!PyArg_ParseTuple(_args
, ""))
770 static PyObject
*Qd_GetPen(_self
, _args
)
774 PyObject
*_res
= NULL
;
776 if (!PyArg_ParseTuple(_args
, ""))
779 _res
= Py_BuildValue("O&",
780 PyMac_BuildPoint
, pt
);
784 static PyObject
*Qd_GetPenState(_self
, _args
)
788 PyObject
*_res
= NULL
;
789 PenState pnState__out__
;
790 if (!PyArg_ParseTuple(_args
, ""))
792 GetPenState(&pnState__out__
);
793 _res
= Py_BuildValue("s#",
794 (char *)&pnState__out__
, (int)sizeof(PenState
));
799 static PyObject
*Qd_SetPenState(_self
, _args
)
803 PyObject
*_res
= NULL
;
804 PenState
*pnState__in__
;
805 int pnState__in_len__
;
806 if (!PyArg_ParseTuple(_args
, "s#",
807 (char **)&pnState__in__
, &pnState__in_len__
))
809 if (pnState__in_len__
!= sizeof(PenState
))
811 PyErr_SetString(PyExc_TypeError
, "buffer length should be sizeof(PenState)");
812 goto pnState__error__
;
814 SetPenState(pnState__in__
);
821 static PyObject
*Qd_PenSize(_self
, _args
)
825 PyObject
*_res
= NULL
;
828 if (!PyArg_ParseTuple(_args
, "hh",
839 static PyObject
*Qd_PenMode(_self
, _args
)
843 PyObject
*_res
= NULL
;
845 if (!PyArg_ParseTuple(_args
, "h",
854 static PyObject
*Qd_PenPat(_self
, _args
)
858 PyObject
*_res
= NULL
;
861 if (!PyArg_ParseTuple(_args
, "s#",
862 (char **)&pat__in__
, &pat__in_len__
))
864 if (pat__in_len__
!= sizeof(Pattern
))
866 PyErr_SetString(PyExc_TypeError
, "buffer length should be sizeof(Pattern)");
876 static PyObject
*Qd_PenNormal(_self
, _args
)
880 PyObject
*_res
= NULL
;
881 if (!PyArg_ParseTuple(_args
, ""))
889 static PyObject
*Qd_MoveTo(_self
, _args
)
893 PyObject
*_res
= NULL
;
896 if (!PyArg_ParseTuple(_args
, "hh",
907 static PyObject
*Qd_Move(_self
, _args
)
911 PyObject
*_res
= NULL
;
914 if (!PyArg_ParseTuple(_args
, "hh",
925 static PyObject
*Qd_MacLineTo(_self
, _args
)
929 PyObject
*_res
= NULL
;
932 if (!PyArg_ParseTuple(_args
, "hh",
943 static PyObject
*Qd_Line(_self
, _args
)
947 PyObject
*_res
= NULL
;
950 if (!PyArg_ParseTuple(_args
, "hh",
961 static PyObject
*Qd_ForeColor(_self
, _args
)
965 PyObject
*_res
= NULL
;
967 if (!PyArg_ParseTuple(_args
, "l",
976 static PyObject
*Qd_BackColor(_self
, _args
)
980 PyObject
*_res
= NULL
;
982 if (!PyArg_ParseTuple(_args
, "l",
991 static PyObject
*Qd_ColorBit(_self
, _args
)
995 PyObject
*_res
= NULL
;
997 if (!PyArg_ParseTuple(_args
, "h",
1006 static PyObject
*Qd_MacSetRect(_self
, _args
)
1010 PyObject
*_res
= NULL
;
1016 if (!PyArg_ParseTuple(_args
, "hhhh",
1027 _res
= Py_BuildValue("O&",
1028 PyMac_BuildRect
, &r
);
1032 static PyObject
*Qd_MacOffsetRect(_self
, _args
)
1036 PyObject
*_res
= NULL
;
1040 if (!PyArg_ParseTuple(_args
, "O&hh",
1048 _res
= Py_BuildValue("O&",
1049 PyMac_BuildRect
, &r
);
1053 static PyObject
*Qd_MacInsetRect(_self
, _args
)
1057 PyObject
*_res
= NULL
;
1061 if (!PyArg_ParseTuple(_args
, "O&hh",
1069 _res
= Py_BuildValue("O&",
1070 PyMac_BuildRect
, &r
);
1074 static PyObject
*Qd_SectRect(_self
, _args
)
1078 PyObject
*_res
= NULL
;
1083 if (!PyArg_ParseTuple(_args
, "O&O&",
1084 PyMac_GetRect
, &src1
,
1085 PyMac_GetRect
, &src2
))
1087 _rv
= SectRect(&src1
,
1090 _res
= Py_BuildValue("bO&",
1092 PyMac_BuildRect
, &dstRect
);
1096 static PyObject
*Qd_MacUnionRect(_self
, _args
)
1100 PyObject
*_res
= NULL
;
1104 if (!PyArg_ParseTuple(_args
, "O&O&",
1105 PyMac_GetRect
, &src1
,
1106 PyMac_GetRect
, &src2
))
1111 _res
= Py_BuildValue("O&",
1112 PyMac_BuildRect
, &dstRect
);
1116 static PyObject
*Qd_MacEqualRect(_self
, _args
)
1120 PyObject
*_res
= NULL
;
1124 if (!PyArg_ParseTuple(_args
, "O&O&",
1125 PyMac_GetRect
, &rect1
,
1126 PyMac_GetRect
, &rect2
))
1128 _rv
= MacEqualRect(&rect1
,
1130 _res
= Py_BuildValue("b",
1135 static PyObject
*Qd_EmptyRect(_self
, _args
)
1139 PyObject
*_res
= NULL
;
1142 if (!PyArg_ParseTuple(_args
, "O&",
1145 _rv
= EmptyRect(&r
);
1146 _res
= Py_BuildValue("b",
1151 static PyObject
*Qd_MacFrameRect(_self
, _args
)
1155 PyObject
*_res
= NULL
;
1157 if (!PyArg_ParseTuple(_args
, "O&",
1166 static PyObject
*Qd_PaintRect(_self
, _args
)
1170 PyObject
*_res
= NULL
;
1172 if (!PyArg_ParseTuple(_args
, "O&",
1181 static PyObject
*Qd_EraseRect(_self
, _args
)
1185 PyObject
*_res
= NULL
;
1187 if (!PyArg_ParseTuple(_args
, "O&",
1196 static PyObject
*Qd_MacInvertRect(_self
, _args
)
1200 PyObject
*_res
= NULL
;
1202 if (!PyArg_ParseTuple(_args
, "O&",
1211 static PyObject
*Qd_MacFillRect(_self
, _args
)
1215 PyObject
*_res
= NULL
;
1219 if (!PyArg_ParseTuple(_args
, "O&s#",
1221 (char **)&pat__in__
, &pat__in_len__
))
1223 if (pat__in_len__
!= sizeof(Pattern
))
1225 PyErr_SetString(PyExc_TypeError
, "buffer length should be sizeof(Pattern)");
1236 static PyObject
*Qd_FrameOval(_self
, _args
)
1240 PyObject
*_res
= NULL
;
1242 if (!PyArg_ParseTuple(_args
, "O&",
1251 static PyObject
*Qd_PaintOval(_self
, _args
)
1255 PyObject
*_res
= NULL
;
1257 if (!PyArg_ParseTuple(_args
, "O&",
1266 static PyObject
*Qd_EraseOval(_self
, _args
)
1270 PyObject
*_res
= NULL
;
1272 if (!PyArg_ParseTuple(_args
, "O&",
1281 static PyObject
*Qd_InvertOval(_self
, _args
)
1285 PyObject
*_res
= NULL
;
1287 if (!PyArg_ParseTuple(_args
, "O&",
1296 static PyObject
*Qd_FillOval(_self
, _args
)
1300 PyObject
*_res
= NULL
;
1304 if (!PyArg_ParseTuple(_args
, "O&s#",
1306 (char **)&pat__in__
, &pat__in_len__
))
1308 if (pat__in_len__
!= sizeof(Pattern
))
1310 PyErr_SetString(PyExc_TypeError
, "buffer length should be sizeof(Pattern)");
1321 static PyObject
*Qd_FrameRoundRect(_self
, _args
)
1325 PyObject
*_res
= NULL
;
1329 if (!PyArg_ParseTuple(_args
, "O&hh",
1342 static PyObject
*Qd_PaintRoundRect(_self
, _args
)
1346 PyObject
*_res
= NULL
;
1350 if (!PyArg_ParseTuple(_args
, "O&hh",
1363 static PyObject
*Qd_EraseRoundRect(_self
, _args
)
1367 PyObject
*_res
= NULL
;
1371 if (!PyArg_ParseTuple(_args
, "O&hh",
1384 static PyObject
*Qd_InvertRoundRect(_self
, _args
)
1388 PyObject
*_res
= NULL
;
1392 if (!PyArg_ParseTuple(_args
, "O&hh",
1405 static PyObject
*Qd_FillRoundRect(_self
, _args
)
1409 PyObject
*_res
= NULL
;
1415 if (!PyArg_ParseTuple(_args
, "O&hhs#",
1419 (char **)&pat__in__
, &pat__in_len__
))
1421 if (pat__in_len__
!= sizeof(Pattern
))
1423 PyErr_SetString(PyExc_TypeError
, "buffer length should be sizeof(Pattern)");
1436 static PyObject
*Qd_FrameArc(_self
, _args
)
1440 PyObject
*_res
= NULL
;
1444 if (!PyArg_ParseTuple(_args
, "O&hh",
1457 static PyObject
*Qd_PaintArc(_self
, _args
)
1461 PyObject
*_res
= NULL
;
1465 if (!PyArg_ParseTuple(_args
, "O&hh",
1478 static PyObject
*Qd_EraseArc(_self
, _args
)
1482 PyObject
*_res
= NULL
;
1486 if (!PyArg_ParseTuple(_args
, "O&hh",
1499 static PyObject
*Qd_InvertArc(_self
, _args
)
1503 PyObject
*_res
= NULL
;
1507 if (!PyArg_ParseTuple(_args
, "O&hh",
1520 static PyObject
*Qd_FillArc(_self
, _args
)
1524 PyObject
*_res
= NULL
;
1530 if (!PyArg_ParseTuple(_args
, "O&hhs#",
1534 (char **)&pat__in__
, &pat__in_len__
))
1536 if (pat__in_len__
!= sizeof(Pattern
))
1538 PyErr_SetString(PyExc_TypeError
, "buffer length should be sizeof(Pattern)");
1551 static PyObject
*Qd_NewRgn(_self
, _args
)
1555 PyObject
*_res
= NULL
;
1557 if (!PyArg_ParseTuple(_args
, ""))
1560 _res
= Py_BuildValue("O&",
1565 static PyObject
*Qd_OpenRgn(_self
, _args
)
1569 PyObject
*_res
= NULL
;
1570 if (!PyArg_ParseTuple(_args
, ""))
1578 static PyObject
*Qd_CloseRgn(_self
, _args
)
1582 PyObject
*_res
= NULL
;
1584 if (!PyArg_ParseTuple(_args
, "O&",
1585 ResObj_Convert
, &dstRgn
))
1593 static PyObject
*Qd_BitMapToRegion(_self
, _args
)
1597 PyObject
*_res
= NULL
;
1601 if (!PyArg_ParseTuple(_args
, "O&O&",
1602 ResObj_Convert
, ®ion
,
1603 BMObj_Convert
, &bMap
))
1605 _err
= BitMapToRegion(region
,
1607 if (_err
!= noErr
) return PyMac_Error(_err
);
1613 static PyObject
*Qd_DisposeRgn(_self
, _args
)
1617 PyObject
*_res
= NULL
;
1619 if (!PyArg_ParseTuple(_args
, "O&",
1620 ResObj_Convert
, &rgn
))
1628 static PyObject
*Qd_MacCopyRgn(_self
, _args
)
1632 PyObject
*_res
= NULL
;
1635 if (!PyArg_ParseTuple(_args
, "O&O&",
1636 ResObj_Convert
, &srcRgn
,
1637 ResObj_Convert
, &dstRgn
))
1646 static PyObject
*Qd_SetEmptyRgn(_self
, _args
)
1650 PyObject
*_res
= NULL
;
1652 if (!PyArg_ParseTuple(_args
, "O&",
1653 ResObj_Convert
, &rgn
))
1661 static PyObject
*Qd_MacSetRectRgn(_self
, _args
)
1665 PyObject
*_res
= NULL
;
1671 if (!PyArg_ParseTuple(_args
, "O&hhhh",
1672 ResObj_Convert
, &rgn
,
1688 static PyObject
*Qd_RectRgn(_self
, _args
)
1692 PyObject
*_res
= NULL
;
1695 if (!PyArg_ParseTuple(_args
, "O&O&",
1696 ResObj_Convert
, &rgn
,
1706 static PyObject
*Qd_MacOffsetRgn(_self
, _args
)
1710 PyObject
*_res
= NULL
;
1714 if (!PyArg_ParseTuple(_args
, "O&hh",
1715 ResObj_Convert
, &rgn
,
1727 static PyObject
*Qd_InsetRgn(_self
, _args
)
1731 PyObject
*_res
= NULL
;
1735 if (!PyArg_ParseTuple(_args
, "O&hh",
1736 ResObj_Convert
, &rgn
,
1748 static PyObject
*Qd_SectRgn(_self
, _args
)
1752 PyObject
*_res
= NULL
;
1756 if (!PyArg_ParseTuple(_args
, "O&O&O&",
1757 ResObj_Convert
, &srcRgnA
,
1758 ResObj_Convert
, &srcRgnB
,
1759 ResObj_Convert
, &dstRgn
))
1769 static PyObject
*Qd_MacUnionRgn(_self
, _args
)
1773 PyObject
*_res
= NULL
;
1777 if (!PyArg_ParseTuple(_args
, "O&O&O&",
1778 ResObj_Convert
, &srcRgnA
,
1779 ResObj_Convert
, &srcRgnB
,
1780 ResObj_Convert
, &dstRgn
))
1782 MacUnionRgn(srcRgnA
,
1790 static PyObject
*Qd_DiffRgn(_self
, _args
)
1794 PyObject
*_res
= NULL
;
1798 if (!PyArg_ParseTuple(_args
, "O&O&O&",
1799 ResObj_Convert
, &srcRgnA
,
1800 ResObj_Convert
, &srcRgnB
,
1801 ResObj_Convert
, &dstRgn
))
1811 static PyObject
*Qd_MacXorRgn(_self
, _args
)
1815 PyObject
*_res
= NULL
;
1819 if (!PyArg_ParseTuple(_args
, "O&O&O&",
1820 ResObj_Convert
, &srcRgnA
,
1821 ResObj_Convert
, &srcRgnB
,
1822 ResObj_Convert
, &dstRgn
))
1832 static PyObject
*Qd_RectInRgn(_self
, _args
)
1836 PyObject
*_res
= NULL
;
1840 if (!PyArg_ParseTuple(_args
, "O&O&",
1842 ResObj_Convert
, &rgn
))
1846 _res
= Py_BuildValue("b",
1851 static PyObject
*Qd_MacEqualRgn(_self
, _args
)
1855 PyObject
*_res
= NULL
;
1859 if (!PyArg_ParseTuple(_args
, "O&O&",
1860 ResObj_Convert
, &rgnA
,
1861 ResObj_Convert
, &rgnB
))
1863 _rv
= MacEqualRgn(rgnA
,
1865 _res
= Py_BuildValue("b",
1870 static PyObject
*Qd_EmptyRgn(_self
, _args
)
1874 PyObject
*_res
= NULL
;
1877 if (!PyArg_ParseTuple(_args
, "O&",
1878 ResObj_Convert
, &rgn
))
1880 _rv
= EmptyRgn(rgn
);
1881 _res
= Py_BuildValue("b",
1886 static PyObject
*Qd_MacFrameRgn(_self
, _args
)
1890 PyObject
*_res
= NULL
;
1892 if (!PyArg_ParseTuple(_args
, "O&",
1893 ResObj_Convert
, &rgn
))
1901 static PyObject
*Qd_MacPaintRgn(_self
, _args
)
1905 PyObject
*_res
= NULL
;
1907 if (!PyArg_ParseTuple(_args
, "O&",
1908 ResObj_Convert
, &rgn
))
1916 static PyObject
*Qd_EraseRgn(_self
, _args
)
1920 PyObject
*_res
= NULL
;
1922 if (!PyArg_ParseTuple(_args
, "O&",
1923 ResObj_Convert
, &rgn
))
1931 static PyObject
*Qd_MacInvertRgn(_self
, _args
)
1935 PyObject
*_res
= NULL
;
1937 if (!PyArg_ParseTuple(_args
, "O&",
1938 ResObj_Convert
, &rgn
))
1946 static PyObject
*Qd_MacFillRgn(_self
, _args
)
1950 PyObject
*_res
= NULL
;
1954 if (!PyArg_ParseTuple(_args
, "O&s#",
1955 ResObj_Convert
, &rgn
,
1956 (char **)&pat__in__
, &pat__in_len__
))
1958 if (pat__in_len__
!= sizeof(Pattern
))
1960 PyErr_SetString(PyExc_TypeError
, "buffer length should be sizeof(Pattern)");
1971 static PyObject
*Qd_ScrollRect(_self
, _args
)
1975 PyObject
*_res
= NULL
;
1979 RgnHandle updateRgn
;
1980 if (!PyArg_ParseTuple(_args
, "O&hhO&",
1984 ResObj_Convert
, &updateRgn
))
1995 static PyObject
*Qd_CopyBits(_self
, _args
)
1999 PyObject
*_res
= NULL
;
2006 if (!PyArg_ParseTuple(_args
, "O&O&O&O&hO&",
2007 BMObj_Convert
, &srcBits
,
2008 BMObj_Convert
, &dstBits
,
2009 PyMac_GetRect
, &srcRect
,
2010 PyMac_GetRect
, &dstRect
,
2012 OptResObj_Convert
, &maskRgn
))
2025 static PyObject
*Qd_CopyMask(_self
, _args
)
2029 PyObject
*_res
= NULL
;
2036 if (!PyArg_ParseTuple(_args
, "O&O&O&O&O&O&",
2037 BMObj_Convert
, &srcBits
,
2038 BMObj_Convert
, &maskBits
,
2039 BMObj_Convert
, &dstBits
,
2040 PyMac_GetRect
, &srcRect
,
2041 PyMac_GetRect
, &maskRect
,
2042 PyMac_GetRect
, &dstRect
))
2055 static PyObject
*Qd_OpenPicture(_self
, _args
)
2059 PyObject
*_res
= NULL
;
2062 if (!PyArg_ParseTuple(_args
, "O&",
2063 PyMac_GetRect
, &picFrame
))
2065 _rv
= OpenPicture(&picFrame
);
2066 _res
= Py_BuildValue("O&",
2071 static PyObject
*Qd_PicComment(_self
, _args
)
2075 PyObject
*_res
= NULL
;
2079 if (!PyArg_ParseTuple(_args
, "hhO&",
2082 ResObj_Convert
, &dataHandle
))
2092 static PyObject
*Qd_ClosePicture(_self
, _args
)
2096 PyObject
*_res
= NULL
;
2097 if (!PyArg_ParseTuple(_args
, ""))
2105 static PyObject
*Qd_DrawPicture(_self
, _args
)
2109 PyObject
*_res
= NULL
;
2110 PicHandle myPicture
;
2112 if (!PyArg_ParseTuple(_args
, "O&O&",
2113 ResObj_Convert
, &myPicture
,
2114 PyMac_GetRect
, &dstRect
))
2116 DrawPicture(myPicture
,
2123 static PyObject
*Qd_KillPicture(_self
, _args
)
2127 PyObject
*_res
= NULL
;
2128 PicHandle myPicture
;
2129 if (!PyArg_ParseTuple(_args
, "O&",
2130 ResObj_Convert
, &myPicture
))
2132 KillPicture(myPicture
);
2138 static PyObject
*Qd_OpenPoly(_self
, _args
)
2142 PyObject
*_res
= NULL
;
2144 if (!PyArg_ParseTuple(_args
, ""))
2147 _res
= Py_BuildValue("O&",
2152 static PyObject
*Qd_ClosePoly(_self
, _args
)
2156 PyObject
*_res
= NULL
;
2157 if (!PyArg_ParseTuple(_args
, ""))
2165 static PyObject
*Qd_KillPoly(_self
, _args
)
2169 PyObject
*_res
= NULL
;
2171 if (!PyArg_ParseTuple(_args
, "O&",
2172 ResObj_Convert
, &poly
))
2180 static PyObject
*Qd_OffsetPoly(_self
, _args
)
2184 PyObject
*_res
= NULL
;
2188 if (!PyArg_ParseTuple(_args
, "O&hh",
2189 ResObj_Convert
, &poly
,
2201 static PyObject
*Qd_FramePoly(_self
, _args
)
2205 PyObject
*_res
= NULL
;
2207 if (!PyArg_ParseTuple(_args
, "O&",
2208 ResObj_Convert
, &poly
))
2216 static PyObject
*Qd_PaintPoly(_self
, _args
)
2220 PyObject
*_res
= NULL
;
2222 if (!PyArg_ParseTuple(_args
, "O&",
2223 ResObj_Convert
, &poly
))
2231 static PyObject
*Qd_ErasePoly(_self
, _args
)
2235 PyObject
*_res
= NULL
;
2237 if (!PyArg_ParseTuple(_args
, "O&",
2238 ResObj_Convert
, &poly
))
2246 static PyObject
*Qd_InvertPoly(_self
, _args
)
2250 PyObject
*_res
= NULL
;
2252 if (!PyArg_ParseTuple(_args
, "O&",
2253 ResObj_Convert
, &poly
))
2261 static PyObject
*Qd_FillPoly(_self
, _args
)
2265 PyObject
*_res
= NULL
;
2269 if (!PyArg_ParseTuple(_args
, "O&s#",
2270 ResObj_Convert
, &poly
,
2271 (char **)&pat__in__
, &pat__in_len__
))
2273 if (pat__in_len__
!= sizeof(Pattern
))
2275 PyErr_SetString(PyExc_TypeError
, "buffer length should be sizeof(Pattern)");
2286 static PyObject
*Qd_SetPt(_self
, _args
)
2290 PyObject
*_res
= NULL
;
2294 if (!PyArg_ParseTuple(_args
, "hh",
2301 _res
= Py_BuildValue("O&",
2302 PyMac_BuildPoint
, pt
);
2306 static PyObject
*Qd_LocalToGlobal(_self
, _args
)
2310 PyObject
*_res
= NULL
;
2312 if (!PyArg_ParseTuple(_args
, "O&",
2313 PyMac_GetPoint
, &pt
))
2316 _res
= Py_BuildValue("O&",
2317 PyMac_BuildPoint
, pt
);
2321 static PyObject
*Qd_GlobalToLocal(_self
, _args
)
2325 PyObject
*_res
= NULL
;
2327 if (!PyArg_ParseTuple(_args
, "O&",
2328 PyMac_GetPoint
, &pt
))
2331 _res
= Py_BuildValue("O&",
2332 PyMac_BuildPoint
, pt
);
2336 static PyObject
*Qd_Random(_self
, _args
)
2340 PyObject
*_res
= NULL
;
2342 if (!PyArg_ParseTuple(_args
, ""))
2345 _res
= Py_BuildValue("h",
2350 static PyObject
*Qd_MacGetPixel(_self
, _args
)
2354 PyObject
*_res
= NULL
;
2358 if (!PyArg_ParseTuple(_args
, "hh",
2362 _rv
= MacGetPixel(h
,
2364 _res
= Py_BuildValue("b",
2369 static PyObject
*Qd_ScalePt(_self
, _args
)
2373 PyObject
*_res
= NULL
;
2377 if (!PyArg_ParseTuple(_args
, "O&O&O&",
2378 PyMac_GetPoint
, &pt
,
2379 PyMac_GetRect
, &srcRect
,
2380 PyMac_GetRect
, &dstRect
))
2385 _res
= Py_BuildValue("O&",
2386 PyMac_BuildPoint
, pt
);
2390 static PyObject
*Qd_MapPt(_self
, _args
)
2394 PyObject
*_res
= NULL
;
2398 if (!PyArg_ParseTuple(_args
, "O&O&O&",
2399 PyMac_GetPoint
, &pt
,
2400 PyMac_GetRect
, &srcRect
,
2401 PyMac_GetRect
, &dstRect
))
2406 _res
= Py_BuildValue("O&",
2407 PyMac_BuildPoint
, pt
);
2411 static PyObject
*Qd_MapRect(_self
, _args
)
2415 PyObject
*_res
= NULL
;
2419 if (!PyArg_ParseTuple(_args
, "O&O&O&",
2421 PyMac_GetRect
, &srcRect
,
2422 PyMac_GetRect
, &dstRect
))
2427 _res
= Py_BuildValue("O&",
2428 PyMac_BuildRect
, &r
);
2432 static PyObject
*Qd_MapRgn(_self
, _args
)
2436 PyObject
*_res
= NULL
;
2440 if (!PyArg_ParseTuple(_args
, "O&O&O&",
2441 ResObj_Convert
, &rgn
,
2442 PyMac_GetRect
, &srcRect
,
2443 PyMac_GetRect
, &dstRect
))
2453 static PyObject
*Qd_MapPoly(_self
, _args
)
2457 PyObject
*_res
= NULL
;
2461 if (!PyArg_ParseTuple(_args
, "O&O&O&",
2462 ResObj_Convert
, &poly
,
2463 PyMac_GetRect
, &srcRect
,
2464 PyMac_GetRect
, &dstRect
))
2474 static PyObject
*Qd_StdBits(_self
, _args
)
2478 PyObject
*_res
= NULL
;
2484 if (!PyArg_ParseTuple(_args
, "O&O&O&hO&",
2485 BMObj_Convert
, &srcBits
,
2486 PyMac_GetRect
, &srcRect
,
2487 PyMac_GetRect
, &dstRect
,
2489 OptResObj_Convert
, &maskRgn
))
2501 static PyObject
*Qd_AddPt(_self
, _args
)
2505 PyObject
*_res
= NULL
;
2508 if (!PyArg_ParseTuple(_args
, "O&O&",
2509 PyMac_GetPoint
, &src
,
2510 PyMac_GetPoint
, &dst
))
2514 _res
= Py_BuildValue("O&",
2515 PyMac_BuildPoint
, dst
);
2519 static PyObject
*Qd_EqualPt(_self
, _args
)
2523 PyObject
*_res
= NULL
;
2527 if (!PyArg_ParseTuple(_args
, "O&O&",
2528 PyMac_GetPoint
, &pt1
,
2529 PyMac_GetPoint
, &pt2
))
2533 _res
= Py_BuildValue("b",
2538 static PyObject
*Qd_MacPtInRect(_self
, _args
)
2542 PyObject
*_res
= NULL
;
2546 if (!PyArg_ParseTuple(_args
, "O&O&",
2547 PyMac_GetPoint
, &pt
,
2550 _rv
= MacPtInRect(pt
,
2552 _res
= Py_BuildValue("b",
2557 static PyObject
*Qd_Pt2Rect(_self
, _args
)
2561 PyObject
*_res
= NULL
;
2565 if (!PyArg_ParseTuple(_args
, "O&O&",
2566 PyMac_GetPoint
, &pt1
,
2567 PyMac_GetPoint
, &pt2
))
2572 _res
= Py_BuildValue("O&",
2573 PyMac_BuildRect
, &dstRect
);
2577 static PyObject
*Qd_PtToAngle(_self
, _args
)
2581 PyObject
*_res
= NULL
;
2585 if (!PyArg_ParseTuple(_args
, "O&O&",
2587 PyMac_GetPoint
, &pt
))
2592 _res
= Py_BuildValue("h",
2597 static PyObject
*Qd_SubPt(_self
, _args
)
2601 PyObject
*_res
= NULL
;
2604 if (!PyArg_ParseTuple(_args
, "O&O&",
2605 PyMac_GetPoint
, &src
,
2606 PyMac_GetPoint
, &dst
))
2610 _res
= Py_BuildValue("O&",
2611 PyMac_BuildPoint
, dst
);
2615 static PyObject
*Qd_PtInRgn(_self
, _args
)
2619 PyObject
*_res
= NULL
;
2623 if (!PyArg_ParseTuple(_args
, "O&O&",
2624 PyMac_GetPoint
, &pt
,
2625 ResObj_Convert
, &rgn
))
2629 _res
= Py_BuildValue("b",
2634 static PyObject
*Qd_NewPixMap(_self
, _args
)
2638 PyObject
*_res
= NULL
;
2640 if (!PyArg_ParseTuple(_args
, ""))
2643 _res
= Py_BuildValue("O&",
2648 static PyObject
*Qd_DisposePixMap(_self
, _args
)
2652 PyObject
*_res
= NULL
;
2654 if (!PyArg_ParseTuple(_args
, "O&",
2655 ResObj_Convert
, &pm
))
2663 static PyObject
*Qd_CopyPixMap(_self
, _args
)
2667 PyObject
*_res
= NULL
;
2670 if (!PyArg_ParseTuple(_args
, "O&O&",
2671 ResObj_Convert
, &srcPM
,
2672 ResObj_Convert
, &dstPM
))
2681 static PyObject
*Qd_NewPixPat(_self
, _args
)
2685 PyObject
*_res
= NULL
;
2687 if (!PyArg_ParseTuple(_args
, ""))
2690 _res
= Py_BuildValue("O&",
2695 static PyObject
*Qd_DisposePixPat(_self
, _args
)
2699 PyObject
*_res
= NULL
;
2701 if (!PyArg_ParseTuple(_args
, "O&",
2702 ResObj_Convert
, &pp
))
2710 static PyObject
*Qd_CopyPixPat(_self
, _args
)
2714 PyObject
*_res
= NULL
;
2717 if (!PyArg_ParseTuple(_args
, "O&O&",
2718 ResObj_Convert
, &srcPP
,
2719 ResObj_Convert
, &dstPP
))
2728 static PyObject
*Qd_PenPixPat(_self
, _args
)
2732 PyObject
*_res
= NULL
;
2734 if (!PyArg_ParseTuple(_args
, "O&",
2735 ResObj_Convert
, &pp
))
2743 static PyObject
*Qd_BackPixPat(_self
, _args
)
2747 PyObject
*_res
= NULL
;
2749 if (!PyArg_ParseTuple(_args
, "O&",
2750 ResObj_Convert
, &pp
))
2758 static PyObject
*Qd_GetPixPat(_self
, _args
)
2762 PyObject
*_res
= NULL
;
2765 if (!PyArg_ParseTuple(_args
, "h",
2768 _rv
= GetPixPat(patID
);
2769 _res
= Py_BuildValue("O&",
2774 static PyObject
*Qd_MakeRGBPat(_self
, _args
)
2778 PyObject
*_res
= NULL
;
2781 if (!PyArg_ParseTuple(_args
, "O&O&",
2782 ResObj_Convert
, &pp
,
2783 QdRGB_Convert
, &myColor
))
2792 static PyObject
*Qd_FillCRect(_self
, _args
)
2796 PyObject
*_res
= NULL
;
2799 if (!PyArg_ParseTuple(_args
, "O&O&",
2801 ResObj_Convert
, &pp
))
2810 static PyObject
*Qd_FillCOval(_self
, _args
)
2814 PyObject
*_res
= NULL
;
2817 if (!PyArg_ParseTuple(_args
, "O&O&",
2819 ResObj_Convert
, &pp
))
2828 static PyObject
*Qd_FillCRoundRect(_self
, _args
)
2832 PyObject
*_res
= NULL
;
2837 if (!PyArg_ParseTuple(_args
, "O&hhO&",
2841 ResObj_Convert
, &pp
))
2852 static PyObject
*Qd_FillCArc(_self
, _args
)
2856 PyObject
*_res
= NULL
;
2861 if (!PyArg_ParseTuple(_args
, "O&hhO&",
2865 ResObj_Convert
, &pp
))
2876 static PyObject
*Qd_FillCRgn(_self
, _args
)
2880 PyObject
*_res
= NULL
;
2883 if (!PyArg_ParseTuple(_args
, "O&O&",
2884 ResObj_Convert
, &rgn
,
2885 ResObj_Convert
, &pp
))
2894 static PyObject
*Qd_FillCPoly(_self
, _args
)
2898 PyObject
*_res
= NULL
;
2901 if (!PyArg_ParseTuple(_args
, "O&O&",
2902 ResObj_Convert
, &poly
,
2903 ResObj_Convert
, &pp
))
2912 static PyObject
*Qd_RGBForeColor(_self
, _args
)
2916 PyObject
*_res
= NULL
;
2918 if (!PyArg_ParseTuple(_args
, "O&",
2919 QdRGB_Convert
, &color
))
2921 RGBForeColor(&color
);
2927 static PyObject
*Qd_RGBBackColor(_self
, _args
)
2931 PyObject
*_res
= NULL
;
2933 if (!PyArg_ParseTuple(_args
, "O&",
2934 QdRGB_Convert
, &color
))
2936 RGBBackColor(&color
);
2942 static PyObject
*Qd_SetCPixel(_self
, _args
)
2946 PyObject
*_res
= NULL
;
2950 if (!PyArg_ParseTuple(_args
, "hhO&",
2953 QdRGB_Convert
, &cPix
))
2963 static PyObject
*Qd_SetPortPix(_self
, _args
)
2967 PyObject
*_res
= NULL
;
2969 if (!PyArg_ParseTuple(_args
, "O&",
2970 ResObj_Convert
, &pm
))
2978 static PyObject
*Qd_GetCPixel(_self
, _args
)
2982 PyObject
*_res
= NULL
;
2986 if (!PyArg_ParseTuple(_args
, "hh",
2993 _res
= Py_BuildValue("O&",
2998 static PyObject
*Qd_GetForeColor(_self
, _args
)
3002 PyObject
*_res
= NULL
;
3004 if (!PyArg_ParseTuple(_args
, ""))
3006 GetForeColor(&color
);
3007 _res
= Py_BuildValue("O&",
3012 static PyObject
*Qd_GetBackColor(_self
, _args
)
3016 PyObject
*_res
= NULL
;
3018 if (!PyArg_ParseTuple(_args
, ""))
3020 GetBackColor(&color
);
3021 _res
= Py_BuildValue("O&",
3026 static PyObject
*Qd_OpColor(_self
, _args
)
3030 PyObject
*_res
= NULL
;
3032 if (!PyArg_ParseTuple(_args
, "O&",
3033 QdRGB_Convert
, &color
))
3041 static PyObject
*Qd_HiliteColor(_self
, _args
)
3045 PyObject
*_res
= NULL
;
3047 if (!PyArg_ParseTuple(_args
, "O&",
3048 QdRGB_Convert
, &color
))
3050 HiliteColor(&color
);
3056 static PyObject
*Qd_DisposeCTable(_self
, _args
)
3060 PyObject
*_res
= NULL
;
3062 if (!PyArg_ParseTuple(_args
, "O&",
3063 ResObj_Convert
, &cTable
))
3065 DisposeCTable(cTable
);
3071 static PyObject
*Qd_GetCTable(_self
, _args
)
3075 PyObject
*_res
= NULL
;
3078 if (!PyArg_ParseTuple(_args
, "h",
3081 _rv
= GetCTable(ctID
);
3082 _res
= Py_BuildValue("O&",
3087 static PyObject
*Qd_GetCCursor(_self
, _args
)
3091 PyObject
*_res
= NULL
;
3094 if (!PyArg_ParseTuple(_args
, "h",
3097 _rv
= GetCCursor(crsrID
);
3098 _res
= Py_BuildValue("O&",
3103 static PyObject
*Qd_SetCCursor(_self
, _args
)
3107 PyObject
*_res
= NULL
;
3109 if (!PyArg_ParseTuple(_args
, "O&",
3110 ResObj_Convert
, &cCrsr
))
3118 static PyObject
*Qd_AllocCursor(_self
, _args
)
3122 PyObject
*_res
= NULL
;
3123 if (!PyArg_ParseTuple(_args
, ""))
3131 static PyObject
*Qd_DisposeCCursor(_self
, _args
)
3135 PyObject
*_res
= NULL
;
3137 if (!PyArg_ParseTuple(_args
, "O&",
3138 ResObj_Convert
, &cCrsr
))
3140 DisposeCCursor(cCrsr
);
3146 static PyObject
*Qd_GetMaxDevice(_self
, _args
)
3150 PyObject
*_res
= NULL
;
3153 if (!PyArg_ParseTuple(_args
, "O&",
3154 PyMac_GetRect
, &globalRect
))
3156 _rv
= GetMaxDevice(&globalRect
);
3157 _res
= Py_BuildValue("O&",
3162 static PyObject
*Qd_GetCTSeed(_self
, _args
)
3166 PyObject
*_res
= NULL
;
3168 if (!PyArg_ParseTuple(_args
, ""))
3171 _res
= Py_BuildValue("l",
3176 static PyObject
*Qd_GetDeviceList(_self
, _args
)
3180 PyObject
*_res
= NULL
;
3182 if (!PyArg_ParseTuple(_args
, ""))
3184 _rv
= GetDeviceList();
3185 _res
= Py_BuildValue("O&",
3190 static PyObject
*Qd_GetMainDevice(_self
, _args
)
3194 PyObject
*_res
= NULL
;
3196 if (!PyArg_ParseTuple(_args
, ""))
3198 _rv
= GetMainDevice();
3199 _res
= Py_BuildValue("O&",
3204 static PyObject
*Qd_GetNextDevice(_self
, _args
)
3208 PyObject
*_res
= NULL
;
3211 if (!PyArg_ParseTuple(_args
, "O&",
3212 ResObj_Convert
, &curDevice
))
3214 _rv
= GetNextDevice(curDevice
);
3215 _res
= Py_BuildValue("O&",
3220 static PyObject
*Qd_TestDeviceAttribute(_self
, _args
)
3224 PyObject
*_res
= NULL
;
3228 if (!PyArg_ParseTuple(_args
, "O&h",
3229 ResObj_Convert
, &gdh
,
3232 _rv
= TestDeviceAttribute(gdh
,
3234 _res
= Py_BuildValue("b",
3239 static PyObject
*Qd_SetDeviceAttribute(_self
, _args
)
3243 PyObject
*_res
= NULL
;
3247 if (!PyArg_ParseTuple(_args
, "O&hb",
3248 ResObj_Convert
, &gdh
,
3252 SetDeviceAttribute(gdh
,
3260 static PyObject
*Qd_InitGDevice(_self
, _args
)
3264 PyObject
*_res
= NULL
;
3268 if (!PyArg_ParseTuple(_args
, "hlO&",
3271 ResObj_Convert
, &gdh
))
3273 InitGDevice(qdRefNum
,
3281 static PyObject
*Qd_NewGDevice(_self
, _args
)
3285 PyObject
*_res
= NULL
;
3289 if (!PyArg_ParseTuple(_args
, "hl",
3293 _rv
= NewGDevice(refNum
,
3295 _res
= Py_BuildValue("O&",
3300 static PyObject
*Qd_DisposeGDevice(_self
, _args
)
3304 PyObject
*_res
= NULL
;
3306 if (!PyArg_ParseTuple(_args
, "O&",
3307 ResObj_Convert
, &gdh
))
3309 DisposeGDevice(gdh
);
3315 static PyObject
*Qd_SetGDevice(_self
, _args
)
3319 PyObject
*_res
= NULL
;
3321 if (!PyArg_ParseTuple(_args
, "O&",
3322 ResObj_Convert
, &gd
))
3330 static PyObject
*Qd_GetGDevice(_self
, _args
)
3334 PyObject
*_res
= NULL
;
3336 if (!PyArg_ParseTuple(_args
, ""))
3339 _res
= Py_BuildValue("O&",
3344 static PyObject
*Qd_Color2Index(_self
, _args
)
3348 PyObject
*_res
= NULL
;
3351 if (!PyArg_ParseTuple(_args
, "O&",
3352 QdRGB_Convert
, &myColor
))
3354 _rv
= Color2Index(&myColor
);
3355 _res
= Py_BuildValue("l",
3360 static PyObject
*Qd_Index2Color(_self
, _args
)
3364 PyObject
*_res
= NULL
;
3367 if (!PyArg_ParseTuple(_args
, "l",
3372 _res
= Py_BuildValue("O&",
3373 QdRGB_New
, &aColor
);
3377 static PyObject
*Qd_InvertColor(_self
, _args
)
3381 PyObject
*_res
= NULL
;
3383 if (!PyArg_ParseTuple(_args
, ""))
3385 InvertColor(&myColor
);
3386 _res
= Py_BuildValue("O&",
3387 QdRGB_New
, &myColor
);
3391 static PyObject
*Qd_RealColor(_self
, _args
)
3395 PyObject
*_res
= NULL
;
3398 if (!PyArg_ParseTuple(_args
, "O&",
3399 QdRGB_Convert
, &color
))
3401 _rv
= RealColor(&color
);
3402 _res
= Py_BuildValue("b",
3407 static PyObject
*Qd_GetSubTable(_self
, _args
)
3411 PyObject
*_res
= NULL
;
3412 CTabHandle myColors
;
3414 CTabHandle targetTbl
;
3415 if (!PyArg_ParseTuple(_args
, "O&hO&",
3416 ResObj_Convert
, &myColors
,
3418 ResObj_Convert
, &targetTbl
))
3420 GetSubTable(myColors
,
3428 static PyObject
*Qd_MakeITable(_self
, _args
)
3432 PyObject
*_res
= NULL
;
3436 if (!PyArg_ParseTuple(_args
, "O&O&h",
3437 ResObj_Convert
, &cTabH
,
3438 ResObj_Convert
, &iTabH
,
3449 static PyObject
*Qd_SetClientID(_self
, _args
)
3453 PyObject
*_res
= NULL
;
3455 if (!PyArg_ParseTuple(_args
, "h",
3464 static PyObject
*Qd_ProtectEntry(_self
, _args
)
3468 PyObject
*_res
= NULL
;
3471 if (!PyArg_ParseTuple(_args
, "hb",
3482 static PyObject
*Qd_ReserveEntry(_self
, _args
)
3486 PyObject
*_res
= NULL
;
3489 if (!PyArg_ParseTuple(_args
, "hb",
3500 static PyObject
*Qd_QDError(_self
, _args
)
3504 PyObject
*_res
= NULL
;
3506 if (!PyArg_ParseTuple(_args
, ""))
3509 _res
= Py_BuildValue("h",
3514 static PyObject
*Qd_CopyDeepMask(_self
, _args
)
3518 PyObject
*_res
= NULL
;
3527 if (!PyArg_ParseTuple(_args
, "O&O&O&O&O&O&hO&",
3528 BMObj_Convert
, &srcBits
,
3529 BMObj_Convert
, &maskBits
,
3530 BMObj_Convert
, &dstBits
,
3531 PyMac_GetRect
, &srcRect
,
3532 PyMac_GetRect
, &maskRect
,
3533 PyMac_GetRect
, &dstRect
,
3535 OptResObj_Convert
, &maskRgn
))
3537 CopyDeepMask(srcBits
,
3550 static PyObject
*Qd_GetPattern(_self
, _args
)
3554 PyObject
*_res
= NULL
;
3557 if (!PyArg_ParseTuple(_args
, "h",
3560 _rv
= GetPattern(patternID
);
3561 _res
= Py_BuildValue("O&",
3566 static PyObject
*Qd_MacGetCursor(_self
, _args
)
3570 PyObject
*_res
= NULL
;
3573 if (!PyArg_ParseTuple(_args
, "h",
3576 _rv
= MacGetCursor(cursorID
);
3577 _res
= Py_BuildValue("O&",
3582 static PyObject
*Qd_GetPicture(_self
, _args
)
3586 PyObject
*_res
= NULL
;
3589 if (!PyArg_ParseTuple(_args
, "h",
3592 _rv
= GetPicture(pictureID
);
3593 _res
= Py_BuildValue("O&",
3598 static PyObject
*Qd_DeltaPoint(_self
, _args
)
3602 PyObject
*_res
= NULL
;
3606 if (!PyArg_ParseTuple(_args
, "O&O&",
3607 PyMac_GetPoint
, &ptA
,
3608 PyMac_GetPoint
, &ptB
))
3610 _rv
= DeltaPoint(ptA
,
3612 _res
= Py_BuildValue("l",
3617 static PyObject
*Qd_ShieldCursor(_self
, _args
)
3621 PyObject
*_res
= NULL
;
3624 if (!PyArg_ParseTuple(_args
, "O&O&",
3625 PyMac_GetRect
, &shieldRect
,
3626 PyMac_GetPoint
, &offsetPt
))
3628 ShieldCursor(&shieldRect
,
3635 static PyObject
*Qd_ScreenRes(_self
, _args
)
3639 PyObject
*_res
= NULL
;
3642 if (!PyArg_ParseTuple(_args
, ""))
3644 ScreenRes(&scrnHRes
,
3646 _res
= Py_BuildValue("hh",
3652 static PyObject
*Qd_GetIndPattern(_self
, _args
)
3656 PyObject
*_res
= NULL
;
3657 Pattern thePat__out__
;
3658 short patternListID
;
3660 if (!PyArg_ParseTuple(_args
, "hh",
3664 GetIndPattern(&thePat__out__
,
3667 _res
= Py_BuildValue("s#",
3668 (char *)&thePat__out__
, (int)sizeof(Pattern
));
3673 static PyObject
*Qd_SlopeFromAngle(_self
, _args
)
3677 PyObject
*_res
= NULL
;
3680 if (!PyArg_ParseTuple(_args
, "h",
3683 _rv
= SlopeFromAngle(angle
);
3684 _res
= Py_BuildValue("O&",
3685 PyMac_BuildFixed
, _rv
);
3689 static PyObject
*Qd_AngleFromSlope(_self
, _args
)
3693 PyObject
*_res
= NULL
;
3696 if (!PyArg_ParseTuple(_args
, "O&",
3697 PyMac_GetFixed
, &slope
))
3699 _rv
= AngleFromSlope(slope
);
3700 _res
= Py_BuildValue("h",
3705 static PyObject
*Qd_TextFont(_self
, _args
)
3709 PyObject
*_res
= NULL
;
3711 if (!PyArg_ParseTuple(_args
, "h",
3720 static PyObject
*Qd_TextFace(_self
, _args
)
3724 PyObject
*_res
= NULL
;
3725 StyleParameter face
;
3726 if (!PyArg_ParseTuple(_args
, "h",
3735 static PyObject
*Qd_TextMode(_self
, _args
)
3739 PyObject
*_res
= NULL
;
3741 if (!PyArg_ParseTuple(_args
, "h",
3750 static PyObject
*Qd_TextSize(_self
, _args
)
3754 PyObject
*_res
= NULL
;
3756 if (!PyArg_ParseTuple(_args
, "h",
3765 static PyObject
*Qd_SpaceExtra(_self
, _args
)
3769 PyObject
*_res
= NULL
;
3771 if (!PyArg_ParseTuple(_args
, "O&",
3772 PyMac_GetFixed
, &extra
))
3780 static PyObject
*Qd_DrawChar(_self
, _args
)
3784 PyObject
*_res
= NULL
;
3786 if (!PyArg_ParseTuple(_args
, "h",
3795 static PyObject
*Qd_DrawString(_self
, _args
)
3799 PyObject
*_res
= NULL
;
3801 if (!PyArg_ParseTuple(_args
, "O&",
3802 PyMac_GetStr255
, s
))
3810 static PyObject
*Qd_MacDrawText(_self
, _args
)
3814 PyObject
*_res
= NULL
;
3815 char *textBuf__in__
;
3817 int textBuf__in_len__
;
3820 if (!PyArg_ParseTuple(_args
, "s#hh",
3821 &textBuf__in__
, &textBuf__in_len__
,
3825 MacDrawText(textBuf__in__
,
3834 static PyObject
*Qd_CharWidth(_self
, _args
)
3838 PyObject
*_res
= NULL
;
3841 if (!PyArg_ParseTuple(_args
, "h",
3844 _rv
= CharWidth(ch
);
3845 _res
= Py_BuildValue("h",
3850 static PyObject
*Qd_StringWidth(_self
, _args
)
3854 PyObject
*_res
= NULL
;
3857 if (!PyArg_ParseTuple(_args
, "O&",
3858 PyMac_GetStr255
, s
))
3860 _rv
= StringWidth(s
);
3861 _res
= Py_BuildValue("h",
3866 static PyObject
*Qd_TextWidth(_self
, _args
)
3870 PyObject
*_res
= NULL
;
3872 char *textBuf__in__
;
3874 int textBuf__in_len__
;
3877 if (!PyArg_ParseTuple(_args
, "s#hh",
3878 &textBuf__in__
, &textBuf__in_len__
,
3882 _rv
= TextWidth(textBuf__in__
,
3885 _res
= Py_BuildValue("h",
3891 static PyObject
*Qd_GetFontInfo(_self
, _args
)
3895 PyObject
*_res
= NULL
;
3897 if (!PyArg_ParseTuple(_args
, ""))
3900 _res
= Py_BuildValue("O&",
3905 static PyObject
*Qd_CharExtra(_self
, _args
)
3909 PyObject
*_res
= NULL
;
3911 if (!PyArg_ParseTuple(_args
, "O&",
3912 PyMac_GetFixed
, &extra
))
3920 static PyObject
*Qd_SetPort(_self
, _args
)
3924 PyObject
*_res
= NULL
;
3926 if (!PyArg_ParseTuple(_args
, "O&",
3927 GrafObj_Convert
, &thePort
))
3935 static PyObject
*Qd_GetCursor(_self
, _args
)
3939 PyObject
*_res
= NULL
;
3942 if (!PyArg_ParseTuple(_args
, "h",
3945 _rv
= GetCursor(cursorID
);
3946 _res
= Py_BuildValue("O&",
3951 static PyObject
*Qd_SetCursor(_self
, _args
)
3955 PyObject
*_res
= NULL
;
3958 if (!PyArg_ParseTuple(_args
, "s#",
3959 (char **)&crsr__in__
, &crsr__in_len__
))
3961 if (crsr__in_len__
!= sizeof(Cursor
))
3963 PyErr_SetString(PyExc_TypeError
, "buffer length should be sizeof(Cursor)");
3966 SetCursor(crsr__in__
);
3973 static PyObject
*Qd_ShowCursor(_self
, _args
)
3977 PyObject
*_res
= NULL
;
3978 if (!PyArg_ParseTuple(_args
, ""))
3986 static PyObject
*Qd_LineTo(_self
, _args
)
3990 PyObject
*_res
= NULL
;
3993 if (!PyArg_ParseTuple(_args
, "hh",
4004 static PyObject
*Qd_SetRect(_self
, _args
)
4008 PyObject
*_res
= NULL
;
4014 if (!PyArg_ParseTuple(_args
, "hhhh",
4025 _res
= Py_BuildValue("O&",
4026 PyMac_BuildRect
, &r
);
4030 static PyObject
*Qd_OffsetRect(_self
, _args
)
4034 PyObject
*_res
= NULL
;
4038 if (!PyArg_ParseTuple(_args
, "O&hh",
4046 _res
= Py_BuildValue("O&",
4047 PyMac_BuildRect
, &r
);
4051 static PyObject
*Qd_InsetRect(_self
, _args
)
4055 PyObject
*_res
= NULL
;
4059 if (!PyArg_ParseTuple(_args
, "O&hh",
4067 _res
= Py_BuildValue("O&",
4068 PyMac_BuildRect
, &r
);
4072 static PyObject
*Qd_UnionRect(_self
, _args
)
4076 PyObject
*_res
= NULL
;
4080 if (!PyArg_ParseTuple(_args
, "O&O&",
4081 PyMac_GetRect
, &src1
,
4082 PyMac_GetRect
, &src2
))
4087 _res
= Py_BuildValue("O&",
4088 PyMac_BuildRect
, &dstRect
);
4092 static PyObject
*Qd_EqualRect(_self
, _args
)
4096 PyObject
*_res
= NULL
;
4100 if (!PyArg_ParseTuple(_args
, "O&O&",
4101 PyMac_GetRect
, &rect1
,
4102 PyMac_GetRect
, &rect2
))
4104 _rv
= EqualRect(&rect1
,
4106 _res
= Py_BuildValue("b",
4111 static PyObject
*Qd_FrameRect(_self
, _args
)
4115 PyObject
*_res
= NULL
;
4117 if (!PyArg_ParseTuple(_args
, "O&",
4126 static PyObject
*Qd_InvertRect(_self
, _args
)
4130 PyObject
*_res
= NULL
;
4132 if (!PyArg_ParseTuple(_args
, "O&",
4141 static PyObject
*Qd_FillRect(_self
, _args
)
4145 PyObject
*_res
= NULL
;
4149 if (!PyArg_ParseTuple(_args
, "O&s#",
4151 (char **)&pat__in__
, &pat__in_len__
))
4153 if (pat__in_len__
!= sizeof(Pattern
))
4155 PyErr_SetString(PyExc_TypeError
, "buffer length should be sizeof(Pattern)");
4166 static PyObject
*Qd_CopyRgn(_self
, _args
)
4170 PyObject
*_res
= NULL
;
4173 if (!PyArg_ParseTuple(_args
, "O&O&",
4174 ResObj_Convert
, &srcRgn
,
4175 ResObj_Convert
, &dstRgn
))
4184 static PyObject
*Qd_SetRectRgn(_self
, _args
)
4188 PyObject
*_res
= NULL
;
4194 if (!PyArg_ParseTuple(_args
, "O&hhhh",
4195 ResObj_Convert
, &rgn
,
4211 static PyObject
*Qd_OffsetRgn(_self
, _args
)
4215 PyObject
*_res
= NULL
;
4219 if (!PyArg_ParseTuple(_args
, "O&hh",
4220 ResObj_Convert
, &rgn
,
4232 static PyObject
*Qd_UnionRgn(_self
, _args
)
4236 PyObject
*_res
= NULL
;
4240 if (!PyArg_ParseTuple(_args
, "O&O&O&",
4241 ResObj_Convert
, &srcRgnA
,
4242 ResObj_Convert
, &srcRgnB
,
4243 ResObj_Convert
, &dstRgn
))
4253 static PyObject
*Qd_XorRgn(_self
, _args
)
4257 PyObject
*_res
= NULL
;
4261 if (!PyArg_ParseTuple(_args
, "O&O&O&",
4262 ResObj_Convert
, &srcRgnA
,
4263 ResObj_Convert
, &srcRgnB
,
4264 ResObj_Convert
, &dstRgn
))
4274 static PyObject
*Qd_EqualRgn(_self
, _args
)
4278 PyObject
*_res
= NULL
;
4282 if (!PyArg_ParseTuple(_args
, "O&O&",
4283 ResObj_Convert
, &rgnA
,
4284 ResObj_Convert
, &rgnB
))
4286 _rv
= EqualRgn(rgnA
,
4288 _res
= Py_BuildValue("b",
4293 static PyObject
*Qd_FrameRgn(_self
, _args
)
4297 PyObject
*_res
= NULL
;
4299 if (!PyArg_ParseTuple(_args
, "O&",
4300 ResObj_Convert
, &rgn
))
4308 static PyObject
*Qd_PaintRgn(_self
, _args
)
4312 PyObject
*_res
= NULL
;
4314 if (!PyArg_ParseTuple(_args
, "O&",
4315 ResObj_Convert
, &rgn
))
4323 static PyObject
*Qd_InvertRgn(_self
, _args
)
4327 PyObject
*_res
= NULL
;
4329 if (!PyArg_ParseTuple(_args
, "O&",
4330 ResObj_Convert
, &rgn
))
4338 static PyObject
*Qd_FillRgn(_self
, _args
)
4342 PyObject
*_res
= NULL
;
4346 if (!PyArg_ParseTuple(_args
, "O&s#",
4347 ResObj_Convert
, &rgn
,
4348 (char **)&pat__in__
, &pat__in_len__
))
4350 if (pat__in_len__
!= sizeof(Pattern
))
4352 PyErr_SetString(PyExc_TypeError
, "buffer length should be sizeof(Pattern)");
4363 static PyObject
*Qd_GetPixel(_self
, _args
)
4367 PyObject
*_res
= NULL
;
4371 if (!PyArg_ParseTuple(_args
, "hh",
4377 _res
= Py_BuildValue("b",
4382 static PyObject
*Qd_PtInRect(_self
, _args
)
4386 PyObject
*_res
= NULL
;
4390 if (!PyArg_ParseTuple(_args
, "O&O&",
4391 PyMac_GetPoint
, &pt
,
4396 _res
= Py_BuildValue("b",
4401 static PyObject
*Qd_DrawText(_self
, _args
)
4405 PyObject
*_res
= NULL
;
4406 char *textBuf__in__
;
4408 int textBuf__in_len__
;
4411 if (!PyArg_ParseTuple(_args
, "s#hh",
4412 &textBuf__in__
, &textBuf__in_len__
,
4416 DrawText(textBuf__in__
,
4425 static PyObject
*Qd_BitMap(_self
, _args
)
4429 PyObject
*_res
= NULL
;
4437 if ( !PyArg_ParseTuple(_args
, "O!iO&", &PyString_Type
, &source
, &rowbytes
, PyMac_GetRect
,
4440 data
= PyString_AsString(source
);
4441 if ((ptr
=(BitMap
*)malloc(sizeof(BitMap
))) == NULL
)
4442 return PyErr_NoMemory();
4443 ptr
->baseAddr
= (Ptr
)data
;
4444 ptr
->rowBytes
= rowbytes
;
4445 ptr
->bounds
= bounds
;
4446 if ( (_res
= BMObj_New(ptr
)) == NULL
) {
4450 ((BitMapObject
*)_res
)->referred_object
= source
;
4452 ((BitMapObject
*)_res
)->referred_bitmap
= ptr
;
4457 static PyObject
*Qd_RawBitMap(_self
, _args
)
4461 PyObject
*_res
= NULL
;
4466 if ( !PyArg_ParseTuple(_args
, "O!", &PyString_Type
, &source
) )
4468 if ( PyString_Size(source
) != sizeof(BitMap
) && PyString_Size(source
) != sizeof(PixMap
) ) {
4469 PyErr_BadArgument();
4472 ptr
= (BitMapPtr
)PyString_AsString(source
);
4473 if ( (_res
= BMObj_New(ptr
)) == NULL
) {
4476 ((BitMapObject
*)_res
)->referred_object
= source
;
4482 static PyMethodDef Qd_methods
[] = {
4483 {"MacSetPort", (PyCFunction
)Qd_MacSetPort
, 1,
4484 "(GrafPtr port) -> None"},
4485 {"GetPort", (PyCFunction
)Qd_GetPort
, 1,
4486 "() -> (GrafPtr port)"},
4487 {"GrafDevice", (PyCFunction
)Qd_GrafDevice
, 1,
4488 "(short device) -> None"},
4489 {"SetPortBits", (PyCFunction
)Qd_SetPortBits
, 1,
4490 "(BitMapPtr bm) -> None"},
4491 {"PortSize", (PyCFunction
)Qd_PortSize
, 1,
4492 "(short width, short height) -> None"},
4493 {"MovePortTo", (PyCFunction
)Qd_MovePortTo
, 1,
4494 "(short leftGlobal, short topGlobal) -> None"},
4495 {"SetOrigin", (PyCFunction
)Qd_SetOrigin
, 1,
4496 "(short h, short v) -> None"},
4497 {"SetClip", (PyCFunction
)Qd_SetClip
, 1,
4498 "(RgnHandle rgn) -> None"},
4499 {"GetClip", (PyCFunction
)Qd_GetClip
, 1,
4500 "(RgnHandle rgn) -> None"},
4501 {"ClipRect", (PyCFunction
)Qd_ClipRect
, 1,
4502 "(Rect r) -> None"},
4503 {"BackPat", (PyCFunction
)Qd_BackPat
, 1,
4504 "(Pattern pat) -> None"},
4505 {"InitCursor", (PyCFunction
)Qd_InitCursor
, 1,
4507 {"MacSetCursor", (PyCFunction
)Qd_MacSetCursor
, 1,
4508 "(Cursor crsr) -> None"},
4509 {"HideCursor", (PyCFunction
)Qd_HideCursor
, 1,
4511 {"MacShowCursor", (PyCFunction
)Qd_MacShowCursor
, 1,
4513 {"ObscureCursor", (PyCFunction
)Qd_ObscureCursor
, 1,
4515 {"HidePen", (PyCFunction
)Qd_HidePen
, 1,
4517 {"ShowPen", (PyCFunction
)Qd_ShowPen
, 1,
4519 {"GetPen", (PyCFunction
)Qd_GetPen
, 1,
4520 "() -> (Point pt)"},
4521 {"GetPenState", (PyCFunction
)Qd_GetPenState
, 1,
4522 "() -> (PenState pnState)"},
4523 {"SetPenState", (PyCFunction
)Qd_SetPenState
, 1,
4524 "(PenState pnState) -> None"},
4525 {"PenSize", (PyCFunction
)Qd_PenSize
, 1,
4526 "(short width, short height) -> None"},
4527 {"PenMode", (PyCFunction
)Qd_PenMode
, 1,
4528 "(short mode) -> None"},
4529 {"PenPat", (PyCFunction
)Qd_PenPat
, 1,
4530 "(Pattern pat) -> None"},
4531 {"PenNormal", (PyCFunction
)Qd_PenNormal
, 1,
4533 {"MoveTo", (PyCFunction
)Qd_MoveTo
, 1,
4534 "(short h, short v) -> None"},
4535 {"Move", (PyCFunction
)Qd_Move
, 1,
4536 "(short dh, short dv) -> None"},
4537 {"MacLineTo", (PyCFunction
)Qd_MacLineTo
, 1,
4538 "(short h, short v) -> None"},
4539 {"Line", (PyCFunction
)Qd_Line
, 1,
4540 "(short dh, short dv) -> None"},
4541 {"ForeColor", (PyCFunction
)Qd_ForeColor
, 1,
4542 "(long color) -> None"},
4543 {"BackColor", (PyCFunction
)Qd_BackColor
, 1,
4544 "(long color) -> None"},
4545 {"ColorBit", (PyCFunction
)Qd_ColorBit
, 1,
4546 "(short whichBit) -> None"},
4547 {"MacSetRect", (PyCFunction
)Qd_MacSetRect
, 1,
4548 "(short left, short top, short right, short bottom) -> (Rect r)"},
4549 {"MacOffsetRect", (PyCFunction
)Qd_MacOffsetRect
, 1,
4550 "(Rect r, short dh, short dv) -> (Rect r)"},
4551 {"MacInsetRect", (PyCFunction
)Qd_MacInsetRect
, 1,
4552 "(Rect r, short dh, short dv) -> (Rect r)"},
4553 {"SectRect", (PyCFunction
)Qd_SectRect
, 1,
4554 "(Rect src1, Rect src2) -> (Boolean _rv, Rect dstRect)"},
4555 {"MacUnionRect", (PyCFunction
)Qd_MacUnionRect
, 1,
4556 "(Rect src1, Rect src2) -> (Rect dstRect)"},
4557 {"MacEqualRect", (PyCFunction
)Qd_MacEqualRect
, 1,
4558 "(Rect rect1, Rect rect2) -> (Boolean _rv)"},
4559 {"EmptyRect", (PyCFunction
)Qd_EmptyRect
, 1,
4560 "(Rect r) -> (Boolean _rv)"},
4561 {"MacFrameRect", (PyCFunction
)Qd_MacFrameRect
, 1,
4562 "(Rect r) -> None"},
4563 {"PaintRect", (PyCFunction
)Qd_PaintRect
, 1,
4564 "(Rect r) -> None"},
4565 {"EraseRect", (PyCFunction
)Qd_EraseRect
, 1,
4566 "(Rect r) -> None"},
4567 {"MacInvertRect", (PyCFunction
)Qd_MacInvertRect
, 1,
4568 "(Rect r) -> None"},
4569 {"MacFillRect", (PyCFunction
)Qd_MacFillRect
, 1,
4570 "(Rect r, Pattern pat) -> None"},
4571 {"FrameOval", (PyCFunction
)Qd_FrameOval
, 1,
4572 "(Rect r) -> None"},
4573 {"PaintOval", (PyCFunction
)Qd_PaintOval
, 1,
4574 "(Rect r) -> None"},
4575 {"EraseOval", (PyCFunction
)Qd_EraseOval
, 1,
4576 "(Rect r) -> None"},
4577 {"InvertOval", (PyCFunction
)Qd_InvertOval
, 1,
4578 "(Rect r) -> None"},
4579 {"FillOval", (PyCFunction
)Qd_FillOval
, 1,
4580 "(Rect r, Pattern pat) -> None"},
4581 {"FrameRoundRect", (PyCFunction
)Qd_FrameRoundRect
, 1,
4582 "(Rect r, short ovalWidth, short ovalHeight) -> None"},
4583 {"PaintRoundRect", (PyCFunction
)Qd_PaintRoundRect
, 1,
4584 "(Rect r, short ovalWidth, short ovalHeight) -> None"},
4585 {"EraseRoundRect", (PyCFunction
)Qd_EraseRoundRect
, 1,
4586 "(Rect r, short ovalWidth, short ovalHeight) -> None"},
4587 {"InvertRoundRect", (PyCFunction
)Qd_InvertRoundRect
, 1,
4588 "(Rect r, short ovalWidth, short ovalHeight) -> None"},
4589 {"FillRoundRect", (PyCFunction
)Qd_FillRoundRect
, 1,
4590 "(Rect r, short ovalWidth, short ovalHeight, Pattern pat) -> None"},
4591 {"FrameArc", (PyCFunction
)Qd_FrameArc
, 1,
4592 "(Rect r, short startAngle, short arcAngle) -> None"},
4593 {"PaintArc", (PyCFunction
)Qd_PaintArc
, 1,
4594 "(Rect r, short startAngle, short arcAngle) -> None"},
4595 {"EraseArc", (PyCFunction
)Qd_EraseArc
, 1,
4596 "(Rect r, short startAngle, short arcAngle) -> None"},
4597 {"InvertArc", (PyCFunction
)Qd_InvertArc
, 1,
4598 "(Rect r, short startAngle, short arcAngle) -> None"},
4599 {"FillArc", (PyCFunction
)Qd_FillArc
, 1,
4600 "(Rect r, short startAngle, short arcAngle, Pattern pat) -> None"},
4601 {"NewRgn", (PyCFunction
)Qd_NewRgn
, 1,
4602 "() -> (RgnHandle _rv)"},
4603 {"OpenRgn", (PyCFunction
)Qd_OpenRgn
, 1,
4605 {"CloseRgn", (PyCFunction
)Qd_CloseRgn
, 1,
4606 "(RgnHandle dstRgn) -> None"},
4607 {"BitMapToRegion", (PyCFunction
)Qd_BitMapToRegion
, 1,
4608 "(RgnHandle region, BitMapPtr bMap) -> None"},
4609 {"DisposeRgn", (PyCFunction
)Qd_DisposeRgn
, 1,
4610 "(RgnHandle rgn) -> None"},
4611 {"MacCopyRgn", (PyCFunction
)Qd_MacCopyRgn
, 1,
4612 "(RgnHandle srcRgn, RgnHandle dstRgn) -> None"},
4613 {"SetEmptyRgn", (PyCFunction
)Qd_SetEmptyRgn
, 1,
4614 "(RgnHandle rgn) -> None"},
4615 {"MacSetRectRgn", (PyCFunction
)Qd_MacSetRectRgn
, 1,
4616 "(RgnHandle rgn, short left, short top, short right, short bottom) -> None"},
4617 {"RectRgn", (PyCFunction
)Qd_RectRgn
, 1,
4618 "(RgnHandle rgn, Rect r) -> None"},
4619 {"MacOffsetRgn", (PyCFunction
)Qd_MacOffsetRgn
, 1,
4620 "(RgnHandle rgn, short dh, short dv) -> None"},
4621 {"InsetRgn", (PyCFunction
)Qd_InsetRgn
, 1,
4622 "(RgnHandle rgn, short dh, short dv) -> None"},
4623 {"SectRgn", (PyCFunction
)Qd_SectRgn
, 1,
4624 "(RgnHandle srcRgnA, RgnHandle srcRgnB, RgnHandle dstRgn) -> None"},
4625 {"MacUnionRgn", (PyCFunction
)Qd_MacUnionRgn
, 1,
4626 "(RgnHandle srcRgnA, RgnHandle srcRgnB, RgnHandle dstRgn) -> None"},
4627 {"DiffRgn", (PyCFunction
)Qd_DiffRgn
, 1,
4628 "(RgnHandle srcRgnA, RgnHandle srcRgnB, RgnHandle dstRgn) -> None"},
4629 {"MacXorRgn", (PyCFunction
)Qd_MacXorRgn
, 1,
4630 "(RgnHandle srcRgnA, RgnHandle srcRgnB, RgnHandle dstRgn) -> None"},
4631 {"RectInRgn", (PyCFunction
)Qd_RectInRgn
, 1,
4632 "(Rect r, RgnHandle rgn) -> (Boolean _rv)"},
4633 {"MacEqualRgn", (PyCFunction
)Qd_MacEqualRgn
, 1,
4634 "(RgnHandle rgnA, RgnHandle rgnB) -> (Boolean _rv)"},
4635 {"EmptyRgn", (PyCFunction
)Qd_EmptyRgn
, 1,
4636 "(RgnHandle rgn) -> (Boolean _rv)"},
4637 {"MacFrameRgn", (PyCFunction
)Qd_MacFrameRgn
, 1,
4638 "(RgnHandle rgn) -> None"},
4639 {"MacPaintRgn", (PyCFunction
)Qd_MacPaintRgn
, 1,
4640 "(RgnHandle rgn) -> None"},
4641 {"EraseRgn", (PyCFunction
)Qd_EraseRgn
, 1,
4642 "(RgnHandle rgn) -> None"},
4643 {"MacInvertRgn", (PyCFunction
)Qd_MacInvertRgn
, 1,
4644 "(RgnHandle rgn) -> None"},
4645 {"MacFillRgn", (PyCFunction
)Qd_MacFillRgn
, 1,
4646 "(RgnHandle rgn, Pattern pat) -> None"},
4647 {"ScrollRect", (PyCFunction
)Qd_ScrollRect
, 1,
4648 "(Rect r, short dh, short dv, RgnHandle updateRgn) -> None"},
4649 {"CopyBits", (PyCFunction
)Qd_CopyBits
, 1,
4650 "(BitMapPtr srcBits, BitMapPtr dstBits, Rect srcRect, Rect dstRect, short mode, RgnHandle maskRgn) -> None"},
4651 {"CopyMask", (PyCFunction
)Qd_CopyMask
, 1,
4652 "(BitMapPtr srcBits, BitMapPtr maskBits, BitMapPtr dstBits, Rect srcRect, Rect maskRect, Rect dstRect) -> None"},
4653 {"OpenPicture", (PyCFunction
)Qd_OpenPicture
, 1,
4654 "(Rect picFrame) -> (PicHandle _rv)"},
4655 {"PicComment", (PyCFunction
)Qd_PicComment
, 1,
4656 "(short kind, short dataSize, Handle dataHandle) -> None"},
4657 {"ClosePicture", (PyCFunction
)Qd_ClosePicture
, 1,
4659 {"DrawPicture", (PyCFunction
)Qd_DrawPicture
, 1,
4660 "(PicHandle myPicture, Rect dstRect) -> None"},
4661 {"KillPicture", (PyCFunction
)Qd_KillPicture
, 1,
4662 "(PicHandle myPicture) -> None"},
4663 {"OpenPoly", (PyCFunction
)Qd_OpenPoly
, 1,
4664 "() -> (PolyHandle _rv)"},
4665 {"ClosePoly", (PyCFunction
)Qd_ClosePoly
, 1,
4667 {"KillPoly", (PyCFunction
)Qd_KillPoly
, 1,
4668 "(PolyHandle poly) -> None"},
4669 {"OffsetPoly", (PyCFunction
)Qd_OffsetPoly
, 1,
4670 "(PolyHandle poly, short dh, short dv) -> None"},
4671 {"FramePoly", (PyCFunction
)Qd_FramePoly
, 1,
4672 "(PolyHandle poly) -> None"},
4673 {"PaintPoly", (PyCFunction
)Qd_PaintPoly
, 1,
4674 "(PolyHandle poly) -> None"},
4675 {"ErasePoly", (PyCFunction
)Qd_ErasePoly
, 1,
4676 "(PolyHandle poly) -> None"},
4677 {"InvertPoly", (PyCFunction
)Qd_InvertPoly
, 1,
4678 "(PolyHandle poly) -> None"},
4679 {"FillPoly", (PyCFunction
)Qd_FillPoly
, 1,
4680 "(PolyHandle poly, Pattern pat) -> None"},
4681 {"SetPt", (PyCFunction
)Qd_SetPt
, 1,
4682 "(short h, short v) -> (Point pt)"},
4683 {"LocalToGlobal", (PyCFunction
)Qd_LocalToGlobal
, 1,
4684 "(Point pt) -> (Point pt)"},
4685 {"GlobalToLocal", (PyCFunction
)Qd_GlobalToLocal
, 1,
4686 "(Point pt) -> (Point pt)"},
4687 {"Random", (PyCFunction
)Qd_Random
, 1,
4688 "() -> (short _rv)"},
4689 {"MacGetPixel", (PyCFunction
)Qd_MacGetPixel
, 1,
4690 "(short h, short v) -> (Boolean _rv)"},
4691 {"ScalePt", (PyCFunction
)Qd_ScalePt
, 1,
4692 "(Point pt, Rect srcRect, Rect dstRect) -> (Point pt)"},
4693 {"MapPt", (PyCFunction
)Qd_MapPt
, 1,
4694 "(Point pt, Rect srcRect, Rect dstRect) -> (Point pt)"},
4695 {"MapRect", (PyCFunction
)Qd_MapRect
, 1,
4696 "(Rect r, Rect srcRect, Rect dstRect) -> (Rect r)"},
4697 {"MapRgn", (PyCFunction
)Qd_MapRgn
, 1,
4698 "(RgnHandle rgn, Rect srcRect, Rect dstRect) -> None"},
4699 {"MapPoly", (PyCFunction
)Qd_MapPoly
, 1,
4700 "(PolyHandle poly, Rect srcRect, Rect dstRect) -> None"},
4701 {"StdBits", (PyCFunction
)Qd_StdBits
, 1,
4702 "(BitMapPtr srcBits, Rect srcRect, Rect dstRect, short mode, RgnHandle maskRgn) -> None"},
4703 {"AddPt", (PyCFunction
)Qd_AddPt
, 1,
4704 "(Point src, Point dst) -> (Point dst)"},
4705 {"EqualPt", (PyCFunction
)Qd_EqualPt
, 1,
4706 "(Point pt1, Point pt2) -> (Boolean _rv)"},
4707 {"MacPtInRect", (PyCFunction
)Qd_MacPtInRect
, 1,
4708 "(Point pt, Rect r) -> (Boolean _rv)"},
4709 {"Pt2Rect", (PyCFunction
)Qd_Pt2Rect
, 1,
4710 "(Point pt1, Point pt2) -> (Rect dstRect)"},
4711 {"PtToAngle", (PyCFunction
)Qd_PtToAngle
, 1,
4712 "(Rect r, Point pt) -> (short angle)"},
4713 {"SubPt", (PyCFunction
)Qd_SubPt
, 1,
4714 "(Point src, Point dst) -> (Point dst)"},
4715 {"PtInRgn", (PyCFunction
)Qd_PtInRgn
, 1,
4716 "(Point pt, RgnHandle rgn) -> (Boolean _rv)"},
4717 {"NewPixMap", (PyCFunction
)Qd_NewPixMap
, 1,
4718 "() -> (PixMapHandle _rv)"},
4719 {"DisposePixMap", (PyCFunction
)Qd_DisposePixMap
, 1,
4720 "(PixMapHandle pm) -> None"},
4721 {"CopyPixMap", (PyCFunction
)Qd_CopyPixMap
, 1,
4722 "(PixMapHandle srcPM, PixMapHandle dstPM) -> None"},
4723 {"NewPixPat", (PyCFunction
)Qd_NewPixPat
, 1,
4724 "() -> (PixPatHandle _rv)"},
4725 {"DisposePixPat", (PyCFunction
)Qd_DisposePixPat
, 1,
4726 "(PixPatHandle pp) -> None"},
4727 {"CopyPixPat", (PyCFunction
)Qd_CopyPixPat
, 1,
4728 "(PixPatHandle srcPP, PixPatHandle dstPP) -> None"},
4729 {"PenPixPat", (PyCFunction
)Qd_PenPixPat
, 1,
4730 "(PixPatHandle pp) -> None"},
4731 {"BackPixPat", (PyCFunction
)Qd_BackPixPat
, 1,
4732 "(PixPatHandle pp) -> None"},
4733 {"GetPixPat", (PyCFunction
)Qd_GetPixPat
, 1,
4734 "(short patID) -> (PixPatHandle _rv)"},
4735 {"MakeRGBPat", (PyCFunction
)Qd_MakeRGBPat
, 1,
4736 "(PixPatHandle pp, RGBColor myColor) -> None"},
4737 {"FillCRect", (PyCFunction
)Qd_FillCRect
, 1,
4738 "(Rect r, PixPatHandle pp) -> None"},
4739 {"FillCOval", (PyCFunction
)Qd_FillCOval
, 1,
4740 "(Rect r, PixPatHandle pp) -> None"},
4741 {"FillCRoundRect", (PyCFunction
)Qd_FillCRoundRect
, 1,
4742 "(Rect r, short ovalWidth, short ovalHeight, PixPatHandle pp) -> None"},
4743 {"FillCArc", (PyCFunction
)Qd_FillCArc
, 1,
4744 "(Rect r, short startAngle, short arcAngle, PixPatHandle pp) -> None"},
4745 {"FillCRgn", (PyCFunction
)Qd_FillCRgn
, 1,
4746 "(RgnHandle rgn, PixPatHandle pp) -> None"},
4747 {"FillCPoly", (PyCFunction
)Qd_FillCPoly
, 1,
4748 "(PolyHandle poly, PixPatHandle pp) -> None"},
4749 {"RGBForeColor", (PyCFunction
)Qd_RGBForeColor
, 1,
4750 "(RGBColor color) -> None"},
4751 {"RGBBackColor", (PyCFunction
)Qd_RGBBackColor
, 1,
4752 "(RGBColor color) -> None"},
4753 {"SetCPixel", (PyCFunction
)Qd_SetCPixel
, 1,
4754 "(short h, short v, RGBColor cPix) -> None"},
4755 {"SetPortPix", (PyCFunction
)Qd_SetPortPix
, 1,
4756 "(PixMapHandle pm) -> None"},
4757 {"GetCPixel", (PyCFunction
)Qd_GetCPixel
, 1,
4758 "(short h, short v) -> (RGBColor cPix)"},
4759 {"GetForeColor", (PyCFunction
)Qd_GetForeColor
, 1,
4760 "() -> (RGBColor color)"},
4761 {"GetBackColor", (PyCFunction
)Qd_GetBackColor
, 1,
4762 "() -> (RGBColor color)"},
4763 {"OpColor", (PyCFunction
)Qd_OpColor
, 1,
4764 "(RGBColor color) -> None"},
4765 {"HiliteColor", (PyCFunction
)Qd_HiliteColor
, 1,
4766 "(RGBColor color) -> None"},
4767 {"DisposeCTable", (PyCFunction
)Qd_DisposeCTable
, 1,
4768 "(CTabHandle cTable) -> None"},
4769 {"GetCTable", (PyCFunction
)Qd_GetCTable
, 1,
4770 "(short ctID) -> (CTabHandle _rv)"},
4771 {"GetCCursor", (PyCFunction
)Qd_GetCCursor
, 1,
4772 "(short crsrID) -> (CCrsrHandle _rv)"},
4773 {"SetCCursor", (PyCFunction
)Qd_SetCCursor
, 1,
4774 "(CCrsrHandle cCrsr) -> None"},
4775 {"AllocCursor", (PyCFunction
)Qd_AllocCursor
, 1,
4777 {"DisposeCCursor", (PyCFunction
)Qd_DisposeCCursor
, 1,
4778 "(CCrsrHandle cCrsr) -> None"},
4779 {"GetMaxDevice", (PyCFunction
)Qd_GetMaxDevice
, 1,
4780 "(Rect globalRect) -> (GDHandle _rv)"},
4781 {"GetCTSeed", (PyCFunction
)Qd_GetCTSeed
, 1,
4782 "() -> (long _rv)"},
4783 {"GetDeviceList", (PyCFunction
)Qd_GetDeviceList
, 1,
4784 "() -> (GDHandle _rv)"},
4785 {"GetMainDevice", (PyCFunction
)Qd_GetMainDevice
, 1,
4786 "() -> (GDHandle _rv)"},
4787 {"GetNextDevice", (PyCFunction
)Qd_GetNextDevice
, 1,
4788 "(GDHandle curDevice) -> (GDHandle _rv)"},
4789 {"TestDeviceAttribute", (PyCFunction
)Qd_TestDeviceAttribute
, 1,
4790 "(GDHandle gdh, short attribute) -> (Boolean _rv)"},
4791 {"SetDeviceAttribute", (PyCFunction
)Qd_SetDeviceAttribute
, 1,
4792 "(GDHandle gdh, short attribute, Boolean value) -> None"},
4793 {"InitGDevice", (PyCFunction
)Qd_InitGDevice
, 1,
4794 "(short qdRefNum, long mode, GDHandle gdh) -> None"},
4795 {"NewGDevice", (PyCFunction
)Qd_NewGDevice
, 1,
4796 "(short refNum, long mode) -> (GDHandle _rv)"},
4797 {"DisposeGDevice", (PyCFunction
)Qd_DisposeGDevice
, 1,
4798 "(GDHandle gdh) -> None"},
4799 {"SetGDevice", (PyCFunction
)Qd_SetGDevice
, 1,
4800 "(GDHandle gd) -> None"},
4801 {"GetGDevice", (PyCFunction
)Qd_GetGDevice
, 1,
4802 "() -> (GDHandle _rv)"},
4803 {"Color2Index", (PyCFunction
)Qd_Color2Index
, 1,
4804 "(RGBColor myColor) -> (long _rv)"},
4805 {"Index2Color", (PyCFunction
)Qd_Index2Color
, 1,
4806 "(long index) -> (RGBColor aColor)"},
4807 {"InvertColor", (PyCFunction
)Qd_InvertColor
, 1,
4808 "() -> (RGBColor myColor)"},
4809 {"RealColor", (PyCFunction
)Qd_RealColor
, 1,
4810 "(RGBColor color) -> (Boolean _rv)"},
4811 {"GetSubTable", (PyCFunction
)Qd_GetSubTable
, 1,
4812 "(CTabHandle myColors, short iTabRes, CTabHandle targetTbl) -> None"},
4813 {"MakeITable", (PyCFunction
)Qd_MakeITable
, 1,
4814 "(CTabHandle cTabH, ITabHandle iTabH, short res) -> None"},
4815 {"SetClientID", (PyCFunction
)Qd_SetClientID
, 1,
4816 "(short id) -> None"},
4817 {"ProtectEntry", (PyCFunction
)Qd_ProtectEntry
, 1,
4818 "(short index, Boolean protect) -> None"},
4819 {"ReserveEntry", (PyCFunction
)Qd_ReserveEntry
, 1,
4820 "(short index, Boolean reserve) -> None"},
4821 {"QDError", (PyCFunction
)Qd_QDError
, 1,
4822 "() -> (short _rv)"},
4823 {"CopyDeepMask", (PyCFunction
)Qd_CopyDeepMask
, 1,
4824 "(BitMapPtr srcBits, BitMapPtr maskBits, BitMapPtr dstBits, Rect srcRect, Rect maskRect, Rect dstRect, short mode, RgnHandle maskRgn) -> None"},
4825 {"GetPattern", (PyCFunction
)Qd_GetPattern
, 1,
4826 "(short patternID) -> (PatHandle _rv)"},
4827 {"MacGetCursor", (PyCFunction
)Qd_MacGetCursor
, 1,
4828 "(short cursorID) -> (CursHandle _rv)"},
4829 {"GetPicture", (PyCFunction
)Qd_GetPicture
, 1,
4830 "(short pictureID) -> (PicHandle _rv)"},
4831 {"DeltaPoint", (PyCFunction
)Qd_DeltaPoint
, 1,
4832 "(Point ptA, Point ptB) -> (long _rv)"},
4833 {"ShieldCursor", (PyCFunction
)Qd_ShieldCursor
, 1,
4834 "(Rect shieldRect, Point offsetPt) -> None"},
4835 {"ScreenRes", (PyCFunction
)Qd_ScreenRes
, 1,
4836 "() -> (short scrnHRes, short scrnVRes)"},
4837 {"GetIndPattern", (PyCFunction
)Qd_GetIndPattern
, 1,
4838 "(short patternListID, short index) -> (Pattern thePat)"},
4839 {"SlopeFromAngle", (PyCFunction
)Qd_SlopeFromAngle
, 1,
4840 "(short angle) -> (Fixed _rv)"},
4841 {"AngleFromSlope", (PyCFunction
)Qd_AngleFromSlope
, 1,
4842 "(Fixed slope) -> (short _rv)"},
4843 {"TextFont", (PyCFunction
)Qd_TextFont
, 1,
4844 "(short font) -> None"},
4845 {"TextFace", (PyCFunction
)Qd_TextFace
, 1,
4846 "(StyleParameter face) -> None"},
4847 {"TextMode", (PyCFunction
)Qd_TextMode
, 1,
4848 "(short mode) -> None"},
4849 {"TextSize", (PyCFunction
)Qd_TextSize
, 1,
4850 "(short size) -> None"},
4851 {"SpaceExtra", (PyCFunction
)Qd_SpaceExtra
, 1,
4852 "(Fixed extra) -> None"},
4853 {"DrawChar", (PyCFunction
)Qd_DrawChar
, 1,
4854 "(CharParameter ch) -> None"},
4855 {"DrawString", (PyCFunction
)Qd_DrawString
, 1,
4856 "(Str255 s) -> None"},
4857 {"MacDrawText", (PyCFunction
)Qd_MacDrawText
, 1,
4858 "(Buffer textBuf, short firstByte, short byteCount) -> None"},
4859 {"CharWidth", (PyCFunction
)Qd_CharWidth
, 1,
4860 "(CharParameter ch) -> (short _rv)"},
4861 {"StringWidth", (PyCFunction
)Qd_StringWidth
, 1,
4862 "(Str255 s) -> (short _rv)"},
4863 {"TextWidth", (PyCFunction
)Qd_TextWidth
, 1,
4864 "(Buffer textBuf, short firstByte, short byteCount) -> (short _rv)"},
4865 {"GetFontInfo", (PyCFunction
)Qd_GetFontInfo
, 1,
4866 "() -> (FontInfo info)"},
4867 {"CharExtra", (PyCFunction
)Qd_CharExtra
, 1,
4868 "(Fixed extra) -> None"},
4869 {"SetPort", (PyCFunction
)Qd_SetPort
, 1,
4870 "(GrafPtr thePort) -> None"},
4871 {"GetCursor", (PyCFunction
)Qd_GetCursor
, 1,
4872 "(short cursorID) -> (CursHandle _rv)"},
4873 {"SetCursor", (PyCFunction
)Qd_SetCursor
, 1,
4874 "(Cursor crsr) -> None"},
4875 {"ShowCursor", (PyCFunction
)Qd_ShowCursor
, 1,
4877 {"LineTo", (PyCFunction
)Qd_LineTo
, 1,
4878 "(short h, short v) -> None"},
4879 {"SetRect", (PyCFunction
)Qd_SetRect
, 1,
4880 "(short left, short top, short right, short bottom) -> (Rect r)"},
4881 {"OffsetRect", (PyCFunction
)Qd_OffsetRect
, 1,
4882 "(Rect r, short dh, short dv) -> (Rect r)"},
4883 {"InsetRect", (PyCFunction
)Qd_InsetRect
, 1,
4884 "(Rect r, short dh, short dv) -> (Rect r)"},
4885 {"UnionRect", (PyCFunction
)Qd_UnionRect
, 1,
4886 "(Rect src1, Rect src2) -> (Rect dstRect)"},
4887 {"EqualRect", (PyCFunction
)Qd_EqualRect
, 1,
4888 "(Rect rect1, Rect rect2) -> (Boolean _rv)"},
4889 {"FrameRect", (PyCFunction
)Qd_FrameRect
, 1,
4890 "(Rect r) -> None"},
4891 {"InvertRect", (PyCFunction
)Qd_InvertRect
, 1,
4892 "(Rect r) -> None"},
4893 {"FillRect", (PyCFunction
)Qd_FillRect
, 1,
4894 "(Rect r, Pattern pat) -> None"},
4895 {"CopyRgn", (PyCFunction
)Qd_CopyRgn
, 1,
4896 "(RgnHandle srcRgn, RgnHandle dstRgn) -> None"},
4897 {"SetRectRgn", (PyCFunction
)Qd_SetRectRgn
, 1,
4898 "(RgnHandle rgn, short left, short top, short right, short bottom) -> None"},
4899 {"OffsetRgn", (PyCFunction
)Qd_OffsetRgn
, 1,
4900 "(RgnHandle rgn, short dh, short dv) -> None"},
4901 {"UnionRgn", (PyCFunction
)Qd_UnionRgn
, 1,
4902 "(RgnHandle srcRgnA, RgnHandle srcRgnB, RgnHandle dstRgn) -> None"},
4903 {"XorRgn", (PyCFunction
)Qd_XorRgn
, 1,
4904 "(RgnHandle srcRgnA, RgnHandle srcRgnB, RgnHandle dstRgn) -> None"},
4905 {"EqualRgn", (PyCFunction
)Qd_EqualRgn
, 1,
4906 "(RgnHandle rgnA, RgnHandle rgnB) -> (Boolean _rv)"},
4907 {"FrameRgn", (PyCFunction
)Qd_FrameRgn
, 1,
4908 "(RgnHandle rgn) -> None"},
4909 {"PaintRgn", (PyCFunction
)Qd_PaintRgn
, 1,
4910 "(RgnHandle rgn) -> None"},
4911 {"InvertRgn", (PyCFunction
)Qd_InvertRgn
, 1,
4912 "(RgnHandle rgn) -> None"},
4913 {"FillRgn", (PyCFunction
)Qd_FillRgn
, 1,
4914 "(RgnHandle rgn, Pattern pat) -> None"},
4915 {"GetPixel", (PyCFunction
)Qd_GetPixel
, 1,
4916 "(short h, short v) -> (Boolean _rv)"},
4917 {"PtInRect", (PyCFunction
)Qd_PtInRect
, 1,
4918 "(Point pt, Rect r) -> (Boolean _rv)"},
4919 {"DrawText", (PyCFunction
)Qd_DrawText
, 1,
4920 "(Buffer textBuf, short firstByte, short byteCount) -> None"},
4921 {"BitMap", (PyCFunction
)Qd_BitMap
, 1,
4922 "Take (string, int, Rect) argument and create BitMap"},
4923 {"RawBitMap", (PyCFunction
)Qd_RawBitMap
, 1,
4924 "Take string BitMap and turn into BitMap object"},
4939 m
= Py_InitModule("Qd", Qd_methods
);
4940 d
= PyModule_GetDict(m
);
4941 Qd_Error
= PyMac_GetOSErrException();
4942 if (Qd_Error
== NULL
||
4943 PyDict_SetItemString(d
, "Error", Qd_Error
) != 0)
4944 Py_FatalError("can't initialize Qd.Error");
4945 GrafPort_Type
.ob_type
= &PyType_Type
;
4946 Py_INCREF(&GrafPort_Type
);
4947 if (PyDict_SetItemString(d
, "GrafPortType", (PyObject
*)&GrafPort_Type
) != 0)
4948 Py_FatalError("can't initialize GrafPortType");
4949 BitMap_Type
.ob_type
= &PyType_Type
;
4950 Py_INCREF(&BitMap_Type
);
4951 if (PyDict_SetItemString(d
, "BitMapType", (PyObject
*)&BitMap_Type
) != 0)
4952 Py_FatalError("can't initialize BitMapType");
4953 QDGlobalsAccess_Type
.ob_type
= &PyType_Type
;
4954 Py_INCREF(&QDGlobalsAccess_Type
);
4955 if (PyDict_SetItemString(d
, "QDGlobalsAccessType", (PyObject
*)&QDGlobalsAccess_Type
) != 0)
4956 Py_FatalError("can't initialize QDGlobalsAccessType");
4962 if (o
== NULL
|| PyDict_SetItemString(d
, "qd", o
) != 0)
4963 Py_FatalError("can't initialize Qd.qd");
4969 /* ========================= End module Qd ========================== */