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