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