blob: aece598109b0d424d2bf261f4331813350d60b00 [file] [log] [blame]
Guido van Rossum17448e21995-01-30 11:53:55 +00001
2/* =========================== Module Qd ============================ */
3
4#include "Python.h"
5
6
7
Guido van Rossum17448e21995-01-30 11:53:55 +00008#include "macglue.h"
Jack Jansen9d8b96c2000-07-14 22:16:45 +00009#include "pymactoolbox.h"
Guido van Rossum17448e21995-01-30 11:53:55 +000010
11#include <QuickDraw.h>
Guido van Rossum17448e21995-01-30 11:53:55 +000012
Jack Jansenbd58eda2001-01-24 14:05:11 +000013#if !ACCESSOR_CALLS_ARE_FUNCTIONS
Jack Jansen87eb4f82001-01-30 09:57:13 +000014#define GetPortBitMapForCopyBits(port) ((const struct BitMap *)&((GrafPort *)(port))->portBits)
Jack Jansenbd58eda2001-01-24 14:05:11 +000015#define GetPortPixMap(port) (((CGrafPtr)(port))->portPixMap)
16#define GetPortBounds(port, bounds) (*(bounds) = (port)->portRect, (bounds))
17#define GetPortForeColor(port, color) (*(color) = (port)->rgbFgColor, (color))
18#define GetPortBackColor(port, color) (*(color) = (port)->rgbBkColor, (color))
19#define GetPortOpColor(port, color) (*(color) = (*(GVarHandle)((port)->grafVars))->rgbOpColor, (color))
20#define GetPortHiliteColor(port, color) (*(color) = (*(GVarHandle)((port)->grafVars))->rgbHiliteColor, (color))
21#define GetPortTextFont(port) ((port)->txFont)
22#define GetPortTextFace(port) ((port)->txFace)
23#define GetPortTextMode(port) ((port)->txMode)
24#define GetPortTextSize(port) ((port)->txSize)
25#define GetPortChExtra(port) ((port)->chExtra)
26#define GetPortFracHPenLocation(port) ((port)->pnLocHFrac)
27#define GetPortSpExtra(port) ((port)->spExtra)
28#define GetPortPenVisibility(port) ((port)->pnVis)
29#define GetPortVisibleRegion(port, rgn) ((rgn) = (port)->visRgn, (rgn))
30#define GetPortClipRegion(port, rgn) ((rgn) = (port)->clipRgn, (rgn))
31#define GetPortBackPixPat(port, pat) ((pat) = (port)->bkPixPat, (pat))
32#define GetPortPenPixPat(port, pat) ((pat) = (port)->pnPixPat, (pat))
33#define GetPortFillPixPat(port, pat) ((pat) = (port)->fillPixPat, (pat))
34#define GetPortPenSize(port, pensize) (*(pensize) = (port)->pnSize, (pensize))
35#define GetPortPenMode(port) ((port)->pnMode)
36#define GetPortPenLocation(port, location) ((*location) = (port)->pnLoc, (location))
37#define IsPortRegionBeingDefined(port) (!!((port)->rgnSave))
38#define IsPortPictureBeingDefined(port) (!!((port)->picSave))
39/* #define IsPortOffscreen(port) */
40/* #define IsPortColor(port) */
41
42#define SetPortBounds(port, bounds) ((port)->portRect = *(bounds))
43#define SetPortOpColor(port, color) ((*(GVarHandle)((port)->grafVars))->rgbOpColor = *(color))
44#define SetPortVisibleRegion(port, rgn) ((port)->visRgn = (rgn))
45#define SetPortClipRegion(port, rgn) ((port)->clipRgn = (rgn))
46#define SetPortBackPixPat(port, pat) ((port)->bkPixPat = (pat))
47#define SetPortPenPixPat(port, pat) ((port)->pnPixPat = (pat))
48#define SetPortFillPixPat(port, pat) ((port)->fillPixPat = (pat))
49#define SetPortPenSize(port, pensize) ((port)->pnSize = (pensize))
50#define SetPortPenMode(port, mode) ((port)->pnMode = (mode))
51#define SetPortFracHPenLocation(port, frac) ((port)->pnLocHFrac = (frac))
52
53/* On pixmaps */
54#define GetPixBounds(pixmap, rect) (*(rect) = (*(pixmap))->bounds, (rect))
55#define GetPixDepth(pixmap) ((*(pixmap))->pixelSize)
56
57/* On regions */
58#define GetRegionBounds(rgn, rect) (*(rect) = (*(rgn))->rgnBBox, (rect))
59
60/* On QD Globals */
61#define GetQDGlobalsRandomSeed() (qd.randSeed)
62#define GetQDGlobalsScreenBits(bits) (*(bits) = qd.screenBits, (bits))
63#define GetQDGlobalsArrow(crsr) (*(crsr) = qd.arrow, (crsr))
64#define GetQDGlobalsDarkGray(pat) (*(pat) = qd.dkGray, (pat))
65#define GetQDGlobalsLightGray(pat) (*(pat) = qd.ltGray, (pat))
66#define GetQDGlobalsGray(pat) (*(pat) = qd.gray, (pat))
67#define GetQDGlobalsBlack(pat) (*(pat) = qd.black, (pat))
68#define GetQDGlobalsWhite(pat) (*(pat) = qd.white, (pat))
69#define GetQDGlobalsThePort() ((CGrafPtr)qd.thePort)
70
71#define SetQDGlobalsRandomSeed(seed) (qd.randSeed = (seed))
72#define SetQDGlobalsArrow(crsr) (qd.arrow = *(crsr))
73
74#endif /* ACCESSOR_CALLS_ARE_FUNCTIONS */
75
76#if !TARGET_API_MAC_CARBON
77#define QDFlushPortBuffer(port, rgn) /* pass */
78#define QDIsPortBufferDirty(port) 0
79#define QDIsPortBuffered(port) 0
80#endif /* !TARGET_API_MAC_CARBON */
81
Jack Jansen87eb4f82001-01-30 09:57:13 +000082staticforward PyObject *BMObj_NewCopied(BitMapPtr);
83
Jack Jansen232f3cd1995-12-09 14:04:31 +000084/*
85** Parse/generate RGB records
86*/
87PyObject *QdRGB_New(itself)
88 RGBColorPtr itself;
89{
90
91 return Py_BuildValue("lll", (long)itself->red, (long)itself->green, (long)itself->blue);
92}
93
94QdRGB_Convert(v, p_itself)
95 PyObject *v;
96 RGBColorPtr p_itself;
97{
98 long red, green, blue;
99
100 if( !PyArg_ParseTuple(v, "lll", &red, &green, &blue) )
101 return 0;
102 p_itself->red = (unsigned short)red;
103 p_itself->green = (unsigned short)green;
104 p_itself->blue = (unsigned short)blue;
105 return 1;
106}
107
Jack Jansen3a50f8a1996-01-11 16:17:14 +0000108/*
109** Generate FontInfo records
110*/
111static
112PyObject *QdFI_New(itself)
113 FontInfo *itself;
114{
115
116 return Py_BuildValue("hhhh", itself->ascent, itself->descent,
117 itself->widMax, itself->leading);
118}
119
Guido van Rossum17448e21995-01-30 11:53:55 +0000120static PyObject *Qd_Error;
121
Jack Jansen330381c1995-11-15 15:18:01 +0000122/* ---------------------- Object type GrafPort ---------------------- */
123
124PyTypeObject GrafPort_Type;
125
126#define GrafObj_Check(x) ((x)->ob_type == &GrafPort_Type)
127
128typedef struct GrafPortObject {
129 PyObject_HEAD
130 GrafPtr ob_itself;
131} GrafPortObject;
132
133PyObject *GrafObj_New(itself)
134 GrafPtr itself;
Guido van Rossum17448e21995-01-30 11:53:55 +0000135{
Jack Jansen330381c1995-11-15 15:18:01 +0000136 GrafPortObject *it;
137 if (itself == NULL) return PyMac_Error(resNotFound);
138 it = PyObject_NEW(GrafPortObject, &GrafPort_Type);
139 if (it == NULL) return NULL;
140 it->ob_itself = itself;
141 return (PyObject *)it;
142}
143GrafObj_Convert(v, p_itself)
144 PyObject *v;
145 GrafPtr *p_itself;
146{
Jack Jansendc2ac8d32001-02-02 22:41:48 +0000147 if (DlgObj_Check(v)) {
148 DialogRef dlg = (DialogRef)((GrafPortObject *)v)->ob_itself;
149 *p_itself = (GrafPtr)GetWindowPort(GetDialogWindow(dlg));
150 return 1;
151 }
152 if (WinObj_Check(v)) {
153 WindowRef win = (WindowRef)((GrafPortObject *)v)->ob_itself;
154 *p_itself = (GrafPtr)GetWindowPort(win);
Jack Jansen330381c1995-11-15 15:18:01 +0000155 return 1;
156 }
157 if (!GrafObj_Check(v))
158 {
159 PyErr_SetString(PyExc_TypeError, "GrafPort required");
160 return 0;
161 }
162 *p_itself = ((GrafPortObject *)v)->ob_itself;
163 return 1;
Guido van Rossum17448e21995-01-30 11:53:55 +0000164}
165
Jack Jansen330381c1995-11-15 15:18:01 +0000166static void GrafObj_dealloc(self)
167 GrafPortObject *self;
Guido van Rossum17448e21995-01-30 11:53:55 +0000168{
Jack Jansen330381c1995-11-15 15:18:01 +0000169 /* Cleanup of self->ob_itself goes here */
170 PyMem_DEL(self);
Guido van Rossume56db431995-03-19 22:49:50 +0000171}
172
Jack Jansen330381c1995-11-15 15:18:01 +0000173static PyMethodDef GrafObj_methods[] = {
174 {NULL, NULL, 0}
175};
176
177PyMethodChain GrafObj_chain = { GrafObj_methods, NULL };
178
179static PyObject *GrafObj_getattr(self, name)
180 GrafPortObject *self;
181 char *name;
Guido van Rossume56db431995-03-19 22:49:50 +0000182{
Jack Jansenbd58eda2001-01-24 14:05:11 +0000183#if !ACCESSOR_CALLS_ARE_FUNCTIONS
Jack Jansen3a50f8a1996-01-11 16:17:14 +0000184
185 { CGrafPtr itself_color = (CGrafPtr)self->ob_itself;
Jack Jansen330381c1995-11-15 15:18:01 +0000186
Jack Jansen3a50f8a1996-01-11 16:17:14 +0000187 if ( strcmp(name, "data") == 0 )
188 return PyString_FromStringAndSize((char *)self->ob_itself, sizeof(GrafPort));
189
190 if ( (itself_color->portVersion&0xc000) == 0xc000 ) {
191 /* Color-only attributes */
192
193 if ( strcmp(name, "portBits") == 0 )
194 /* XXXX Do we need HLock() stuff here?? */
195 return BMObj_New((BitMapPtr)*itself_color->portPixMap);
196 if ( strcmp(name, "grafVars") == 0 )
197 return Py_BuildValue("O&", ResObj_New, (Handle)itself_color->visRgn);
198 if ( strcmp(name, "chExtra") == 0 )
199 return Py_BuildValue("h", itself_color->chExtra);
200 if ( strcmp(name, "pnLocHFrac") == 0 )
201 return Py_BuildValue("h", itself_color->pnLocHFrac);
Jack Jansen61f3df41996-01-15 14:39:56 +0000202 if ( strcmp(name, "bkPixPat") == 0 )
203 return Py_BuildValue("O&", ResObj_New, (Handle)itself_color->bkPixPat);
204 if ( strcmp(name, "rgbFgColor") == 0 )
205 return Py_BuildValue("O&", QdRGB_New, &itself_color->rgbFgColor);
206 if ( strcmp(name, "rgbBkColor") == 0 )
207 return Py_BuildValue("O&", QdRGB_New, &itself_color->rgbBkColor);
208 if ( strcmp(name, "pnPixPat") == 0 )
209 return Py_BuildValue("O&", ResObj_New, (Handle)itself_color->pnPixPat);
210 if ( strcmp(name, "fillPixPat") == 0 )
211 return Py_BuildValue("O&", ResObj_New, (Handle)itself_color->fillPixPat);
Jack Jansen3a50f8a1996-01-11 16:17:14 +0000212 } else {
213 /* Mono-only attributes */
214 if ( strcmp(name, "portBits") == 0 )
215 return BMObj_New(&self->ob_itself->portBits);
Jack Jansen61f3df41996-01-15 14:39:56 +0000216 if ( strcmp(name, "bkPat") == 0 )
217 return Py_BuildValue("s#", (char *)&self->ob_itself->bkPat, sizeof(Pattern));
218 if ( strcmp(name, "fillPat") == 0 )
219 return Py_BuildValue("s#", (char *)&self->ob_itself->fillPat, sizeof(Pattern));
220 if ( strcmp(name, "pnPat") == 0 )
221 return Py_BuildValue("s#", (char *)&self->ob_itself->pnPat, sizeof(Pattern));
Jack Jansen3a50f8a1996-01-11 16:17:14 +0000222 }
223 /*
224 ** Accessible for both color/mono windows.
225 ** portVersion is really color-only, but we put it here
226 ** for convenience
227 */
228 if ( strcmp(name, "portVersion") == 0 )
229 return Py_BuildValue("h", itself_color->portVersion);
230 if ( strcmp(name, "device") == 0 )
231 return PyInt_FromLong((long)self->ob_itself->device);
232 if ( strcmp(name, "portRect") == 0 )
233 return Py_BuildValue("O&", PyMac_BuildRect, &self->ob_itself->portRect);
234 if ( strcmp(name, "visRgn") == 0 )
235 return Py_BuildValue("O&", ResObj_New, (Handle)self->ob_itself->visRgn);
236 if ( strcmp(name, "clipRgn") == 0 )
237 return Py_BuildValue("O&", ResObj_New, (Handle)self->ob_itself->clipRgn);
Jack Jansen3a50f8a1996-01-11 16:17:14 +0000238 if ( strcmp(name, "pnLoc") == 0 )
239 return Py_BuildValue("O&", PyMac_BuildPoint, self->ob_itself->pnLoc);
240 if ( strcmp(name, "pnSize") == 0 )
241 return Py_BuildValue("O&", PyMac_BuildPoint, self->ob_itself->pnSize);
242 if ( strcmp(name, "pnMode") == 0 )
243 return Py_BuildValue("h", self->ob_itself->pnMode);
Jack Jansen3a50f8a1996-01-11 16:17:14 +0000244 if ( strcmp(name, "pnVis") == 0 )
245 return Py_BuildValue("h", self->ob_itself->pnVis);
246 if ( strcmp(name, "txFont") == 0 )
247 return Py_BuildValue("h", self->ob_itself->txFont);
248 if ( strcmp(name, "txFace") == 0 )
249 return Py_BuildValue("h", (short)self->ob_itself->txFace);
250 if ( strcmp(name, "txMode") == 0 )
251 return Py_BuildValue("h", self->ob_itself->txMode);
252 if ( strcmp(name, "txSize") == 0 )
253 return Py_BuildValue("h", self->ob_itself->txSize);
254 if ( strcmp(name, "spExtra") == 0 )
255 return Py_BuildValue("O&", PyMac_BuildFixed, self->ob_itself->spExtra);
256 /* XXXX Add more, as needed */
Jack Jansen3355be31996-05-08 15:33:20 +0000257 /* This one is so we can compare grafports: */
258 if ( strcmp(name, "_id") == 0 )
259 return Py_BuildValue("l", (long)self->ob_itself);
Jack Jansen3a50f8a1996-01-11 16:17:14 +0000260 }
Jack Jansenbd58eda2001-01-24 14:05:11 +0000261#else
262
263 { CGrafPtr itself_color = (CGrafPtr)self->ob_itself;
Jack Jansenbd58eda2001-01-24 14:05:11 +0000264 if ( strcmp(name, "portBits") == 0 )
Jack Jansen5c3c58b2001-01-29 14:07:01 +0000265 return BMObj_New((BitMapPtr)GetPortBitMapForCopyBits(itself_color));
Jack Jansenbd58eda2001-01-24 14:05:11 +0000266 if ( strcmp(name, "chExtra") == 0 )
267 return Py_BuildValue("h", GetPortChExtra(itself_color));
268 if ( strcmp(name, "pnLocHFrac") == 0 )
269 return Py_BuildValue("h", GetPortFracHPenLocation(itself_color));
270 if ( strcmp(name, "bkPixPat") == 0 ) {
271 PixPatHandle h=0;
272 return Py_BuildValue("O&", ResObj_New, (Handle)GetPortBackPixPat(itself_color, h));
273 }
274 if ( strcmp(name, "rgbFgColor") == 0 ) {
275 RGBColor c;
276 return Py_BuildValue("O&", QdRGB_New, GetPortForeColor(itself_color, &c));
277 }
278 if ( strcmp(name, "rgbBkColor") == 0 ) {
279 RGBColor c;
280 return Py_BuildValue("O&", QdRGB_New, GetPortBackColor(itself_color, &c));
281 }
282 if ( strcmp(name, "pnPixPat") == 0 ) {
Jack Jansen5c3c58b2001-01-29 14:07:01 +0000283 PixPatHandle h=NewPixPat(); /* XXXX wrong dispose routine */
Jack Jansenbd58eda2001-01-24 14:05:11 +0000284
285 return Py_BuildValue("O&", ResObj_New, (Handle)GetPortPenPixPat(itself_color, h));
286 }
287 if ( strcmp(name, "fillPixPat") == 0 ) {
Jack Jansen5c3c58b2001-01-29 14:07:01 +0000288 PixPatHandle h=NewPixPat(); /* XXXX wrong dispose routine */
Jack Jansenbd58eda2001-01-24 14:05:11 +0000289 return Py_BuildValue("O&", ResObj_New, (Handle)GetPortFillPixPat(itself_color, h));
290 }
291 if ( strcmp(name, "portRect") == 0 ) {
292 Rect r;
293 return Py_BuildValue("O&", PyMac_BuildRect, GetPortBounds(itself_color, &r));
294 }
295 if ( strcmp(name, "visRgn") == 0 ) {
Jack Jansen5c3c58b2001-01-29 14:07:01 +0000296 RgnHandle h=NewRgn(); /* XXXX wrong dispose routine */
Jack Jansenbd58eda2001-01-24 14:05:11 +0000297 return Py_BuildValue("O&", ResObj_New, (Handle)GetPortVisibleRegion(itself_color, h));
298 }
299 if ( strcmp(name, "clipRgn") == 0 ) {
Jack Jansen5c3c58b2001-01-29 14:07:01 +0000300 RgnHandle h=NewRgn(); /* XXXX wrong dispose routine */
Jack Jansenbd58eda2001-01-24 14:05:11 +0000301 return Py_BuildValue("O&", ResObj_New, (Handle)GetPortClipRegion(itself_color, h));
302 }
303 if ( strcmp(name, "pnLoc") == 0 ) {
304 Point p;
305 return Py_BuildValue("O&", PyMac_BuildPoint, *GetPortPenLocation(itself_color, &p));
306 }
307 if ( strcmp(name, "pnSize") == 0 ) {
308 Point p;
309 return Py_BuildValue("O&", PyMac_BuildPoint, *GetPortPenSize(itself_color, &p));
310 }
311 if ( strcmp(name, "pnMode") == 0 )
312 return Py_BuildValue("h", GetPortPenMode(itself_color));
313 if ( strcmp(name, "pnVis") == 0 )
314 return Py_BuildValue("h", GetPortPenVisibility(itself_color));
315 if ( strcmp(name, "txFont") == 0 )
316 return Py_BuildValue("h", GetPortTextFont(itself_color));
317 if ( strcmp(name, "txFace") == 0 )
318 return Py_BuildValue("h", (short)GetPortTextFace(itself_color));
319 if ( strcmp(name, "txMode") == 0 )
320 return Py_BuildValue("h", GetPortTextMode(itself_color));
321 if ( strcmp(name, "txSize") == 0 )
322 return Py_BuildValue("h", GetPortTextSize(itself_color));
323 if ( strcmp(name, "spExtra") == 0 )
324 return Py_BuildValue("O&", PyMac_BuildFixed, GetPortSpExtra(itself_color));
325 /* XXXX Add more, as needed */
326 /* This one is so we can compare grafports: */
327 if ( strcmp(name, "_id") == 0 )
328 return Py_BuildValue("l", (long)self->ob_itself);
329 }
Jack Jansene79dc762000-06-02 21:35:07 +0000330#endif
Jack Jansen330381c1995-11-15 15:18:01 +0000331 return Py_FindMethodInChain(&GrafObj_chain, (PyObject *)self, name);
Guido van Rossum17448e21995-01-30 11:53:55 +0000332}
333
Jack Jansen330381c1995-11-15 15:18:01 +0000334#define GrafObj_setattr NULL
335
Jack Jansena05ac601999-12-12 21:41:51 +0000336#define GrafObj_compare NULL
337
338#define GrafObj_repr NULL
339
340#define GrafObj_hash NULL
341
Jack Jansen330381c1995-11-15 15:18:01 +0000342PyTypeObject GrafPort_Type = {
343 PyObject_HEAD_INIT(&PyType_Type)
344 0, /*ob_size*/
345 "GrafPort", /*tp_name*/
346 sizeof(GrafPortObject), /*tp_basicsize*/
347 0, /*tp_itemsize*/
348 /* methods */
349 (destructor) GrafObj_dealloc, /*tp_dealloc*/
350 0, /*tp_print*/
351 (getattrfunc) GrafObj_getattr, /*tp_getattr*/
352 (setattrfunc) GrafObj_setattr, /*tp_setattr*/
Jack Jansena05ac601999-12-12 21:41:51 +0000353 (cmpfunc) GrafObj_compare, /*tp_compare*/
354 (reprfunc) GrafObj_repr, /*tp_repr*/
355 (PyNumberMethods *)0, /* tp_as_number */
356 (PySequenceMethods *)0, /* tp_as_sequence */
357 (PyMappingMethods *)0, /* tp_as_mapping */
358 (hashfunc) GrafObj_hash, /*tp_hash*/
Jack Jansen330381c1995-11-15 15:18:01 +0000359};
360
361/* -------------------- End object type GrafPort -------------------- */
362
363
Jack Jansen41058c01995-11-16 22:48:29 +0000364/* ----------------------- Object type BitMap ----------------------- */
365
366PyTypeObject BitMap_Type;
367
368#define BMObj_Check(x) ((x)->ob_type == &BitMap_Type)
369
370typedef struct BitMapObject {
371 PyObject_HEAD
372 BitMapPtr ob_itself;
373 PyObject *referred_object;
374 BitMap *referred_bitmap;
375} BitMapObject;
376
377PyObject *BMObj_New(itself)
378 BitMapPtr itself;
379{
380 BitMapObject *it;
381 if (itself == NULL) return PyMac_Error(resNotFound);
382 it = PyObject_NEW(BitMapObject, &BitMap_Type);
383 if (it == NULL) return NULL;
384 it->ob_itself = itself;
385 it->referred_object = NULL;
386 it->referred_bitmap = NULL;
387 return (PyObject *)it;
388}
389BMObj_Convert(v, p_itself)
390 PyObject *v;
391 BitMapPtr *p_itself;
392{
393 if (!BMObj_Check(v))
394 {
395 PyErr_SetString(PyExc_TypeError, "BitMap required");
396 return 0;
397 }
398 *p_itself = ((BitMapObject *)v)->ob_itself;
399 return 1;
400}
401
402static void BMObj_dealloc(self)
403 BitMapObject *self;
404{
405 Py_XDECREF(self->referred_object);
406 if (self->referred_bitmap) free(self->referred_bitmap);
407 PyMem_DEL(self);
408}
409
Jack Jansen484be612000-03-03 16:01:11 +0000410static PyObject *BMObj_getdata(_self, _args)
411 BitMapObject *_self;
412 PyObject *_args;
413{
414 PyObject *_res = NULL;
415
416 int from, length;
417 char *cp;
418
419 if ( !PyArg_ParseTuple(_args, "ii", &from, &length) )
420 return NULL;
421 cp = _self->ob_itself->baseAddr+from;
422 return PyString_FromStringAndSize(cp, length);
423
424}
425
426static PyObject *BMObj_putdata(_self, _args)
427 BitMapObject *_self;
428 PyObject *_args;
429{
430 PyObject *_res = NULL;
431
432 int from, length;
433 char *cp, *icp;
434
435 if ( !PyArg_ParseTuple(_args, "is#", &from, &icp, &length) )
436 return NULL;
437 cp = _self->ob_itself->baseAddr+from;
438 memcpy(cp, icp, length);
439 Py_INCREF(Py_None);
440 return Py_None;
441
442}
443
Jack Jansen41058c01995-11-16 22:48:29 +0000444static PyMethodDef BMObj_methods[] = {
Jack Jansen484be612000-03-03 16:01:11 +0000445 {"getdata", (PyCFunction)BMObj_getdata, 1,
446 "(int start, int size) -> string. Return bytes from the bitmap"},
447 {"putdata", (PyCFunction)BMObj_putdata, 1,
448 "(int start, string data). Store bytes into the bitmap"},
Jack Jansen41058c01995-11-16 22:48:29 +0000449 {NULL, NULL, 0}
450};
451
452PyMethodChain BMObj_chain = { BMObj_methods, NULL };
453
454static PyObject *BMObj_getattr(self, name)
455 BitMapObject *self;
456 char *name;
457{
458 if ( strcmp(name, "baseAddr") == 0 )
459 return PyInt_FromLong((long)self->ob_itself->baseAddr);
460 if ( strcmp(name, "rowBytes") == 0 )
461 return PyInt_FromLong((long)self->ob_itself->rowBytes);
462 if ( strcmp(name, "bounds") == 0 )
463 return Py_BuildValue("O&", PyMac_BuildRect, &self->ob_itself->bounds);
464 /* XXXX Add more, as needed */
Jack Jansen425e9eb1995-12-12 15:02:03 +0000465 if ( strcmp(name, "bitmap_data") == 0 )
466 return PyString_FromStringAndSize((char *)self->ob_itself, sizeof(BitMap));
467 if ( strcmp(name, "pixmap_data") == 0 )
468 return PyString_FromStringAndSize((char *)self->ob_itself, sizeof(PixMap));
Jack Jansen41058c01995-11-16 22:48:29 +0000469
470 return Py_FindMethodInChain(&BMObj_chain, (PyObject *)self, name);
471}
472
473#define BMObj_setattr NULL
474
Jack Jansena05ac601999-12-12 21:41:51 +0000475#define BMObj_compare NULL
476
477#define BMObj_repr NULL
478
479#define BMObj_hash NULL
480
Jack Jansen41058c01995-11-16 22:48:29 +0000481PyTypeObject BitMap_Type = {
482 PyObject_HEAD_INIT(&PyType_Type)
483 0, /*ob_size*/
484 "BitMap", /*tp_name*/
485 sizeof(BitMapObject), /*tp_basicsize*/
486 0, /*tp_itemsize*/
487 /* methods */
488 (destructor) BMObj_dealloc, /*tp_dealloc*/
489 0, /*tp_print*/
490 (getattrfunc) BMObj_getattr, /*tp_getattr*/
491 (setattrfunc) BMObj_setattr, /*tp_setattr*/
Jack Jansena05ac601999-12-12 21:41:51 +0000492 (cmpfunc) BMObj_compare, /*tp_compare*/
493 (reprfunc) BMObj_repr, /*tp_repr*/
494 (PyNumberMethods *)0, /* tp_as_number */
495 (PySequenceMethods *)0, /* tp_as_sequence */
496 (PyMappingMethods *)0, /* tp_as_mapping */
497 (hashfunc) BMObj_hash, /*tp_hash*/
Jack Jansen41058c01995-11-16 22:48:29 +0000498};
499
500/* --------------------- End object type BitMap --------------------- */
501
502
Jack Jansenbdd07471996-01-29 15:44:03 +0000503/* ------------------ Object type QDGlobalsAccess ------------------- */
504
505staticforward PyTypeObject QDGlobalsAccess_Type;
506
507#define QDGA_Check(x) ((x)->ob_type == &QDGlobalsAccess_Type)
508
509typedef struct QDGlobalsAccessObject {
510 PyObject_HEAD
511} QDGlobalsAccessObject;
512
513static PyObject *QDGA_New()
514{
515 QDGlobalsAccessObject *it;
516 it = PyObject_NEW(QDGlobalsAccessObject, &QDGlobalsAccess_Type);
517 if (it == NULL) return NULL;
518 return (PyObject *)it;
519}
520
521static void QDGA_dealloc(self)
522 QDGlobalsAccessObject *self;
523{
524 PyMem_DEL(self);
525}
526
527static PyMethodDef QDGA_methods[] = {
528 {NULL, NULL, 0}
529};
530
531static PyMethodChain QDGA_chain = { QDGA_methods, NULL };
532
533static PyObject *QDGA_getattr(self, name)
534 QDGlobalsAccessObject *self;
535 char *name;
536{
Jack Jansenbd58eda2001-01-24 14:05:11 +0000537#if !ACCESSOR_CALLS_ARE_FUNCTIONS
Jack Jansenbdd07471996-01-29 15:44:03 +0000538
539 if ( strcmp(name, "arrow") == 0 )
540 return PyString_FromStringAndSize((char *)&qd.arrow, sizeof(qd.arrow));
541 if ( strcmp(name, "black") == 0 )
542 return PyString_FromStringAndSize((char *)&qd.black, sizeof(qd.black));
543 if ( strcmp(name, "white") == 0 )
544 return PyString_FromStringAndSize((char *)&qd.white, sizeof(qd.white));
545 if ( strcmp(name, "gray") == 0 )
546 return PyString_FromStringAndSize((char *)&qd.gray, sizeof(qd.gray));
547 if ( strcmp(name, "ltGray") == 0 )
548 return PyString_FromStringAndSize((char *)&qd.ltGray, sizeof(qd.ltGray));
549 if ( strcmp(name, "dkGray") == 0 )
550 return PyString_FromStringAndSize((char *)&qd.dkGray, sizeof(qd.dkGray));
551 if ( strcmp(name, "screenBits") == 0 )
552 return BMObj_New(&qd.screenBits);
553 if ( strcmp(name, "thePort") == 0 )
554 return GrafObj_New(qd.thePort);
555 if ( strcmp(name, "randSeed") == 0 )
556 return Py_BuildValue("l", &qd.randSeed);
557
Jack Jansenfd78de32000-06-20 07:42:00 +0000558#else
559
560 if ( strcmp(name, "arrow") == 0 ) {
561 Cursor rv;
562 GetQDGlobalsArrow(&rv);
563 return PyString_FromStringAndSize((char *)&rv, sizeof(rv));
564 }
565 if ( strcmp(name, "black") == 0 ) {
566 Pattern rv;
567 GetQDGlobalsBlack(&rv);
568 return PyString_FromStringAndSize((char *)&rv, sizeof(rv));
569 }
570 if ( strcmp(name, "white") == 0 ) {
571 Pattern rv;
572 GetQDGlobalsWhite(&rv);
573 return PyString_FromStringAndSize((char *)&rv, sizeof(rv));
574 }
575 if ( strcmp(name, "gray") == 0 ) {
576 Pattern rv;
577 GetQDGlobalsGray(&rv);
578 return PyString_FromStringAndSize((char *)&rv, sizeof(rv));
579 }
580 if ( strcmp(name, "ltGray") == 0 ) {
581 Pattern rv;
582 GetQDGlobalsLightGray(&rv);
583 return PyString_FromStringAndSize((char *)&rv, sizeof(rv));
584 }
585 if ( strcmp(name, "dkGray") == 0 ) {
586 Pattern rv;
587 GetQDGlobalsDarkGray(&rv);
588 return PyString_FromStringAndSize((char *)&rv, sizeof(rv));
589 }
590 if ( strcmp(name, "screenBits") == 0 ) {
591 BitMap rv;
592 GetQDGlobalsScreenBits(&rv);
Jack Jansen87eb4f82001-01-30 09:57:13 +0000593 return BMObj_NewCopied(&rv);
Jack Jansenfd78de32000-06-20 07:42:00 +0000594 }
595 if ( strcmp(name, "thePort") == 0 )
596 return GrafObj_New(GetQDGlobalsThePort());
597 if ( strcmp(name, "randSeed") == 0 )
598 return Py_BuildValue("l", GetQDGlobalsRandomSeed());
599
Jack Jansene79dc762000-06-02 21:35:07 +0000600#endif
Jack Jansenbdd07471996-01-29 15:44:03 +0000601 return Py_FindMethodInChain(&QDGA_chain, (PyObject *)self, name);
602}
603
604#define QDGA_setattr NULL
605
Jack Jansena05ac601999-12-12 21:41:51 +0000606#define QDGA_compare NULL
607
608#define QDGA_repr NULL
609
610#define QDGA_hash NULL
611
Jack Jansenbdd07471996-01-29 15:44:03 +0000612staticforward PyTypeObject QDGlobalsAccess_Type = {
613 PyObject_HEAD_INIT(&PyType_Type)
614 0, /*ob_size*/
615 "QDGlobalsAccess", /*tp_name*/
616 sizeof(QDGlobalsAccessObject), /*tp_basicsize*/
617 0, /*tp_itemsize*/
618 /* methods */
619 (destructor) QDGA_dealloc, /*tp_dealloc*/
620 0, /*tp_print*/
621 (getattrfunc) QDGA_getattr, /*tp_getattr*/
622 (setattrfunc) QDGA_setattr, /*tp_setattr*/
Jack Jansena05ac601999-12-12 21:41:51 +0000623 (cmpfunc) QDGA_compare, /*tp_compare*/
624 (reprfunc) QDGA_repr, /*tp_repr*/
625 (PyNumberMethods *)0, /* tp_as_number */
626 (PySequenceMethods *)0, /* tp_as_sequence */
627 (PyMappingMethods *)0, /* tp_as_mapping */
628 (hashfunc) QDGA_hash, /*tp_hash*/
Jack Jansenbdd07471996-01-29 15:44:03 +0000629};
630
631/* ---------------- End object type QDGlobalsAccess ----------------- */
632
633
Jack Jansen1c4e6141998-04-21 15:23:55 +0000634static PyObject *Qd_MacSetPort(_self, _args)
Guido van Rossum17448e21995-01-30 11:53:55 +0000635 PyObject *_self;
636 PyObject *_args;
637{
638 PyObject *_res = NULL;
Jack Jansen330381c1995-11-15 15:18:01 +0000639 GrafPtr port;
Guido van Rossum17448e21995-01-30 11:53:55 +0000640 if (!PyArg_ParseTuple(_args, "O&",
Jack Jansen330381c1995-11-15 15:18:01 +0000641 GrafObj_Convert, &port))
Guido van Rossum17448e21995-01-30 11:53:55 +0000642 return NULL;
Jack Jansen1c4e6141998-04-21 15:23:55 +0000643 MacSetPort(port);
Guido van Rossume56db431995-03-19 22:49:50 +0000644 Py_INCREF(Py_None);
645 _res = Py_None;
646 return _res;
647}
648
649static PyObject *Qd_GetPort(_self, _args)
650 PyObject *_self;
651 PyObject *_args;
652{
653 PyObject *_res = NULL;
Jack Jansen330381c1995-11-15 15:18:01 +0000654 GrafPtr port;
Guido van Rossume56db431995-03-19 22:49:50 +0000655 if (!PyArg_ParseTuple(_args, ""))
656 return NULL;
657 GetPort(&port);
658 _res = Py_BuildValue("O&",
Jack Jansen330381c1995-11-15 15:18:01 +0000659 GrafObj_New, port);
Guido van Rossume56db431995-03-19 22:49:50 +0000660 return _res;
661}
662
663static PyObject *Qd_GrafDevice(_self, _args)
664 PyObject *_self;
665 PyObject *_args;
666{
667 PyObject *_res = NULL;
668 short device;
669 if (!PyArg_ParseTuple(_args, "h",
670 &device))
671 return NULL;
672 GrafDevice(device);
673 Py_INCREF(Py_None);
674 _res = Py_None;
675 return _res;
676}
677
Jack Jansen41058c01995-11-16 22:48:29 +0000678static PyObject *Qd_SetPortBits(_self, _args)
679 PyObject *_self;
680 PyObject *_args;
681{
682 PyObject *_res = NULL;
683 BitMapPtr bm;
684 if (!PyArg_ParseTuple(_args, "O&",
685 BMObj_Convert, &bm))
686 return NULL;
687 SetPortBits(bm);
688 Py_INCREF(Py_None);
689 _res = Py_None;
690 return _res;
691}
692
Guido van Rossume56db431995-03-19 22:49:50 +0000693static PyObject *Qd_PortSize(_self, _args)
694 PyObject *_self;
695 PyObject *_args;
696{
697 PyObject *_res = NULL;
698 short width;
699 short height;
700 if (!PyArg_ParseTuple(_args, "hh",
701 &width,
702 &height))
703 return NULL;
704 PortSize(width,
705 height);
706 Py_INCREF(Py_None);
707 _res = Py_None;
708 return _res;
709}
710
711static PyObject *Qd_MovePortTo(_self, _args)
712 PyObject *_self;
713 PyObject *_args;
714{
715 PyObject *_res = NULL;
716 short leftGlobal;
717 short topGlobal;
718 if (!PyArg_ParseTuple(_args, "hh",
719 &leftGlobal,
720 &topGlobal))
721 return NULL;
722 MovePortTo(leftGlobal,
723 topGlobal);
724 Py_INCREF(Py_None);
725 _res = Py_None;
726 return _res;
727}
728
729static PyObject *Qd_SetOrigin(_self, _args)
730 PyObject *_self;
731 PyObject *_args;
732{
733 PyObject *_res = NULL;
734 short h;
735 short v;
736 if (!PyArg_ParseTuple(_args, "hh",
737 &h,
738 &v))
739 return NULL;
740 SetOrigin(h,
741 v);
742 Py_INCREF(Py_None);
743 _res = Py_None;
744 return _res;
745}
746
747static PyObject *Qd_SetClip(_self, _args)
748 PyObject *_self;
749 PyObject *_args;
750{
751 PyObject *_res = NULL;
752 RgnHandle rgn;
753 if (!PyArg_ParseTuple(_args, "O&",
754 ResObj_Convert, &rgn))
755 return NULL;
756 SetClip(rgn);
757 Py_INCREF(Py_None);
758 _res = Py_None;
759 return _res;
760}
761
762static PyObject *Qd_GetClip(_self, _args)
763 PyObject *_self;
764 PyObject *_args;
765{
766 PyObject *_res = NULL;
767 RgnHandle rgn;
768 if (!PyArg_ParseTuple(_args, "O&",
769 ResObj_Convert, &rgn))
770 return NULL;
771 GetClip(rgn);
Guido van Rossum17448e21995-01-30 11:53:55 +0000772 Py_INCREF(Py_None);
773 _res = Py_None;
774 return _res;
775}
776
777static PyObject *Qd_ClipRect(_self, _args)
778 PyObject *_self;
779 PyObject *_args;
780{
781 PyObject *_res = NULL;
782 Rect r;
783 if (!PyArg_ParseTuple(_args, "O&",
784 PyMac_GetRect, &r))
785 return NULL;
786 ClipRect(&r);
787 Py_INCREF(Py_None);
788 _res = Py_None;
789 return _res;
790}
791
Jack Jansen04a02e71996-01-06 17:12:58 +0000792static PyObject *Qd_BackPat(_self, _args)
793 PyObject *_self;
794 PyObject *_args;
795{
796 PyObject *_res = NULL;
797 Pattern *pat__in__;
798 int pat__in_len__;
799 if (!PyArg_ParseTuple(_args, "s#",
800 (char **)&pat__in__, &pat__in_len__))
801 return NULL;
802 if (pat__in_len__ != sizeof(Pattern))
803 {
804 PyErr_SetString(PyExc_TypeError, "buffer length should be sizeof(Pattern)");
805 goto pat__error__;
806 }
807 BackPat(pat__in__);
808 Py_INCREF(Py_None);
809 _res = Py_None;
810 pat__error__: ;
811 return _res;
812}
813
Guido van Rossume56db431995-03-19 22:49:50 +0000814static PyObject *Qd_InitCursor(_self, _args)
815 PyObject *_self;
816 PyObject *_args;
817{
818 PyObject *_res = NULL;
819 if (!PyArg_ParseTuple(_args, ""))
820 return NULL;
821 InitCursor();
822 Py_INCREF(Py_None);
823 _res = Py_None;
824 return _res;
825}
826
Jack Jansen1c4e6141998-04-21 15:23:55 +0000827static PyObject *Qd_MacSetCursor(_self, _args)
Jack Jansenb5394061996-01-05 18:06:41 +0000828 PyObject *_self;
829 PyObject *_args;
830{
831 PyObject *_res = NULL;
832 Cursor *crsr__in__;
833 int crsr__in_len__;
834 if (!PyArg_ParseTuple(_args, "s#",
835 (char **)&crsr__in__, &crsr__in_len__))
836 return NULL;
837 if (crsr__in_len__ != sizeof(Cursor))
838 {
839 PyErr_SetString(PyExc_TypeError, "buffer length should be sizeof(Cursor)");
840 goto crsr__error__;
841 }
Jack Jansen1c4e6141998-04-21 15:23:55 +0000842 MacSetCursor(crsr__in__);
Jack Jansenb5394061996-01-05 18:06:41 +0000843 Py_INCREF(Py_None);
844 _res = Py_None;
845 crsr__error__: ;
846 return _res;
847}
848
Guido van Rossume56db431995-03-19 22:49:50 +0000849static PyObject *Qd_HideCursor(_self, _args)
850 PyObject *_self;
851 PyObject *_args;
852{
853 PyObject *_res = NULL;
854 if (!PyArg_ParseTuple(_args, ""))
855 return NULL;
856 HideCursor();
857 Py_INCREF(Py_None);
858 _res = Py_None;
859 return _res;
860}
861
Jack Jansen1c4e6141998-04-21 15:23:55 +0000862static PyObject *Qd_MacShowCursor(_self, _args)
Guido van Rossume56db431995-03-19 22:49:50 +0000863 PyObject *_self;
864 PyObject *_args;
865{
866 PyObject *_res = NULL;
867 if (!PyArg_ParseTuple(_args, ""))
868 return NULL;
Jack Jansen1c4e6141998-04-21 15:23:55 +0000869 MacShowCursor();
Guido van Rossume56db431995-03-19 22:49:50 +0000870 Py_INCREF(Py_None);
871 _res = Py_None;
872 return _res;
873}
874
875static PyObject *Qd_ObscureCursor(_self, _args)
876 PyObject *_self;
877 PyObject *_args;
878{
879 PyObject *_res = NULL;
880 if (!PyArg_ParseTuple(_args, ""))
881 return NULL;
882 ObscureCursor();
883 Py_INCREF(Py_None);
884 _res = Py_None;
885 return _res;
886}
887
888static PyObject *Qd_HidePen(_self, _args)
889 PyObject *_self;
890 PyObject *_args;
891{
892 PyObject *_res = NULL;
893 if (!PyArg_ParseTuple(_args, ""))
894 return NULL;
895 HidePen();
896 Py_INCREF(Py_None);
897 _res = Py_None;
898 return _res;
899}
900
901static PyObject *Qd_ShowPen(_self, _args)
902 PyObject *_self;
903 PyObject *_args;
904{
905 PyObject *_res = NULL;
906 if (!PyArg_ParseTuple(_args, ""))
907 return NULL;
908 ShowPen();
909 Py_INCREF(Py_None);
910 _res = Py_None;
911 return _res;
912}
913
914static PyObject *Qd_GetPen(_self, _args)
915 PyObject *_self;
916 PyObject *_args;
917{
918 PyObject *_res = NULL;
919 Point pt;
Jack Jansen1d8ede71996-01-08 23:47:31 +0000920 if (!PyArg_ParseTuple(_args, ""))
Guido van Rossume56db431995-03-19 22:49:50 +0000921 return NULL;
922 GetPen(&pt);
923 _res = Py_BuildValue("O&",
924 PyMac_BuildPoint, pt);
925 return _res;
926}
927
Jack Jansen04a02e71996-01-06 17:12:58 +0000928static PyObject *Qd_GetPenState(_self, _args)
929 PyObject *_self;
930 PyObject *_args;
931{
932 PyObject *_res = NULL;
933 PenState pnState__out__;
934 if (!PyArg_ParseTuple(_args, ""))
935 return NULL;
936 GetPenState(&pnState__out__);
937 _res = Py_BuildValue("s#",
938 (char *)&pnState__out__, (int)sizeof(PenState));
939 pnState__error__: ;
940 return _res;
941}
942
943static PyObject *Qd_SetPenState(_self, _args)
944 PyObject *_self;
945 PyObject *_args;
946{
947 PyObject *_res = NULL;
948 PenState *pnState__in__;
949 int pnState__in_len__;
950 if (!PyArg_ParseTuple(_args, "s#",
951 (char **)&pnState__in__, &pnState__in_len__))
952 return NULL;
953 if (pnState__in_len__ != sizeof(PenState))
954 {
955 PyErr_SetString(PyExc_TypeError, "buffer length should be sizeof(PenState)");
956 goto pnState__error__;
957 }
958 SetPenState(pnState__in__);
959 Py_INCREF(Py_None);
960 _res = Py_None;
961 pnState__error__: ;
962 return _res;
963}
964
Guido van Rossume56db431995-03-19 22:49:50 +0000965static PyObject *Qd_PenSize(_self, _args)
966 PyObject *_self;
967 PyObject *_args;
968{
969 PyObject *_res = NULL;
970 short width;
971 short height;
972 if (!PyArg_ParseTuple(_args, "hh",
973 &width,
974 &height))
975 return NULL;
976 PenSize(width,
977 height);
978 Py_INCREF(Py_None);
979 _res = Py_None;
980 return _res;
981}
982
983static PyObject *Qd_PenMode(_self, _args)
984 PyObject *_self;
985 PyObject *_args;
986{
987 PyObject *_res = NULL;
988 short mode;
989 if (!PyArg_ParseTuple(_args, "h",
990 &mode))
991 return NULL;
992 PenMode(mode);
993 Py_INCREF(Py_None);
994 _res = Py_None;
995 return _res;
996}
997
Jack Jansen04a02e71996-01-06 17:12:58 +0000998static PyObject *Qd_PenPat(_self, _args)
999 PyObject *_self;
1000 PyObject *_args;
1001{
1002 PyObject *_res = NULL;
1003 Pattern *pat__in__;
1004 int pat__in_len__;
1005 if (!PyArg_ParseTuple(_args, "s#",
1006 (char **)&pat__in__, &pat__in_len__))
1007 return NULL;
1008 if (pat__in_len__ != sizeof(Pattern))
1009 {
1010 PyErr_SetString(PyExc_TypeError, "buffer length should be sizeof(Pattern)");
1011 goto pat__error__;
1012 }
1013 PenPat(pat__in__);
1014 Py_INCREF(Py_None);
1015 _res = Py_None;
1016 pat__error__: ;
1017 return _res;
1018}
1019
Guido van Rossume56db431995-03-19 22:49:50 +00001020static PyObject *Qd_PenNormal(_self, _args)
1021 PyObject *_self;
1022 PyObject *_args;
1023{
1024 PyObject *_res = NULL;
1025 if (!PyArg_ParseTuple(_args, ""))
1026 return NULL;
1027 PenNormal();
1028 Py_INCREF(Py_None);
1029 _res = Py_None;
1030 return _res;
1031}
1032
1033static PyObject *Qd_MoveTo(_self, _args)
1034 PyObject *_self;
1035 PyObject *_args;
1036{
1037 PyObject *_res = NULL;
1038 short h;
1039 short v;
1040 if (!PyArg_ParseTuple(_args, "hh",
1041 &h,
1042 &v))
1043 return NULL;
1044 MoveTo(h,
1045 v);
1046 Py_INCREF(Py_None);
1047 _res = Py_None;
1048 return _res;
1049}
1050
1051static PyObject *Qd_Move(_self, _args)
1052 PyObject *_self;
1053 PyObject *_args;
1054{
1055 PyObject *_res = NULL;
1056 short dh;
1057 short dv;
1058 if (!PyArg_ParseTuple(_args, "hh",
1059 &dh,
1060 &dv))
1061 return NULL;
1062 Move(dh,
1063 dv);
1064 Py_INCREF(Py_None);
1065 _res = Py_None;
1066 return _res;
1067}
1068
Jack Jansen1c4e6141998-04-21 15:23:55 +00001069static PyObject *Qd_MacLineTo(_self, _args)
Guido van Rossume56db431995-03-19 22:49:50 +00001070 PyObject *_self;
1071 PyObject *_args;
1072{
1073 PyObject *_res = NULL;
1074 short h;
1075 short v;
1076 if (!PyArg_ParseTuple(_args, "hh",
1077 &h,
1078 &v))
1079 return NULL;
Jack Jansen1c4e6141998-04-21 15:23:55 +00001080 MacLineTo(h,
1081 v);
Guido van Rossume56db431995-03-19 22:49:50 +00001082 Py_INCREF(Py_None);
1083 _res = Py_None;
1084 return _res;
1085}
1086
1087static PyObject *Qd_Line(_self, _args)
1088 PyObject *_self;
1089 PyObject *_args;
1090{
1091 PyObject *_res = NULL;
1092 short dh;
1093 short dv;
1094 if (!PyArg_ParseTuple(_args, "hh",
1095 &dh,
1096 &dv))
1097 return NULL;
1098 Line(dh,
1099 dv);
1100 Py_INCREF(Py_None);
1101 _res = Py_None;
1102 return _res;
1103}
1104
Guido van Rossume56db431995-03-19 22:49:50 +00001105static PyObject *Qd_ForeColor(_self, _args)
1106 PyObject *_self;
1107 PyObject *_args;
1108{
1109 PyObject *_res = NULL;
1110 long color;
1111 if (!PyArg_ParseTuple(_args, "l",
1112 &color))
1113 return NULL;
1114 ForeColor(color);
1115 Py_INCREF(Py_None);
1116 _res = Py_None;
1117 return _res;
1118}
1119
1120static PyObject *Qd_BackColor(_self, _args)
1121 PyObject *_self;
1122 PyObject *_args;
1123{
1124 PyObject *_res = NULL;
1125 long color;
1126 if (!PyArg_ParseTuple(_args, "l",
1127 &color))
1128 return NULL;
1129 BackColor(color);
1130 Py_INCREF(Py_None);
1131 _res = Py_None;
1132 return _res;
1133}
1134
1135static PyObject *Qd_ColorBit(_self, _args)
1136 PyObject *_self;
1137 PyObject *_args;
1138{
1139 PyObject *_res = NULL;
1140 short whichBit;
1141 if (!PyArg_ParseTuple(_args, "h",
1142 &whichBit))
1143 return NULL;
1144 ColorBit(whichBit);
1145 Py_INCREF(Py_None);
1146 _res = Py_None;
1147 return _res;
1148}
1149
Jack Jansen1c4e6141998-04-21 15:23:55 +00001150static PyObject *Qd_MacSetRect(_self, _args)
Guido van Rossume56db431995-03-19 22:49:50 +00001151 PyObject *_self;
1152 PyObject *_args;
1153{
1154 PyObject *_res = NULL;
1155 Rect r;
1156 short left;
1157 short top;
1158 short right;
1159 short bottom;
1160 if (!PyArg_ParseTuple(_args, "hhhh",
1161 &left,
1162 &top,
1163 &right,
1164 &bottom))
1165 return NULL;
Jack Jansen1c4e6141998-04-21 15:23:55 +00001166 MacSetRect(&r,
1167 left,
1168 top,
1169 right,
1170 bottom);
Guido van Rossume56db431995-03-19 22:49:50 +00001171 _res = Py_BuildValue("O&",
1172 PyMac_BuildRect, &r);
1173 return _res;
1174}
1175
Jack Jansen1c4e6141998-04-21 15:23:55 +00001176static PyObject *Qd_MacOffsetRect(_self, _args)
Guido van Rossume56db431995-03-19 22:49:50 +00001177 PyObject *_self;
1178 PyObject *_args;
1179{
1180 PyObject *_res = NULL;
1181 Rect r;
1182 short dh;
1183 short dv;
Jack Jansen54c8f7e1995-11-14 10:46:01 +00001184 if (!PyArg_ParseTuple(_args, "O&hh",
1185 PyMac_GetRect, &r,
Guido van Rossume56db431995-03-19 22:49:50 +00001186 &dh,
1187 &dv))
1188 return NULL;
Jack Jansen1c4e6141998-04-21 15:23:55 +00001189 MacOffsetRect(&r,
1190 dh,
1191 dv);
Guido van Rossume56db431995-03-19 22:49:50 +00001192 _res = Py_BuildValue("O&",
1193 PyMac_BuildRect, &r);
1194 return _res;
1195}
1196
Jack Jansen1c4e6141998-04-21 15:23:55 +00001197static PyObject *Qd_MacInsetRect(_self, _args)
Guido van Rossume56db431995-03-19 22:49:50 +00001198 PyObject *_self;
1199 PyObject *_args;
1200{
1201 PyObject *_res = NULL;
1202 Rect r;
1203 short dh;
1204 short dv;
Jack Jansen54c8f7e1995-11-14 10:46:01 +00001205 if (!PyArg_ParseTuple(_args, "O&hh",
1206 PyMac_GetRect, &r,
Guido van Rossume56db431995-03-19 22:49:50 +00001207 &dh,
1208 &dv))
1209 return NULL;
Jack Jansen1c4e6141998-04-21 15:23:55 +00001210 MacInsetRect(&r,
1211 dh,
1212 dv);
Guido van Rossume56db431995-03-19 22:49:50 +00001213 _res = Py_BuildValue("O&",
1214 PyMac_BuildRect, &r);
1215 return _res;
1216}
1217
1218static PyObject *Qd_SectRect(_self, _args)
1219 PyObject *_self;
1220 PyObject *_args;
1221{
1222 PyObject *_res = NULL;
1223 Boolean _rv;
1224 Rect src1;
1225 Rect src2;
1226 Rect dstRect;
1227 if (!PyArg_ParseTuple(_args, "O&O&",
1228 PyMac_GetRect, &src1,
1229 PyMac_GetRect, &src2))
1230 return NULL;
1231 _rv = SectRect(&src1,
1232 &src2,
1233 &dstRect);
1234 _res = Py_BuildValue("bO&",
1235 _rv,
1236 PyMac_BuildRect, &dstRect);
1237 return _res;
1238}
1239
Jack Jansen1c4e6141998-04-21 15:23:55 +00001240static PyObject *Qd_MacUnionRect(_self, _args)
Guido van Rossume56db431995-03-19 22:49:50 +00001241 PyObject *_self;
1242 PyObject *_args;
1243{
1244 PyObject *_res = NULL;
1245 Rect src1;
1246 Rect src2;
1247 Rect dstRect;
1248 if (!PyArg_ParseTuple(_args, "O&O&",
1249 PyMac_GetRect, &src1,
1250 PyMac_GetRect, &src2))
1251 return NULL;
Jack Jansen1c4e6141998-04-21 15:23:55 +00001252 MacUnionRect(&src1,
1253 &src2,
1254 &dstRect);
Guido van Rossume56db431995-03-19 22:49:50 +00001255 _res = Py_BuildValue("O&",
1256 PyMac_BuildRect, &dstRect);
1257 return _res;
1258}
1259
Jack Jansen1c4e6141998-04-21 15:23:55 +00001260static PyObject *Qd_MacEqualRect(_self, _args)
Guido van Rossume56db431995-03-19 22:49:50 +00001261 PyObject *_self;
1262 PyObject *_args;
1263{
1264 PyObject *_res = NULL;
1265 Boolean _rv;
1266 Rect rect1;
1267 Rect rect2;
1268 if (!PyArg_ParseTuple(_args, "O&O&",
1269 PyMac_GetRect, &rect1,
1270 PyMac_GetRect, &rect2))
1271 return NULL;
Jack Jansen1c4e6141998-04-21 15:23:55 +00001272 _rv = MacEqualRect(&rect1,
1273 &rect2);
Guido van Rossume56db431995-03-19 22:49:50 +00001274 _res = Py_BuildValue("b",
1275 _rv);
1276 return _res;
1277}
1278
1279static PyObject *Qd_EmptyRect(_self, _args)
1280 PyObject *_self;
1281 PyObject *_args;
1282{
1283 PyObject *_res = NULL;
1284 Boolean _rv;
1285 Rect r;
1286 if (!PyArg_ParseTuple(_args, "O&",
1287 PyMac_GetRect, &r))
1288 return NULL;
1289 _rv = EmptyRect(&r);
1290 _res = Py_BuildValue("b",
1291 _rv);
1292 return _res;
1293}
1294
Jack Jansen1c4e6141998-04-21 15:23:55 +00001295static PyObject *Qd_MacFrameRect(_self, _args)
Guido van Rossume56db431995-03-19 22:49:50 +00001296 PyObject *_self;
1297 PyObject *_args;
1298{
1299 PyObject *_res = NULL;
1300 Rect r;
1301 if (!PyArg_ParseTuple(_args, "O&",
1302 PyMac_GetRect, &r))
1303 return NULL;
Jack Jansen1c4e6141998-04-21 15:23:55 +00001304 MacFrameRect(&r);
Guido van Rossume56db431995-03-19 22:49:50 +00001305 Py_INCREF(Py_None);
1306 _res = Py_None;
1307 return _res;
1308}
1309
1310static PyObject *Qd_PaintRect(_self, _args)
1311 PyObject *_self;
1312 PyObject *_args;
1313{
1314 PyObject *_res = NULL;
1315 Rect r;
1316 if (!PyArg_ParseTuple(_args, "O&",
1317 PyMac_GetRect, &r))
1318 return NULL;
1319 PaintRect(&r);
1320 Py_INCREF(Py_None);
1321 _res = Py_None;
1322 return _res;
1323}
1324
Guido van Rossum17448e21995-01-30 11:53:55 +00001325static PyObject *Qd_EraseRect(_self, _args)
1326 PyObject *_self;
1327 PyObject *_args;
1328{
1329 PyObject *_res = NULL;
1330 Rect r;
1331 if (!PyArg_ParseTuple(_args, "O&",
1332 PyMac_GetRect, &r))
1333 return NULL;
1334 EraseRect(&r);
1335 Py_INCREF(Py_None);
1336 _res = Py_None;
1337 return _res;
1338}
1339
Jack Jansen1c4e6141998-04-21 15:23:55 +00001340static PyObject *Qd_MacInvertRect(_self, _args)
Guido van Rossum17448e21995-01-30 11:53:55 +00001341 PyObject *_self;
1342 PyObject *_args;
1343{
1344 PyObject *_res = NULL;
Guido van Rossume56db431995-03-19 22:49:50 +00001345 Rect r;
Guido van Rossum17448e21995-01-30 11:53:55 +00001346 if (!PyArg_ParseTuple(_args, "O&",
Guido van Rossume56db431995-03-19 22:49:50 +00001347 PyMac_GetRect, &r))
Guido van Rossum17448e21995-01-30 11:53:55 +00001348 return NULL;
Jack Jansen1c4e6141998-04-21 15:23:55 +00001349 MacInvertRect(&r);
Guido van Rossum17448e21995-01-30 11:53:55 +00001350 Py_INCREF(Py_None);
1351 _res = Py_None;
1352 return _res;
1353}
1354
Jack Jansen1c4e6141998-04-21 15:23:55 +00001355static PyObject *Qd_MacFillRect(_self, _args)
Jack Jansen04a02e71996-01-06 17:12:58 +00001356 PyObject *_self;
1357 PyObject *_args;
1358{
1359 PyObject *_res = NULL;
1360 Rect r;
1361 Pattern *pat__in__;
1362 int pat__in_len__;
1363 if (!PyArg_ParseTuple(_args, "O&s#",
1364 PyMac_GetRect, &r,
1365 (char **)&pat__in__, &pat__in_len__))
1366 return NULL;
1367 if (pat__in_len__ != sizeof(Pattern))
1368 {
1369 PyErr_SetString(PyExc_TypeError, "buffer length should be sizeof(Pattern)");
1370 goto pat__error__;
1371 }
Jack Jansen1c4e6141998-04-21 15:23:55 +00001372 MacFillRect(&r,
1373 pat__in__);
Jack Jansen04a02e71996-01-06 17:12:58 +00001374 Py_INCREF(Py_None);
1375 _res = Py_None;
1376 pat__error__: ;
1377 return _res;
1378}
1379
Guido van Rossume56db431995-03-19 22:49:50 +00001380static PyObject *Qd_FrameOval(_self, _args)
1381 PyObject *_self;
1382 PyObject *_args;
1383{
1384 PyObject *_res = NULL;
1385 Rect r;
1386 if (!PyArg_ParseTuple(_args, "O&",
1387 PyMac_GetRect, &r))
1388 return NULL;
1389 FrameOval(&r);
1390 Py_INCREF(Py_None);
1391 _res = Py_None;
1392 return _res;
1393}
1394
1395static PyObject *Qd_PaintOval(_self, _args)
1396 PyObject *_self;
1397 PyObject *_args;
1398{
1399 PyObject *_res = NULL;
1400 Rect r;
1401 if (!PyArg_ParseTuple(_args, "O&",
1402 PyMac_GetRect, &r))
1403 return NULL;
1404 PaintOval(&r);
1405 Py_INCREF(Py_None);
1406 _res = Py_None;
1407 return _res;
1408}
1409
1410static PyObject *Qd_EraseOval(_self, _args)
1411 PyObject *_self;
1412 PyObject *_args;
1413{
1414 PyObject *_res = NULL;
1415 Rect r;
1416 if (!PyArg_ParseTuple(_args, "O&",
1417 PyMac_GetRect, &r))
1418 return NULL;
1419 EraseOval(&r);
1420 Py_INCREF(Py_None);
1421 _res = Py_None;
1422 return _res;
1423}
1424
1425static PyObject *Qd_InvertOval(_self, _args)
1426 PyObject *_self;
1427 PyObject *_args;
1428{
1429 PyObject *_res = NULL;
1430 Rect r;
1431 if (!PyArg_ParseTuple(_args, "O&",
1432 PyMac_GetRect, &r))
1433 return NULL;
1434 InvertOval(&r);
1435 Py_INCREF(Py_None);
1436 _res = Py_None;
1437 return _res;
1438}
1439
Jack Jansen04a02e71996-01-06 17:12:58 +00001440static PyObject *Qd_FillOval(_self, _args)
1441 PyObject *_self;
1442 PyObject *_args;
1443{
1444 PyObject *_res = NULL;
1445 Rect r;
1446 Pattern *pat__in__;
1447 int pat__in_len__;
1448 if (!PyArg_ParseTuple(_args, "O&s#",
1449 PyMac_GetRect, &r,
1450 (char **)&pat__in__, &pat__in_len__))
1451 return NULL;
1452 if (pat__in_len__ != sizeof(Pattern))
1453 {
1454 PyErr_SetString(PyExc_TypeError, "buffer length should be sizeof(Pattern)");
1455 goto pat__error__;
1456 }
1457 FillOval(&r,
1458 pat__in__);
1459 Py_INCREF(Py_None);
1460 _res = Py_None;
1461 pat__error__: ;
1462 return _res;
1463}
1464
Guido van Rossume56db431995-03-19 22:49:50 +00001465static PyObject *Qd_FrameRoundRect(_self, _args)
1466 PyObject *_self;
1467 PyObject *_args;
1468{
1469 PyObject *_res = NULL;
1470 Rect r;
1471 short ovalWidth;
1472 short ovalHeight;
1473 if (!PyArg_ParseTuple(_args, "O&hh",
1474 PyMac_GetRect, &r,
1475 &ovalWidth,
1476 &ovalHeight))
1477 return NULL;
1478 FrameRoundRect(&r,
1479 ovalWidth,
1480 ovalHeight);
1481 Py_INCREF(Py_None);
1482 _res = Py_None;
1483 return _res;
1484}
1485
1486static PyObject *Qd_PaintRoundRect(_self, _args)
1487 PyObject *_self;
1488 PyObject *_args;
1489{
1490 PyObject *_res = NULL;
1491 Rect r;
1492 short ovalWidth;
1493 short ovalHeight;
1494 if (!PyArg_ParseTuple(_args, "O&hh",
1495 PyMac_GetRect, &r,
1496 &ovalWidth,
1497 &ovalHeight))
1498 return NULL;
1499 PaintRoundRect(&r,
1500 ovalWidth,
1501 ovalHeight);
1502 Py_INCREF(Py_None);
1503 _res = Py_None;
1504 return _res;
1505}
1506
1507static PyObject *Qd_EraseRoundRect(_self, _args)
1508 PyObject *_self;
1509 PyObject *_args;
1510{
1511 PyObject *_res = NULL;
1512 Rect r;
1513 short ovalWidth;
1514 short ovalHeight;
1515 if (!PyArg_ParseTuple(_args, "O&hh",
1516 PyMac_GetRect, &r,
1517 &ovalWidth,
1518 &ovalHeight))
1519 return NULL;
1520 EraseRoundRect(&r,
1521 ovalWidth,
1522 ovalHeight);
1523 Py_INCREF(Py_None);
1524 _res = Py_None;
1525 return _res;
1526}
1527
1528static PyObject *Qd_InvertRoundRect(_self, _args)
1529 PyObject *_self;
1530 PyObject *_args;
1531{
1532 PyObject *_res = NULL;
1533 Rect r;
1534 short ovalWidth;
1535 short ovalHeight;
1536 if (!PyArg_ParseTuple(_args, "O&hh",
1537 PyMac_GetRect, &r,
1538 &ovalWidth,
1539 &ovalHeight))
1540 return NULL;
1541 InvertRoundRect(&r,
1542 ovalWidth,
1543 ovalHeight);
1544 Py_INCREF(Py_None);
1545 _res = Py_None;
1546 return _res;
1547}
1548
Jack Jansen04a02e71996-01-06 17:12:58 +00001549static PyObject *Qd_FillRoundRect(_self, _args)
1550 PyObject *_self;
1551 PyObject *_args;
1552{
1553 PyObject *_res = NULL;
1554 Rect r;
1555 short ovalWidth;
1556 short ovalHeight;
1557 Pattern *pat__in__;
1558 int pat__in_len__;
1559 if (!PyArg_ParseTuple(_args, "O&hhs#",
1560 PyMac_GetRect, &r,
1561 &ovalWidth,
1562 &ovalHeight,
1563 (char **)&pat__in__, &pat__in_len__))
1564 return NULL;
1565 if (pat__in_len__ != sizeof(Pattern))
1566 {
1567 PyErr_SetString(PyExc_TypeError, "buffer length should be sizeof(Pattern)");
1568 goto pat__error__;
1569 }
1570 FillRoundRect(&r,
1571 ovalWidth,
1572 ovalHeight,
1573 pat__in__);
1574 Py_INCREF(Py_None);
1575 _res = Py_None;
1576 pat__error__: ;
1577 return _res;
1578}
1579
Guido van Rossume56db431995-03-19 22:49:50 +00001580static PyObject *Qd_FrameArc(_self, _args)
1581 PyObject *_self;
1582 PyObject *_args;
1583{
1584 PyObject *_res = NULL;
1585 Rect r;
1586 short startAngle;
1587 short arcAngle;
1588 if (!PyArg_ParseTuple(_args, "O&hh",
1589 PyMac_GetRect, &r,
1590 &startAngle,
1591 &arcAngle))
1592 return NULL;
1593 FrameArc(&r,
1594 startAngle,
1595 arcAngle);
1596 Py_INCREF(Py_None);
1597 _res = Py_None;
1598 return _res;
1599}
1600
1601static PyObject *Qd_PaintArc(_self, _args)
1602 PyObject *_self;
1603 PyObject *_args;
1604{
1605 PyObject *_res = NULL;
1606 Rect r;
1607 short startAngle;
1608 short arcAngle;
1609 if (!PyArg_ParseTuple(_args, "O&hh",
1610 PyMac_GetRect, &r,
1611 &startAngle,
1612 &arcAngle))
1613 return NULL;
1614 PaintArc(&r,
1615 startAngle,
1616 arcAngle);
1617 Py_INCREF(Py_None);
1618 _res = Py_None;
1619 return _res;
1620}
1621
1622static PyObject *Qd_EraseArc(_self, _args)
1623 PyObject *_self;
1624 PyObject *_args;
1625{
1626 PyObject *_res = NULL;
1627 Rect r;
1628 short startAngle;
1629 short arcAngle;
1630 if (!PyArg_ParseTuple(_args, "O&hh",
1631 PyMac_GetRect, &r,
1632 &startAngle,
1633 &arcAngle))
1634 return NULL;
1635 EraseArc(&r,
1636 startAngle,
1637 arcAngle);
1638 Py_INCREF(Py_None);
1639 _res = Py_None;
1640 return _res;
1641}
1642
1643static PyObject *Qd_InvertArc(_self, _args)
1644 PyObject *_self;
1645 PyObject *_args;
1646{
1647 PyObject *_res = NULL;
1648 Rect r;
1649 short startAngle;
1650 short arcAngle;
1651 if (!PyArg_ParseTuple(_args, "O&hh",
1652 PyMac_GetRect, &r,
1653 &startAngle,
1654 &arcAngle))
1655 return NULL;
1656 InvertArc(&r,
1657 startAngle,
1658 arcAngle);
1659 Py_INCREF(Py_None);
1660 _res = Py_None;
1661 return _res;
1662}
1663
Jack Jansen04a02e71996-01-06 17:12:58 +00001664static PyObject *Qd_FillArc(_self, _args)
1665 PyObject *_self;
1666 PyObject *_args;
1667{
1668 PyObject *_res = NULL;
1669 Rect r;
1670 short startAngle;
1671 short arcAngle;
1672 Pattern *pat__in__;
1673 int pat__in_len__;
1674 if (!PyArg_ParseTuple(_args, "O&hhs#",
1675 PyMac_GetRect, &r,
1676 &startAngle,
1677 &arcAngle,
1678 (char **)&pat__in__, &pat__in_len__))
1679 return NULL;
1680 if (pat__in_len__ != sizeof(Pattern))
1681 {
1682 PyErr_SetString(PyExc_TypeError, "buffer length should be sizeof(Pattern)");
1683 goto pat__error__;
1684 }
1685 FillArc(&r,
1686 startAngle,
1687 arcAngle,
1688 pat__in__);
1689 Py_INCREF(Py_None);
1690 _res = Py_None;
1691 pat__error__: ;
1692 return _res;
1693}
1694
Guido van Rossume56db431995-03-19 22:49:50 +00001695static PyObject *Qd_NewRgn(_self, _args)
1696 PyObject *_self;
1697 PyObject *_args;
1698{
1699 PyObject *_res = NULL;
1700 RgnHandle _rv;
1701 if (!PyArg_ParseTuple(_args, ""))
1702 return NULL;
1703 _rv = NewRgn();
1704 _res = Py_BuildValue("O&",
1705 ResObj_New, _rv);
1706 return _res;
1707}
1708
1709static PyObject *Qd_OpenRgn(_self, _args)
1710 PyObject *_self;
1711 PyObject *_args;
1712{
1713 PyObject *_res = NULL;
1714 if (!PyArg_ParseTuple(_args, ""))
1715 return NULL;
1716 OpenRgn();
1717 Py_INCREF(Py_None);
1718 _res = Py_None;
1719 return _res;
1720}
1721
1722static PyObject *Qd_CloseRgn(_self, _args)
1723 PyObject *_self;
1724 PyObject *_args;
1725{
1726 PyObject *_res = NULL;
1727 RgnHandle dstRgn;
1728 if (!PyArg_ParseTuple(_args, "O&",
1729 ResObj_Convert, &dstRgn))
1730 return NULL;
1731 CloseRgn(dstRgn);
1732 Py_INCREF(Py_None);
1733 _res = Py_None;
1734 return _res;
1735}
1736
Jack Jansen41058c01995-11-16 22:48:29 +00001737static PyObject *Qd_BitMapToRegion(_self, _args)
1738 PyObject *_self;
1739 PyObject *_args;
1740{
1741 PyObject *_res = NULL;
1742 OSErr _err;
1743 RgnHandle region;
1744 BitMapPtr bMap;
1745 if (!PyArg_ParseTuple(_args, "O&O&",
1746 ResObj_Convert, &region,
1747 BMObj_Convert, &bMap))
1748 return NULL;
1749 _err = BitMapToRegion(region,
1750 bMap);
1751 if (_err != noErr) return PyMac_Error(_err);
1752 Py_INCREF(Py_None);
1753 _res = Py_None;
1754 return _res;
1755}
1756
Guido van Rossume56db431995-03-19 22:49:50 +00001757static PyObject *Qd_DisposeRgn(_self, _args)
1758 PyObject *_self;
1759 PyObject *_args;
1760{
1761 PyObject *_res = NULL;
1762 RgnHandle rgn;
1763 if (!PyArg_ParseTuple(_args, "O&",
1764 ResObj_Convert, &rgn))
1765 return NULL;
1766 DisposeRgn(rgn);
1767 Py_INCREF(Py_None);
1768 _res = Py_None;
1769 return _res;
1770}
1771
Jack Jansen1c4e6141998-04-21 15:23:55 +00001772static PyObject *Qd_MacCopyRgn(_self, _args)
Guido van Rossume56db431995-03-19 22:49:50 +00001773 PyObject *_self;
1774 PyObject *_args;
1775{
1776 PyObject *_res = NULL;
1777 RgnHandle srcRgn;
1778 RgnHandle dstRgn;
1779 if (!PyArg_ParseTuple(_args, "O&O&",
1780 ResObj_Convert, &srcRgn,
1781 ResObj_Convert, &dstRgn))
1782 return NULL;
Jack Jansen1c4e6141998-04-21 15:23:55 +00001783 MacCopyRgn(srcRgn,
1784 dstRgn);
Guido van Rossume56db431995-03-19 22:49:50 +00001785 Py_INCREF(Py_None);
1786 _res = Py_None;
1787 return _res;
1788}
1789
1790static PyObject *Qd_SetEmptyRgn(_self, _args)
1791 PyObject *_self;
1792 PyObject *_args;
1793{
1794 PyObject *_res = NULL;
1795 RgnHandle rgn;
1796 if (!PyArg_ParseTuple(_args, "O&",
1797 ResObj_Convert, &rgn))
1798 return NULL;
1799 SetEmptyRgn(rgn);
1800 Py_INCREF(Py_None);
1801 _res = Py_None;
1802 return _res;
1803}
1804
Jack Jansen1c4e6141998-04-21 15:23:55 +00001805static PyObject *Qd_MacSetRectRgn(_self, _args)
Guido van Rossume56db431995-03-19 22:49:50 +00001806 PyObject *_self;
1807 PyObject *_args;
1808{
1809 PyObject *_res = NULL;
1810 RgnHandle rgn;
1811 short left;
1812 short top;
1813 short right;
1814 short bottom;
1815 if (!PyArg_ParseTuple(_args, "O&hhhh",
1816 ResObj_Convert, &rgn,
1817 &left,
1818 &top,
1819 &right,
1820 &bottom))
1821 return NULL;
Jack Jansen1c4e6141998-04-21 15:23:55 +00001822 MacSetRectRgn(rgn,
1823 left,
1824 top,
1825 right,
1826 bottom);
Guido van Rossume56db431995-03-19 22:49:50 +00001827 Py_INCREF(Py_None);
1828 _res = Py_None;
1829 return _res;
1830}
1831
1832static PyObject *Qd_RectRgn(_self, _args)
1833 PyObject *_self;
1834 PyObject *_args;
1835{
1836 PyObject *_res = NULL;
1837 RgnHandle rgn;
1838 Rect r;
1839 if (!PyArg_ParseTuple(_args, "O&O&",
1840 ResObj_Convert, &rgn,
1841 PyMac_GetRect, &r))
1842 return NULL;
1843 RectRgn(rgn,
1844 &r);
1845 Py_INCREF(Py_None);
1846 _res = Py_None;
1847 return _res;
1848}
1849
Jack Jansen1c4e6141998-04-21 15:23:55 +00001850static PyObject *Qd_MacOffsetRgn(_self, _args)
Guido van Rossume56db431995-03-19 22:49:50 +00001851 PyObject *_self;
1852 PyObject *_args;
1853{
1854 PyObject *_res = NULL;
1855 RgnHandle rgn;
1856 short dh;
1857 short dv;
1858 if (!PyArg_ParseTuple(_args, "O&hh",
1859 ResObj_Convert, &rgn,
1860 &dh,
1861 &dv))
1862 return NULL;
Jack Jansen1c4e6141998-04-21 15:23:55 +00001863 MacOffsetRgn(rgn,
1864 dh,
1865 dv);
Guido van Rossume56db431995-03-19 22:49:50 +00001866 Py_INCREF(Py_None);
1867 _res = Py_None;
1868 return _res;
1869}
1870
1871static PyObject *Qd_InsetRgn(_self, _args)
1872 PyObject *_self;
1873 PyObject *_args;
1874{
1875 PyObject *_res = NULL;
1876 RgnHandle rgn;
1877 short dh;
1878 short dv;
1879 if (!PyArg_ParseTuple(_args, "O&hh",
1880 ResObj_Convert, &rgn,
1881 &dh,
1882 &dv))
1883 return NULL;
1884 InsetRgn(rgn,
1885 dh,
1886 dv);
1887 Py_INCREF(Py_None);
1888 _res = Py_None;
1889 return _res;
1890}
1891
1892static PyObject *Qd_SectRgn(_self, _args)
1893 PyObject *_self;
1894 PyObject *_args;
1895{
1896 PyObject *_res = NULL;
1897 RgnHandle srcRgnA;
1898 RgnHandle srcRgnB;
1899 RgnHandle dstRgn;
1900 if (!PyArg_ParseTuple(_args, "O&O&O&",
1901 ResObj_Convert, &srcRgnA,
1902 ResObj_Convert, &srcRgnB,
1903 ResObj_Convert, &dstRgn))
1904 return NULL;
1905 SectRgn(srcRgnA,
1906 srcRgnB,
1907 dstRgn);
1908 Py_INCREF(Py_None);
1909 _res = Py_None;
1910 return _res;
1911}
1912
Jack Jansen1c4e6141998-04-21 15:23:55 +00001913static PyObject *Qd_MacUnionRgn(_self, _args)
Guido van Rossume56db431995-03-19 22:49:50 +00001914 PyObject *_self;
1915 PyObject *_args;
1916{
1917 PyObject *_res = NULL;
1918 RgnHandle srcRgnA;
1919 RgnHandle srcRgnB;
1920 RgnHandle dstRgn;
1921 if (!PyArg_ParseTuple(_args, "O&O&O&",
1922 ResObj_Convert, &srcRgnA,
1923 ResObj_Convert, &srcRgnB,
1924 ResObj_Convert, &dstRgn))
1925 return NULL;
Jack Jansen1c4e6141998-04-21 15:23:55 +00001926 MacUnionRgn(srcRgnA,
1927 srcRgnB,
1928 dstRgn);
Guido van Rossume56db431995-03-19 22:49:50 +00001929 Py_INCREF(Py_None);
1930 _res = Py_None;
1931 return _res;
1932}
1933
1934static PyObject *Qd_DiffRgn(_self, _args)
1935 PyObject *_self;
1936 PyObject *_args;
1937{
1938 PyObject *_res = NULL;
1939 RgnHandle srcRgnA;
1940 RgnHandle srcRgnB;
1941 RgnHandle dstRgn;
1942 if (!PyArg_ParseTuple(_args, "O&O&O&",
1943 ResObj_Convert, &srcRgnA,
1944 ResObj_Convert, &srcRgnB,
1945 ResObj_Convert, &dstRgn))
1946 return NULL;
1947 DiffRgn(srcRgnA,
1948 srcRgnB,
1949 dstRgn);
1950 Py_INCREF(Py_None);
1951 _res = Py_None;
1952 return _res;
1953}
1954
Jack Jansen1c4e6141998-04-21 15:23:55 +00001955static PyObject *Qd_MacXorRgn(_self, _args)
Guido van Rossume56db431995-03-19 22:49:50 +00001956 PyObject *_self;
1957 PyObject *_args;
1958{
1959 PyObject *_res = NULL;
1960 RgnHandle srcRgnA;
1961 RgnHandle srcRgnB;
1962 RgnHandle dstRgn;
1963 if (!PyArg_ParseTuple(_args, "O&O&O&",
1964 ResObj_Convert, &srcRgnA,
1965 ResObj_Convert, &srcRgnB,
1966 ResObj_Convert, &dstRgn))
1967 return NULL;
Jack Jansen1c4e6141998-04-21 15:23:55 +00001968 MacXorRgn(srcRgnA,
1969 srcRgnB,
1970 dstRgn);
Guido van Rossume56db431995-03-19 22:49:50 +00001971 Py_INCREF(Py_None);
1972 _res = Py_None;
1973 return _res;
1974}
1975
1976static PyObject *Qd_RectInRgn(_self, _args)
1977 PyObject *_self;
1978 PyObject *_args;
1979{
1980 PyObject *_res = NULL;
1981 Boolean _rv;
1982 Rect r;
1983 RgnHandle rgn;
1984 if (!PyArg_ParseTuple(_args, "O&O&",
1985 PyMac_GetRect, &r,
1986 ResObj_Convert, &rgn))
1987 return NULL;
1988 _rv = RectInRgn(&r,
1989 rgn);
1990 _res = Py_BuildValue("b",
1991 _rv);
1992 return _res;
1993}
1994
Jack Jansen1c4e6141998-04-21 15:23:55 +00001995static PyObject *Qd_MacEqualRgn(_self, _args)
Guido van Rossume56db431995-03-19 22:49:50 +00001996 PyObject *_self;
1997 PyObject *_args;
1998{
1999 PyObject *_res = NULL;
2000 Boolean _rv;
2001 RgnHandle rgnA;
2002 RgnHandle rgnB;
2003 if (!PyArg_ParseTuple(_args, "O&O&",
2004 ResObj_Convert, &rgnA,
2005 ResObj_Convert, &rgnB))
2006 return NULL;
Jack Jansen1c4e6141998-04-21 15:23:55 +00002007 _rv = MacEqualRgn(rgnA,
2008 rgnB);
Guido van Rossume56db431995-03-19 22:49:50 +00002009 _res = Py_BuildValue("b",
2010 _rv);
2011 return _res;
2012}
2013
2014static PyObject *Qd_EmptyRgn(_self, _args)
2015 PyObject *_self;
2016 PyObject *_args;
2017{
2018 PyObject *_res = NULL;
2019 Boolean _rv;
2020 RgnHandle rgn;
2021 if (!PyArg_ParseTuple(_args, "O&",
2022 ResObj_Convert, &rgn))
2023 return NULL;
2024 _rv = EmptyRgn(rgn);
2025 _res = Py_BuildValue("b",
2026 _rv);
2027 return _res;
2028}
2029
Jack Jansen1c4e6141998-04-21 15:23:55 +00002030static PyObject *Qd_MacFrameRgn(_self, _args)
Guido van Rossume56db431995-03-19 22:49:50 +00002031 PyObject *_self;
2032 PyObject *_args;
2033{
2034 PyObject *_res = NULL;
2035 RgnHandle rgn;
2036 if (!PyArg_ParseTuple(_args, "O&",
2037 ResObj_Convert, &rgn))
2038 return NULL;
Jack Jansen1c4e6141998-04-21 15:23:55 +00002039 MacFrameRgn(rgn);
Guido van Rossume56db431995-03-19 22:49:50 +00002040 Py_INCREF(Py_None);
2041 _res = Py_None;
2042 return _res;
2043}
2044
Jack Jansen1c4e6141998-04-21 15:23:55 +00002045static PyObject *Qd_MacPaintRgn(_self, _args)
Guido van Rossume56db431995-03-19 22:49:50 +00002046 PyObject *_self;
2047 PyObject *_args;
2048{
2049 PyObject *_res = NULL;
2050 RgnHandle rgn;
2051 if (!PyArg_ParseTuple(_args, "O&",
2052 ResObj_Convert, &rgn))
2053 return NULL;
Jack Jansen1c4e6141998-04-21 15:23:55 +00002054 MacPaintRgn(rgn);
Guido van Rossume56db431995-03-19 22:49:50 +00002055 Py_INCREF(Py_None);
2056 _res = Py_None;
2057 return _res;
2058}
2059
2060static PyObject *Qd_EraseRgn(_self, _args)
2061 PyObject *_self;
2062 PyObject *_args;
2063{
2064 PyObject *_res = NULL;
2065 RgnHandle rgn;
2066 if (!PyArg_ParseTuple(_args, "O&",
2067 ResObj_Convert, &rgn))
2068 return NULL;
2069 EraseRgn(rgn);
2070 Py_INCREF(Py_None);
2071 _res = Py_None;
2072 return _res;
2073}
2074
Jack Jansen1c4e6141998-04-21 15:23:55 +00002075static PyObject *Qd_MacInvertRgn(_self, _args)
Guido van Rossume56db431995-03-19 22:49:50 +00002076 PyObject *_self;
2077 PyObject *_args;
2078{
2079 PyObject *_res = NULL;
2080 RgnHandle rgn;
2081 if (!PyArg_ParseTuple(_args, "O&",
2082 ResObj_Convert, &rgn))
2083 return NULL;
Jack Jansen1c4e6141998-04-21 15:23:55 +00002084 MacInvertRgn(rgn);
Guido van Rossume56db431995-03-19 22:49:50 +00002085 Py_INCREF(Py_None);
2086 _res = Py_None;
2087 return _res;
2088}
2089
Jack Jansen1c4e6141998-04-21 15:23:55 +00002090static PyObject *Qd_MacFillRgn(_self, _args)
Jack Jansen04a02e71996-01-06 17:12:58 +00002091 PyObject *_self;
2092 PyObject *_args;
2093{
2094 PyObject *_res = NULL;
2095 RgnHandle rgn;
2096 Pattern *pat__in__;
2097 int pat__in_len__;
2098 if (!PyArg_ParseTuple(_args, "O&s#",
2099 ResObj_Convert, &rgn,
2100 (char **)&pat__in__, &pat__in_len__))
2101 return NULL;
2102 if (pat__in_len__ != sizeof(Pattern))
2103 {
2104 PyErr_SetString(PyExc_TypeError, "buffer length should be sizeof(Pattern)");
2105 goto pat__error__;
2106 }
Jack Jansen1c4e6141998-04-21 15:23:55 +00002107 MacFillRgn(rgn,
2108 pat__in__);
Jack Jansen04a02e71996-01-06 17:12:58 +00002109 Py_INCREF(Py_None);
2110 _res = Py_None;
2111 pat__error__: ;
2112 return _res;
2113}
2114
Guido van Rossume56db431995-03-19 22:49:50 +00002115static PyObject *Qd_ScrollRect(_self, _args)
2116 PyObject *_self;
2117 PyObject *_args;
2118{
2119 PyObject *_res = NULL;
2120 Rect r;
2121 short dh;
2122 short dv;
2123 RgnHandle updateRgn;
2124 if (!PyArg_ParseTuple(_args, "O&hhO&",
2125 PyMac_GetRect, &r,
2126 &dh,
2127 &dv,
2128 ResObj_Convert, &updateRgn))
2129 return NULL;
2130 ScrollRect(&r,
2131 dh,
2132 dv,
2133 updateRgn);
2134 Py_INCREF(Py_None);
2135 _res = Py_None;
2136 return _res;
2137}
2138
Jack Jansen41058c01995-11-16 22:48:29 +00002139static PyObject *Qd_CopyBits(_self, _args)
2140 PyObject *_self;
2141 PyObject *_args;
2142{
2143 PyObject *_res = NULL;
2144 BitMapPtr srcBits;
2145 BitMapPtr dstBits;
2146 Rect srcRect;
2147 Rect dstRect;
2148 short mode;
2149 RgnHandle maskRgn;
2150 if (!PyArg_ParseTuple(_args, "O&O&O&O&hO&",
2151 BMObj_Convert, &srcBits,
2152 BMObj_Convert, &dstBits,
2153 PyMac_GetRect, &srcRect,
2154 PyMac_GetRect, &dstRect,
2155 &mode,
Jack Jansen425e9eb1995-12-12 15:02:03 +00002156 OptResObj_Convert, &maskRgn))
Jack Jansen41058c01995-11-16 22:48:29 +00002157 return NULL;
2158 CopyBits(srcBits,
2159 dstBits,
2160 &srcRect,
2161 &dstRect,
2162 mode,
2163 maskRgn);
2164 Py_INCREF(Py_None);
2165 _res = Py_None;
2166 return _res;
2167}
2168
2169static PyObject *Qd_CopyMask(_self, _args)
2170 PyObject *_self;
2171 PyObject *_args;
2172{
2173 PyObject *_res = NULL;
2174 BitMapPtr srcBits;
2175 BitMapPtr maskBits;
2176 BitMapPtr dstBits;
2177 Rect srcRect;
2178 Rect maskRect;
2179 Rect dstRect;
2180 if (!PyArg_ParseTuple(_args, "O&O&O&O&O&O&",
2181 BMObj_Convert, &srcBits,
2182 BMObj_Convert, &maskBits,
2183 BMObj_Convert, &dstBits,
2184 PyMac_GetRect, &srcRect,
2185 PyMac_GetRect, &maskRect,
2186 PyMac_GetRect, &dstRect))
2187 return NULL;
2188 CopyMask(srcBits,
2189 maskBits,
2190 dstBits,
2191 &srcRect,
2192 &maskRect,
2193 &dstRect);
2194 Py_INCREF(Py_None);
2195 _res = Py_None;
2196 return _res;
2197}
2198
Guido van Rossume56db431995-03-19 22:49:50 +00002199static PyObject *Qd_OpenPicture(_self, _args)
2200 PyObject *_self;
2201 PyObject *_args;
2202{
2203 PyObject *_res = NULL;
2204 PicHandle _rv;
2205 Rect picFrame;
2206 if (!PyArg_ParseTuple(_args, "O&",
2207 PyMac_GetRect, &picFrame))
2208 return NULL;
2209 _rv = OpenPicture(&picFrame);
2210 _res = Py_BuildValue("O&",
2211 ResObj_New, _rv);
2212 return _res;
2213}
2214
2215static PyObject *Qd_PicComment(_self, _args)
2216 PyObject *_self;
2217 PyObject *_args;
2218{
2219 PyObject *_res = NULL;
2220 short kind;
2221 short dataSize;
2222 Handle dataHandle;
2223 if (!PyArg_ParseTuple(_args, "hhO&",
2224 &kind,
2225 &dataSize,
2226 ResObj_Convert, &dataHandle))
2227 return NULL;
2228 PicComment(kind,
2229 dataSize,
2230 dataHandle);
2231 Py_INCREF(Py_None);
2232 _res = Py_None;
2233 return _res;
2234}
2235
2236static PyObject *Qd_ClosePicture(_self, _args)
2237 PyObject *_self;
2238 PyObject *_args;
2239{
2240 PyObject *_res = NULL;
2241 if (!PyArg_ParseTuple(_args, ""))
2242 return NULL;
2243 ClosePicture();
2244 Py_INCREF(Py_None);
2245 _res = Py_None;
2246 return _res;
2247}
2248
2249static PyObject *Qd_DrawPicture(_self, _args)
2250 PyObject *_self;
2251 PyObject *_args;
2252{
2253 PyObject *_res = NULL;
2254 PicHandle myPicture;
2255 Rect dstRect;
2256 if (!PyArg_ParseTuple(_args, "O&O&",
2257 ResObj_Convert, &myPicture,
2258 PyMac_GetRect, &dstRect))
2259 return NULL;
2260 DrawPicture(myPicture,
2261 &dstRect);
2262 Py_INCREF(Py_None);
2263 _res = Py_None;
2264 return _res;
2265}
2266
2267static PyObject *Qd_KillPicture(_self, _args)
2268 PyObject *_self;
2269 PyObject *_args;
2270{
2271 PyObject *_res = NULL;
2272 PicHandle myPicture;
2273 if (!PyArg_ParseTuple(_args, "O&",
2274 ResObj_Convert, &myPicture))
2275 return NULL;
2276 KillPicture(myPicture);
2277 Py_INCREF(Py_None);
2278 _res = Py_None;
2279 return _res;
2280}
2281
2282static PyObject *Qd_OpenPoly(_self, _args)
2283 PyObject *_self;
2284 PyObject *_args;
2285{
2286 PyObject *_res = NULL;
2287 PolyHandle _rv;
2288 if (!PyArg_ParseTuple(_args, ""))
2289 return NULL;
2290 _rv = OpenPoly();
2291 _res = Py_BuildValue("O&",
2292 ResObj_New, _rv);
2293 return _res;
2294}
2295
2296static PyObject *Qd_ClosePoly(_self, _args)
2297 PyObject *_self;
2298 PyObject *_args;
2299{
2300 PyObject *_res = NULL;
2301 if (!PyArg_ParseTuple(_args, ""))
2302 return NULL;
2303 ClosePoly();
2304 Py_INCREF(Py_None);
2305 _res = Py_None;
2306 return _res;
2307}
2308
2309static PyObject *Qd_KillPoly(_self, _args)
2310 PyObject *_self;
2311 PyObject *_args;
2312{
2313 PyObject *_res = NULL;
2314 PolyHandle poly;
2315 if (!PyArg_ParseTuple(_args, "O&",
2316 ResObj_Convert, &poly))
2317 return NULL;
2318 KillPoly(poly);
2319 Py_INCREF(Py_None);
2320 _res = Py_None;
2321 return _res;
2322}
2323
2324static PyObject *Qd_OffsetPoly(_self, _args)
2325 PyObject *_self;
2326 PyObject *_args;
2327{
2328 PyObject *_res = NULL;
2329 PolyHandle poly;
2330 short dh;
2331 short dv;
2332 if (!PyArg_ParseTuple(_args, "O&hh",
2333 ResObj_Convert, &poly,
2334 &dh,
2335 &dv))
2336 return NULL;
2337 OffsetPoly(poly,
2338 dh,
2339 dv);
2340 Py_INCREF(Py_None);
2341 _res = Py_None;
2342 return _res;
2343}
2344
2345static PyObject *Qd_FramePoly(_self, _args)
2346 PyObject *_self;
2347 PyObject *_args;
2348{
2349 PyObject *_res = NULL;
2350 PolyHandle poly;
2351 if (!PyArg_ParseTuple(_args, "O&",
2352 ResObj_Convert, &poly))
2353 return NULL;
2354 FramePoly(poly);
2355 Py_INCREF(Py_None);
2356 _res = Py_None;
2357 return _res;
2358}
2359
2360static PyObject *Qd_PaintPoly(_self, _args)
2361 PyObject *_self;
2362 PyObject *_args;
2363{
2364 PyObject *_res = NULL;
2365 PolyHandle poly;
2366 if (!PyArg_ParseTuple(_args, "O&",
2367 ResObj_Convert, &poly))
2368 return NULL;
2369 PaintPoly(poly);
2370 Py_INCREF(Py_None);
2371 _res = Py_None;
2372 return _res;
2373}
2374
2375static PyObject *Qd_ErasePoly(_self, _args)
2376 PyObject *_self;
2377 PyObject *_args;
2378{
2379 PyObject *_res = NULL;
2380 PolyHandle poly;
2381 if (!PyArg_ParseTuple(_args, "O&",
2382 ResObj_Convert, &poly))
2383 return NULL;
2384 ErasePoly(poly);
2385 Py_INCREF(Py_None);
2386 _res = Py_None;
2387 return _res;
2388}
2389
2390static PyObject *Qd_InvertPoly(_self, _args)
2391 PyObject *_self;
2392 PyObject *_args;
2393{
2394 PyObject *_res = NULL;
2395 PolyHandle poly;
2396 if (!PyArg_ParseTuple(_args, "O&",
2397 ResObj_Convert, &poly))
2398 return NULL;
2399 InvertPoly(poly);
2400 Py_INCREF(Py_None);
2401 _res = Py_None;
2402 return _res;
2403}
2404
Jack Jansen04a02e71996-01-06 17:12:58 +00002405static PyObject *Qd_FillPoly(_self, _args)
2406 PyObject *_self;
2407 PyObject *_args;
2408{
2409 PyObject *_res = NULL;
2410 PolyHandle poly;
2411 Pattern *pat__in__;
2412 int pat__in_len__;
2413 if (!PyArg_ParseTuple(_args, "O&s#",
2414 ResObj_Convert, &poly,
2415 (char **)&pat__in__, &pat__in_len__))
2416 return NULL;
2417 if (pat__in_len__ != sizeof(Pattern))
2418 {
2419 PyErr_SetString(PyExc_TypeError, "buffer length should be sizeof(Pattern)");
2420 goto pat__error__;
2421 }
2422 FillPoly(poly,
2423 pat__in__);
2424 Py_INCREF(Py_None);
2425 _res = Py_None;
2426 pat__error__: ;
2427 return _res;
2428}
2429
Guido van Rossume56db431995-03-19 22:49:50 +00002430static PyObject *Qd_SetPt(_self, _args)
2431 PyObject *_self;
2432 PyObject *_args;
2433{
2434 PyObject *_res = NULL;
2435 Point pt;
2436 short h;
2437 short v;
Jack Jansen1d8ede71996-01-08 23:47:31 +00002438 if (!PyArg_ParseTuple(_args, "hh",
Guido van Rossume56db431995-03-19 22:49:50 +00002439 &h,
2440 &v))
2441 return NULL;
2442 SetPt(&pt,
2443 h,
2444 v);
2445 _res = Py_BuildValue("O&",
2446 PyMac_BuildPoint, pt);
2447 return _res;
2448}
2449
2450static PyObject *Qd_LocalToGlobal(_self, _args)
2451 PyObject *_self;
2452 PyObject *_args;
2453{
2454 PyObject *_res = NULL;
2455 Point pt;
2456 if (!PyArg_ParseTuple(_args, "O&",
2457 PyMac_GetPoint, &pt))
2458 return NULL;
2459 LocalToGlobal(&pt);
2460 _res = Py_BuildValue("O&",
2461 PyMac_BuildPoint, pt);
2462 return _res;
2463}
2464
2465static PyObject *Qd_GlobalToLocal(_self, _args)
2466 PyObject *_self;
2467 PyObject *_args;
2468{
2469 PyObject *_res = NULL;
2470 Point pt;
2471 if (!PyArg_ParseTuple(_args, "O&",
2472 PyMac_GetPoint, &pt))
2473 return NULL;
2474 GlobalToLocal(&pt);
2475 _res = Py_BuildValue("O&",
2476 PyMac_BuildPoint, pt);
2477 return _res;
2478}
2479
2480static PyObject *Qd_Random(_self, _args)
2481 PyObject *_self;
2482 PyObject *_args;
2483{
2484 PyObject *_res = NULL;
2485 short _rv;
2486 if (!PyArg_ParseTuple(_args, ""))
2487 return NULL;
2488 _rv = Random();
2489 _res = Py_BuildValue("h",
2490 _rv);
2491 return _res;
2492}
2493
Jack Jansen1c4e6141998-04-21 15:23:55 +00002494static PyObject *Qd_MacGetPixel(_self, _args)
Guido van Rossume56db431995-03-19 22:49:50 +00002495 PyObject *_self;
2496 PyObject *_args;
2497{
2498 PyObject *_res = NULL;
2499 Boolean _rv;
2500 short h;
2501 short v;
2502 if (!PyArg_ParseTuple(_args, "hh",
2503 &h,
2504 &v))
2505 return NULL;
Jack Jansen1c4e6141998-04-21 15:23:55 +00002506 _rv = MacGetPixel(h,
2507 v);
Guido van Rossume56db431995-03-19 22:49:50 +00002508 _res = Py_BuildValue("b",
2509 _rv);
2510 return _res;
2511}
2512
2513static PyObject *Qd_ScalePt(_self, _args)
2514 PyObject *_self;
2515 PyObject *_args;
2516{
2517 PyObject *_res = NULL;
2518 Point pt;
2519 Rect srcRect;
2520 Rect dstRect;
2521 if (!PyArg_ParseTuple(_args, "O&O&O&",
2522 PyMac_GetPoint, &pt,
2523 PyMac_GetRect, &srcRect,
2524 PyMac_GetRect, &dstRect))
2525 return NULL;
2526 ScalePt(&pt,
2527 &srcRect,
2528 &dstRect);
2529 _res = Py_BuildValue("O&",
2530 PyMac_BuildPoint, pt);
2531 return _res;
2532}
2533
2534static PyObject *Qd_MapPt(_self, _args)
2535 PyObject *_self;
2536 PyObject *_args;
2537{
2538 PyObject *_res = NULL;
2539 Point pt;
2540 Rect srcRect;
2541 Rect dstRect;
2542 if (!PyArg_ParseTuple(_args, "O&O&O&",
2543 PyMac_GetPoint, &pt,
2544 PyMac_GetRect, &srcRect,
2545 PyMac_GetRect, &dstRect))
2546 return NULL;
2547 MapPt(&pt,
2548 &srcRect,
2549 &dstRect);
2550 _res = Py_BuildValue("O&",
2551 PyMac_BuildPoint, pt);
2552 return _res;
2553}
2554
2555static PyObject *Qd_MapRect(_self, _args)
2556 PyObject *_self;
2557 PyObject *_args;
2558{
2559 PyObject *_res = NULL;
2560 Rect r;
2561 Rect srcRect;
2562 Rect dstRect;
Jack Jansen54c8f7e1995-11-14 10:46:01 +00002563 if (!PyArg_ParseTuple(_args, "O&O&O&",
2564 PyMac_GetRect, &r,
Guido van Rossume56db431995-03-19 22:49:50 +00002565 PyMac_GetRect, &srcRect,
2566 PyMac_GetRect, &dstRect))
2567 return NULL;
2568 MapRect(&r,
2569 &srcRect,
2570 &dstRect);
2571 _res = Py_BuildValue("O&",
2572 PyMac_BuildRect, &r);
2573 return _res;
2574}
2575
2576static PyObject *Qd_MapRgn(_self, _args)
2577 PyObject *_self;
2578 PyObject *_args;
2579{
2580 PyObject *_res = NULL;
2581 RgnHandle rgn;
2582 Rect srcRect;
2583 Rect dstRect;
2584 if (!PyArg_ParseTuple(_args, "O&O&O&",
2585 ResObj_Convert, &rgn,
2586 PyMac_GetRect, &srcRect,
2587 PyMac_GetRect, &dstRect))
2588 return NULL;
2589 MapRgn(rgn,
2590 &srcRect,
2591 &dstRect);
2592 Py_INCREF(Py_None);
2593 _res = Py_None;
2594 return _res;
2595}
2596
2597static PyObject *Qd_MapPoly(_self, _args)
2598 PyObject *_self;
2599 PyObject *_args;
2600{
2601 PyObject *_res = NULL;
2602 PolyHandle poly;
2603 Rect srcRect;
2604 Rect dstRect;
2605 if (!PyArg_ParseTuple(_args, "O&O&O&",
2606 ResObj_Convert, &poly,
2607 PyMac_GetRect, &srcRect,
2608 PyMac_GetRect, &dstRect))
2609 return NULL;
2610 MapPoly(poly,
2611 &srcRect,
2612 &dstRect);
2613 Py_INCREF(Py_None);
2614 _res = Py_None;
2615 return _res;
2616}
2617
Jack Jansen41058c01995-11-16 22:48:29 +00002618static PyObject *Qd_StdBits(_self, _args)
2619 PyObject *_self;
2620 PyObject *_args;
2621{
2622 PyObject *_res = NULL;
2623 BitMapPtr srcBits;
2624 Rect srcRect;
2625 Rect dstRect;
2626 short mode;
2627 RgnHandle maskRgn;
2628 if (!PyArg_ParseTuple(_args, "O&O&O&hO&",
2629 BMObj_Convert, &srcBits,
2630 PyMac_GetRect, &srcRect,
2631 PyMac_GetRect, &dstRect,
2632 &mode,
Jack Jansen425e9eb1995-12-12 15:02:03 +00002633 OptResObj_Convert, &maskRgn))
Jack Jansen41058c01995-11-16 22:48:29 +00002634 return NULL;
2635 StdBits(srcBits,
2636 &srcRect,
2637 &dstRect,
2638 mode,
2639 maskRgn);
2640 Py_INCREF(Py_None);
2641 _res = Py_None;
2642 return _res;
2643}
2644
Guido van Rossume56db431995-03-19 22:49:50 +00002645static PyObject *Qd_AddPt(_self, _args)
2646 PyObject *_self;
2647 PyObject *_args;
2648{
2649 PyObject *_res = NULL;
2650 Point src;
2651 Point dst;
2652 if (!PyArg_ParseTuple(_args, "O&O&",
2653 PyMac_GetPoint, &src,
2654 PyMac_GetPoint, &dst))
2655 return NULL;
2656 AddPt(src,
2657 &dst);
2658 _res = Py_BuildValue("O&",
2659 PyMac_BuildPoint, dst);
2660 return _res;
2661}
2662
2663static PyObject *Qd_EqualPt(_self, _args)
2664 PyObject *_self;
2665 PyObject *_args;
2666{
2667 PyObject *_res = NULL;
2668 Boolean _rv;
2669 Point pt1;
2670 Point pt2;
2671 if (!PyArg_ParseTuple(_args, "O&O&",
2672 PyMac_GetPoint, &pt1,
2673 PyMac_GetPoint, &pt2))
2674 return NULL;
2675 _rv = EqualPt(pt1,
2676 pt2);
2677 _res = Py_BuildValue("b",
2678 _rv);
2679 return _res;
2680}
2681
Jack Jansen1c4e6141998-04-21 15:23:55 +00002682static PyObject *Qd_MacPtInRect(_self, _args)
Guido van Rossume56db431995-03-19 22:49:50 +00002683 PyObject *_self;
2684 PyObject *_args;
2685{
2686 PyObject *_res = NULL;
2687 Boolean _rv;
2688 Point pt;
2689 Rect r;
2690 if (!PyArg_ParseTuple(_args, "O&O&",
2691 PyMac_GetPoint, &pt,
2692 PyMac_GetRect, &r))
2693 return NULL;
Jack Jansen1c4e6141998-04-21 15:23:55 +00002694 _rv = MacPtInRect(pt,
2695 &r);
Guido van Rossume56db431995-03-19 22:49:50 +00002696 _res = Py_BuildValue("b",
2697 _rv);
2698 return _res;
2699}
2700
2701static PyObject *Qd_Pt2Rect(_self, _args)
2702 PyObject *_self;
2703 PyObject *_args;
2704{
2705 PyObject *_res = NULL;
2706 Point pt1;
2707 Point pt2;
2708 Rect dstRect;
2709 if (!PyArg_ParseTuple(_args, "O&O&",
2710 PyMac_GetPoint, &pt1,
2711 PyMac_GetPoint, &pt2))
2712 return NULL;
2713 Pt2Rect(pt1,
2714 pt2,
2715 &dstRect);
2716 _res = Py_BuildValue("O&",
2717 PyMac_BuildRect, &dstRect);
2718 return _res;
2719}
2720
2721static PyObject *Qd_PtToAngle(_self, _args)
2722 PyObject *_self;
2723 PyObject *_args;
2724{
2725 PyObject *_res = NULL;
2726 Rect r;
2727 Point pt;
2728 short angle;
2729 if (!PyArg_ParseTuple(_args, "O&O&",
2730 PyMac_GetRect, &r,
2731 PyMac_GetPoint, &pt))
2732 return NULL;
2733 PtToAngle(&r,
2734 pt,
2735 &angle);
2736 _res = Py_BuildValue("h",
2737 angle);
2738 return _res;
2739}
2740
Jack Jansenb81cf9d1995-06-06 13:08:40 +00002741static PyObject *Qd_SubPt(_self, _args)
2742 PyObject *_self;
2743 PyObject *_args;
2744{
2745 PyObject *_res = NULL;
2746 Point src;
2747 Point dst;
2748 if (!PyArg_ParseTuple(_args, "O&O&",
2749 PyMac_GetPoint, &src,
2750 PyMac_GetPoint, &dst))
2751 return NULL;
2752 SubPt(src,
2753 &dst);
2754 _res = Py_BuildValue("O&",
2755 PyMac_BuildPoint, dst);
2756 return _res;
2757}
2758
Guido van Rossume56db431995-03-19 22:49:50 +00002759static PyObject *Qd_PtInRgn(_self, _args)
2760 PyObject *_self;
2761 PyObject *_args;
2762{
2763 PyObject *_res = NULL;
2764 Boolean _rv;
2765 Point pt;
2766 RgnHandle rgn;
2767 if (!PyArg_ParseTuple(_args, "O&O&",
2768 PyMac_GetPoint, &pt,
2769 ResObj_Convert, &rgn))
2770 return NULL;
2771 _rv = PtInRgn(pt,
2772 rgn);
2773 _res = Py_BuildValue("b",
2774 _rv);
2775 return _res;
2776}
2777
2778static PyObject *Qd_NewPixMap(_self, _args)
2779 PyObject *_self;
2780 PyObject *_args;
2781{
2782 PyObject *_res = NULL;
2783 PixMapHandle _rv;
2784 if (!PyArg_ParseTuple(_args, ""))
2785 return NULL;
2786 _rv = NewPixMap();
2787 _res = Py_BuildValue("O&",
2788 ResObj_New, _rv);
2789 return _res;
2790}
2791
Guido van Rossume56db431995-03-19 22:49:50 +00002792static PyObject *Qd_DisposePixMap(_self, _args)
2793 PyObject *_self;
2794 PyObject *_args;
2795{
2796 PyObject *_res = NULL;
2797 PixMapHandle pm;
2798 if (!PyArg_ParseTuple(_args, "O&",
2799 ResObj_Convert, &pm))
2800 return NULL;
2801 DisposePixMap(pm);
2802 Py_INCREF(Py_None);
2803 _res = Py_None;
2804 return _res;
2805}
2806
2807static PyObject *Qd_CopyPixMap(_self, _args)
2808 PyObject *_self;
2809 PyObject *_args;
2810{
2811 PyObject *_res = NULL;
2812 PixMapHandle srcPM;
2813 PixMapHandle dstPM;
2814 if (!PyArg_ParseTuple(_args, "O&O&",
2815 ResObj_Convert, &srcPM,
2816 ResObj_Convert, &dstPM))
2817 return NULL;
2818 CopyPixMap(srcPM,
2819 dstPM);
2820 Py_INCREF(Py_None);
2821 _res = Py_None;
2822 return _res;
2823}
2824
2825static PyObject *Qd_NewPixPat(_self, _args)
2826 PyObject *_self;
2827 PyObject *_args;
2828{
2829 PyObject *_res = NULL;
2830 PixPatHandle _rv;
2831 if (!PyArg_ParseTuple(_args, ""))
2832 return NULL;
2833 _rv = NewPixPat();
2834 _res = Py_BuildValue("O&",
2835 ResObj_New, _rv);
2836 return _res;
2837}
2838
Guido van Rossume56db431995-03-19 22:49:50 +00002839static PyObject *Qd_DisposePixPat(_self, _args)
2840 PyObject *_self;
2841 PyObject *_args;
2842{
2843 PyObject *_res = NULL;
2844 PixPatHandle pp;
2845 if (!PyArg_ParseTuple(_args, "O&",
2846 ResObj_Convert, &pp))
2847 return NULL;
2848 DisposePixPat(pp);
2849 Py_INCREF(Py_None);
2850 _res = Py_None;
2851 return _res;
2852}
2853
2854static PyObject *Qd_CopyPixPat(_self, _args)
2855 PyObject *_self;
2856 PyObject *_args;
2857{
2858 PyObject *_res = NULL;
2859 PixPatHandle srcPP;
2860 PixPatHandle dstPP;
2861 if (!PyArg_ParseTuple(_args, "O&O&",
2862 ResObj_Convert, &srcPP,
2863 ResObj_Convert, &dstPP))
2864 return NULL;
2865 CopyPixPat(srcPP,
2866 dstPP);
2867 Py_INCREF(Py_None);
2868 _res = Py_None;
2869 return _res;
2870}
2871
2872static PyObject *Qd_PenPixPat(_self, _args)
2873 PyObject *_self;
2874 PyObject *_args;
2875{
2876 PyObject *_res = NULL;
2877 PixPatHandle pp;
2878 if (!PyArg_ParseTuple(_args, "O&",
2879 ResObj_Convert, &pp))
2880 return NULL;
2881 PenPixPat(pp);
2882 Py_INCREF(Py_None);
2883 _res = Py_None;
2884 return _res;
2885}
2886
2887static PyObject *Qd_BackPixPat(_self, _args)
2888 PyObject *_self;
2889 PyObject *_args;
2890{
2891 PyObject *_res = NULL;
2892 PixPatHandle pp;
2893 if (!PyArg_ParseTuple(_args, "O&",
2894 ResObj_Convert, &pp))
2895 return NULL;
2896 BackPixPat(pp);
2897 Py_INCREF(Py_None);
2898 _res = Py_None;
2899 return _res;
2900}
2901
2902static PyObject *Qd_GetPixPat(_self, _args)
2903 PyObject *_self;
2904 PyObject *_args;
2905{
2906 PyObject *_res = NULL;
2907 PixPatHandle _rv;
2908 short patID;
2909 if (!PyArg_ParseTuple(_args, "h",
2910 &patID))
2911 return NULL;
2912 _rv = GetPixPat(patID);
2913 _res = Py_BuildValue("O&",
2914 ResObj_New, _rv);
2915 return _res;
2916}
2917
Jack Jansen232f3cd1995-12-09 14:04:31 +00002918static PyObject *Qd_MakeRGBPat(_self, _args)
2919 PyObject *_self;
2920 PyObject *_args;
2921{
2922 PyObject *_res = NULL;
2923 PixPatHandle pp;
2924 RGBColor myColor;
2925 if (!PyArg_ParseTuple(_args, "O&O&",
2926 ResObj_Convert, &pp,
2927 QdRGB_Convert, &myColor))
2928 return NULL;
2929 MakeRGBPat(pp,
2930 &myColor);
2931 Py_INCREF(Py_None);
2932 _res = Py_None;
2933 return _res;
2934}
2935
Guido van Rossume56db431995-03-19 22:49:50 +00002936static PyObject *Qd_FillCRect(_self, _args)
2937 PyObject *_self;
2938 PyObject *_args;
2939{
2940 PyObject *_res = NULL;
2941 Rect r;
2942 PixPatHandle pp;
2943 if (!PyArg_ParseTuple(_args, "O&O&",
2944 PyMac_GetRect, &r,
2945 ResObj_Convert, &pp))
2946 return NULL;
2947 FillCRect(&r,
2948 pp);
2949 Py_INCREF(Py_None);
2950 _res = Py_None;
2951 return _res;
2952}
2953
2954static PyObject *Qd_FillCOval(_self, _args)
2955 PyObject *_self;
2956 PyObject *_args;
2957{
2958 PyObject *_res = NULL;
2959 Rect r;
2960 PixPatHandle pp;
2961 if (!PyArg_ParseTuple(_args, "O&O&",
2962 PyMac_GetRect, &r,
2963 ResObj_Convert, &pp))
2964 return NULL;
2965 FillCOval(&r,
2966 pp);
2967 Py_INCREF(Py_None);
2968 _res = Py_None;
2969 return _res;
2970}
2971
2972static PyObject *Qd_FillCRoundRect(_self, _args)
2973 PyObject *_self;
2974 PyObject *_args;
2975{
2976 PyObject *_res = NULL;
2977 Rect r;
2978 short ovalWidth;
2979 short ovalHeight;
2980 PixPatHandle pp;
2981 if (!PyArg_ParseTuple(_args, "O&hhO&",
2982 PyMac_GetRect, &r,
2983 &ovalWidth,
2984 &ovalHeight,
2985 ResObj_Convert, &pp))
2986 return NULL;
2987 FillCRoundRect(&r,
2988 ovalWidth,
2989 ovalHeight,
2990 pp);
2991 Py_INCREF(Py_None);
2992 _res = Py_None;
2993 return _res;
2994}
2995
2996static PyObject *Qd_FillCArc(_self, _args)
2997 PyObject *_self;
2998 PyObject *_args;
2999{
3000 PyObject *_res = NULL;
3001 Rect r;
3002 short startAngle;
3003 short arcAngle;
3004 PixPatHandle pp;
3005 if (!PyArg_ParseTuple(_args, "O&hhO&",
3006 PyMac_GetRect, &r,
3007 &startAngle,
3008 &arcAngle,
3009 ResObj_Convert, &pp))
3010 return NULL;
3011 FillCArc(&r,
3012 startAngle,
3013 arcAngle,
3014 pp);
3015 Py_INCREF(Py_None);
3016 _res = Py_None;
3017 return _res;
3018}
3019
3020static PyObject *Qd_FillCRgn(_self, _args)
3021 PyObject *_self;
3022 PyObject *_args;
3023{
3024 PyObject *_res = NULL;
3025 RgnHandle rgn;
3026 PixPatHandle pp;
3027 if (!PyArg_ParseTuple(_args, "O&O&",
3028 ResObj_Convert, &rgn,
3029 ResObj_Convert, &pp))
3030 return NULL;
3031 FillCRgn(rgn,
3032 pp);
3033 Py_INCREF(Py_None);
3034 _res = Py_None;
3035 return _res;
3036}
3037
3038static PyObject *Qd_FillCPoly(_self, _args)
3039 PyObject *_self;
3040 PyObject *_args;
3041{
3042 PyObject *_res = NULL;
3043 PolyHandle poly;
3044 PixPatHandle pp;
3045 if (!PyArg_ParseTuple(_args, "O&O&",
3046 ResObj_Convert, &poly,
3047 ResObj_Convert, &pp))
3048 return NULL;
3049 FillCPoly(poly,
3050 pp);
3051 Py_INCREF(Py_None);
3052 _res = Py_None;
3053 return _res;
3054}
3055
Jack Jansen232f3cd1995-12-09 14:04:31 +00003056static PyObject *Qd_RGBForeColor(_self, _args)
3057 PyObject *_self;
3058 PyObject *_args;
3059{
3060 PyObject *_res = NULL;
3061 RGBColor color;
3062 if (!PyArg_ParseTuple(_args, "O&",
3063 QdRGB_Convert, &color))
3064 return NULL;
3065 RGBForeColor(&color);
3066 Py_INCREF(Py_None);
3067 _res = Py_None;
3068 return _res;
3069}
3070
3071static PyObject *Qd_RGBBackColor(_self, _args)
3072 PyObject *_self;
3073 PyObject *_args;
3074{
3075 PyObject *_res = NULL;
3076 RGBColor color;
3077 if (!PyArg_ParseTuple(_args, "O&",
3078 QdRGB_Convert, &color))
3079 return NULL;
3080 RGBBackColor(&color);
3081 Py_INCREF(Py_None);
3082 _res = Py_None;
3083 return _res;
3084}
3085
3086static PyObject *Qd_SetCPixel(_self, _args)
3087 PyObject *_self;
3088 PyObject *_args;
3089{
3090 PyObject *_res = NULL;
3091 short h;
3092 short v;
3093 RGBColor cPix;
3094 if (!PyArg_ParseTuple(_args, "hhO&",
3095 &h,
3096 &v,
3097 QdRGB_Convert, &cPix))
3098 return NULL;
3099 SetCPixel(h,
3100 v,
3101 &cPix);
3102 Py_INCREF(Py_None);
3103 _res = Py_None;
3104 return _res;
3105}
3106
Guido van Rossume56db431995-03-19 22:49:50 +00003107static PyObject *Qd_SetPortPix(_self, _args)
3108 PyObject *_self;
3109 PyObject *_args;
3110{
3111 PyObject *_res = NULL;
3112 PixMapHandle pm;
3113 if (!PyArg_ParseTuple(_args, "O&",
3114 ResObj_Convert, &pm))
3115 return NULL;
3116 SetPortPix(pm);
3117 Py_INCREF(Py_None);
3118 _res = Py_None;
3119 return _res;
3120}
3121
Jack Jansen232f3cd1995-12-09 14:04:31 +00003122static PyObject *Qd_GetCPixel(_self, _args)
3123 PyObject *_self;
3124 PyObject *_args;
3125{
3126 PyObject *_res = NULL;
3127 short h;
3128 short v;
3129 RGBColor cPix;
3130 if (!PyArg_ParseTuple(_args, "hh",
3131 &h,
3132 &v))
3133 return NULL;
3134 GetCPixel(h,
3135 v,
3136 &cPix);
3137 _res = Py_BuildValue("O&",
3138 QdRGB_New, &cPix);
3139 return _res;
3140}
3141
3142static PyObject *Qd_GetForeColor(_self, _args)
3143 PyObject *_self;
3144 PyObject *_args;
3145{
3146 PyObject *_res = NULL;
3147 RGBColor color;
3148 if (!PyArg_ParseTuple(_args, ""))
3149 return NULL;
3150 GetForeColor(&color);
3151 _res = Py_BuildValue("O&",
3152 QdRGB_New, &color);
3153 return _res;
3154}
3155
3156static PyObject *Qd_GetBackColor(_self, _args)
3157 PyObject *_self;
3158 PyObject *_args;
3159{
3160 PyObject *_res = NULL;
3161 RGBColor color;
3162 if (!PyArg_ParseTuple(_args, ""))
3163 return NULL;
3164 GetBackColor(&color);
3165 _res = Py_BuildValue("O&",
3166 QdRGB_New, &color);
3167 return _res;
3168}
3169
3170static PyObject *Qd_OpColor(_self, _args)
3171 PyObject *_self;
3172 PyObject *_args;
3173{
3174 PyObject *_res = NULL;
3175 RGBColor color;
3176 if (!PyArg_ParseTuple(_args, "O&",
3177 QdRGB_Convert, &color))
3178 return NULL;
3179 OpColor(&color);
3180 Py_INCREF(Py_None);
3181 _res = Py_None;
3182 return _res;
3183}
3184
3185static PyObject *Qd_HiliteColor(_self, _args)
3186 PyObject *_self;
3187 PyObject *_args;
3188{
3189 PyObject *_res = NULL;
3190 RGBColor color;
3191 if (!PyArg_ParseTuple(_args, "O&",
3192 QdRGB_Convert, &color))
3193 return NULL;
3194 HiliteColor(&color);
3195 Py_INCREF(Py_None);
3196 _res = Py_None;
3197 return _res;
3198}
3199
Jack Jansen69b43ed1997-08-15 14:35:54 +00003200static PyObject *Qd_DisposeCTable(_self, _args)
3201 PyObject *_self;
3202 PyObject *_args;
3203{
3204 PyObject *_res = NULL;
3205 CTabHandle cTable;
3206 if (!PyArg_ParseTuple(_args, "O&",
3207 ResObj_Convert, &cTable))
3208 return NULL;
3209 DisposeCTable(cTable);
3210 Py_INCREF(Py_None);
3211 _res = Py_None;
3212 return _res;
3213}
3214
3215static PyObject *Qd_GetCTable(_self, _args)
3216 PyObject *_self;
3217 PyObject *_args;
3218{
3219 PyObject *_res = NULL;
3220 CTabHandle _rv;
3221 short ctID;
3222 if (!PyArg_ParseTuple(_args, "h",
3223 &ctID))
3224 return NULL;
3225 _rv = GetCTable(ctID);
3226 _res = Py_BuildValue("O&",
3227 ResObj_New, _rv);
3228 return _res;
3229}
3230
3231static PyObject *Qd_GetCCursor(_self, _args)
3232 PyObject *_self;
3233 PyObject *_args;
3234{
3235 PyObject *_res = NULL;
3236 CCrsrHandle _rv;
3237 short crsrID;
3238 if (!PyArg_ParseTuple(_args, "h",
3239 &crsrID))
3240 return NULL;
3241 _rv = GetCCursor(crsrID);
3242 _res = Py_BuildValue("O&",
3243 ResObj_New, _rv);
3244 return _res;
3245}
3246
3247static PyObject *Qd_SetCCursor(_self, _args)
3248 PyObject *_self;
3249 PyObject *_args;
3250{
3251 PyObject *_res = NULL;
3252 CCrsrHandle cCrsr;
3253 if (!PyArg_ParseTuple(_args, "O&",
3254 ResObj_Convert, &cCrsr))
3255 return NULL;
3256 SetCCursor(cCrsr);
3257 Py_INCREF(Py_None);
3258 _res = Py_None;
3259 return _res;
3260}
3261
Guido van Rossume56db431995-03-19 22:49:50 +00003262static PyObject *Qd_AllocCursor(_self, _args)
3263 PyObject *_self;
3264 PyObject *_args;
3265{
3266 PyObject *_res = NULL;
3267 if (!PyArg_ParseTuple(_args, ""))
3268 return NULL;
3269 AllocCursor();
3270 Py_INCREF(Py_None);
3271 _res = Py_None;
3272 return _res;
3273}
3274
Jack Jansen69b43ed1997-08-15 14:35:54 +00003275static PyObject *Qd_DisposeCCursor(_self, _args)
3276 PyObject *_self;
3277 PyObject *_args;
3278{
3279 PyObject *_res = NULL;
3280 CCrsrHandle cCrsr;
3281 if (!PyArg_ParseTuple(_args, "O&",
3282 ResObj_Convert, &cCrsr))
3283 return NULL;
3284 DisposeCCursor(cCrsr);
3285 Py_INCREF(Py_None);
3286 _res = Py_None;
3287 return _res;
3288}
3289
3290static PyObject *Qd_GetMaxDevice(_self, _args)
3291 PyObject *_self;
3292 PyObject *_args;
3293{
3294 PyObject *_res = NULL;
3295 GDHandle _rv;
3296 Rect globalRect;
3297 if (!PyArg_ParseTuple(_args, "O&",
3298 PyMac_GetRect, &globalRect))
3299 return NULL;
3300 _rv = GetMaxDevice(&globalRect);
3301 _res = Py_BuildValue("O&",
3302 ResObj_New, _rv);
3303 return _res;
3304}
3305
Guido van Rossume56db431995-03-19 22:49:50 +00003306static PyObject *Qd_GetCTSeed(_self, _args)
3307 PyObject *_self;
3308 PyObject *_args;
3309{
3310 PyObject *_res = NULL;
3311 long _rv;
3312 if (!PyArg_ParseTuple(_args, ""))
3313 return NULL;
3314 _rv = GetCTSeed();
3315 _res = Py_BuildValue("l",
3316 _rv);
3317 return _res;
3318}
3319
Jack Jansen69b43ed1997-08-15 14:35:54 +00003320static PyObject *Qd_GetDeviceList(_self, _args)
3321 PyObject *_self;
3322 PyObject *_args;
3323{
3324 PyObject *_res = NULL;
3325 GDHandle _rv;
3326 if (!PyArg_ParseTuple(_args, ""))
3327 return NULL;
3328 _rv = GetDeviceList();
3329 _res = Py_BuildValue("O&",
3330 ResObj_New, _rv);
3331 return _res;
3332}
3333
3334static PyObject *Qd_GetMainDevice(_self, _args)
3335 PyObject *_self;
3336 PyObject *_args;
3337{
3338 PyObject *_res = NULL;
3339 GDHandle _rv;
3340 if (!PyArg_ParseTuple(_args, ""))
3341 return NULL;
3342 _rv = GetMainDevice();
3343 _res = Py_BuildValue("O&",
3344 ResObj_New, _rv);
3345 return _res;
3346}
3347
3348static PyObject *Qd_GetNextDevice(_self, _args)
3349 PyObject *_self;
3350 PyObject *_args;
3351{
3352 PyObject *_res = NULL;
3353 GDHandle _rv;
3354 GDHandle curDevice;
3355 if (!PyArg_ParseTuple(_args, "O&",
3356 ResObj_Convert, &curDevice))
3357 return NULL;
3358 _rv = GetNextDevice(curDevice);
3359 _res = Py_BuildValue("O&",
3360 ResObj_New, _rv);
3361 return _res;
3362}
3363
3364static PyObject *Qd_TestDeviceAttribute(_self, _args)
3365 PyObject *_self;
3366 PyObject *_args;
3367{
3368 PyObject *_res = NULL;
3369 Boolean _rv;
3370 GDHandle gdh;
3371 short attribute;
3372 if (!PyArg_ParseTuple(_args, "O&h",
3373 ResObj_Convert, &gdh,
3374 &attribute))
3375 return NULL;
3376 _rv = TestDeviceAttribute(gdh,
3377 attribute);
3378 _res = Py_BuildValue("b",
3379 _rv);
3380 return _res;
3381}
3382
3383static PyObject *Qd_SetDeviceAttribute(_self, _args)
3384 PyObject *_self;
3385 PyObject *_args;
3386{
3387 PyObject *_res = NULL;
3388 GDHandle gdh;
3389 short attribute;
3390 Boolean value;
3391 if (!PyArg_ParseTuple(_args, "O&hb",
3392 ResObj_Convert, &gdh,
3393 &attribute,
3394 &value))
3395 return NULL;
3396 SetDeviceAttribute(gdh,
3397 attribute,
3398 value);
3399 Py_INCREF(Py_None);
3400 _res = Py_None;
3401 return _res;
3402}
3403
3404static PyObject *Qd_InitGDevice(_self, _args)
3405 PyObject *_self;
3406 PyObject *_args;
3407{
3408 PyObject *_res = NULL;
3409 short qdRefNum;
3410 long mode;
3411 GDHandle gdh;
3412 if (!PyArg_ParseTuple(_args, "hlO&",
3413 &qdRefNum,
3414 &mode,
3415 ResObj_Convert, &gdh))
3416 return NULL;
3417 InitGDevice(qdRefNum,
3418 mode,
3419 gdh);
3420 Py_INCREF(Py_None);
3421 _res = Py_None;
3422 return _res;
3423}
3424
3425static PyObject *Qd_NewGDevice(_self, _args)
3426 PyObject *_self;
3427 PyObject *_args;
3428{
3429 PyObject *_res = NULL;
3430 GDHandle _rv;
3431 short refNum;
3432 long mode;
3433 if (!PyArg_ParseTuple(_args, "hl",
3434 &refNum,
3435 &mode))
3436 return NULL;
3437 _rv = NewGDevice(refNum,
3438 mode);
3439 _res = Py_BuildValue("O&",
3440 ResObj_New, _rv);
3441 return _res;
3442}
3443
3444static PyObject *Qd_DisposeGDevice(_self, _args)
3445 PyObject *_self;
3446 PyObject *_args;
3447{
3448 PyObject *_res = NULL;
3449 GDHandle gdh;
3450 if (!PyArg_ParseTuple(_args, "O&",
3451 ResObj_Convert, &gdh))
3452 return NULL;
3453 DisposeGDevice(gdh);
3454 Py_INCREF(Py_None);
3455 _res = Py_None;
3456 return _res;
3457}
3458
3459static PyObject *Qd_SetGDevice(_self, _args)
3460 PyObject *_self;
3461 PyObject *_args;
3462{
3463 PyObject *_res = NULL;
3464 GDHandle gd;
3465 if (!PyArg_ParseTuple(_args, "O&",
3466 ResObj_Convert, &gd))
3467 return NULL;
3468 SetGDevice(gd);
3469 Py_INCREF(Py_None);
3470 _res = Py_None;
3471 return _res;
3472}
3473
3474static PyObject *Qd_GetGDevice(_self, _args)
3475 PyObject *_self;
3476 PyObject *_args;
3477{
3478 PyObject *_res = NULL;
3479 GDHandle _rv;
3480 if (!PyArg_ParseTuple(_args, ""))
3481 return NULL;
3482 _rv = GetGDevice();
3483 _res = Py_BuildValue("O&",
3484 ResObj_New, _rv);
3485 return _res;
3486}
3487
Jack Jansen232f3cd1995-12-09 14:04:31 +00003488static PyObject *Qd_Color2Index(_self, _args)
3489 PyObject *_self;
3490 PyObject *_args;
3491{
3492 PyObject *_res = NULL;
3493 long _rv;
3494 RGBColor myColor;
3495 if (!PyArg_ParseTuple(_args, "O&",
3496 QdRGB_Convert, &myColor))
3497 return NULL;
3498 _rv = Color2Index(&myColor);
3499 _res = Py_BuildValue("l",
3500 _rv);
3501 return _res;
3502}
3503
3504static PyObject *Qd_Index2Color(_self, _args)
3505 PyObject *_self;
3506 PyObject *_args;
3507{
3508 PyObject *_res = NULL;
3509 long index;
3510 RGBColor aColor;
3511 if (!PyArg_ParseTuple(_args, "l",
3512 &index))
3513 return NULL;
3514 Index2Color(index,
3515 &aColor);
3516 _res = Py_BuildValue("O&",
3517 QdRGB_New, &aColor);
3518 return _res;
3519}
3520
3521static PyObject *Qd_InvertColor(_self, _args)
3522 PyObject *_self;
3523 PyObject *_args;
3524{
3525 PyObject *_res = NULL;
3526 RGBColor myColor;
3527 if (!PyArg_ParseTuple(_args, ""))
3528 return NULL;
3529 InvertColor(&myColor);
3530 _res = Py_BuildValue("O&",
3531 QdRGB_New, &myColor);
3532 return _res;
3533}
3534
3535static PyObject *Qd_RealColor(_self, _args)
3536 PyObject *_self;
3537 PyObject *_args;
3538{
3539 PyObject *_res = NULL;
3540 Boolean _rv;
3541 RGBColor color;
3542 if (!PyArg_ParseTuple(_args, "O&",
3543 QdRGB_Convert, &color))
3544 return NULL;
3545 _rv = RealColor(&color);
3546 _res = Py_BuildValue("b",
3547 _rv);
3548 return _res;
3549}
3550
Jack Jansen69b43ed1997-08-15 14:35:54 +00003551static PyObject *Qd_GetSubTable(_self, _args)
3552 PyObject *_self;
3553 PyObject *_args;
3554{
3555 PyObject *_res = NULL;
3556 CTabHandle myColors;
3557 short iTabRes;
3558 CTabHandle targetTbl;
3559 if (!PyArg_ParseTuple(_args, "O&hO&",
3560 ResObj_Convert, &myColors,
3561 &iTabRes,
3562 ResObj_Convert, &targetTbl))
3563 return NULL;
3564 GetSubTable(myColors,
3565 iTabRes,
3566 targetTbl);
3567 Py_INCREF(Py_None);
3568 _res = Py_None;
3569 return _res;
3570}
3571
3572static PyObject *Qd_MakeITable(_self, _args)
3573 PyObject *_self;
3574 PyObject *_args;
3575{
3576 PyObject *_res = NULL;
3577 CTabHandle cTabH;
3578 ITabHandle iTabH;
3579 short res;
3580 if (!PyArg_ParseTuple(_args, "O&O&h",
3581 ResObj_Convert, &cTabH,
3582 ResObj_Convert, &iTabH,
3583 &res))
3584 return NULL;
3585 MakeITable(cTabH,
3586 iTabH,
3587 res);
3588 Py_INCREF(Py_None);
3589 _res = Py_None;
3590 return _res;
3591}
3592
Guido van Rossume56db431995-03-19 22:49:50 +00003593static PyObject *Qd_SetClientID(_self, _args)
3594 PyObject *_self;
3595 PyObject *_args;
3596{
3597 PyObject *_res = NULL;
3598 short id;
3599 if (!PyArg_ParseTuple(_args, "h",
3600 &id))
3601 return NULL;
3602 SetClientID(id);
3603 Py_INCREF(Py_None);
3604 _res = Py_None;
3605 return _res;
3606}
3607
3608static PyObject *Qd_ProtectEntry(_self, _args)
3609 PyObject *_self;
3610 PyObject *_args;
3611{
3612 PyObject *_res = NULL;
3613 short index;
3614 Boolean protect;
3615 if (!PyArg_ParseTuple(_args, "hb",
3616 &index,
3617 &protect))
3618 return NULL;
3619 ProtectEntry(index,
3620 protect);
3621 Py_INCREF(Py_None);
3622 _res = Py_None;
3623 return _res;
3624}
3625
3626static PyObject *Qd_ReserveEntry(_self, _args)
3627 PyObject *_self;
3628 PyObject *_args;
3629{
3630 PyObject *_res = NULL;
3631 short index;
3632 Boolean reserve;
3633 if (!PyArg_ParseTuple(_args, "hb",
3634 &index,
3635 &reserve))
3636 return NULL;
3637 ReserveEntry(index,
3638 reserve);
3639 Py_INCREF(Py_None);
3640 _res = Py_None;
3641 return _res;
3642}
3643
3644static PyObject *Qd_QDError(_self, _args)
3645 PyObject *_self;
3646 PyObject *_args;
3647{
3648 PyObject *_res = NULL;
3649 short _rv;
3650 if (!PyArg_ParseTuple(_args, ""))
3651 return NULL;
3652 _rv = QDError();
3653 _res = Py_BuildValue("h",
3654 _rv);
3655 return _res;
3656}
3657
Jack Jansen41058c01995-11-16 22:48:29 +00003658static PyObject *Qd_CopyDeepMask(_self, _args)
3659 PyObject *_self;
3660 PyObject *_args;
3661{
3662 PyObject *_res = NULL;
3663 BitMapPtr srcBits;
3664 BitMapPtr maskBits;
3665 BitMapPtr dstBits;
3666 Rect srcRect;
3667 Rect maskRect;
3668 Rect dstRect;
3669 short mode;
3670 RgnHandle maskRgn;
3671 if (!PyArg_ParseTuple(_args, "O&O&O&O&O&O&hO&",
3672 BMObj_Convert, &srcBits,
3673 BMObj_Convert, &maskBits,
3674 BMObj_Convert, &dstBits,
3675 PyMac_GetRect, &srcRect,
3676 PyMac_GetRect, &maskRect,
3677 PyMac_GetRect, &dstRect,
3678 &mode,
Jack Jansen425e9eb1995-12-12 15:02:03 +00003679 OptResObj_Convert, &maskRgn))
Jack Jansen41058c01995-11-16 22:48:29 +00003680 return NULL;
3681 CopyDeepMask(srcBits,
3682 maskBits,
3683 dstBits,
3684 &srcRect,
3685 &maskRect,
3686 &dstRect,
3687 mode,
3688 maskRgn);
3689 Py_INCREF(Py_None);
3690 _res = Py_None;
3691 return _res;
3692}
3693
Jack Jansen54c8f7e1995-11-14 10:46:01 +00003694static PyObject *Qd_GetPattern(_self, _args)
3695 PyObject *_self;
3696 PyObject *_args;
3697{
3698 PyObject *_res = NULL;
3699 PatHandle _rv;
3700 short patternID;
3701 if (!PyArg_ParseTuple(_args, "h",
3702 &patternID))
3703 return NULL;
3704 _rv = GetPattern(patternID);
3705 _res = Py_BuildValue("O&",
3706 ResObj_New, _rv);
3707 return _res;
3708}
3709
Jack Jansen1c4e6141998-04-21 15:23:55 +00003710static PyObject *Qd_MacGetCursor(_self, _args)
Jack Jansen54c8f7e1995-11-14 10:46:01 +00003711 PyObject *_self;
3712 PyObject *_args;
3713{
3714 PyObject *_res = NULL;
3715 CursHandle _rv;
3716 short cursorID;
3717 if (!PyArg_ParseTuple(_args, "h",
3718 &cursorID))
3719 return NULL;
Jack Jansen1c4e6141998-04-21 15:23:55 +00003720 _rv = MacGetCursor(cursorID);
Jack Jansen54c8f7e1995-11-14 10:46:01 +00003721 _res = Py_BuildValue("O&",
3722 ResObj_New, _rv);
3723 return _res;
3724}
3725
3726static PyObject *Qd_GetPicture(_self, _args)
3727 PyObject *_self;
3728 PyObject *_args;
3729{
3730 PyObject *_res = NULL;
3731 PicHandle _rv;
3732 short pictureID;
3733 if (!PyArg_ParseTuple(_args, "h",
3734 &pictureID))
3735 return NULL;
3736 _rv = GetPicture(pictureID);
3737 _res = Py_BuildValue("O&",
3738 ResObj_New, _rv);
3739 return _res;
3740}
3741
3742static PyObject *Qd_DeltaPoint(_self, _args)
3743 PyObject *_self;
3744 PyObject *_args;
3745{
3746 PyObject *_res = NULL;
3747 long _rv;
3748 Point ptA;
3749 Point ptB;
3750 if (!PyArg_ParseTuple(_args, "O&O&",
3751 PyMac_GetPoint, &ptA,
3752 PyMac_GetPoint, &ptB))
3753 return NULL;
3754 _rv = DeltaPoint(ptA,
3755 ptB);
3756 _res = Py_BuildValue("l",
3757 _rv);
3758 return _res;
3759}
3760
3761static PyObject *Qd_ShieldCursor(_self, _args)
3762 PyObject *_self;
3763 PyObject *_args;
3764{
3765 PyObject *_res = NULL;
3766 Rect shieldRect;
3767 Point offsetPt;
3768 if (!PyArg_ParseTuple(_args, "O&O&",
3769 PyMac_GetRect, &shieldRect,
3770 PyMac_GetPoint, &offsetPt))
3771 return NULL;
3772 ShieldCursor(&shieldRect,
3773 offsetPt);
3774 Py_INCREF(Py_None);
3775 _res = Py_None;
3776 return _res;
3777}
3778
3779static PyObject *Qd_ScreenRes(_self, _args)
3780 PyObject *_self;
3781 PyObject *_args;
3782{
3783 PyObject *_res = NULL;
3784 short scrnHRes;
3785 short scrnVRes;
3786 if (!PyArg_ParseTuple(_args, ""))
3787 return NULL;
3788 ScreenRes(&scrnHRes,
3789 &scrnVRes);
3790 _res = Py_BuildValue("hh",
3791 scrnHRes,
3792 scrnVRes);
3793 return _res;
3794}
3795
Jack Jansen04a02e71996-01-06 17:12:58 +00003796static PyObject *Qd_GetIndPattern(_self, _args)
3797 PyObject *_self;
3798 PyObject *_args;
3799{
3800 PyObject *_res = NULL;
3801 Pattern thePat__out__;
3802 short patternListID;
3803 short index;
3804 if (!PyArg_ParseTuple(_args, "hh",
3805 &patternListID,
3806 &index))
3807 return NULL;
3808 GetIndPattern(&thePat__out__,
3809 patternListID,
3810 index);
3811 _res = Py_BuildValue("s#",
3812 (char *)&thePat__out__, (int)sizeof(Pattern));
3813 thePat__error__: ;
3814 return _res;
3815}
3816
Jack Jansen21f96871998-02-20 16:02:09 +00003817static PyObject *Qd_SlopeFromAngle(_self, _args)
3818 PyObject *_self;
3819 PyObject *_args;
3820{
3821 PyObject *_res = NULL;
3822 Fixed _rv;
3823 short angle;
3824 if (!PyArg_ParseTuple(_args, "h",
3825 &angle))
3826 return NULL;
3827 _rv = SlopeFromAngle(angle);
3828 _res = Py_BuildValue("O&",
3829 PyMac_BuildFixed, _rv);
3830 return _res;
3831}
3832
3833static PyObject *Qd_AngleFromSlope(_self, _args)
3834 PyObject *_self;
3835 PyObject *_args;
3836{
3837 PyObject *_res = NULL;
3838 short _rv;
3839 Fixed slope;
3840 if (!PyArg_ParseTuple(_args, "O&",
3841 PyMac_GetFixed, &slope))
3842 return NULL;
3843 _rv = AngleFromSlope(slope);
3844 _res = Py_BuildValue("h",
3845 _rv);
3846 return _res;
3847}
3848
Jack Jansenbd58eda2001-01-24 14:05:11 +00003849static PyObject *Qd_GetPortPixMap(_self, _args)
3850 PyObject *_self;
3851 PyObject *_args;
3852{
3853 PyObject *_res = NULL;
3854 PixMapHandle _rv;
3855 CGrafPtr port;
3856 if (!PyArg_ParseTuple(_args, "O&",
3857 GrafObj_Convert, &port))
3858 return NULL;
3859 _rv = GetPortPixMap(port);
3860 _res = Py_BuildValue("O&",
3861 ResObj_New, _rv);
3862 return _res;
3863}
3864
Jack Jansen5c3c58b2001-01-29 14:07:01 +00003865static PyObject *Qd_GetPortBitMapForCopyBits(_self, _args)
3866 PyObject *_self;
3867 PyObject *_args;
3868{
3869 PyObject *_res = NULL;
3870 const BitMap * _rv;
3871 CGrafPtr port;
3872 if (!PyArg_ParseTuple(_args, "O&",
3873 GrafObj_Convert, &port))
3874 return NULL;
3875 _rv = GetPortBitMapForCopyBits(port);
3876 _res = Py_BuildValue("O&",
3877 BMObj_New, _rv);
3878 return _res;
3879}
3880
Jack Jansenbd58eda2001-01-24 14:05:11 +00003881static PyObject *Qd_GetPortBounds(_self, _args)
3882 PyObject *_self;
3883 PyObject *_args;
3884{
3885 PyObject *_res = NULL;
3886 CGrafPtr port;
3887 Rect rect;
3888 if (!PyArg_ParseTuple(_args, "O&",
3889 GrafObj_Convert, &port))
3890 return NULL;
3891 GetPortBounds(port,
3892 &rect);
3893 _res = Py_BuildValue("O&",
3894 PyMac_BuildRect, &rect);
3895 return _res;
3896}
3897
3898static PyObject *Qd_GetPortForeColor(_self, _args)
3899 PyObject *_self;
3900 PyObject *_args;
3901{
3902 PyObject *_res = NULL;
3903 CGrafPtr port;
3904 RGBColor foreColor;
3905 if (!PyArg_ParseTuple(_args, "O&",
3906 GrafObj_Convert, &port))
3907 return NULL;
3908 GetPortForeColor(port,
3909 &foreColor);
3910 _res = Py_BuildValue("O&",
3911 QdRGB_New, &foreColor);
3912 return _res;
3913}
3914
3915static PyObject *Qd_GetPortBackColor(_self, _args)
3916 PyObject *_self;
3917 PyObject *_args;
3918{
3919 PyObject *_res = NULL;
3920 CGrafPtr port;
3921 RGBColor backColor;
3922 if (!PyArg_ParseTuple(_args, "O&",
3923 GrafObj_Convert, &port))
3924 return NULL;
3925 GetPortBackColor(port,
3926 &backColor);
3927 _res = Py_BuildValue("O&",
3928 QdRGB_New, &backColor);
3929 return _res;
3930}
3931
3932static PyObject *Qd_GetPortOpColor(_self, _args)
3933 PyObject *_self;
3934 PyObject *_args;
3935{
3936 PyObject *_res = NULL;
3937 CGrafPtr port;
3938 RGBColor opColor;
3939 if (!PyArg_ParseTuple(_args, "O&",
3940 GrafObj_Convert, &port))
3941 return NULL;
3942 GetPortOpColor(port,
3943 &opColor);
3944 _res = Py_BuildValue("O&",
3945 QdRGB_New, &opColor);
3946 return _res;
3947}
3948
3949static PyObject *Qd_GetPortHiliteColor(_self, _args)
3950 PyObject *_self;
3951 PyObject *_args;
3952{
3953 PyObject *_res = NULL;
3954 CGrafPtr port;
3955 RGBColor hiliteColor;
3956 if (!PyArg_ParseTuple(_args, "O&",
3957 GrafObj_Convert, &port))
3958 return NULL;
3959 GetPortHiliteColor(port,
3960 &hiliteColor);
3961 _res = Py_BuildValue("O&",
3962 QdRGB_New, &hiliteColor);
3963 return _res;
3964}
3965
3966static PyObject *Qd_GetPortTextFont(_self, _args)
3967 PyObject *_self;
3968 PyObject *_args;
3969{
3970 PyObject *_res = NULL;
3971 short _rv;
3972 CGrafPtr port;
3973 if (!PyArg_ParseTuple(_args, "O&",
3974 GrafObj_Convert, &port))
3975 return NULL;
3976 _rv = GetPortTextFont(port);
3977 _res = Py_BuildValue("h",
3978 _rv);
3979 return _res;
3980}
3981
3982static PyObject *Qd_GetPortTextFace(_self, _args)
3983 PyObject *_self;
3984 PyObject *_args;
3985{
3986 PyObject *_res = NULL;
3987 Style _rv;
3988 CGrafPtr port;
3989 if (!PyArg_ParseTuple(_args, "O&",
3990 GrafObj_Convert, &port))
3991 return NULL;
3992 _rv = GetPortTextFace(port);
3993 _res = Py_BuildValue("b",
3994 _rv);
3995 return _res;
3996}
3997
3998static PyObject *Qd_GetPortTextMode(_self, _args)
3999 PyObject *_self;
4000 PyObject *_args;
4001{
4002 PyObject *_res = NULL;
4003 short _rv;
4004 CGrafPtr port;
4005 if (!PyArg_ParseTuple(_args, "O&",
4006 GrafObj_Convert, &port))
4007 return NULL;
4008 _rv = GetPortTextMode(port);
4009 _res = Py_BuildValue("h",
4010 _rv);
4011 return _res;
4012}
4013
4014static PyObject *Qd_GetPortTextSize(_self, _args)
4015 PyObject *_self;
4016 PyObject *_args;
4017{
4018 PyObject *_res = NULL;
4019 short _rv;
4020 CGrafPtr port;
4021 if (!PyArg_ParseTuple(_args, "O&",
4022 GrafObj_Convert, &port))
4023 return NULL;
4024 _rv = GetPortTextSize(port);
4025 _res = Py_BuildValue("h",
4026 _rv);
4027 return _res;
4028}
4029
4030static PyObject *Qd_GetPortChExtra(_self, _args)
4031 PyObject *_self;
4032 PyObject *_args;
4033{
4034 PyObject *_res = NULL;
4035 short _rv;
4036 CGrafPtr port;
4037 if (!PyArg_ParseTuple(_args, "O&",
4038 GrafObj_Convert, &port))
4039 return NULL;
4040 _rv = GetPortChExtra(port);
4041 _res = Py_BuildValue("h",
4042 _rv);
4043 return _res;
4044}
4045
4046static PyObject *Qd_GetPortFracHPenLocation(_self, _args)
4047 PyObject *_self;
4048 PyObject *_args;
4049{
4050 PyObject *_res = NULL;
4051 short _rv;
4052 CGrafPtr port;
4053 if (!PyArg_ParseTuple(_args, "O&",
4054 GrafObj_Convert, &port))
4055 return NULL;
4056 _rv = GetPortFracHPenLocation(port);
4057 _res = Py_BuildValue("h",
4058 _rv);
4059 return _res;
4060}
4061
4062static PyObject *Qd_GetPortSpExtra(_self, _args)
4063 PyObject *_self;
4064 PyObject *_args;
4065{
4066 PyObject *_res = NULL;
4067 Fixed _rv;
4068 CGrafPtr port;
4069 if (!PyArg_ParseTuple(_args, "O&",
4070 GrafObj_Convert, &port))
4071 return NULL;
4072 _rv = GetPortSpExtra(port);
4073 _res = Py_BuildValue("O&",
4074 PyMac_BuildFixed, _rv);
4075 return _res;
4076}
4077
4078static PyObject *Qd_GetPortPenVisibility(_self, _args)
4079 PyObject *_self;
4080 PyObject *_args;
4081{
4082 PyObject *_res = NULL;
4083 short _rv;
4084 CGrafPtr port;
4085 if (!PyArg_ParseTuple(_args, "O&",
4086 GrafObj_Convert, &port))
4087 return NULL;
4088 _rv = GetPortPenVisibility(port);
4089 _res = Py_BuildValue("h",
4090 _rv);
4091 return _res;
4092}
4093
4094static PyObject *Qd_GetPortVisibleRegion(_self, _args)
4095 PyObject *_self;
4096 PyObject *_args;
4097{
4098 PyObject *_res = NULL;
4099 RgnHandle _rv;
4100 CGrafPtr port;
4101 RgnHandle visRgn;
4102 if (!PyArg_ParseTuple(_args, "O&O&",
4103 GrafObj_Convert, &port,
4104 ResObj_Convert, &visRgn))
4105 return NULL;
4106 _rv = GetPortVisibleRegion(port,
4107 visRgn);
4108 _res = Py_BuildValue("O&",
4109 ResObj_New, _rv);
4110 return _res;
4111}
4112
4113static PyObject *Qd_GetPortClipRegion(_self, _args)
4114 PyObject *_self;
4115 PyObject *_args;
4116{
4117 PyObject *_res = NULL;
4118 RgnHandle _rv;
4119 CGrafPtr port;
4120 RgnHandle clipRgn;
4121 if (!PyArg_ParseTuple(_args, "O&O&",
4122 GrafObj_Convert, &port,
4123 ResObj_Convert, &clipRgn))
4124 return NULL;
4125 _rv = GetPortClipRegion(port,
4126 clipRgn);
4127 _res = Py_BuildValue("O&",
4128 ResObj_New, _rv);
4129 return _res;
4130}
4131
4132static PyObject *Qd_GetPortBackPixPat(_self, _args)
4133 PyObject *_self;
4134 PyObject *_args;
4135{
4136 PyObject *_res = NULL;
4137 PixPatHandle _rv;
4138 CGrafPtr port;
4139 PixPatHandle backPattern;
4140 if (!PyArg_ParseTuple(_args, "O&O&",
4141 GrafObj_Convert, &port,
4142 ResObj_Convert, &backPattern))
4143 return NULL;
4144 _rv = GetPortBackPixPat(port,
4145 backPattern);
4146 _res = Py_BuildValue("O&",
4147 ResObj_New, _rv);
4148 return _res;
4149}
4150
4151static PyObject *Qd_GetPortPenPixPat(_self, _args)
4152 PyObject *_self;
4153 PyObject *_args;
4154{
4155 PyObject *_res = NULL;
4156 PixPatHandle _rv;
4157 CGrafPtr port;
4158 PixPatHandle penPattern;
4159 if (!PyArg_ParseTuple(_args, "O&O&",
4160 GrafObj_Convert, &port,
4161 ResObj_Convert, &penPattern))
4162 return NULL;
4163 _rv = GetPortPenPixPat(port,
4164 penPattern);
4165 _res = Py_BuildValue("O&",
4166 ResObj_New, _rv);
4167 return _res;
4168}
4169
4170static PyObject *Qd_GetPortFillPixPat(_self, _args)
4171 PyObject *_self;
4172 PyObject *_args;
4173{
4174 PyObject *_res = NULL;
4175 PixPatHandle _rv;
4176 CGrafPtr port;
4177 PixPatHandle fillPattern;
4178 if (!PyArg_ParseTuple(_args, "O&O&",
4179 GrafObj_Convert, &port,
4180 ResObj_Convert, &fillPattern))
4181 return NULL;
4182 _rv = GetPortFillPixPat(port,
4183 fillPattern);
4184 _res = Py_BuildValue("O&",
4185 ResObj_New, _rv);
4186 return _res;
4187}
4188
4189static PyObject *Qd_GetPortPenSize(_self, _args)
4190 PyObject *_self;
4191 PyObject *_args;
4192{
4193 PyObject *_res = NULL;
4194 CGrafPtr port;
4195 Point penSize;
4196 if (!PyArg_ParseTuple(_args, "O&O&",
4197 GrafObj_Convert, &port,
4198 PyMac_GetPoint, &penSize))
4199 return NULL;
4200 GetPortPenSize(port,
4201 &penSize);
4202 _res = Py_BuildValue("O&",
4203 PyMac_BuildPoint, penSize);
4204 return _res;
4205}
4206
4207static PyObject *Qd_GetPortPenMode(_self, _args)
4208 PyObject *_self;
4209 PyObject *_args;
4210{
4211 PyObject *_res = NULL;
4212 SInt32 _rv;
4213 CGrafPtr port;
4214 if (!PyArg_ParseTuple(_args, "O&",
4215 GrafObj_Convert, &port))
4216 return NULL;
4217 _rv = GetPortPenMode(port);
4218 _res = Py_BuildValue("l",
4219 _rv);
4220 return _res;
4221}
4222
4223static PyObject *Qd_GetPortPenLocation(_self, _args)
4224 PyObject *_self;
4225 PyObject *_args;
4226{
4227 PyObject *_res = NULL;
4228 CGrafPtr port;
4229 Point penLocation;
4230 if (!PyArg_ParseTuple(_args, "O&O&",
4231 GrafObj_Convert, &port,
4232 PyMac_GetPoint, &penLocation))
4233 return NULL;
4234 GetPortPenLocation(port,
4235 &penLocation);
4236 _res = Py_BuildValue("O&",
4237 PyMac_BuildPoint, penLocation);
4238 return _res;
4239}
4240
4241static PyObject *Qd_IsPortRegionBeingDefined(_self, _args)
4242 PyObject *_self;
4243 PyObject *_args;
4244{
4245 PyObject *_res = NULL;
4246 Boolean _rv;
4247 CGrafPtr port;
4248 if (!PyArg_ParseTuple(_args, "O&",
4249 GrafObj_Convert, &port))
4250 return NULL;
4251 _rv = IsPortRegionBeingDefined(port);
4252 _res = Py_BuildValue("b",
4253 _rv);
4254 return _res;
4255}
4256
4257static PyObject *Qd_IsPortPictureBeingDefined(_self, _args)
4258 PyObject *_self;
4259 PyObject *_args;
4260{
4261 PyObject *_res = NULL;
4262 Boolean _rv;
4263 CGrafPtr port;
4264 if (!PyArg_ParseTuple(_args, "O&",
4265 GrafObj_Convert, &port))
4266 return NULL;
4267 _rv = IsPortPictureBeingDefined(port);
4268 _res = Py_BuildValue("b",
4269 _rv);
4270 return _res;
4271}
4272
4273#if TARGET_API_MAC_CARBON
4274
4275static PyObject *Qd_IsPortOffscreen(_self, _args)
4276 PyObject *_self;
4277 PyObject *_args;
4278{
4279 PyObject *_res = NULL;
4280 Boolean _rv;
4281 CGrafPtr port;
4282 if (!PyArg_ParseTuple(_args, "O&",
4283 GrafObj_Convert, &port))
4284 return NULL;
4285 _rv = IsPortOffscreen(port);
4286 _res = Py_BuildValue("b",
4287 _rv);
4288 return _res;
4289}
4290#endif
4291
4292#if TARGET_API_MAC_CARBON
4293
4294static PyObject *Qd_IsPortColor(_self, _args)
4295 PyObject *_self;
4296 PyObject *_args;
4297{
4298 PyObject *_res = NULL;
4299 Boolean _rv;
4300 CGrafPtr port;
4301 if (!PyArg_ParseTuple(_args, "O&",
4302 GrafObj_Convert, &port))
4303 return NULL;
4304 _rv = IsPortColor(port);
4305 _res = Py_BuildValue("b",
4306 _rv);
4307 return _res;
4308}
4309#endif
4310
4311static PyObject *Qd_SetPortBounds(_self, _args)
4312 PyObject *_self;
4313 PyObject *_args;
4314{
4315 PyObject *_res = NULL;
4316 CGrafPtr port;
4317 Rect rect;
4318 if (!PyArg_ParseTuple(_args, "O&O&",
4319 GrafObj_Convert, &port,
4320 PyMac_GetRect, &rect))
4321 return NULL;
4322 SetPortBounds(port,
4323 &rect);
4324 Py_INCREF(Py_None);
4325 _res = Py_None;
4326 return _res;
4327}
4328
4329static PyObject *Qd_SetPortOpColor(_self, _args)
4330 PyObject *_self;
4331 PyObject *_args;
4332{
4333 PyObject *_res = NULL;
4334 CGrafPtr port;
4335 RGBColor opColor;
4336 if (!PyArg_ParseTuple(_args, "O&O&",
4337 GrafObj_Convert, &port,
4338 QdRGB_Convert, &opColor))
4339 return NULL;
4340 SetPortOpColor(port,
4341 &opColor);
4342 Py_INCREF(Py_None);
4343 _res = Py_None;
4344 return _res;
4345}
4346
4347static PyObject *Qd_SetPortVisibleRegion(_self, _args)
4348 PyObject *_self;
4349 PyObject *_args;
4350{
4351 PyObject *_res = NULL;
4352 CGrafPtr port;
4353 RgnHandle visRgn;
4354 if (!PyArg_ParseTuple(_args, "O&O&",
4355 GrafObj_Convert, &port,
4356 ResObj_Convert, &visRgn))
4357 return NULL;
4358 SetPortVisibleRegion(port,
4359 visRgn);
4360 Py_INCREF(Py_None);
4361 _res = Py_None;
4362 return _res;
4363}
4364
4365static PyObject *Qd_SetPortClipRegion(_self, _args)
4366 PyObject *_self;
4367 PyObject *_args;
4368{
4369 PyObject *_res = NULL;
4370 CGrafPtr port;
4371 RgnHandle clipRgn;
4372 if (!PyArg_ParseTuple(_args, "O&O&",
4373 GrafObj_Convert, &port,
4374 ResObj_Convert, &clipRgn))
4375 return NULL;
4376 SetPortClipRegion(port,
4377 clipRgn);
4378 Py_INCREF(Py_None);
4379 _res = Py_None;
4380 return _res;
4381}
4382
4383static PyObject *Qd_SetPortPenPixPat(_self, _args)
4384 PyObject *_self;
4385 PyObject *_args;
4386{
4387 PyObject *_res = NULL;
4388 CGrafPtr port;
4389 PixPatHandle penPattern;
4390 if (!PyArg_ParseTuple(_args, "O&O&",
4391 GrafObj_Convert, &port,
4392 ResObj_Convert, &penPattern))
4393 return NULL;
4394 SetPortPenPixPat(port,
4395 penPattern);
4396 Py_INCREF(Py_None);
4397 _res = Py_None;
4398 return _res;
4399}
4400
4401static PyObject *Qd_SetPortBackPixPat(_self, _args)
4402 PyObject *_self;
4403 PyObject *_args;
4404{
4405 PyObject *_res = NULL;
4406 CGrafPtr port;
4407 PixPatHandle backPattern;
4408 if (!PyArg_ParseTuple(_args, "O&O&",
4409 GrafObj_Convert, &port,
4410 ResObj_Convert, &backPattern))
4411 return NULL;
4412 SetPortBackPixPat(port,
4413 backPattern);
4414 Py_INCREF(Py_None);
4415 _res = Py_None;
4416 return _res;
4417}
4418
4419static PyObject *Qd_SetPortPenSize(_self, _args)
4420 PyObject *_self;
4421 PyObject *_args;
4422{
4423 PyObject *_res = NULL;
4424 CGrafPtr port;
4425 Point penSize;
4426 if (!PyArg_ParseTuple(_args, "O&O&",
4427 GrafObj_Convert, &port,
4428 PyMac_GetPoint, &penSize))
4429 return NULL;
4430 SetPortPenSize(port,
4431 penSize);
4432 Py_INCREF(Py_None);
4433 _res = Py_None;
4434 return _res;
4435}
4436
4437static PyObject *Qd_SetPortPenMode(_self, _args)
4438 PyObject *_self;
4439 PyObject *_args;
4440{
4441 PyObject *_res = NULL;
4442 CGrafPtr port;
4443 SInt32 penMode;
4444 if (!PyArg_ParseTuple(_args, "O&l",
4445 GrafObj_Convert, &port,
4446 &penMode))
4447 return NULL;
4448 SetPortPenMode(port,
4449 penMode);
4450 Py_INCREF(Py_None);
4451 _res = Py_None;
4452 return _res;
4453}
4454
4455static PyObject *Qd_SetPortFracHPenLocation(_self, _args)
4456 PyObject *_self;
4457 PyObject *_args;
4458{
4459 PyObject *_res = NULL;
4460 CGrafPtr port;
4461 short pnLocHFrac;
4462 if (!PyArg_ParseTuple(_args, "O&h",
4463 GrafObj_Convert, &port,
4464 &pnLocHFrac))
4465 return NULL;
4466 SetPortFracHPenLocation(port,
4467 pnLocHFrac);
4468 Py_INCREF(Py_None);
4469 _res = Py_None;
4470 return _res;
4471}
4472
4473static PyObject *Qd_GetPixBounds(_self, _args)
4474 PyObject *_self;
4475 PyObject *_args;
4476{
4477 PyObject *_res = NULL;
4478 PixMapHandle pixMap;
4479 Rect bounds;
4480 if (!PyArg_ParseTuple(_args, "O&",
4481 ResObj_Convert, &pixMap))
4482 return NULL;
4483 GetPixBounds(pixMap,
4484 &bounds);
4485 _res = Py_BuildValue("O&",
4486 PyMac_BuildRect, &bounds);
4487 return _res;
4488}
4489
4490static PyObject *Qd_GetPixDepth(_self, _args)
4491 PyObject *_self;
4492 PyObject *_args;
4493{
4494 PyObject *_res = NULL;
4495 short _rv;
4496 PixMapHandle pixMap;
4497 if (!PyArg_ParseTuple(_args, "O&",
4498 ResObj_Convert, &pixMap))
4499 return NULL;
4500 _rv = GetPixDepth(pixMap);
4501 _res = Py_BuildValue("h",
4502 _rv);
4503 return _res;
4504}
4505
4506static PyObject *Qd_GetQDGlobalsRandomSeed(_self, _args)
4507 PyObject *_self;
4508 PyObject *_args;
4509{
4510 PyObject *_res = NULL;
4511 long _rv;
4512 if (!PyArg_ParseTuple(_args, ""))
4513 return NULL;
4514 _rv = GetQDGlobalsRandomSeed();
4515 _res = Py_BuildValue("l",
4516 _rv);
4517 return _res;
4518}
4519
4520static PyObject *Qd_GetQDGlobalsScreenBits(_self, _args)
4521 PyObject *_self;
4522 PyObject *_args;
4523{
4524 PyObject *_res = NULL;
4525 BitMap screenBits;
4526 if (!PyArg_ParseTuple(_args, ""))
4527 return NULL;
4528 GetQDGlobalsScreenBits(&screenBits);
4529 _res = Py_BuildValue("O&",
Jack Jansen87eb4f82001-01-30 09:57:13 +00004530 BMObj_NewCopied, &screenBits);
Jack Jansenbd58eda2001-01-24 14:05:11 +00004531 return _res;
4532}
4533
4534static PyObject *Qd_GetQDGlobalsArrow(_self, _args)
4535 PyObject *_self;
4536 PyObject *_args;
4537{
4538 PyObject *_res = NULL;
4539 Cursor arrow__out__;
4540 if (!PyArg_ParseTuple(_args, ""))
4541 return NULL;
4542 GetQDGlobalsArrow(&arrow__out__);
4543 _res = Py_BuildValue("s#",
4544 (char *)&arrow__out__, (int)sizeof(Cursor));
4545 arrow__error__: ;
4546 return _res;
4547}
4548
4549static PyObject *Qd_GetQDGlobalsDarkGray(_self, _args)
4550 PyObject *_self;
4551 PyObject *_args;
4552{
4553 PyObject *_res = NULL;
4554 Pattern dkGray__out__;
4555 if (!PyArg_ParseTuple(_args, ""))
4556 return NULL;
4557 GetQDGlobalsDarkGray(&dkGray__out__);
4558 _res = Py_BuildValue("s#",
4559 (char *)&dkGray__out__, (int)sizeof(Pattern));
4560 dkGray__error__: ;
4561 return _res;
4562}
4563
4564static PyObject *Qd_GetQDGlobalsLightGray(_self, _args)
4565 PyObject *_self;
4566 PyObject *_args;
4567{
4568 PyObject *_res = NULL;
4569 Pattern ltGray__out__;
4570 if (!PyArg_ParseTuple(_args, ""))
4571 return NULL;
4572 GetQDGlobalsLightGray(&ltGray__out__);
4573 _res = Py_BuildValue("s#",
4574 (char *)&ltGray__out__, (int)sizeof(Pattern));
4575 ltGray__error__: ;
4576 return _res;
4577}
4578
4579static PyObject *Qd_GetQDGlobalsGray(_self, _args)
4580 PyObject *_self;
4581 PyObject *_args;
4582{
4583 PyObject *_res = NULL;
4584 Pattern gray__out__;
4585 if (!PyArg_ParseTuple(_args, ""))
4586 return NULL;
4587 GetQDGlobalsGray(&gray__out__);
4588 _res = Py_BuildValue("s#",
4589 (char *)&gray__out__, (int)sizeof(Pattern));
4590 gray__error__: ;
4591 return _res;
4592}
4593
4594static PyObject *Qd_GetQDGlobalsBlack(_self, _args)
4595 PyObject *_self;
4596 PyObject *_args;
4597{
4598 PyObject *_res = NULL;
4599 Pattern black__out__;
4600 if (!PyArg_ParseTuple(_args, ""))
4601 return NULL;
4602 GetQDGlobalsBlack(&black__out__);
4603 _res = Py_BuildValue("s#",
4604 (char *)&black__out__, (int)sizeof(Pattern));
4605 black__error__: ;
4606 return _res;
4607}
4608
4609static PyObject *Qd_GetQDGlobalsWhite(_self, _args)
4610 PyObject *_self;
4611 PyObject *_args;
4612{
4613 PyObject *_res = NULL;
4614 Pattern white__out__;
4615 if (!PyArg_ParseTuple(_args, ""))
4616 return NULL;
4617 GetQDGlobalsWhite(&white__out__);
4618 _res = Py_BuildValue("s#",
4619 (char *)&white__out__, (int)sizeof(Pattern));
4620 white__error__: ;
4621 return _res;
4622}
4623
4624static PyObject *Qd_GetQDGlobalsThePort(_self, _args)
4625 PyObject *_self;
4626 PyObject *_args;
4627{
4628 PyObject *_res = NULL;
4629 CGrafPtr _rv;
4630 if (!PyArg_ParseTuple(_args, ""))
4631 return NULL;
4632 _rv = GetQDGlobalsThePort();
4633 _res = Py_BuildValue("O&",
4634 GrafObj_New, _rv);
4635 return _res;
4636}
4637
4638static PyObject *Qd_SetQDGlobalsRandomSeed(_self, _args)
4639 PyObject *_self;
4640 PyObject *_args;
4641{
4642 PyObject *_res = NULL;
4643 long randomSeed;
4644 if (!PyArg_ParseTuple(_args, "l",
4645 &randomSeed))
4646 return NULL;
4647 SetQDGlobalsRandomSeed(randomSeed);
4648 Py_INCREF(Py_None);
4649 _res = Py_None;
4650 return _res;
4651}
4652
4653static PyObject *Qd_SetQDGlobalsArrow(_self, _args)
4654 PyObject *_self;
4655 PyObject *_args;
4656{
4657 PyObject *_res = NULL;
4658 Cursor *arrow__in__;
4659 int arrow__in_len__;
4660 if (!PyArg_ParseTuple(_args, "s#",
4661 (char **)&arrow__in__, &arrow__in_len__))
4662 return NULL;
4663 if (arrow__in_len__ != sizeof(Cursor))
4664 {
4665 PyErr_SetString(PyExc_TypeError, "buffer length should be sizeof(Cursor)");
4666 goto arrow__error__;
4667 }
4668 SetQDGlobalsArrow(arrow__in__);
4669 Py_INCREF(Py_None);
4670 _res = Py_None;
4671 arrow__error__: ;
4672 return _res;
4673}
4674
4675static PyObject *Qd_GetRegionBounds(_self, _args)
4676 PyObject *_self;
4677 PyObject *_args;
4678{
4679 PyObject *_res = NULL;
4680 RgnHandle region;
4681 Rect bounds;
4682 if (!PyArg_ParseTuple(_args, "O&",
4683 ResObj_Convert, &region))
4684 return NULL;
4685 GetRegionBounds(region,
4686 &bounds);
4687 _res = Py_BuildValue("O&",
4688 PyMac_BuildRect, &bounds);
4689 return _res;
4690}
4691
4692#if TARGET_API_MAC_CARBON
4693
4694static PyObject *Qd_IsRegionRectangular(_self, _args)
4695 PyObject *_self;
4696 PyObject *_args;
4697{
4698 PyObject *_res = NULL;
4699 Boolean _rv;
4700 RgnHandle region;
4701 if (!PyArg_ParseTuple(_args, "O&",
4702 ResObj_Convert, &region))
4703 return NULL;
4704 _rv = IsRegionRectangular(region);
4705 _res = Py_BuildValue("b",
4706 _rv);
4707 return _res;
4708}
4709#endif
4710
4711#if TARGET_API_MAC_CARBON
4712
4713static PyObject *Qd_CreateNewPort(_self, _args)
4714 PyObject *_self;
4715 PyObject *_args;
4716{
4717 PyObject *_res = NULL;
4718 CGrafPtr _rv;
4719 if (!PyArg_ParseTuple(_args, ""))
4720 return NULL;
4721 _rv = CreateNewPort();
4722 _res = Py_BuildValue("O&",
4723 GrafObj_New, _rv);
4724 return _res;
4725}
4726#endif
4727
4728#if TARGET_API_MAC_CARBON
4729
4730static PyObject *Qd_DisposePort(_self, _args)
4731 PyObject *_self;
4732 PyObject *_args;
4733{
4734 PyObject *_res = NULL;
4735 CGrafPtr port;
4736 if (!PyArg_ParseTuple(_args, "O&",
4737 GrafObj_Convert, &port))
4738 return NULL;
4739 DisposePort(port);
4740 Py_INCREF(Py_None);
4741 _res = Py_None;
4742 return _res;
4743}
4744#endif
4745
4746#if TARGET_API_MAC_CARBON
4747
4748static PyObject *Qd_SetQDError(_self, _args)
4749 PyObject *_self;
4750 PyObject *_args;
4751{
4752 PyObject *_res = NULL;
4753 OSErr err;
4754 if (!PyArg_ParseTuple(_args, "h",
4755 &err))
4756 return NULL;
4757 SetQDError(err);
4758 Py_INCREF(Py_None);
4759 _res = Py_None;
4760 return _res;
4761}
4762#endif
4763
4764static PyObject *Qd_QDIsPortBuffered(_self, _args)
4765 PyObject *_self;
4766 PyObject *_args;
4767{
4768 PyObject *_res = NULL;
4769 Boolean _rv;
4770 CGrafPtr port;
4771 if (!PyArg_ParseTuple(_args, "O&",
4772 GrafObj_Convert, &port))
4773 return NULL;
4774 _rv = QDIsPortBuffered(port);
4775 _res = Py_BuildValue("b",
4776 _rv);
4777 return _res;
4778}
4779
4780static PyObject *Qd_QDIsPortBufferDirty(_self, _args)
4781 PyObject *_self;
4782 PyObject *_args;
4783{
4784 PyObject *_res = NULL;
4785 Boolean _rv;
4786 CGrafPtr port;
4787 if (!PyArg_ParseTuple(_args, "O&",
4788 GrafObj_Convert, &port))
4789 return NULL;
4790 _rv = QDIsPortBufferDirty(port);
4791 _res = Py_BuildValue("b",
4792 _rv);
4793 return _res;
4794}
4795
4796static PyObject *Qd_QDFlushPortBuffer(_self, _args)
4797 PyObject *_self;
4798 PyObject *_args;
4799{
4800 PyObject *_res = NULL;
4801 CGrafPtr port;
4802 RgnHandle region;
4803 if (!PyArg_ParseTuple(_args, "O&O&",
4804 GrafObj_Convert, &port,
4805 ResObj_Convert, &region))
4806 return NULL;
4807 QDFlushPortBuffer(port,
4808 region);
4809 Py_INCREF(Py_None);
4810 _res = Py_None;
4811 return _res;
4812}
4813
Jack Jansenb81cf9d1995-06-06 13:08:40 +00004814static PyObject *Qd_TextFont(_self, _args)
4815 PyObject *_self;
4816 PyObject *_args;
4817{
4818 PyObject *_res = NULL;
4819 short font;
4820 if (!PyArg_ParseTuple(_args, "h",
4821 &font))
4822 return NULL;
4823 TextFont(font);
4824 Py_INCREF(Py_None);
4825 _res = Py_None;
4826 return _res;
4827}
4828
4829static PyObject *Qd_TextFace(_self, _args)
4830 PyObject *_self;
4831 PyObject *_args;
4832{
4833 PyObject *_res = NULL;
Jack Jansene742a821998-02-25 15:46:50 +00004834 StyleParameter face;
Jack Jansenb81cf9d1995-06-06 13:08:40 +00004835 if (!PyArg_ParseTuple(_args, "h",
4836 &face))
4837 return NULL;
4838 TextFace(face);
4839 Py_INCREF(Py_None);
4840 _res = Py_None;
4841 return _res;
4842}
4843
4844static PyObject *Qd_TextMode(_self, _args)
4845 PyObject *_self;
4846 PyObject *_args;
4847{
4848 PyObject *_res = NULL;
4849 short mode;
4850 if (!PyArg_ParseTuple(_args, "h",
4851 &mode))
4852 return NULL;
4853 TextMode(mode);
4854 Py_INCREF(Py_None);
4855 _res = Py_None;
4856 return _res;
4857}
4858
4859static PyObject *Qd_TextSize(_self, _args)
4860 PyObject *_self;
4861 PyObject *_args;
4862{
4863 PyObject *_res = NULL;
4864 short size;
4865 if (!PyArg_ParseTuple(_args, "h",
4866 &size))
4867 return NULL;
4868 TextSize(size);
4869 Py_INCREF(Py_None);
4870 _res = Py_None;
4871 return _res;
4872}
4873
4874static PyObject *Qd_SpaceExtra(_self, _args)
4875 PyObject *_self;
4876 PyObject *_args;
4877{
4878 PyObject *_res = NULL;
Jack Jansen330381c1995-11-15 15:18:01 +00004879 Fixed extra;
4880 if (!PyArg_ParseTuple(_args, "O&",
4881 PyMac_GetFixed, &extra))
Jack Jansenb81cf9d1995-06-06 13:08:40 +00004882 return NULL;
4883 SpaceExtra(extra);
4884 Py_INCREF(Py_None);
4885 _res = Py_None;
4886 return _res;
4887}
4888
4889static PyObject *Qd_DrawChar(_self, _args)
4890 PyObject *_self;
4891 PyObject *_args;
4892{
4893 PyObject *_res = NULL;
Jack Jansen21f96871998-02-20 16:02:09 +00004894 CharParameter ch;
Jack Jansene742a821998-02-25 15:46:50 +00004895 if (!PyArg_ParseTuple(_args, "h",
Jack Jansenb81cf9d1995-06-06 13:08:40 +00004896 &ch))
4897 return NULL;
4898 DrawChar(ch);
4899 Py_INCREF(Py_None);
4900 _res = Py_None;
4901 return _res;
4902}
4903
4904static PyObject *Qd_DrawString(_self, _args)
4905 PyObject *_self;
4906 PyObject *_args;
4907{
4908 PyObject *_res = NULL;
4909 Str255 s;
4910 if (!PyArg_ParseTuple(_args, "O&",
4911 PyMac_GetStr255, s))
4912 return NULL;
4913 DrawString(s);
4914 Py_INCREF(Py_None);
4915 _res = Py_None;
4916 return _res;
4917}
4918
Jack Jansen1c4e6141998-04-21 15:23:55 +00004919static PyObject *Qd_MacDrawText(_self, _args)
Jack Jansenb81cf9d1995-06-06 13:08:40 +00004920 PyObject *_self;
4921 PyObject *_args;
4922{
4923 PyObject *_res = NULL;
4924 char *textBuf__in__;
4925 int textBuf__len__;
4926 int textBuf__in_len__;
4927 short firstByte;
4928 short byteCount;
4929 if (!PyArg_ParseTuple(_args, "s#hh",
4930 &textBuf__in__, &textBuf__in_len__,
4931 &firstByte,
4932 &byteCount))
4933 return NULL;
Jack Jansen1c4e6141998-04-21 15:23:55 +00004934 MacDrawText(textBuf__in__,
4935 firstByte,
4936 byteCount);
Jack Jansenb81cf9d1995-06-06 13:08:40 +00004937 Py_INCREF(Py_None);
4938 _res = Py_None;
4939 textBuf__error__: ;
4940 return _res;
4941}
4942
4943static PyObject *Qd_CharWidth(_self, _args)
4944 PyObject *_self;
4945 PyObject *_args;
4946{
4947 PyObject *_res = NULL;
4948 short _rv;
Jack Jansen21f96871998-02-20 16:02:09 +00004949 CharParameter ch;
Jack Jansene742a821998-02-25 15:46:50 +00004950 if (!PyArg_ParseTuple(_args, "h",
Jack Jansenb81cf9d1995-06-06 13:08:40 +00004951 &ch))
4952 return NULL;
4953 _rv = CharWidth(ch);
4954 _res = Py_BuildValue("h",
4955 _rv);
4956 return _res;
4957}
4958
4959static PyObject *Qd_StringWidth(_self, _args)
4960 PyObject *_self;
4961 PyObject *_args;
4962{
4963 PyObject *_res = NULL;
4964 short _rv;
4965 Str255 s;
4966 if (!PyArg_ParseTuple(_args, "O&",
4967 PyMac_GetStr255, s))
4968 return NULL;
4969 _rv = StringWidth(s);
4970 _res = Py_BuildValue("h",
4971 _rv);
4972 return _res;
4973}
4974
4975static PyObject *Qd_TextWidth(_self, _args)
4976 PyObject *_self;
4977 PyObject *_args;
4978{
4979 PyObject *_res = NULL;
4980 short _rv;
4981 char *textBuf__in__;
4982 int textBuf__len__;
4983 int textBuf__in_len__;
4984 short firstByte;
4985 short byteCount;
4986 if (!PyArg_ParseTuple(_args, "s#hh",
4987 &textBuf__in__, &textBuf__in_len__,
4988 &firstByte,
4989 &byteCount))
4990 return NULL;
4991 _rv = TextWidth(textBuf__in__,
4992 firstByte,
4993 byteCount);
4994 _res = Py_BuildValue("h",
4995 _rv);
4996 textBuf__error__: ;
4997 return _res;
4998}
4999
Jack Jansen3a50f8a1996-01-11 16:17:14 +00005000static PyObject *Qd_GetFontInfo(_self, _args)
5001 PyObject *_self;
5002 PyObject *_args;
5003{
5004 PyObject *_res = NULL;
5005 FontInfo info;
5006 if (!PyArg_ParseTuple(_args, ""))
5007 return NULL;
5008 GetFontInfo(&info);
5009 _res = Py_BuildValue("O&",
5010 QdFI_New, &info);
5011 return _res;
5012}
5013
Jack Jansenb81cf9d1995-06-06 13:08:40 +00005014static PyObject *Qd_CharExtra(_self, _args)
5015 PyObject *_self;
5016 PyObject *_args;
5017{
5018 PyObject *_res = NULL;
Jack Jansen330381c1995-11-15 15:18:01 +00005019 Fixed extra;
5020 if (!PyArg_ParseTuple(_args, "O&",
5021 PyMac_GetFixed, &extra))
Jack Jansenb81cf9d1995-06-06 13:08:40 +00005022 return NULL;
5023 CharExtra(extra);
5024 Py_INCREF(Py_None);
5025 _res = Py_None;
5026 return _res;
5027}
5028
Jack Jansen7f725e41998-04-23 13:21:09 +00005029static PyObject *Qd_SetPort(_self, _args)
5030 PyObject *_self;
5031 PyObject *_args;
5032{
5033 PyObject *_res = NULL;
Jack Jansen29bfea91998-04-27 15:09:36 +00005034 GrafPtr thePort;
Jack Jansen7f725e41998-04-23 13:21:09 +00005035 if (!PyArg_ParseTuple(_args, "O&",
Jack Jansen29bfea91998-04-27 15:09:36 +00005036 GrafObj_Convert, &thePort))
Jack Jansen7f725e41998-04-23 13:21:09 +00005037 return NULL;
5038 SetPort(thePort);
5039 Py_INCREF(Py_None);
5040 _res = Py_None;
5041 return _res;
5042}
5043
Jack Jansene180d991998-04-24 10:28:20 +00005044static PyObject *Qd_GetCursor(_self, _args)
Jack Jansen7f725e41998-04-23 13:21:09 +00005045 PyObject *_self;
5046 PyObject *_args;
5047{
5048 PyObject *_res = NULL;
Jack Jansene180d991998-04-24 10:28:20 +00005049 CursHandle _rv;
5050 short cursorID;
5051 if (!PyArg_ParseTuple(_args, "h",
5052 &cursorID))
Jack Jansen7f725e41998-04-23 13:21:09 +00005053 return NULL;
Jack Jansene180d991998-04-24 10:28:20 +00005054 _rv = GetCursor(cursorID);
5055 _res = Py_BuildValue("O&",
5056 ResObj_New, _rv);
5057 return _res;
5058}
5059
5060static PyObject *Qd_SetCursor(_self, _args)
5061 PyObject *_self;
5062 PyObject *_args;
5063{
5064 PyObject *_res = NULL;
5065 Cursor *crsr__in__;
5066 int crsr__in_len__;
5067 if (!PyArg_ParseTuple(_args, "s#",
5068 (char **)&crsr__in__, &crsr__in_len__))
5069 return NULL;
5070 if (crsr__in_len__ != sizeof(Cursor))
5071 {
5072 PyErr_SetString(PyExc_TypeError, "buffer length should be sizeof(Cursor)");
5073 goto crsr__error__;
5074 }
5075 SetCursor(crsr__in__);
Jack Jansen7f725e41998-04-23 13:21:09 +00005076 Py_INCREF(Py_None);
5077 _res = Py_None;
Jack Jansene180d991998-04-24 10:28:20 +00005078 crsr__error__: ;
5079 return _res;
5080}
5081
5082static PyObject *Qd_ShowCursor(_self, _args)
5083 PyObject *_self;
5084 PyObject *_args;
5085{
5086 PyObject *_res = NULL;
5087 if (!PyArg_ParseTuple(_args, ""))
5088 return NULL;
5089 ShowCursor();
5090 Py_INCREF(Py_None);
5091 _res = Py_None;
5092 return _res;
5093}
5094
5095static PyObject *Qd_LineTo(_self, _args)
5096 PyObject *_self;
5097 PyObject *_args;
5098{
5099 PyObject *_res = NULL;
5100 short h;
5101 short v;
5102 if (!PyArg_ParseTuple(_args, "hh",
5103 &h,
5104 &v))
5105 return NULL;
5106 LineTo(h,
5107 v);
5108 Py_INCREF(Py_None);
5109 _res = Py_None;
5110 return _res;
5111}
5112
5113static PyObject *Qd_SetRect(_self, _args)
5114 PyObject *_self;
5115 PyObject *_args;
5116{
5117 PyObject *_res = NULL;
5118 Rect r;
5119 short left;
5120 short top;
5121 short right;
5122 short bottom;
5123 if (!PyArg_ParseTuple(_args, "hhhh",
5124 &left,
5125 &top,
5126 &right,
5127 &bottom))
5128 return NULL;
5129 SetRect(&r,
5130 left,
5131 top,
5132 right,
5133 bottom);
5134 _res = Py_BuildValue("O&",
5135 PyMac_BuildRect, &r);
5136 return _res;
5137}
5138
5139static PyObject *Qd_OffsetRect(_self, _args)
5140 PyObject *_self;
5141 PyObject *_args;
5142{
5143 PyObject *_res = NULL;
5144 Rect r;
5145 short dh;
5146 short dv;
5147 if (!PyArg_ParseTuple(_args, "O&hh",
5148 PyMac_GetRect, &r,
5149 &dh,
5150 &dv))
5151 return NULL;
5152 OffsetRect(&r,
5153 dh,
5154 dv);
5155 _res = Py_BuildValue("O&",
5156 PyMac_BuildRect, &r);
5157 return _res;
5158}
5159
5160static PyObject *Qd_InsetRect(_self, _args)
5161 PyObject *_self;
5162 PyObject *_args;
5163{
5164 PyObject *_res = NULL;
5165 Rect r;
5166 short dh;
5167 short dv;
5168 if (!PyArg_ParseTuple(_args, "O&hh",
5169 PyMac_GetRect, &r,
5170 &dh,
5171 &dv))
5172 return NULL;
5173 InsetRect(&r,
5174 dh,
5175 dv);
5176 _res = Py_BuildValue("O&",
5177 PyMac_BuildRect, &r);
5178 return _res;
5179}
5180
5181static PyObject *Qd_UnionRect(_self, _args)
5182 PyObject *_self;
5183 PyObject *_args;
5184{
5185 PyObject *_res = NULL;
5186 Rect src1;
5187 Rect src2;
5188 Rect dstRect;
5189 if (!PyArg_ParseTuple(_args, "O&O&",
5190 PyMac_GetRect, &src1,
5191 PyMac_GetRect, &src2))
5192 return NULL;
5193 UnionRect(&src1,
5194 &src2,
5195 &dstRect);
5196 _res = Py_BuildValue("O&",
5197 PyMac_BuildRect, &dstRect);
5198 return _res;
5199}
5200
5201static PyObject *Qd_EqualRect(_self, _args)
5202 PyObject *_self;
5203 PyObject *_args;
5204{
5205 PyObject *_res = NULL;
5206 Boolean _rv;
5207 Rect rect1;
5208 Rect rect2;
5209 if (!PyArg_ParseTuple(_args, "O&O&",
5210 PyMac_GetRect, &rect1,
5211 PyMac_GetRect, &rect2))
5212 return NULL;
5213 _rv = EqualRect(&rect1,
5214 &rect2);
5215 _res = Py_BuildValue("b",
5216 _rv);
5217 return _res;
5218}
5219
5220static PyObject *Qd_FrameRect(_self, _args)
5221 PyObject *_self;
5222 PyObject *_args;
5223{
5224 PyObject *_res = NULL;
5225 Rect r;
5226 if (!PyArg_ParseTuple(_args, "O&",
5227 PyMac_GetRect, &r))
5228 return NULL;
5229 FrameRect(&r);
5230 Py_INCREF(Py_None);
5231 _res = Py_None;
5232 return _res;
5233}
5234
5235static PyObject *Qd_InvertRect(_self, _args)
5236 PyObject *_self;
5237 PyObject *_args;
5238{
5239 PyObject *_res = NULL;
5240 Rect r;
5241 if (!PyArg_ParseTuple(_args, "O&",
5242 PyMac_GetRect, &r))
5243 return NULL;
5244 InvertRect(&r);
5245 Py_INCREF(Py_None);
5246 _res = Py_None;
5247 return _res;
5248}
5249
5250static PyObject *Qd_FillRect(_self, _args)
5251 PyObject *_self;
5252 PyObject *_args;
5253{
5254 PyObject *_res = NULL;
5255 Rect r;
5256 Pattern *pat__in__;
5257 int pat__in_len__;
5258 if (!PyArg_ParseTuple(_args, "O&s#",
5259 PyMac_GetRect, &r,
5260 (char **)&pat__in__, &pat__in_len__))
5261 return NULL;
5262 if (pat__in_len__ != sizeof(Pattern))
5263 {
5264 PyErr_SetString(PyExc_TypeError, "buffer length should be sizeof(Pattern)");
5265 goto pat__error__;
5266 }
5267 FillRect(&r,
5268 pat__in__);
5269 Py_INCREF(Py_None);
5270 _res = Py_None;
5271 pat__error__: ;
5272 return _res;
5273}
5274
5275static PyObject *Qd_CopyRgn(_self, _args)
5276 PyObject *_self;
5277 PyObject *_args;
5278{
5279 PyObject *_res = NULL;
5280 RgnHandle srcRgn;
5281 RgnHandle dstRgn;
5282 if (!PyArg_ParseTuple(_args, "O&O&",
5283 ResObj_Convert, &srcRgn,
5284 ResObj_Convert, &dstRgn))
5285 return NULL;
5286 CopyRgn(srcRgn,
5287 dstRgn);
5288 Py_INCREF(Py_None);
5289 _res = Py_None;
5290 return _res;
5291}
5292
5293static PyObject *Qd_SetRectRgn(_self, _args)
5294 PyObject *_self;
5295 PyObject *_args;
5296{
5297 PyObject *_res = NULL;
5298 RgnHandle rgn;
5299 short left;
5300 short top;
5301 short right;
5302 short bottom;
5303 if (!PyArg_ParseTuple(_args, "O&hhhh",
5304 ResObj_Convert, &rgn,
5305 &left,
5306 &top,
5307 &right,
5308 &bottom))
5309 return NULL;
5310 SetRectRgn(rgn,
5311 left,
5312 top,
5313 right,
5314 bottom);
5315 Py_INCREF(Py_None);
5316 _res = Py_None;
5317 return _res;
5318}
5319
5320static PyObject *Qd_OffsetRgn(_self, _args)
5321 PyObject *_self;
5322 PyObject *_args;
5323{
5324 PyObject *_res = NULL;
5325 RgnHandle rgn;
5326 short dh;
5327 short dv;
5328 if (!PyArg_ParseTuple(_args, "O&hh",
5329 ResObj_Convert, &rgn,
5330 &dh,
5331 &dv))
5332 return NULL;
5333 OffsetRgn(rgn,
5334 dh,
5335 dv);
5336 Py_INCREF(Py_None);
5337 _res = Py_None;
5338 return _res;
5339}
5340
5341static PyObject *Qd_UnionRgn(_self, _args)
5342 PyObject *_self;
5343 PyObject *_args;
5344{
5345 PyObject *_res = NULL;
5346 RgnHandle srcRgnA;
5347 RgnHandle srcRgnB;
5348 RgnHandle dstRgn;
5349 if (!PyArg_ParseTuple(_args, "O&O&O&",
5350 ResObj_Convert, &srcRgnA,
5351 ResObj_Convert, &srcRgnB,
5352 ResObj_Convert, &dstRgn))
5353 return NULL;
5354 UnionRgn(srcRgnA,
5355 srcRgnB,
5356 dstRgn);
5357 Py_INCREF(Py_None);
5358 _res = Py_None;
5359 return _res;
5360}
5361
5362static PyObject *Qd_XorRgn(_self, _args)
5363 PyObject *_self;
5364 PyObject *_args;
5365{
5366 PyObject *_res = NULL;
5367 RgnHandle srcRgnA;
5368 RgnHandle srcRgnB;
5369 RgnHandle dstRgn;
5370 if (!PyArg_ParseTuple(_args, "O&O&O&",
5371 ResObj_Convert, &srcRgnA,
5372 ResObj_Convert, &srcRgnB,
5373 ResObj_Convert, &dstRgn))
5374 return NULL;
5375 XorRgn(srcRgnA,
5376 srcRgnB,
5377 dstRgn);
5378 Py_INCREF(Py_None);
5379 _res = Py_None;
5380 return _res;
5381}
5382
5383static PyObject *Qd_EqualRgn(_self, _args)
5384 PyObject *_self;
5385 PyObject *_args;
5386{
5387 PyObject *_res = NULL;
5388 Boolean _rv;
5389 RgnHandle rgnA;
5390 RgnHandle rgnB;
5391 if (!PyArg_ParseTuple(_args, "O&O&",
5392 ResObj_Convert, &rgnA,
5393 ResObj_Convert, &rgnB))
5394 return NULL;
5395 _rv = EqualRgn(rgnA,
5396 rgnB);
5397 _res = Py_BuildValue("b",
5398 _rv);
5399 return _res;
5400}
5401
5402static PyObject *Qd_FrameRgn(_self, _args)
5403 PyObject *_self;
5404 PyObject *_args;
5405{
5406 PyObject *_res = NULL;
5407 RgnHandle rgn;
5408 if (!PyArg_ParseTuple(_args, "O&",
5409 ResObj_Convert, &rgn))
5410 return NULL;
5411 FrameRgn(rgn);
5412 Py_INCREF(Py_None);
5413 _res = Py_None;
5414 return _res;
5415}
5416
5417static PyObject *Qd_PaintRgn(_self, _args)
5418 PyObject *_self;
5419 PyObject *_args;
5420{
5421 PyObject *_res = NULL;
5422 RgnHandle rgn;
5423 if (!PyArg_ParseTuple(_args, "O&",
5424 ResObj_Convert, &rgn))
5425 return NULL;
5426 PaintRgn(rgn);
5427 Py_INCREF(Py_None);
5428 _res = Py_None;
5429 return _res;
5430}
5431
5432static PyObject *Qd_InvertRgn(_self, _args)
5433 PyObject *_self;
5434 PyObject *_args;
5435{
5436 PyObject *_res = NULL;
5437 RgnHandle rgn;
5438 if (!PyArg_ParseTuple(_args, "O&",
5439 ResObj_Convert, &rgn))
5440 return NULL;
5441 InvertRgn(rgn);
5442 Py_INCREF(Py_None);
5443 _res = Py_None;
5444 return _res;
5445}
5446
5447static PyObject *Qd_FillRgn(_self, _args)
5448 PyObject *_self;
5449 PyObject *_args;
5450{
5451 PyObject *_res = NULL;
5452 RgnHandle rgn;
5453 Pattern *pat__in__;
5454 int pat__in_len__;
5455 if (!PyArg_ParseTuple(_args, "O&s#",
5456 ResObj_Convert, &rgn,
5457 (char **)&pat__in__, &pat__in_len__))
5458 return NULL;
5459 if (pat__in_len__ != sizeof(Pattern))
5460 {
5461 PyErr_SetString(PyExc_TypeError, "buffer length should be sizeof(Pattern)");
5462 goto pat__error__;
5463 }
5464 FillRgn(rgn,
5465 pat__in__);
5466 Py_INCREF(Py_None);
5467 _res = Py_None;
5468 pat__error__: ;
5469 return _res;
5470}
5471
5472static PyObject *Qd_GetPixel(_self, _args)
5473 PyObject *_self;
5474 PyObject *_args;
5475{
5476 PyObject *_res = NULL;
5477 Boolean _rv;
5478 short h;
5479 short v;
5480 if (!PyArg_ParseTuple(_args, "hh",
5481 &h,
5482 &v))
5483 return NULL;
5484 _rv = GetPixel(h,
5485 v);
5486 _res = Py_BuildValue("b",
5487 _rv);
5488 return _res;
5489}
5490
5491static PyObject *Qd_PtInRect(_self, _args)
5492 PyObject *_self;
5493 PyObject *_args;
5494{
5495 PyObject *_res = NULL;
5496 Boolean _rv;
5497 Point pt;
5498 Rect r;
5499 if (!PyArg_ParseTuple(_args, "O&O&",
5500 PyMac_GetPoint, &pt,
5501 PyMac_GetRect, &r))
5502 return NULL;
5503 _rv = PtInRect(pt,
5504 &r);
5505 _res = Py_BuildValue("b",
5506 _rv);
5507 return _res;
5508}
5509
5510static PyObject *Qd_DrawText(_self, _args)
5511 PyObject *_self;
5512 PyObject *_args;
5513{
5514 PyObject *_res = NULL;
5515 char *textBuf__in__;
5516 int textBuf__len__;
5517 int textBuf__in_len__;
5518 short firstByte;
5519 short byteCount;
5520 if (!PyArg_ParseTuple(_args, "s#hh",
5521 &textBuf__in__, &textBuf__in_len__,
5522 &firstByte,
5523 &byteCount))
5524 return NULL;
5525 DrawText(textBuf__in__,
5526 firstByte,
5527 byteCount);
5528 Py_INCREF(Py_None);
5529 _res = Py_None;
5530 textBuf__error__: ;
Jack Jansen7f725e41998-04-23 13:21:09 +00005531 return _res;
5532}
5533
Jack Jansen41058c01995-11-16 22:48:29 +00005534static PyObject *Qd_BitMap(_self, _args)
5535 PyObject *_self;
5536 PyObject *_args;
5537{
5538 PyObject *_res = NULL;
5539
5540 BitMap *ptr;
5541 PyObject *source;
5542 Rect bounds;
5543 int rowbytes;
5544 char *data;
5545
5546 if ( !PyArg_ParseTuple(_args, "O!iO&", &PyString_Type, &source, &rowbytes, PyMac_GetRect,
5547 &bounds) )
5548 return NULL;
5549 data = PyString_AsString(source);
5550 if ((ptr=(BitMap *)malloc(sizeof(BitMap))) == NULL )
5551 return PyErr_NoMemory();
5552 ptr->baseAddr = (Ptr)data;
5553 ptr->rowBytes = rowbytes;
5554 ptr->bounds = bounds;
5555 if ( (_res = BMObj_New(ptr)) == NULL ) {
5556 free(ptr);
5557 return NULL;
5558 }
5559 ((BitMapObject *)_res)->referred_object = source;
5560 Py_INCREF(source);
5561 ((BitMapObject *)_res)->referred_bitmap = ptr;
5562 return _res;
5563
5564}
5565
Jack Jansen425e9eb1995-12-12 15:02:03 +00005566static PyObject *Qd_RawBitMap(_self, _args)
5567 PyObject *_self;
5568 PyObject *_args;
5569{
5570 PyObject *_res = NULL;
5571
5572 BitMap *ptr;
5573 PyObject *source;
5574
5575 if ( !PyArg_ParseTuple(_args, "O!", &PyString_Type, &source) )
5576 return NULL;
5577 if ( PyString_Size(source) != sizeof(BitMap) && PyString_Size(source) != sizeof(PixMap) ) {
5578 PyErr_BadArgument();
5579 return NULL;
5580 }
5581 ptr = (BitMapPtr)PyString_AsString(source);
5582 if ( (_res = BMObj_New(ptr)) == NULL ) {
5583 return NULL;
5584 }
5585 ((BitMapObject *)_res)->referred_object = source;
5586 Py_INCREF(source);
5587 return _res;
5588
5589}
5590
Guido van Rossum17448e21995-01-30 11:53:55 +00005591static PyMethodDef Qd_methods[] = {
Jack Jansen1c4e6141998-04-21 15:23:55 +00005592 {"MacSetPort", (PyCFunction)Qd_MacSetPort, 1,
Jack Jansen330381c1995-11-15 15:18:01 +00005593 "(GrafPtr port) -> None"},
Guido van Rossume56db431995-03-19 22:49:50 +00005594 {"GetPort", (PyCFunction)Qd_GetPort, 1,
Jack Jansen330381c1995-11-15 15:18:01 +00005595 "() -> (GrafPtr port)"},
Guido van Rossume56db431995-03-19 22:49:50 +00005596 {"GrafDevice", (PyCFunction)Qd_GrafDevice, 1,
5597 "(short device) -> None"},
Jack Jansen41058c01995-11-16 22:48:29 +00005598 {"SetPortBits", (PyCFunction)Qd_SetPortBits, 1,
5599 "(BitMapPtr bm) -> None"},
Guido van Rossume56db431995-03-19 22:49:50 +00005600 {"PortSize", (PyCFunction)Qd_PortSize, 1,
5601 "(short width, short height) -> None"},
5602 {"MovePortTo", (PyCFunction)Qd_MovePortTo, 1,
5603 "(short leftGlobal, short topGlobal) -> None"},
5604 {"SetOrigin", (PyCFunction)Qd_SetOrigin, 1,
5605 "(short h, short v) -> None"},
5606 {"SetClip", (PyCFunction)Qd_SetClip, 1,
5607 "(RgnHandle rgn) -> None"},
5608 {"GetClip", (PyCFunction)Qd_GetClip, 1,
5609 "(RgnHandle rgn) -> None"},
Guido van Rossum17448e21995-01-30 11:53:55 +00005610 {"ClipRect", (PyCFunction)Qd_ClipRect, 1,
5611 "(Rect r) -> None"},
Jack Jansen04a02e71996-01-06 17:12:58 +00005612 {"BackPat", (PyCFunction)Qd_BackPat, 1,
5613 "(Pattern pat) -> None"},
Guido van Rossume56db431995-03-19 22:49:50 +00005614 {"InitCursor", (PyCFunction)Qd_InitCursor, 1,
5615 "() -> None"},
Jack Jansen1c4e6141998-04-21 15:23:55 +00005616 {"MacSetCursor", (PyCFunction)Qd_MacSetCursor, 1,
Jack Jansenb5394061996-01-05 18:06:41 +00005617 "(Cursor crsr) -> None"},
Guido van Rossume56db431995-03-19 22:49:50 +00005618 {"HideCursor", (PyCFunction)Qd_HideCursor, 1,
5619 "() -> None"},
Jack Jansen1c4e6141998-04-21 15:23:55 +00005620 {"MacShowCursor", (PyCFunction)Qd_MacShowCursor, 1,
Guido van Rossume56db431995-03-19 22:49:50 +00005621 "() -> None"},
5622 {"ObscureCursor", (PyCFunction)Qd_ObscureCursor, 1,
5623 "() -> None"},
5624 {"HidePen", (PyCFunction)Qd_HidePen, 1,
5625 "() -> None"},
5626 {"ShowPen", (PyCFunction)Qd_ShowPen, 1,
5627 "() -> None"},
5628 {"GetPen", (PyCFunction)Qd_GetPen, 1,
Jack Jansen1d8ede71996-01-08 23:47:31 +00005629 "() -> (Point pt)"},
Jack Jansen04a02e71996-01-06 17:12:58 +00005630 {"GetPenState", (PyCFunction)Qd_GetPenState, 1,
5631 "() -> (PenState pnState)"},
5632 {"SetPenState", (PyCFunction)Qd_SetPenState, 1,
5633 "(PenState pnState) -> None"},
Guido van Rossume56db431995-03-19 22:49:50 +00005634 {"PenSize", (PyCFunction)Qd_PenSize, 1,
5635 "(short width, short height) -> None"},
5636 {"PenMode", (PyCFunction)Qd_PenMode, 1,
5637 "(short mode) -> None"},
Jack Jansen04a02e71996-01-06 17:12:58 +00005638 {"PenPat", (PyCFunction)Qd_PenPat, 1,
5639 "(Pattern pat) -> None"},
Guido van Rossume56db431995-03-19 22:49:50 +00005640 {"PenNormal", (PyCFunction)Qd_PenNormal, 1,
5641 "() -> None"},
5642 {"MoveTo", (PyCFunction)Qd_MoveTo, 1,
5643 "(short h, short v) -> None"},
5644 {"Move", (PyCFunction)Qd_Move, 1,
5645 "(short dh, short dv) -> None"},
Jack Jansen1c4e6141998-04-21 15:23:55 +00005646 {"MacLineTo", (PyCFunction)Qd_MacLineTo, 1,
Guido van Rossume56db431995-03-19 22:49:50 +00005647 "(short h, short v) -> None"},
5648 {"Line", (PyCFunction)Qd_Line, 1,
5649 "(short dh, short dv) -> None"},
Guido van Rossume56db431995-03-19 22:49:50 +00005650 {"ForeColor", (PyCFunction)Qd_ForeColor, 1,
5651 "(long color) -> None"},
5652 {"BackColor", (PyCFunction)Qd_BackColor, 1,
5653 "(long color) -> None"},
5654 {"ColorBit", (PyCFunction)Qd_ColorBit, 1,
5655 "(short whichBit) -> None"},
Jack Jansen1c4e6141998-04-21 15:23:55 +00005656 {"MacSetRect", (PyCFunction)Qd_MacSetRect, 1,
Guido van Rossume56db431995-03-19 22:49:50 +00005657 "(short left, short top, short right, short bottom) -> (Rect r)"},
Jack Jansen1c4e6141998-04-21 15:23:55 +00005658 {"MacOffsetRect", (PyCFunction)Qd_MacOffsetRect, 1,
Jack Jansen54c8f7e1995-11-14 10:46:01 +00005659 "(Rect r, short dh, short dv) -> (Rect r)"},
Jack Jansen1c4e6141998-04-21 15:23:55 +00005660 {"MacInsetRect", (PyCFunction)Qd_MacInsetRect, 1,
Jack Jansen54c8f7e1995-11-14 10:46:01 +00005661 "(Rect r, short dh, short dv) -> (Rect r)"},
Guido van Rossume56db431995-03-19 22:49:50 +00005662 {"SectRect", (PyCFunction)Qd_SectRect, 1,
5663 "(Rect src1, Rect src2) -> (Boolean _rv, Rect dstRect)"},
Jack Jansen1c4e6141998-04-21 15:23:55 +00005664 {"MacUnionRect", (PyCFunction)Qd_MacUnionRect, 1,
Guido van Rossume56db431995-03-19 22:49:50 +00005665 "(Rect src1, Rect src2) -> (Rect dstRect)"},
Jack Jansen1c4e6141998-04-21 15:23:55 +00005666 {"MacEqualRect", (PyCFunction)Qd_MacEqualRect, 1,
Guido van Rossume56db431995-03-19 22:49:50 +00005667 "(Rect rect1, Rect rect2) -> (Boolean _rv)"},
5668 {"EmptyRect", (PyCFunction)Qd_EmptyRect, 1,
5669 "(Rect r) -> (Boolean _rv)"},
Jack Jansen1c4e6141998-04-21 15:23:55 +00005670 {"MacFrameRect", (PyCFunction)Qd_MacFrameRect, 1,
Guido van Rossume56db431995-03-19 22:49:50 +00005671 "(Rect r) -> None"},
5672 {"PaintRect", (PyCFunction)Qd_PaintRect, 1,
5673 "(Rect r) -> None"},
Guido van Rossum17448e21995-01-30 11:53:55 +00005674 {"EraseRect", (PyCFunction)Qd_EraseRect, 1,
5675 "(Rect r) -> None"},
Jack Jansen1c4e6141998-04-21 15:23:55 +00005676 {"MacInvertRect", (PyCFunction)Qd_MacInvertRect, 1,
Guido van Rossume56db431995-03-19 22:49:50 +00005677 "(Rect r) -> None"},
Jack Jansen1c4e6141998-04-21 15:23:55 +00005678 {"MacFillRect", (PyCFunction)Qd_MacFillRect, 1,
Jack Jansen04a02e71996-01-06 17:12:58 +00005679 "(Rect r, Pattern pat) -> None"},
Guido van Rossume56db431995-03-19 22:49:50 +00005680 {"FrameOval", (PyCFunction)Qd_FrameOval, 1,
5681 "(Rect r) -> None"},
5682 {"PaintOval", (PyCFunction)Qd_PaintOval, 1,
5683 "(Rect r) -> None"},
5684 {"EraseOval", (PyCFunction)Qd_EraseOval, 1,
5685 "(Rect r) -> None"},
5686 {"InvertOval", (PyCFunction)Qd_InvertOval, 1,
5687 "(Rect r) -> None"},
Jack Jansen04a02e71996-01-06 17:12:58 +00005688 {"FillOval", (PyCFunction)Qd_FillOval, 1,
5689 "(Rect r, Pattern pat) -> None"},
Guido van Rossume56db431995-03-19 22:49:50 +00005690 {"FrameRoundRect", (PyCFunction)Qd_FrameRoundRect, 1,
5691 "(Rect r, short ovalWidth, short ovalHeight) -> None"},
5692 {"PaintRoundRect", (PyCFunction)Qd_PaintRoundRect, 1,
5693 "(Rect r, short ovalWidth, short ovalHeight) -> None"},
5694 {"EraseRoundRect", (PyCFunction)Qd_EraseRoundRect, 1,
5695 "(Rect r, short ovalWidth, short ovalHeight) -> None"},
5696 {"InvertRoundRect", (PyCFunction)Qd_InvertRoundRect, 1,
5697 "(Rect r, short ovalWidth, short ovalHeight) -> None"},
Jack Jansen04a02e71996-01-06 17:12:58 +00005698 {"FillRoundRect", (PyCFunction)Qd_FillRoundRect, 1,
5699 "(Rect r, short ovalWidth, short ovalHeight, Pattern pat) -> None"},
Guido van Rossume56db431995-03-19 22:49:50 +00005700 {"FrameArc", (PyCFunction)Qd_FrameArc, 1,
5701 "(Rect r, short startAngle, short arcAngle) -> None"},
5702 {"PaintArc", (PyCFunction)Qd_PaintArc, 1,
5703 "(Rect r, short startAngle, short arcAngle) -> None"},
5704 {"EraseArc", (PyCFunction)Qd_EraseArc, 1,
5705 "(Rect r, short startAngle, short arcAngle) -> None"},
5706 {"InvertArc", (PyCFunction)Qd_InvertArc, 1,
5707 "(Rect r, short startAngle, short arcAngle) -> None"},
Jack Jansen04a02e71996-01-06 17:12:58 +00005708 {"FillArc", (PyCFunction)Qd_FillArc, 1,
5709 "(Rect r, short startAngle, short arcAngle, Pattern pat) -> None"},
Guido van Rossume56db431995-03-19 22:49:50 +00005710 {"NewRgn", (PyCFunction)Qd_NewRgn, 1,
5711 "() -> (RgnHandle _rv)"},
5712 {"OpenRgn", (PyCFunction)Qd_OpenRgn, 1,
5713 "() -> None"},
5714 {"CloseRgn", (PyCFunction)Qd_CloseRgn, 1,
5715 "(RgnHandle dstRgn) -> None"},
Jack Jansen41058c01995-11-16 22:48:29 +00005716 {"BitMapToRegion", (PyCFunction)Qd_BitMapToRegion, 1,
5717 "(RgnHandle region, BitMapPtr bMap) -> None"},
Guido van Rossume56db431995-03-19 22:49:50 +00005718 {"DisposeRgn", (PyCFunction)Qd_DisposeRgn, 1,
5719 "(RgnHandle rgn) -> None"},
Jack Jansen1c4e6141998-04-21 15:23:55 +00005720 {"MacCopyRgn", (PyCFunction)Qd_MacCopyRgn, 1,
Guido van Rossume56db431995-03-19 22:49:50 +00005721 "(RgnHandle srcRgn, RgnHandle dstRgn) -> None"},
5722 {"SetEmptyRgn", (PyCFunction)Qd_SetEmptyRgn, 1,
5723 "(RgnHandle rgn) -> None"},
Jack Jansen1c4e6141998-04-21 15:23:55 +00005724 {"MacSetRectRgn", (PyCFunction)Qd_MacSetRectRgn, 1,
Guido van Rossume56db431995-03-19 22:49:50 +00005725 "(RgnHandle rgn, short left, short top, short right, short bottom) -> None"},
5726 {"RectRgn", (PyCFunction)Qd_RectRgn, 1,
5727 "(RgnHandle rgn, Rect r) -> None"},
Jack Jansen1c4e6141998-04-21 15:23:55 +00005728 {"MacOffsetRgn", (PyCFunction)Qd_MacOffsetRgn, 1,
Guido van Rossume56db431995-03-19 22:49:50 +00005729 "(RgnHandle rgn, short dh, short dv) -> None"},
5730 {"InsetRgn", (PyCFunction)Qd_InsetRgn, 1,
5731 "(RgnHandle rgn, short dh, short dv) -> None"},
5732 {"SectRgn", (PyCFunction)Qd_SectRgn, 1,
5733 "(RgnHandle srcRgnA, RgnHandle srcRgnB, RgnHandle dstRgn) -> None"},
Jack Jansen1c4e6141998-04-21 15:23:55 +00005734 {"MacUnionRgn", (PyCFunction)Qd_MacUnionRgn, 1,
Guido van Rossume56db431995-03-19 22:49:50 +00005735 "(RgnHandle srcRgnA, RgnHandle srcRgnB, RgnHandle dstRgn) -> None"},
5736 {"DiffRgn", (PyCFunction)Qd_DiffRgn, 1,
5737 "(RgnHandle srcRgnA, RgnHandle srcRgnB, RgnHandle dstRgn) -> None"},
Jack Jansen1c4e6141998-04-21 15:23:55 +00005738 {"MacXorRgn", (PyCFunction)Qd_MacXorRgn, 1,
Guido van Rossume56db431995-03-19 22:49:50 +00005739 "(RgnHandle srcRgnA, RgnHandle srcRgnB, RgnHandle dstRgn) -> None"},
5740 {"RectInRgn", (PyCFunction)Qd_RectInRgn, 1,
5741 "(Rect r, RgnHandle rgn) -> (Boolean _rv)"},
Jack Jansen1c4e6141998-04-21 15:23:55 +00005742 {"MacEqualRgn", (PyCFunction)Qd_MacEqualRgn, 1,
Guido van Rossume56db431995-03-19 22:49:50 +00005743 "(RgnHandle rgnA, RgnHandle rgnB) -> (Boolean _rv)"},
5744 {"EmptyRgn", (PyCFunction)Qd_EmptyRgn, 1,
5745 "(RgnHandle rgn) -> (Boolean _rv)"},
Jack Jansen1c4e6141998-04-21 15:23:55 +00005746 {"MacFrameRgn", (PyCFunction)Qd_MacFrameRgn, 1,
Guido van Rossume56db431995-03-19 22:49:50 +00005747 "(RgnHandle rgn) -> None"},
Jack Jansen1c4e6141998-04-21 15:23:55 +00005748 {"MacPaintRgn", (PyCFunction)Qd_MacPaintRgn, 1,
Guido van Rossume56db431995-03-19 22:49:50 +00005749 "(RgnHandle rgn) -> None"},
5750 {"EraseRgn", (PyCFunction)Qd_EraseRgn, 1,
5751 "(RgnHandle rgn) -> None"},
Jack Jansen1c4e6141998-04-21 15:23:55 +00005752 {"MacInvertRgn", (PyCFunction)Qd_MacInvertRgn, 1,
Guido van Rossume56db431995-03-19 22:49:50 +00005753 "(RgnHandle rgn) -> None"},
Jack Jansen1c4e6141998-04-21 15:23:55 +00005754 {"MacFillRgn", (PyCFunction)Qd_MacFillRgn, 1,
Jack Jansen04a02e71996-01-06 17:12:58 +00005755 "(RgnHandle rgn, Pattern pat) -> None"},
Guido van Rossume56db431995-03-19 22:49:50 +00005756 {"ScrollRect", (PyCFunction)Qd_ScrollRect, 1,
5757 "(Rect r, short dh, short dv, RgnHandle updateRgn) -> None"},
Jack Jansen41058c01995-11-16 22:48:29 +00005758 {"CopyBits", (PyCFunction)Qd_CopyBits, 1,
5759 "(BitMapPtr srcBits, BitMapPtr dstBits, Rect srcRect, Rect dstRect, short mode, RgnHandle maskRgn) -> None"},
5760 {"CopyMask", (PyCFunction)Qd_CopyMask, 1,
5761 "(BitMapPtr srcBits, BitMapPtr maskBits, BitMapPtr dstBits, Rect srcRect, Rect maskRect, Rect dstRect) -> None"},
Guido van Rossume56db431995-03-19 22:49:50 +00005762 {"OpenPicture", (PyCFunction)Qd_OpenPicture, 1,
5763 "(Rect picFrame) -> (PicHandle _rv)"},
5764 {"PicComment", (PyCFunction)Qd_PicComment, 1,
5765 "(short kind, short dataSize, Handle dataHandle) -> None"},
5766 {"ClosePicture", (PyCFunction)Qd_ClosePicture, 1,
5767 "() -> None"},
5768 {"DrawPicture", (PyCFunction)Qd_DrawPicture, 1,
5769 "(PicHandle myPicture, Rect dstRect) -> None"},
5770 {"KillPicture", (PyCFunction)Qd_KillPicture, 1,
5771 "(PicHandle myPicture) -> None"},
5772 {"OpenPoly", (PyCFunction)Qd_OpenPoly, 1,
5773 "() -> (PolyHandle _rv)"},
5774 {"ClosePoly", (PyCFunction)Qd_ClosePoly, 1,
5775 "() -> None"},
5776 {"KillPoly", (PyCFunction)Qd_KillPoly, 1,
5777 "(PolyHandle poly) -> None"},
5778 {"OffsetPoly", (PyCFunction)Qd_OffsetPoly, 1,
5779 "(PolyHandle poly, short dh, short dv) -> None"},
5780 {"FramePoly", (PyCFunction)Qd_FramePoly, 1,
5781 "(PolyHandle poly) -> None"},
5782 {"PaintPoly", (PyCFunction)Qd_PaintPoly, 1,
5783 "(PolyHandle poly) -> None"},
5784 {"ErasePoly", (PyCFunction)Qd_ErasePoly, 1,
5785 "(PolyHandle poly) -> None"},
5786 {"InvertPoly", (PyCFunction)Qd_InvertPoly, 1,
5787 "(PolyHandle poly) -> None"},
Jack Jansen04a02e71996-01-06 17:12:58 +00005788 {"FillPoly", (PyCFunction)Qd_FillPoly, 1,
5789 "(PolyHandle poly, Pattern pat) -> None"},
Guido van Rossume56db431995-03-19 22:49:50 +00005790 {"SetPt", (PyCFunction)Qd_SetPt, 1,
Jack Jansen1d8ede71996-01-08 23:47:31 +00005791 "(short h, short v) -> (Point pt)"},
Guido van Rossume56db431995-03-19 22:49:50 +00005792 {"LocalToGlobal", (PyCFunction)Qd_LocalToGlobal, 1,
5793 "(Point pt) -> (Point pt)"},
5794 {"GlobalToLocal", (PyCFunction)Qd_GlobalToLocal, 1,
5795 "(Point pt) -> (Point pt)"},
5796 {"Random", (PyCFunction)Qd_Random, 1,
5797 "() -> (short _rv)"},
Jack Jansen1c4e6141998-04-21 15:23:55 +00005798 {"MacGetPixel", (PyCFunction)Qd_MacGetPixel, 1,
Guido van Rossume56db431995-03-19 22:49:50 +00005799 "(short h, short v) -> (Boolean _rv)"},
5800 {"ScalePt", (PyCFunction)Qd_ScalePt, 1,
5801 "(Point pt, Rect srcRect, Rect dstRect) -> (Point pt)"},
5802 {"MapPt", (PyCFunction)Qd_MapPt, 1,
5803 "(Point pt, Rect srcRect, Rect dstRect) -> (Point pt)"},
5804 {"MapRect", (PyCFunction)Qd_MapRect, 1,
Jack Jansen54c8f7e1995-11-14 10:46:01 +00005805 "(Rect r, Rect srcRect, Rect dstRect) -> (Rect r)"},
Guido van Rossume56db431995-03-19 22:49:50 +00005806 {"MapRgn", (PyCFunction)Qd_MapRgn, 1,
5807 "(RgnHandle rgn, Rect srcRect, Rect dstRect) -> None"},
5808 {"MapPoly", (PyCFunction)Qd_MapPoly, 1,
5809 "(PolyHandle poly, Rect srcRect, Rect dstRect) -> None"},
Jack Jansen41058c01995-11-16 22:48:29 +00005810 {"StdBits", (PyCFunction)Qd_StdBits, 1,
5811 "(BitMapPtr srcBits, Rect srcRect, Rect dstRect, short mode, RgnHandle maskRgn) -> None"},
Guido van Rossume56db431995-03-19 22:49:50 +00005812 {"AddPt", (PyCFunction)Qd_AddPt, 1,
5813 "(Point src, Point dst) -> (Point dst)"},
5814 {"EqualPt", (PyCFunction)Qd_EqualPt, 1,
5815 "(Point pt1, Point pt2) -> (Boolean _rv)"},
Jack Jansen1c4e6141998-04-21 15:23:55 +00005816 {"MacPtInRect", (PyCFunction)Qd_MacPtInRect, 1,
Guido van Rossume56db431995-03-19 22:49:50 +00005817 "(Point pt, Rect r) -> (Boolean _rv)"},
5818 {"Pt2Rect", (PyCFunction)Qd_Pt2Rect, 1,
5819 "(Point pt1, Point pt2) -> (Rect dstRect)"},
5820 {"PtToAngle", (PyCFunction)Qd_PtToAngle, 1,
5821 "(Rect r, Point pt) -> (short angle)"},
Jack Jansenb81cf9d1995-06-06 13:08:40 +00005822 {"SubPt", (PyCFunction)Qd_SubPt, 1,
5823 "(Point src, Point dst) -> (Point dst)"},
Guido van Rossume56db431995-03-19 22:49:50 +00005824 {"PtInRgn", (PyCFunction)Qd_PtInRgn, 1,
5825 "(Point pt, RgnHandle rgn) -> (Boolean _rv)"},
5826 {"NewPixMap", (PyCFunction)Qd_NewPixMap, 1,
5827 "() -> (PixMapHandle _rv)"},
Guido van Rossume56db431995-03-19 22:49:50 +00005828 {"DisposePixMap", (PyCFunction)Qd_DisposePixMap, 1,
5829 "(PixMapHandle pm) -> None"},
5830 {"CopyPixMap", (PyCFunction)Qd_CopyPixMap, 1,
5831 "(PixMapHandle srcPM, PixMapHandle dstPM) -> None"},
5832 {"NewPixPat", (PyCFunction)Qd_NewPixPat, 1,
5833 "() -> (PixPatHandle _rv)"},
Guido van Rossume56db431995-03-19 22:49:50 +00005834 {"DisposePixPat", (PyCFunction)Qd_DisposePixPat, 1,
5835 "(PixPatHandle pp) -> None"},
5836 {"CopyPixPat", (PyCFunction)Qd_CopyPixPat, 1,
5837 "(PixPatHandle srcPP, PixPatHandle dstPP) -> None"},
5838 {"PenPixPat", (PyCFunction)Qd_PenPixPat, 1,
5839 "(PixPatHandle pp) -> None"},
5840 {"BackPixPat", (PyCFunction)Qd_BackPixPat, 1,
5841 "(PixPatHandle pp) -> None"},
5842 {"GetPixPat", (PyCFunction)Qd_GetPixPat, 1,
5843 "(short patID) -> (PixPatHandle _rv)"},
Jack Jansen232f3cd1995-12-09 14:04:31 +00005844 {"MakeRGBPat", (PyCFunction)Qd_MakeRGBPat, 1,
5845 "(PixPatHandle pp, RGBColor myColor) -> None"},
Guido van Rossume56db431995-03-19 22:49:50 +00005846 {"FillCRect", (PyCFunction)Qd_FillCRect, 1,
5847 "(Rect r, PixPatHandle pp) -> None"},
5848 {"FillCOval", (PyCFunction)Qd_FillCOval, 1,
5849 "(Rect r, PixPatHandle pp) -> None"},
5850 {"FillCRoundRect", (PyCFunction)Qd_FillCRoundRect, 1,
5851 "(Rect r, short ovalWidth, short ovalHeight, PixPatHandle pp) -> None"},
5852 {"FillCArc", (PyCFunction)Qd_FillCArc, 1,
5853 "(Rect r, short startAngle, short arcAngle, PixPatHandle pp) -> None"},
5854 {"FillCRgn", (PyCFunction)Qd_FillCRgn, 1,
5855 "(RgnHandle rgn, PixPatHandle pp) -> None"},
5856 {"FillCPoly", (PyCFunction)Qd_FillCPoly, 1,
5857 "(PolyHandle poly, PixPatHandle pp) -> None"},
Jack Jansen232f3cd1995-12-09 14:04:31 +00005858 {"RGBForeColor", (PyCFunction)Qd_RGBForeColor, 1,
5859 "(RGBColor color) -> None"},
5860 {"RGBBackColor", (PyCFunction)Qd_RGBBackColor, 1,
5861 "(RGBColor color) -> None"},
5862 {"SetCPixel", (PyCFunction)Qd_SetCPixel, 1,
5863 "(short h, short v, RGBColor cPix) -> None"},
Guido van Rossume56db431995-03-19 22:49:50 +00005864 {"SetPortPix", (PyCFunction)Qd_SetPortPix, 1,
5865 "(PixMapHandle pm) -> None"},
Jack Jansen232f3cd1995-12-09 14:04:31 +00005866 {"GetCPixel", (PyCFunction)Qd_GetCPixel, 1,
5867 "(short h, short v) -> (RGBColor cPix)"},
5868 {"GetForeColor", (PyCFunction)Qd_GetForeColor, 1,
5869 "() -> (RGBColor color)"},
5870 {"GetBackColor", (PyCFunction)Qd_GetBackColor, 1,
5871 "() -> (RGBColor color)"},
5872 {"OpColor", (PyCFunction)Qd_OpColor, 1,
5873 "(RGBColor color) -> None"},
5874 {"HiliteColor", (PyCFunction)Qd_HiliteColor, 1,
5875 "(RGBColor color) -> None"},
Jack Jansen69b43ed1997-08-15 14:35:54 +00005876 {"DisposeCTable", (PyCFunction)Qd_DisposeCTable, 1,
5877 "(CTabHandle cTable) -> None"},
5878 {"GetCTable", (PyCFunction)Qd_GetCTable, 1,
5879 "(short ctID) -> (CTabHandle _rv)"},
5880 {"GetCCursor", (PyCFunction)Qd_GetCCursor, 1,
5881 "(short crsrID) -> (CCrsrHandle _rv)"},
5882 {"SetCCursor", (PyCFunction)Qd_SetCCursor, 1,
5883 "(CCrsrHandle cCrsr) -> None"},
Guido van Rossume56db431995-03-19 22:49:50 +00005884 {"AllocCursor", (PyCFunction)Qd_AllocCursor, 1,
5885 "() -> None"},
Jack Jansen69b43ed1997-08-15 14:35:54 +00005886 {"DisposeCCursor", (PyCFunction)Qd_DisposeCCursor, 1,
5887 "(CCrsrHandle cCrsr) -> None"},
5888 {"GetMaxDevice", (PyCFunction)Qd_GetMaxDevice, 1,
5889 "(Rect globalRect) -> (GDHandle _rv)"},
Guido van Rossume56db431995-03-19 22:49:50 +00005890 {"GetCTSeed", (PyCFunction)Qd_GetCTSeed, 1,
5891 "() -> (long _rv)"},
Jack Jansen69b43ed1997-08-15 14:35:54 +00005892 {"GetDeviceList", (PyCFunction)Qd_GetDeviceList, 1,
5893 "() -> (GDHandle _rv)"},
5894 {"GetMainDevice", (PyCFunction)Qd_GetMainDevice, 1,
5895 "() -> (GDHandle _rv)"},
5896 {"GetNextDevice", (PyCFunction)Qd_GetNextDevice, 1,
5897 "(GDHandle curDevice) -> (GDHandle _rv)"},
5898 {"TestDeviceAttribute", (PyCFunction)Qd_TestDeviceAttribute, 1,
5899 "(GDHandle gdh, short attribute) -> (Boolean _rv)"},
5900 {"SetDeviceAttribute", (PyCFunction)Qd_SetDeviceAttribute, 1,
5901 "(GDHandle gdh, short attribute, Boolean value) -> None"},
5902 {"InitGDevice", (PyCFunction)Qd_InitGDevice, 1,
5903 "(short qdRefNum, long mode, GDHandle gdh) -> None"},
5904 {"NewGDevice", (PyCFunction)Qd_NewGDevice, 1,
5905 "(short refNum, long mode) -> (GDHandle _rv)"},
5906 {"DisposeGDevice", (PyCFunction)Qd_DisposeGDevice, 1,
5907 "(GDHandle gdh) -> None"},
5908 {"SetGDevice", (PyCFunction)Qd_SetGDevice, 1,
5909 "(GDHandle gd) -> None"},
5910 {"GetGDevice", (PyCFunction)Qd_GetGDevice, 1,
5911 "() -> (GDHandle _rv)"},
Jack Jansen232f3cd1995-12-09 14:04:31 +00005912 {"Color2Index", (PyCFunction)Qd_Color2Index, 1,
5913 "(RGBColor myColor) -> (long _rv)"},
5914 {"Index2Color", (PyCFunction)Qd_Index2Color, 1,
5915 "(long index) -> (RGBColor aColor)"},
5916 {"InvertColor", (PyCFunction)Qd_InvertColor, 1,
5917 "() -> (RGBColor myColor)"},
5918 {"RealColor", (PyCFunction)Qd_RealColor, 1,
5919 "(RGBColor color) -> (Boolean _rv)"},
Jack Jansen69b43ed1997-08-15 14:35:54 +00005920 {"GetSubTable", (PyCFunction)Qd_GetSubTable, 1,
5921 "(CTabHandle myColors, short iTabRes, CTabHandle targetTbl) -> None"},
5922 {"MakeITable", (PyCFunction)Qd_MakeITable, 1,
5923 "(CTabHandle cTabH, ITabHandle iTabH, short res) -> None"},
Guido van Rossume56db431995-03-19 22:49:50 +00005924 {"SetClientID", (PyCFunction)Qd_SetClientID, 1,
5925 "(short id) -> None"},
5926 {"ProtectEntry", (PyCFunction)Qd_ProtectEntry, 1,
5927 "(short index, Boolean protect) -> None"},
5928 {"ReserveEntry", (PyCFunction)Qd_ReserveEntry, 1,
5929 "(short index, Boolean reserve) -> None"},
5930 {"QDError", (PyCFunction)Qd_QDError, 1,
5931 "() -> (short _rv)"},
Jack Jansen41058c01995-11-16 22:48:29 +00005932 {"CopyDeepMask", (PyCFunction)Qd_CopyDeepMask, 1,
5933 "(BitMapPtr srcBits, BitMapPtr maskBits, BitMapPtr dstBits, Rect srcRect, Rect maskRect, Rect dstRect, short mode, RgnHandle maskRgn) -> None"},
Jack Jansen54c8f7e1995-11-14 10:46:01 +00005934 {"GetPattern", (PyCFunction)Qd_GetPattern, 1,
5935 "(short patternID) -> (PatHandle _rv)"},
Jack Jansen1c4e6141998-04-21 15:23:55 +00005936 {"MacGetCursor", (PyCFunction)Qd_MacGetCursor, 1,
Jack Jansen54c8f7e1995-11-14 10:46:01 +00005937 "(short cursorID) -> (CursHandle _rv)"},
5938 {"GetPicture", (PyCFunction)Qd_GetPicture, 1,
5939 "(short pictureID) -> (PicHandle _rv)"},
5940 {"DeltaPoint", (PyCFunction)Qd_DeltaPoint, 1,
5941 "(Point ptA, Point ptB) -> (long _rv)"},
5942 {"ShieldCursor", (PyCFunction)Qd_ShieldCursor, 1,
5943 "(Rect shieldRect, Point offsetPt) -> None"},
5944 {"ScreenRes", (PyCFunction)Qd_ScreenRes, 1,
5945 "() -> (short scrnHRes, short scrnVRes)"},
Jack Jansen04a02e71996-01-06 17:12:58 +00005946 {"GetIndPattern", (PyCFunction)Qd_GetIndPattern, 1,
5947 "(short patternListID, short index) -> (Pattern thePat)"},
Jack Jansen21f96871998-02-20 16:02:09 +00005948 {"SlopeFromAngle", (PyCFunction)Qd_SlopeFromAngle, 1,
5949 "(short angle) -> (Fixed _rv)"},
5950 {"AngleFromSlope", (PyCFunction)Qd_AngleFromSlope, 1,
5951 "(Fixed slope) -> (short _rv)"},
Jack Jansenbd58eda2001-01-24 14:05:11 +00005952 {"GetPortPixMap", (PyCFunction)Qd_GetPortPixMap, 1,
5953 "(CGrafPtr port) -> (PixMapHandle _rv)"},
Jack Jansen5c3c58b2001-01-29 14:07:01 +00005954 {"GetPortBitMapForCopyBits", (PyCFunction)Qd_GetPortBitMapForCopyBits, 1,
5955 "(CGrafPtr port) -> (const BitMap * _rv)"},
Jack Jansenbd58eda2001-01-24 14:05:11 +00005956 {"GetPortBounds", (PyCFunction)Qd_GetPortBounds, 1,
5957 "(CGrafPtr port) -> (Rect rect)"},
5958 {"GetPortForeColor", (PyCFunction)Qd_GetPortForeColor, 1,
5959 "(CGrafPtr port) -> (RGBColor foreColor)"},
5960 {"GetPortBackColor", (PyCFunction)Qd_GetPortBackColor, 1,
5961 "(CGrafPtr port) -> (RGBColor backColor)"},
5962 {"GetPortOpColor", (PyCFunction)Qd_GetPortOpColor, 1,
5963 "(CGrafPtr port) -> (RGBColor opColor)"},
5964 {"GetPortHiliteColor", (PyCFunction)Qd_GetPortHiliteColor, 1,
5965 "(CGrafPtr port) -> (RGBColor hiliteColor)"},
5966 {"GetPortTextFont", (PyCFunction)Qd_GetPortTextFont, 1,
5967 "(CGrafPtr port) -> (short _rv)"},
5968 {"GetPortTextFace", (PyCFunction)Qd_GetPortTextFace, 1,
5969 "(CGrafPtr port) -> (Style _rv)"},
5970 {"GetPortTextMode", (PyCFunction)Qd_GetPortTextMode, 1,
5971 "(CGrafPtr port) -> (short _rv)"},
5972 {"GetPortTextSize", (PyCFunction)Qd_GetPortTextSize, 1,
5973 "(CGrafPtr port) -> (short _rv)"},
5974 {"GetPortChExtra", (PyCFunction)Qd_GetPortChExtra, 1,
5975 "(CGrafPtr port) -> (short _rv)"},
5976 {"GetPortFracHPenLocation", (PyCFunction)Qd_GetPortFracHPenLocation, 1,
5977 "(CGrafPtr port) -> (short _rv)"},
5978 {"GetPortSpExtra", (PyCFunction)Qd_GetPortSpExtra, 1,
5979 "(CGrafPtr port) -> (Fixed _rv)"},
5980 {"GetPortPenVisibility", (PyCFunction)Qd_GetPortPenVisibility, 1,
5981 "(CGrafPtr port) -> (short _rv)"},
5982 {"GetPortVisibleRegion", (PyCFunction)Qd_GetPortVisibleRegion, 1,
5983 "(CGrafPtr port, RgnHandle visRgn) -> (RgnHandle _rv)"},
5984 {"GetPortClipRegion", (PyCFunction)Qd_GetPortClipRegion, 1,
5985 "(CGrafPtr port, RgnHandle clipRgn) -> (RgnHandle _rv)"},
5986 {"GetPortBackPixPat", (PyCFunction)Qd_GetPortBackPixPat, 1,
5987 "(CGrafPtr port, PixPatHandle backPattern) -> (PixPatHandle _rv)"},
5988 {"GetPortPenPixPat", (PyCFunction)Qd_GetPortPenPixPat, 1,
5989 "(CGrafPtr port, PixPatHandle penPattern) -> (PixPatHandle _rv)"},
5990 {"GetPortFillPixPat", (PyCFunction)Qd_GetPortFillPixPat, 1,
5991 "(CGrafPtr port, PixPatHandle fillPattern) -> (PixPatHandle _rv)"},
5992 {"GetPortPenSize", (PyCFunction)Qd_GetPortPenSize, 1,
5993 "(CGrafPtr port, Point penSize) -> (Point penSize)"},
5994 {"GetPortPenMode", (PyCFunction)Qd_GetPortPenMode, 1,
5995 "(CGrafPtr port) -> (SInt32 _rv)"},
5996 {"GetPortPenLocation", (PyCFunction)Qd_GetPortPenLocation, 1,
5997 "(CGrafPtr port, Point penLocation) -> (Point penLocation)"},
5998 {"IsPortRegionBeingDefined", (PyCFunction)Qd_IsPortRegionBeingDefined, 1,
5999 "(CGrafPtr port) -> (Boolean _rv)"},
6000 {"IsPortPictureBeingDefined", (PyCFunction)Qd_IsPortPictureBeingDefined, 1,
6001 "(CGrafPtr port) -> (Boolean _rv)"},
6002
6003#if TARGET_API_MAC_CARBON
6004 {"IsPortOffscreen", (PyCFunction)Qd_IsPortOffscreen, 1,
6005 "(CGrafPtr port) -> (Boolean _rv)"},
6006#endif
6007
6008#if TARGET_API_MAC_CARBON
6009 {"IsPortColor", (PyCFunction)Qd_IsPortColor, 1,
6010 "(CGrafPtr port) -> (Boolean _rv)"},
6011#endif
6012 {"SetPortBounds", (PyCFunction)Qd_SetPortBounds, 1,
6013 "(CGrafPtr port, Rect rect) -> None"},
6014 {"SetPortOpColor", (PyCFunction)Qd_SetPortOpColor, 1,
6015 "(CGrafPtr port, RGBColor opColor) -> None"},
6016 {"SetPortVisibleRegion", (PyCFunction)Qd_SetPortVisibleRegion, 1,
6017 "(CGrafPtr port, RgnHandle visRgn) -> None"},
6018 {"SetPortClipRegion", (PyCFunction)Qd_SetPortClipRegion, 1,
6019 "(CGrafPtr port, RgnHandle clipRgn) -> None"},
6020 {"SetPortPenPixPat", (PyCFunction)Qd_SetPortPenPixPat, 1,
6021 "(CGrafPtr port, PixPatHandle penPattern) -> None"},
6022 {"SetPortBackPixPat", (PyCFunction)Qd_SetPortBackPixPat, 1,
6023 "(CGrafPtr port, PixPatHandle backPattern) -> None"},
6024 {"SetPortPenSize", (PyCFunction)Qd_SetPortPenSize, 1,
6025 "(CGrafPtr port, Point penSize) -> None"},
6026 {"SetPortPenMode", (PyCFunction)Qd_SetPortPenMode, 1,
6027 "(CGrafPtr port, SInt32 penMode) -> None"},
6028 {"SetPortFracHPenLocation", (PyCFunction)Qd_SetPortFracHPenLocation, 1,
6029 "(CGrafPtr port, short pnLocHFrac) -> None"},
6030 {"GetPixBounds", (PyCFunction)Qd_GetPixBounds, 1,
6031 "(PixMapHandle pixMap) -> (Rect bounds)"},
6032 {"GetPixDepth", (PyCFunction)Qd_GetPixDepth, 1,
6033 "(PixMapHandle pixMap) -> (short _rv)"},
6034 {"GetQDGlobalsRandomSeed", (PyCFunction)Qd_GetQDGlobalsRandomSeed, 1,
6035 "() -> (long _rv)"},
6036 {"GetQDGlobalsScreenBits", (PyCFunction)Qd_GetQDGlobalsScreenBits, 1,
6037 "() -> (BitMap screenBits)"},
6038 {"GetQDGlobalsArrow", (PyCFunction)Qd_GetQDGlobalsArrow, 1,
6039 "() -> (Cursor arrow)"},
6040 {"GetQDGlobalsDarkGray", (PyCFunction)Qd_GetQDGlobalsDarkGray, 1,
6041 "() -> (Pattern dkGray)"},
6042 {"GetQDGlobalsLightGray", (PyCFunction)Qd_GetQDGlobalsLightGray, 1,
6043 "() -> (Pattern ltGray)"},
6044 {"GetQDGlobalsGray", (PyCFunction)Qd_GetQDGlobalsGray, 1,
6045 "() -> (Pattern gray)"},
6046 {"GetQDGlobalsBlack", (PyCFunction)Qd_GetQDGlobalsBlack, 1,
6047 "() -> (Pattern black)"},
6048 {"GetQDGlobalsWhite", (PyCFunction)Qd_GetQDGlobalsWhite, 1,
6049 "() -> (Pattern white)"},
6050 {"GetQDGlobalsThePort", (PyCFunction)Qd_GetQDGlobalsThePort, 1,
6051 "() -> (CGrafPtr _rv)"},
6052 {"SetQDGlobalsRandomSeed", (PyCFunction)Qd_SetQDGlobalsRandomSeed, 1,
6053 "(long randomSeed) -> None"},
6054 {"SetQDGlobalsArrow", (PyCFunction)Qd_SetQDGlobalsArrow, 1,
6055 "(Cursor arrow) -> None"},
6056 {"GetRegionBounds", (PyCFunction)Qd_GetRegionBounds, 1,
6057 "(RgnHandle region) -> (Rect bounds)"},
6058
6059#if TARGET_API_MAC_CARBON
6060 {"IsRegionRectangular", (PyCFunction)Qd_IsRegionRectangular, 1,
6061 "(RgnHandle region) -> (Boolean _rv)"},
6062#endif
6063
6064#if TARGET_API_MAC_CARBON
6065 {"CreateNewPort", (PyCFunction)Qd_CreateNewPort, 1,
6066 "() -> (CGrafPtr _rv)"},
6067#endif
6068
6069#if TARGET_API_MAC_CARBON
6070 {"DisposePort", (PyCFunction)Qd_DisposePort, 1,
6071 "(CGrafPtr port) -> None"},
6072#endif
6073
6074#if TARGET_API_MAC_CARBON
6075 {"SetQDError", (PyCFunction)Qd_SetQDError, 1,
6076 "(OSErr err) -> None"},
6077#endif
6078 {"QDIsPortBuffered", (PyCFunction)Qd_QDIsPortBuffered, 1,
6079 "(CGrafPtr port) -> (Boolean _rv)"},
6080 {"QDIsPortBufferDirty", (PyCFunction)Qd_QDIsPortBufferDirty, 1,
6081 "(CGrafPtr port) -> (Boolean _rv)"},
6082 {"QDFlushPortBuffer", (PyCFunction)Qd_QDFlushPortBuffer, 1,
6083 "(CGrafPtr port, RgnHandle region) -> None"},
Jack Jansenb81cf9d1995-06-06 13:08:40 +00006084 {"TextFont", (PyCFunction)Qd_TextFont, 1,
6085 "(short font) -> None"},
6086 {"TextFace", (PyCFunction)Qd_TextFace, 1,
Jack Jansene742a821998-02-25 15:46:50 +00006087 "(StyleParameter face) -> None"},
Jack Jansenb81cf9d1995-06-06 13:08:40 +00006088 {"TextMode", (PyCFunction)Qd_TextMode, 1,
6089 "(short mode) -> None"},
6090 {"TextSize", (PyCFunction)Qd_TextSize, 1,
6091 "(short size) -> None"},
6092 {"SpaceExtra", (PyCFunction)Qd_SpaceExtra, 1,
Jack Jansen330381c1995-11-15 15:18:01 +00006093 "(Fixed extra) -> None"},
Jack Jansenb81cf9d1995-06-06 13:08:40 +00006094 {"DrawChar", (PyCFunction)Qd_DrawChar, 1,
Jack Jansen21f96871998-02-20 16:02:09 +00006095 "(CharParameter ch) -> None"},
Jack Jansenb81cf9d1995-06-06 13:08:40 +00006096 {"DrawString", (PyCFunction)Qd_DrawString, 1,
6097 "(Str255 s) -> None"},
Jack Jansen1c4e6141998-04-21 15:23:55 +00006098 {"MacDrawText", (PyCFunction)Qd_MacDrawText, 1,
Jack Jansenb81cf9d1995-06-06 13:08:40 +00006099 "(Buffer textBuf, short firstByte, short byteCount) -> None"},
6100 {"CharWidth", (PyCFunction)Qd_CharWidth, 1,
Jack Jansen21f96871998-02-20 16:02:09 +00006101 "(CharParameter ch) -> (short _rv)"},
Jack Jansenb81cf9d1995-06-06 13:08:40 +00006102 {"StringWidth", (PyCFunction)Qd_StringWidth, 1,
6103 "(Str255 s) -> (short _rv)"},
6104 {"TextWidth", (PyCFunction)Qd_TextWidth, 1,
6105 "(Buffer textBuf, short firstByte, short byteCount) -> (short _rv)"},
Jack Jansen3a50f8a1996-01-11 16:17:14 +00006106 {"GetFontInfo", (PyCFunction)Qd_GetFontInfo, 1,
6107 "() -> (FontInfo info)"},
Jack Jansenb81cf9d1995-06-06 13:08:40 +00006108 {"CharExtra", (PyCFunction)Qd_CharExtra, 1,
Jack Jansen330381c1995-11-15 15:18:01 +00006109 "(Fixed extra) -> None"},
Jack Jansen7f725e41998-04-23 13:21:09 +00006110 {"SetPort", (PyCFunction)Qd_SetPort, 1,
Jack Jansen29bfea91998-04-27 15:09:36 +00006111 "(GrafPtr thePort) -> None"},
Jack Jansene180d991998-04-24 10:28:20 +00006112 {"GetCursor", (PyCFunction)Qd_GetCursor, 1,
6113 "(short cursorID) -> (CursHandle _rv)"},
6114 {"SetCursor", (PyCFunction)Qd_SetCursor, 1,
6115 "(Cursor crsr) -> None"},
6116 {"ShowCursor", (PyCFunction)Qd_ShowCursor, 1,
6117 "() -> None"},
6118 {"LineTo", (PyCFunction)Qd_LineTo, 1,
6119 "(short h, short v) -> None"},
6120 {"SetRect", (PyCFunction)Qd_SetRect, 1,
6121 "(short left, short top, short right, short bottom) -> (Rect r)"},
6122 {"OffsetRect", (PyCFunction)Qd_OffsetRect, 1,
6123 "(Rect r, short dh, short dv) -> (Rect r)"},
6124 {"InsetRect", (PyCFunction)Qd_InsetRect, 1,
6125 "(Rect r, short dh, short dv) -> (Rect r)"},
6126 {"UnionRect", (PyCFunction)Qd_UnionRect, 1,
6127 "(Rect src1, Rect src2) -> (Rect dstRect)"},
6128 {"EqualRect", (PyCFunction)Qd_EqualRect, 1,
6129 "(Rect rect1, Rect rect2) -> (Boolean _rv)"},
6130 {"FrameRect", (PyCFunction)Qd_FrameRect, 1,
6131 "(Rect r) -> None"},
6132 {"InvertRect", (PyCFunction)Qd_InvertRect, 1,
6133 "(Rect r) -> None"},
6134 {"FillRect", (PyCFunction)Qd_FillRect, 1,
6135 "(Rect r, Pattern pat) -> None"},
6136 {"CopyRgn", (PyCFunction)Qd_CopyRgn, 1,
6137 "(RgnHandle srcRgn, RgnHandle dstRgn) -> None"},
6138 {"SetRectRgn", (PyCFunction)Qd_SetRectRgn, 1,
6139 "(RgnHandle rgn, short left, short top, short right, short bottom) -> None"},
6140 {"OffsetRgn", (PyCFunction)Qd_OffsetRgn, 1,
6141 "(RgnHandle rgn, short dh, short dv) -> None"},
6142 {"UnionRgn", (PyCFunction)Qd_UnionRgn, 1,
6143 "(RgnHandle srcRgnA, RgnHandle srcRgnB, RgnHandle dstRgn) -> None"},
6144 {"XorRgn", (PyCFunction)Qd_XorRgn, 1,
6145 "(RgnHandle srcRgnA, RgnHandle srcRgnB, RgnHandle dstRgn) -> None"},
6146 {"EqualRgn", (PyCFunction)Qd_EqualRgn, 1,
6147 "(RgnHandle rgnA, RgnHandle rgnB) -> (Boolean _rv)"},
6148 {"FrameRgn", (PyCFunction)Qd_FrameRgn, 1,
6149 "(RgnHandle rgn) -> None"},
6150 {"PaintRgn", (PyCFunction)Qd_PaintRgn, 1,
6151 "(RgnHandle rgn) -> None"},
6152 {"InvertRgn", (PyCFunction)Qd_InvertRgn, 1,
6153 "(RgnHandle rgn) -> None"},
6154 {"FillRgn", (PyCFunction)Qd_FillRgn, 1,
6155 "(RgnHandle rgn, Pattern pat) -> None"},
6156 {"GetPixel", (PyCFunction)Qd_GetPixel, 1,
6157 "(short h, short v) -> (Boolean _rv)"},
6158 {"PtInRect", (PyCFunction)Qd_PtInRect, 1,
6159 "(Point pt, Rect r) -> (Boolean _rv)"},
6160 {"DrawText", (PyCFunction)Qd_DrawText, 1,
6161 "(Buffer textBuf, short firstByte, short byteCount) -> None"},
Jack Jansen41058c01995-11-16 22:48:29 +00006162 {"BitMap", (PyCFunction)Qd_BitMap, 1,
6163 "Take (string, int, Rect) argument and create BitMap"},
Jack Jansen425e9eb1995-12-12 15:02:03 +00006164 {"RawBitMap", (PyCFunction)Qd_RawBitMap, 1,
6165 "Take string BitMap and turn into BitMap object"},
Guido van Rossum17448e21995-01-30 11:53:55 +00006166 {NULL, NULL, 0}
6167};
6168
6169
6170
Jack Jansen87eb4f82001-01-30 09:57:13 +00006171/* Like BMObj_New, but the original bitmap data structure is copied (and
6172** released when the object is released)
6173*/
6174PyObject *BMObj_NewCopied(itself)
6175 BitMapPtr itself;
6176{
6177 BitMapObject *it;
6178 BitMapPtr itself_copy;
6179
6180 if ((itself_copy=(BitMapPtr)malloc(sizeof(BitMap))) == NULL)
6181 return PyErr_NoMemory();
6182 *itself_copy = *itself;
6183 it = (BitMapObject *)BMObj_New(itself_copy);
6184 it->referred_bitmap = itself_copy;
6185 return (PyObject *)it;
6186}
6187
6188
Guido van Rossum17448e21995-01-30 11:53:55 +00006189
6190void initQd()
6191{
6192 PyObject *m;
6193 PyObject *d;
6194
6195
6196
6197
6198 m = Py_InitModule("Qd", Qd_methods);
6199 d = PyModule_GetDict(m);
6200 Qd_Error = PyMac_GetOSErrException();
6201 if (Qd_Error == NULL ||
6202 PyDict_SetItemString(d, "Error", Qd_Error) != 0)
Jack Jansenbd58eda2001-01-24 14:05:11 +00006203 return;
Jack Jansena755e681997-09-20 17:40:22 +00006204 GrafPort_Type.ob_type = &PyType_Type;
6205 Py_INCREF(&GrafPort_Type);
6206 if (PyDict_SetItemString(d, "GrafPortType", (PyObject *)&GrafPort_Type) != 0)
6207 Py_FatalError("can't initialize GrafPortType");
6208 BitMap_Type.ob_type = &PyType_Type;
6209 Py_INCREF(&BitMap_Type);
6210 if (PyDict_SetItemString(d, "BitMapType", (PyObject *)&BitMap_Type) != 0)
6211 Py_FatalError("can't initialize BitMapType");
6212 QDGlobalsAccess_Type.ob_type = &PyType_Type;
6213 Py_INCREF(&QDGlobalsAccess_Type);
6214 if (PyDict_SetItemString(d, "QDGlobalsAccessType", (PyObject *)&QDGlobalsAccess_Type) != 0)
6215 Py_FatalError("can't initialize QDGlobalsAccessType");
Jack Jansenb5394061996-01-05 18:06:41 +00006216
6217 {
6218 PyObject *o;
Jack Jansenbdd07471996-01-29 15:44:03 +00006219
6220 o = QDGA_New();
6221 if (o == NULL || PyDict_SetItemString(d, "qd", o) != 0)
Jack Jansenbd58eda2001-01-24 14:05:11 +00006222 return;
Jack Jansenb5394061996-01-05 18:06:41 +00006223 }
6224
6225
Guido van Rossum17448e21995-01-30 11:53:55 +00006226}
6227
6228/* ========================= End module Qd ========================== */
6229