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