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