Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 1 | |
| 2 | /* =========================== Module Qd ============================ */ |
| 3 | |
| 4 | #include "Python.h" |
| 5 | |
| 6 | |
| 7 | |
| 8 | #define SystemSevenOrLater 1 |
| 9 | |
| 10 | #include "macglue.h" |
| 11 | #include <Memory.h> |
| 12 | #include <Dialogs.h> |
| 13 | #include <Menus.h> |
| 14 | #include <Controls.h> |
| 15 | |
| 16 | extern PyObject *ResObj_New(Handle); |
| 17 | extern int ResObj_Convert(PyObject *, Handle *); |
Jack Jansen | 425e9eb | 1995-12-12 15:02:03 +0000 | [diff] [blame] | 18 | extern PyObject *OptResObj_New(Handle); |
| 19 | extern int OptResObj_Convert(PyObject *, Handle *); |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 20 | |
| 21 | extern PyObject *WinObj_New(WindowPtr); |
| 22 | extern int WinObj_Convert(PyObject *, WindowPtr *); |
Jack Jansen | 330381c | 1995-11-15 15:18:01 +0000 | [diff] [blame] | 23 | extern PyTypeObject Window_Type; |
| 24 | #define WinObj_Check(x) ((x)->ob_type == &Window_Type) |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 25 | |
| 26 | extern PyObject *DlgObj_New(DialogPtr); |
| 27 | extern int DlgObj_Convert(PyObject *, DialogPtr *); |
| 28 | extern PyTypeObject Dialog_Type; |
| 29 | #define DlgObj_Check(x) ((x)->ob_type == &Dialog_Type) |
| 30 | |
| 31 | extern PyObject *MenuObj_New(MenuHandle); |
| 32 | extern int MenuObj_Convert(PyObject *, MenuHandle *); |
| 33 | |
| 34 | extern PyObject *CtlObj_New(ControlHandle); |
| 35 | extern int CtlObj_Convert(PyObject *, ControlHandle *); |
| 36 | |
Jack Jansen | 330381c | 1995-11-15 15:18:01 +0000 | [diff] [blame] | 37 | extern PyObject *GrafObj_New(GrafPtr); |
| 38 | extern int GrafObj_Convert(PyObject *, GrafPtr *); |
| 39 | |
Jack Jansen | 41058c0 | 1995-11-16 22:48:29 +0000 | [diff] [blame] | 40 | extern PyObject *BMObj_New(BitMapPtr); |
| 41 | extern int BMObj_Convert(PyObject *, BitMapPtr *); |
| 42 | |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 43 | extern PyObject *WinObj_WhichWindow(WindowPtr); |
| 44 | |
| 45 | #include <QuickDraw.h> |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 46 | |
| 47 | #define resNotFound -192 /* Can't include <Errors.h> because of Python's "errors.h" */ |
| 48 | |
Jack Jansen | 232f3cd | 1995-12-09 14:04:31 +0000 | [diff] [blame] | 49 | /* |
| 50 | ** Parse/generate RGB records |
| 51 | */ |
| 52 | PyObject *QdRGB_New(itself) |
| 53 | RGBColorPtr itself; |
| 54 | { |
| 55 | |
| 56 | return Py_BuildValue("lll", (long)itself->red, (long)itself->green, (long)itself->blue); |
| 57 | } |
| 58 | |
| 59 | QdRGB_Convert(v, p_itself) |
| 60 | PyObject *v; |
| 61 | RGBColorPtr p_itself; |
| 62 | { |
| 63 | long red, green, blue; |
| 64 | |
| 65 | if( !PyArg_ParseTuple(v, "lll", &red, &green, &blue) ) |
| 66 | return 0; |
| 67 | p_itself->red = (unsigned short)red; |
| 68 | p_itself->green = (unsigned short)green; |
| 69 | p_itself->blue = (unsigned short)blue; |
| 70 | return 1; |
| 71 | } |
| 72 | |
Jack Jansen | 3a50f8a | 1996-01-11 16:17:14 +0000 | [diff] [blame] | 73 | /* |
| 74 | ** Generate FontInfo records |
| 75 | */ |
| 76 | static |
| 77 | PyObject *QdFI_New(itself) |
| 78 | FontInfo *itself; |
| 79 | { |
| 80 | |
| 81 | return Py_BuildValue("hhhh", itself->ascent, itself->descent, |
| 82 | itself->widMax, itself->leading); |
| 83 | } |
| 84 | |
| 85 | |
Jack Jansen | 232f3cd | 1995-12-09 14:04:31 +0000 | [diff] [blame] | 86 | |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 87 | static PyObject *Qd_Error; |
| 88 | |
Jack Jansen | 330381c | 1995-11-15 15:18:01 +0000 | [diff] [blame] | 89 | /* ---------------------- Object type GrafPort ---------------------- */ |
| 90 | |
| 91 | PyTypeObject GrafPort_Type; |
| 92 | |
| 93 | #define GrafObj_Check(x) ((x)->ob_type == &GrafPort_Type) |
| 94 | |
| 95 | typedef struct GrafPortObject { |
| 96 | PyObject_HEAD |
| 97 | GrafPtr ob_itself; |
| 98 | } GrafPortObject; |
| 99 | |
| 100 | PyObject *GrafObj_New(itself) |
| 101 | GrafPtr itself; |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 102 | { |
Jack Jansen | 330381c | 1995-11-15 15:18:01 +0000 | [diff] [blame] | 103 | GrafPortObject *it; |
| 104 | if (itself == NULL) return PyMac_Error(resNotFound); |
| 105 | it = PyObject_NEW(GrafPortObject, &GrafPort_Type); |
| 106 | if (it == NULL) return NULL; |
| 107 | it->ob_itself = itself; |
| 108 | return (PyObject *)it; |
| 109 | } |
| 110 | GrafObj_Convert(v, p_itself) |
| 111 | PyObject *v; |
| 112 | GrafPtr *p_itself; |
| 113 | { |
| 114 | if (DlgObj_Check(v) || WinObj_Check(v)) { |
| 115 | *p_itself = ((GrafPortObject *)v)->ob_itself; |
| 116 | return 1; |
| 117 | } |
| 118 | if (!GrafObj_Check(v)) |
| 119 | { |
| 120 | PyErr_SetString(PyExc_TypeError, "GrafPort required"); |
| 121 | return 0; |
| 122 | } |
| 123 | *p_itself = ((GrafPortObject *)v)->ob_itself; |
| 124 | return 1; |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 125 | } |
| 126 | |
Jack Jansen | 330381c | 1995-11-15 15:18:01 +0000 | [diff] [blame] | 127 | static void GrafObj_dealloc(self) |
| 128 | GrafPortObject *self; |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 129 | { |
Jack Jansen | 330381c | 1995-11-15 15:18:01 +0000 | [diff] [blame] | 130 | /* Cleanup of self->ob_itself goes here */ |
| 131 | PyMem_DEL(self); |
Guido van Rossum | e56db43 | 1995-03-19 22:49:50 +0000 | [diff] [blame] | 132 | } |
| 133 | |
Jack Jansen | 330381c | 1995-11-15 15:18:01 +0000 | [diff] [blame] | 134 | static PyMethodDef GrafObj_methods[] = { |
| 135 | {NULL, NULL, 0} |
| 136 | }; |
| 137 | |
| 138 | PyMethodChain GrafObj_chain = { GrafObj_methods, NULL }; |
| 139 | |
| 140 | static PyObject *GrafObj_getattr(self, name) |
| 141 | GrafPortObject *self; |
| 142 | char *name; |
Guido van Rossum | e56db43 | 1995-03-19 22:49:50 +0000 | [diff] [blame] | 143 | { |
Jack Jansen | 3a50f8a | 1996-01-11 16:17:14 +0000 | [diff] [blame] | 144 | |
| 145 | { CGrafPtr itself_color = (CGrafPtr)self->ob_itself; |
Jack Jansen | 330381c | 1995-11-15 15:18:01 +0000 | [diff] [blame] | 146 | |
Jack Jansen | 3a50f8a | 1996-01-11 16:17:14 +0000 | [diff] [blame] | 147 | if ( strcmp(name, "data") == 0 ) |
| 148 | return PyString_FromStringAndSize((char *)self->ob_itself, sizeof(GrafPort)); |
| 149 | |
| 150 | if ( (itself_color->portVersion&0xc000) == 0xc000 ) { |
| 151 | /* Color-only attributes */ |
| 152 | |
| 153 | if ( strcmp(name, "portBits") == 0 ) |
| 154 | /* XXXX Do we need HLock() stuff here?? */ |
| 155 | return BMObj_New((BitMapPtr)*itself_color->portPixMap); |
| 156 | if ( strcmp(name, "grafVars") == 0 ) |
| 157 | return Py_BuildValue("O&", ResObj_New, (Handle)itself_color->visRgn); |
| 158 | if ( strcmp(name, "chExtra") == 0 ) |
| 159 | return Py_BuildValue("h", itself_color->chExtra); |
| 160 | if ( strcmp(name, "pnLocHFrac") == 0 ) |
| 161 | return Py_BuildValue("h", itself_color->pnLocHFrac); |
Jack Jansen | 61f3df4 | 1996-01-15 14:39:56 +0000 | [diff] [blame] | 162 | if ( strcmp(name, "bkPixPat") == 0 ) |
| 163 | return Py_BuildValue("O&", ResObj_New, (Handle)itself_color->bkPixPat); |
| 164 | if ( strcmp(name, "rgbFgColor") == 0 ) |
| 165 | return Py_BuildValue("O&", QdRGB_New, &itself_color->rgbFgColor); |
| 166 | if ( strcmp(name, "rgbBkColor") == 0 ) |
| 167 | return Py_BuildValue("O&", QdRGB_New, &itself_color->rgbBkColor); |
| 168 | if ( strcmp(name, "pnPixPat") == 0 ) |
| 169 | return Py_BuildValue("O&", ResObj_New, (Handle)itself_color->pnPixPat); |
| 170 | if ( strcmp(name, "fillPixPat") == 0 ) |
| 171 | return Py_BuildValue("O&", ResObj_New, (Handle)itself_color->fillPixPat); |
Jack Jansen | 3a50f8a | 1996-01-11 16:17:14 +0000 | [diff] [blame] | 172 | } else { |
| 173 | /* Mono-only attributes */ |
| 174 | if ( strcmp(name, "portBits") == 0 ) |
| 175 | return BMObj_New(&self->ob_itself->portBits); |
Jack Jansen | 61f3df4 | 1996-01-15 14:39:56 +0000 | [diff] [blame] | 176 | if ( strcmp(name, "bkPat") == 0 ) |
| 177 | return Py_BuildValue("s#", (char *)&self->ob_itself->bkPat, sizeof(Pattern)); |
| 178 | if ( strcmp(name, "fillPat") == 0 ) |
| 179 | return Py_BuildValue("s#", (char *)&self->ob_itself->fillPat, sizeof(Pattern)); |
| 180 | if ( strcmp(name, "pnPat") == 0 ) |
| 181 | return Py_BuildValue("s#", (char *)&self->ob_itself->pnPat, sizeof(Pattern)); |
Jack Jansen | 3a50f8a | 1996-01-11 16:17:14 +0000 | [diff] [blame] | 182 | } |
| 183 | /* |
| 184 | ** Accessible for both color/mono windows. |
| 185 | ** portVersion is really color-only, but we put it here |
| 186 | ** for convenience |
| 187 | */ |
| 188 | if ( strcmp(name, "portVersion") == 0 ) |
| 189 | return Py_BuildValue("h", itself_color->portVersion); |
| 190 | if ( strcmp(name, "device") == 0 ) |
| 191 | return PyInt_FromLong((long)self->ob_itself->device); |
| 192 | if ( strcmp(name, "portRect") == 0 ) |
| 193 | return Py_BuildValue("O&", PyMac_BuildRect, &self->ob_itself->portRect); |
| 194 | if ( strcmp(name, "visRgn") == 0 ) |
| 195 | return Py_BuildValue("O&", ResObj_New, (Handle)self->ob_itself->visRgn); |
| 196 | if ( strcmp(name, "clipRgn") == 0 ) |
| 197 | return Py_BuildValue("O&", ResObj_New, (Handle)self->ob_itself->clipRgn); |
Jack Jansen | 3a50f8a | 1996-01-11 16:17:14 +0000 | [diff] [blame] | 198 | if ( strcmp(name, "pnLoc") == 0 ) |
| 199 | return Py_BuildValue("O&", PyMac_BuildPoint, self->ob_itself->pnLoc); |
| 200 | if ( strcmp(name, "pnSize") == 0 ) |
| 201 | return Py_BuildValue("O&", PyMac_BuildPoint, self->ob_itself->pnSize); |
| 202 | if ( strcmp(name, "pnMode") == 0 ) |
| 203 | return Py_BuildValue("h", self->ob_itself->pnMode); |
Jack Jansen | 3a50f8a | 1996-01-11 16:17:14 +0000 | [diff] [blame] | 204 | if ( strcmp(name, "pnVis") == 0 ) |
| 205 | return Py_BuildValue("h", self->ob_itself->pnVis); |
| 206 | if ( strcmp(name, "txFont") == 0 ) |
| 207 | return Py_BuildValue("h", self->ob_itself->txFont); |
| 208 | if ( strcmp(name, "txFace") == 0 ) |
| 209 | return Py_BuildValue("h", (short)self->ob_itself->txFace); |
| 210 | if ( strcmp(name, "txMode") == 0 ) |
| 211 | return Py_BuildValue("h", self->ob_itself->txMode); |
| 212 | if ( strcmp(name, "txSize") == 0 ) |
| 213 | return Py_BuildValue("h", self->ob_itself->txSize); |
| 214 | if ( strcmp(name, "spExtra") == 0 ) |
| 215 | return Py_BuildValue("O&", PyMac_BuildFixed, self->ob_itself->spExtra); |
| 216 | /* XXXX Add more, as needed */ |
Jack Jansen | 3355be3 | 1996-05-08 15:33:20 +0000 | [diff] [blame] | 217 | /* This one is so we can compare grafports: */ |
| 218 | if ( strcmp(name, "_id") == 0 ) |
| 219 | return Py_BuildValue("l", (long)self->ob_itself); |
Jack Jansen | 3a50f8a | 1996-01-11 16:17:14 +0000 | [diff] [blame] | 220 | } |
Jack Jansen | 330381c | 1995-11-15 15:18:01 +0000 | [diff] [blame] | 221 | return Py_FindMethodInChain(&GrafObj_chain, (PyObject *)self, name); |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 222 | } |
| 223 | |
Jack Jansen | 330381c | 1995-11-15 15:18:01 +0000 | [diff] [blame] | 224 | #define GrafObj_setattr NULL |
| 225 | |
| 226 | PyTypeObject GrafPort_Type = { |
| 227 | PyObject_HEAD_INIT(&PyType_Type) |
| 228 | 0, /*ob_size*/ |
| 229 | "GrafPort", /*tp_name*/ |
| 230 | sizeof(GrafPortObject), /*tp_basicsize*/ |
| 231 | 0, /*tp_itemsize*/ |
| 232 | /* methods */ |
| 233 | (destructor) GrafObj_dealloc, /*tp_dealloc*/ |
| 234 | 0, /*tp_print*/ |
| 235 | (getattrfunc) GrafObj_getattr, /*tp_getattr*/ |
| 236 | (setattrfunc) GrafObj_setattr, /*tp_setattr*/ |
| 237 | }; |
| 238 | |
| 239 | /* -------------------- End object type GrafPort -------------------- */ |
| 240 | |
| 241 | |
Jack Jansen | 41058c0 | 1995-11-16 22:48:29 +0000 | [diff] [blame] | 242 | /* ----------------------- Object type BitMap ----------------------- */ |
| 243 | |
| 244 | PyTypeObject BitMap_Type; |
| 245 | |
| 246 | #define BMObj_Check(x) ((x)->ob_type == &BitMap_Type) |
| 247 | |
| 248 | typedef struct BitMapObject { |
| 249 | PyObject_HEAD |
| 250 | BitMapPtr ob_itself; |
| 251 | PyObject *referred_object; |
| 252 | BitMap *referred_bitmap; |
| 253 | } BitMapObject; |
| 254 | |
| 255 | PyObject *BMObj_New(itself) |
| 256 | BitMapPtr itself; |
| 257 | { |
| 258 | BitMapObject *it; |
| 259 | if (itself == NULL) return PyMac_Error(resNotFound); |
| 260 | it = PyObject_NEW(BitMapObject, &BitMap_Type); |
| 261 | if (it == NULL) return NULL; |
| 262 | it->ob_itself = itself; |
| 263 | it->referred_object = NULL; |
| 264 | it->referred_bitmap = NULL; |
| 265 | return (PyObject *)it; |
| 266 | } |
| 267 | BMObj_Convert(v, p_itself) |
| 268 | PyObject *v; |
| 269 | BitMapPtr *p_itself; |
| 270 | { |
| 271 | if (!BMObj_Check(v)) |
| 272 | { |
| 273 | PyErr_SetString(PyExc_TypeError, "BitMap required"); |
| 274 | return 0; |
| 275 | } |
| 276 | *p_itself = ((BitMapObject *)v)->ob_itself; |
| 277 | return 1; |
| 278 | } |
| 279 | |
| 280 | static void BMObj_dealloc(self) |
| 281 | BitMapObject *self; |
| 282 | { |
| 283 | Py_XDECREF(self->referred_object); |
| 284 | if (self->referred_bitmap) free(self->referred_bitmap); |
| 285 | PyMem_DEL(self); |
| 286 | } |
| 287 | |
| 288 | static PyMethodDef BMObj_methods[] = { |
| 289 | {NULL, NULL, 0} |
| 290 | }; |
| 291 | |
| 292 | PyMethodChain BMObj_chain = { BMObj_methods, NULL }; |
| 293 | |
| 294 | static PyObject *BMObj_getattr(self, name) |
| 295 | BitMapObject *self; |
| 296 | char *name; |
| 297 | { |
| 298 | if ( strcmp(name, "baseAddr") == 0 ) |
| 299 | return PyInt_FromLong((long)self->ob_itself->baseAddr); |
| 300 | if ( strcmp(name, "rowBytes") == 0 ) |
| 301 | return PyInt_FromLong((long)self->ob_itself->rowBytes); |
| 302 | if ( strcmp(name, "bounds") == 0 ) |
| 303 | return Py_BuildValue("O&", PyMac_BuildRect, &self->ob_itself->bounds); |
| 304 | /* XXXX Add more, as needed */ |
Jack Jansen | 425e9eb | 1995-12-12 15:02:03 +0000 | [diff] [blame] | 305 | if ( strcmp(name, "bitmap_data") == 0 ) |
| 306 | return PyString_FromStringAndSize((char *)self->ob_itself, sizeof(BitMap)); |
| 307 | if ( strcmp(name, "pixmap_data") == 0 ) |
| 308 | return PyString_FromStringAndSize((char *)self->ob_itself, sizeof(PixMap)); |
Jack Jansen | 41058c0 | 1995-11-16 22:48:29 +0000 | [diff] [blame] | 309 | |
| 310 | return Py_FindMethodInChain(&BMObj_chain, (PyObject *)self, name); |
| 311 | } |
| 312 | |
| 313 | #define BMObj_setattr NULL |
| 314 | |
| 315 | PyTypeObject BitMap_Type = { |
| 316 | PyObject_HEAD_INIT(&PyType_Type) |
| 317 | 0, /*ob_size*/ |
| 318 | "BitMap", /*tp_name*/ |
| 319 | sizeof(BitMapObject), /*tp_basicsize*/ |
| 320 | 0, /*tp_itemsize*/ |
| 321 | /* methods */ |
| 322 | (destructor) BMObj_dealloc, /*tp_dealloc*/ |
| 323 | 0, /*tp_print*/ |
| 324 | (getattrfunc) BMObj_getattr, /*tp_getattr*/ |
| 325 | (setattrfunc) BMObj_setattr, /*tp_setattr*/ |
| 326 | }; |
| 327 | |
| 328 | /* --------------------- End object type BitMap --------------------- */ |
| 329 | |
| 330 | |
Jack Jansen | bdd0747 | 1996-01-29 15:44:03 +0000 | [diff] [blame] | 331 | /* ------------------ Object type QDGlobalsAccess ------------------- */ |
| 332 | |
| 333 | staticforward PyTypeObject QDGlobalsAccess_Type; |
| 334 | |
| 335 | #define QDGA_Check(x) ((x)->ob_type == &QDGlobalsAccess_Type) |
| 336 | |
| 337 | typedef struct QDGlobalsAccessObject { |
| 338 | PyObject_HEAD |
| 339 | } QDGlobalsAccessObject; |
| 340 | |
| 341 | static PyObject *QDGA_New() |
| 342 | { |
| 343 | QDGlobalsAccessObject *it; |
| 344 | it = PyObject_NEW(QDGlobalsAccessObject, &QDGlobalsAccess_Type); |
| 345 | if (it == NULL) return NULL; |
| 346 | return (PyObject *)it; |
| 347 | } |
| 348 | |
| 349 | static void QDGA_dealloc(self) |
| 350 | QDGlobalsAccessObject *self; |
| 351 | { |
| 352 | PyMem_DEL(self); |
| 353 | } |
| 354 | |
| 355 | static PyMethodDef QDGA_methods[] = { |
| 356 | {NULL, NULL, 0} |
| 357 | }; |
| 358 | |
| 359 | static PyMethodChain QDGA_chain = { QDGA_methods, NULL }; |
| 360 | |
| 361 | static PyObject *QDGA_getattr(self, name) |
| 362 | QDGlobalsAccessObject *self; |
| 363 | char *name; |
| 364 | { |
| 365 | |
| 366 | if ( strcmp(name, "arrow") == 0 ) |
| 367 | return PyString_FromStringAndSize((char *)&qd.arrow, sizeof(qd.arrow)); |
| 368 | if ( strcmp(name, "black") == 0 ) |
| 369 | return PyString_FromStringAndSize((char *)&qd.black, sizeof(qd.black)); |
| 370 | if ( strcmp(name, "white") == 0 ) |
| 371 | return PyString_FromStringAndSize((char *)&qd.white, sizeof(qd.white)); |
| 372 | if ( strcmp(name, "gray") == 0 ) |
| 373 | return PyString_FromStringAndSize((char *)&qd.gray, sizeof(qd.gray)); |
| 374 | if ( strcmp(name, "ltGray") == 0 ) |
| 375 | return PyString_FromStringAndSize((char *)&qd.ltGray, sizeof(qd.ltGray)); |
| 376 | if ( strcmp(name, "dkGray") == 0 ) |
| 377 | return PyString_FromStringAndSize((char *)&qd.dkGray, sizeof(qd.dkGray)); |
| 378 | if ( strcmp(name, "screenBits") == 0 ) |
| 379 | return BMObj_New(&qd.screenBits); |
| 380 | if ( strcmp(name, "thePort") == 0 ) |
| 381 | return GrafObj_New(qd.thePort); |
| 382 | if ( strcmp(name, "randSeed") == 0 ) |
| 383 | return Py_BuildValue("l", &qd.randSeed); |
| 384 | |
| 385 | return Py_FindMethodInChain(&QDGA_chain, (PyObject *)self, name); |
| 386 | } |
| 387 | |
| 388 | #define QDGA_setattr NULL |
| 389 | |
| 390 | staticforward PyTypeObject QDGlobalsAccess_Type = { |
| 391 | PyObject_HEAD_INIT(&PyType_Type) |
| 392 | 0, /*ob_size*/ |
| 393 | "QDGlobalsAccess", /*tp_name*/ |
| 394 | sizeof(QDGlobalsAccessObject), /*tp_basicsize*/ |
| 395 | 0, /*tp_itemsize*/ |
| 396 | /* methods */ |
| 397 | (destructor) QDGA_dealloc, /*tp_dealloc*/ |
| 398 | 0, /*tp_print*/ |
| 399 | (getattrfunc) QDGA_getattr, /*tp_getattr*/ |
| 400 | (setattrfunc) QDGA_setattr, /*tp_setattr*/ |
| 401 | }; |
| 402 | |
| 403 | /* ---------------- End object type QDGlobalsAccess ----------------- */ |
| 404 | |
| 405 | |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 406 | static PyObject *Qd_SetPort(_self, _args) |
| 407 | PyObject *_self; |
| 408 | PyObject *_args; |
| 409 | { |
| 410 | PyObject *_res = NULL; |
Jack Jansen | 330381c | 1995-11-15 15:18:01 +0000 | [diff] [blame] | 411 | GrafPtr port; |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 412 | if (!PyArg_ParseTuple(_args, "O&", |
Jack Jansen | 330381c | 1995-11-15 15:18:01 +0000 | [diff] [blame] | 413 | GrafObj_Convert, &port)) |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 414 | return NULL; |
Guido van Rossum | e56db43 | 1995-03-19 22:49:50 +0000 | [diff] [blame] | 415 | SetPort(port); |
| 416 | Py_INCREF(Py_None); |
| 417 | _res = Py_None; |
| 418 | return _res; |
| 419 | } |
| 420 | |
| 421 | static PyObject *Qd_GetPort(_self, _args) |
| 422 | PyObject *_self; |
| 423 | PyObject *_args; |
| 424 | { |
| 425 | PyObject *_res = NULL; |
Jack Jansen | 330381c | 1995-11-15 15:18:01 +0000 | [diff] [blame] | 426 | GrafPtr port; |
Guido van Rossum | e56db43 | 1995-03-19 22:49:50 +0000 | [diff] [blame] | 427 | if (!PyArg_ParseTuple(_args, "")) |
| 428 | return NULL; |
| 429 | GetPort(&port); |
| 430 | _res = Py_BuildValue("O&", |
Jack Jansen | 330381c | 1995-11-15 15:18:01 +0000 | [diff] [blame] | 431 | GrafObj_New, port); |
Guido van Rossum | e56db43 | 1995-03-19 22:49:50 +0000 | [diff] [blame] | 432 | return _res; |
| 433 | } |
| 434 | |
| 435 | static PyObject *Qd_GrafDevice(_self, _args) |
| 436 | PyObject *_self; |
| 437 | PyObject *_args; |
| 438 | { |
| 439 | PyObject *_res = NULL; |
| 440 | short device; |
| 441 | if (!PyArg_ParseTuple(_args, "h", |
| 442 | &device)) |
| 443 | return NULL; |
| 444 | GrafDevice(device); |
| 445 | Py_INCREF(Py_None); |
| 446 | _res = Py_None; |
| 447 | return _res; |
| 448 | } |
| 449 | |
Jack Jansen | 41058c0 | 1995-11-16 22:48:29 +0000 | [diff] [blame] | 450 | static PyObject *Qd_SetPortBits(_self, _args) |
| 451 | PyObject *_self; |
| 452 | PyObject *_args; |
| 453 | { |
| 454 | PyObject *_res = NULL; |
| 455 | BitMapPtr bm; |
| 456 | if (!PyArg_ParseTuple(_args, "O&", |
| 457 | BMObj_Convert, &bm)) |
| 458 | return NULL; |
| 459 | SetPortBits(bm); |
| 460 | Py_INCREF(Py_None); |
| 461 | _res = Py_None; |
| 462 | return _res; |
| 463 | } |
| 464 | |
Guido van Rossum | e56db43 | 1995-03-19 22:49:50 +0000 | [diff] [blame] | 465 | static PyObject *Qd_PortSize(_self, _args) |
| 466 | PyObject *_self; |
| 467 | PyObject *_args; |
| 468 | { |
| 469 | PyObject *_res = NULL; |
| 470 | short width; |
| 471 | short height; |
| 472 | if (!PyArg_ParseTuple(_args, "hh", |
| 473 | &width, |
| 474 | &height)) |
| 475 | return NULL; |
| 476 | PortSize(width, |
| 477 | height); |
| 478 | Py_INCREF(Py_None); |
| 479 | _res = Py_None; |
| 480 | return _res; |
| 481 | } |
| 482 | |
| 483 | static PyObject *Qd_MovePortTo(_self, _args) |
| 484 | PyObject *_self; |
| 485 | PyObject *_args; |
| 486 | { |
| 487 | PyObject *_res = NULL; |
| 488 | short leftGlobal; |
| 489 | short topGlobal; |
| 490 | if (!PyArg_ParseTuple(_args, "hh", |
| 491 | &leftGlobal, |
| 492 | &topGlobal)) |
| 493 | return NULL; |
| 494 | MovePortTo(leftGlobal, |
| 495 | topGlobal); |
| 496 | Py_INCREF(Py_None); |
| 497 | _res = Py_None; |
| 498 | return _res; |
| 499 | } |
| 500 | |
| 501 | static PyObject *Qd_SetOrigin(_self, _args) |
| 502 | PyObject *_self; |
| 503 | PyObject *_args; |
| 504 | { |
| 505 | PyObject *_res = NULL; |
| 506 | short h; |
| 507 | short v; |
| 508 | if (!PyArg_ParseTuple(_args, "hh", |
| 509 | &h, |
| 510 | &v)) |
| 511 | return NULL; |
| 512 | SetOrigin(h, |
| 513 | v); |
| 514 | Py_INCREF(Py_None); |
| 515 | _res = Py_None; |
| 516 | return _res; |
| 517 | } |
| 518 | |
| 519 | static PyObject *Qd_SetClip(_self, _args) |
| 520 | PyObject *_self; |
| 521 | PyObject *_args; |
| 522 | { |
| 523 | PyObject *_res = NULL; |
| 524 | RgnHandle rgn; |
| 525 | if (!PyArg_ParseTuple(_args, "O&", |
| 526 | ResObj_Convert, &rgn)) |
| 527 | return NULL; |
| 528 | SetClip(rgn); |
| 529 | Py_INCREF(Py_None); |
| 530 | _res = Py_None; |
| 531 | return _res; |
| 532 | } |
| 533 | |
| 534 | static PyObject *Qd_GetClip(_self, _args) |
| 535 | PyObject *_self; |
| 536 | PyObject *_args; |
| 537 | { |
| 538 | PyObject *_res = NULL; |
| 539 | RgnHandle rgn; |
| 540 | if (!PyArg_ParseTuple(_args, "O&", |
| 541 | ResObj_Convert, &rgn)) |
| 542 | return NULL; |
| 543 | GetClip(rgn); |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 544 | Py_INCREF(Py_None); |
| 545 | _res = Py_None; |
| 546 | return _res; |
| 547 | } |
| 548 | |
| 549 | static PyObject *Qd_ClipRect(_self, _args) |
| 550 | PyObject *_self; |
| 551 | PyObject *_args; |
| 552 | { |
| 553 | PyObject *_res = NULL; |
| 554 | Rect r; |
| 555 | if (!PyArg_ParseTuple(_args, "O&", |
| 556 | PyMac_GetRect, &r)) |
| 557 | return NULL; |
| 558 | ClipRect(&r); |
| 559 | Py_INCREF(Py_None); |
| 560 | _res = Py_None; |
| 561 | return _res; |
| 562 | } |
| 563 | |
Jack Jansen | 04a02e7 | 1996-01-06 17:12:58 +0000 | [diff] [blame] | 564 | static PyObject *Qd_BackPat(_self, _args) |
| 565 | PyObject *_self; |
| 566 | PyObject *_args; |
| 567 | { |
| 568 | PyObject *_res = NULL; |
| 569 | Pattern *pat__in__; |
| 570 | int pat__in_len__; |
| 571 | if (!PyArg_ParseTuple(_args, "s#", |
| 572 | (char **)&pat__in__, &pat__in_len__)) |
| 573 | return NULL; |
| 574 | if (pat__in_len__ != sizeof(Pattern)) |
| 575 | { |
| 576 | PyErr_SetString(PyExc_TypeError, "buffer length should be sizeof(Pattern)"); |
| 577 | goto pat__error__; |
| 578 | } |
| 579 | BackPat(pat__in__); |
| 580 | Py_INCREF(Py_None); |
| 581 | _res = Py_None; |
| 582 | pat__error__: ; |
| 583 | return _res; |
| 584 | } |
| 585 | |
Guido van Rossum | e56db43 | 1995-03-19 22:49:50 +0000 | [diff] [blame] | 586 | static PyObject *Qd_InitCursor(_self, _args) |
| 587 | PyObject *_self; |
| 588 | PyObject *_args; |
| 589 | { |
| 590 | PyObject *_res = NULL; |
| 591 | if (!PyArg_ParseTuple(_args, "")) |
| 592 | return NULL; |
| 593 | InitCursor(); |
| 594 | Py_INCREF(Py_None); |
| 595 | _res = Py_None; |
| 596 | return _res; |
| 597 | } |
| 598 | |
Jack Jansen | b539406 | 1996-01-05 18:06:41 +0000 | [diff] [blame] | 599 | static PyObject *Qd_SetCursor(_self, _args) |
| 600 | PyObject *_self; |
| 601 | PyObject *_args; |
| 602 | { |
| 603 | PyObject *_res = NULL; |
| 604 | Cursor *crsr__in__; |
| 605 | int crsr__in_len__; |
| 606 | if (!PyArg_ParseTuple(_args, "s#", |
| 607 | (char **)&crsr__in__, &crsr__in_len__)) |
| 608 | return NULL; |
| 609 | if (crsr__in_len__ != sizeof(Cursor)) |
| 610 | { |
| 611 | PyErr_SetString(PyExc_TypeError, "buffer length should be sizeof(Cursor)"); |
| 612 | goto crsr__error__; |
| 613 | } |
| 614 | SetCursor(crsr__in__); |
| 615 | Py_INCREF(Py_None); |
| 616 | _res = Py_None; |
| 617 | crsr__error__: ; |
| 618 | return _res; |
| 619 | } |
| 620 | |
Guido van Rossum | e56db43 | 1995-03-19 22:49:50 +0000 | [diff] [blame] | 621 | static PyObject *Qd_HideCursor(_self, _args) |
| 622 | PyObject *_self; |
| 623 | PyObject *_args; |
| 624 | { |
| 625 | PyObject *_res = NULL; |
| 626 | if (!PyArg_ParseTuple(_args, "")) |
| 627 | return NULL; |
| 628 | HideCursor(); |
| 629 | Py_INCREF(Py_None); |
| 630 | _res = Py_None; |
| 631 | return _res; |
| 632 | } |
| 633 | |
| 634 | static PyObject *Qd_ShowCursor(_self, _args) |
| 635 | PyObject *_self; |
| 636 | PyObject *_args; |
| 637 | { |
| 638 | PyObject *_res = NULL; |
| 639 | if (!PyArg_ParseTuple(_args, "")) |
| 640 | return NULL; |
| 641 | ShowCursor(); |
| 642 | Py_INCREF(Py_None); |
| 643 | _res = Py_None; |
| 644 | return _res; |
| 645 | } |
| 646 | |
| 647 | static PyObject *Qd_ObscureCursor(_self, _args) |
| 648 | PyObject *_self; |
| 649 | PyObject *_args; |
| 650 | { |
| 651 | PyObject *_res = NULL; |
| 652 | if (!PyArg_ParseTuple(_args, "")) |
| 653 | return NULL; |
| 654 | ObscureCursor(); |
| 655 | Py_INCREF(Py_None); |
| 656 | _res = Py_None; |
| 657 | return _res; |
| 658 | } |
| 659 | |
| 660 | static PyObject *Qd_HidePen(_self, _args) |
| 661 | PyObject *_self; |
| 662 | PyObject *_args; |
| 663 | { |
| 664 | PyObject *_res = NULL; |
| 665 | if (!PyArg_ParseTuple(_args, "")) |
| 666 | return NULL; |
| 667 | HidePen(); |
| 668 | Py_INCREF(Py_None); |
| 669 | _res = Py_None; |
| 670 | return _res; |
| 671 | } |
| 672 | |
| 673 | static PyObject *Qd_ShowPen(_self, _args) |
| 674 | PyObject *_self; |
| 675 | PyObject *_args; |
| 676 | { |
| 677 | PyObject *_res = NULL; |
| 678 | if (!PyArg_ParseTuple(_args, "")) |
| 679 | return NULL; |
| 680 | ShowPen(); |
| 681 | Py_INCREF(Py_None); |
| 682 | _res = Py_None; |
| 683 | return _res; |
| 684 | } |
| 685 | |
| 686 | static PyObject *Qd_GetPen(_self, _args) |
| 687 | PyObject *_self; |
| 688 | PyObject *_args; |
| 689 | { |
| 690 | PyObject *_res = NULL; |
| 691 | Point pt; |
Jack Jansen | 1d8ede7 | 1996-01-08 23:47:31 +0000 | [diff] [blame] | 692 | if (!PyArg_ParseTuple(_args, "")) |
Guido van Rossum | e56db43 | 1995-03-19 22:49:50 +0000 | [diff] [blame] | 693 | return NULL; |
| 694 | GetPen(&pt); |
| 695 | _res = Py_BuildValue("O&", |
| 696 | PyMac_BuildPoint, pt); |
| 697 | return _res; |
| 698 | } |
| 699 | |
Jack Jansen | 04a02e7 | 1996-01-06 17:12:58 +0000 | [diff] [blame] | 700 | static PyObject *Qd_GetPenState(_self, _args) |
| 701 | PyObject *_self; |
| 702 | PyObject *_args; |
| 703 | { |
| 704 | PyObject *_res = NULL; |
| 705 | PenState pnState__out__; |
| 706 | if (!PyArg_ParseTuple(_args, "")) |
| 707 | return NULL; |
| 708 | GetPenState(&pnState__out__); |
| 709 | _res = Py_BuildValue("s#", |
| 710 | (char *)&pnState__out__, (int)sizeof(PenState)); |
| 711 | pnState__error__: ; |
| 712 | return _res; |
| 713 | } |
| 714 | |
| 715 | static PyObject *Qd_SetPenState(_self, _args) |
| 716 | PyObject *_self; |
| 717 | PyObject *_args; |
| 718 | { |
| 719 | PyObject *_res = NULL; |
| 720 | PenState *pnState__in__; |
| 721 | int pnState__in_len__; |
| 722 | if (!PyArg_ParseTuple(_args, "s#", |
| 723 | (char **)&pnState__in__, &pnState__in_len__)) |
| 724 | return NULL; |
| 725 | if (pnState__in_len__ != sizeof(PenState)) |
| 726 | { |
| 727 | PyErr_SetString(PyExc_TypeError, "buffer length should be sizeof(PenState)"); |
| 728 | goto pnState__error__; |
| 729 | } |
| 730 | SetPenState(pnState__in__); |
| 731 | Py_INCREF(Py_None); |
| 732 | _res = Py_None; |
| 733 | pnState__error__: ; |
| 734 | return _res; |
| 735 | } |
| 736 | |
Guido van Rossum | e56db43 | 1995-03-19 22:49:50 +0000 | [diff] [blame] | 737 | static PyObject *Qd_PenSize(_self, _args) |
| 738 | PyObject *_self; |
| 739 | PyObject *_args; |
| 740 | { |
| 741 | PyObject *_res = NULL; |
| 742 | short width; |
| 743 | short height; |
| 744 | if (!PyArg_ParseTuple(_args, "hh", |
| 745 | &width, |
| 746 | &height)) |
| 747 | return NULL; |
| 748 | PenSize(width, |
| 749 | height); |
| 750 | Py_INCREF(Py_None); |
| 751 | _res = Py_None; |
| 752 | return _res; |
| 753 | } |
| 754 | |
| 755 | static PyObject *Qd_PenMode(_self, _args) |
| 756 | PyObject *_self; |
| 757 | PyObject *_args; |
| 758 | { |
| 759 | PyObject *_res = NULL; |
| 760 | short mode; |
| 761 | if (!PyArg_ParseTuple(_args, "h", |
| 762 | &mode)) |
| 763 | return NULL; |
| 764 | PenMode(mode); |
| 765 | Py_INCREF(Py_None); |
| 766 | _res = Py_None; |
| 767 | return _res; |
| 768 | } |
| 769 | |
Jack Jansen | 04a02e7 | 1996-01-06 17:12:58 +0000 | [diff] [blame] | 770 | static PyObject *Qd_PenPat(_self, _args) |
| 771 | PyObject *_self; |
| 772 | PyObject *_args; |
| 773 | { |
| 774 | PyObject *_res = NULL; |
| 775 | Pattern *pat__in__; |
| 776 | int pat__in_len__; |
| 777 | if (!PyArg_ParseTuple(_args, "s#", |
| 778 | (char **)&pat__in__, &pat__in_len__)) |
| 779 | return NULL; |
| 780 | if (pat__in_len__ != sizeof(Pattern)) |
| 781 | { |
| 782 | PyErr_SetString(PyExc_TypeError, "buffer length should be sizeof(Pattern)"); |
| 783 | goto pat__error__; |
| 784 | } |
| 785 | PenPat(pat__in__); |
| 786 | Py_INCREF(Py_None); |
| 787 | _res = Py_None; |
| 788 | pat__error__: ; |
| 789 | return _res; |
| 790 | } |
| 791 | |
Guido van Rossum | e56db43 | 1995-03-19 22:49:50 +0000 | [diff] [blame] | 792 | static PyObject *Qd_PenNormal(_self, _args) |
| 793 | PyObject *_self; |
| 794 | PyObject *_args; |
| 795 | { |
| 796 | PyObject *_res = NULL; |
| 797 | if (!PyArg_ParseTuple(_args, "")) |
| 798 | return NULL; |
| 799 | PenNormal(); |
| 800 | Py_INCREF(Py_None); |
| 801 | _res = Py_None; |
| 802 | return _res; |
| 803 | } |
| 804 | |
| 805 | static PyObject *Qd_MoveTo(_self, _args) |
| 806 | PyObject *_self; |
| 807 | PyObject *_args; |
| 808 | { |
| 809 | PyObject *_res = NULL; |
| 810 | short h; |
| 811 | short v; |
| 812 | if (!PyArg_ParseTuple(_args, "hh", |
| 813 | &h, |
| 814 | &v)) |
| 815 | return NULL; |
| 816 | MoveTo(h, |
| 817 | v); |
| 818 | Py_INCREF(Py_None); |
| 819 | _res = Py_None; |
| 820 | return _res; |
| 821 | } |
| 822 | |
| 823 | static PyObject *Qd_Move(_self, _args) |
| 824 | PyObject *_self; |
| 825 | PyObject *_args; |
| 826 | { |
| 827 | PyObject *_res = NULL; |
| 828 | short dh; |
| 829 | short dv; |
| 830 | if (!PyArg_ParseTuple(_args, "hh", |
| 831 | &dh, |
| 832 | &dv)) |
| 833 | return NULL; |
| 834 | Move(dh, |
| 835 | dv); |
| 836 | Py_INCREF(Py_None); |
| 837 | _res = Py_None; |
| 838 | return _res; |
| 839 | } |
| 840 | |
| 841 | static PyObject *Qd_LineTo(_self, _args) |
| 842 | PyObject *_self; |
| 843 | PyObject *_args; |
| 844 | { |
| 845 | PyObject *_res = NULL; |
| 846 | short h; |
| 847 | short v; |
| 848 | if (!PyArg_ParseTuple(_args, "hh", |
| 849 | &h, |
| 850 | &v)) |
| 851 | return NULL; |
| 852 | LineTo(h, |
| 853 | v); |
| 854 | Py_INCREF(Py_None); |
| 855 | _res = Py_None; |
| 856 | return _res; |
| 857 | } |
| 858 | |
| 859 | static PyObject *Qd_Line(_self, _args) |
| 860 | PyObject *_self; |
| 861 | PyObject *_args; |
| 862 | { |
| 863 | PyObject *_res = NULL; |
| 864 | short dh; |
| 865 | short dv; |
| 866 | if (!PyArg_ParseTuple(_args, "hh", |
| 867 | &dh, |
| 868 | &dv)) |
| 869 | return NULL; |
| 870 | Line(dh, |
| 871 | dv); |
| 872 | Py_INCREF(Py_None); |
| 873 | _res = Py_None; |
| 874 | return _res; |
| 875 | } |
| 876 | |
Guido van Rossum | e56db43 | 1995-03-19 22:49:50 +0000 | [diff] [blame] | 877 | static PyObject *Qd_ForeColor(_self, _args) |
| 878 | PyObject *_self; |
| 879 | PyObject *_args; |
| 880 | { |
| 881 | PyObject *_res = NULL; |
| 882 | long color; |
| 883 | if (!PyArg_ParseTuple(_args, "l", |
| 884 | &color)) |
| 885 | return NULL; |
| 886 | ForeColor(color); |
| 887 | Py_INCREF(Py_None); |
| 888 | _res = Py_None; |
| 889 | return _res; |
| 890 | } |
| 891 | |
| 892 | static PyObject *Qd_BackColor(_self, _args) |
| 893 | PyObject *_self; |
| 894 | PyObject *_args; |
| 895 | { |
| 896 | PyObject *_res = NULL; |
| 897 | long color; |
| 898 | if (!PyArg_ParseTuple(_args, "l", |
| 899 | &color)) |
| 900 | return NULL; |
| 901 | BackColor(color); |
| 902 | Py_INCREF(Py_None); |
| 903 | _res = Py_None; |
| 904 | return _res; |
| 905 | } |
| 906 | |
| 907 | static PyObject *Qd_ColorBit(_self, _args) |
| 908 | PyObject *_self; |
| 909 | PyObject *_args; |
| 910 | { |
| 911 | PyObject *_res = NULL; |
| 912 | short whichBit; |
| 913 | if (!PyArg_ParseTuple(_args, "h", |
| 914 | &whichBit)) |
| 915 | return NULL; |
| 916 | ColorBit(whichBit); |
| 917 | Py_INCREF(Py_None); |
| 918 | _res = Py_None; |
| 919 | return _res; |
| 920 | } |
| 921 | |
| 922 | static PyObject *Qd_SetRect(_self, _args) |
| 923 | PyObject *_self; |
| 924 | PyObject *_args; |
| 925 | { |
| 926 | PyObject *_res = NULL; |
| 927 | Rect r; |
| 928 | short left; |
| 929 | short top; |
| 930 | short right; |
| 931 | short bottom; |
| 932 | if (!PyArg_ParseTuple(_args, "hhhh", |
| 933 | &left, |
| 934 | &top, |
| 935 | &right, |
| 936 | &bottom)) |
| 937 | return NULL; |
| 938 | SetRect(&r, |
| 939 | left, |
| 940 | top, |
| 941 | right, |
| 942 | bottom); |
| 943 | _res = Py_BuildValue("O&", |
| 944 | PyMac_BuildRect, &r); |
| 945 | return _res; |
| 946 | } |
| 947 | |
| 948 | static PyObject *Qd_OffsetRect(_self, _args) |
| 949 | PyObject *_self; |
| 950 | PyObject *_args; |
| 951 | { |
| 952 | PyObject *_res = NULL; |
| 953 | Rect r; |
| 954 | short dh; |
| 955 | short dv; |
Jack Jansen | 54c8f7e | 1995-11-14 10:46:01 +0000 | [diff] [blame] | 956 | if (!PyArg_ParseTuple(_args, "O&hh", |
| 957 | PyMac_GetRect, &r, |
Guido van Rossum | e56db43 | 1995-03-19 22:49:50 +0000 | [diff] [blame] | 958 | &dh, |
| 959 | &dv)) |
| 960 | return NULL; |
| 961 | OffsetRect(&r, |
| 962 | dh, |
| 963 | dv); |
| 964 | _res = Py_BuildValue("O&", |
| 965 | PyMac_BuildRect, &r); |
| 966 | return _res; |
| 967 | } |
| 968 | |
| 969 | static PyObject *Qd_InsetRect(_self, _args) |
| 970 | PyObject *_self; |
| 971 | PyObject *_args; |
| 972 | { |
| 973 | PyObject *_res = NULL; |
| 974 | Rect r; |
| 975 | short dh; |
| 976 | short dv; |
Jack Jansen | 54c8f7e | 1995-11-14 10:46:01 +0000 | [diff] [blame] | 977 | if (!PyArg_ParseTuple(_args, "O&hh", |
| 978 | PyMac_GetRect, &r, |
Guido van Rossum | e56db43 | 1995-03-19 22:49:50 +0000 | [diff] [blame] | 979 | &dh, |
| 980 | &dv)) |
| 981 | return NULL; |
| 982 | InsetRect(&r, |
| 983 | dh, |
| 984 | dv); |
| 985 | _res = Py_BuildValue("O&", |
| 986 | PyMac_BuildRect, &r); |
| 987 | return _res; |
| 988 | } |
| 989 | |
| 990 | static PyObject *Qd_SectRect(_self, _args) |
| 991 | PyObject *_self; |
| 992 | PyObject *_args; |
| 993 | { |
| 994 | PyObject *_res = NULL; |
| 995 | Boolean _rv; |
| 996 | Rect src1; |
| 997 | Rect src2; |
| 998 | Rect dstRect; |
| 999 | if (!PyArg_ParseTuple(_args, "O&O&", |
| 1000 | PyMac_GetRect, &src1, |
| 1001 | PyMac_GetRect, &src2)) |
| 1002 | return NULL; |
| 1003 | _rv = SectRect(&src1, |
| 1004 | &src2, |
| 1005 | &dstRect); |
| 1006 | _res = Py_BuildValue("bO&", |
| 1007 | _rv, |
| 1008 | PyMac_BuildRect, &dstRect); |
| 1009 | return _res; |
| 1010 | } |
| 1011 | |
| 1012 | static PyObject *Qd_UnionRect(_self, _args) |
| 1013 | PyObject *_self; |
| 1014 | PyObject *_args; |
| 1015 | { |
| 1016 | PyObject *_res = NULL; |
| 1017 | Rect src1; |
| 1018 | Rect src2; |
| 1019 | Rect dstRect; |
| 1020 | if (!PyArg_ParseTuple(_args, "O&O&", |
| 1021 | PyMac_GetRect, &src1, |
| 1022 | PyMac_GetRect, &src2)) |
| 1023 | return NULL; |
| 1024 | UnionRect(&src1, |
| 1025 | &src2, |
| 1026 | &dstRect); |
| 1027 | _res = Py_BuildValue("O&", |
| 1028 | PyMac_BuildRect, &dstRect); |
| 1029 | return _res; |
| 1030 | } |
| 1031 | |
| 1032 | static PyObject *Qd_EqualRect(_self, _args) |
| 1033 | PyObject *_self; |
| 1034 | PyObject *_args; |
| 1035 | { |
| 1036 | PyObject *_res = NULL; |
| 1037 | Boolean _rv; |
| 1038 | Rect rect1; |
| 1039 | Rect rect2; |
| 1040 | if (!PyArg_ParseTuple(_args, "O&O&", |
| 1041 | PyMac_GetRect, &rect1, |
| 1042 | PyMac_GetRect, &rect2)) |
| 1043 | return NULL; |
| 1044 | _rv = EqualRect(&rect1, |
| 1045 | &rect2); |
| 1046 | _res = Py_BuildValue("b", |
| 1047 | _rv); |
| 1048 | return _res; |
| 1049 | } |
| 1050 | |
| 1051 | static PyObject *Qd_EmptyRect(_self, _args) |
| 1052 | PyObject *_self; |
| 1053 | PyObject *_args; |
| 1054 | { |
| 1055 | PyObject *_res = NULL; |
| 1056 | Boolean _rv; |
| 1057 | Rect r; |
| 1058 | if (!PyArg_ParseTuple(_args, "O&", |
| 1059 | PyMac_GetRect, &r)) |
| 1060 | return NULL; |
| 1061 | _rv = EmptyRect(&r); |
| 1062 | _res = Py_BuildValue("b", |
| 1063 | _rv); |
| 1064 | return _res; |
| 1065 | } |
| 1066 | |
| 1067 | static PyObject *Qd_FrameRect(_self, _args) |
| 1068 | PyObject *_self; |
| 1069 | PyObject *_args; |
| 1070 | { |
| 1071 | PyObject *_res = NULL; |
| 1072 | Rect r; |
| 1073 | if (!PyArg_ParseTuple(_args, "O&", |
| 1074 | PyMac_GetRect, &r)) |
| 1075 | return NULL; |
| 1076 | FrameRect(&r); |
| 1077 | Py_INCREF(Py_None); |
| 1078 | _res = Py_None; |
| 1079 | return _res; |
| 1080 | } |
| 1081 | |
| 1082 | static PyObject *Qd_PaintRect(_self, _args) |
| 1083 | PyObject *_self; |
| 1084 | PyObject *_args; |
| 1085 | { |
| 1086 | PyObject *_res = NULL; |
| 1087 | Rect r; |
| 1088 | if (!PyArg_ParseTuple(_args, "O&", |
| 1089 | PyMac_GetRect, &r)) |
| 1090 | return NULL; |
| 1091 | PaintRect(&r); |
| 1092 | Py_INCREF(Py_None); |
| 1093 | _res = Py_None; |
| 1094 | return _res; |
| 1095 | } |
| 1096 | |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 1097 | static PyObject *Qd_EraseRect(_self, _args) |
| 1098 | PyObject *_self; |
| 1099 | PyObject *_args; |
| 1100 | { |
| 1101 | PyObject *_res = NULL; |
| 1102 | Rect r; |
| 1103 | if (!PyArg_ParseTuple(_args, "O&", |
| 1104 | PyMac_GetRect, &r)) |
| 1105 | return NULL; |
| 1106 | EraseRect(&r); |
| 1107 | Py_INCREF(Py_None); |
| 1108 | _res = Py_None; |
| 1109 | return _res; |
| 1110 | } |
| 1111 | |
Guido van Rossum | e56db43 | 1995-03-19 22:49:50 +0000 | [diff] [blame] | 1112 | static PyObject *Qd_InvertRect(_self, _args) |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 1113 | PyObject *_self; |
| 1114 | PyObject *_args; |
| 1115 | { |
| 1116 | PyObject *_res = NULL; |
Guido van Rossum | e56db43 | 1995-03-19 22:49:50 +0000 | [diff] [blame] | 1117 | Rect r; |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 1118 | if (!PyArg_ParseTuple(_args, "O&", |
Guido van Rossum | e56db43 | 1995-03-19 22:49:50 +0000 | [diff] [blame] | 1119 | PyMac_GetRect, &r)) |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 1120 | return NULL; |
Guido van Rossum | e56db43 | 1995-03-19 22:49:50 +0000 | [diff] [blame] | 1121 | InvertRect(&r); |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 1122 | Py_INCREF(Py_None); |
| 1123 | _res = Py_None; |
| 1124 | return _res; |
| 1125 | } |
| 1126 | |
Jack Jansen | 04a02e7 | 1996-01-06 17:12:58 +0000 | [diff] [blame] | 1127 | static PyObject *Qd_FillRect(_self, _args) |
| 1128 | PyObject *_self; |
| 1129 | PyObject *_args; |
| 1130 | { |
| 1131 | PyObject *_res = NULL; |
| 1132 | Rect r; |
| 1133 | Pattern *pat__in__; |
| 1134 | int pat__in_len__; |
| 1135 | if (!PyArg_ParseTuple(_args, "O&s#", |
| 1136 | PyMac_GetRect, &r, |
| 1137 | (char **)&pat__in__, &pat__in_len__)) |
| 1138 | return NULL; |
| 1139 | if (pat__in_len__ != sizeof(Pattern)) |
| 1140 | { |
| 1141 | PyErr_SetString(PyExc_TypeError, "buffer length should be sizeof(Pattern)"); |
| 1142 | goto pat__error__; |
| 1143 | } |
| 1144 | FillRect(&r, |
| 1145 | pat__in__); |
| 1146 | Py_INCREF(Py_None); |
| 1147 | _res = Py_None; |
| 1148 | pat__error__: ; |
| 1149 | return _res; |
| 1150 | } |
| 1151 | |
Guido van Rossum | e56db43 | 1995-03-19 22:49:50 +0000 | [diff] [blame] | 1152 | static PyObject *Qd_FrameOval(_self, _args) |
| 1153 | PyObject *_self; |
| 1154 | PyObject *_args; |
| 1155 | { |
| 1156 | PyObject *_res = NULL; |
| 1157 | Rect r; |
| 1158 | if (!PyArg_ParseTuple(_args, "O&", |
| 1159 | PyMac_GetRect, &r)) |
| 1160 | return NULL; |
| 1161 | FrameOval(&r); |
| 1162 | Py_INCREF(Py_None); |
| 1163 | _res = Py_None; |
| 1164 | return _res; |
| 1165 | } |
| 1166 | |
| 1167 | static PyObject *Qd_PaintOval(_self, _args) |
| 1168 | PyObject *_self; |
| 1169 | PyObject *_args; |
| 1170 | { |
| 1171 | PyObject *_res = NULL; |
| 1172 | Rect r; |
| 1173 | if (!PyArg_ParseTuple(_args, "O&", |
| 1174 | PyMac_GetRect, &r)) |
| 1175 | return NULL; |
| 1176 | PaintOval(&r); |
| 1177 | Py_INCREF(Py_None); |
| 1178 | _res = Py_None; |
| 1179 | return _res; |
| 1180 | } |
| 1181 | |
| 1182 | static PyObject *Qd_EraseOval(_self, _args) |
| 1183 | PyObject *_self; |
| 1184 | PyObject *_args; |
| 1185 | { |
| 1186 | PyObject *_res = NULL; |
| 1187 | Rect r; |
| 1188 | if (!PyArg_ParseTuple(_args, "O&", |
| 1189 | PyMac_GetRect, &r)) |
| 1190 | return NULL; |
| 1191 | EraseOval(&r); |
| 1192 | Py_INCREF(Py_None); |
| 1193 | _res = Py_None; |
| 1194 | return _res; |
| 1195 | } |
| 1196 | |
| 1197 | static PyObject *Qd_InvertOval(_self, _args) |
| 1198 | PyObject *_self; |
| 1199 | PyObject *_args; |
| 1200 | { |
| 1201 | PyObject *_res = NULL; |
| 1202 | Rect r; |
| 1203 | if (!PyArg_ParseTuple(_args, "O&", |
| 1204 | PyMac_GetRect, &r)) |
| 1205 | return NULL; |
| 1206 | InvertOval(&r); |
| 1207 | Py_INCREF(Py_None); |
| 1208 | _res = Py_None; |
| 1209 | return _res; |
| 1210 | } |
| 1211 | |
Jack Jansen | 04a02e7 | 1996-01-06 17:12:58 +0000 | [diff] [blame] | 1212 | static PyObject *Qd_FillOval(_self, _args) |
| 1213 | PyObject *_self; |
| 1214 | PyObject *_args; |
| 1215 | { |
| 1216 | PyObject *_res = NULL; |
| 1217 | Rect r; |
| 1218 | Pattern *pat__in__; |
| 1219 | int pat__in_len__; |
| 1220 | if (!PyArg_ParseTuple(_args, "O&s#", |
| 1221 | PyMac_GetRect, &r, |
| 1222 | (char **)&pat__in__, &pat__in_len__)) |
| 1223 | return NULL; |
| 1224 | if (pat__in_len__ != sizeof(Pattern)) |
| 1225 | { |
| 1226 | PyErr_SetString(PyExc_TypeError, "buffer length should be sizeof(Pattern)"); |
| 1227 | goto pat__error__; |
| 1228 | } |
| 1229 | FillOval(&r, |
| 1230 | pat__in__); |
| 1231 | Py_INCREF(Py_None); |
| 1232 | _res = Py_None; |
| 1233 | pat__error__: ; |
| 1234 | return _res; |
| 1235 | } |
| 1236 | |
Guido van Rossum | e56db43 | 1995-03-19 22:49:50 +0000 | [diff] [blame] | 1237 | static PyObject *Qd_FrameRoundRect(_self, _args) |
| 1238 | PyObject *_self; |
| 1239 | PyObject *_args; |
| 1240 | { |
| 1241 | PyObject *_res = NULL; |
| 1242 | Rect r; |
| 1243 | short ovalWidth; |
| 1244 | short ovalHeight; |
| 1245 | if (!PyArg_ParseTuple(_args, "O&hh", |
| 1246 | PyMac_GetRect, &r, |
| 1247 | &ovalWidth, |
| 1248 | &ovalHeight)) |
| 1249 | return NULL; |
| 1250 | FrameRoundRect(&r, |
| 1251 | ovalWidth, |
| 1252 | ovalHeight); |
| 1253 | Py_INCREF(Py_None); |
| 1254 | _res = Py_None; |
| 1255 | return _res; |
| 1256 | } |
| 1257 | |
| 1258 | static PyObject *Qd_PaintRoundRect(_self, _args) |
| 1259 | PyObject *_self; |
| 1260 | PyObject *_args; |
| 1261 | { |
| 1262 | PyObject *_res = NULL; |
| 1263 | Rect r; |
| 1264 | short ovalWidth; |
| 1265 | short ovalHeight; |
| 1266 | if (!PyArg_ParseTuple(_args, "O&hh", |
| 1267 | PyMac_GetRect, &r, |
| 1268 | &ovalWidth, |
| 1269 | &ovalHeight)) |
| 1270 | return NULL; |
| 1271 | PaintRoundRect(&r, |
| 1272 | ovalWidth, |
| 1273 | ovalHeight); |
| 1274 | Py_INCREF(Py_None); |
| 1275 | _res = Py_None; |
| 1276 | return _res; |
| 1277 | } |
| 1278 | |
| 1279 | static PyObject *Qd_EraseRoundRect(_self, _args) |
| 1280 | PyObject *_self; |
| 1281 | PyObject *_args; |
| 1282 | { |
| 1283 | PyObject *_res = NULL; |
| 1284 | Rect r; |
| 1285 | short ovalWidth; |
| 1286 | short ovalHeight; |
| 1287 | if (!PyArg_ParseTuple(_args, "O&hh", |
| 1288 | PyMac_GetRect, &r, |
| 1289 | &ovalWidth, |
| 1290 | &ovalHeight)) |
| 1291 | return NULL; |
| 1292 | EraseRoundRect(&r, |
| 1293 | ovalWidth, |
| 1294 | ovalHeight); |
| 1295 | Py_INCREF(Py_None); |
| 1296 | _res = Py_None; |
| 1297 | return _res; |
| 1298 | } |
| 1299 | |
| 1300 | static PyObject *Qd_InvertRoundRect(_self, _args) |
| 1301 | PyObject *_self; |
| 1302 | PyObject *_args; |
| 1303 | { |
| 1304 | PyObject *_res = NULL; |
| 1305 | Rect r; |
| 1306 | short ovalWidth; |
| 1307 | short ovalHeight; |
| 1308 | if (!PyArg_ParseTuple(_args, "O&hh", |
| 1309 | PyMac_GetRect, &r, |
| 1310 | &ovalWidth, |
| 1311 | &ovalHeight)) |
| 1312 | return NULL; |
| 1313 | InvertRoundRect(&r, |
| 1314 | ovalWidth, |
| 1315 | ovalHeight); |
| 1316 | Py_INCREF(Py_None); |
| 1317 | _res = Py_None; |
| 1318 | return _res; |
| 1319 | } |
| 1320 | |
Jack Jansen | 04a02e7 | 1996-01-06 17:12:58 +0000 | [diff] [blame] | 1321 | static PyObject *Qd_FillRoundRect(_self, _args) |
| 1322 | PyObject *_self; |
| 1323 | PyObject *_args; |
| 1324 | { |
| 1325 | PyObject *_res = NULL; |
| 1326 | Rect r; |
| 1327 | short ovalWidth; |
| 1328 | short ovalHeight; |
| 1329 | Pattern *pat__in__; |
| 1330 | int pat__in_len__; |
| 1331 | if (!PyArg_ParseTuple(_args, "O&hhs#", |
| 1332 | PyMac_GetRect, &r, |
| 1333 | &ovalWidth, |
| 1334 | &ovalHeight, |
| 1335 | (char **)&pat__in__, &pat__in_len__)) |
| 1336 | return NULL; |
| 1337 | if (pat__in_len__ != sizeof(Pattern)) |
| 1338 | { |
| 1339 | PyErr_SetString(PyExc_TypeError, "buffer length should be sizeof(Pattern)"); |
| 1340 | goto pat__error__; |
| 1341 | } |
| 1342 | FillRoundRect(&r, |
| 1343 | ovalWidth, |
| 1344 | ovalHeight, |
| 1345 | pat__in__); |
| 1346 | Py_INCREF(Py_None); |
| 1347 | _res = Py_None; |
| 1348 | pat__error__: ; |
| 1349 | return _res; |
| 1350 | } |
| 1351 | |
Guido van Rossum | e56db43 | 1995-03-19 22:49:50 +0000 | [diff] [blame] | 1352 | static PyObject *Qd_FrameArc(_self, _args) |
| 1353 | PyObject *_self; |
| 1354 | PyObject *_args; |
| 1355 | { |
| 1356 | PyObject *_res = NULL; |
| 1357 | Rect r; |
| 1358 | short startAngle; |
| 1359 | short arcAngle; |
| 1360 | if (!PyArg_ParseTuple(_args, "O&hh", |
| 1361 | PyMac_GetRect, &r, |
| 1362 | &startAngle, |
| 1363 | &arcAngle)) |
| 1364 | return NULL; |
| 1365 | FrameArc(&r, |
| 1366 | startAngle, |
| 1367 | arcAngle); |
| 1368 | Py_INCREF(Py_None); |
| 1369 | _res = Py_None; |
| 1370 | return _res; |
| 1371 | } |
| 1372 | |
| 1373 | static PyObject *Qd_PaintArc(_self, _args) |
| 1374 | PyObject *_self; |
| 1375 | PyObject *_args; |
| 1376 | { |
| 1377 | PyObject *_res = NULL; |
| 1378 | Rect r; |
| 1379 | short startAngle; |
| 1380 | short arcAngle; |
| 1381 | if (!PyArg_ParseTuple(_args, "O&hh", |
| 1382 | PyMac_GetRect, &r, |
| 1383 | &startAngle, |
| 1384 | &arcAngle)) |
| 1385 | return NULL; |
| 1386 | PaintArc(&r, |
| 1387 | startAngle, |
| 1388 | arcAngle); |
| 1389 | Py_INCREF(Py_None); |
| 1390 | _res = Py_None; |
| 1391 | return _res; |
| 1392 | } |
| 1393 | |
| 1394 | static PyObject *Qd_EraseArc(_self, _args) |
| 1395 | PyObject *_self; |
| 1396 | PyObject *_args; |
| 1397 | { |
| 1398 | PyObject *_res = NULL; |
| 1399 | Rect r; |
| 1400 | short startAngle; |
| 1401 | short arcAngle; |
| 1402 | if (!PyArg_ParseTuple(_args, "O&hh", |
| 1403 | PyMac_GetRect, &r, |
| 1404 | &startAngle, |
| 1405 | &arcAngle)) |
| 1406 | return NULL; |
| 1407 | EraseArc(&r, |
| 1408 | startAngle, |
| 1409 | arcAngle); |
| 1410 | Py_INCREF(Py_None); |
| 1411 | _res = Py_None; |
| 1412 | return _res; |
| 1413 | } |
| 1414 | |
| 1415 | static PyObject *Qd_InvertArc(_self, _args) |
| 1416 | PyObject *_self; |
| 1417 | PyObject *_args; |
| 1418 | { |
| 1419 | PyObject *_res = NULL; |
| 1420 | Rect r; |
| 1421 | short startAngle; |
| 1422 | short arcAngle; |
| 1423 | if (!PyArg_ParseTuple(_args, "O&hh", |
| 1424 | PyMac_GetRect, &r, |
| 1425 | &startAngle, |
| 1426 | &arcAngle)) |
| 1427 | return NULL; |
| 1428 | InvertArc(&r, |
| 1429 | startAngle, |
| 1430 | arcAngle); |
| 1431 | Py_INCREF(Py_None); |
| 1432 | _res = Py_None; |
| 1433 | return _res; |
| 1434 | } |
| 1435 | |
Jack Jansen | 04a02e7 | 1996-01-06 17:12:58 +0000 | [diff] [blame] | 1436 | static PyObject *Qd_FillArc(_self, _args) |
| 1437 | PyObject *_self; |
| 1438 | PyObject *_args; |
| 1439 | { |
| 1440 | PyObject *_res = NULL; |
| 1441 | Rect r; |
| 1442 | short startAngle; |
| 1443 | short arcAngle; |
| 1444 | Pattern *pat__in__; |
| 1445 | int pat__in_len__; |
| 1446 | if (!PyArg_ParseTuple(_args, "O&hhs#", |
| 1447 | PyMac_GetRect, &r, |
| 1448 | &startAngle, |
| 1449 | &arcAngle, |
| 1450 | (char **)&pat__in__, &pat__in_len__)) |
| 1451 | return NULL; |
| 1452 | if (pat__in_len__ != sizeof(Pattern)) |
| 1453 | { |
| 1454 | PyErr_SetString(PyExc_TypeError, "buffer length should be sizeof(Pattern)"); |
| 1455 | goto pat__error__; |
| 1456 | } |
| 1457 | FillArc(&r, |
| 1458 | startAngle, |
| 1459 | arcAngle, |
| 1460 | pat__in__); |
| 1461 | Py_INCREF(Py_None); |
| 1462 | _res = Py_None; |
| 1463 | pat__error__: ; |
| 1464 | return _res; |
| 1465 | } |
| 1466 | |
Guido van Rossum | e56db43 | 1995-03-19 22:49:50 +0000 | [diff] [blame] | 1467 | static PyObject *Qd_NewRgn(_self, _args) |
| 1468 | PyObject *_self; |
| 1469 | PyObject *_args; |
| 1470 | { |
| 1471 | PyObject *_res = NULL; |
| 1472 | RgnHandle _rv; |
| 1473 | if (!PyArg_ParseTuple(_args, "")) |
| 1474 | return NULL; |
| 1475 | _rv = NewRgn(); |
| 1476 | _res = Py_BuildValue("O&", |
| 1477 | ResObj_New, _rv); |
| 1478 | return _res; |
| 1479 | } |
| 1480 | |
| 1481 | static PyObject *Qd_OpenRgn(_self, _args) |
| 1482 | PyObject *_self; |
| 1483 | PyObject *_args; |
| 1484 | { |
| 1485 | PyObject *_res = NULL; |
| 1486 | if (!PyArg_ParseTuple(_args, "")) |
| 1487 | return NULL; |
| 1488 | OpenRgn(); |
| 1489 | Py_INCREF(Py_None); |
| 1490 | _res = Py_None; |
| 1491 | return _res; |
| 1492 | } |
| 1493 | |
| 1494 | static PyObject *Qd_CloseRgn(_self, _args) |
| 1495 | PyObject *_self; |
| 1496 | PyObject *_args; |
| 1497 | { |
| 1498 | PyObject *_res = NULL; |
| 1499 | RgnHandle dstRgn; |
| 1500 | if (!PyArg_ParseTuple(_args, "O&", |
| 1501 | ResObj_Convert, &dstRgn)) |
| 1502 | return NULL; |
| 1503 | CloseRgn(dstRgn); |
| 1504 | Py_INCREF(Py_None); |
| 1505 | _res = Py_None; |
| 1506 | return _res; |
| 1507 | } |
| 1508 | |
Jack Jansen | 41058c0 | 1995-11-16 22:48:29 +0000 | [diff] [blame] | 1509 | static PyObject *Qd_BitMapToRegion(_self, _args) |
| 1510 | PyObject *_self; |
| 1511 | PyObject *_args; |
| 1512 | { |
| 1513 | PyObject *_res = NULL; |
| 1514 | OSErr _err; |
| 1515 | RgnHandle region; |
| 1516 | BitMapPtr bMap; |
| 1517 | if (!PyArg_ParseTuple(_args, "O&O&", |
| 1518 | ResObj_Convert, ®ion, |
| 1519 | BMObj_Convert, &bMap)) |
| 1520 | return NULL; |
| 1521 | _err = BitMapToRegion(region, |
| 1522 | bMap); |
| 1523 | if (_err != noErr) return PyMac_Error(_err); |
| 1524 | Py_INCREF(Py_None); |
| 1525 | _res = Py_None; |
| 1526 | return _res; |
| 1527 | } |
| 1528 | |
Guido van Rossum | e56db43 | 1995-03-19 22:49:50 +0000 | [diff] [blame] | 1529 | static PyObject *Qd_DisposeRgn(_self, _args) |
| 1530 | PyObject *_self; |
| 1531 | PyObject *_args; |
| 1532 | { |
| 1533 | PyObject *_res = NULL; |
| 1534 | RgnHandle rgn; |
| 1535 | if (!PyArg_ParseTuple(_args, "O&", |
| 1536 | ResObj_Convert, &rgn)) |
| 1537 | return NULL; |
| 1538 | DisposeRgn(rgn); |
| 1539 | Py_INCREF(Py_None); |
| 1540 | _res = Py_None; |
| 1541 | return _res; |
| 1542 | } |
| 1543 | |
| 1544 | static PyObject *Qd_CopyRgn(_self, _args) |
| 1545 | PyObject *_self; |
| 1546 | PyObject *_args; |
| 1547 | { |
| 1548 | PyObject *_res = NULL; |
| 1549 | RgnHandle srcRgn; |
| 1550 | RgnHandle dstRgn; |
| 1551 | if (!PyArg_ParseTuple(_args, "O&O&", |
| 1552 | ResObj_Convert, &srcRgn, |
| 1553 | ResObj_Convert, &dstRgn)) |
| 1554 | return NULL; |
| 1555 | CopyRgn(srcRgn, |
| 1556 | dstRgn); |
| 1557 | Py_INCREF(Py_None); |
| 1558 | _res = Py_None; |
| 1559 | return _res; |
| 1560 | } |
| 1561 | |
| 1562 | static PyObject *Qd_SetEmptyRgn(_self, _args) |
| 1563 | PyObject *_self; |
| 1564 | PyObject *_args; |
| 1565 | { |
| 1566 | PyObject *_res = NULL; |
| 1567 | RgnHandle rgn; |
| 1568 | if (!PyArg_ParseTuple(_args, "O&", |
| 1569 | ResObj_Convert, &rgn)) |
| 1570 | return NULL; |
| 1571 | SetEmptyRgn(rgn); |
| 1572 | Py_INCREF(Py_None); |
| 1573 | _res = Py_None; |
| 1574 | return _res; |
| 1575 | } |
| 1576 | |
| 1577 | static PyObject *Qd_SetRectRgn(_self, _args) |
| 1578 | PyObject *_self; |
| 1579 | PyObject *_args; |
| 1580 | { |
| 1581 | PyObject *_res = NULL; |
| 1582 | RgnHandle rgn; |
| 1583 | short left; |
| 1584 | short top; |
| 1585 | short right; |
| 1586 | short bottom; |
| 1587 | if (!PyArg_ParseTuple(_args, "O&hhhh", |
| 1588 | ResObj_Convert, &rgn, |
| 1589 | &left, |
| 1590 | &top, |
| 1591 | &right, |
| 1592 | &bottom)) |
| 1593 | return NULL; |
| 1594 | SetRectRgn(rgn, |
| 1595 | left, |
| 1596 | top, |
| 1597 | right, |
| 1598 | bottom); |
| 1599 | Py_INCREF(Py_None); |
| 1600 | _res = Py_None; |
| 1601 | return _res; |
| 1602 | } |
| 1603 | |
| 1604 | static PyObject *Qd_RectRgn(_self, _args) |
| 1605 | PyObject *_self; |
| 1606 | PyObject *_args; |
| 1607 | { |
| 1608 | PyObject *_res = NULL; |
| 1609 | RgnHandle rgn; |
| 1610 | Rect r; |
| 1611 | if (!PyArg_ParseTuple(_args, "O&O&", |
| 1612 | ResObj_Convert, &rgn, |
| 1613 | PyMac_GetRect, &r)) |
| 1614 | return NULL; |
| 1615 | RectRgn(rgn, |
| 1616 | &r); |
| 1617 | Py_INCREF(Py_None); |
| 1618 | _res = Py_None; |
| 1619 | return _res; |
| 1620 | } |
| 1621 | |
| 1622 | static PyObject *Qd_OffsetRgn(_self, _args) |
| 1623 | PyObject *_self; |
| 1624 | PyObject *_args; |
| 1625 | { |
| 1626 | PyObject *_res = NULL; |
| 1627 | RgnHandle rgn; |
| 1628 | short dh; |
| 1629 | short dv; |
| 1630 | if (!PyArg_ParseTuple(_args, "O&hh", |
| 1631 | ResObj_Convert, &rgn, |
| 1632 | &dh, |
| 1633 | &dv)) |
| 1634 | return NULL; |
| 1635 | OffsetRgn(rgn, |
| 1636 | dh, |
| 1637 | dv); |
| 1638 | Py_INCREF(Py_None); |
| 1639 | _res = Py_None; |
| 1640 | return _res; |
| 1641 | } |
| 1642 | |
| 1643 | static PyObject *Qd_InsetRgn(_self, _args) |
| 1644 | PyObject *_self; |
| 1645 | PyObject *_args; |
| 1646 | { |
| 1647 | PyObject *_res = NULL; |
| 1648 | RgnHandle rgn; |
| 1649 | short dh; |
| 1650 | short dv; |
| 1651 | if (!PyArg_ParseTuple(_args, "O&hh", |
| 1652 | ResObj_Convert, &rgn, |
| 1653 | &dh, |
| 1654 | &dv)) |
| 1655 | return NULL; |
| 1656 | InsetRgn(rgn, |
| 1657 | dh, |
| 1658 | dv); |
| 1659 | Py_INCREF(Py_None); |
| 1660 | _res = Py_None; |
| 1661 | return _res; |
| 1662 | } |
| 1663 | |
| 1664 | static PyObject *Qd_SectRgn(_self, _args) |
| 1665 | PyObject *_self; |
| 1666 | PyObject *_args; |
| 1667 | { |
| 1668 | PyObject *_res = NULL; |
| 1669 | RgnHandle srcRgnA; |
| 1670 | RgnHandle srcRgnB; |
| 1671 | RgnHandle dstRgn; |
| 1672 | if (!PyArg_ParseTuple(_args, "O&O&O&", |
| 1673 | ResObj_Convert, &srcRgnA, |
| 1674 | ResObj_Convert, &srcRgnB, |
| 1675 | ResObj_Convert, &dstRgn)) |
| 1676 | return NULL; |
| 1677 | SectRgn(srcRgnA, |
| 1678 | srcRgnB, |
| 1679 | dstRgn); |
| 1680 | Py_INCREF(Py_None); |
| 1681 | _res = Py_None; |
| 1682 | return _res; |
| 1683 | } |
| 1684 | |
| 1685 | static PyObject *Qd_UnionRgn(_self, _args) |
| 1686 | PyObject *_self; |
| 1687 | PyObject *_args; |
| 1688 | { |
| 1689 | PyObject *_res = NULL; |
| 1690 | RgnHandle srcRgnA; |
| 1691 | RgnHandle srcRgnB; |
| 1692 | RgnHandle dstRgn; |
| 1693 | if (!PyArg_ParseTuple(_args, "O&O&O&", |
| 1694 | ResObj_Convert, &srcRgnA, |
| 1695 | ResObj_Convert, &srcRgnB, |
| 1696 | ResObj_Convert, &dstRgn)) |
| 1697 | return NULL; |
| 1698 | UnionRgn(srcRgnA, |
| 1699 | srcRgnB, |
| 1700 | dstRgn); |
| 1701 | Py_INCREF(Py_None); |
| 1702 | _res = Py_None; |
| 1703 | return _res; |
| 1704 | } |
| 1705 | |
| 1706 | static PyObject *Qd_DiffRgn(_self, _args) |
| 1707 | PyObject *_self; |
| 1708 | PyObject *_args; |
| 1709 | { |
| 1710 | PyObject *_res = NULL; |
| 1711 | RgnHandle srcRgnA; |
| 1712 | RgnHandle srcRgnB; |
| 1713 | RgnHandle dstRgn; |
| 1714 | if (!PyArg_ParseTuple(_args, "O&O&O&", |
| 1715 | ResObj_Convert, &srcRgnA, |
| 1716 | ResObj_Convert, &srcRgnB, |
| 1717 | ResObj_Convert, &dstRgn)) |
| 1718 | return NULL; |
| 1719 | DiffRgn(srcRgnA, |
| 1720 | srcRgnB, |
| 1721 | dstRgn); |
| 1722 | Py_INCREF(Py_None); |
| 1723 | _res = Py_None; |
| 1724 | return _res; |
| 1725 | } |
| 1726 | |
| 1727 | static PyObject *Qd_XorRgn(_self, _args) |
| 1728 | PyObject *_self; |
| 1729 | PyObject *_args; |
| 1730 | { |
| 1731 | PyObject *_res = NULL; |
| 1732 | RgnHandle srcRgnA; |
| 1733 | RgnHandle srcRgnB; |
| 1734 | RgnHandle dstRgn; |
| 1735 | if (!PyArg_ParseTuple(_args, "O&O&O&", |
| 1736 | ResObj_Convert, &srcRgnA, |
| 1737 | ResObj_Convert, &srcRgnB, |
| 1738 | ResObj_Convert, &dstRgn)) |
| 1739 | return NULL; |
| 1740 | XorRgn(srcRgnA, |
| 1741 | srcRgnB, |
| 1742 | dstRgn); |
| 1743 | Py_INCREF(Py_None); |
| 1744 | _res = Py_None; |
| 1745 | return _res; |
| 1746 | } |
| 1747 | |
| 1748 | static PyObject *Qd_RectInRgn(_self, _args) |
| 1749 | PyObject *_self; |
| 1750 | PyObject *_args; |
| 1751 | { |
| 1752 | PyObject *_res = NULL; |
| 1753 | Boolean _rv; |
| 1754 | Rect r; |
| 1755 | RgnHandle rgn; |
| 1756 | if (!PyArg_ParseTuple(_args, "O&O&", |
| 1757 | PyMac_GetRect, &r, |
| 1758 | ResObj_Convert, &rgn)) |
| 1759 | return NULL; |
| 1760 | _rv = RectInRgn(&r, |
| 1761 | rgn); |
| 1762 | _res = Py_BuildValue("b", |
| 1763 | _rv); |
| 1764 | return _res; |
| 1765 | } |
| 1766 | |
| 1767 | static PyObject *Qd_EqualRgn(_self, _args) |
| 1768 | PyObject *_self; |
| 1769 | PyObject *_args; |
| 1770 | { |
| 1771 | PyObject *_res = NULL; |
| 1772 | Boolean _rv; |
| 1773 | RgnHandle rgnA; |
| 1774 | RgnHandle rgnB; |
| 1775 | if (!PyArg_ParseTuple(_args, "O&O&", |
| 1776 | ResObj_Convert, &rgnA, |
| 1777 | ResObj_Convert, &rgnB)) |
| 1778 | return NULL; |
| 1779 | _rv = EqualRgn(rgnA, |
| 1780 | rgnB); |
| 1781 | _res = Py_BuildValue("b", |
| 1782 | _rv); |
| 1783 | return _res; |
| 1784 | } |
| 1785 | |
| 1786 | static PyObject *Qd_EmptyRgn(_self, _args) |
| 1787 | PyObject *_self; |
| 1788 | PyObject *_args; |
| 1789 | { |
| 1790 | PyObject *_res = NULL; |
| 1791 | Boolean _rv; |
| 1792 | RgnHandle rgn; |
| 1793 | if (!PyArg_ParseTuple(_args, "O&", |
| 1794 | ResObj_Convert, &rgn)) |
| 1795 | return NULL; |
| 1796 | _rv = EmptyRgn(rgn); |
| 1797 | _res = Py_BuildValue("b", |
| 1798 | _rv); |
| 1799 | return _res; |
| 1800 | } |
| 1801 | |
| 1802 | static PyObject *Qd_FrameRgn(_self, _args) |
| 1803 | PyObject *_self; |
| 1804 | PyObject *_args; |
| 1805 | { |
| 1806 | PyObject *_res = NULL; |
| 1807 | RgnHandle rgn; |
| 1808 | if (!PyArg_ParseTuple(_args, "O&", |
| 1809 | ResObj_Convert, &rgn)) |
| 1810 | return NULL; |
| 1811 | FrameRgn(rgn); |
| 1812 | Py_INCREF(Py_None); |
| 1813 | _res = Py_None; |
| 1814 | return _res; |
| 1815 | } |
| 1816 | |
| 1817 | static PyObject *Qd_PaintRgn(_self, _args) |
| 1818 | PyObject *_self; |
| 1819 | PyObject *_args; |
| 1820 | { |
| 1821 | PyObject *_res = NULL; |
| 1822 | RgnHandle rgn; |
| 1823 | if (!PyArg_ParseTuple(_args, "O&", |
| 1824 | ResObj_Convert, &rgn)) |
| 1825 | return NULL; |
| 1826 | PaintRgn(rgn); |
| 1827 | Py_INCREF(Py_None); |
| 1828 | _res = Py_None; |
| 1829 | return _res; |
| 1830 | } |
| 1831 | |
| 1832 | static PyObject *Qd_EraseRgn(_self, _args) |
| 1833 | PyObject *_self; |
| 1834 | PyObject *_args; |
| 1835 | { |
| 1836 | PyObject *_res = NULL; |
| 1837 | RgnHandle rgn; |
| 1838 | if (!PyArg_ParseTuple(_args, "O&", |
| 1839 | ResObj_Convert, &rgn)) |
| 1840 | return NULL; |
| 1841 | EraseRgn(rgn); |
| 1842 | Py_INCREF(Py_None); |
| 1843 | _res = Py_None; |
| 1844 | return _res; |
| 1845 | } |
| 1846 | |
| 1847 | static PyObject *Qd_InvertRgn(_self, _args) |
| 1848 | PyObject *_self; |
| 1849 | PyObject *_args; |
| 1850 | { |
| 1851 | PyObject *_res = NULL; |
| 1852 | RgnHandle rgn; |
| 1853 | if (!PyArg_ParseTuple(_args, "O&", |
| 1854 | ResObj_Convert, &rgn)) |
| 1855 | return NULL; |
| 1856 | InvertRgn(rgn); |
| 1857 | Py_INCREF(Py_None); |
| 1858 | _res = Py_None; |
| 1859 | return _res; |
| 1860 | } |
| 1861 | |
Jack Jansen | 04a02e7 | 1996-01-06 17:12:58 +0000 | [diff] [blame] | 1862 | static PyObject *Qd_FillRgn(_self, _args) |
| 1863 | PyObject *_self; |
| 1864 | PyObject *_args; |
| 1865 | { |
| 1866 | PyObject *_res = NULL; |
| 1867 | RgnHandle rgn; |
| 1868 | Pattern *pat__in__; |
| 1869 | int pat__in_len__; |
| 1870 | if (!PyArg_ParseTuple(_args, "O&s#", |
| 1871 | ResObj_Convert, &rgn, |
| 1872 | (char **)&pat__in__, &pat__in_len__)) |
| 1873 | return NULL; |
| 1874 | if (pat__in_len__ != sizeof(Pattern)) |
| 1875 | { |
| 1876 | PyErr_SetString(PyExc_TypeError, "buffer length should be sizeof(Pattern)"); |
| 1877 | goto pat__error__; |
| 1878 | } |
| 1879 | FillRgn(rgn, |
| 1880 | pat__in__); |
| 1881 | Py_INCREF(Py_None); |
| 1882 | _res = Py_None; |
| 1883 | pat__error__: ; |
| 1884 | return _res; |
| 1885 | } |
| 1886 | |
Guido van Rossum | e56db43 | 1995-03-19 22:49:50 +0000 | [diff] [blame] | 1887 | static PyObject *Qd_ScrollRect(_self, _args) |
| 1888 | PyObject *_self; |
| 1889 | PyObject *_args; |
| 1890 | { |
| 1891 | PyObject *_res = NULL; |
| 1892 | Rect r; |
| 1893 | short dh; |
| 1894 | short dv; |
| 1895 | RgnHandle updateRgn; |
| 1896 | if (!PyArg_ParseTuple(_args, "O&hhO&", |
| 1897 | PyMac_GetRect, &r, |
| 1898 | &dh, |
| 1899 | &dv, |
| 1900 | ResObj_Convert, &updateRgn)) |
| 1901 | return NULL; |
| 1902 | ScrollRect(&r, |
| 1903 | dh, |
| 1904 | dv, |
| 1905 | updateRgn); |
| 1906 | Py_INCREF(Py_None); |
| 1907 | _res = Py_None; |
| 1908 | return _res; |
| 1909 | } |
| 1910 | |
Jack Jansen | 41058c0 | 1995-11-16 22:48:29 +0000 | [diff] [blame] | 1911 | static PyObject *Qd_CopyBits(_self, _args) |
| 1912 | PyObject *_self; |
| 1913 | PyObject *_args; |
| 1914 | { |
| 1915 | PyObject *_res = NULL; |
| 1916 | BitMapPtr srcBits; |
| 1917 | BitMapPtr dstBits; |
| 1918 | Rect srcRect; |
| 1919 | Rect dstRect; |
| 1920 | short mode; |
| 1921 | RgnHandle maskRgn; |
| 1922 | if (!PyArg_ParseTuple(_args, "O&O&O&O&hO&", |
| 1923 | BMObj_Convert, &srcBits, |
| 1924 | BMObj_Convert, &dstBits, |
| 1925 | PyMac_GetRect, &srcRect, |
| 1926 | PyMac_GetRect, &dstRect, |
| 1927 | &mode, |
Jack Jansen | 425e9eb | 1995-12-12 15:02:03 +0000 | [diff] [blame] | 1928 | OptResObj_Convert, &maskRgn)) |
Jack Jansen | 41058c0 | 1995-11-16 22:48:29 +0000 | [diff] [blame] | 1929 | return NULL; |
| 1930 | CopyBits(srcBits, |
| 1931 | dstBits, |
| 1932 | &srcRect, |
| 1933 | &dstRect, |
| 1934 | mode, |
| 1935 | maskRgn); |
| 1936 | Py_INCREF(Py_None); |
| 1937 | _res = Py_None; |
| 1938 | return _res; |
| 1939 | } |
| 1940 | |
| 1941 | static PyObject *Qd_CopyMask(_self, _args) |
| 1942 | PyObject *_self; |
| 1943 | PyObject *_args; |
| 1944 | { |
| 1945 | PyObject *_res = NULL; |
| 1946 | BitMapPtr srcBits; |
| 1947 | BitMapPtr maskBits; |
| 1948 | BitMapPtr dstBits; |
| 1949 | Rect srcRect; |
| 1950 | Rect maskRect; |
| 1951 | Rect dstRect; |
| 1952 | if (!PyArg_ParseTuple(_args, "O&O&O&O&O&O&", |
| 1953 | BMObj_Convert, &srcBits, |
| 1954 | BMObj_Convert, &maskBits, |
| 1955 | BMObj_Convert, &dstBits, |
| 1956 | PyMac_GetRect, &srcRect, |
| 1957 | PyMac_GetRect, &maskRect, |
| 1958 | PyMac_GetRect, &dstRect)) |
| 1959 | return NULL; |
| 1960 | CopyMask(srcBits, |
| 1961 | maskBits, |
| 1962 | dstBits, |
| 1963 | &srcRect, |
| 1964 | &maskRect, |
| 1965 | &dstRect); |
| 1966 | Py_INCREF(Py_None); |
| 1967 | _res = Py_None; |
| 1968 | return _res; |
| 1969 | } |
| 1970 | |
Guido van Rossum | e56db43 | 1995-03-19 22:49:50 +0000 | [diff] [blame] | 1971 | static PyObject *Qd_OpenPicture(_self, _args) |
| 1972 | PyObject *_self; |
| 1973 | PyObject *_args; |
| 1974 | { |
| 1975 | PyObject *_res = NULL; |
| 1976 | PicHandle _rv; |
| 1977 | Rect picFrame; |
| 1978 | if (!PyArg_ParseTuple(_args, "O&", |
| 1979 | PyMac_GetRect, &picFrame)) |
| 1980 | return NULL; |
| 1981 | _rv = OpenPicture(&picFrame); |
| 1982 | _res = Py_BuildValue("O&", |
| 1983 | ResObj_New, _rv); |
| 1984 | return _res; |
| 1985 | } |
| 1986 | |
| 1987 | static PyObject *Qd_PicComment(_self, _args) |
| 1988 | PyObject *_self; |
| 1989 | PyObject *_args; |
| 1990 | { |
| 1991 | PyObject *_res = NULL; |
| 1992 | short kind; |
| 1993 | short dataSize; |
| 1994 | Handle dataHandle; |
| 1995 | if (!PyArg_ParseTuple(_args, "hhO&", |
| 1996 | &kind, |
| 1997 | &dataSize, |
| 1998 | ResObj_Convert, &dataHandle)) |
| 1999 | return NULL; |
| 2000 | PicComment(kind, |
| 2001 | dataSize, |
| 2002 | dataHandle); |
| 2003 | Py_INCREF(Py_None); |
| 2004 | _res = Py_None; |
| 2005 | return _res; |
| 2006 | } |
| 2007 | |
| 2008 | static PyObject *Qd_ClosePicture(_self, _args) |
| 2009 | PyObject *_self; |
| 2010 | PyObject *_args; |
| 2011 | { |
| 2012 | PyObject *_res = NULL; |
| 2013 | if (!PyArg_ParseTuple(_args, "")) |
| 2014 | return NULL; |
| 2015 | ClosePicture(); |
| 2016 | Py_INCREF(Py_None); |
| 2017 | _res = Py_None; |
| 2018 | return _res; |
| 2019 | } |
| 2020 | |
| 2021 | static PyObject *Qd_DrawPicture(_self, _args) |
| 2022 | PyObject *_self; |
| 2023 | PyObject *_args; |
| 2024 | { |
| 2025 | PyObject *_res = NULL; |
| 2026 | PicHandle myPicture; |
| 2027 | Rect dstRect; |
| 2028 | if (!PyArg_ParseTuple(_args, "O&O&", |
| 2029 | ResObj_Convert, &myPicture, |
| 2030 | PyMac_GetRect, &dstRect)) |
| 2031 | return NULL; |
| 2032 | DrawPicture(myPicture, |
| 2033 | &dstRect); |
| 2034 | Py_INCREF(Py_None); |
| 2035 | _res = Py_None; |
| 2036 | return _res; |
| 2037 | } |
| 2038 | |
| 2039 | static PyObject *Qd_KillPicture(_self, _args) |
| 2040 | PyObject *_self; |
| 2041 | PyObject *_args; |
| 2042 | { |
| 2043 | PyObject *_res = NULL; |
| 2044 | PicHandle myPicture; |
| 2045 | if (!PyArg_ParseTuple(_args, "O&", |
| 2046 | ResObj_Convert, &myPicture)) |
| 2047 | return NULL; |
| 2048 | KillPicture(myPicture); |
| 2049 | Py_INCREF(Py_None); |
| 2050 | _res = Py_None; |
| 2051 | return _res; |
| 2052 | } |
| 2053 | |
| 2054 | static PyObject *Qd_OpenPoly(_self, _args) |
| 2055 | PyObject *_self; |
| 2056 | PyObject *_args; |
| 2057 | { |
| 2058 | PyObject *_res = NULL; |
| 2059 | PolyHandle _rv; |
| 2060 | if (!PyArg_ParseTuple(_args, "")) |
| 2061 | return NULL; |
| 2062 | _rv = OpenPoly(); |
| 2063 | _res = Py_BuildValue("O&", |
| 2064 | ResObj_New, _rv); |
| 2065 | return _res; |
| 2066 | } |
| 2067 | |
| 2068 | static PyObject *Qd_ClosePoly(_self, _args) |
| 2069 | PyObject *_self; |
| 2070 | PyObject *_args; |
| 2071 | { |
| 2072 | PyObject *_res = NULL; |
| 2073 | if (!PyArg_ParseTuple(_args, "")) |
| 2074 | return NULL; |
| 2075 | ClosePoly(); |
| 2076 | Py_INCREF(Py_None); |
| 2077 | _res = Py_None; |
| 2078 | return _res; |
| 2079 | } |
| 2080 | |
| 2081 | static PyObject *Qd_KillPoly(_self, _args) |
| 2082 | PyObject *_self; |
| 2083 | PyObject *_args; |
| 2084 | { |
| 2085 | PyObject *_res = NULL; |
| 2086 | PolyHandle poly; |
| 2087 | if (!PyArg_ParseTuple(_args, "O&", |
| 2088 | ResObj_Convert, &poly)) |
| 2089 | return NULL; |
| 2090 | KillPoly(poly); |
| 2091 | Py_INCREF(Py_None); |
| 2092 | _res = Py_None; |
| 2093 | return _res; |
| 2094 | } |
| 2095 | |
| 2096 | static PyObject *Qd_OffsetPoly(_self, _args) |
| 2097 | PyObject *_self; |
| 2098 | PyObject *_args; |
| 2099 | { |
| 2100 | PyObject *_res = NULL; |
| 2101 | PolyHandle poly; |
| 2102 | short dh; |
| 2103 | short dv; |
| 2104 | if (!PyArg_ParseTuple(_args, "O&hh", |
| 2105 | ResObj_Convert, &poly, |
| 2106 | &dh, |
| 2107 | &dv)) |
| 2108 | return NULL; |
| 2109 | OffsetPoly(poly, |
| 2110 | dh, |
| 2111 | dv); |
| 2112 | Py_INCREF(Py_None); |
| 2113 | _res = Py_None; |
| 2114 | return _res; |
| 2115 | } |
| 2116 | |
| 2117 | static PyObject *Qd_FramePoly(_self, _args) |
| 2118 | PyObject *_self; |
| 2119 | PyObject *_args; |
| 2120 | { |
| 2121 | PyObject *_res = NULL; |
| 2122 | PolyHandle poly; |
| 2123 | if (!PyArg_ParseTuple(_args, "O&", |
| 2124 | ResObj_Convert, &poly)) |
| 2125 | return NULL; |
| 2126 | FramePoly(poly); |
| 2127 | Py_INCREF(Py_None); |
| 2128 | _res = Py_None; |
| 2129 | return _res; |
| 2130 | } |
| 2131 | |
| 2132 | static PyObject *Qd_PaintPoly(_self, _args) |
| 2133 | PyObject *_self; |
| 2134 | PyObject *_args; |
| 2135 | { |
| 2136 | PyObject *_res = NULL; |
| 2137 | PolyHandle poly; |
| 2138 | if (!PyArg_ParseTuple(_args, "O&", |
| 2139 | ResObj_Convert, &poly)) |
| 2140 | return NULL; |
| 2141 | PaintPoly(poly); |
| 2142 | Py_INCREF(Py_None); |
| 2143 | _res = Py_None; |
| 2144 | return _res; |
| 2145 | } |
| 2146 | |
| 2147 | static PyObject *Qd_ErasePoly(_self, _args) |
| 2148 | PyObject *_self; |
| 2149 | PyObject *_args; |
| 2150 | { |
| 2151 | PyObject *_res = NULL; |
| 2152 | PolyHandle poly; |
| 2153 | if (!PyArg_ParseTuple(_args, "O&", |
| 2154 | ResObj_Convert, &poly)) |
| 2155 | return NULL; |
| 2156 | ErasePoly(poly); |
| 2157 | Py_INCREF(Py_None); |
| 2158 | _res = Py_None; |
| 2159 | return _res; |
| 2160 | } |
| 2161 | |
| 2162 | static PyObject *Qd_InvertPoly(_self, _args) |
| 2163 | PyObject *_self; |
| 2164 | PyObject *_args; |
| 2165 | { |
| 2166 | PyObject *_res = NULL; |
| 2167 | PolyHandle poly; |
| 2168 | if (!PyArg_ParseTuple(_args, "O&", |
| 2169 | ResObj_Convert, &poly)) |
| 2170 | return NULL; |
| 2171 | InvertPoly(poly); |
| 2172 | Py_INCREF(Py_None); |
| 2173 | _res = Py_None; |
| 2174 | return _res; |
| 2175 | } |
| 2176 | |
Jack Jansen | 04a02e7 | 1996-01-06 17:12:58 +0000 | [diff] [blame] | 2177 | static PyObject *Qd_FillPoly(_self, _args) |
| 2178 | PyObject *_self; |
| 2179 | PyObject *_args; |
| 2180 | { |
| 2181 | PyObject *_res = NULL; |
| 2182 | PolyHandle poly; |
| 2183 | Pattern *pat__in__; |
| 2184 | int pat__in_len__; |
| 2185 | if (!PyArg_ParseTuple(_args, "O&s#", |
| 2186 | ResObj_Convert, &poly, |
| 2187 | (char **)&pat__in__, &pat__in_len__)) |
| 2188 | return NULL; |
| 2189 | if (pat__in_len__ != sizeof(Pattern)) |
| 2190 | { |
| 2191 | PyErr_SetString(PyExc_TypeError, "buffer length should be sizeof(Pattern)"); |
| 2192 | goto pat__error__; |
| 2193 | } |
| 2194 | FillPoly(poly, |
| 2195 | pat__in__); |
| 2196 | Py_INCREF(Py_None); |
| 2197 | _res = Py_None; |
| 2198 | pat__error__: ; |
| 2199 | return _res; |
| 2200 | } |
| 2201 | |
Guido van Rossum | e56db43 | 1995-03-19 22:49:50 +0000 | [diff] [blame] | 2202 | static PyObject *Qd_SetPt(_self, _args) |
| 2203 | PyObject *_self; |
| 2204 | PyObject *_args; |
| 2205 | { |
| 2206 | PyObject *_res = NULL; |
| 2207 | Point pt; |
| 2208 | short h; |
| 2209 | short v; |
Jack Jansen | 1d8ede7 | 1996-01-08 23:47:31 +0000 | [diff] [blame] | 2210 | if (!PyArg_ParseTuple(_args, "hh", |
Guido van Rossum | e56db43 | 1995-03-19 22:49:50 +0000 | [diff] [blame] | 2211 | &h, |
| 2212 | &v)) |
| 2213 | return NULL; |
| 2214 | SetPt(&pt, |
| 2215 | h, |
| 2216 | v); |
| 2217 | _res = Py_BuildValue("O&", |
| 2218 | PyMac_BuildPoint, pt); |
| 2219 | return _res; |
| 2220 | } |
| 2221 | |
| 2222 | static PyObject *Qd_LocalToGlobal(_self, _args) |
| 2223 | PyObject *_self; |
| 2224 | PyObject *_args; |
| 2225 | { |
| 2226 | PyObject *_res = NULL; |
| 2227 | Point pt; |
| 2228 | if (!PyArg_ParseTuple(_args, "O&", |
| 2229 | PyMac_GetPoint, &pt)) |
| 2230 | return NULL; |
| 2231 | LocalToGlobal(&pt); |
| 2232 | _res = Py_BuildValue("O&", |
| 2233 | PyMac_BuildPoint, pt); |
| 2234 | return _res; |
| 2235 | } |
| 2236 | |
| 2237 | static PyObject *Qd_GlobalToLocal(_self, _args) |
| 2238 | PyObject *_self; |
| 2239 | PyObject *_args; |
| 2240 | { |
| 2241 | PyObject *_res = NULL; |
| 2242 | Point pt; |
| 2243 | if (!PyArg_ParseTuple(_args, "O&", |
| 2244 | PyMac_GetPoint, &pt)) |
| 2245 | return NULL; |
| 2246 | GlobalToLocal(&pt); |
| 2247 | _res = Py_BuildValue("O&", |
| 2248 | PyMac_BuildPoint, pt); |
| 2249 | return _res; |
| 2250 | } |
| 2251 | |
| 2252 | static PyObject *Qd_Random(_self, _args) |
| 2253 | PyObject *_self; |
| 2254 | PyObject *_args; |
| 2255 | { |
| 2256 | PyObject *_res = NULL; |
| 2257 | short _rv; |
| 2258 | if (!PyArg_ParseTuple(_args, "")) |
| 2259 | return NULL; |
| 2260 | _rv = Random(); |
| 2261 | _res = Py_BuildValue("h", |
| 2262 | _rv); |
| 2263 | return _res; |
| 2264 | } |
| 2265 | |
| 2266 | static PyObject *Qd_GetPixel(_self, _args) |
| 2267 | PyObject *_self; |
| 2268 | PyObject *_args; |
| 2269 | { |
| 2270 | PyObject *_res = NULL; |
| 2271 | Boolean _rv; |
| 2272 | short h; |
| 2273 | short v; |
| 2274 | if (!PyArg_ParseTuple(_args, "hh", |
| 2275 | &h, |
| 2276 | &v)) |
| 2277 | return NULL; |
| 2278 | _rv = GetPixel(h, |
| 2279 | v); |
| 2280 | _res = Py_BuildValue("b", |
| 2281 | _rv); |
| 2282 | return _res; |
| 2283 | } |
| 2284 | |
| 2285 | static PyObject *Qd_ScalePt(_self, _args) |
| 2286 | PyObject *_self; |
| 2287 | PyObject *_args; |
| 2288 | { |
| 2289 | PyObject *_res = NULL; |
| 2290 | Point pt; |
| 2291 | Rect srcRect; |
| 2292 | Rect dstRect; |
| 2293 | if (!PyArg_ParseTuple(_args, "O&O&O&", |
| 2294 | PyMac_GetPoint, &pt, |
| 2295 | PyMac_GetRect, &srcRect, |
| 2296 | PyMac_GetRect, &dstRect)) |
| 2297 | return NULL; |
| 2298 | ScalePt(&pt, |
| 2299 | &srcRect, |
| 2300 | &dstRect); |
| 2301 | _res = Py_BuildValue("O&", |
| 2302 | PyMac_BuildPoint, pt); |
| 2303 | return _res; |
| 2304 | } |
| 2305 | |
| 2306 | static PyObject *Qd_MapPt(_self, _args) |
| 2307 | PyObject *_self; |
| 2308 | PyObject *_args; |
| 2309 | { |
| 2310 | PyObject *_res = NULL; |
| 2311 | Point pt; |
| 2312 | Rect srcRect; |
| 2313 | Rect dstRect; |
| 2314 | if (!PyArg_ParseTuple(_args, "O&O&O&", |
| 2315 | PyMac_GetPoint, &pt, |
| 2316 | PyMac_GetRect, &srcRect, |
| 2317 | PyMac_GetRect, &dstRect)) |
| 2318 | return NULL; |
| 2319 | MapPt(&pt, |
| 2320 | &srcRect, |
| 2321 | &dstRect); |
| 2322 | _res = Py_BuildValue("O&", |
| 2323 | PyMac_BuildPoint, pt); |
| 2324 | return _res; |
| 2325 | } |
| 2326 | |
| 2327 | static PyObject *Qd_MapRect(_self, _args) |
| 2328 | PyObject *_self; |
| 2329 | PyObject *_args; |
| 2330 | { |
| 2331 | PyObject *_res = NULL; |
| 2332 | Rect r; |
| 2333 | Rect srcRect; |
| 2334 | Rect dstRect; |
Jack Jansen | 54c8f7e | 1995-11-14 10:46:01 +0000 | [diff] [blame] | 2335 | if (!PyArg_ParseTuple(_args, "O&O&O&", |
| 2336 | PyMac_GetRect, &r, |
Guido van Rossum | e56db43 | 1995-03-19 22:49:50 +0000 | [diff] [blame] | 2337 | PyMac_GetRect, &srcRect, |
| 2338 | PyMac_GetRect, &dstRect)) |
| 2339 | return NULL; |
| 2340 | MapRect(&r, |
| 2341 | &srcRect, |
| 2342 | &dstRect); |
| 2343 | _res = Py_BuildValue("O&", |
| 2344 | PyMac_BuildRect, &r); |
| 2345 | return _res; |
| 2346 | } |
| 2347 | |
| 2348 | static PyObject *Qd_MapRgn(_self, _args) |
| 2349 | PyObject *_self; |
| 2350 | PyObject *_args; |
| 2351 | { |
| 2352 | PyObject *_res = NULL; |
| 2353 | RgnHandle rgn; |
| 2354 | Rect srcRect; |
| 2355 | Rect dstRect; |
| 2356 | if (!PyArg_ParseTuple(_args, "O&O&O&", |
| 2357 | ResObj_Convert, &rgn, |
| 2358 | PyMac_GetRect, &srcRect, |
| 2359 | PyMac_GetRect, &dstRect)) |
| 2360 | return NULL; |
| 2361 | MapRgn(rgn, |
| 2362 | &srcRect, |
| 2363 | &dstRect); |
| 2364 | Py_INCREF(Py_None); |
| 2365 | _res = Py_None; |
| 2366 | return _res; |
| 2367 | } |
| 2368 | |
| 2369 | static PyObject *Qd_MapPoly(_self, _args) |
| 2370 | PyObject *_self; |
| 2371 | PyObject *_args; |
| 2372 | { |
| 2373 | PyObject *_res = NULL; |
| 2374 | PolyHandle poly; |
| 2375 | Rect srcRect; |
| 2376 | Rect dstRect; |
| 2377 | if (!PyArg_ParseTuple(_args, "O&O&O&", |
| 2378 | ResObj_Convert, &poly, |
| 2379 | PyMac_GetRect, &srcRect, |
| 2380 | PyMac_GetRect, &dstRect)) |
| 2381 | return NULL; |
| 2382 | MapPoly(poly, |
| 2383 | &srcRect, |
| 2384 | &dstRect); |
| 2385 | Py_INCREF(Py_None); |
| 2386 | _res = Py_None; |
| 2387 | return _res; |
| 2388 | } |
| 2389 | |
Jack Jansen | 41058c0 | 1995-11-16 22:48:29 +0000 | [diff] [blame] | 2390 | static PyObject *Qd_StdBits(_self, _args) |
| 2391 | PyObject *_self; |
| 2392 | PyObject *_args; |
| 2393 | { |
| 2394 | PyObject *_res = NULL; |
| 2395 | BitMapPtr srcBits; |
| 2396 | Rect srcRect; |
| 2397 | Rect dstRect; |
| 2398 | short mode; |
| 2399 | RgnHandle maskRgn; |
| 2400 | if (!PyArg_ParseTuple(_args, "O&O&O&hO&", |
| 2401 | BMObj_Convert, &srcBits, |
| 2402 | PyMac_GetRect, &srcRect, |
| 2403 | PyMac_GetRect, &dstRect, |
| 2404 | &mode, |
Jack Jansen | 425e9eb | 1995-12-12 15:02:03 +0000 | [diff] [blame] | 2405 | OptResObj_Convert, &maskRgn)) |
Jack Jansen | 41058c0 | 1995-11-16 22:48:29 +0000 | [diff] [blame] | 2406 | return NULL; |
| 2407 | StdBits(srcBits, |
| 2408 | &srcRect, |
| 2409 | &dstRect, |
| 2410 | mode, |
| 2411 | maskRgn); |
| 2412 | Py_INCREF(Py_None); |
| 2413 | _res = Py_None; |
| 2414 | return _res; |
| 2415 | } |
| 2416 | |
Guido van Rossum | e56db43 | 1995-03-19 22:49:50 +0000 | [diff] [blame] | 2417 | static PyObject *Qd_AddPt(_self, _args) |
| 2418 | PyObject *_self; |
| 2419 | PyObject *_args; |
| 2420 | { |
| 2421 | PyObject *_res = NULL; |
| 2422 | Point src; |
| 2423 | Point dst; |
| 2424 | if (!PyArg_ParseTuple(_args, "O&O&", |
| 2425 | PyMac_GetPoint, &src, |
| 2426 | PyMac_GetPoint, &dst)) |
| 2427 | return NULL; |
| 2428 | AddPt(src, |
| 2429 | &dst); |
| 2430 | _res = Py_BuildValue("O&", |
| 2431 | PyMac_BuildPoint, dst); |
| 2432 | return _res; |
| 2433 | } |
| 2434 | |
| 2435 | static PyObject *Qd_EqualPt(_self, _args) |
| 2436 | PyObject *_self; |
| 2437 | PyObject *_args; |
| 2438 | { |
| 2439 | PyObject *_res = NULL; |
| 2440 | Boolean _rv; |
| 2441 | Point pt1; |
| 2442 | Point pt2; |
| 2443 | if (!PyArg_ParseTuple(_args, "O&O&", |
| 2444 | PyMac_GetPoint, &pt1, |
| 2445 | PyMac_GetPoint, &pt2)) |
| 2446 | return NULL; |
| 2447 | _rv = EqualPt(pt1, |
| 2448 | pt2); |
| 2449 | _res = Py_BuildValue("b", |
| 2450 | _rv); |
| 2451 | return _res; |
| 2452 | } |
| 2453 | |
| 2454 | static PyObject *Qd_PtInRect(_self, _args) |
| 2455 | PyObject *_self; |
| 2456 | PyObject *_args; |
| 2457 | { |
| 2458 | PyObject *_res = NULL; |
| 2459 | Boolean _rv; |
| 2460 | Point pt; |
| 2461 | Rect r; |
| 2462 | if (!PyArg_ParseTuple(_args, "O&O&", |
| 2463 | PyMac_GetPoint, &pt, |
| 2464 | PyMac_GetRect, &r)) |
| 2465 | return NULL; |
| 2466 | _rv = PtInRect(pt, |
| 2467 | &r); |
| 2468 | _res = Py_BuildValue("b", |
| 2469 | _rv); |
| 2470 | return _res; |
| 2471 | } |
| 2472 | |
| 2473 | static PyObject *Qd_Pt2Rect(_self, _args) |
| 2474 | PyObject *_self; |
| 2475 | PyObject *_args; |
| 2476 | { |
| 2477 | PyObject *_res = NULL; |
| 2478 | Point pt1; |
| 2479 | Point pt2; |
| 2480 | Rect dstRect; |
| 2481 | if (!PyArg_ParseTuple(_args, "O&O&", |
| 2482 | PyMac_GetPoint, &pt1, |
| 2483 | PyMac_GetPoint, &pt2)) |
| 2484 | return NULL; |
| 2485 | Pt2Rect(pt1, |
| 2486 | pt2, |
| 2487 | &dstRect); |
| 2488 | _res = Py_BuildValue("O&", |
| 2489 | PyMac_BuildRect, &dstRect); |
| 2490 | return _res; |
| 2491 | } |
| 2492 | |
| 2493 | static PyObject *Qd_PtToAngle(_self, _args) |
| 2494 | PyObject *_self; |
| 2495 | PyObject *_args; |
| 2496 | { |
| 2497 | PyObject *_res = NULL; |
| 2498 | Rect r; |
| 2499 | Point pt; |
| 2500 | short angle; |
| 2501 | if (!PyArg_ParseTuple(_args, "O&O&", |
| 2502 | PyMac_GetRect, &r, |
| 2503 | PyMac_GetPoint, &pt)) |
| 2504 | return NULL; |
| 2505 | PtToAngle(&r, |
| 2506 | pt, |
| 2507 | &angle); |
| 2508 | _res = Py_BuildValue("h", |
| 2509 | angle); |
| 2510 | return _res; |
| 2511 | } |
| 2512 | |
Jack Jansen | b81cf9d | 1995-06-06 13:08:40 +0000 | [diff] [blame] | 2513 | static PyObject *Qd_SubPt(_self, _args) |
| 2514 | PyObject *_self; |
| 2515 | PyObject *_args; |
| 2516 | { |
| 2517 | PyObject *_res = NULL; |
| 2518 | Point src; |
| 2519 | Point dst; |
| 2520 | if (!PyArg_ParseTuple(_args, "O&O&", |
| 2521 | PyMac_GetPoint, &src, |
| 2522 | PyMac_GetPoint, &dst)) |
| 2523 | return NULL; |
| 2524 | SubPt(src, |
| 2525 | &dst); |
| 2526 | _res = Py_BuildValue("O&", |
| 2527 | PyMac_BuildPoint, dst); |
| 2528 | return _res; |
| 2529 | } |
| 2530 | |
Guido van Rossum | e56db43 | 1995-03-19 22:49:50 +0000 | [diff] [blame] | 2531 | static PyObject *Qd_PtInRgn(_self, _args) |
| 2532 | PyObject *_self; |
| 2533 | PyObject *_args; |
| 2534 | { |
| 2535 | PyObject *_res = NULL; |
| 2536 | Boolean _rv; |
| 2537 | Point pt; |
| 2538 | RgnHandle rgn; |
| 2539 | if (!PyArg_ParseTuple(_args, "O&O&", |
| 2540 | PyMac_GetPoint, &pt, |
| 2541 | ResObj_Convert, &rgn)) |
| 2542 | return NULL; |
| 2543 | _rv = PtInRgn(pt, |
| 2544 | rgn); |
| 2545 | _res = Py_BuildValue("b", |
| 2546 | _rv); |
| 2547 | return _res; |
| 2548 | } |
| 2549 | |
| 2550 | static PyObject *Qd_NewPixMap(_self, _args) |
| 2551 | PyObject *_self; |
| 2552 | PyObject *_args; |
| 2553 | { |
| 2554 | PyObject *_res = NULL; |
| 2555 | PixMapHandle _rv; |
| 2556 | if (!PyArg_ParseTuple(_args, "")) |
| 2557 | return NULL; |
| 2558 | _rv = NewPixMap(); |
| 2559 | _res = Py_BuildValue("O&", |
| 2560 | ResObj_New, _rv); |
| 2561 | return _res; |
| 2562 | } |
| 2563 | |
Guido van Rossum | e56db43 | 1995-03-19 22:49:50 +0000 | [diff] [blame] | 2564 | static PyObject *Qd_DisposePixMap(_self, _args) |
| 2565 | PyObject *_self; |
| 2566 | PyObject *_args; |
| 2567 | { |
| 2568 | PyObject *_res = NULL; |
| 2569 | PixMapHandle pm; |
| 2570 | if (!PyArg_ParseTuple(_args, "O&", |
| 2571 | ResObj_Convert, &pm)) |
| 2572 | return NULL; |
| 2573 | DisposePixMap(pm); |
| 2574 | Py_INCREF(Py_None); |
| 2575 | _res = Py_None; |
| 2576 | return _res; |
| 2577 | } |
| 2578 | |
| 2579 | static PyObject *Qd_CopyPixMap(_self, _args) |
| 2580 | PyObject *_self; |
| 2581 | PyObject *_args; |
| 2582 | { |
| 2583 | PyObject *_res = NULL; |
| 2584 | PixMapHandle srcPM; |
| 2585 | PixMapHandle dstPM; |
| 2586 | if (!PyArg_ParseTuple(_args, "O&O&", |
| 2587 | ResObj_Convert, &srcPM, |
| 2588 | ResObj_Convert, &dstPM)) |
| 2589 | return NULL; |
| 2590 | CopyPixMap(srcPM, |
| 2591 | dstPM); |
| 2592 | Py_INCREF(Py_None); |
| 2593 | _res = Py_None; |
| 2594 | return _res; |
| 2595 | } |
| 2596 | |
| 2597 | static PyObject *Qd_NewPixPat(_self, _args) |
| 2598 | PyObject *_self; |
| 2599 | PyObject *_args; |
| 2600 | { |
| 2601 | PyObject *_res = NULL; |
| 2602 | PixPatHandle _rv; |
| 2603 | if (!PyArg_ParseTuple(_args, "")) |
| 2604 | return NULL; |
| 2605 | _rv = NewPixPat(); |
| 2606 | _res = Py_BuildValue("O&", |
| 2607 | ResObj_New, _rv); |
| 2608 | return _res; |
| 2609 | } |
| 2610 | |
Guido van Rossum | e56db43 | 1995-03-19 22:49:50 +0000 | [diff] [blame] | 2611 | static PyObject *Qd_DisposePixPat(_self, _args) |
| 2612 | PyObject *_self; |
| 2613 | 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 | |
| 2626 | static PyObject *Qd_CopyPixPat(_self, _args) |
| 2627 | PyObject *_self; |
| 2628 | PyObject *_args; |
| 2629 | { |
| 2630 | PyObject *_res = NULL; |
| 2631 | PixPatHandle srcPP; |
| 2632 | PixPatHandle dstPP; |
| 2633 | if (!PyArg_ParseTuple(_args, "O&O&", |
| 2634 | ResObj_Convert, &srcPP, |
| 2635 | ResObj_Convert, &dstPP)) |
| 2636 | return NULL; |
| 2637 | CopyPixPat(srcPP, |
| 2638 | dstPP); |
| 2639 | Py_INCREF(Py_None); |
| 2640 | _res = Py_None; |
| 2641 | return _res; |
| 2642 | } |
| 2643 | |
| 2644 | static PyObject *Qd_PenPixPat(_self, _args) |
| 2645 | PyObject *_self; |
| 2646 | PyObject *_args; |
| 2647 | { |
| 2648 | PyObject *_res = NULL; |
| 2649 | PixPatHandle pp; |
| 2650 | if (!PyArg_ParseTuple(_args, "O&", |
| 2651 | ResObj_Convert, &pp)) |
| 2652 | return NULL; |
| 2653 | PenPixPat(pp); |
| 2654 | Py_INCREF(Py_None); |
| 2655 | _res = Py_None; |
| 2656 | return _res; |
| 2657 | } |
| 2658 | |
| 2659 | static PyObject *Qd_BackPixPat(_self, _args) |
| 2660 | PyObject *_self; |
| 2661 | PyObject *_args; |
| 2662 | { |
| 2663 | PyObject *_res = NULL; |
| 2664 | PixPatHandle pp; |
| 2665 | if (!PyArg_ParseTuple(_args, "O&", |
| 2666 | ResObj_Convert, &pp)) |
| 2667 | return NULL; |
| 2668 | BackPixPat(pp); |
| 2669 | Py_INCREF(Py_None); |
| 2670 | _res = Py_None; |
| 2671 | return _res; |
| 2672 | } |
| 2673 | |
| 2674 | static PyObject *Qd_GetPixPat(_self, _args) |
| 2675 | PyObject *_self; |
| 2676 | PyObject *_args; |
| 2677 | { |
| 2678 | PyObject *_res = NULL; |
| 2679 | PixPatHandle _rv; |
| 2680 | short patID; |
| 2681 | if (!PyArg_ParseTuple(_args, "h", |
| 2682 | &patID)) |
| 2683 | return NULL; |
| 2684 | _rv = GetPixPat(patID); |
| 2685 | _res = Py_BuildValue("O&", |
| 2686 | ResObj_New, _rv); |
| 2687 | return _res; |
| 2688 | } |
| 2689 | |
Jack Jansen | 232f3cd | 1995-12-09 14:04:31 +0000 | [diff] [blame] | 2690 | static PyObject *Qd_MakeRGBPat(_self, _args) |
| 2691 | PyObject *_self; |
| 2692 | PyObject *_args; |
| 2693 | { |
| 2694 | PyObject *_res = NULL; |
| 2695 | PixPatHandle pp; |
| 2696 | RGBColor myColor; |
| 2697 | if (!PyArg_ParseTuple(_args, "O&O&", |
| 2698 | ResObj_Convert, &pp, |
| 2699 | QdRGB_Convert, &myColor)) |
| 2700 | return NULL; |
| 2701 | MakeRGBPat(pp, |
| 2702 | &myColor); |
| 2703 | Py_INCREF(Py_None); |
| 2704 | _res = Py_None; |
| 2705 | return _res; |
| 2706 | } |
| 2707 | |
Guido van Rossum | e56db43 | 1995-03-19 22:49:50 +0000 | [diff] [blame] | 2708 | static PyObject *Qd_FillCRect(_self, _args) |
| 2709 | PyObject *_self; |
| 2710 | PyObject *_args; |
| 2711 | { |
| 2712 | PyObject *_res = NULL; |
| 2713 | Rect r; |
| 2714 | PixPatHandle pp; |
| 2715 | if (!PyArg_ParseTuple(_args, "O&O&", |
| 2716 | PyMac_GetRect, &r, |
| 2717 | ResObj_Convert, &pp)) |
| 2718 | return NULL; |
| 2719 | FillCRect(&r, |
| 2720 | pp); |
| 2721 | Py_INCREF(Py_None); |
| 2722 | _res = Py_None; |
| 2723 | return _res; |
| 2724 | } |
| 2725 | |
| 2726 | static PyObject *Qd_FillCOval(_self, _args) |
| 2727 | PyObject *_self; |
| 2728 | PyObject *_args; |
| 2729 | { |
| 2730 | PyObject *_res = NULL; |
| 2731 | Rect r; |
| 2732 | PixPatHandle pp; |
| 2733 | if (!PyArg_ParseTuple(_args, "O&O&", |
| 2734 | PyMac_GetRect, &r, |
| 2735 | ResObj_Convert, &pp)) |
| 2736 | return NULL; |
| 2737 | FillCOval(&r, |
| 2738 | pp); |
| 2739 | Py_INCREF(Py_None); |
| 2740 | _res = Py_None; |
| 2741 | return _res; |
| 2742 | } |
| 2743 | |
| 2744 | static PyObject *Qd_FillCRoundRect(_self, _args) |
| 2745 | PyObject *_self; |
| 2746 | PyObject *_args; |
| 2747 | { |
| 2748 | PyObject *_res = NULL; |
| 2749 | Rect r; |
| 2750 | short ovalWidth; |
| 2751 | short ovalHeight; |
| 2752 | PixPatHandle pp; |
| 2753 | if (!PyArg_ParseTuple(_args, "O&hhO&", |
| 2754 | PyMac_GetRect, &r, |
| 2755 | &ovalWidth, |
| 2756 | &ovalHeight, |
| 2757 | ResObj_Convert, &pp)) |
| 2758 | return NULL; |
| 2759 | FillCRoundRect(&r, |
| 2760 | ovalWidth, |
| 2761 | ovalHeight, |
| 2762 | pp); |
| 2763 | Py_INCREF(Py_None); |
| 2764 | _res = Py_None; |
| 2765 | return _res; |
| 2766 | } |
| 2767 | |
| 2768 | static PyObject *Qd_FillCArc(_self, _args) |
| 2769 | PyObject *_self; |
| 2770 | PyObject *_args; |
| 2771 | { |
| 2772 | PyObject *_res = NULL; |
| 2773 | Rect r; |
| 2774 | short startAngle; |
| 2775 | short arcAngle; |
| 2776 | PixPatHandle pp; |
| 2777 | if (!PyArg_ParseTuple(_args, "O&hhO&", |
| 2778 | PyMac_GetRect, &r, |
| 2779 | &startAngle, |
| 2780 | &arcAngle, |
| 2781 | ResObj_Convert, &pp)) |
| 2782 | return NULL; |
| 2783 | FillCArc(&r, |
| 2784 | startAngle, |
| 2785 | arcAngle, |
| 2786 | pp); |
| 2787 | Py_INCREF(Py_None); |
| 2788 | _res = Py_None; |
| 2789 | return _res; |
| 2790 | } |
| 2791 | |
| 2792 | static PyObject *Qd_FillCRgn(_self, _args) |
| 2793 | PyObject *_self; |
| 2794 | PyObject *_args; |
| 2795 | { |
| 2796 | PyObject *_res = NULL; |
| 2797 | RgnHandle rgn; |
| 2798 | PixPatHandle pp; |
| 2799 | if (!PyArg_ParseTuple(_args, "O&O&", |
| 2800 | ResObj_Convert, &rgn, |
| 2801 | ResObj_Convert, &pp)) |
| 2802 | return NULL; |
| 2803 | FillCRgn(rgn, |
| 2804 | pp); |
| 2805 | Py_INCREF(Py_None); |
| 2806 | _res = Py_None; |
| 2807 | return _res; |
| 2808 | } |
| 2809 | |
| 2810 | static PyObject *Qd_FillCPoly(_self, _args) |
| 2811 | PyObject *_self; |
| 2812 | PyObject *_args; |
| 2813 | { |
| 2814 | PyObject *_res = NULL; |
| 2815 | PolyHandle poly; |
| 2816 | PixPatHandle pp; |
| 2817 | if (!PyArg_ParseTuple(_args, "O&O&", |
| 2818 | ResObj_Convert, &poly, |
| 2819 | ResObj_Convert, &pp)) |
| 2820 | return NULL; |
| 2821 | FillCPoly(poly, |
| 2822 | pp); |
| 2823 | Py_INCREF(Py_None); |
| 2824 | _res = Py_None; |
| 2825 | return _res; |
| 2826 | } |
| 2827 | |
Jack Jansen | 232f3cd | 1995-12-09 14:04:31 +0000 | [diff] [blame] | 2828 | static PyObject *Qd_RGBForeColor(_self, _args) |
| 2829 | PyObject *_self; |
| 2830 | PyObject *_args; |
| 2831 | { |
| 2832 | PyObject *_res = NULL; |
| 2833 | RGBColor color; |
| 2834 | if (!PyArg_ParseTuple(_args, "O&", |
| 2835 | QdRGB_Convert, &color)) |
| 2836 | return NULL; |
| 2837 | RGBForeColor(&color); |
| 2838 | Py_INCREF(Py_None); |
| 2839 | _res = Py_None; |
| 2840 | return _res; |
| 2841 | } |
| 2842 | |
| 2843 | static PyObject *Qd_RGBBackColor(_self, _args) |
| 2844 | PyObject *_self; |
| 2845 | PyObject *_args; |
| 2846 | { |
| 2847 | PyObject *_res = NULL; |
| 2848 | RGBColor color; |
| 2849 | if (!PyArg_ParseTuple(_args, "O&", |
| 2850 | QdRGB_Convert, &color)) |
| 2851 | return NULL; |
| 2852 | RGBBackColor(&color); |
| 2853 | Py_INCREF(Py_None); |
| 2854 | _res = Py_None; |
| 2855 | return _res; |
| 2856 | } |
| 2857 | |
| 2858 | static PyObject *Qd_SetCPixel(_self, _args) |
| 2859 | PyObject *_self; |
| 2860 | PyObject *_args; |
| 2861 | { |
| 2862 | PyObject *_res = NULL; |
| 2863 | short h; |
| 2864 | short v; |
| 2865 | RGBColor cPix; |
| 2866 | if (!PyArg_ParseTuple(_args, "hhO&", |
| 2867 | &h, |
| 2868 | &v, |
| 2869 | QdRGB_Convert, &cPix)) |
| 2870 | return NULL; |
| 2871 | SetCPixel(h, |
| 2872 | v, |
| 2873 | &cPix); |
| 2874 | Py_INCREF(Py_None); |
| 2875 | _res = Py_None; |
| 2876 | return _res; |
| 2877 | } |
| 2878 | |
Guido van Rossum | e56db43 | 1995-03-19 22:49:50 +0000 | [diff] [blame] | 2879 | static PyObject *Qd_SetPortPix(_self, _args) |
| 2880 | PyObject *_self; |
| 2881 | PyObject *_args; |
| 2882 | { |
| 2883 | PyObject *_res = NULL; |
| 2884 | PixMapHandle pm; |
| 2885 | if (!PyArg_ParseTuple(_args, "O&", |
| 2886 | ResObj_Convert, &pm)) |
| 2887 | return NULL; |
| 2888 | SetPortPix(pm); |
| 2889 | Py_INCREF(Py_None); |
| 2890 | _res = Py_None; |
| 2891 | return _res; |
| 2892 | } |
| 2893 | |
Jack Jansen | 232f3cd | 1995-12-09 14:04:31 +0000 | [diff] [blame] | 2894 | static PyObject *Qd_GetCPixel(_self, _args) |
| 2895 | PyObject *_self; |
| 2896 | PyObject *_args; |
| 2897 | { |
| 2898 | PyObject *_res = NULL; |
| 2899 | short h; |
| 2900 | short v; |
| 2901 | RGBColor cPix; |
| 2902 | if (!PyArg_ParseTuple(_args, "hh", |
| 2903 | &h, |
| 2904 | &v)) |
| 2905 | return NULL; |
| 2906 | GetCPixel(h, |
| 2907 | v, |
| 2908 | &cPix); |
| 2909 | _res = Py_BuildValue("O&", |
| 2910 | QdRGB_New, &cPix); |
| 2911 | return _res; |
| 2912 | } |
| 2913 | |
| 2914 | static PyObject *Qd_GetForeColor(_self, _args) |
| 2915 | PyObject *_self; |
| 2916 | PyObject *_args; |
| 2917 | { |
| 2918 | PyObject *_res = NULL; |
| 2919 | RGBColor color; |
| 2920 | if (!PyArg_ParseTuple(_args, "")) |
| 2921 | return NULL; |
| 2922 | GetForeColor(&color); |
| 2923 | _res = Py_BuildValue("O&", |
| 2924 | QdRGB_New, &color); |
| 2925 | return _res; |
| 2926 | } |
| 2927 | |
| 2928 | static PyObject *Qd_GetBackColor(_self, _args) |
| 2929 | PyObject *_self; |
| 2930 | PyObject *_args; |
| 2931 | { |
| 2932 | PyObject *_res = NULL; |
| 2933 | RGBColor color; |
| 2934 | if (!PyArg_ParseTuple(_args, "")) |
| 2935 | return NULL; |
| 2936 | GetBackColor(&color); |
| 2937 | _res = Py_BuildValue("O&", |
| 2938 | QdRGB_New, &color); |
| 2939 | return _res; |
| 2940 | } |
| 2941 | |
| 2942 | static PyObject *Qd_OpColor(_self, _args) |
| 2943 | PyObject *_self; |
| 2944 | PyObject *_args; |
| 2945 | { |
| 2946 | PyObject *_res = NULL; |
| 2947 | RGBColor color; |
| 2948 | if (!PyArg_ParseTuple(_args, "O&", |
| 2949 | QdRGB_Convert, &color)) |
| 2950 | return NULL; |
| 2951 | OpColor(&color); |
| 2952 | Py_INCREF(Py_None); |
| 2953 | _res = Py_None; |
| 2954 | return _res; |
| 2955 | } |
| 2956 | |
| 2957 | static PyObject *Qd_HiliteColor(_self, _args) |
| 2958 | PyObject *_self; |
| 2959 | PyObject *_args; |
| 2960 | { |
| 2961 | PyObject *_res = NULL; |
| 2962 | RGBColor color; |
| 2963 | if (!PyArg_ParseTuple(_args, "O&", |
| 2964 | QdRGB_Convert, &color)) |
| 2965 | return NULL; |
| 2966 | HiliteColor(&color); |
| 2967 | Py_INCREF(Py_None); |
| 2968 | _res = Py_None; |
| 2969 | return _res; |
| 2970 | } |
| 2971 | |
Jack Jansen | 69b43ed | 1997-08-15 14:35:54 +0000 | [diff] [blame] | 2972 | static PyObject *Qd_DisposeCTable(_self, _args) |
| 2973 | PyObject *_self; |
| 2974 | PyObject *_args; |
| 2975 | { |
| 2976 | PyObject *_res = NULL; |
| 2977 | CTabHandle cTable; |
| 2978 | if (!PyArg_ParseTuple(_args, "O&", |
| 2979 | ResObj_Convert, &cTable)) |
| 2980 | return NULL; |
| 2981 | DisposeCTable(cTable); |
| 2982 | Py_INCREF(Py_None); |
| 2983 | _res = Py_None; |
| 2984 | return _res; |
| 2985 | } |
| 2986 | |
| 2987 | static PyObject *Qd_GetCTable(_self, _args) |
| 2988 | PyObject *_self; |
| 2989 | PyObject *_args; |
| 2990 | { |
| 2991 | PyObject *_res = NULL; |
| 2992 | CTabHandle _rv; |
| 2993 | short ctID; |
| 2994 | if (!PyArg_ParseTuple(_args, "h", |
| 2995 | &ctID)) |
| 2996 | return NULL; |
| 2997 | _rv = GetCTable(ctID); |
| 2998 | _res = Py_BuildValue("O&", |
| 2999 | ResObj_New, _rv); |
| 3000 | return _res; |
| 3001 | } |
| 3002 | |
| 3003 | static PyObject *Qd_GetCCursor(_self, _args) |
| 3004 | PyObject *_self; |
| 3005 | PyObject *_args; |
| 3006 | { |
| 3007 | PyObject *_res = NULL; |
| 3008 | CCrsrHandle _rv; |
| 3009 | short crsrID; |
| 3010 | if (!PyArg_ParseTuple(_args, "h", |
| 3011 | &crsrID)) |
| 3012 | return NULL; |
| 3013 | _rv = GetCCursor(crsrID); |
| 3014 | _res = Py_BuildValue("O&", |
| 3015 | ResObj_New, _rv); |
| 3016 | return _res; |
| 3017 | } |
| 3018 | |
| 3019 | static PyObject *Qd_SetCCursor(_self, _args) |
| 3020 | PyObject *_self; |
| 3021 | PyObject *_args; |
| 3022 | { |
| 3023 | PyObject *_res = NULL; |
| 3024 | CCrsrHandle cCrsr; |
| 3025 | if (!PyArg_ParseTuple(_args, "O&", |
| 3026 | ResObj_Convert, &cCrsr)) |
| 3027 | return NULL; |
| 3028 | SetCCursor(cCrsr); |
| 3029 | Py_INCREF(Py_None); |
| 3030 | _res = Py_None; |
| 3031 | return _res; |
| 3032 | } |
| 3033 | |
Guido van Rossum | e56db43 | 1995-03-19 22:49:50 +0000 | [diff] [blame] | 3034 | static PyObject *Qd_AllocCursor(_self, _args) |
| 3035 | PyObject *_self; |
| 3036 | PyObject *_args; |
| 3037 | { |
| 3038 | PyObject *_res = NULL; |
| 3039 | if (!PyArg_ParseTuple(_args, "")) |
| 3040 | return NULL; |
| 3041 | AllocCursor(); |
| 3042 | Py_INCREF(Py_None); |
| 3043 | _res = Py_None; |
| 3044 | return _res; |
| 3045 | } |
| 3046 | |
Jack Jansen | 69b43ed | 1997-08-15 14:35:54 +0000 | [diff] [blame] | 3047 | static PyObject *Qd_DisposeCCursor(_self, _args) |
| 3048 | PyObject *_self; |
| 3049 | PyObject *_args; |
| 3050 | { |
| 3051 | PyObject *_res = NULL; |
| 3052 | CCrsrHandle cCrsr; |
| 3053 | if (!PyArg_ParseTuple(_args, "O&", |
| 3054 | ResObj_Convert, &cCrsr)) |
| 3055 | return NULL; |
| 3056 | DisposeCCursor(cCrsr); |
| 3057 | Py_INCREF(Py_None); |
| 3058 | _res = Py_None; |
| 3059 | return _res; |
| 3060 | } |
| 3061 | |
| 3062 | static PyObject *Qd_GetMaxDevice(_self, _args) |
| 3063 | PyObject *_self; |
| 3064 | PyObject *_args; |
| 3065 | { |
| 3066 | PyObject *_res = NULL; |
| 3067 | GDHandle _rv; |
| 3068 | Rect globalRect; |
| 3069 | if (!PyArg_ParseTuple(_args, "O&", |
| 3070 | PyMac_GetRect, &globalRect)) |
| 3071 | return NULL; |
| 3072 | _rv = GetMaxDevice(&globalRect); |
| 3073 | _res = Py_BuildValue("O&", |
| 3074 | ResObj_New, _rv); |
| 3075 | return _res; |
| 3076 | } |
| 3077 | |
Guido van Rossum | e56db43 | 1995-03-19 22:49:50 +0000 | [diff] [blame] | 3078 | static PyObject *Qd_GetCTSeed(_self, _args) |
| 3079 | PyObject *_self; |
| 3080 | PyObject *_args; |
| 3081 | { |
| 3082 | PyObject *_res = NULL; |
| 3083 | long _rv; |
| 3084 | if (!PyArg_ParseTuple(_args, "")) |
| 3085 | return NULL; |
| 3086 | _rv = GetCTSeed(); |
| 3087 | _res = Py_BuildValue("l", |
| 3088 | _rv); |
| 3089 | return _res; |
| 3090 | } |
| 3091 | |
Jack Jansen | 69b43ed | 1997-08-15 14:35:54 +0000 | [diff] [blame] | 3092 | static PyObject *Qd_GetDeviceList(_self, _args) |
| 3093 | PyObject *_self; |
| 3094 | PyObject *_args; |
| 3095 | { |
| 3096 | PyObject *_res = NULL; |
| 3097 | GDHandle _rv; |
| 3098 | if (!PyArg_ParseTuple(_args, "")) |
| 3099 | return NULL; |
| 3100 | _rv = GetDeviceList(); |
| 3101 | _res = Py_BuildValue("O&", |
| 3102 | ResObj_New, _rv); |
| 3103 | return _res; |
| 3104 | } |
| 3105 | |
| 3106 | static PyObject *Qd_GetMainDevice(_self, _args) |
| 3107 | PyObject *_self; |
| 3108 | PyObject *_args; |
| 3109 | { |
| 3110 | PyObject *_res = NULL; |
| 3111 | GDHandle _rv; |
| 3112 | if (!PyArg_ParseTuple(_args, "")) |
| 3113 | return NULL; |
| 3114 | _rv = GetMainDevice(); |
| 3115 | _res = Py_BuildValue("O&", |
| 3116 | ResObj_New, _rv); |
| 3117 | return _res; |
| 3118 | } |
| 3119 | |
| 3120 | static PyObject *Qd_GetNextDevice(_self, _args) |
| 3121 | PyObject *_self; |
| 3122 | PyObject *_args; |
| 3123 | { |
| 3124 | PyObject *_res = NULL; |
| 3125 | GDHandle _rv; |
| 3126 | GDHandle curDevice; |
| 3127 | if (!PyArg_ParseTuple(_args, "O&", |
| 3128 | ResObj_Convert, &curDevice)) |
| 3129 | return NULL; |
| 3130 | _rv = GetNextDevice(curDevice); |
| 3131 | _res = Py_BuildValue("O&", |
| 3132 | ResObj_New, _rv); |
| 3133 | return _res; |
| 3134 | } |
| 3135 | |
| 3136 | static PyObject *Qd_TestDeviceAttribute(_self, _args) |
| 3137 | PyObject *_self; |
| 3138 | PyObject *_args; |
| 3139 | { |
| 3140 | PyObject *_res = NULL; |
| 3141 | Boolean _rv; |
| 3142 | GDHandle gdh; |
| 3143 | short attribute; |
| 3144 | if (!PyArg_ParseTuple(_args, "O&h", |
| 3145 | ResObj_Convert, &gdh, |
| 3146 | &attribute)) |
| 3147 | return NULL; |
| 3148 | _rv = TestDeviceAttribute(gdh, |
| 3149 | attribute); |
| 3150 | _res = Py_BuildValue("b", |
| 3151 | _rv); |
| 3152 | return _res; |
| 3153 | } |
| 3154 | |
| 3155 | static PyObject *Qd_SetDeviceAttribute(_self, _args) |
| 3156 | PyObject *_self; |
| 3157 | PyObject *_args; |
| 3158 | { |
| 3159 | PyObject *_res = NULL; |
| 3160 | GDHandle gdh; |
| 3161 | short attribute; |
| 3162 | Boolean value; |
| 3163 | if (!PyArg_ParseTuple(_args, "O&hb", |
| 3164 | ResObj_Convert, &gdh, |
| 3165 | &attribute, |
| 3166 | &value)) |
| 3167 | return NULL; |
| 3168 | SetDeviceAttribute(gdh, |
| 3169 | attribute, |
| 3170 | value); |
| 3171 | Py_INCREF(Py_None); |
| 3172 | _res = Py_None; |
| 3173 | return _res; |
| 3174 | } |
| 3175 | |
| 3176 | static PyObject *Qd_InitGDevice(_self, _args) |
| 3177 | PyObject *_self; |
| 3178 | PyObject *_args; |
| 3179 | { |
| 3180 | PyObject *_res = NULL; |
| 3181 | short qdRefNum; |
| 3182 | long mode; |
| 3183 | GDHandle gdh; |
| 3184 | if (!PyArg_ParseTuple(_args, "hlO&", |
| 3185 | &qdRefNum, |
| 3186 | &mode, |
| 3187 | ResObj_Convert, &gdh)) |
| 3188 | return NULL; |
| 3189 | InitGDevice(qdRefNum, |
| 3190 | mode, |
| 3191 | gdh); |
| 3192 | Py_INCREF(Py_None); |
| 3193 | _res = Py_None; |
| 3194 | return _res; |
| 3195 | } |
| 3196 | |
| 3197 | static PyObject *Qd_NewGDevice(_self, _args) |
| 3198 | PyObject *_self; |
| 3199 | PyObject *_args; |
| 3200 | { |
| 3201 | PyObject *_res = NULL; |
| 3202 | GDHandle _rv; |
| 3203 | short refNum; |
| 3204 | long mode; |
| 3205 | if (!PyArg_ParseTuple(_args, "hl", |
| 3206 | &refNum, |
| 3207 | &mode)) |
| 3208 | return NULL; |
| 3209 | _rv = NewGDevice(refNum, |
| 3210 | mode); |
| 3211 | _res = Py_BuildValue("O&", |
| 3212 | ResObj_New, _rv); |
| 3213 | return _res; |
| 3214 | } |
| 3215 | |
| 3216 | static PyObject *Qd_DisposeGDevice(_self, _args) |
| 3217 | PyObject *_self; |
| 3218 | PyObject *_args; |
| 3219 | { |
| 3220 | PyObject *_res = NULL; |
| 3221 | GDHandle gdh; |
| 3222 | if (!PyArg_ParseTuple(_args, "O&", |
| 3223 | ResObj_Convert, &gdh)) |
| 3224 | return NULL; |
| 3225 | DisposeGDevice(gdh); |
| 3226 | Py_INCREF(Py_None); |
| 3227 | _res = Py_None; |
| 3228 | return _res; |
| 3229 | } |
| 3230 | |
| 3231 | static PyObject *Qd_SetGDevice(_self, _args) |
| 3232 | PyObject *_self; |
| 3233 | PyObject *_args; |
| 3234 | { |
| 3235 | PyObject *_res = NULL; |
| 3236 | GDHandle gd; |
| 3237 | if (!PyArg_ParseTuple(_args, "O&", |
| 3238 | ResObj_Convert, &gd)) |
| 3239 | return NULL; |
| 3240 | SetGDevice(gd); |
| 3241 | Py_INCREF(Py_None); |
| 3242 | _res = Py_None; |
| 3243 | return _res; |
| 3244 | } |
| 3245 | |
| 3246 | static PyObject *Qd_GetGDevice(_self, _args) |
| 3247 | PyObject *_self; |
| 3248 | PyObject *_args; |
| 3249 | { |
| 3250 | PyObject *_res = NULL; |
| 3251 | GDHandle _rv; |
| 3252 | if (!PyArg_ParseTuple(_args, "")) |
| 3253 | return NULL; |
| 3254 | _rv = GetGDevice(); |
| 3255 | _res = Py_BuildValue("O&", |
| 3256 | ResObj_New, _rv); |
| 3257 | return _res; |
| 3258 | } |
| 3259 | |
Jack Jansen | 232f3cd | 1995-12-09 14:04:31 +0000 | [diff] [blame] | 3260 | static PyObject *Qd_Color2Index(_self, _args) |
| 3261 | PyObject *_self; |
| 3262 | PyObject *_args; |
| 3263 | { |
| 3264 | PyObject *_res = NULL; |
| 3265 | long _rv; |
| 3266 | RGBColor myColor; |
| 3267 | if (!PyArg_ParseTuple(_args, "O&", |
| 3268 | QdRGB_Convert, &myColor)) |
| 3269 | return NULL; |
| 3270 | _rv = Color2Index(&myColor); |
| 3271 | _res = Py_BuildValue("l", |
| 3272 | _rv); |
| 3273 | return _res; |
| 3274 | } |
| 3275 | |
| 3276 | static PyObject *Qd_Index2Color(_self, _args) |
| 3277 | PyObject *_self; |
| 3278 | PyObject *_args; |
| 3279 | { |
| 3280 | PyObject *_res = NULL; |
| 3281 | long index; |
| 3282 | RGBColor aColor; |
| 3283 | if (!PyArg_ParseTuple(_args, "l", |
| 3284 | &index)) |
| 3285 | return NULL; |
| 3286 | Index2Color(index, |
| 3287 | &aColor); |
| 3288 | _res = Py_BuildValue("O&", |
| 3289 | QdRGB_New, &aColor); |
| 3290 | return _res; |
| 3291 | } |
| 3292 | |
| 3293 | static PyObject *Qd_InvertColor(_self, _args) |
| 3294 | PyObject *_self; |
| 3295 | PyObject *_args; |
| 3296 | { |
| 3297 | PyObject *_res = NULL; |
| 3298 | RGBColor myColor; |
| 3299 | if (!PyArg_ParseTuple(_args, "")) |
| 3300 | return NULL; |
| 3301 | InvertColor(&myColor); |
| 3302 | _res = Py_BuildValue("O&", |
| 3303 | QdRGB_New, &myColor); |
| 3304 | return _res; |
| 3305 | } |
| 3306 | |
| 3307 | static PyObject *Qd_RealColor(_self, _args) |
| 3308 | PyObject *_self; |
| 3309 | PyObject *_args; |
| 3310 | { |
| 3311 | PyObject *_res = NULL; |
| 3312 | Boolean _rv; |
| 3313 | RGBColor color; |
| 3314 | if (!PyArg_ParseTuple(_args, "O&", |
| 3315 | QdRGB_Convert, &color)) |
| 3316 | return NULL; |
| 3317 | _rv = RealColor(&color); |
| 3318 | _res = Py_BuildValue("b", |
| 3319 | _rv); |
| 3320 | return _res; |
| 3321 | } |
| 3322 | |
Jack Jansen | 69b43ed | 1997-08-15 14:35:54 +0000 | [diff] [blame] | 3323 | static PyObject *Qd_GetSubTable(_self, _args) |
| 3324 | PyObject *_self; |
| 3325 | PyObject *_args; |
| 3326 | { |
| 3327 | PyObject *_res = NULL; |
| 3328 | CTabHandle myColors; |
| 3329 | short iTabRes; |
| 3330 | CTabHandle targetTbl; |
| 3331 | if (!PyArg_ParseTuple(_args, "O&hO&", |
| 3332 | ResObj_Convert, &myColors, |
| 3333 | &iTabRes, |
| 3334 | ResObj_Convert, &targetTbl)) |
| 3335 | return NULL; |
| 3336 | GetSubTable(myColors, |
| 3337 | iTabRes, |
| 3338 | targetTbl); |
| 3339 | Py_INCREF(Py_None); |
| 3340 | _res = Py_None; |
| 3341 | return _res; |
| 3342 | } |
| 3343 | |
| 3344 | static PyObject *Qd_MakeITable(_self, _args) |
| 3345 | PyObject *_self; |
| 3346 | PyObject *_args; |
| 3347 | { |
| 3348 | PyObject *_res = NULL; |
| 3349 | CTabHandle cTabH; |
| 3350 | ITabHandle iTabH; |
| 3351 | short res; |
| 3352 | if (!PyArg_ParseTuple(_args, "O&O&h", |
| 3353 | ResObj_Convert, &cTabH, |
| 3354 | ResObj_Convert, &iTabH, |
| 3355 | &res)) |
| 3356 | return NULL; |
| 3357 | MakeITable(cTabH, |
| 3358 | iTabH, |
| 3359 | res); |
| 3360 | Py_INCREF(Py_None); |
| 3361 | _res = Py_None; |
| 3362 | return _res; |
| 3363 | } |
| 3364 | |
Guido van Rossum | e56db43 | 1995-03-19 22:49:50 +0000 | [diff] [blame] | 3365 | static PyObject *Qd_SetClientID(_self, _args) |
| 3366 | PyObject *_self; |
| 3367 | PyObject *_args; |
| 3368 | { |
| 3369 | PyObject *_res = NULL; |
| 3370 | short id; |
| 3371 | if (!PyArg_ParseTuple(_args, "h", |
| 3372 | &id)) |
| 3373 | return NULL; |
| 3374 | SetClientID(id); |
| 3375 | Py_INCREF(Py_None); |
| 3376 | _res = Py_None; |
| 3377 | return _res; |
| 3378 | } |
| 3379 | |
| 3380 | static PyObject *Qd_ProtectEntry(_self, _args) |
| 3381 | PyObject *_self; |
| 3382 | PyObject *_args; |
| 3383 | { |
| 3384 | PyObject *_res = NULL; |
| 3385 | short index; |
| 3386 | Boolean protect; |
| 3387 | if (!PyArg_ParseTuple(_args, "hb", |
| 3388 | &index, |
| 3389 | &protect)) |
| 3390 | return NULL; |
| 3391 | ProtectEntry(index, |
| 3392 | protect); |
| 3393 | Py_INCREF(Py_None); |
| 3394 | _res = Py_None; |
| 3395 | return _res; |
| 3396 | } |
| 3397 | |
| 3398 | static PyObject *Qd_ReserveEntry(_self, _args) |
| 3399 | PyObject *_self; |
| 3400 | PyObject *_args; |
| 3401 | { |
| 3402 | PyObject *_res = NULL; |
| 3403 | short index; |
| 3404 | Boolean reserve; |
| 3405 | if (!PyArg_ParseTuple(_args, "hb", |
| 3406 | &index, |
| 3407 | &reserve)) |
| 3408 | return NULL; |
| 3409 | ReserveEntry(index, |
| 3410 | reserve); |
| 3411 | Py_INCREF(Py_None); |
| 3412 | _res = Py_None; |
| 3413 | return _res; |
| 3414 | } |
| 3415 | |
| 3416 | static PyObject *Qd_QDError(_self, _args) |
| 3417 | PyObject *_self; |
| 3418 | PyObject *_args; |
| 3419 | { |
| 3420 | PyObject *_res = NULL; |
| 3421 | short _rv; |
| 3422 | if (!PyArg_ParseTuple(_args, "")) |
| 3423 | return NULL; |
| 3424 | _rv = QDError(); |
| 3425 | _res = Py_BuildValue("h", |
| 3426 | _rv); |
| 3427 | return _res; |
| 3428 | } |
| 3429 | |
Jack Jansen | 41058c0 | 1995-11-16 22:48:29 +0000 | [diff] [blame] | 3430 | static PyObject *Qd_CopyDeepMask(_self, _args) |
| 3431 | PyObject *_self; |
| 3432 | PyObject *_args; |
| 3433 | { |
| 3434 | PyObject *_res = NULL; |
| 3435 | BitMapPtr srcBits; |
| 3436 | BitMapPtr maskBits; |
| 3437 | BitMapPtr dstBits; |
| 3438 | Rect srcRect; |
| 3439 | Rect maskRect; |
| 3440 | Rect dstRect; |
| 3441 | short mode; |
| 3442 | RgnHandle maskRgn; |
| 3443 | if (!PyArg_ParseTuple(_args, "O&O&O&O&O&O&hO&", |
| 3444 | BMObj_Convert, &srcBits, |
| 3445 | BMObj_Convert, &maskBits, |
| 3446 | BMObj_Convert, &dstBits, |
| 3447 | PyMac_GetRect, &srcRect, |
| 3448 | PyMac_GetRect, &maskRect, |
| 3449 | PyMac_GetRect, &dstRect, |
| 3450 | &mode, |
Jack Jansen | 425e9eb | 1995-12-12 15:02:03 +0000 | [diff] [blame] | 3451 | OptResObj_Convert, &maskRgn)) |
Jack Jansen | 41058c0 | 1995-11-16 22:48:29 +0000 | [diff] [blame] | 3452 | return NULL; |
| 3453 | CopyDeepMask(srcBits, |
| 3454 | maskBits, |
| 3455 | dstBits, |
| 3456 | &srcRect, |
| 3457 | &maskRect, |
| 3458 | &dstRect, |
| 3459 | mode, |
| 3460 | maskRgn); |
| 3461 | Py_INCREF(Py_None); |
| 3462 | _res = Py_None; |
| 3463 | return _res; |
| 3464 | } |
| 3465 | |
Jack Jansen | 54c8f7e | 1995-11-14 10:46:01 +0000 | [diff] [blame] | 3466 | static PyObject *Qd_GetPattern(_self, _args) |
| 3467 | PyObject *_self; |
| 3468 | PyObject *_args; |
| 3469 | { |
| 3470 | PyObject *_res = NULL; |
| 3471 | PatHandle _rv; |
| 3472 | short patternID; |
| 3473 | if (!PyArg_ParseTuple(_args, "h", |
| 3474 | &patternID)) |
| 3475 | return NULL; |
| 3476 | _rv = GetPattern(patternID); |
| 3477 | _res = Py_BuildValue("O&", |
| 3478 | ResObj_New, _rv); |
| 3479 | return _res; |
| 3480 | } |
| 3481 | |
| 3482 | static PyObject *Qd_GetCursor(_self, _args) |
| 3483 | PyObject *_self; |
| 3484 | PyObject *_args; |
| 3485 | { |
| 3486 | PyObject *_res = NULL; |
| 3487 | CursHandle _rv; |
| 3488 | short cursorID; |
| 3489 | if (!PyArg_ParseTuple(_args, "h", |
| 3490 | &cursorID)) |
| 3491 | return NULL; |
| 3492 | _rv = GetCursor(cursorID); |
| 3493 | _res = Py_BuildValue("O&", |
| 3494 | ResObj_New, _rv); |
| 3495 | return _res; |
| 3496 | } |
| 3497 | |
| 3498 | static PyObject *Qd_GetPicture(_self, _args) |
| 3499 | PyObject *_self; |
| 3500 | PyObject *_args; |
| 3501 | { |
| 3502 | PyObject *_res = NULL; |
| 3503 | PicHandle _rv; |
| 3504 | short pictureID; |
| 3505 | if (!PyArg_ParseTuple(_args, "h", |
| 3506 | &pictureID)) |
| 3507 | return NULL; |
| 3508 | _rv = GetPicture(pictureID); |
| 3509 | _res = Py_BuildValue("O&", |
| 3510 | ResObj_New, _rv); |
| 3511 | return _res; |
| 3512 | } |
| 3513 | |
| 3514 | static PyObject *Qd_DeltaPoint(_self, _args) |
| 3515 | PyObject *_self; |
| 3516 | PyObject *_args; |
| 3517 | { |
| 3518 | PyObject *_res = NULL; |
| 3519 | long _rv; |
| 3520 | Point ptA; |
| 3521 | Point ptB; |
| 3522 | if (!PyArg_ParseTuple(_args, "O&O&", |
| 3523 | PyMac_GetPoint, &ptA, |
| 3524 | PyMac_GetPoint, &ptB)) |
| 3525 | return NULL; |
| 3526 | _rv = DeltaPoint(ptA, |
| 3527 | ptB); |
| 3528 | _res = Py_BuildValue("l", |
| 3529 | _rv); |
| 3530 | return _res; |
| 3531 | } |
| 3532 | |
| 3533 | static PyObject *Qd_ShieldCursor(_self, _args) |
| 3534 | PyObject *_self; |
| 3535 | PyObject *_args; |
| 3536 | { |
| 3537 | PyObject *_res = NULL; |
| 3538 | Rect shieldRect; |
| 3539 | Point offsetPt; |
| 3540 | if (!PyArg_ParseTuple(_args, "O&O&", |
| 3541 | PyMac_GetRect, &shieldRect, |
| 3542 | PyMac_GetPoint, &offsetPt)) |
| 3543 | return NULL; |
| 3544 | ShieldCursor(&shieldRect, |
| 3545 | offsetPt); |
| 3546 | Py_INCREF(Py_None); |
| 3547 | _res = Py_None; |
| 3548 | return _res; |
| 3549 | } |
| 3550 | |
| 3551 | static PyObject *Qd_ScreenRes(_self, _args) |
| 3552 | PyObject *_self; |
| 3553 | PyObject *_args; |
| 3554 | { |
| 3555 | PyObject *_res = NULL; |
| 3556 | short scrnHRes; |
| 3557 | short scrnVRes; |
| 3558 | if (!PyArg_ParseTuple(_args, "")) |
| 3559 | return NULL; |
| 3560 | ScreenRes(&scrnHRes, |
| 3561 | &scrnVRes); |
| 3562 | _res = Py_BuildValue("hh", |
| 3563 | scrnHRes, |
| 3564 | scrnVRes); |
| 3565 | return _res; |
| 3566 | } |
| 3567 | |
Jack Jansen | 04a02e7 | 1996-01-06 17:12:58 +0000 | [diff] [blame] | 3568 | static PyObject *Qd_GetIndPattern(_self, _args) |
| 3569 | PyObject *_self; |
| 3570 | PyObject *_args; |
| 3571 | { |
| 3572 | PyObject *_res = NULL; |
| 3573 | Pattern thePat__out__; |
| 3574 | short patternListID; |
| 3575 | short index; |
| 3576 | if (!PyArg_ParseTuple(_args, "hh", |
| 3577 | &patternListID, |
| 3578 | &index)) |
| 3579 | return NULL; |
| 3580 | GetIndPattern(&thePat__out__, |
| 3581 | patternListID, |
| 3582 | index); |
| 3583 | _res = Py_BuildValue("s#", |
| 3584 | (char *)&thePat__out__, (int)sizeof(Pattern)); |
| 3585 | thePat__error__: ; |
| 3586 | return _res; |
| 3587 | } |
| 3588 | |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 3589 | static PyObject *Qd_SlopeFromAngle(_self, _args) |
| 3590 | PyObject *_self; |
| 3591 | PyObject *_args; |
| 3592 | { |
| 3593 | PyObject *_res = NULL; |
| 3594 | Fixed _rv; |
| 3595 | short angle; |
| 3596 | if (!PyArg_ParseTuple(_args, "h", |
| 3597 | &angle)) |
| 3598 | return NULL; |
| 3599 | _rv = SlopeFromAngle(angle); |
| 3600 | _res = Py_BuildValue("O&", |
| 3601 | PyMac_BuildFixed, _rv); |
| 3602 | return _res; |
| 3603 | } |
| 3604 | |
| 3605 | static PyObject *Qd_AngleFromSlope(_self, _args) |
| 3606 | PyObject *_self; |
| 3607 | PyObject *_args; |
| 3608 | { |
| 3609 | PyObject *_res = NULL; |
| 3610 | short _rv; |
| 3611 | Fixed slope; |
| 3612 | if (!PyArg_ParseTuple(_args, "O&", |
| 3613 | PyMac_GetFixed, &slope)) |
| 3614 | return NULL; |
| 3615 | _rv = AngleFromSlope(slope); |
| 3616 | _res = Py_BuildValue("h", |
| 3617 | _rv); |
| 3618 | return _res; |
| 3619 | } |
| 3620 | |
Jack Jansen | b81cf9d | 1995-06-06 13:08:40 +0000 | [diff] [blame] | 3621 | static PyObject *Qd_TextFont(_self, _args) |
| 3622 | PyObject *_self; |
| 3623 | PyObject *_args; |
| 3624 | { |
| 3625 | PyObject *_res = NULL; |
| 3626 | short font; |
| 3627 | if (!PyArg_ParseTuple(_args, "h", |
| 3628 | &font)) |
| 3629 | return NULL; |
| 3630 | TextFont(font); |
| 3631 | Py_INCREF(Py_None); |
| 3632 | _res = Py_None; |
| 3633 | return _res; |
| 3634 | } |
| 3635 | |
| 3636 | static PyObject *Qd_TextFace(_self, _args) |
| 3637 | PyObject *_self; |
| 3638 | PyObject *_args; |
| 3639 | { |
| 3640 | PyObject *_res = NULL; |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 3641 | Style face; |
Jack Jansen | b81cf9d | 1995-06-06 13:08:40 +0000 | [diff] [blame] | 3642 | if (!PyArg_ParseTuple(_args, "h", |
| 3643 | &face)) |
| 3644 | return NULL; |
| 3645 | TextFace(face); |
| 3646 | Py_INCREF(Py_None); |
| 3647 | _res = Py_None; |
| 3648 | return _res; |
| 3649 | } |
| 3650 | |
| 3651 | static PyObject *Qd_TextMode(_self, _args) |
| 3652 | PyObject *_self; |
| 3653 | PyObject *_args; |
| 3654 | { |
| 3655 | PyObject *_res = NULL; |
| 3656 | short mode; |
| 3657 | if (!PyArg_ParseTuple(_args, "h", |
| 3658 | &mode)) |
| 3659 | return NULL; |
| 3660 | TextMode(mode); |
| 3661 | Py_INCREF(Py_None); |
| 3662 | _res = Py_None; |
| 3663 | return _res; |
| 3664 | } |
| 3665 | |
| 3666 | static PyObject *Qd_TextSize(_self, _args) |
| 3667 | PyObject *_self; |
| 3668 | PyObject *_args; |
| 3669 | { |
| 3670 | PyObject *_res = NULL; |
| 3671 | short size; |
| 3672 | if (!PyArg_ParseTuple(_args, "h", |
| 3673 | &size)) |
| 3674 | return NULL; |
| 3675 | TextSize(size); |
| 3676 | Py_INCREF(Py_None); |
| 3677 | _res = Py_None; |
| 3678 | return _res; |
| 3679 | } |
| 3680 | |
| 3681 | static PyObject *Qd_SpaceExtra(_self, _args) |
| 3682 | PyObject *_self; |
| 3683 | PyObject *_args; |
| 3684 | { |
| 3685 | PyObject *_res = NULL; |
Jack Jansen | 330381c | 1995-11-15 15:18:01 +0000 | [diff] [blame] | 3686 | Fixed extra; |
| 3687 | if (!PyArg_ParseTuple(_args, "O&", |
| 3688 | PyMac_GetFixed, &extra)) |
Jack Jansen | b81cf9d | 1995-06-06 13:08:40 +0000 | [diff] [blame] | 3689 | return NULL; |
| 3690 | SpaceExtra(extra); |
| 3691 | Py_INCREF(Py_None); |
| 3692 | _res = Py_None; |
| 3693 | return _res; |
| 3694 | } |
| 3695 | |
| 3696 | static PyObject *Qd_DrawChar(_self, _args) |
| 3697 | PyObject *_self; |
| 3698 | PyObject *_args; |
| 3699 | { |
| 3700 | PyObject *_res = NULL; |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 3701 | CharParameter ch; |
| 3702 | if (!PyArg_ParseTuple(_args, "c", |
Jack Jansen | b81cf9d | 1995-06-06 13:08:40 +0000 | [diff] [blame] | 3703 | &ch)) |
| 3704 | return NULL; |
| 3705 | DrawChar(ch); |
| 3706 | Py_INCREF(Py_None); |
| 3707 | _res = Py_None; |
| 3708 | return _res; |
| 3709 | } |
| 3710 | |
| 3711 | static PyObject *Qd_DrawString(_self, _args) |
| 3712 | PyObject *_self; |
| 3713 | PyObject *_args; |
| 3714 | { |
| 3715 | PyObject *_res = NULL; |
| 3716 | Str255 s; |
| 3717 | if (!PyArg_ParseTuple(_args, "O&", |
| 3718 | PyMac_GetStr255, s)) |
| 3719 | return NULL; |
| 3720 | DrawString(s); |
| 3721 | Py_INCREF(Py_None); |
| 3722 | _res = Py_None; |
| 3723 | return _res; |
| 3724 | } |
| 3725 | |
| 3726 | static PyObject *Qd_DrawText(_self, _args) |
| 3727 | PyObject *_self; |
| 3728 | PyObject *_args; |
| 3729 | { |
| 3730 | PyObject *_res = NULL; |
| 3731 | char *textBuf__in__; |
| 3732 | int textBuf__len__; |
| 3733 | int textBuf__in_len__; |
| 3734 | short firstByte; |
| 3735 | short byteCount; |
| 3736 | if (!PyArg_ParseTuple(_args, "s#hh", |
| 3737 | &textBuf__in__, &textBuf__in_len__, |
| 3738 | &firstByte, |
| 3739 | &byteCount)) |
| 3740 | return NULL; |
| 3741 | DrawText(textBuf__in__, |
| 3742 | firstByte, |
| 3743 | byteCount); |
| 3744 | Py_INCREF(Py_None); |
| 3745 | _res = Py_None; |
| 3746 | textBuf__error__: ; |
| 3747 | return _res; |
| 3748 | } |
| 3749 | |
| 3750 | static PyObject *Qd_CharWidth(_self, _args) |
| 3751 | PyObject *_self; |
| 3752 | PyObject *_args; |
| 3753 | { |
| 3754 | PyObject *_res = NULL; |
| 3755 | short _rv; |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 3756 | CharParameter ch; |
| 3757 | if (!PyArg_ParseTuple(_args, "c", |
Jack Jansen | b81cf9d | 1995-06-06 13:08:40 +0000 | [diff] [blame] | 3758 | &ch)) |
| 3759 | return NULL; |
| 3760 | _rv = CharWidth(ch); |
| 3761 | _res = Py_BuildValue("h", |
| 3762 | _rv); |
| 3763 | return _res; |
| 3764 | } |
| 3765 | |
| 3766 | static PyObject *Qd_StringWidth(_self, _args) |
| 3767 | PyObject *_self; |
| 3768 | PyObject *_args; |
| 3769 | { |
| 3770 | PyObject *_res = NULL; |
| 3771 | short _rv; |
| 3772 | Str255 s; |
| 3773 | if (!PyArg_ParseTuple(_args, "O&", |
| 3774 | PyMac_GetStr255, s)) |
| 3775 | return NULL; |
| 3776 | _rv = StringWidth(s); |
| 3777 | _res = Py_BuildValue("h", |
| 3778 | _rv); |
| 3779 | return _res; |
| 3780 | } |
| 3781 | |
| 3782 | static PyObject *Qd_TextWidth(_self, _args) |
| 3783 | PyObject *_self; |
| 3784 | PyObject *_args; |
| 3785 | { |
| 3786 | PyObject *_res = NULL; |
| 3787 | short _rv; |
| 3788 | char *textBuf__in__; |
| 3789 | int textBuf__len__; |
| 3790 | int textBuf__in_len__; |
| 3791 | short firstByte; |
| 3792 | short byteCount; |
| 3793 | if (!PyArg_ParseTuple(_args, "s#hh", |
| 3794 | &textBuf__in__, &textBuf__in_len__, |
| 3795 | &firstByte, |
| 3796 | &byteCount)) |
| 3797 | return NULL; |
| 3798 | _rv = TextWidth(textBuf__in__, |
| 3799 | firstByte, |
| 3800 | byteCount); |
| 3801 | _res = Py_BuildValue("h", |
| 3802 | _rv); |
| 3803 | textBuf__error__: ; |
| 3804 | return _res; |
| 3805 | } |
| 3806 | |
Jack Jansen | 3a50f8a | 1996-01-11 16:17:14 +0000 | [diff] [blame] | 3807 | static PyObject *Qd_GetFontInfo(_self, _args) |
| 3808 | PyObject *_self; |
| 3809 | PyObject *_args; |
| 3810 | { |
| 3811 | PyObject *_res = NULL; |
| 3812 | FontInfo info; |
| 3813 | if (!PyArg_ParseTuple(_args, "")) |
| 3814 | return NULL; |
| 3815 | GetFontInfo(&info); |
| 3816 | _res = Py_BuildValue("O&", |
| 3817 | QdFI_New, &info); |
| 3818 | return _res; |
| 3819 | } |
| 3820 | |
Jack Jansen | b81cf9d | 1995-06-06 13:08:40 +0000 | [diff] [blame] | 3821 | static PyObject *Qd_CharExtra(_self, _args) |
| 3822 | PyObject *_self; |
| 3823 | PyObject *_args; |
| 3824 | { |
| 3825 | PyObject *_res = NULL; |
Jack Jansen | 330381c | 1995-11-15 15:18:01 +0000 | [diff] [blame] | 3826 | Fixed extra; |
| 3827 | if (!PyArg_ParseTuple(_args, "O&", |
| 3828 | PyMac_GetFixed, &extra)) |
Jack Jansen | b81cf9d | 1995-06-06 13:08:40 +0000 | [diff] [blame] | 3829 | return NULL; |
| 3830 | CharExtra(extra); |
| 3831 | Py_INCREF(Py_None); |
| 3832 | _res = Py_None; |
| 3833 | return _res; |
| 3834 | } |
| 3835 | |
Jack Jansen | 41058c0 | 1995-11-16 22:48:29 +0000 | [diff] [blame] | 3836 | static PyObject *Qd_BitMap(_self, _args) |
| 3837 | PyObject *_self; |
| 3838 | PyObject *_args; |
| 3839 | { |
| 3840 | PyObject *_res = NULL; |
| 3841 | |
| 3842 | BitMap *ptr; |
| 3843 | PyObject *source; |
| 3844 | Rect bounds; |
| 3845 | int rowbytes; |
| 3846 | char *data; |
| 3847 | |
| 3848 | if ( !PyArg_ParseTuple(_args, "O!iO&", &PyString_Type, &source, &rowbytes, PyMac_GetRect, |
| 3849 | &bounds) ) |
| 3850 | return NULL; |
| 3851 | data = PyString_AsString(source); |
| 3852 | if ((ptr=(BitMap *)malloc(sizeof(BitMap))) == NULL ) |
| 3853 | return PyErr_NoMemory(); |
| 3854 | ptr->baseAddr = (Ptr)data; |
| 3855 | ptr->rowBytes = rowbytes; |
| 3856 | ptr->bounds = bounds; |
| 3857 | if ( (_res = BMObj_New(ptr)) == NULL ) { |
| 3858 | free(ptr); |
| 3859 | return NULL; |
| 3860 | } |
| 3861 | ((BitMapObject *)_res)->referred_object = source; |
| 3862 | Py_INCREF(source); |
| 3863 | ((BitMapObject *)_res)->referred_bitmap = ptr; |
| 3864 | return _res; |
| 3865 | |
| 3866 | } |
| 3867 | |
Jack Jansen | 425e9eb | 1995-12-12 15:02:03 +0000 | [diff] [blame] | 3868 | static PyObject *Qd_RawBitMap(_self, _args) |
| 3869 | PyObject *_self; |
| 3870 | PyObject *_args; |
| 3871 | { |
| 3872 | PyObject *_res = NULL; |
| 3873 | |
| 3874 | BitMap *ptr; |
| 3875 | PyObject *source; |
| 3876 | |
| 3877 | if ( !PyArg_ParseTuple(_args, "O!", &PyString_Type, &source) ) |
| 3878 | return NULL; |
| 3879 | if ( PyString_Size(source) != sizeof(BitMap) && PyString_Size(source) != sizeof(PixMap) ) { |
| 3880 | PyErr_BadArgument(); |
| 3881 | return NULL; |
| 3882 | } |
| 3883 | ptr = (BitMapPtr)PyString_AsString(source); |
| 3884 | if ( (_res = BMObj_New(ptr)) == NULL ) { |
| 3885 | return NULL; |
| 3886 | } |
| 3887 | ((BitMapObject *)_res)->referred_object = source; |
| 3888 | Py_INCREF(source); |
| 3889 | return _res; |
| 3890 | |
| 3891 | } |
| 3892 | |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 3893 | static PyMethodDef Qd_methods[] = { |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 3894 | {"SetPort", (PyCFunction)Qd_SetPort, 1, |
Jack Jansen | 330381c | 1995-11-15 15:18:01 +0000 | [diff] [blame] | 3895 | "(GrafPtr port) -> None"}, |
Guido van Rossum | e56db43 | 1995-03-19 22:49:50 +0000 | [diff] [blame] | 3896 | {"GetPort", (PyCFunction)Qd_GetPort, 1, |
Jack Jansen | 330381c | 1995-11-15 15:18:01 +0000 | [diff] [blame] | 3897 | "() -> (GrafPtr port)"}, |
Guido van Rossum | e56db43 | 1995-03-19 22:49:50 +0000 | [diff] [blame] | 3898 | {"GrafDevice", (PyCFunction)Qd_GrafDevice, 1, |
| 3899 | "(short device) -> None"}, |
Jack Jansen | 41058c0 | 1995-11-16 22:48:29 +0000 | [diff] [blame] | 3900 | {"SetPortBits", (PyCFunction)Qd_SetPortBits, 1, |
| 3901 | "(BitMapPtr bm) -> None"}, |
Guido van Rossum | e56db43 | 1995-03-19 22:49:50 +0000 | [diff] [blame] | 3902 | {"PortSize", (PyCFunction)Qd_PortSize, 1, |
| 3903 | "(short width, short height) -> None"}, |
| 3904 | {"MovePortTo", (PyCFunction)Qd_MovePortTo, 1, |
| 3905 | "(short leftGlobal, short topGlobal) -> None"}, |
| 3906 | {"SetOrigin", (PyCFunction)Qd_SetOrigin, 1, |
| 3907 | "(short h, short v) -> None"}, |
| 3908 | {"SetClip", (PyCFunction)Qd_SetClip, 1, |
| 3909 | "(RgnHandle rgn) -> None"}, |
| 3910 | {"GetClip", (PyCFunction)Qd_GetClip, 1, |
| 3911 | "(RgnHandle rgn) -> None"}, |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 3912 | {"ClipRect", (PyCFunction)Qd_ClipRect, 1, |
| 3913 | "(Rect r) -> None"}, |
Jack Jansen | 04a02e7 | 1996-01-06 17:12:58 +0000 | [diff] [blame] | 3914 | {"BackPat", (PyCFunction)Qd_BackPat, 1, |
| 3915 | "(Pattern pat) -> None"}, |
Guido van Rossum | e56db43 | 1995-03-19 22:49:50 +0000 | [diff] [blame] | 3916 | {"InitCursor", (PyCFunction)Qd_InitCursor, 1, |
| 3917 | "() -> None"}, |
Jack Jansen | b539406 | 1996-01-05 18:06:41 +0000 | [diff] [blame] | 3918 | {"SetCursor", (PyCFunction)Qd_SetCursor, 1, |
| 3919 | "(Cursor crsr) -> None"}, |
Guido van Rossum | e56db43 | 1995-03-19 22:49:50 +0000 | [diff] [blame] | 3920 | {"HideCursor", (PyCFunction)Qd_HideCursor, 1, |
| 3921 | "() -> None"}, |
| 3922 | {"ShowCursor", (PyCFunction)Qd_ShowCursor, 1, |
| 3923 | "() -> None"}, |
| 3924 | {"ObscureCursor", (PyCFunction)Qd_ObscureCursor, 1, |
| 3925 | "() -> None"}, |
| 3926 | {"HidePen", (PyCFunction)Qd_HidePen, 1, |
| 3927 | "() -> None"}, |
| 3928 | {"ShowPen", (PyCFunction)Qd_ShowPen, 1, |
| 3929 | "() -> None"}, |
| 3930 | {"GetPen", (PyCFunction)Qd_GetPen, 1, |
Jack Jansen | 1d8ede7 | 1996-01-08 23:47:31 +0000 | [diff] [blame] | 3931 | "() -> (Point pt)"}, |
Jack Jansen | 04a02e7 | 1996-01-06 17:12:58 +0000 | [diff] [blame] | 3932 | {"GetPenState", (PyCFunction)Qd_GetPenState, 1, |
| 3933 | "() -> (PenState pnState)"}, |
| 3934 | {"SetPenState", (PyCFunction)Qd_SetPenState, 1, |
| 3935 | "(PenState pnState) -> None"}, |
Guido van Rossum | e56db43 | 1995-03-19 22:49:50 +0000 | [diff] [blame] | 3936 | {"PenSize", (PyCFunction)Qd_PenSize, 1, |
| 3937 | "(short width, short height) -> None"}, |
| 3938 | {"PenMode", (PyCFunction)Qd_PenMode, 1, |
| 3939 | "(short mode) -> None"}, |
Jack Jansen | 04a02e7 | 1996-01-06 17:12:58 +0000 | [diff] [blame] | 3940 | {"PenPat", (PyCFunction)Qd_PenPat, 1, |
| 3941 | "(Pattern pat) -> None"}, |
Guido van Rossum | e56db43 | 1995-03-19 22:49:50 +0000 | [diff] [blame] | 3942 | {"PenNormal", (PyCFunction)Qd_PenNormal, 1, |
| 3943 | "() -> None"}, |
| 3944 | {"MoveTo", (PyCFunction)Qd_MoveTo, 1, |
| 3945 | "(short h, short v) -> None"}, |
| 3946 | {"Move", (PyCFunction)Qd_Move, 1, |
| 3947 | "(short dh, short dv) -> None"}, |
| 3948 | {"LineTo", (PyCFunction)Qd_LineTo, 1, |
| 3949 | "(short h, short v) -> None"}, |
| 3950 | {"Line", (PyCFunction)Qd_Line, 1, |
| 3951 | "(short dh, short dv) -> None"}, |
Guido van Rossum | e56db43 | 1995-03-19 22:49:50 +0000 | [diff] [blame] | 3952 | {"ForeColor", (PyCFunction)Qd_ForeColor, 1, |
| 3953 | "(long color) -> None"}, |
| 3954 | {"BackColor", (PyCFunction)Qd_BackColor, 1, |
| 3955 | "(long color) -> None"}, |
| 3956 | {"ColorBit", (PyCFunction)Qd_ColorBit, 1, |
| 3957 | "(short whichBit) -> None"}, |
| 3958 | {"SetRect", (PyCFunction)Qd_SetRect, 1, |
| 3959 | "(short left, short top, short right, short bottom) -> (Rect r)"}, |
| 3960 | {"OffsetRect", (PyCFunction)Qd_OffsetRect, 1, |
Jack Jansen | 54c8f7e | 1995-11-14 10:46:01 +0000 | [diff] [blame] | 3961 | "(Rect r, short dh, short dv) -> (Rect r)"}, |
Guido van Rossum | e56db43 | 1995-03-19 22:49:50 +0000 | [diff] [blame] | 3962 | {"InsetRect", (PyCFunction)Qd_InsetRect, 1, |
Jack Jansen | 54c8f7e | 1995-11-14 10:46:01 +0000 | [diff] [blame] | 3963 | "(Rect r, short dh, short dv) -> (Rect r)"}, |
Guido van Rossum | e56db43 | 1995-03-19 22:49:50 +0000 | [diff] [blame] | 3964 | {"SectRect", (PyCFunction)Qd_SectRect, 1, |
| 3965 | "(Rect src1, Rect src2) -> (Boolean _rv, Rect dstRect)"}, |
| 3966 | {"UnionRect", (PyCFunction)Qd_UnionRect, 1, |
| 3967 | "(Rect src1, Rect src2) -> (Rect dstRect)"}, |
| 3968 | {"EqualRect", (PyCFunction)Qd_EqualRect, 1, |
| 3969 | "(Rect rect1, Rect rect2) -> (Boolean _rv)"}, |
| 3970 | {"EmptyRect", (PyCFunction)Qd_EmptyRect, 1, |
| 3971 | "(Rect r) -> (Boolean _rv)"}, |
| 3972 | {"FrameRect", (PyCFunction)Qd_FrameRect, 1, |
| 3973 | "(Rect r) -> None"}, |
| 3974 | {"PaintRect", (PyCFunction)Qd_PaintRect, 1, |
| 3975 | "(Rect r) -> None"}, |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 3976 | {"EraseRect", (PyCFunction)Qd_EraseRect, 1, |
| 3977 | "(Rect r) -> None"}, |
Guido van Rossum | e56db43 | 1995-03-19 22:49:50 +0000 | [diff] [blame] | 3978 | {"InvertRect", (PyCFunction)Qd_InvertRect, 1, |
| 3979 | "(Rect r) -> None"}, |
Jack Jansen | 04a02e7 | 1996-01-06 17:12:58 +0000 | [diff] [blame] | 3980 | {"FillRect", (PyCFunction)Qd_FillRect, 1, |
| 3981 | "(Rect r, Pattern pat) -> None"}, |
Guido van Rossum | e56db43 | 1995-03-19 22:49:50 +0000 | [diff] [blame] | 3982 | {"FrameOval", (PyCFunction)Qd_FrameOval, 1, |
| 3983 | "(Rect r) -> None"}, |
| 3984 | {"PaintOval", (PyCFunction)Qd_PaintOval, 1, |
| 3985 | "(Rect r) -> None"}, |
| 3986 | {"EraseOval", (PyCFunction)Qd_EraseOval, 1, |
| 3987 | "(Rect r) -> None"}, |
| 3988 | {"InvertOval", (PyCFunction)Qd_InvertOval, 1, |
| 3989 | "(Rect r) -> None"}, |
Jack Jansen | 04a02e7 | 1996-01-06 17:12:58 +0000 | [diff] [blame] | 3990 | {"FillOval", (PyCFunction)Qd_FillOval, 1, |
| 3991 | "(Rect r, Pattern pat) -> None"}, |
Guido van Rossum | e56db43 | 1995-03-19 22:49:50 +0000 | [diff] [blame] | 3992 | {"FrameRoundRect", (PyCFunction)Qd_FrameRoundRect, 1, |
| 3993 | "(Rect r, short ovalWidth, short ovalHeight) -> None"}, |
| 3994 | {"PaintRoundRect", (PyCFunction)Qd_PaintRoundRect, 1, |
| 3995 | "(Rect r, short ovalWidth, short ovalHeight) -> None"}, |
| 3996 | {"EraseRoundRect", (PyCFunction)Qd_EraseRoundRect, 1, |
| 3997 | "(Rect r, short ovalWidth, short ovalHeight) -> None"}, |
| 3998 | {"InvertRoundRect", (PyCFunction)Qd_InvertRoundRect, 1, |
| 3999 | "(Rect r, short ovalWidth, short ovalHeight) -> None"}, |
Jack Jansen | 04a02e7 | 1996-01-06 17:12:58 +0000 | [diff] [blame] | 4000 | {"FillRoundRect", (PyCFunction)Qd_FillRoundRect, 1, |
| 4001 | "(Rect r, short ovalWidth, short ovalHeight, Pattern pat) -> None"}, |
Guido van Rossum | e56db43 | 1995-03-19 22:49:50 +0000 | [diff] [blame] | 4002 | {"FrameArc", (PyCFunction)Qd_FrameArc, 1, |
| 4003 | "(Rect r, short startAngle, short arcAngle) -> None"}, |
| 4004 | {"PaintArc", (PyCFunction)Qd_PaintArc, 1, |
| 4005 | "(Rect r, short startAngle, short arcAngle) -> None"}, |
| 4006 | {"EraseArc", (PyCFunction)Qd_EraseArc, 1, |
| 4007 | "(Rect r, short startAngle, short arcAngle) -> None"}, |
| 4008 | {"InvertArc", (PyCFunction)Qd_InvertArc, 1, |
| 4009 | "(Rect r, short startAngle, short arcAngle) -> None"}, |
Jack Jansen | 04a02e7 | 1996-01-06 17:12:58 +0000 | [diff] [blame] | 4010 | {"FillArc", (PyCFunction)Qd_FillArc, 1, |
| 4011 | "(Rect r, short startAngle, short arcAngle, Pattern pat) -> None"}, |
Guido van Rossum | e56db43 | 1995-03-19 22:49:50 +0000 | [diff] [blame] | 4012 | {"NewRgn", (PyCFunction)Qd_NewRgn, 1, |
| 4013 | "() -> (RgnHandle _rv)"}, |
| 4014 | {"OpenRgn", (PyCFunction)Qd_OpenRgn, 1, |
| 4015 | "() -> None"}, |
| 4016 | {"CloseRgn", (PyCFunction)Qd_CloseRgn, 1, |
| 4017 | "(RgnHandle dstRgn) -> None"}, |
Jack Jansen | 41058c0 | 1995-11-16 22:48:29 +0000 | [diff] [blame] | 4018 | {"BitMapToRegion", (PyCFunction)Qd_BitMapToRegion, 1, |
| 4019 | "(RgnHandle region, BitMapPtr bMap) -> None"}, |
Guido van Rossum | e56db43 | 1995-03-19 22:49:50 +0000 | [diff] [blame] | 4020 | {"DisposeRgn", (PyCFunction)Qd_DisposeRgn, 1, |
| 4021 | "(RgnHandle rgn) -> None"}, |
| 4022 | {"CopyRgn", (PyCFunction)Qd_CopyRgn, 1, |
| 4023 | "(RgnHandle srcRgn, RgnHandle dstRgn) -> None"}, |
| 4024 | {"SetEmptyRgn", (PyCFunction)Qd_SetEmptyRgn, 1, |
| 4025 | "(RgnHandle rgn) -> None"}, |
| 4026 | {"SetRectRgn", (PyCFunction)Qd_SetRectRgn, 1, |
| 4027 | "(RgnHandle rgn, short left, short top, short right, short bottom) -> None"}, |
| 4028 | {"RectRgn", (PyCFunction)Qd_RectRgn, 1, |
| 4029 | "(RgnHandle rgn, Rect r) -> None"}, |
| 4030 | {"OffsetRgn", (PyCFunction)Qd_OffsetRgn, 1, |
| 4031 | "(RgnHandle rgn, short dh, short dv) -> None"}, |
| 4032 | {"InsetRgn", (PyCFunction)Qd_InsetRgn, 1, |
| 4033 | "(RgnHandle rgn, short dh, short dv) -> None"}, |
| 4034 | {"SectRgn", (PyCFunction)Qd_SectRgn, 1, |
| 4035 | "(RgnHandle srcRgnA, RgnHandle srcRgnB, RgnHandle dstRgn) -> None"}, |
| 4036 | {"UnionRgn", (PyCFunction)Qd_UnionRgn, 1, |
| 4037 | "(RgnHandle srcRgnA, RgnHandle srcRgnB, RgnHandle dstRgn) -> None"}, |
| 4038 | {"DiffRgn", (PyCFunction)Qd_DiffRgn, 1, |
| 4039 | "(RgnHandle srcRgnA, RgnHandle srcRgnB, RgnHandle dstRgn) -> None"}, |
| 4040 | {"XorRgn", (PyCFunction)Qd_XorRgn, 1, |
| 4041 | "(RgnHandle srcRgnA, RgnHandle srcRgnB, RgnHandle dstRgn) -> None"}, |
| 4042 | {"RectInRgn", (PyCFunction)Qd_RectInRgn, 1, |
| 4043 | "(Rect r, RgnHandle rgn) -> (Boolean _rv)"}, |
| 4044 | {"EqualRgn", (PyCFunction)Qd_EqualRgn, 1, |
| 4045 | "(RgnHandle rgnA, RgnHandle rgnB) -> (Boolean _rv)"}, |
| 4046 | {"EmptyRgn", (PyCFunction)Qd_EmptyRgn, 1, |
| 4047 | "(RgnHandle rgn) -> (Boolean _rv)"}, |
| 4048 | {"FrameRgn", (PyCFunction)Qd_FrameRgn, 1, |
| 4049 | "(RgnHandle rgn) -> None"}, |
| 4050 | {"PaintRgn", (PyCFunction)Qd_PaintRgn, 1, |
| 4051 | "(RgnHandle rgn) -> None"}, |
| 4052 | {"EraseRgn", (PyCFunction)Qd_EraseRgn, 1, |
| 4053 | "(RgnHandle rgn) -> None"}, |
| 4054 | {"InvertRgn", (PyCFunction)Qd_InvertRgn, 1, |
| 4055 | "(RgnHandle rgn) -> None"}, |
Jack Jansen | 04a02e7 | 1996-01-06 17:12:58 +0000 | [diff] [blame] | 4056 | {"FillRgn", (PyCFunction)Qd_FillRgn, 1, |
| 4057 | "(RgnHandle rgn, Pattern pat) -> None"}, |
Guido van Rossum | e56db43 | 1995-03-19 22:49:50 +0000 | [diff] [blame] | 4058 | {"ScrollRect", (PyCFunction)Qd_ScrollRect, 1, |
| 4059 | "(Rect r, short dh, short dv, RgnHandle updateRgn) -> None"}, |
Jack Jansen | 41058c0 | 1995-11-16 22:48:29 +0000 | [diff] [blame] | 4060 | {"CopyBits", (PyCFunction)Qd_CopyBits, 1, |
| 4061 | "(BitMapPtr srcBits, BitMapPtr dstBits, Rect srcRect, Rect dstRect, short mode, RgnHandle maskRgn) -> None"}, |
| 4062 | {"CopyMask", (PyCFunction)Qd_CopyMask, 1, |
| 4063 | "(BitMapPtr srcBits, BitMapPtr maskBits, BitMapPtr dstBits, Rect srcRect, Rect maskRect, Rect dstRect) -> None"}, |
Guido van Rossum | e56db43 | 1995-03-19 22:49:50 +0000 | [diff] [blame] | 4064 | {"OpenPicture", (PyCFunction)Qd_OpenPicture, 1, |
| 4065 | "(Rect picFrame) -> (PicHandle _rv)"}, |
| 4066 | {"PicComment", (PyCFunction)Qd_PicComment, 1, |
| 4067 | "(short kind, short dataSize, Handle dataHandle) -> None"}, |
| 4068 | {"ClosePicture", (PyCFunction)Qd_ClosePicture, 1, |
| 4069 | "() -> None"}, |
| 4070 | {"DrawPicture", (PyCFunction)Qd_DrawPicture, 1, |
| 4071 | "(PicHandle myPicture, Rect dstRect) -> None"}, |
| 4072 | {"KillPicture", (PyCFunction)Qd_KillPicture, 1, |
| 4073 | "(PicHandle myPicture) -> None"}, |
| 4074 | {"OpenPoly", (PyCFunction)Qd_OpenPoly, 1, |
| 4075 | "() -> (PolyHandle _rv)"}, |
| 4076 | {"ClosePoly", (PyCFunction)Qd_ClosePoly, 1, |
| 4077 | "() -> None"}, |
| 4078 | {"KillPoly", (PyCFunction)Qd_KillPoly, 1, |
| 4079 | "(PolyHandle poly) -> None"}, |
| 4080 | {"OffsetPoly", (PyCFunction)Qd_OffsetPoly, 1, |
| 4081 | "(PolyHandle poly, short dh, short dv) -> None"}, |
| 4082 | {"FramePoly", (PyCFunction)Qd_FramePoly, 1, |
| 4083 | "(PolyHandle poly) -> None"}, |
| 4084 | {"PaintPoly", (PyCFunction)Qd_PaintPoly, 1, |
| 4085 | "(PolyHandle poly) -> None"}, |
| 4086 | {"ErasePoly", (PyCFunction)Qd_ErasePoly, 1, |
| 4087 | "(PolyHandle poly) -> None"}, |
| 4088 | {"InvertPoly", (PyCFunction)Qd_InvertPoly, 1, |
| 4089 | "(PolyHandle poly) -> None"}, |
Jack Jansen | 04a02e7 | 1996-01-06 17:12:58 +0000 | [diff] [blame] | 4090 | {"FillPoly", (PyCFunction)Qd_FillPoly, 1, |
| 4091 | "(PolyHandle poly, Pattern pat) -> None"}, |
Guido van Rossum | e56db43 | 1995-03-19 22:49:50 +0000 | [diff] [blame] | 4092 | {"SetPt", (PyCFunction)Qd_SetPt, 1, |
Jack Jansen | 1d8ede7 | 1996-01-08 23:47:31 +0000 | [diff] [blame] | 4093 | "(short h, short v) -> (Point pt)"}, |
Guido van Rossum | e56db43 | 1995-03-19 22:49:50 +0000 | [diff] [blame] | 4094 | {"LocalToGlobal", (PyCFunction)Qd_LocalToGlobal, 1, |
| 4095 | "(Point pt) -> (Point pt)"}, |
| 4096 | {"GlobalToLocal", (PyCFunction)Qd_GlobalToLocal, 1, |
| 4097 | "(Point pt) -> (Point pt)"}, |
| 4098 | {"Random", (PyCFunction)Qd_Random, 1, |
| 4099 | "() -> (short _rv)"}, |
| 4100 | {"GetPixel", (PyCFunction)Qd_GetPixel, 1, |
| 4101 | "(short h, short v) -> (Boolean _rv)"}, |
| 4102 | {"ScalePt", (PyCFunction)Qd_ScalePt, 1, |
| 4103 | "(Point pt, Rect srcRect, Rect dstRect) -> (Point pt)"}, |
| 4104 | {"MapPt", (PyCFunction)Qd_MapPt, 1, |
| 4105 | "(Point pt, Rect srcRect, Rect dstRect) -> (Point pt)"}, |
| 4106 | {"MapRect", (PyCFunction)Qd_MapRect, 1, |
Jack Jansen | 54c8f7e | 1995-11-14 10:46:01 +0000 | [diff] [blame] | 4107 | "(Rect r, Rect srcRect, Rect dstRect) -> (Rect r)"}, |
Guido van Rossum | e56db43 | 1995-03-19 22:49:50 +0000 | [diff] [blame] | 4108 | {"MapRgn", (PyCFunction)Qd_MapRgn, 1, |
| 4109 | "(RgnHandle rgn, Rect srcRect, Rect dstRect) -> None"}, |
| 4110 | {"MapPoly", (PyCFunction)Qd_MapPoly, 1, |
| 4111 | "(PolyHandle poly, Rect srcRect, Rect dstRect) -> None"}, |
Jack Jansen | 41058c0 | 1995-11-16 22:48:29 +0000 | [diff] [blame] | 4112 | {"StdBits", (PyCFunction)Qd_StdBits, 1, |
| 4113 | "(BitMapPtr srcBits, Rect srcRect, Rect dstRect, short mode, RgnHandle maskRgn) -> None"}, |
Guido van Rossum | e56db43 | 1995-03-19 22:49:50 +0000 | [diff] [blame] | 4114 | {"AddPt", (PyCFunction)Qd_AddPt, 1, |
| 4115 | "(Point src, Point dst) -> (Point dst)"}, |
| 4116 | {"EqualPt", (PyCFunction)Qd_EqualPt, 1, |
| 4117 | "(Point pt1, Point pt2) -> (Boolean _rv)"}, |
| 4118 | {"PtInRect", (PyCFunction)Qd_PtInRect, 1, |
| 4119 | "(Point pt, Rect r) -> (Boolean _rv)"}, |
| 4120 | {"Pt2Rect", (PyCFunction)Qd_Pt2Rect, 1, |
| 4121 | "(Point pt1, Point pt2) -> (Rect dstRect)"}, |
| 4122 | {"PtToAngle", (PyCFunction)Qd_PtToAngle, 1, |
| 4123 | "(Rect r, Point pt) -> (short angle)"}, |
Jack Jansen | b81cf9d | 1995-06-06 13:08:40 +0000 | [diff] [blame] | 4124 | {"SubPt", (PyCFunction)Qd_SubPt, 1, |
| 4125 | "(Point src, Point dst) -> (Point dst)"}, |
Guido van Rossum | e56db43 | 1995-03-19 22:49:50 +0000 | [diff] [blame] | 4126 | {"PtInRgn", (PyCFunction)Qd_PtInRgn, 1, |
| 4127 | "(Point pt, RgnHandle rgn) -> (Boolean _rv)"}, |
| 4128 | {"NewPixMap", (PyCFunction)Qd_NewPixMap, 1, |
| 4129 | "() -> (PixMapHandle _rv)"}, |
Guido van Rossum | e56db43 | 1995-03-19 22:49:50 +0000 | [diff] [blame] | 4130 | {"DisposePixMap", (PyCFunction)Qd_DisposePixMap, 1, |
| 4131 | "(PixMapHandle pm) -> None"}, |
| 4132 | {"CopyPixMap", (PyCFunction)Qd_CopyPixMap, 1, |
| 4133 | "(PixMapHandle srcPM, PixMapHandle dstPM) -> None"}, |
| 4134 | {"NewPixPat", (PyCFunction)Qd_NewPixPat, 1, |
| 4135 | "() -> (PixPatHandle _rv)"}, |
Guido van Rossum | e56db43 | 1995-03-19 22:49:50 +0000 | [diff] [blame] | 4136 | {"DisposePixPat", (PyCFunction)Qd_DisposePixPat, 1, |
| 4137 | "(PixPatHandle pp) -> None"}, |
| 4138 | {"CopyPixPat", (PyCFunction)Qd_CopyPixPat, 1, |
| 4139 | "(PixPatHandle srcPP, PixPatHandle dstPP) -> None"}, |
| 4140 | {"PenPixPat", (PyCFunction)Qd_PenPixPat, 1, |
| 4141 | "(PixPatHandle pp) -> None"}, |
| 4142 | {"BackPixPat", (PyCFunction)Qd_BackPixPat, 1, |
| 4143 | "(PixPatHandle pp) -> None"}, |
| 4144 | {"GetPixPat", (PyCFunction)Qd_GetPixPat, 1, |
| 4145 | "(short patID) -> (PixPatHandle _rv)"}, |
Jack Jansen | 232f3cd | 1995-12-09 14:04:31 +0000 | [diff] [blame] | 4146 | {"MakeRGBPat", (PyCFunction)Qd_MakeRGBPat, 1, |
| 4147 | "(PixPatHandle pp, RGBColor myColor) -> None"}, |
Guido van Rossum | e56db43 | 1995-03-19 22:49:50 +0000 | [diff] [blame] | 4148 | {"FillCRect", (PyCFunction)Qd_FillCRect, 1, |
| 4149 | "(Rect r, PixPatHandle pp) -> None"}, |
| 4150 | {"FillCOval", (PyCFunction)Qd_FillCOval, 1, |
| 4151 | "(Rect r, PixPatHandle pp) -> None"}, |
| 4152 | {"FillCRoundRect", (PyCFunction)Qd_FillCRoundRect, 1, |
| 4153 | "(Rect r, short ovalWidth, short ovalHeight, PixPatHandle pp) -> None"}, |
| 4154 | {"FillCArc", (PyCFunction)Qd_FillCArc, 1, |
| 4155 | "(Rect r, short startAngle, short arcAngle, PixPatHandle pp) -> None"}, |
| 4156 | {"FillCRgn", (PyCFunction)Qd_FillCRgn, 1, |
| 4157 | "(RgnHandle rgn, PixPatHandle pp) -> None"}, |
| 4158 | {"FillCPoly", (PyCFunction)Qd_FillCPoly, 1, |
| 4159 | "(PolyHandle poly, PixPatHandle pp) -> None"}, |
Jack Jansen | 232f3cd | 1995-12-09 14:04:31 +0000 | [diff] [blame] | 4160 | {"RGBForeColor", (PyCFunction)Qd_RGBForeColor, 1, |
| 4161 | "(RGBColor color) -> None"}, |
| 4162 | {"RGBBackColor", (PyCFunction)Qd_RGBBackColor, 1, |
| 4163 | "(RGBColor color) -> None"}, |
| 4164 | {"SetCPixel", (PyCFunction)Qd_SetCPixel, 1, |
| 4165 | "(short h, short v, RGBColor cPix) -> None"}, |
Guido van Rossum | e56db43 | 1995-03-19 22:49:50 +0000 | [diff] [blame] | 4166 | {"SetPortPix", (PyCFunction)Qd_SetPortPix, 1, |
| 4167 | "(PixMapHandle pm) -> None"}, |
Jack Jansen | 232f3cd | 1995-12-09 14:04:31 +0000 | [diff] [blame] | 4168 | {"GetCPixel", (PyCFunction)Qd_GetCPixel, 1, |
| 4169 | "(short h, short v) -> (RGBColor cPix)"}, |
| 4170 | {"GetForeColor", (PyCFunction)Qd_GetForeColor, 1, |
| 4171 | "() -> (RGBColor color)"}, |
| 4172 | {"GetBackColor", (PyCFunction)Qd_GetBackColor, 1, |
| 4173 | "() -> (RGBColor color)"}, |
| 4174 | {"OpColor", (PyCFunction)Qd_OpColor, 1, |
| 4175 | "(RGBColor color) -> None"}, |
| 4176 | {"HiliteColor", (PyCFunction)Qd_HiliteColor, 1, |
| 4177 | "(RGBColor color) -> None"}, |
Jack Jansen | 69b43ed | 1997-08-15 14:35:54 +0000 | [diff] [blame] | 4178 | {"DisposeCTable", (PyCFunction)Qd_DisposeCTable, 1, |
| 4179 | "(CTabHandle cTable) -> None"}, |
| 4180 | {"GetCTable", (PyCFunction)Qd_GetCTable, 1, |
| 4181 | "(short ctID) -> (CTabHandle _rv)"}, |
| 4182 | {"GetCCursor", (PyCFunction)Qd_GetCCursor, 1, |
| 4183 | "(short crsrID) -> (CCrsrHandle _rv)"}, |
| 4184 | {"SetCCursor", (PyCFunction)Qd_SetCCursor, 1, |
| 4185 | "(CCrsrHandle cCrsr) -> None"}, |
Guido van Rossum | e56db43 | 1995-03-19 22:49:50 +0000 | [diff] [blame] | 4186 | {"AllocCursor", (PyCFunction)Qd_AllocCursor, 1, |
| 4187 | "() -> None"}, |
Jack Jansen | 69b43ed | 1997-08-15 14:35:54 +0000 | [diff] [blame] | 4188 | {"DisposeCCursor", (PyCFunction)Qd_DisposeCCursor, 1, |
| 4189 | "(CCrsrHandle cCrsr) -> None"}, |
| 4190 | {"GetMaxDevice", (PyCFunction)Qd_GetMaxDevice, 1, |
| 4191 | "(Rect globalRect) -> (GDHandle _rv)"}, |
Guido van Rossum | e56db43 | 1995-03-19 22:49:50 +0000 | [diff] [blame] | 4192 | {"GetCTSeed", (PyCFunction)Qd_GetCTSeed, 1, |
| 4193 | "() -> (long _rv)"}, |
Jack Jansen | 69b43ed | 1997-08-15 14:35:54 +0000 | [diff] [blame] | 4194 | {"GetDeviceList", (PyCFunction)Qd_GetDeviceList, 1, |
| 4195 | "() -> (GDHandle _rv)"}, |
| 4196 | {"GetMainDevice", (PyCFunction)Qd_GetMainDevice, 1, |
| 4197 | "() -> (GDHandle _rv)"}, |
| 4198 | {"GetNextDevice", (PyCFunction)Qd_GetNextDevice, 1, |
| 4199 | "(GDHandle curDevice) -> (GDHandle _rv)"}, |
| 4200 | {"TestDeviceAttribute", (PyCFunction)Qd_TestDeviceAttribute, 1, |
| 4201 | "(GDHandle gdh, short attribute) -> (Boolean _rv)"}, |
| 4202 | {"SetDeviceAttribute", (PyCFunction)Qd_SetDeviceAttribute, 1, |
| 4203 | "(GDHandle gdh, short attribute, Boolean value) -> None"}, |
| 4204 | {"InitGDevice", (PyCFunction)Qd_InitGDevice, 1, |
| 4205 | "(short qdRefNum, long mode, GDHandle gdh) -> None"}, |
| 4206 | {"NewGDevice", (PyCFunction)Qd_NewGDevice, 1, |
| 4207 | "(short refNum, long mode) -> (GDHandle _rv)"}, |
| 4208 | {"DisposeGDevice", (PyCFunction)Qd_DisposeGDevice, 1, |
| 4209 | "(GDHandle gdh) -> None"}, |
| 4210 | {"SetGDevice", (PyCFunction)Qd_SetGDevice, 1, |
| 4211 | "(GDHandle gd) -> None"}, |
| 4212 | {"GetGDevice", (PyCFunction)Qd_GetGDevice, 1, |
| 4213 | "() -> (GDHandle _rv)"}, |
Jack Jansen | 232f3cd | 1995-12-09 14:04:31 +0000 | [diff] [blame] | 4214 | {"Color2Index", (PyCFunction)Qd_Color2Index, 1, |
| 4215 | "(RGBColor myColor) -> (long _rv)"}, |
| 4216 | {"Index2Color", (PyCFunction)Qd_Index2Color, 1, |
| 4217 | "(long index) -> (RGBColor aColor)"}, |
| 4218 | {"InvertColor", (PyCFunction)Qd_InvertColor, 1, |
| 4219 | "() -> (RGBColor myColor)"}, |
| 4220 | {"RealColor", (PyCFunction)Qd_RealColor, 1, |
| 4221 | "(RGBColor color) -> (Boolean _rv)"}, |
Jack Jansen | 69b43ed | 1997-08-15 14:35:54 +0000 | [diff] [blame] | 4222 | {"GetSubTable", (PyCFunction)Qd_GetSubTable, 1, |
| 4223 | "(CTabHandle myColors, short iTabRes, CTabHandle targetTbl) -> None"}, |
| 4224 | {"MakeITable", (PyCFunction)Qd_MakeITable, 1, |
| 4225 | "(CTabHandle cTabH, ITabHandle iTabH, short res) -> None"}, |
Guido van Rossum | e56db43 | 1995-03-19 22:49:50 +0000 | [diff] [blame] | 4226 | {"SetClientID", (PyCFunction)Qd_SetClientID, 1, |
| 4227 | "(short id) -> None"}, |
| 4228 | {"ProtectEntry", (PyCFunction)Qd_ProtectEntry, 1, |
| 4229 | "(short index, Boolean protect) -> None"}, |
| 4230 | {"ReserveEntry", (PyCFunction)Qd_ReserveEntry, 1, |
| 4231 | "(short index, Boolean reserve) -> None"}, |
| 4232 | {"QDError", (PyCFunction)Qd_QDError, 1, |
| 4233 | "() -> (short _rv)"}, |
Jack Jansen | 41058c0 | 1995-11-16 22:48:29 +0000 | [diff] [blame] | 4234 | {"CopyDeepMask", (PyCFunction)Qd_CopyDeepMask, 1, |
| 4235 | "(BitMapPtr srcBits, BitMapPtr maskBits, BitMapPtr dstBits, Rect srcRect, Rect maskRect, Rect dstRect, short mode, RgnHandle maskRgn) -> None"}, |
Jack Jansen | 54c8f7e | 1995-11-14 10:46:01 +0000 | [diff] [blame] | 4236 | {"GetPattern", (PyCFunction)Qd_GetPattern, 1, |
| 4237 | "(short patternID) -> (PatHandle _rv)"}, |
| 4238 | {"GetCursor", (PyCFunction)Qd_GetCursor, 1, |
| 4239 | "(short cursorID) -> (CursHandle _rv)"}, |
| 4240 | {"GetPicture", (PyCFunction)Qd_GetPicture, 1, |
| 4241 | "(short pictureID) -> (PicHandle _rv)"}, |
| 4242 | {"DeltaPoint", (PyCFunction)Qd_DeltaPoint, 1, |
| 4243 | "(Point ptA, Point ptB) -> (long _rv)"}, |
| 4244 | {"ShieldCursor", (PyCFunction)Qd_ShieldCursor, 1, |
| 4245 | "(Rect shieldRect, Point offsetPt) -> None"}, |
| 4246 | {"ScreenRes", (PyCFunction)Qd_ScreenRes, 1, |
| 4247 | "() -> (short scrnHRes, short scrnVRes)"}, |
Jack Jansen | 04a02e7 | 1996-01-06 17:12:58 +0000 | [diff] [blame] | 4248 | {"GetIndPattern", (PyCFunction)Qd_GetIndPattern, 1, |
| 4249 | "(short patternListID, short index) -> (Pattern thePat)"}, |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 4250 | {"SlopeFromAngle", (PyCFunction)Qd_SlopeFromAngle, 1, |
| 4251 | "(short angle) -> (Fixed _rv)"}, |
| 4252 | {"AngleFromSlope", (PyCFunction)Qd_AngleFromSlope, 1, |
| 4253 | "(Fixed slope) -> (short _rv)"}, |
Jack Jansen | b81cf9d | 1995-06-06 13:08:40 +0000 | [diff] [blame] | 4254 | {"TextFont", (PyCFunction)Qd_TextFont, 1, |
| 4255 | "(short font) -> None"}, |
| 4256 | {"TextFace", (PyCFunction)Qd_TextFace, 1, |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 4257 | "(Style face) -> None"}, |
Jack Jansen | b81cf9d | 1995-06-06 13:08:40 +0000 | [diff] [blame] | 4258 | {"TextMode", (PyCFunction)Qd_TextMode, 1, |
| 4259 | "(short mode) -> None"}, |
| 4260 | {"TextSize", (PyCFunction)Qd_TextSize, 1, |
| 4261 | "(short size) -> None"}, |
| 4262 | {"SpaceExtra", (PyCFunction)Qd_SpaceExtra, 1, |
Jack Jansen | 330381c | 1995-11-15 15:18:01 +0000 | [diff] [blame] | 4263 | "(Fixed extra) -> None"}, |
Jack Jansen | b81cf9d | 1995-06-06 13:08:40 +0000 | [diff] [blame] | 4264 | {"DrawChar", (PyCFunction)Qd_DrawChar, 1, |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 4265 | "(CharParameter ch) -> None"}, |
Jack Jansen | b81cf9d | 1995-06-06 13:08:40 +0000 | [diff] [blame] | 4266 | {"DrawString", (PyCFunction)Qd_DrawString, 1, |
| 4267 | "(Str255 s) -> None"}, |
| 4268 | {"DrawText", (PyCFunction)Qd_DrawText, 1, |
| 4269 | "(Buffer textBuf, short firstByte, short byteCount) -> None"}, |
| 4270 | {"CharWidth", (PyCFunction)Qd_CharWidth, 1, |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 4271 | "(CharParameter ch) -> (short _rv)"}, |
Jack Jansen | b81cf9d | 1995-06-06 13:08:40 +0000 | [diff] [blame] | 4272 | {"StringWidth", (PyCFunction)Qd_StringWidth, 1, |
| 4273 | "(Str255 s) -> (short _rv)"}, |
| 4274 | {"TextWidth", (PyCFunction)Qd_TextWidth, 1, |
| 4275 | "(Buffer textBuf, short firstByte, short byteCount) -> (short _rv)"}, |
Jack Jansen | 3a50f8a | 1996-01-11 16:17:14 +0000 | [diff] [blame] | 4276 | {"GetFontInfo", (PyCFunction)Qd_GetFontInfo, 1, |
| 4277 | "() -> (FontInfo info)"}, |
Jack Jansen | b81cf9d | 1995-06-06 13:08:40 +0000 | [diff] [blame] | 4278 | {"CharExtra", (PyCFunction)Qd_CharExtra, 1, |
Jack Jansen | 330381c | 1995-11-15 15:18:01 +0000 | [diff] [blame] | 4279 | "(Fixed extra) -> None"}, |
Jack Jansen | 41058c0 | 1995-11-16 22:48:29 +0000 | [diff] [blame] | 4280 | {"BitMap", (PyCFunction)Qd_BitMap, 1, |
| 4281 | "Take (string, int, Rect) argument and create BitMap"}, |
Jack Jansen | 425e9eb | 1995-12-12 15:02:03 +0000 | [diff] [blame] | 4282 | {"RawBitMap", (PyCFunction)Qd_RawBitMap, 1, |
| 4283 | "Take string BitMap and turn into BitMap object"}, |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 4284 | {NULL, NULL, 0} |
| 4285 | }; |
| 4286 | |
| 4287 | |
| 4288 | |
| 4289 | |
| 4290 | void initQd() |
| 4291 | { |
| 4292 | PyObject *m; |
| 4293 | PyObject *d; |
| 4294 | |
| 4295 | |
| 4296 | |
| 4297 | |
| 4298 | m = Py_InitModule("Qd", Qd_methods); |
| 4299 | d = PyModule_GetDict(m); |
| 4300 | Qd_Error = PyMac_GetOSErrException(); |
| 4301 | if (Qd_Error == NULL || |
| 4302 | PyDict_SetItemString(d, "Error", Qd_Error) != 0) |
| 4303 | Py_FatalError("can't initialize Qd.Error"); |
Jack Jansen | a755e68 | 1997-09-20 17:40:22 +0000 | [diff] [blame] | 4304 | GrafPort_Type.ob_type = &PyType_Type; |
| 4305 | Py_INCREF(&GrafPort_Type); |
| 4306 | if (PyDict_SetItemString(d, "GrafPortType", (PyObject *)&GrafPort_Type) != 0) |
| 4307 | Py_FatalError("can't initialize GrafPortType"); |
| 4308 | BitMap_Type.ob_type = &PyType_Type; |
| 4309 | Py_INCREF(&BitMap_Type); |
| 4310 | if (PyDict_SetItemString(d, "BitMapType", (PyObject *)&BitMap_Type) != 0) |
| 4311 | Py_FatalError("can't initialize BitMapType"); |
| 4312 | QDGlobalsAccess_Type.ob_type = &PyType_Type; |
| 4313 | Py_INCREF(&QDGlobalsAccess_Type); |
| 4314 | if (PyDict_SetItemString(d, "QDGlobalsAccessType", (PyObject *)&QDGlobalsAccess_Type) != 0) |
| 4315 | Py_FatalError("can't initialize QDGlobalsAccessType"); |
Jack Jansen | b539406 | 1996-01-05 18:06:41 +0000 | [diff] [blame] | 4316 | |
| 4317 | { |
| 4318 | PyObject *o; |
Jack Jansen | bdd0747 | 1996-01-29 15:44:03 +0000 | [diff] [blame] | 4319 | |
| 4320 | o = QDGA_New(); |
| 4321 | if (o == NULL || PyDict_SetItemString(d, "qd", o) != 0) |
| 4322 | Py_FatalError("can't initialize Qd.qd"); |
Jack Jansen | b539406 | 1996-01-05 18:06:41 +0000 | [diff] [blame] | 4323 | } |
| 4324 | |
| 4325 | |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 4326 | } |
| 4327 | |
| 4328 | /* ========================= End module Qd ========================== */ |
| 4329 | |