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> |
| 46 | #include <Desk.h> |
| 47 | |
| 48 | #define resNotFound -192 /* Can't include <Errors.h> because of Python's "errors.h" */ |
| 49 | |
Jack Jansen | 232f3cd | 1995-12-09 14:04:31 +0000 | [diff] [blame] | 50 | /* |
| 51 | ** Parse/generate RGB records |
| 52 | */ |
| 53 | PyObject *QdRGB_New(itself) |
| 54 | RGBColorPtr itself; |
| 55 | { |
| 56 | |
| 57 | return Py_BuildValue("lll", (long)itself->red, (long)itself->green, (long)itself->blue); |
| 58 | } |
| 59 | |
| 60 | QdRGB_Convert(v, p_itself) |
| 61 | PyObject *v; |
| 62 | RGBColorPtr p_itself; |
| 63 | { |
| 64 | long red, green, blue; |
| 65 | |
| 66 | if( !PyArg_ParseTuple(v, "lll", &red, &green, &blue) ) |
| 67 | return 0; |
| 68 | p_itself->red = (unsigned short)red; |
| 69 | p_itself->green = (unsigned short)green; |
| 70 | p_itself->blue = (unsigned short)blue; |
| 71 | return 1; |
| 72 | } |
| 73 | |
| 74 | |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 75 | static PyObject *Qd_Error; |
| 76 | |
Jack Jansen | 330381c | 1995-11-15 15:18:01 +0000 | [diff] [blame] | 77 | /* ---------------------- Object type GrafPort ---------------------- */ |
| 78 | |
| 79 | PyTypeObject GrafPort_Type; |
| 80 | |
| 81 | #define GrafObj_Check(x) ((x)->ob_type == &GrafPort_Type) |
| 82 | |
| 83 | typedef struct GrafPortObject { |
| 84 | PyObject_HEAD |
| 85 | GrafPtr ob_itself; |
| 86 | } GrafPortObject; |
| 87 | |
| 88 | PyObject *GrafObj_New(itself) |
| 89 | GrafPtr itself; |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 90 | { |
Jack Jansen | 330381c | 1995-11-15 15:18:01 +0000 | [diff] [blame] | 91 | GrafPortObject *it; |
| 92 | if (itself == NULL) return PyMac_Error(resNotFound); |
| 93 | it = PyObject_NEW(GrafPortObject, &GrafPort_Type); |
| 94 | if (it == NULL) return NULL; |
| 95 | it->ob_itself = itself; |
| 96 | return (PyObject *)it; |
| 97 | } |
| 98 | GrafObj_Convert(v, p_itself) |
| 99 | PyObject *v; |
| 100 | GrafPtr *p_itself; |
| 101 | { |
| 102 | if (DlgObj_Check(v) || WinObj_Check(v)) { |
| 103 | *p_itself = ((GrafPortObject *)v)->ob_itself; |
| 104 | return 1; |
| 105 | } |
| 106 | if (!GrafObj_Check(v)) |
| 107 | { |
| 108 | PyErr_SetString(PyExc_TypeError, "GrafPort required"); |
| 109 | return 0; |
| 110 | } |
| 111 | *p_itself = ((GrafPortObject *)v)->ob_itself; |
| 112 | return 1; |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 113 | } |
| 114 | |
Jack Jansen | 330381c | 1995-11-15 15:18:01 +0000 | [diff] [blame] | 115 | static void GrafObj_dealloc(self) |
| 116 | GrafPortObject *self; |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 117 | { |
Jack Jansen | 330381c | 1995-11-15 15:18:01 +0000 | [diff] [blame] | 118 | /* Cleanup of self->ob_itself goes here */ |
| 119 | PyMem_DEL(self); |
Guido van Rossum | e56db43 | 1995-03-19 22:49:50 +0000 | [diff] [blame] | 120 | } |
| 121 | |
Jack Jansen | 330381c | 1995-11-15 15:18:01 +0000 | [diff] [blame] | 122 | static PyMethodDef GrafObj_methods[] = { |
| 123 | {NULL, NULL, 0} |
| 124 | }; |
| 125 | |
| 126 | PyMethodChain GrafObj_chain = { GrafObj_methods, NULL }; |
| 127 | |
| 128 | static PyObject *GrafObj_getattr(self, name) |
| 129 | GrafPortObject *self; |
| 130 | char *name; |
Guido van Rossum | e56db43 | 1995-03-19 22:49:50 +0000 | [diff] [blame] | 131 | { |
Jack Jansen | 330381c | 1995-11-15 15:18:01 +0000 | [diff] [blame] | 132 | if ( strcmp(name, "device") == 0 ) |
| 133 | return PyInt_FromLong((long)self->ob_itself->device); |
Jack Jansen | 425e9eb | 1995-12-12 15:02:03 +0000 | [diff] [blame^] | 134 | if ( strcmp(name, "portBits") == 0 ) { |
| 135 | CGrafPtr itself_color = (CGrafPtr)self->ob_itself; |
| 136 | |
| 137 | if ( (itself_color->portVersion&0xc000) == 0xc000 ) |
| 138 | /* XXXX Do we need HLock() stuff here?? */ |
| 139 | return BMObj_New((BitMapPtr)*itself_color->portPixMap); |
| 140 | else |
| 141 | return BMObj_New(&self->ob_itself->portBits); |
| 142 | } |
Jack Jansen | 330381c | 1995-11-15 15:18:01 +0000 | [diff] [blame] | 143 | if ( strcmp(name, "portRect") == 0 ) |
| 144 | return Py_BuildValue("O&", PyMac_BuildRect, &self->ob_itself->portRect); |
| 145 | /* XXXX Add more, as needed */ |
| 146 | |
| 147 | return Py_FindMethodInChain(&GrafObj_chain, (PyObject *)self, name); |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 148 | } |
| 149 | |
Jack Jansen | 330381c | 1995-11-15 15:18:01 +0000 | [diff] [blame] | 150 | #define GrafObj_setattr NULL |
| 151 | |
| 152 | PyTypeObject GrafPort_Type = { |
| 153 | PyObject_HEAD_INIT(&PyType_Type) |
| 154 | 0, /*ob_size*/ |
| 155 | "GrafPort", /*tp_name*/ |
| 156 | sizeof(GrafPortObject), /*tp_basicsize*/ |
| 157 | 0, /*tp_itemsize*/ |
| 158 | /* methods */ |
| 159 | (destructor) GrafObj_dealloc, /*tp_dealloc*/ |
| 160 | 0, /*tp_print*/ |
| 161 | (getattrfunc) GrafObj_getattr, /*tp_getattr*/ |
| 162 | (setattrfunc) GrafObj_setattr, /*tp_setattr*/ |
| 163 | }; |
| 164 | |
| 165 | /* -------------------- End object type GrafPort -------------------- */ |
| 166 | |
| 167 | |
Jack Jansen | 41058c0 | 1995-11-16 22:48:29 +0000 | [diff] [blame] | 168 | /* ----------------------- Object type BitMap ----------------------- */ |
| 169 | |
| 170 | PyTypeObject BitMap_Type; |
| 171 | |
| 172 | #define BMObj_Check(x) ((x)->ob_type == &BitMap_Type) |
| 173 | |
| 174 | typedef struct BitMapObject { |
| 175 | PyObject_HEAD |
| 176 | BitMapPtr ob_itself; |
| 177 | PyObject *referred_object; |
| 178 | BitMap *referred_bitmap; |
| 179 | } BitMapObject; |
| 180 | |
| 181 | PyObject *BMObj_New(itself) |
| 182 | BitMapPtr itself; |
| 183 | { |
| 184 | BitMapObject *it; |
| 185 | if (itself == NULL) return PyMac_Error(resNotFound); |
| 186 | it = PyObject_NEW(BitMapObject, &BitMap_Type); |
| 187 | if (it == NULL) return NULL; |
| 188 | it->ob_itself = itself; |
| 189 | it->referred_object = NULL; |
| 190 | it->referred_bitmap = NULL; |
| 191 | return (PyObject *)it; |
| 192 | } |
| 193 | BMObj_Convert(v, p_itself) |
| 194 | PyObject *v; |
| 195 | BitMapPtr *p_itself; |
| 196 | { |
| 197 | if (!BMObj_Check(v)) |
| 198 | { |
| 199 | PyErr_SetString(PyExc_TypeError, "BitMap required"); |
| 200 | return 0; |
| 201 | } |
| 202 | *p_itself = ((BitMapObject *)v)->ob_itself; |
| 203 | return 1; |
| 204 | } |
| 205 | |
| 206 | static void BMObj_dealloc(self) |
| 207 | BitMapObject *self; |
| 208 | { |
| 209 | Py_XDECREF(self->referred_object); |
| 210 | if (self->referred_bitmap) free(self->referred_bitmap); |
| 211 | PyMem_DEL(self); |
| 212 | } |
| 213 | |
| 214 | static PyMethodDef BMObj_methods[] = { |
| 215 | {NULL, NULL, 0} |
| 216 | }; |
| 217 | |
| 218 | PyMethodChain BMObj_chain = { BMObj_methods, NULL }; |
| 219 | |
| 220 | static PyObject *BMObj_getattr(self, name) |
| 221 | BitMapObject *self; |
| 222 | char *name; |
| 223 | { |
| 224 | if ( strcmp(name, "baseAddr") == 0 ) |
| 225 | return PyInt_FromLong((long)self->ob_itself->baseAddr); |
| 226 | if ( strcmp(name, "rowBytes") == 0 ) |
| 227 | return PyInt_FromLong((long)self->ob_itself->rowBytes); |
| 228 | if ( strcmp(name, "bounds") == 0 ) |
| 229 | return Py_BuildValue("O&", PyMac_BuildRect, &self->ob_itself->bounds); |
| 230 | /* XXXX Add more, as needed */ |
Jack Jansen | 425e9eb | 1995-12-12 15:02:03 +0000 | [diff] [blame^] | 231 | if ( strcmp(name, "bitmap_data") == 0 ) |
| 232 | return PyString_FromStringAndSize((char *)self->ob_itself, sizeof(BitMap)); |
| 233 | if ( strcmp(name, "pixmap_data") == 0 ) |
| 234 | return PyString_FromStringAndSize((char *)self->ob_itself, sizeof(PixMap)); |
Jack Jansen | 41058c0 | 1995-11-16 22:48:29 +0000 | [diff] [blame] | 235 | |
| 236 | return Py_FindMethodInChain(&BMObj_chain, (PyObject *)self, name); |
| 237 | } |
| 238 | |
| 239 | #define BMObj_setattr NULL |
| 240 | |
| 241 | PyTypeObject BitMap_Type = { |
| 242 | PyObject_HEAD_INIT(&PyType_Type) |
| 243 | 0, /*ob_size*/ |
| 244 | "BitMap", /*tp_name*/ |
| 245 | sizeof(BitMapObject), /*tp_basicsize*/ |
| 246 | 0, /*tp_itemsize*/ |
| 247 | /* methods */ |
| 248 | (destructor) BMObj_dealloc, /*tp_dealloc*/ |
| 249 | 0, /*tp_print*/ |
| 250 | (getattrfunc) BMObj_getattr, /*tp_getattr*/ |
| 251 | (setattrfunc) BMObj_setattr, /*tp_setattr*/ |
| 252 | }; |
| 253 | |
| 254 | /* --------------------- End object type BitMap --------------------- */ |
| 255 | |
| 256 | |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 257 | static PyObject *Qd_SetPort(_self, _args) |
| 258 | PyObject *_self; |
| 259 | PyObject *_args; |
| 260 | { |
| 261 | PyObject *_res = NULL; |
Jack Jansen | 330381c | 1995-11-15 15:18:01 +0000 | [diff] [blame] | 262 | GrafPtr port; |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 263 | if (!PyArg_ParseTuple(_args, "O&", |
Jack Jansen | 330381c | 1995-11-15 15:18:01 +0000 | [diff] [blame] | 264 | GrafObj_Convert, &port)) |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 265 | return NULL; |
Guido van Rossum | e56db43 | 1995-03-19 22:49:50 +0000 | [diff] [blame] | 266 | SetPort(port); |
| 267 | Py_INCREF(Py_None); |
| 268 | _res = Py_None; |
| 269 | return _res; |
| 270 | } |
| 271 | |
| 272 | static PyObject *Qd_GetPort(_self, _args) |
| 273 | PyObject *_self; |
| 274 | PyObject *_args; |
| 275 | { |
| 276 | PyObject *_res = NULL; |
Jack Jansen | 330381c | 1995-11-15 15:18:01 +0000 | [diff] [blame] | 277 | GrafPtr port; |
Guido van Rossum | e56db43 | 1995-03-19 22:49:50 +0000 | [diff] [blame] | 278 | if (!PyArg_ParseTuple(_args, "")) |
| 279 | return NULL; |
| 280 | GetPort(&port); |
| 281 | _res = Py_BuildValue("O&", |
Jack Jansen | 330381c | 1995-11-15 15:18:01 +0000 | [diff] [blame] | 282 | GrafObj_New, port); |
Guido van Rossum | e56db43 | 1995-03-19 22:49:50 +0000 | [diff] [blame] | 283 | return _res; |
| 284 | } |
| 285 | |
| 286 | static PyObject *Qd_GrafDevice(_self, _args) |
| 287 | PyObject *_self; |
| 288 | PyObject *_args; |
| 289 | { |
| 290 | PyObject *_res = NULL; |
| 291 | short device; |
| 292 | if (!PyArg_ParseTuple(_args, "h", |
| 293 | &device)) |
| 294 | return NULL; |
| 295 | GrafDevice(device); |
| 296 | Py_INCREF(Py_None); |
| 297 | _res = Py_None; |
| 298 | return _res; |
| 299 | } |
| 300 | |
Jack Jansen | 41058c0 | 1995-11-16 22:48:29 +0000 | [diff] [blame] | 301 | static PyObject *Qd_SetPortBits(_self, _args) |
| 302 | PyObject *_self; |
| 303 | PyObject *_args; |
| 304 | { |
| 305 | PyObject *_res = NULL; |
| 306 | BitMapPtr bm; |
| 307 | if (!PyArg_ParseTuple(_args, "O&", |
| 308 | BMObj_Convert, &bm)) |
| 309 | return NULL; |
| 310 | SetPortBits(bm); |
| 311 | Py_INCREF(Py_None); |
| 312 | _res = Py_None; |
| 313 | return _res; |
| 314 | } |
| 315 | |
Guido van Rossum | e56db43 | 1995-03-19 22:49:50 +0000 | [diff] [blame] | 316 | static PyObject *Qd_PortSize(_self, _args) |
| 317 | PyObject *_self; |
| 318 | PyObject *_args; |
| 319 | { |
| 320 | PyObject *_res = NULL; |
| 321 | short width; |
| 322 | short height; |
| 323 | if (!PyArg_ParseTuple(_args, "hh", |
| 324 | &width, |
| 325 | &height)) |
| 326 | return NULL; |
| 327 | PortSize(width, |
| 328 | height); |
| 329 | Py_INCREF(Py_None); |
| 330 | _res = Py_None; |
| 331 | return _res; |
| 332 | } |
| 333 | |
| 334 | static PyObject *Qd_MovePortTo(_self, _args) |
| 335 | PyObject *_self; |
| 336 | PyObject *_args; |
| 337 | { |
| 338 | PyObject *_res = NULL; |
| 339 | short leftGlobal; |
| 340 | short topGlobal; |
| 341 | if (!PyArg_ParseTuple(_args, "hh", |
| 342 | &leftGlobal, |
| 343 | &topGlobal)) |
| 344 | return NULL; |
| 345 | MovePortTo(leftGlobal, |
| 346 | topGlobal); |
| 347 | Py_INCREF(Py_None); |
| 348 | _res = Py_None; |
| 349 | return _res; |
| 350 | } |
| 351 | |
| 352 | static PyObject *Qd_SetOrigin(_self, _args) |
| 353 | PyObject *_self; |
| 354 | PyObject *_args; |
| 355 | { |
| 356 | PyObject *_res = NULL; |
| 357 | short h; |
| 358 | short v; |
| 359 | if (!PyArg_ParseTuple(_args, "hh", |
| 360 | &h, |
| 361 | &v)) |
| 362 | return NULL; |
| 363 | SetOrigin(h, |
| 364 | v); |
| 365 | Py_INCREF(Py_None); |
| 366 | _res = Py_None; |
| 367 | return _res; |
| 368 | } |
| 369 | |
| 370 | static PyObject *Qd_SetClip(_self, _args) |
| 371 | PyObject *_self; |
| 372 | PyObject *_args; |
| 373 | { |
| 374 | PyObject *_res = NULL; |
| 375 | RgnHandle rgn; |
| 376 | if (!PyArg_ParseTuple(_args, "O&", |
| 377 | ResObj_Convert, &rgn)) |
| 378 | return NULL; |
| 379 | SetClip(rgn); |
| 380 | Py_INCREF(Py_None); |
| 381 | _res = Py_None; |
| 382 | return _res; |
| 383 | } |
| 384 | |
| 385 | static PyObject *Qd_GetClip(_self, _args) |
| 386 | PyObject *_self; |
| 387 | PyObject *_args; |
| 388 | { |
| 389 | PyObject *_res = NULL; |
| 390 | RgnHandle rgn; |
| 391 | if (!PyArg_ParseTuple(_args, "O&", |
| 392 | ResObj_Convert, &rgn)) |
| 393 | return NULL; |
| 394 | GetClip(rgn); |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 395 | Py_INCREF(Py_None); |
| 396 | _res = Py_None; |
| 397 | return _res; |
| 398 | } |
| 399 | |
| 400 | static PyObject *Qd_ClipRect(_self, _args) |
| 401 | PyObject *_self; |
| 402 | PyObject *_args; |
| 403 | { |
| 404 | PyObject *_res = NULL; |
| 405 | Rect r; |
| 406 | if (!PyArg_ParseTuple(_args, "O&", |
| 407 | PyMac_GetRect, &r)) |
| 408 | return NULL; |
| 409 | ClipRect(&r); |
| 410 | Py_INCREF(Py_None); |
| 411 | _res = Py_None; |
| 412 | return _res; |
| 413 | } |
| 414 | |
Guido van Rossum | e56db43 | 1995-03-19 22:49:50 +0000 | [diff] [blame] | 415 | static PyObject *Qd_InitCursor(_self, _args) |
| 416 | PyObject *_self; |
| 417 | PyObject *_args; |
| 418 | { |
| 419 | PyObject *_res = NULL; |
| 420 | if (!PyArg_ParseTuple(_args, "")) |
| 421 | return NULL; |
| 422 | InitCursor(); |
| 423 | Py_INCREF(Py_None); |
| 424 | _res = Py_None; |
| 425 | return _res; |
| 426 | } |
| 427 | |
| 428 | static PyObject *Qd_HideCursor(_self, _args) |
| 429 | PyObject *_self; |
| 430 | PyObject *_args; |
| 431 | { |
| 432 | PyObject *_res = NULL; |
| 433 | if (!PyArg_ParseTuple(_args, "")) |
| 434 | return NULL; |
| 435 | HideCursor(); |
| 436 | Py_INCREF(Py_None); |
| 437 | _res = Py_None; |
| 438 | return _res; |
| 439 | } |
| 440 | |
| 441 | static PyObject *Qd_ShowCursor(_self, _args) |
| 442 | PyObject *_self; |
| 443 | PyObject *_args; |
| 444 | { |
| 445 | PyObject *_res = NULL; |
| 446 | if (!PyArg_ParseTuple(_args, "")) |
| 447 | return NULL; |
| 448 | ShowCursor(); |
| 449 | Py_INCREF(Py_None); |
| 450 | _res = Py_None; |
| 451 | return _res; |
| 452 | } |
| 453 | |
| 454 | static PyObject *Qd_ObscureCursor(_self, _args) |
| 455 | PyObject *_self; |
| 456 | PyObject *_args; |
| 457 | { |
| 458 | PyObject *_res = NULL; |
| 459 | if (!PyArg_ParseTuple(_args, "")) |
| 460 | return NULL; |
| 461 | ObscureCursor(); |
| 462 | Py_INCREF(Py_None); |
| 463 | _res = Py_None; |
| 464 | return _res; |
| 465 | } |
| 466 | |
| 467 | static PyObject *Qd_HidePen(_self, _args) |
| 468 | PyObject *_self; |
| 469 | PyObject *_args; |
| 470 | { |
| 471 | PyObject *_res = NULL; |
| 472 | if (!PyArg_ParseTuple(_args, "")) |
| 473 | return NULL; |
| 474 | HidePen(); |
| 475 | Py_INCREF(Py_None); |
| 476 | _res = Py_None; |
| 477 | return _res; |
| 478 | } |
| 479 | |
| 480 | static PyObject *Qd_ShowPen(_self, _args) |
| 481 | PyObject *_self; |
| 482 | PyObject *_args; |
| 483 | { |
| 484 | PyObject *_res = NULL; |
| 485 | if (!PyArg_ParseTuple(_args, "")) |
| 486 | return NULL; |
| 487 | ShowPen(); |
| 488 | Py_INCREF(Py_None); |
| 489 | _res = Py_None; |
| 490 | return _res; |
| 491 | } |
| 492 | |
| 493 | static PyObject *Qd_GetPen(_self, _args) |
| 494 | PyObject *_self; |
| 495 | PyObject *_args; |
| 496 | { |
| 497 | PyObject *_res = NULL; |
| 498 | Point pt; |
| 499 | if (!PyArg_ParseTuple(_args, "O&", |
| 500 | PyMac_GetPoint, &pt)) |
| 501 | return NULL; |
| 502 | GetPen(&pt); |
| 503 | _res = Py_BuildValue("O&", |
| 504 | PyMac_BuildPoint, pt); |
| 505 | return _res; |
| 506 | } |
| 507 | |
| 508 | static PyObject *Qd_PenSize(_self, _args) |
| 509 | PyObject *_self; |
| 510 | PyObject *_args; |
| 511 | { |
| 512 | PyObject *_res = NULL; |
| 513 | short width; |
| 514 | short height; |
| 515 | if (!PyArg_ParseTuple(_args, "hh", |
| 516 | &width, |
| 517 | &height)) |
| 518 | return NULL; |
| 519 | PenSize(width, |
| 520 | height); |
| 521 | Py_INCREF(Py_None); |
| 522 | _res = Py_None; |
| 523 | return _res; |
| 524 | } |
| 525 | |
| 526 | static PyObject *Qd_PenMode(_self, _args) |
| 527 | PyObject *_self; |
| 528 | PyObject *_args; |
| 529 | { |
| 530 | PyObject *_res = NULL; |
| 531 | short mode; |
| 532 | if (!PyArg_ParseTuple(_args, "h", |
| 533 | &mode)) |
| 534 | return NULL; |
| 535 | PenMode(mode); |
| 536 | Py_INCREF(Py_None); |
| 537 | _res = Py_None; |
| 538 | return _res; |
| 539 | } |
| 540 | |
| 541 | static PyObject *Qd_PenNormal(_self, _args) |
| 542 | PyObject *_self; |
| 543 | PyObject *_args; |
| 544 | { |
| 545 | PyObject *_res = NULL; |
| 546 | if (!PyArg_ParseTuple(_args, "")) |
| 547 | return NULL; |
| 548 | PenNormal(); |
| 549 | Py_INCREF(Py_None); |
| 550 | _res = Py_None; |
| 551 | return _res; |
| 552 | } |
| 553 | |
| 554 | static PyObject *Qd_MoveTo(_self, _args) |
| 555 | PyObject *_self; |
| 556 | PyObject *_args; |
| 557 | { |
| 558 | PyObject *_res = NULL; |
| 559 | short h; |
| 560 | short v; |
| 561 | if (!PyArg_ParseTuple(_args, "hh", |
| 562 | &h, |
| 563 | &v)) |
| 564 | return NULL; |
| 565 | MoveTo(h, |
| 566 | v); |
| 567 | Py_INCREF(Py_None); |
| 568 | _res = Py_None; |
| 569 | return _res; |
| 570 | } |
| 571 | |
| 572 | static PyObject *Qd_Move(_self, _args) |
| 573 | PyObject *_self; |
| 574 | PyObject *_args; |
| 575 | { |
| 576 | PyObject *_res = NULL; |
| 577 | short dh; |
| 578 | short dv; |
| 579 | if (!PyArg_ParseTuple(_args, "hh", |
| 580 | &dh, |
| 581 | &dv)) |
| 582 | return NULL; |
| 583 | Move(dh, |
| 584 | dv); |
| 585 | Py_INCREF(Py_None); |
| 586 | _res = Py_None; |
| 587 | return _res; |
| 588 | } |
| 589 | |
| 590 | static PyObject *Qd_LineTo(_self, _args) |
| 591 | PyObject *_self; |
| 592 | PyObject *_args; |
| 593 | { |
| 594 | PyObject *_res = NULL; |
| 595 | short h; |
| 596 | short v; |
| 597 | if (!PyArg_ParseTuple(_args, "hh", |
| 598 | &h, |
| 599 | &v)) |
| 600 | return NULL; |
| 601 | LineTo(h, |
| 602 | v); |
| 603 | Py_INCREF(Py_None); |
| 604 | _res = Py_None; |
| 605 | return _res; |
| 606 | } |
| 607 | |
| 608 | static PyObject *Qd_Line(_self, _args) |
| 609 | PyObject *_self; |
| 610 | PyObject *_args; |
| 611 | { |
| 612 | PyObject *_res = NULL; |
| 613 | short dh; |
| 614 | short dv; |
| 615 | if (!PyArg_ParseTuple(_args, "hh", |
| 616 | &dh, |
| 617 | &dv)) |
| 618 | return NULL; |
| 619 | Line(dh, |
| 620 | dv); |
| 621 | Py_INCREF(Py_None); |
| 622 | _res = Py_None; |
| 623 | return _res; |
| 624 | } |
| 625 | |
Guido van Rossum | e56db43 | 1995-03-19 22:49:50 +0000 | [diff] [blame] | 626 | static PyObject *Qd_ForeColor(_self, _args) |
| 627 | PyObject *_self; |
| 628 | PyObject *_args; |
| 629 | { |
| 630 | PyObject *_res = NULL; |
| 631 | long color; |
| 632 | if (!PyArg_ParseTuple(_args, "l", |
| 633 | &color)) |
| 634 | return NULL; |
| 635 | ForeColor(color); |
| 636 | Py_INCREF(Py_None); |
| 637 | _res = Py_None; |
| 638 | return _res; |
| 639 | } |
| 640 | |
| 641 | static PyObject *Qd_BackColor(_self, _args) |
| 642 | PyObject *_self; |
| 643 | PyObject *_args; |
| 644 | { |
| 645 | PyObject *_res = NULL; |
| 646 | long color; |
| 647 | if (!PyArg_ParseTuple(_args, "l", |
| 648 | &color)) |
| 649 | return NULL; |
| 650 | BackColor(color); |
| 651 | Py_INCREF(Py_None); |
| 652 | _res = Py_None; |
| 653 | return _res; |
| 654 | } |
| 655 | |
| 656 | static PyObject *Qd_ColorBit(_self, _args) |
| 657 | PyObject *_self; |
| 658 | PyObject *_args; |
| 659 | { |
| 660 | PyObject *_res = NULL; |
| 661 | short whichBit; |
| 662 | if (!PyArg_ParseTuple(_args, "h", |
| 663 | &whichBit)) |
| 664 | return NULL; |
| 665 | ColorBit(whichBit); |
| 666 | Py_INCREF(Py_None); |
| 667 | _res = Py_None; |
| 668 | return _res; |
| 669 | } |
| 670 | |
| 671 | static PyObject *Qd_SetRect(_self, _args) |
| 672 | PyObject *_self; |
| 673 | PyObject *_args; |
| 674 | { |
| 675 | PyObject *_res = NULL; |
| 676 | Rect r; |
| 677 | short left; |
| 678 | short top; |
| 679 | short right; |
| 680 | short bottom; |
| 681 | if (!PyArg_ParseTuple(_args, "hhhh", |
| 682 | &left, |
| 683 | &top, |
| 684 | &right, |
| 685 | &bottom)) |
| 686 | return NULL; |
| 687 | SetRect(&r, |
| 688 | left, |
| 689 | top, |
| 690 | right, |
| 691 | bottom); |
| 692 | _res = Py_BuildValue("O&", |
| 693 | PyMac_BuildRect, &r); |
| 694 | return _res; |
| 695 | } |
| 696 | |
| 697 | static PyObject *Qd_OffsetRect(_self, _args) |
| 698 | PyObject *_self; |
| 699 | PyObject *_args; |
| 700 | { |
| 701 | PyObject *_res = NULL; |
| 702 | Rect r; |
| 703 | short dh; |
| 704 | short dv; |
Jack Jansen | 54c8f7e | 1995-11-14 10:46:01 +0000 | [diff] [blame] | 705 | if (!PyArg_ParseTuple(_args, "O&hh", |
| 706 | PyMac_GetRect, &r, |
Guido van Rossum | e56db43 | 1995-03-19 22:49:50 +0000 | [diff] [blame] | 707 | &dh, |
| 708 | &dv)) |
| 709 | return NULL; |
| 710 | OffsetRect(&r, |
| 711 | dh, |
| 712 | dv); |
| 713 | _res = Py_BuildValue("O&", |
| 714 | PyMac_BuildRect, &r); |
| 715 | return _res; |
| 716 | } |
| 717 | |
| 718 | static PyObject *Qd_InsetRect(_self, _args) |
| 719 | PyObject *_self; |
| 720 | PyObject *_args; |
| 721 | { |
| 722 | PyObject *_res = NULL; |
| 723 | Rect r; |
| 724 | short dh; |
| 725 | short dv; |
Jack Jansen | 54c8f7e | 1995-11-14 10:46:01 +0000 | [diff] [blame] | 726 | if (!PyArg_ParseTuple(_args, "O&hh", |
| 727 | PyMac_GetRect, &r, |
Guido van Rossum | e56db43 | 1995-03-19 22:49:50 +0000 | [diff] [blame] | 728 | &dh, |
| 729 | &dv)) |
| 730 | return NULL; |
| 731 | InsetRect(&r, |
| 732 | dh, |
| 733 | dv); |
| 734 | _res = Py_BuildValue("O&", |
| 735 | PyMac_BuildRect, &r); |
| 736 | return _res; |
| 737 | } |
| 738 | |
| 739 | static PyObject *Qd_SectRect(_self, _args) |
| 740 | PyObject *_self; |
| 741 | PyObject *_args; |
| 742 | { |
| 743 | PyObject *_res = NULL; |
| 744 | Boolean _rv; |
| 745 | Rect src1; |
| 746 | Rect src2; |
| 747 | Rect dstRect; |
| 748 | if (!PyArg_ParseTuple(_args, "O&O&", |
| 749 | PyMac_GetRect, &src1, |
| 750 | PyMac_GetRect, &src2)) |
| 751 | return NULL; |
| 752 | _rv = SectRect(&src1, |
| 753 | &src2, |
| 754 | &dstRect); |
| 755 | _res = Py_BuildValue("bO&", |
| 756 | _rv, |
| 757 | PyMac_BuildRect, &dstRect); |
| 758 | return _res; |
| 759 | } |
| 760 | |
| 761 | static PyObject *Qd_UnionRect(_self, _args) |
| 762 | PyObject *_self; |
| 763 | PyObject *_args; |
| 764 | { |
| 765 | PyObject *_res = NULL; |
| 766 | Rect src1; |
| 767 | Rect src2; |
| 768 | Rect dstRect; |
| 769 | if (!PyArg_ParseTuple(_args, "O&O&", |
| 770 | PyMac_GetRect, &src1, |
| 771 | PyMac_GetRect, &src2)) |
| 772 | return NULL; |
| 773 | UnionRect(&src1, |
| 774 | &src2, |
| 775 | &dstRect); |
| 776 | _res = Py_BuildValue("O&", |
| 777 | PyMac_BuildRect, &dstRect); |
| 778 | return _res; |
| 779 | } |
| 780 | |
| 781 | static PyObject *Qd_EqualRect(_self, _args) |
| 782 | PyObject *_self; |
| 783 | PyObject *_args; |
| 784 | { |
| 785 | PyObject *_res = NULL; |
| 786 | Boolean _rv; |
| 787 | Rect rect1; |
| 788 | Rect rect2; |
| 789 | if (!PyArg_ParseTuple(_args, "O&O&", |
| 790 | PyMac_GetRect, &rect1, |
| 791 | PyMac_GetRect, &rect2)) |
| 792 | return NULL; |
| 793 | _rv = EqualRect(&rect1, |
| 794 | &rect2); |
| 795 | _res = Py_BuildValue("b", |
| 796 | _rv); |
| 797 | return _res; |
| 798 | } |
| 799 | |
| 800 | static PyObject *Qd_EmptyRect(_self, _args) |
| 801 | PyObject *_self; |
| 802 | PyObject *_args; |
| 803 | { |
| 804 | PyObject *_res = NULL; |
| 805 | Boolean _rv; |
| 806 | Rect r; |
| 807 | if (!PyArg_ParseTuple(_args, "O&", |
| 808 | PyMac_GetRect, &r)) |
| 809 | return NULL; |
| 810 | _rv = EmptyRect(&r); |
| 811 | _res = Py_BuildValue("b", |
| 812 | _rv); |
| 813 | return _res; |
| 814 | } |
| 815 | |
| 816 | static PyObject *Qd_FrameRect(_self, _args) |
| 817 | PyObject *_self; |
| 818 | PyObject *_args; |
| 819 | { |
| 820 | PyObject *_res = NULL; |
| 821 | Rect r; |
| 822 | if (!PyArg_ParseTuple(_args, "O&", |
| 823 | PyMac_GetRect, &r)) |
| 824 | return NULL; |
| 825 | FrameRect(&r); |
| 826 | Py_INCREF(Py_None); |
| 827 | _res = Py_None; |
| 828 | return _res; |
| 829 | } |
| 830 | |
| 831 | static PyObject *Qd_PaintRect(_self, _args) |
| 832 | PyObject *_self; |
| 833 | PyObject *_args; |
| 834 | { |
| 835 | PyObject *_res = NULL; |
| 836 | Rect r; |
| 837 | if (!PyArg_ParseTuple(_args, "O&", |
| 838 | PyMac_GetRect, &r)) |
| 839 | return NULL; |
| 840 | PaintRect(&r); |
| 841 | Py_INCREF(Py_None); |
| 842 | _res = Py_None; |
| 843 | return _res; |
| 844 | } |
| 845 | |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 846 | static PyObject *Qd_EraseRect(_self, _args) |
| 847 | PyObject *_self; |
| 848 | PyObject *_args; |
| 849 | { |
| 850 | PyObject *_res = NULL; |
| 851 | Rect r; |
| 852 | if (!PyArg_ParseTuple(_args, "O&", |
| 853 | PyMac_GetRect, &r)) |
| 854 | return NULL; |
| 855 | EraseRect(&r); |
| 856 | Py_INCREF(Py_None); |
| 857 | _res = Py_None; |
| 858 | return _res; |
| 859 | } |
| 860 | |
Guido van Rossum | e56db43 | 1995-03-19 22:49:50 +0000 | [diff] [blame] | 861 | static PyObject *Qd_InvertRect(_self, _args) |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 862 | PyObject *_self; |
| 863 | PyObject *_args; |
| 864 | { |
| 865 | PyObject *_res = NULL; |
Guido van Rossum | e56db43 | 1995-03-19 22:49:50 +0000 | [diff] [blame] | 866 | Rect r; |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 867 | if (!PyArg_ParseTuple(_args, "O&", |
Guido van Rossum | e56db43 | 1995-03-19 22:49:50 +0000 | [diff] [blame] | 868 | PyMac_GetRect, &r)) |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 869 | return NULL; |
Guido van Rossum | e56db43 | 1995-03-19 22:49:50 +0000 | [diff] [blame] | 870 | InvertRect(&r); |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 871 | Py_INCREF(Py_None); |
| 872 | _res = Py_None; |
| 873 | return _res; |
| 874 | } |
| 875 | |
Guido van Rossum | e56db43 | 1995-03-19 22:49:50 +0000 | [diff] [blame] | 876 | static PyObject *Qd_FrameOval(_self, _args) |
| 877 | PyObject *_self; |
| 878 | PyObject *_args; |
| 879 | { |
| 880 | PyObject *_res = NULL; |
| 881 | Rect r; |
| 882 | if (!PyArg_ParseTuple(_args, "O&", |
| 883 | PyMac_GetRect, &r)) |
| 884 | return NULL; |
| 885 | FrameOval(&r); |
| 886 | Py_INCREF(Py_None); |
| 887 | _res = Py_None; |
| 888 | return _res; |
| 889 | } |
| 890 | |
| 891 | static PyObject *Qd_PaintOval(_self, _args) |
| 892 | PyObject *_self; |
| 893 | PyObject *_args; |
| 894 | { |
| 895 | PyObject *_res = NULL; |
| 896 | Rect r; |
| 897 | if (!PyArg_ParseTuple(_args, "O&", |
| 898 | PyMac_GetRect, &r)) |
| 899 | return NULL; |
| 900 | PaintOval(&r); |
| 901 | Py_INCREF(Py_None); |
| 902 | _res = Py_None; |
| 903 | return _res; |
| 904 | } |
| 905 | |
| 906 | static PyObject *Qd_EraseOval(_self, _args) |
| 907 | PyObject *_self; |
| 908 | PyObject *_args; |
| 909 | { |
| 910 | PyObject *_res = NULL; |
| 911 | Rect r; |
| 912 | if (!PyArg_ParseTuple(_args, "O&", |
| 913 | PyMac_GetRect, &r)) |
| 914 | return NULL; |
| 915 | EraseOval(&r); |
| 916 | Py_INCREF(Py_None); |
| 917 | _res = Py_None; |
| 918 | return _res; |
| 919 | } |
| 920 | |
| 921 | static PyObject *Qd_InvertOval(_self, _args) |
| 922 | PyObject *_self; |
| 923 | PyObject *_args; |
| 924 | { |
| 925 | PyObject *_res = NULL; |
| 926 | Rect r; |
| 927 | if (!PyArg_ParseTuple(_args, "O&", |
| 928 | PyMac_GetRect, &r)) |
| 929 | return NULL; |
| 930 | InvertOval(&r); |
| 931 | Py_INCREF(Py_None); |
| 932 | _res = Py_None; |
| 933 | return _res; |
| 934 | } |
| 935 | |
| 936 | static PyObject *Qd_FrameRoundRect(_self, _args) |
| 937 | PyObject *_self; |
| 938 | PyObject *_args; |
| 939 | { |
| 940 | PyObject *_res = NULL; |
| 941 | Rect r; |
| 942 | short ovalWidth; |
| 943 | short ovalHeight; |
| 944 | if (!PyArg_ParseTuple(_args, "O&hh", |
| 945 | PyMac_GetRect, &r, |
| 946 | &ovalWidth, |
| 947 | &ovalHeight)) |
| 948 | return NULL; |
| 949 | FrameRoundRect(&r, |
| 950 | ovalWidth, |
| 951 | ovalHeight); |
| 952 | Py_INCREF(Py_None); |
| 953 | _res = Py_None; |
| 954 | return _res; |
| 955 | } |
| 956 | |
| 957 | static PyObject *Qd_PaintRoundRect(_self, _args) |
| 958 | PyObject *_self; |
| 959 | PyObject *_args; |
| 960 | { |
| 961 | PyObject *_res = NULL; |
| 962 | Rect r; |
| 963 | short ovalWidth; |
| 964 | short ovalHeight; |
| 965 | if (!PyArg_ParseTuple(_args, "O&hh", |
| 966 | PyMac_GetRect, &r, |
| 967 | &ovalWidth, |
| 968 | &ovalHeight)) |
| 969 | return NULL; |
| 970 | PaintRoundRect(&r, |
| 971 | ovalWidth, |
| 972 | ovalHeight); |
| 973 | Py_INCREF(Py_None); |
| 974 | _res = Py_None; |
| 975 | return _res; |
| 976 | } |
| 977 | |
| 978 | static PyObject *Qd_EraseRoundRect(_self, _args) |
| 979 | PyObject *_self; |
| 980 | PyObject *_args; |
| 981 | { |
| 982 | PyObject *_res = NULL; |
| 983 | Rect r; |
| 984 | short ovalWidth; |
| 985 | short ovalHeight; |
| 986 | if (!PyArg_ParseTuple(_args, "O&hh", |
| 987 | PyMac_GetRect, &r, |
| 988 | &ovalWidth, |
| 989 | &ovalHeight)) |
| 990 | return NULL; |
| 991 | EraseRoundRect(&r, |
| 992 | ovalWidth, |
| 993 | ovalHeight); |
| 994 | Py_INCREF(Py_None); |
| 995 | _res = Py_None; |
| 996 | return _res; |
| 997 | } |
| 998 | |
| 999 | static PyObject *Qd_InvertRoundRect(_self, _args) |
| 1000 | PyObject *_self; |
| 1001 | PyObject *_args; |
| 1002 | { |
| 1003 | PyObject *_res = NULL; |
| 1004 | Rect r; |
| 1005 | short ovalWidth; |
| 1006 | short ovalHeight; |
| 1007 | if (!PyArg_ParseTuple(_args, "O&hh", |
| 1008 | PyMac_GetRect, &r, |
| 1009 | &ovalWidth, |
| 1010 | &ovalHeight)) |
| 1011 | return NULL; |
| 1012 | InvertRoundRect(&r, |
| 1013 | ovalWidth, |
| 1014 | ovalHeight); |
| 1015 | Py_INCREF(Py_None); |
| 1016 | _res = Py_None; |
| 1017 | return _res; |
| 1018 | } |
| 1019 | |
| 1020 | static PyObject *Qd_FrameArc(_self, _args) |
| 1021 | PyObject *_self; |
| 1022 | PyObject *_args; |
| 1023 | { |
| 1024 | PyObject *_res = NULL; |
| 1025 | Rect r; |
| 1026 | short startAngle; |
| 1027 | short arcAngle; |
| 1028 | if (!PyArg_ParseTuple(_args, "O&hh", |
| 1029 | PyMac_GetRect, &r, |
| 1030 | &startAngle, |
| 1031 | &arcAngle)) |
| 1032 | return NULL; |
| 1033 | FrameArc(&r, |
| 1034 | startAngle, |
| 1035 | arcAngle); |
| 1036 | Py_INCREF(Py_None); |
| 1037 | _res = Py_None; |
| 1038 | return _res; |
| 1039 | } |
| 1040 | |
| 1041 | static PyObject *Qd_PaintArc(_self, _args) |
| 1042 | PyObject *_self; |
| 1043 | PyObject *_args; |
| 1044 | { |
| 1045 | PyObject *_res = NULL; |
| 1046 | Rect r; |
| 1047 | short startAngle; |
| 1048 | short arcAngle; |
| 1049 | if (!PyArg_ParseTuple(_args, "O&hh", |
| 1050 | PyMac_GetRect, &r, |
| 1051 | &startAngle, |
| 1052 | &arcAngle)) |
| 1053 | return NULL; |
| 1054 | PaintArc(&r, |
| 1055 | startAngle, |
| 1056 | arcAngle); |
| 1057 | Py_INCREF(Py_None); |
| 1058 | _res = Py_None; |
| 1059 | return _res; |
| 1060 | } |
| 1061 | |
| 1062 | static PyObject *Qd_EraseArc(_self, _args) |
| 1063 | PyObject *_self; |
| 1064 | PyObject *_args; |
| 1065 | { |
| 1066 | PyObject *_res = NULL; |
| 1067 | Rect r; |
| 1068 | short startAngle; |
| 1069 | short arcAngle; |
| 1070 | if (!PyArg_ParseTuple(_args, "O&hh", |
| 1071 | PyMac_GetRect, &r, |
| 1072 | &startAngle, |
| 1073 | &arcAngle)) |
| 1074 | return NULL; |
| 1075 | EraseArc(&r, |
| 1076 | startAngle, |
| 1077 | arcAngle); |
| 1078 | Py_INCREF(Py_None); |
| 1079 | _res = Py_None; |
| 1080 | return _res; |
| 1081 | } |
| 1082 | |
| 1083 | static PyObject *Qd_InvertArc(_self, _args) |
| 1084 | PyObject *_self; |
| 1085 | PyObject *_args; |
| 1086 | { |
| 1087 | PyObject *_res = NULL; |
| 1088 | Rect r; |
| 1089 | short startAngle; |
| 1090 | short arcAngle; |
| 1091 | if (!PyArg_ParseTuple(_args, "O&hh", |
| 1092 | PyMac_GetRect, &r, |
| 1093 | &startAngle, |
| 1094 | &arcAngle)) |
| 1095 | return NULL; |
| 1096 | InvertArc(&r, |
| 1097 | startAngle, |
| 1098 | arcAngle); |
| 1099 | Py_INCREF(Py_None); |
| 1100 | _res = Py_None; |
| 1101 | return _res; |
| 1102 | } |
| 1103 | |
| 1104 | static PyObject *Qd_NewRgn(_self, _args) |
| 1105 | PyObject *_self; |
| 1106 | PyObject *_args; |
| 1107 | { |
| 1108 | PyObject *_res = NULL; |
| 1109 | RgnHandle _rv; |
| 1110 | if (!PyArg_ParseTuple(_args, "")) |
| 1111 | return NULL; |
| 1112 | _rv = NewRgn(); |
| 1113 | _res = Py_BuildValue("O&", |
| 1114 | ResObj_New, _rv); |
| 1115 | return _res; |
| 1116 | } |
| 1117 | |
| 1118 | static PyObject *Qd_OpenRgn(_self, _args) |
| 1119 | PyObject *_self; |
| 1120 | PyObject *_args; |
| 1121 | { |
| 1122 | PyObject *_res = NULL; |
| 1123 | if (!PyArg_ParseTuple(_args, "")) |
| 1124 | return NULL; |
| 1125 | OpenRgn(); |
| 1126 | Py_INCREF(Py_None); |
| 1127 | _res = Py_None; |
| 1128 | return _res; |
| 1129 | } |
| 1130 | |
| 1131 | static PyObject *Qd_CloseRgn(_self, _args) |
| 1132 | PyObject *_self; |
| 1133 | PyObject *_args; |
| 1134 | { |
| 1135 | PyObject *_res = NULL; |
| 1136 | RgnHandle dstRgn; |
| 1137 | if (!PyArg_ParseTuple(_args, "O&", |
| 1138 | ResObj_Convert, &dstRgn)) |
| 1139 | return NULL; |
| 1140 | CloseRgn(dstRgn); |
| 1141 | Py_INCREF(Py_None); |
| 1142 | _res = Py_None; |
| 1143 | return _res; |
| 1144 | } |
| 1145 | |
Jack Jansen | 41058c0 | 1995-11-16 22:48:29 +0000 | [diff] [blame] | 1146 | static PyObject *Qd_BitMapToRegion(_self, _args) |
| 1147 | PyObject *_self; |
| 1148 | PyObject *_args; |
| 1149 | { |
| 1150 | PyObject *_res = NULL; |
| 1151 | OSErr _err; |
| 1152 | RgnHandle region; |
| 1153 | BitMapPtr bMap; |
| 1154 | if (!PyArg_ParseTuple(_args, "O&O&", |
| 1155 | ResObj_Convert, ®ion, |
| 1156 | BMObj_Convert, &bMap)) |
| 1157 | return NULL; |
| 1158 | _err = BitMapToRegion(region, |
| 1159 | bMap); |
| 1160 | if (_err != noErr) return PyMac_Error(_err); |
| 1161 | Py_INCREF(Py_None); |
| 1162 | _res = Py_None; |
| 1163 | return _res; |
| 1164 | } |
| 1165 | |
Guido van Rossum | e56db43 | 1995-03-19 22:49:50 +0000 | [diff] [blame] | 1166 | static PyObject *Qd_DisposeRgn(_self, _args) |
| 1167 | PyObject *_self; |
| 1168 | PyObject *_args; |
| 1169 | { |
| 1170 | PyObject *_res = NULL; |
| 1171 | RgnHandle rgn; |
| 1172 | if (!PyArg_ParseTuple(_args, "O&", |
| 1173 | ResObj_Convert, &rgn)) |
| 1174 | return NULL; |
| 1175 | DisposeRgn(rgn); |
| 1176 | Py_INCREF(Py_None); |
| 1177 | _res = Py_None; |
| 1178 | return _res; |
| 1179 | } |
| 1180 | |
| 1181 | static PyObject *Qd_CopyRgn(_self, _args) |
| 1182 | PyObject *_self; |
| 1183 | PyObject *_args; |
| 1184 | { |
| 1185 | PyObject *_res = NULL; |
| 1186 | RgnHandle srcRgn; |
| 1187 | RgnHandle dstRgn; |
| 1188 | if (!PyArg_ParseTuple(_args, "O&O&", |
| 1189 | ResObj_Convert, &srcRgn, |
| 1190 | ResObj_Convert, &dstRgn)) |
| 1191 | return NULL; |
| 1192 | CopyRgn(srcRgn, |
| 1193 | dstRgn); |
| 1194 | Py_INCREF(Py_None); |
| 1195 | _res = Py_None; |
| 1196 | return _res; |
| 1197 | } |
| 1198 | |
| 1199 | static PyObject *Qd_SetEmptyRgn(_self, _args) |
| 1200 | PyObject *_self; |
| 1201 | PyObject *_args; |
| 1202 | { |
| 1203 | PyObject *_res = NULL; |
| 1204 | RgnHandle rgn; |
| 1205 | if (!PyArg_ParseTuple(_args, "O&", |
| 1206 | ResObj_Convert, &rgn)) |
| 1207 | return NULL; |
| 1208 | SetEmptyRgn(rgn); |
| 1209 | Py_INCREF(Py_None); |
| 1210 | _res = Py_None; |
| 1211 | return _res; |
| 1212 | } |
| 1213 | |
| 1214 | static PyObject *Qd_SetRectRgn(_self, _args) |
| 1215 | PyObject *_self; |
| 1216 | PyObject *_args; |
| 1217 | { |
| 1218 | PyObject *_res = NULL; |
| 1219 | RgnHandle rgn; |
| 1220 | short left; |
| 1221 | short top; |
| 1222 | short right; |
| 1223 | short bottom; |
| 1224 | if (!PyArg_ParseTuple(_args, "O&hhhh", |
| 1225 | ResObj_Convert, &rgn, |
| 1226 | &left, |
| 1227 | &top, |
| 1228 | &right, |
| 1229 | &bottom)) |
| 1230 | return NULL; |
| 1231 | SetRectRgn(rgn, |
| 1232 | left, |
| 1233 | top, |
| 1234 | right, |
| 1235 | bottom); |
| 1236 | Py_INCREF(Py_None); |
| 1237 | _res = Py_None; |
| 1238 | return _res; |
| 1239 | } |
| 1240 | |
| 1241 | static PyObject *Qd_RectRgn(_self, _args) |
| 1242 | PyObject *_self; |
| 1243 | PyObject *_args; |
| 1244 | { |
| 1245 | PyObject *_res = NULL; |
| 1246 | RgnHandle rgn; |
| 1247 | Rect r; |
| 1248 | if (!PyArg_ParseTuple(_args, "O&O&", |
| 1249 | ResObj_Convert, &rgn, |
| 1250 | PyMac_GetRect, &r)) |
| 1251 | return NULL; |
| 1252 | RectRgn(rgn, |
| 1253 | &r); |
| 1254 | Py_INCREF(Py_None); |
| 1255 | _res = Py_None; |
| 1256 | return _res; |
| 1257 | } |
| 1258 | |
| 1259 | static PyObject *Qd_OffsetRgn(_self, _args) |
| 1260 | PyObject *_self; |
| 1261 | PyObject *_args; |
| 1262 | { |
| 1263 | PyObject *_res = NULL; |
| 1264 | RgnHandle rgn; |
| 1265 | short dh; |
| 1266 | short dv; |
| 1267 | if (!PyArg_ParseTuple(_args, "O&hh", |
| 1268 | ResObj_Convert, &rgn, |
| 1269 | &dh, |
| 1270 | &dv)) |
| 1271 | return NULL; |
| 1272 | OffsetRgn(rgn, |
| 1273 | dh, |
| 1274 | dv); |
| 1275 | Py_INCREF(Py_None); |
| 1276 | _res = Py_None; |
| 1277 | return _res; |
| 1278 | } |
| 1279 | |
| 1280 | static PyObject *Qd_InsetRgn(_self, _args) |
| 1281 | PyObject *_self; |
| 1282 | PyObject *_args; |
| 1283 | { |
| 1284 | PyObject *_res = NULL; |
| 1285 | RgnHandle rgn; |
| 1286 | short dh; |
| 1287 | short dv; |
| 1288 | if (!PyArg_ParseTuple(_args, "O&hh", |
| 1289 | ResObj_Convert, &rgn, |
| 1290 | &dh, |
| 1291 | &dv)) |
| 1292 | return NULL; |
| 1293 | InsetRgn(rgn, |
| 1294 | dh, |
| 1295 | dv); |
| 1296 | Py_INCREF(Py_None); |
| 1297 | _res = Py_None; |
| 1298 | return _res; |
| 1299 | } |
| 1300 | |
| 1301 | static PyObject *Qd_SectRgn(_self, _args) |
| 1302 | PyObject *_self; |
| 1303 | PyObject *_args; |
| 1304 | { |
| 1305 | PyObject *_res = NULL; |
| 1306 | RgnHandle srcRgnA; |
| 1307 | RgnHandle srcRgnB; |
| 1308 | RgnHandle dstRgn; |
| 1309 | if (!PyArg_ParseTuple(_args, "O&O&O&", |
| 1310 | ResObj_Convert, &srcRgnA, |
| 1311 | ResObj_Convert, &srcRgnB, |
| 1312 | ResObj_Convert, &dstRgn)) |
| 1313 | return NULL; |
| 1314 | SectRgn(srcRgnA, |
| 1315 | srcRgnB, |
| 1316 | dstRgn); |
| 1317 | Py_INCREF(Py_None); |
| 1318 | _res = Py_None; |
| 1319 | return _res; |
| 1320 | } |
| 1321 | |
| 1322 | static PyObject *Qd_UnionRgn(_self, _args) |
| 1323 | PyObject *_self; |
| 1324 | PyObject *_args; |
| 1325 | { |
| 1326 | PyObject *_res = NULL; |
| 1327 | RgnHandle srcRgnA; |
| 1328 | RgnHandle srcRgnB; |
| 1329 | RgnHandle dstRgn; |
| 1330 | if (!PyArg_ParseTuple(_args, "O&O&O&", |
| 1331 | ResObj_Convert, &srcRgnA, |
| 1332 | ResObj_Convert, &srcRgnB, |
| 1333 | ResObj_Convert, &dstRgn)) |
| 1334 | return NULL; |
| 1335 | UnionRgn(srcRgnA, |
| 1336 | srcRgnB, |
| 1337 | dstRgn); |
| 1338 | Py_INCREF(Py_None); |
| 1339 | _res = Py_None; |
| 1340 | return _res; |
| 1341 | } |
| 1342 | |
| 1343 | static PyObject *Qd_DiffRgn(_self, _args) |
| 1344 | PyObject *_self; |
| 1345 | PyObject *_args; |
| 1346 | { |
| 1347 | PyObject *_res = NULL; |
| 1348 | RgnHandle srcRgnA; |
| 1349 | RgnHandle srcRgnB; |
| 1350 | RgnHandle dstRgn; |
| 1351 | if (!PyArg_ParseTuple(_args, "O&O&O&", |
| 1352 | ResObj_Convert, &srcRgnA, |
| 1353 | ResObj_Convert, &srcRgnB, |
| 1354 | ResObj_Convert, &dstRgn)) |
| 1355 | return NULL; |
| 1356 | DiffRgn(srcRgnA, |
| 1357 | srcRgnB, |
| 1358 | dstRgn); |
| 1359 | Py_INCREF(Py_None); |
| 1360 | _res = Py_None; |
| 1361 | return _res; |
| 1362 | } |
| 1363 | |
| 1364 | static PyObject *Qd_XorRgn(_self, _args) |
| 1365 | PyObject *_self; |
| 1366 | PyObject *_args; |
| 1367 | { |
| 1368 | PyObject *_res = NULL; |
| 1369 | RgnHandle srcRgnA; |
| 1370 | RgnHandle srcRgnB; |
| 1371 | RgnHandle dstRgn; |
| 1372 | if (!PyArg_ParseTuple(_args, "O&O&O&", |
| 1373 | ResObj_Convert, &srcRgnA, |
| 1374 | ResObj_Convert, &srcRgnB, |
| 1375 | ResObj_Convert, &dstRgn)) |
| 1376 | return NULL; |
| 1377 | XorRgn(srcRgnA, |
| 1378 | srcRgnB, |
| 1379 | dstRgn); |
| 1380 | Py_INCREF(Py_None); |
| 1381 | _res = Py_None; |
| 1382 | return _res; |
| 1383 | } |
| 1384 | |
| 1385 | static PyObject *Qd_RectInRgn(_self, _args) |
| 1386 | PyObject *_self; |
| 1387 | PyObject *_args; |
| 1388 | { |
| 1389 | PyObject *_res = NULL; |
| 1390 | Boolean _rv; |
| 1391 | Rect r; |
| 1392 | RgnHandle rgn; |
| 1393 | if (!PyArg_ParseTuple(_args, "O&O&", |
| 1394 | PyMac_GetRect, &r, |
| 1395 | ResObj_Convert, &rgn)) |
| 1396 | return NULL; |
| 1397 | _rv = RectInRgn(&r, |
| 1398 | rgn); |
| 1399 | _res = Py_BuildValue("b", |
| 1400 | _rv); |
| 1401 | return _res; |
| 1402 | } |
| 1403 | |
| 1404 | static PyObject *Qd_EqualRgn(_self, _args) |
| 1405 | PyObject *_self; |
| 1406 | PyObject *_args; |
| 1407 | { |
| 1408 | PyObject *_res = NULL; |
| 1409 | Boolean _rv; |
| 1410 | RgnHandle rgnA; |
| 1411 | RgnHandle rgnB; |
| 1412 | if (!PyArg_ParseTuple(_args, "O&O&", |
| 1413 | ResObj_Convert, &rgnA, |
| 1414 | ResObj_Convert, &rgnB)) |
| 1415 | return NULL; |
| 1416 | _rv = EqualRgn(rgnA, |
| 1417 | rgnB); |
| 1418 | _res = Py_BuildValue("b", |
| 1419 | _rv); |
| 1420 | return _res; |
| 1421 | } |
| 1422 | |
| 1423 | static PyObject *Qd_EmptyRgn(_self, _args) |
| 1424 | PyObject *_self; |
| 1425 | PyObject *_args; |
| 1426 | { |
| 1427 | PyObject *_res = NULL; |
| 1428 | Boolean _rv; |
| 1429 | RgnHandle rgn; |
| 1430 | if (!PyArg_ParseTuple(_args, "O&", |
| 1431 | ResObj_Convert, &rgn)) |
| 1432 | return NULL; |
| 1433 | _rv = EmptyRgn(rgn); |
| 1434 | _res = Py_BuildValue("b", |
| 1435 | _rv); |
| 1436 | return _res; |
| 1437 | } |
| 1438 | |
| 1439 | static PyObject *Qd_FrameRgn(_self, _args) |
| 1440 | PyObject *_self; |
| 1441 | PyObject *_args; |
| 1442 | { |
| 1443 | PyObject *_res = NULL; |
| 1444 | RgnHandle rgn; |
| 1445 | if (!PyArg_ParseTuple(_args, "O&", |
| 1446 | ResObj_Convert, &rgn)) |
| 1447 | return NULL; |
| 1448 | FrameRgn(rgn); |
| 1449 | Py_INCREF(Py_None); |
| 1450 | _res = Py_None; |
| 1451 | return _res; |
| 1452 | } |
| 1453 | |
| 1454 | static PyObject *Qd_PaintRgn(_self, _args) |
| 1455 | PyObject *_self; |
| 1456 | PyObject *_args; |
| 1457 | { |
| 1458 | PyObject *_res = NULL; |
| 1459 | RgnHandle rgn; |
| 1460 | if (!PyArg_ParseTuple(_args, "O&", |
| 1461 | ResObj_Convert, &rgn)) |
| 1462 | return NULL; |
| 1463 | PaintRgn(rgn); |
| 1464 | Py_INCREF(Py_None); |
| 1465 | _res = Py_None; |
| 1466 | return _res; |
| 1467 | } |
| 1468 | |
| 1469 | static PyObject *Qd_EraseRgn(_self, _args) |
| 1470 | PyObject *_self; |
| 1471 | PyObject *_args; |
| 1472 | { |
| 1473 | PyObject *_res = NULL; |
| 1474 | RgnHandle rgn; |
| 1475 | if (!PyArg_ParseTuple(_args, "O&", |
| 1476 | ResObj_Convert, &rgn)) |
| 1477 | return NULL; |
| 1478 | EraseRgn(rgn); |
| 1479 | Py_INCREF(Py_None); |
| 1480 | _res = Py_None; |
| 1481 | return _res; |
| 1482 | } |
| 1483 | |
| 1484 | static PyObject *Qd_InvertRgn(_self, _args) |
| 1485 | PyObject *_self; |
| 1486 | PyObject *_args; |
| 1487 | { |
| 1488 | PyObject *_res = NULL; |
| 1489 | RgnHandle rgn; |
| 1490 | if (!PyArg_ParseTuple(_args, "O&", |
| 1491 | ResObj_Convert, &rgn)) |
| 1492 | return NULL; |
| 1493 | InvertRgn(rgn); |
| 1494 | Py_INCREF(Py_None); |
| 1495 | _res = Py_None; |
| 1496 | return _res; |
| 1497 | } |
| 1498 | |
| 1499 | static PyObject *Qd_ScrollRect(_self, _args) |
| 1500 | PyObject *_self; |
| 1501 | PyObject *_args; |
| 1502 | { |
| 1503 | PyObject *_res = NULL; |
| 1504 | Rect r; |
| 1505 | short dh; |
| 1506 | short dv; |
| 1507 | RgnHandle updateRgn; |
| 1508 | if (!PyArg_ParseTuple(_args, "O&hhO&", |
| 1509 | PyMac_GetRect, &r, |
| 1510 | &dh, |
| 1511 | &dv, |
| 1512 | ResObj_Convert, &updateRgn)) |
| 1513 | return NULL; |
| 1514 | ScrollRect(&r, |
| 1515 | dh, |
| 1516 | dv, |
| 1517 | updateRgn); |
| 1518 | Py_INCREF(Py_None); |
| 1519 | _res = Py_None; |
| 1520 | return _res; |
| 1521 | } |
| 1522 | |
Jack Jansen | 41058c0 | 1995-11-16 22:48:29 +0000 | [diff] [blame] | 1523 | static PyObject *Qd_CopyBits(_self, _args) |
| 1524 | PyObject *_self; |
| 1525 | PyObject *_args; |
| 1526 | { |
| 1527 | PyObject *_res = NULL; |
| 1528 | BitMapPtr srcBits; |
| 1529 | BitMapPtr dstBits; |
| 1530 | Rect srcRect; |
| 1531 | Rect dstRect; |
| 1532 | short mode; |
| 1533 | RgnHandle maskRgn; |
| 1534 | if (!PyArg_ParseTuple(_args, "O&O&O&O&hO&", |
| 1535 | BMObj_Convert, &srcBits, |
| 1536 | BMObj_Convert, &dstBits, |
| 1537 | PyMac_GetRect, &srcRect, |
| 1538 | PyMac_GetRect, &dstRect, |
| 1539 | &mode, |
Jack Jansen | 425e9eb | 1995-12-12 15:02:03 +0000 | [diff] [blame^] | 1540 | OptResObj_Convert, &maskRgn)) |
Jack Jansen | 41058c0 | 1995-11-16 22:48:29 +0000 | [diff] [blame] | 1541 | return NULL; |
| 1542 | CopyBits(srcBits, |
| 1543 | dstBits, |
| 1544 | &srcRect, |
| 1545 | &dstRect, |
| 1546 | mode, |
| 1547 | maskRgn); |
| 1548 | Py_INCREF(Py_None); |
| 1549 | _res = Py_None; |
| 1550 | return _res; |
| 1551 | } |
| 1552 | |
| 1553 | static PyObject *Qd_CopyMask(_self, _args) |
| 1554 | PyObject *_self; |
| 1555 | PyObject *_args; |
| 1556 | { |
| 1557 | PyObject *_res = NULL; |
| 1558 | BitMapPtr srcBits; |
| 1559 | BitMapPtr maskBits; |
| 1560 | BitMapPtr dstBits; |
| 1561 | Rect srcRect; |
| 1562 | Rect maskRect; |
| 1563 | Rect dstRect; |
| 1564 | if (!PyArg_ParseTuple(_args, "O&O&O&O&O&O&", |
| 1565 | BMObj_Convert, &srcBits, |
| 1566 | BMObj_Convert, &maskBits, |
| 1567 | BMObj_Convert, &dstBits, |
| 1568 | PyMac_GetRect, &srcRect, |
| 1569 | PyMac_GetRect, &maskRect, |
| 1570 | PyMac_GetRect, &dstRect)) |
| 1571 | return NULL; |
| 1572 | CopyMask(srcBits, |
| 1573 | maskBits, |
| 1574 | dstBits, |
| 1575 | &srcRect, |
| 1576 | &maskRect, |
| 1577 | &dstRect); |
| 1578 | Py_INCREF(Py_None); |
| 1579 | _res = Py_None; |
| 1580 | return _res; |
| 1581 | } |
| 1582 | |
Guido van Rossum | e56db43 | 1995-03-19 22:49:50 +0000 | [diff] [blame] | 1583 | static PyObject *Qd_OpenPicture(_self, _args) |
| 1584 | PyObject *_self; |
| 1585 | PyObject *_args; |
| 1586 | { |
| 1587 | PyObject *_res = NULL; |
| 1588 | PicHandle _rv; |
| 1589 | Rect picFrame; |
| 1590 | if (!PyArg_ParseTuple(_args, "O&", |
| 1591 | PyMac_GetRect, &picFrame)) |
| 1592 | return NULL; |
| 1593 | _rv = OpenPicture(&picFrame); |
| 1594 | _res = Py_BuildValue("O&", |
| 1595 | ResObj_New, _rv); |
| 1596 | return _res; |
| 1597 | } |
| 1598 | |
| 1599 | static PyObject *Qd_PicComment(_self, _args) |
| 1600 | PyObject *_self; |
| 1601 | PyObject *_args; |
| 1602 | { |
| 1603 | PyObject *_res = NULL; |
| 1604 | short kind; |
| 1605 | short dataSize; |
| 1606 | Handle dataHandle; |
| 1607 | if (!PyArg_ParseTuple(_args, "hhO&", |
| 1608 | &kind, |
| 1609 | &dataSize, |
| 1610 | ResObj_Convert, &dataHandle)) |
| 1611 | return NULL; |
| 1612 | PicComment(kind, |
| 1613 | dataSize, |
| 1614 | dataHandle); |
| 1615 | Py_INCREF(Py_None); |
| 1616 | _res = Py_None; |
| 1617 | return _res; |
| 1618 | } |
| 1619 | |
| 1620 | static PyObject *Qd_ClosePicture(_self, _args) |
| 1621 | PyObject *_self; |
| 1622 | PyObject *_args; |
| 1623 | { |
| 1624 | PyObject *_res = NULL; |
| 1625 | if (!PyArg_ParseTuple(_args, "")) |
| 1626 | return NULL; |
| 1627 | ClosePicture(); |
| 1628 | Py_INCREF(Py_None); |
| 1629 | _res = Py_None; |
| 1630 | return _res; |
| 1631 | } |
| 1632 | |
| 1633 | static PyObject *Qd_DrawPicture(_self, _args) |
| 1634 | PyObject *_self; |
| 1635 | PyObject *_args; |
| 1636 | { |
| 1637 | PyObject *_res = NULL; |
| 1638 | PicHandle myPicture; |
| 1639 | Rect dstRect; |
| 1640 | if (!PyArg_ParseTuple(_args, "O&O&", |
| 1641 | ResObj_Convert, &myPicture, |
| 1642 | PyMac_GetRect, &dstRect)) |
| 1643 | return NULL; |
| 1644 | DrawPicture(myPicture, |
| 1645 | &dstRect); |
| 1646 | Py_INCREF(Py_None); |
| 1647 | _res = Py_None; |
| 1648 | return _res; |
| 1649 | } |
| 1650 | |
| 1651 | static PyObject *Qd_KillPicture(_self, _args) |
| 1652 | PyObject *_self; |
| 1653 | PyObject *_args; |
| 1654 | { |
| 1655 | PyObject *_res = NULL; |
| 1656 | PicHandle myPicture; |
| 1657 | if (!PyArg_ParseTuple(_args, "O&", |
| 1658 | ResObj_Convert, &myPicture)) |
| 1659 | return NULL; |
| 1660 | KillPicture(myPicture); |
| 1661 | Py_INCREF(Py_None); |
| 1662 | _res = Py_None; |
| 1663 | return _res; |
| 1664 | } |
| 1665 | |
| 1666 | static PyObject *Qd_OpenPoly(_self, _args) |
| 1667 | PyObject *_self; |
| 1668 | PyObject *_args; |
| 1669 | { |
| 1670 | PyObject *_res = NULL; |
| 1671 | PolyHandle _rv; |
| 1672 | if (!PyArg_ParseTuple(_args, "")) |
| 1673 | return NULL; |
| 1674 | _rv = OpenPoly(); |
| 1675 | _res = Py_BuildValue("O&", |
| 1676 | ResObj_New, _rv); |
| 1677 | return _res; |
| 1678 | } |
| 1679 | |
| 1680 | static PyObject *Qd_ClosePoly(_self, _args) |
| 1681 | PyObject *_self; |
| 1682 | PyObject *_args; |
| 1683 | { |
| 1684 | PyObject *_res = NULL; |
| 1685 | if (!PyArg_ParseTuple(_args, "")) |
| 1686 | return NULL; |
| 1687 | ClosePoly(); |
| 1688 | Py_INCREF(Py_None); |
| 1689 | _res = Py_None; |
| 1690 | return _res; |
| 1691 | } |
| 1692 | |
| 1693 | static PyObject *Qd_KillPoly(_self, _args) |
| 1694 | PyObject *_self; |
| 1695 | PyObject *_args; |
| 1696 | { |
| 1697 | PyObject *_res = NULL; |
| 1698 | PolyHandle poly; |
| 1699 | if (!PyArg_ParseTuple(_args, "O&", |
| 1700 | ResObj_Convert, &poly)) |
| 1701 | return NULL; |
| 1702 | KillPoly(poly); |
| 1703 | Py_INCREF(Py_None); |
| 1704 | _res = Py_None; |
| 1705 | return _res; |
| 1706 | } |
| 1707 | |
| 1708 | static PyObject *Qd_OffsetPoly(_self, _args) |
| 1709 | PyObject *_self; |
| 1710 | PyObject *_args; |
| 1711 | { |
| 1712 | PyObject *_res = NULL; |
| 1713 | PolyHandle poly; |
| 1714 | short dh; |
| 1715 | short dv; |
| 1716 | if (!PyArg_ParseTuple(_args, "O&hh", |
| 1717 | ResObj_Convert, &poly, |
| 1718 | &dh, |
| 1719 | &dv)) |
| 1720 | return NULL; |
| 1721 | OffsetPoly(poly, |
| 1722 | dh, |
| 1723 | dv); |
| 1724 | Py_INCREF(Py_None); |
| 1725 | _res = Py_None; |
| 1726 | return _res; |
| 1727 | } |
| 1728 | |
| 1729 | static PyObject *Qd_FramePoly(_self, _args) |
| 1730 | PyObject *_self; |
| 1731 | PyObject *_args; |
| 1732 | { |
| 1733 | PyObject *_res = NULL; |
| 1734 | PolyHandle poly; |
| 1735 | if (!PyArg_ParseTuple(_args, "O&", |
| 1736 | ResObj_Convert, &poly)) |
| 1737 | return NULL; |
| 1738 | FramePoly(poly); |
| 1739 | Py_INCREF(Py_None); |
| 1740 | _res = Py_None; |
| 1741 | return _res; |
| 1742 | } |
| 1743 | |
| 1744 | static PyObject *Qd_PaintPoly(_self, _args) |
| 1745 | PyObject *_self; |
| 1746 | PyObject *_args; |
| 1747 | { |
| 1748 | PyObject *_res = NULL; |
| 1749 | PolyHandle poly; |
| 1750 | if (!PyArg_ParseTuple(_args, "O&", |
| 1751 | ResObj_Convert, &poly)) |
| 1752 | return NULL; |
| 1753 | PaintPoly(poly); |
| 1754 | Py_INCREF(Py_None); |
| 1755 | _res = Py_None; |
| 1756 | return _res; |
| 1757 | } |
| 1758 | |
| 1759 | static PyObject *Qd_ErasePoly(_self, _args) |
| 1760 | PyObject *_self; |
| 1761 | PyObject *_args; |
| 1762 | { |
| 1763 | PyObject *_res = NULL; |
| 1764 | PolyHandle poly; |
| 1765 | if (!PyArg_ParseTuple(_args, "O&", |
| 1766 | ResObj_Convert, &poly)) |
| 1767 | return NULL; |
| 1768 | ErasePoly(poly); |
| 1769 | Py_INCREF(Py_None); |
| 1770 | _res = Py_None; |
| 1771 | return _res; |
| 1772 | } |
| 1773 | |
| 1774 | static PyObject *Qd_InvertPoly(_self, _args) |
| 1775 | PyObject *_self; |
| 1776 | PyObject *_args; |
| 1777 | { |
| 1778 | PyObject *_res = NULL; |
| 1779 | PolyHandle poly; |
| 1780 | if (!PyArg_ParseTuple(_args, "O&", |
| 1781 | ResObj_Convert, &poly)) |
| 1782 | return NULL; |
| 1783 | InvertPoly(poly); |
| 1784 | Py_INCREF(Py_None); |
| 1785 | _res = Py_None; |
| 1786 | return _res; |
| 1787 | } |
| 1788 | |
| 1789 | static PyObject *Qd_SetPt(_self, _args) |
| 1790 | PyObject *_self; |
| 1791 | PyObject *_args; |
| 1792 | { |
| 1793 | PyObject *_res = NULL; |
| 1794 | Point pt; |
| 1795 | short h; |
| 1796 | short v; |
| 1797 | if (!PyArg_ParseTuple(_args, "O&hh", |
| 1798 | PyMac_GetPoint, &pt, |
| 1799 | &h, |
| 1800 | &v)) |
| 1801 | return NULL; |
| 1802 | SetPt(&pt, |
| 1803 | h, |
| 1804 | v); |
| 1805 | _res = Py_BuildValue("O&", |
| 1806 | PyMac_BuildPoint, pt); |
| 1807 | return _res; |
| 1808 | } |
| 1809 | |
| 1810 | static PyObject *Qd_LocalToGlobal(_self, _args) |
| 1811 | PyObject *_self; |
| 1812 | PyObject *_args; |
| 1813 | { |
| 1814 | PyObject *_res = NULL; |
| 1815 | Point pt; |
| 1816 | if (!PyArg_ParseTuple(_args, "O&", |
| 1817 | PyMac_GetPoint, &pt)) |
| 1818 | return NULL; |
| 1819 | LocalToGlobal(&pt); |
| 1820 | _res = Py_BuildValue("O&", |
| 1821 | PyMac_BuildPoint, pt); |
| 1822 | return _res; |
| 1823 | } |
| 1824 | |
| 1825 | static PyObject *Qd_GlobalToLocal(_self, _args) |
| 1826 | PyObject *_self; |
| 1827 | PyObject *_args; |
| 1828 | { |
| 1829 | PyObject *_res = NULL; |
| 1830 | Point pt; |
| 1831 | if (!PyArg_ParseTuple(_args, "O&", |
| 1832 | PyMac_GetPoint, &pt)) |
| 1833 | return NULL; |
| 1834 | GlobalToLocal(&pt); |
| 1835 | _res = Py_BuildValue("O&", |
| 1836 | PyMac_BuildPoint, pt); |
| 1837 | return _res; |
| 1838 | } |
| 1839 | |
| 1840 | static PyObject *Qd_Random(_self, _args) |
| 1841 | PyObject *_self; |
| 1842 | PyObject *_args; |
| 1843 | { |
| 1844 | PyObject *_res = NULL; |
| 1845 | short _rv; |
| 1846 | if (!PyArg_ParseTuple(_args, "")) |
| 1847 | return NULL; |
| 1848 | _rv = Random(); |
| 1849 | _res = Py_BuildValue("h", |
| 1850 | _rv); |
| 1851 | return _res; |
| 1852 | } |
| 1853 | |
| 1854 | static PyObject *Qd_GetPixel(_self, _args) |
| 1855 | PyObject *_self; |
| 1856 | PyObject *_args; |
| 1857 | { |
| 1858 | PyObject *_res = NULL; |
| 1859 | Boolean _rv; |
| 1860 | short h; |
| 1861 | short v; |
| 1862 | if (!PyArg_ParseTuple(_args, "hh", |
| 1863 | &h, |
| 1864 | &v)) |
| 1865 | return NULL; |
| 1866 | _rv = GetPixel(h, |
| 1867 | v); |
| 1868 | _res = Py_BuildValue("b", |
| 1869 | _rv); |
| 1870 | return _res; |
| 1871 | } |
| 1872 | |
| 1873 | static PyObject *Qd_ScalePt(_self, _args) |
| 1874 | PyObject *_self; |
| 1875 | PyObject *_args; |
| 1876 | { |
| 1877 | PyObject *_res = NULL; |
| 1878 | Point pt; |
| 1879 | Rect srcRect; |
| 1880 | Rect dstRect; |
| 1881 | if (!PyArg_ParseTuple(_args, "O&O&O&", |
| 1882 | PyMac_GetPoint, &pt, |
| 1883 | PyMac_GetRect, &srcRect, |
| 1884 | PyMac_GetRect, &dstRect)) |
| 1885 | return NULL; |
| 1886 | ScalePt(&pt, |
| 1887 | &srcRect, |
| 1888 | &dstRect); |
| 1889 | _res = Py_BuildValue("O&", |
| 1890 | PyMac_BuildPoint, pt); |
| 1891 | return _res; |
| 1892 | } |
| 1893 | |
| 1894 | static PyObject *Qd_MapPt(_self, _args) |
| 1895 | PyObject *_self; |
| 1896 | PyObject *_args; |
| 1897 | { |
| 1898 | PyObject *_res = NULL; |
| 1899 | Point pt; |
| 1900 | Rect srcRect; |
| 1901 | Rect dstRect; |
| 1902 | if (!PyArg_ParseTuple(_args, "O&O&O&", |
| 1903 | PyMac_GetPoint, &pt, |
| 1904 | PyMac_GetRect, &srcRect, |
| 1905 | PyMac_GetRect, &dstRect)) |
| 1906 | return NULL; |
| 1907 | MapPt(&pt, |
| 1908 | &srcRect, |
| 1909 | &dstRect); |
| 1910 | _res = Py_BuildValue("O&", |
| 1911 | PyMac_BuildPoint, pt); |
| 1912 | return _res; |
| 1913 | } |
| 1914 | |
| 1915 | static PyObject *Qd_MapRect(_self, _args) |
| 1916 | PyObject *_self; |
| 1917 | PyObject *_args; |
| 1918 | { |
| 1919 | PyObject *_res = NULL; |
| 1920 | Rect r; |
| 1921 | Rect srcRect; |
| 1922 | Rect dstRect; |
Jack Jansen | 54c8f7e | 1995-11-14 10:46:01 +0000 | [diff] [blame] | 1923 | if (!PyArg_ParseTuple(_args, "O&O&O&", |
| 1924 | PyMac_GetRect, &r, |
Guido van Rossum | e56db43 | 1995-03-19 22:49:50 +0000 | [diff] [blame] | 1925 | PyMac_GetRect, &srcRect, |
| 1926 | PyMac_GetRect, &dstRect)) |
| 1927 | return NULL; |
| 1928 | MapRect(&r, |
| 1929 | &srcRect, |
| 1930 | &dstRect); |
| 1931 | _res = Py_BuildValue("O&", |
| 1932 | PyMac_BuildRect, &r); |
| 1933 | return _res; |
| 1934 | } |
| 1935 | |
| 1936 | static PyObject *Qd_MapRgn(_self, _args) |
| 1937 | PyObject *_self; |
| 1938 | PyObject *_args; |
| 1939 | { |
| 1940 | PyObject *_res = NULL; |
| 1941 | RgnHandle rgn; |
| 1942 | Rect srcRect; |
| 1943 | Rect dstRect; |
| 1944 | if (!PyArg_ParseTuple(_args, "O&O&O&", |
| 1945 | ResObj_Convert, &rgn, |
| 1946 | PyMac_GetRect, &srcRect, |
| 1947 | PyMac_GetRect, &dstRect)) |
| 1948 | return NULL; |
| 1949 | MapRgn(rgn, |
| 1950 | &srcRect, |
| 1951 | &dstRect); |
| 1952 | Py_INCREF(Py_None); |
| 1953 | _res = Py_None; |
| 1954 | return _res; |
| 1955 | } |
| 1956 | |
| 1957 | static PyObject *Qd_MapPoly(_self, _args) |
| 1958 | PyObject *_self; |
| 1959 | PyObject *_args; |
| 1960 | { |
| 1961 | PyObject *_res = NULL; |
| 1962 | PolyHandle poly; |
| 1963 | Rect srcRect; |
| 1964 | Rect dstRect; |
| 1965 | if (!PyArg_ParseTuple(_args, "O&O&O&", |
| 1966 | ResObj_Convert, &poly, |
| 1967 | PyMac_GetRect, &srcRect, |
| 1968 | PyMac_GetRect, &dstRect)) |
| 1969 | return NULL; |
| 1970 | MapPoly(poly, |
| 1971 | &srcRect, |
| 1972 | &dstRect); |
| 1973 | Py_INCREF(Py_None); |
| 1974 | _res = Py_None; |
| 1975 | return _res; |
| 1976 | } |
| 1977 | |
Jack Jansen | 41058c0 | 1995-11-16 22:48:29 +0000 | [diff] [blame] | 1978 | static PyObject *Qd_StdBits(_self, _args) |
| 1979 | PyObject *_self; |
| 1980 | PyObject *_args; |
| 1981 | { |
| 1982 | PyObject *_res = NULL; |
| 1983 | BitMapPtr srcBits; |
| 1984 | Rect srcRect; |
| 1985 | Rect dstRect; |
| 1986 | short mode; |
| 1987 | RgnHandle maskRgn; |
| 1988 | if (!PyArg_ParseTuple(_args, "O&O&O&hO&", |
| 1989 | BMObj_Convert, &srcBits, |
| 1990 | PyMac_GetRect, &srcRect, |
| 1991 | PyMac_GetRect, &dstRect, |
| 1992 | &mode, |
Jack Jansen | 425e9eb | 1995-12-12 15:02:03 +0000 | [diff] [blame^] | 1993 | OptResObj_Convert, &maskRgn)) |
Jack Jansen | 41058c0 | 1995-11-16 22:48:29 +0000 | [diff] [blame] | 1994 | return NULL; |
| 1995 | StdBits(srcBits, |
| 1996 | &srcRect, |
| 1997 | &dstRect, |
| 1998 | mode, |
| 1999 | maskRgn); |
| 2000 | Py_INCREF(Py_None); |
| 2001 | _res = Py_None; |
| 2002 | return _res; |
| 2003 | } |
| 2004 | |
Guido van Rossum | e56db43 | 1995-03-19 22:49:50 +0000 | [diff] [blame] | 2005 | static PyObject *Qd_AddPt(_self, _args) |
| 2006 | PyObject *_self; |
| 2007 | PyObject *_args; |
| 2008 | { |
| 2009 | PyObject *_res = NULL; |
| 2010 | Point src; |
| 2011 | Point dst; |
| 2012 | if (!PyArg_ParseTuple(_args, "O&O&", |
| 2013 | PyMac_GetPoint, &src, |
| 2014 | PyMac_GetPoint, &dst)) |
| 2015 | return NULL; |
| 2016 | AddPt(src, |
| 2017 | &dst); |
| 2018 | _res = Py_BuildValue("O&", |
| 2019 | PyMac_BuildPoint, dst); |
| 2020 | return _res; |
| 2021 | } |
| 2022 | |
| 2023 | static PyObject *Qd_EqualPt(_self, _args) |
| 2024 | PyObject *_self; |
| 2025 | PyObject *_args; |
| 2026 | { |
| 2027 | PyObject *_res = NULL; |
| 2028 | Boolean _rv; |
| 2029 | Point pt1; |
| 2030 | Point pt2; |
| 2031 | if (!PyArg_ParseTuple(_args, "O&O&", |
| 2032 | PyMac_GetPoint, &pt1, |
| 2033 | PyMac_GetPoint, &pt2)) |
| 2034 | return NULL; |
| 2035 | _rv = EqualPt(pt1, |
| 2036 | pt2); |
| 2037 | _res = Py_BuildValue("b", |
| 2038 | _rv); |
| 2039 | return _res; |
| 2040 | } |
| 2041 | |
| 2042 | static PyObject *Qd_PtInRect(_self, _args) |
| 2043 | PyObject *_self; |
| 2044 | PyObject *_args; |
| 2045 | { |
| 2046 | PyObject *_res = NULL; |
| 2047 | Boolean _rv; |
| 2048 | Point pt; |
| 2049 | Rect r; |
| 2050 | if (!PyArg_ParseTuple(_args, "O&O&", |
| 2051 | PyMac_GetPoint, &pt, |
| 2052 | PyMac_GetRect, &r)) |
| 2053 | return NULL; |
| 2054 | _rv = PtInRect(pt, |
| 2055 | &r); |
| 2056 | _res = Py_BuildValue("b", |
| 2057 | _rv); |
| 2058 | return _res; |
| 2059 | } |
| 2060 | |
| 2061 | static PyObject *Qd_Pt2Rect(_self, _args) |
| 2062 | PyObject *_self; |
| 2063 | PyObject *_args; |
| 2064 | { |
| 2065 | PyObject *_res = NULL; |
| 2066 | Point pt1; |
| 2067 | Point pt2; |
| 2068 | Rect dstRect; |
| 2069 | if (!PyArg_ParseTuple(_args, "O&O&", |
| 2070 | PyMac_GetPoint, &pt1, |
| 2071 | PyMac_GetPoint, &pt2)) |
| 2072 | return NULL; |
| 2073 | Pt2Rect(pt1, |
| 2074 | pt2, |
| 2075 | &dstRect); |
| 2076 | _res = Py_BuildValue("O&", |
| 2077 | PyMac_BuildRect, &dstRect); |
| 2078 | return _res; |
| 2079 | } |
| 2080 | |
| 2081 | static PyObject *Qd_PtToAngle(_self, _args) |
| 2082 | PyObject *_self; |
| 2083 | PyObject *_args; |
| 2084 | { |
| 2085 | PyObject *_res = NULL; |
| 2086 | Rect r; |
| 2087 | Point pt; |
| 2088 | short angle; |
| 2089 | if (!PyArg_ParseTuple(_args, "O&O&", |
| 2090 | PyMac_GetRect, &r, |
| 2091 | PyMac_GetPoint, &pt)) |
| 2092 | return NULL; |
| 2093 | PtToAngle(&r, |
| 2094 | pt, |
| 2095 | &angle); |
| 2096 | _res = Py_BuildValue("h", |
| 2097 | angle); |
| 2098 | return _res; |
| 2099 | } |
| 2100 | |
Jack Jansen | b81cf9d | 1995-06-06 13:08:40 +0000 | [diff] [blame] | 2101 | static PyObject *Qd_SubPt(_self, _args) |
| 2102 | PyObject *_self; |
| 2103 | PyObject *_args; |
| 2104 | { |
| 2105 | PyObject *_res = NULL; |
| 2106 | Point src; |
| 2107 | Point dst; |
| 2108 | if (!PyArg_ParseTuple(_args, "O&O&", |
| 2109 | PyMac_GetPoint, &src, |
| 2110 | PyMac_GetPoint, &dst)) |
| 2111 | return NULL; |
| 2112 | SubPt(src, |
| 2113 | &dst); |
| 2114 | _res = Py_BuildValue("O&", |
| 2115 | PyMac_BuildPoint, dst); |
| 2116 | return _res; |
| 2117 | } |
| 2118 | |
Guido van Rossum | e56db43 | 1995-03-19 22:49:50 +0000 | [diff] [blame] | 2119 | static PyObject *Qd_PtInRgn(_self, _args) |
| 2120 | PyObject *_self; |
| 2121 | PyObject *_args; |
| 2122 | { |
| 2123 | PyObject *_res = NULL; |
| 2124 | Boolean _rv; |
| 2125 | Point pt; |
| 2126 | RgnHandle rgn; |
| 2127 | if (!PyArg_ParseTuple(_args, "O&O&", |
| 2128 | PyMac_GetPoint, &pt, |
| 2129 | ResObj_Convert, &rgn)) |
| 2130 | return NULL; |
| 2131 | _rv = PtInRgn(pt, |
| 2132 | rgn); |
| 2133 | _res = Py_BuildValue("b", |
| 2134 | _rv); |
| 2135 | return _res; |
| 2136 | } |
| 2137 | |
| 2138 | static PyObject *Qd_NewPixMap(_self, _args) |
| 2139 | PyObject *_self; |
| 2140 | PyObject *_args; |
| 2141 | { |
| 2142 | PyObject *_res = NULL; |
| 2143 | PixMapHandle _rv; |
| 2144 | if (!PyArg_ParseTuple(_args, "")) |
| 2145 | return NULL; |
| 2146 | _rv = NewPixMap(); |
| 2147 | _res = Py_BuildValue("O&", |
| 2148 | ResObj_New, _rv); |
| 2149 | return _res; |
| 2150 | } |
| 2151 | |
Guido van Rossum | e56db43 | 1995-03-19 22:49:50 +0000 | [diff] [blame] | 2152 | static PyObject *Qd_DisposePixMap(_self, _args) |
| 2153 | PyObject *_self; |
| 2154 | PyObject *_args; |
| 2155 | { |
| 2156 | PyObject *_res = NULL; |
| 2157 | PixMapHandle pm; |
| 2158 | if (!PyArg_ParseTuple(_args, "O&", |
| 2159 | ResObj_Convert, &pm)) |
| 2160 | return NULL; |
| 2161 | DisposePixMap(pm); |
| 2162 | Py_INCREF(Py_None); |
| 2163 | _res = Py_None; |
| 2164 | return _res; |
| 2165 | } |
| 2166 | |
| 2167 | static PyObject *Qd_CopyPixMap(_self, _args) |
| 2168 | PyObject *_self; |
| 2169 | PyObject *_args; |
| 2170 | { |
| 2171 | PyObject *_res = NULL; |
| 2172 | PixMapHandle srcPM; |
| 2173 | PixMapHandle dstPM; |
| 2174 | if (!PyArg_ParseTuple(_args, "O&O&", |
| 2175 | ResObj_Convert, &srcPM, |
| 2176 | ResObj_Convert, &dstPM)) |
| 2177 | return NULL; |
| 2178 | CopyPixMap(srcPM, |
| 2179 | dstPM); |
| 2180 | Py_INCREF(Py_None); |
| 2181 | _res = Py_None; |
| 2182 | return _res; |
| 2183 | } |
| 2184 | |
| 2185 | static PyObject *Qd_NewPixPat(_self, _args) |
| 2186 | PyObject *_self; |
| 2187 | PyObject *_args; |
| 2188 | { |
| 2189 | PyObject *_res = NULL; |
| 2190 | PixPatHandle _rv; |
| 2191 | if (!PyArg_ParseTuple(_args, "")) |
| 2192 | return NULL; |
| 2193 | _rv = NewPixPat(); |
| 2194 | _res = Py_BuildValue("O&", |
| 2195 | ResObj_New, _rv); |
| 2196 | return _res; |
| 2197 | } |
| 2198 | |
Guido van Rossum | e56db43 | 1995-03-19 22:49:50 +0000 | [diff] [blame] | 2199 | static PyObject *Qd_DisposePixPat(_self, _args) |
| 2200 | PyObject *_self; |
| 2201 | PyObject *_args; |
| 2202 | { |
| 2203 | PyObject *_res = NULL; |
| 2204 | PixPatHandle pp; |
| 2205 | if (!PyArg_ParseTuple(_args, "O&", |
| 2206 | ResObj_Convert, &pp)) |
| 2207 | return NULL; |
| 2208 | DisposePixPat(pp); |
| 2209 | Py_INCREF(Py_None); |
| 2210 | _res = Py_None; |
| 2211 | return _res; |
| 2212 | } |
| 2213 | |
| 2214 | static PyObject *Qd_CopyPixPat(_self, _args) |
| 2215 | PyObject *_self; |
| 2216 | PyObject *_args; |
| 2217 | { |
| 2218 | PyObject *_res = NULL; |
| 2219 | PixPatHandle srcPP; |
| 2220 | PixPatHandle dstPP; |
| 2221 | if (!PyArg_ParseTuple(_args, "O&O&", |
| 2222 | ResObj_Convert, &srcPP, |
| 2223 | ResObj_Convert, &dstPP)) |
| 2224 | return NULL; |
| 2225 | CopyPixPat(srcPP, |
| 2226 | dstPP); |
| 2227 | Py_INCREF(Py_None); |
| 2228 | _res = Py_None; |
| 2229 | return _res; |
| 2230 | } |
| 2231 | |
| 2232 | static PyObject *Qd_PenPixPat(_self, _args) |
| 2233 | PyObject *_self; |
| 2234 | PyObject *_args; |
| 2235 | { |
| 2236 | PyObject *_res = NULL; |
| 2237 | PixPatHandle pp; |
| 2238 | if (!PyArg_ParseTuple(_args, "O&", |
| 2239 | ResObj_Convert, &pp)) |
| 2240 | return NULL; |
| 2241 | PenPixPat(pp); |
| 2242 | Py_INCREF(Py_None); |
| 2243 | _res = Py_None; |
| 2244 | return _res; |
| 2245 | } |
| 2246 | |
| 2247 | static PyObject *Qd_BackPixPat(_self, _args) |
| 2248 | PyObject *_self; |
| 2249 | PyObject *_args; |
| 2250 | { |
| 2251 | PyObject *_res = NULL; |
| 2252 | PixPatHandle pp; |
| 2253 | if (!PyArg_ParseTuple(_args, "O&", |
| 2254 | ResObj_Convert, &pp)) |
| 2255 | return NULL; |
| 2256 | BackPixPat(pp); |
| 2257 | Py_INCREF(Py_None); |
| 2258 | _res = Py_None; |
| 2259 | return _res; |
| 2260 | } |
| 2261 | |
| 2262 | static PyObject *Qd_GetPixPat(_self, _args) |
| 2263 | PyObject *_self; |
| 2264 | PyObject *_args; |
| 2265 | { |
| 2266 | PyObject *_res = NULL; |
| 2267 | PixPatHandle _rv; |
| 2268 | short patID; |
| 2269 | if (!PyArg_ParseTuple(_args, "h", |
| 2270 | &patID)) |
| 2271 | return NULL; |
| 2272 | _rv = GetPixPat(patID); |
| 2273 | _res = Py_BuildValue("O&", |
| 2274 | ResObj_New, _rv); |
| 2275 | return _res; |
| 2276 | } |
| 2277 | |
Jack Jansen | 232f3cd | 1995-12-09 14:04:31 +0000 | [diff] [blame] | 2278 | static PyObject *Qd_MakeRGBPat(_self, _args) |
| 2279 | PyObject *_self; |
| 2280 | PyObject *_args; |
| 2281 | { |
| 2282 | PyObject *_res = NULL; |
| 2283 | PixPatHandle pp; |
| 2284 | RGBColor myColor; |
| 2285 | if (!PyArg_ParseTuple(_args, "O&O&", |
| 2286 | ResObj_Convert, &pp, |
| 2287 | QdRGB_Convert, &myColor)) |
| 2288 | return NULL; |
| 2289 | MakeRGBPat(pp, |
| 2290 | &myColor); |
| 2291 | Py_INCREF(Py_None); |
| 2292 | _res = Py_None; |
| 2293 | return _res; |
| 2294 | } |
| 2295 | |
Guido van Rossum | e56db43 | 1995-03-19 22:49:50 +0000 | [diff] [blame] | 2296 | static PyObject *Qd_FillCRect(_self, _args) |
| 2297 | PyObject *_self; |
| 2298 | PyObject *_args; |
| 2299 | { |
| 2300 | PyObject *_res = NULL; |
| 2301 | Rect r; |
| 2302 | PixPatHandle pp; |
| 2303 | if (!PyArg_ParseTuple(_args, "O&O&", |
| 2304 | PyMac_GetRect, &r, |
| 2305 | ResObj_Convert, &pp)) |
| 2306 | return NULL; |
| 2307 | FillCRect(&r, |
| 2308 | pp); |
| 2309 | Py_INCREF(Py_None); |
| 2310 | _res = Py_None; |
| 2311 | return _res; |
| 2312 | } |
| 2313 | |
| 2314 | static PyObject *Qd_FillCOval(_self, _args) |
| 2315 | PyObject *_self; |
| 2316 | PyObject *_args; |
| 2317 | { |
| 2318 | PyObject *_res = NULL; |
| 2319 | Rect r; |
| 2320 | PixPatHandle pp; |
| 2321 | if (!PyArg_ParseTuple(_args, "O&O&", |
| 2322 | PyMac_GetRect, &r, |
| 2323 | ResObj_Convert, &pp)) |
| 2324 | return NULL; |
| 2325 | FillCOval(&r, |
| 2326 | pp); |
| 2327 | Py_INCREF(Py_None); |
| 2328 | _res = Py_None; |
| 2329 | return _res; |
| 2330 | } |
| 2331 | |
| 2332 | static PyObject *Qd_FillCRoundRect(_self, _args) |
| 2333 | PyObject *_self; |
| 2334 | PyObject *_args; |
| 2335 | { |
| 2336 | PyObject *_res = NULL; |
| 2337 | Rect r; |
| 2338 | short ovalWidth; |
| 2339 | short ovalHeight; |
| 2340 | PixPatHandle pp; |
| 2341 | if (!PyArg_ParseTuple(_args, "O&hhO&", |
| 2342 | PyMac_GetRect, &r, |
| 2343 | &ovalWidth, |
| 2344 | &ovalHeight, |
| 2345 | ResObj_Convert, &pp)) |
| 2346 | return NULL; |
| 2347 | FillCRoundRect(&r, |
| 2348 | ovalWidth, |
| 2349 | ovalHeight, |
| 2350 | pp); |
| 2351 | Py_INCREF(Py_None); |
| 2352 | _res = Py_None; |
| 2353 | return _res; |
| 2354 | } |
| 2355 | |
| 2356 | static PyObject *Qd_FillCArc(_self, _args) |
| 2357 | PyObject *_self; |
| 2358 | PyObject *_args; |
| 2359 | { |
| 2360 | PyObject *_res = NULL; |
| 2361 | Rect r; |
| 2362 | short startAngle; |
| 2363 | short arcAngle; |
| 2364 | PixPatHandle pp; |
| 2365 | if (!PyArg_ParseTuple(_args, "O&hhO&", |
| 2366 | PyMac_GetRect, &r, |
| 2367 | &startAngle, |
| 2368 | &arcAngle, |
| 2369 | ResObj_Convert, &pp)) |
| 2370 | return NULL; |
| 2371 | FillCArc(&r, |
| 2372 | startAngle, |
| 2373 | arcAngle, |
| 2374 | pp); |
| 2375 | Py_INCREF(Py_None); |
| 2376 | _res = Py_None; |
| 2377 | return _res; |
| 2378 | } |
| 2379 | |
| 2380 | static PyObject *Qd_FillCRgn(_self, _args) |
| 2381 | PyObject *_self; |
| 2382 | PyObject *_args; |
| 2383 | { |
| 2384 | PyObject *_res = NULL; |
| 2385 | RgnHandle rgn; |
| 2386 | PixPatHandle pp; |
| 2387 | if (!PyArg_ParseTuple(_args, "O&O&", |
| 2388 | ResObj_Convert, &rgn, |
| 2389 | ResObj_Convert, &pp)) |
| 2390 | return NULL; |
| 2391 | FillCRgn(rgn, |
| 2392 | pp); |
| 2393 | Py_INCREF(Py_None); |
| 2394 | _res = Py_None; |
| 2395 | return _res; |
| 2396 | } |
| 2397 | |
| 2398 | static PyObject *Qd_FillCPoly(_self, _args) |
| 2399 | PyObject *_self; |
| 2400 | PyObject *_args; |
| 2401 | { |
| 2402 | PyObject *_res = NULL; |
| 2403 | PolyHandle poly; |
| 2404 | PixPatHandle pp; |
| 2405 | if (!PyArg_ParseTuple(_args, "O&O&", |
| 2406 | ResObj_Convert, &poly, |
| 2407 | ResObj_Convert, &pp)) |
| 2408 | return NULL; |
| 2409 | FillCPoly(poly, |
| 2410 | pp); |
| 2411 | Py_INCREF(Py_None); |
| 2412 | _res = Py_None; |
| 2413 | return _res; |
| 2414 | } |
| 2415 | |
Jack Jansen | 232f3cd | 1995-12-09 14:04:31 +0000 | [diff] [blame] | 2416 | static PyObject *Qd_RGBForeColor(_self, _args) |
| 2417 | PyObject *_self; |
| 2418 | PyObject *_args; |
| 2419 | { |
| 2420 | PyObject *_res = NULL; |
| 2421 | RGBColor color; |
| 2422 | if (!PyArg_ParseTuple(_args, "O&", |
| 2423 | QdRGB_Convert, &color)) |
| 2424 | return NULL; |
| 2425 | RGBForeColor(&color); |
| 2426 | Py_INCREF(Py_None); |
| 2427 | _res = Py_None; |
| 2428 | return _res; |
| 2429 | } |
| 2430 | |
| 2431 | static PyObject *Qd_RGBBackColor(_self, _args) |
| 2432 | PyObject *_self; |
| 2433 | PyObject *_args; |
| 2434 | { |
| 2435 | PyObject *_res = NULL; |
| 2436 | RGBColor color; |
| 2437 | if (!PyArg_ParseTuple(_args, "O&", |
| 2438 | QdRGB_Convert, &color)) |
| 2439 | return NULL; |
| 2440 | RGBBackColor(&color); |
| 2441 | Py_INCREF(Py_None); |
| 2442 | _res = Py_None; |
| 2443 | return _res; |
| 2444 | } |
| 2445 | |
| 2446 | static PyObject *Qd_SetCPixel(_self, _args) |
| 2447 | PyObject *_self; |
| 2448 | PyObject *_args; |
| 2449 | { |
| 2450 | PyObject *_res = NULL; |
| 2451 | short h; |
| 2452 | short v; |
| 2453 | RGBColor cPix; |
| 2454 | if (!PyArg_ParseTuple(_args, "hhO&", |
| 2455 | &h, |
| 2456 | &v, |
| 2457 | QdRGB_Convert, &cPix)) |
| 2458 | return NULL; |
| 2459 | SetCPixel(h, |
| 2460 | v, |
| 2461 | &cPix); |
| 2462 | Py_INCREF(Py_None); |
| 2463 | _res = Py_None; |
| 2464 | return _res; |
| 2465 | } |
| 2466 | |
Guido van Rossum | e56db43 | 1995-03-19 22:49:50 +0000 | [diff] [blame] | 2467 | static PyObject *Qd_SetPortPix(_self, _args) |
| 2468 | PyObject *_self; |
| 2469 | PyObject *_args; |
| 2470 | { |
| 2471 | PyObject *_res = NULL; |
| 2472 | PixMapHandle pm; |
| 2473 | if (!PyArg_ParseTuple(_args, "O&", |
| 2474 | ResObj_Convert, &pm)) |
| 2475 | return NULL; |
| 2476 | SetPortPix(pm); |
| 2477 | Py_INCREF(Py_None); |
| 2478 | _res = Py_None; |
| 2479 | return _res; |
| 2480 | } |
| 2481 | |
Jack Jansen | 232f3cd | 1995-12-09 14:04:31 +0000 | [diff] [blame] | 2482 | static PyObject *Qd_GetCPixel(_self, _args) |
| 2483 | PyObject *_self; |
| 2484 | PyObject *_args; |
| 2485 | { |
| 2486 | PyObject *_res = NULL; |
| 2487 | short h; |
| 2488 | short v; |
| 2489 | RGBColor cPix; |
| 2490 | if (!PyArg_ParseTuple(_args, "hh", |
| 2491 | &h, |
| 2492 | &v)) |
| 2493 | return NULL; |
| 2494 | GetCPixel(h, |
| 2495 | v, |
| 2496 | &cPix); |
| 2497 | _res = Py_BuildValue("O&", |
| 2498 | QdRGB_New, &cPix); |
| 2499 | return _res; |
| 2500 | } |
| 2501 | |
| 2502 | static PyObject *Qd_GetForeColor(_self, _args) |
| 2503 | PyObject *_self; |
| 2504 | PyObject *_args; |
| 2505 | { |
| 2506 | PyObject *_res = NULL; |
| 2507 | RGBColor color; |
| 2508 | if (!PyArg_ParseTuple(_args, "")) |
| 2509 | return NULL; |
| 2510 | GetForeColor(&color); |
| 2511 | _res = Py_BuildValue("O&", |
| 2512 | QdRGB_New, &color); |
| 2513 | return _res; |
| 2514 | } |
| 2515 | |
| 2516 | static PyObject *Qd_GetBackColor(_self, _args) |
| 2517 | PyObject *_self; |
| 2518 | PyObject *_args; |
| 2519 | { |
| 2520 | PyObject *_res = NULL; |
| 2521 | RGBColor color; |
| 2522 | if (!PyArg_ParseTuple(_args, "")) |
| 2523 | return NULL; |
| 2524 | GetBackColor(&color); |
| 2525 | _res = Py_BuildValue("O&", |
| 2526 | QdRGB_New, &color); |
| 2527 | return _res; |
| 2528 | } |
| 2529 | |
| 2530 | static PyObject *Qd_OpColor(_self, _args) |
| 2531 | PyObject *_self; |
| 2532 | PyObject *_args; |
| 2533 | { |
| 2534 | PyObject *_res = NULL; |
| 2535 | RGBColor color; |
| 2536 | if (!PyArg_ParseTuple(_args, "O&", |
| 2537 | QdRGB_Convert, &color)) |
| 2538 | return NULL; |
| 2539 | OpColor(&color); |
| 2540 | Py_INCREF(Py_None); |
| 2541 | _res = Py_None; |
| 2542 | return _res; |
| 2543 | } |
| 2544 | |
| 2545 | static PyObject *Qd_HiliteColor(_self, _args) |
| 2546 | PyObject *_self; |
| 2547 | PyObject *_args; |
| 2548 | { |
| 2549 | PyObject *_res = NULL; |
| 2550 | RGBColor color; |
| 2551 | if (!PyArg_ParseTuple(_args, "O&", |
| 2552 | QdRGB_Convert, &color)) |
| 2553 | return NULL; |
| 2554 | HiliteColor(&color); |
| 2555 | Py_INCREF(Py_None); |
| 2556 | _res = Py_None; |
| 2557 | return _res; |
| 2558 | } |
| 2559 | |
Guido van Rossum | e56db43 | 1995-03-19 22:49:50 +0000 | [diff] [blame] | 2560 | static PyObject *Qd_AllocCursor(_self, _args) |
| 2561 | PyObject *_self; |
| 2562 | PyObject *_args; |
| 2563 | { |
| 2564 | PyObject *_res = NULL; |
| 2565 | if (!PyArg_ParseTuple(_args, "")) |
| 2566 | return NULL; |
| 2567 | AllocCursor(); |
| 2568 | Py_INCREF(Py_None); |
| 2569 | _res = Py_None; |
| 2570 | return _res; |
| 2571 | } |
| 2572 | |
Guido van Rossum | e56db43 | 1995-03-19 22:49:50 +0000 | [diff] [blame] | 2573 | static PyObject *Qd_GetCTSeed(_self, _args) |
| 2574 | PyObject *_self; |
| 2575 | PyObject *_args; |
| 2576 | { |
| 2577 | PyObject *_res = NULL; |
| 2578 | long _rv; |
| 2579 | if (!PyArg_ParseTuple(_args, "")) |
| 2580 | return NULL; |
| 2581 | _rv = GetCTSeed(); |
| 2582 | _res = Py_BuildValue("l", |
| 2583 | _rv); |
| 2584 | return _res; |
| 2585 | } |
| 2586 | |
Jack Jansen | 232f3cd | 1995-12-09 14:04:31 +0000 | [diff] [blame] | 2587 | static PyObject *Qd_Color2Index(_self, _args) |
| 2588 | PyObject *_self; |
| 2589 | PyObject *_args; |
| 2590 | { |
| 2591 | PyObject *_res = NULL; |
| 2592 | long _rv; |
| 2593 | RGBColor myColor; |
| 2594 | if (!PyArg_ParseTuple(_args, "O&", |
| 2595 | QdRGB_Convert, &myColor)) |
| 2596 | return NULL; |
| 2597 | _rv = Color2Index(&myColor); |
| 2598 | _res = Py_BuildValue("l", |
| 2599 | _rv); |
| 2600 | return _res; |
| 2601 | } |
| 2602 | |
| 2603 | static PyObject *Qd_Index2Color(_self, _args) |
| 2604 | PyObject *_self; |
| 2605 | PyObject *_args; |
| 2606 | { |
| 2607 | PyObject *_res = NULL; |
| 2608 | long index; |
| 2609 | RGBColor aColor; |
| 2610 | if (!PyArg_ParseTuple(_args, "l", |
| 2611 | &index)) |
| 2612 | return NULL; |
| 2613 | Index2Color(index, |
| 2614 | &aColor); |
| 2615 | _res = Py_BuildValue("O&", |
| 2616 | QdRGB_New, &aColor); |
| 2617 | return _res; |
| 2618 | } |
| 2619 | |
| 2620 | static PyObject *Qd_InvertColor(_self, _args) |
| 2621 | PyObject *_self; |
| 2622 | PyObject *_args; |
| 2623 | { |
| 2624 | PyObject *_res = NULL; |
| 2625 | RGBColor myColor; |
| 2626 | if (!PyArg_ParseTuple(_args, "")) |
| 2627 | return NULL; |
| 2628 | InvertColor(&myColor); |
| 2629 | _res = Py_BuildValue("O&", |
| 2630 | QdRGB_New, &myColor); |
| 2631 | return _res; |
| 2632 | } |
| 2633 | |
| 2634 | static PyObject *Qd_RealColor(_self, _args) |
| 2635 | PyObject *_self; |
| 2636 | PyObject *_args; |
| 2637 | { |
| 2638 | PyObject *_res = NULL; |
| 2639 | Boolean _rv; |
| 2640 | RGBColor color; |
| 2641 | if (!PyArg_ParseTuple(_args, "O&", |
| 2642 | QdRGB_Convert, &color)) |
| 2643 | return NULL; |
| 2644 | _rv = RealColor(&color); |
| 2645 | _res = Py_BuildValue("b", |
| 2646 | _rv); |
| 2647 | return _res; |
| 2648 | } |
| 2649 | |
Guido van Rossum | e56db43 | 1995-03-19 22:49:50 +0000 | [diff] [blame] | 2650 | static PyObject *Qd_SetClientID(_self, _args) |
| 2651 | PyObject *_self; |
| 2652 | PyObject *_args; |
| 2653 | { |
| 2654 | PyObject *_res = NULL; |
| 2655 | short id; |
| 2656 | if (!PyArg_ParseTuple(_args, "h", |
| 2657 | &id)) |
| 2658 | return NULL; |
| 2659 | SetClientID(id); |
| 2660 | Py_INCREF(Py_None); |
| 2661 | _res = Py_None; |
| 2662 | return _res; |
| 2663 | } |
| 2664 | |
| 2665 | static PyObject *Qd_ProtectEntry(_self, _args) |
| 2666 | PyObject *_self; |
| 2667 | PyObject *_args; |
| 2668 | { |
| 2669 | PyObject *_res = NULL; |
| 2670 | short index; |
| 2671 | Boolean protect; |
| 2672 | if (!PyArg_ParseTuple(_args, "hb", |
| 2673 | &index, |
| 2674 | &protect)) |
| 2675 | return NULL; |
| 2676 | ProtectEntry(index, |
| 2677 | protect); |
| 2678 | Py_INCREF(Py_None); |
| 2679 | _res = Py_None; |
| 2680 | return _res; |
| 2681 | } |
| 2682 | |
| 2683 | static PyObject *Qd_ReserveEntry(_self, _args) |
| 2684 | PyObject *_self; |
| 2685 | PyObject *_args; |
| 2686 | { |
| 2687 | PyObject *_res = NULL; |
| 2688 | short index; |
| 2689 | Boolean reserve; |
| 2690 | if (!PyArg_ParseTuple(_args, "hb", |
| 2691 | &index, |
| 2692 | &reserve)) |
| 2693 | return NULL; |
| 2694 | ReserveEntry(index, |
| 2695 | reserve); |
| 2696 | Py_INCREF(Py_None); |
| 2697 | _res = Py_None; |
| 2698 | return _res; |
| 2699 | } |
| 2700 | |
| 2701 | static PyObject *Qd_QDError(_self, _args) |
| 2702 | PyObject *_self; |
| 2703 | PyObject *_args; |
| 2704 | { |
| 2705 | PyObject *_res = NULL; |
| 2706 | short _rv; |
| 2707 | if (!PyArg_ParseTuple(_args, "")) |
| 2708 | return NULL; |
| 2709 | _rv = QDError(); |
| 2710 | _res = Py_BuildValue("h", |
| 2711 | _rv); |
| 2712 | return _res; |
| 2713 | } |
| 2714 | |
Jack Jansen | 41058c0 | 1995-11-16 22:48:29 +0000 | [diff] [blame] | 2715 | static PyObject *Qd_CopyDeepMask(_self, _args) |
| 2716 | PyObject *_self; |
| 2717 | PyObject *_args; |
| 2718 | { |
| 2719 | PyObject *_res = NULL; |
| 2720 | BitMapPtr srcBits; |
| 2721 | BitMapPtr maskBits; |
| 2722 | BitMapPtr dstBits; |
| 2723 | Rect srcRect; |
| 2724 | Rect maskRect; |
| 2725 | Rect dstRect; |
| 2726 | short mode; |
| 2727 | RgnHandle maskRgn; |
| 2728 | if (!PyArg_ParseTuple(_args, "O&O&O&O&O&O&hO&", |
| 2729 | BMObj_Convert, &srcBits, |
| 2730 | BMObj_Convert, &maskBits, |
| 2731 | BMObj_Convert, &dstBits, |
| 2732 | PyMac_GetRect, &srcRect, |
| 2733 | PyMac_GetRect, &maskRect, |
| 2734 | PyMac_GetRect, &dstRect, |
| 2735 | &mode, |
Jack Jansen | 425e9eb | 1995-12-12 15:02:03 +0000 | [diff] [blame^] | 2736 | OptResObj_Convert, &maskRgn)) |
Jack Jansen | 41058c0 | 1995-11-16 22:48:29 +0000 | [diff] [blame] | 2737 | return NULL; |
| 2738 | CopyDeepMask(srcBits, |
| 2739 | maskBits, |
| 2740 | dstBits, |
| 2741 | &srcRect, |
| 2742 | &maskRect, |
| 2743 | &dstRect, |
| 2744 | mode, |
| 2745 | maskRgn); |
| 2746 | Py_INCREF(Py_None); |
| 2747 | _res = Py_None; |
| 2748 | return _res; |
| 2749 | } |
| 2750 | |
Jack Jansen | 54c8f7e | 1995-11-14 10:46:01 +0000 | [diff] [blame] | 2751 | static PyObject *Qd_GetPattern(_self, _args) |
| 2752 | PyObject *_self; |
| 2753 | PyObject *_args; |
| 2754 | { |
| 2755 | PyObject *_res = NULL; |
| 2756 | PatHandle _rv; |
| 2757 | short patternID; |
| 2758 | if (!PyArg_ParseTuple(_args, "h", |
| 2759 | &patternID)) |
| 2760 | return NULL; |
| 2761 | _rv = GetPattern(patternID); |
| 2762 | _res = Py_BuildValue("O&", |
| 2763 | ResObj_New, _rv); |
| 2764 | return _res; |
| 2765 | } |
| 2766 | |
| 2767 | static PyObject *Qd_GetCursor(_self, _args) |
| 2768 | PyObject *_self; |
| 2769 | PyObject *_args; |
| 2770 | { |
| 2771 | PyObject *_res = NULL; |
| 2772 | CursHandle _rv; |
| 2773 | short cursorID; |
| 2774 | if (!PyArg_ParseTuple(_args, "h", |
| 2775 | &cursorID)) |
| 2776 | return NULL; |
| 2777 | _rv = GetCursor(cursorID); |
| 2778 | _res = Py_BuildValue("O&", |
| 2779 | ResObj_New, _rv); |
| 2780 | return _res; |
| 2781 | } |
| 2782 | |
| 2783 | static PyObject *Qd_GetPicture(_self, _args) |
| 2784 | PyObject *_self; |
| 2785 | PyObject *_args; |
| 2786 | { |
| 2787 | PyObject *_res = NULL; |
| 2788 | PicHandle _rv; |
| 2789 | short pictureID; |
| 2790 | if (!PyArg_ParseTuple(_args, "h", |
| 2791 | &pictureID)) |
| 2792 | return NULL; |
| 2793 | _rv = GetPicture(pictureID); |
| 2794 | _res = Py_BuildValue("O&", |
| 2795 | ResObj_New, _rv); |
| 2796 | return _res; |
| 2797 | } |
| 2798 | |
| 2799 | static PyObject *Qd_DeltaPoint(_self, _args) |
| 2800 | PyObject *_self; |
| 2801 | PyObject *_args; |
| 2802 | { |
| 2803 | PyObject *_res = NULL; |
| 2804 | long _rv; |
| 2805 | Point ptA; |
| 2806 | Point ptB; |
| 2807 | if (!PyArg_ParseTuple(_args, "O&O&", |
| 2808 | PyMac_GetPoint, &ptA, |
| 2809 | PyMac_GetPoint, &ptB)) |
| 2810 | return NULL; |
| 2811 | _rv = DeltaPoint(ptA, |
| 2812 | ptB); |
| 2813 | _res = Py_BuildValue("l", |
| 2814 | _rv); |
| 2815 | return _res; |
| 2816 | } |
| 2817 | |
| 2818 | static PyObject *Qd_ShieldCursor(_self, _args) |
| 2819 | PyObject *_self; |
| 2820 | PyObject *_args; |
| 2821 | { |
| 2822 | PyObject *_res = NULL; |
| 2823 | Rect shieldRect; |
| 2824 | Point offsetPt; |
| 2825 | if (!PyArg_ParseTuple(_args, "O&O&", |
| 2826 | PyMac_GetRect, &shieldRect, |
| 2827 | PyMac_GetPoint, &offsetPt)) |
| 2828 | return NULL; |
| 2829 | ShieldCursor(&shieldRect, |
| 2830 | offsetPt); |
| 2831 | Py_INCREF(Py_None); |
| 2832 | _res = Py_None; |
| 2833 | return _res; |
| 2834 | } |
| 2835 | |
| 2836 | static PyObject *Qd_ScreenRes(_self, _args) |
| 2837 | PyObject *_self; |
| 2838 | PyObject *_args; |
| 2839 | { |
| 2840 | PyObject *_res = NULL; |
| 2841 | short scrnHRes; |
| 2842 | short scrnVRes; |
| 2843 | if (!PyArg_ParseTuple(_args, "")) |
| 2844 | return NULL; |
| 2845 | ScreenRes(&scrnHRes, |
| 2846 | &scrnVRes); |
| 2847 | _res = Py_BuildValue("hh", |
| 2848 | scrnHRes, |
| 2849 | scrnVRes); |
| 2850 | return _res; |
| 2851 | } |
| 2852 | |
Jack Jansen | b81cf9d | 1995-06-06 13:08:40 +0000 | [diff] [blame] | 2853 | static PyObject *Qd_TextFont(_self, _args) |
| 2854 | PyObject *_self; |
| 2855 | PyObject *_args; |
| 2856 | { |
| 2857 | PyObject *_res = NULL; |
| 2858 | short font; |
| 2859 | if (!PyArg_ParseTuple(_args, "h", |
| 2860 | &font)) |
| 2861 | return NULL; |
| 2862 | TextFont(font); |
| 2863 | Py_INCREF(Py_None); |
| 2864 | _res = Py_None; |
| 2865 | return _res; |
| 2866 | } |
| 2867 | |
| 2868 | static PyObject *Qd_TextFace(_self, _args) |
| 2869 | PyObject *_self; |
| 2870 | PyObject *_args; |
| 2871 | { |
| 2872 | PyObject *_res = NULL; |
| 2873 | short face; |
| 2874 | if (!PyArg_ParseTuple(_args, "h", |
| 2875 | &face)) |
| 2876 | return NULL; |
| 2877 | TextFace(face); |
| 2878 | Py_INCREF(Py_None); |
| 2879 | _res = Py_None; |
| 2880 | return _res; |
| 2881 | } |
| 2882 | |
| 2883 | static PyObject *Qd_TextMode(_self, _args) |
| 2884 | PyObject *_self; |
| 2885 | PyObject *_args; |
| 2886 | { |
| 2887 | PyObject *_res = NULL; |
| 2888 | short mode; |
| 2889 | if (!PyArg_ParseTuple(_args, "h", |
| 2890 | &mode)) |
| 2891 | return NULL; |
| 2892 | TextMode(mode); |
| 2893 | Py_INCREF(Py_None); |
| 2894 | _res = Py_None; |
| 2895 | return _res; |
| 2896 | } |
| 2897 | |
| 2898 | static PyObject *Qd_TextSize(_self, _args) |
| 2899 | PyObject *_self; |
| 2900 | PyObject *_args; |
| 2901 | { |
| 2902 | PyObject *_res = NULL; |
| 2903 | short size; |
| 2904 | if (!PyArg_ParseTuple(_args, "h", |
| 2905 | &size)) |
| 2906 | return NULL; |
| 2907 | TextSize(size); |
| 2908 | Py_INCREF(Py_None); |
| 2909 | _res = Py_None; |
| 2910 | return _res; |
| 2911 | } |
| 2912 | |
| 2913 | static PyObject *Qd_SpaceExtra(_self, _args) |
| 2914 | PyObject *_self; |
| 2915 | PyObject *_args; |
| 2916 | { |
| 2917 | PyObject *_res = NULL; |
Jack Jansen | 330381c | 1995-11-15 15:18:01 +0000 | [diff] [blame] | 2918 | Fixed extra; |
| 2919 | if (!PyArg_ParseTuple(_args, "O&", |
| 2920 | PyMac_GetFixed, &extra)) |
Jack Jansen | b81cf9d | 1995-06-06 13:08:40 +0000 | [diff] [blame] | 2921 | return NULL; |
| 2922 | SpaceExtra(extra); |
| 2923 | Py_INCREF(Py_None); |
| 2924 | _res = Py_None; |
| 2925 | return _res; |
| 2926 | } |
| 2927 | |
| 2928 | static PyObject *Qd_DrawChar(_self, _args) |
| 2929 | PyObject *_self; |
| 2930 | PyObject *_args; |
| 2931 | { |
| 2932 | PyObject *_res = NULL; |
| 2933 | short ch; |
| 2934 | if (!PyArg_ParseTuple(_args, "h", |
| 2935 | &ch)) |
| 2936 | return NULL; |
| 2937 | DrawChar(ch); |
| 2938 | Py_INCREF(Py_None); |
| 2939 | _res = Py_None; |
| 2940 | return _res; |
| 2941 | } |
| 2942 | |
| 2943 | static PyObject *Qd_DrawString(_self, _args) |
| 2944 | PyObject *_self; |
| 2945 | PyObject *_args; |
| 2946 | { |
| 2947 | PyObject *_res = NULL; |
| 2948 | Str255 s; |
| 2949 | if (!PyArg_ParseTuple(_args, "O&", |
| 2950 | PyMac_GetStr255, s)) |
| 2951 | return NULL; |
| 2952 | DrawString(s); |
| 2953 | Py_INCREF(Py_None); |
| 2954 | _res = Py_None; |
| 2955 | return _res; |
| 2956 | } |
| 2957 | |
| 2958 | static PyObject *Qd_DrawText(_self, _args) |
| 2959 | PyObject *_self; |
| 2960 | PyObject *_args; |
| 2961 | { |
| 2962 | PyObject *_res = NULL; |
| 2963 | char *textBuf__in__; |
| 2964 | int textBuf__len__; |
| 2965 | int textBuf__in_len__; |
| 2966 | short firstByte; |
| 2967 | short byteCount; |
| 2968 | if (!PyArg_ParseTuple(_args, "s#hh", |
| 2969 | &textBuf__in__, &textBuf__in_len__, |
| 2970 | &firstByte, |
| 2971 | &byteCount)) |
| 2972 | return NULL; |
| 2973 | DrawText(textBuf__in__, |
| 2974 | firstByte, |
| 2975 | byteCount); |
| 2976 | Py_INCREF(Py_None); |
| 2977 | _res = Py_None; |
| 2978 | textBuf__error__: ; |
| 2979 | return _res; |
| 2980 | } |
| 2981 | |
| 2982 | static PyObject *Qd_CharWidth(_self, _args) |
| 2983 | PyObject *_self; |
| 2984 | PyObject *_args; |
| 2985 | { |
| 2986 | PyObject *_res = NULL; |
| 2987 | short _rv; |
| 2988 | short ch; |
| 2989 | if (!PyArg_ParseTuple(_args, "h", |
| 2990 | &ch)) |
| 2991 | return NULL; |
| 2992 | _rv = CharWidth(ch); |
| 2993 | _res = Py_BuildValue("h", |
| 2994 | _rv); |
| 2995 | return _res; |
| 2996 | } |
| 2997 | |
| 2998 | static PyObject *Qd_StringWidth(_self, _args) |
| 2999 | PyObject *_self; |
| 3000 | PyObject *_args; |
| 3001 | { |
| 3002 | PyObject *_res = NULL; |
| 3003 | short _rv; |
| 3004 | Str255 s; |
| 3005 | if (!PyArg_ParseTuple(_args, "O&", |
| 3006 | PyMac_GetStr255, s)) |
| 3007 | return NULL; |
| 3008 | _rv = StringWidth(s); |
| 3009 | _res = Py_BuildValue("h", |
| 3010 | _rv); |
| 3011 | return _res; |
| 3012 | } |
| 3013 | |
| 3014 | static PyObject *Qd_TextWidth(_self, _args) |
| 3015 | PyObject *_self; |
| 3016 | PyObject *_args; |
| 3017 | { |
| 3018 | PyObject *_res = NULL; |
| 3019 | short _rv; |
| 3020 | char *textBuf__in__; |
| 3021 | int textBuf__len__; |
| 3022 | int textBuf__in_len__; |
| 3023 | short firstByte; |
| 3024 | short byteCount; |
| 3025 | if (!PyArg_ParseTuple(_args, "s#hh", |
| 3026 | &textBuf__in__, &textBuf__in_len__, |
| 3027 | &firstByte, |
| 3028 | &byteCount)) |
| 3029 | return NULL; |
| 3030 | _rv = TextWidth(textBuf__in__, |
| 3031 | firstByte, |
| 3032 | byteCount); |
| 3033 | _res = Py_BuildValue("h", |
| 3034 | _rv); |
| 3035 | textBuf__error__: ; |
| 3036 | return _res; |
| 3037 | } |
| 3038 | |
| 3039 | static PyObject *Qd_CharExtra(_self, _args) |
| 3040 | PyObject *_self; |
| 3041 | PyObject *_args; |
| 3042 | { |
| 3043 | PyObject *_res = NULL; |
Jack Jansen | 330381c | 1995-11-15 15:18:01 +0000 | [diff] [blame] | 3044 | Fixed extra; |
| 3045 | if (!PyArg_ParseTuple(_args, "O&", |
| 3046 | PyMac_GetFixed, &extra)) |
Jack Jansen | b81cf9d | 1995-06-06 13:08:40 +0000 | [diff] [blame] | 3047 | return NULL; |
| 3048 | CharExtra(extra); |
| 3049 | Py_INCREF(Py_None); |
| 3050 | _res = Py_None; |
| 3051 | return _res; |
| 3052 | } |
| 3053 | |
Jack Jansen | 41058c0 | 1995-11-16 22:48:29 +0000 | [diff] [blame] | 3054 | static PyObject *Qd_BitMap(_self, _args) |
| 3055 | PyObject *_self; |
| 3056 | PyObject *_args; |
| 3057 | { |
| 3058 | PyObject *_res = NULL; |
| 3059 | |
| 3060 | BitMap *ptr; |
| 3061 | PyObject *source; |
| 3062 | Rect bounds; |
| 3063 | int rowbytes; |
| 3064 | char *data; |
| 3065 | |
| 3066 | if ( !PyArg_ParseTuple(_args, "O!iO&", &PyString_Type, &source, &rowbytes, PyMac_GetRect, |
| 3067 | &bounds) ) |
| 3068 | return NULL; |
| 3069 | data = PyString_AsString(source); |
| 3070 | if ((ptr=(BitMap *)malloc(sizeof(BitMap))) == NULL ) |
| 3071 | return PyErr_NoMemory(); |
| 3072 | ptr->baseAddr = (Ptr)data; |
| 3073 | ptr->rowBytes = rowbytes; |
| 3074 | ptr->bounds = bounds; |
| 3075 | if ( (_res = BMObj_New(ptr)) == NULL ) { |
| 3076 | free(ptr); |
| 3077 | return NULL; |
| 3078 | } |
| 3079 | ((BitMapObject *)_res)->referred_object = source; |
| 3080 | Py_INCREF(source); |
| 3081 | ((BitMapObject *)_res)->referred_bitmap = ptr; |
| 3082 | return _res; |
| 3083 | |
| 3084 | } |
| 3085 | |
Jack Jansen | 425e9eb | 1995-12-12 15:02:03 +0000 | [diff] [blame^] | 3086 | static PyObject *Qd_RawBitMap(_self, _args) |
| 3087 | PyObject *_self; |
| 3088 | PyObject *_args; |
| 3089 | { |
| 3090 | PyObject *_res = NULL; |
| 3091 | |
| 3092 | BitMap *ptr; |
| 3093 | PyObject *source; |
| 3094 | |
| 3095 | if ( !PyArg_ParseTuple(_args, "O!", &PyString_Type, &source) ) |
| 3096 | return NULL; |
| 3097 | if ( PyString_Size(source) != sizeof(BitMap) && PyString_Size(source) != sizeof(PixMap) ) { |
| 3098 | PyErr_BadArgument(); |
| 3099 | return NULL; |
| 3100 | } |
| 3101 | ptr = (BitMapPtr)PyString_AsString(source); |
| 3102 | if ( (_res = BMObj_New(ptr)) == NULL ) { |
| 3103 | return NULL; |
| 3104 | } |
| 3105 | ((BitMapObject *)_res)->referred_object = source; |
| 3106 | Py_INCREF(source); |
| 3107 | return _res; |
| 3108 | |
| 3109 | } |
| 3110 | |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 3111 | static PyMethodDef Qd_methods[] = { |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 3112 | {"SetPort", (PyCFunction)Qd_SetPort, 1, |
Jack Jansen | 330381c | 1995-11-15 15:18:01 +0000 | [diff] [blame] | 3113 | "(GrafPtr port) -> None"}, |
Guido van Rossum | e56db43 | 1995-03-19 22:49:50 +0000 | [diff] [blame] | 3114 | {"GetPort", (PyCFunction)Qd_GetPort, 1, |
Jack Jansen | 330381c | 1995-11-15 15:18:01 +0000 | [diff] [blame] | 3115 | "() -> (GrafPtr port)"}, |
Guido van Rossum | e56db43 | 1995-03-19 22:49:50 +0000 | [diff] [blame] | 3116 | {"GrafDevice", (PyCFunction)Qd_GrafDevice, 1, |
| 3117 | "(short device) -> None"}, |
Jack Jansen | 41058c0 | 1995-11-16 22:48:29 +0000 | [diff] [blame] | 3118 | {"SetPortBits", (PyCFunction)Qd_SetPortBits, 1, |
| 3119 | "(BitMapPtr bm) -> None"}, |
Guido van Rossum | e56db43 | 1995-03-19 22:49:50 +0000 | [diff] [blame] | 3120 | {"PortSize", (PyCFunction)Qd_PortSize, 1, |
| 3121 | "(short width, short height) -> None"}, |
| 3122 | {"MovePortTo", (PyCFunction)Qd_MovePortTo, 1, |
| 3123 | "(short leftGlobal, short topGlobal) -> None"}, |
| 3124 | {"SetOrigin", (PyCFunction)Qd_SetOrigin, 1, |
| 3125 | "(short h, short v) -> None"}, |
| 3126 | {"SetClip", (PyCFunction)Qd_SetClip, 1, |
| 3127 | "(RgnHandle rgn) -> None"}, |
| 3128 | {"GetClip", (PyCFunction)Qd_GetClip, 1, |
| 3129 | "(RgnHandle rgn) -> None"}, |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 3130 | {"ClipRect", (PyCFunction)Qd_ClipRect, 1, |
| 3131 | "(Rect r) -> None"}, |
Guido van Rossum | e56db43 | 1995-03-19 22:49:50 +0000 | [diff] [blame] | 3132 | {"InitCursor", (PyCFunction)Qd_InitCursor, 1, |
| 3133 | "() -> None"}, |
| 3134 | {"HideCursor", (PyCFunction)Qd_HideCursor, 1, |
| 3135 | "() -> None"}, |
| 3136 | {"ShowCursor", (PyCFunction)Qd_ShowCursor, 1, |
| 3137 | "() -> None"}, |
| 3138 | {"ObscureCursor", (PyCFunction)Qd_ObscureCursor, 1, |
| 3139 | "() -> None"}, |
| 3140 | {"HidePen", (PyCFunction)Qd_HidePen, 1, |
| 3141 | "() -> None"}, |
| 3142 | {"ShowPen", (PyCFunction)Qd_ShowPen, 1, |
| 3143 | "() -> None"}, |
| 3144 | {"GetPen", (PyCFunction)Qd_GetPen, 1, |
| 3145 | "(Point pt) -> (Point pt)"}, |
| 3146 | {"PenSize", (PyCFunction)Qd_PenSize, 1, |
| 3147 | "(short width, short height) -> None"}, |
| 3148 | {"PenMode", (PyCFunction)Qd_PenMode, 1, |
| 3149 | "(short mode) -> None"}, |
| 3150 | {"PenNormal", (PyCFunction)Qd_PenNormal, 1, |
| 3151 | "() -> None"}, |
| 3152 | {"MoveTo", (PyCFunction)Qd_MoveTo, 1, |
| 3153 | "(short h, short v) -> None"}, |
| 3154 | {"Move", (PyCFunction)Qd_Move, 1, |
| 3155 | "(short dh, short dv) -> None"}, |
| 3156 | {"LineTo", (PyCFunction)Qd_LineTo, 1, |
| 3157 | "(short h, short v) -> None"}, |
| 3158 | {"Line", (PyCFunction)Qd_Line, 1, |
| 3159 | "(short dh, short dv) -> None"}, |
Guido van Rossum | e56db43 | 1995-03-19 22:49:50 +0000 | [diff] [blame] | 3160 | {"ForeColor", (PyCFunction)Qd_ForeColor, 1, |
| 3161 | "(long color) -> None"}, |
| 3162 | {"BackColor", (PyCFunction)Qd_BackColor, 1, |
| 3163 | "(long color) -> None"}, |
| 3164 | {"ColorBit", (PyCFunction)Qd_ColorBit, 1, |
| 3165 | "(short whichBit) -> None"}, |
| 3166 | {"SetRect", (PyCFunction)Qd_SetRect, 1, |
| 3167 | "(short left, short top, short right, short bottom) -> (Rect r)"}, |
| 3168 | {"OffsetRect", (PyCFunction)Qd_OffsetRect, 1, |
Jack Jansen | 54c8f7e | 1995-11-14 10:46:01 +0000 | [diff] [blame] | 3169 | "(Rect r, short dh, short dv) -> (Rect r)"}, |
Guido van Rossum | e56db43 | 1995-03-19 22:49:50 +0000 | [diff] [blame] | 3170 | {"InsetRect", (PyCFunction)Qd_InsetRect, 1, |
Jack Jansen | 54c8f7e | 1995-11-14 10:46:01 +0000 | [diff] [blame] | 3171 | "(Rect r, short dh, short dv) -> (Rect r)"}, |
Guido van Rossum | e56db43 | 1995-03-19 22:49:50 +0000 | [diff] [blame] | 3172 | {"SectRect", (PyCFunction)Qd_SectRect, 1, |
| 3173 | "(Rect src1, Rect src2) -> (Boolean _rv, Rect dstRect)"}, |
| 3174 | {"UnionRect", (PyCFunction)Qd_UnionRect, 1, |
| 3175 | "(Rect src1, Rect src2) -> (Rect dstRect)"}, |
| 3176 | {"EqualRect", (PyCFunction)Qd_EqualRect, 1, |
| 3177 | "(Rect rect1, Rect rect2) -> (Boolean _rv)"}, |
| 3178 | {"EmptyRect", (PyCFunction)Qd_EmptyRect, 1, |
| 3179 | "(Rect r) -> (Boolean _rv)"}, |
| 3180 | {"FrameRect", (PyCFunction)Qd_FrameRect, 1, |
| 3181 | "(Rect r) -> None"}, |
| 3182 | {"PaintRect", (PyCFunction)Qd_PaintRect, 1, |
| 3183 | "(Rect r) -> None"}, |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 3184 | {"EraseRect", (PyCFunction)Qd_EraseRect, 1, |
| 3185 | "(Rect r) -> None"}, |
Guido van Rossum | e56db43 | 1995-03-19 22:49:50 +0000 | [diff] [blame] | 3186 | {"InvertRect", (PyCFunction)Qd_InvertRect, 1, |
| 3187 | "(Rect r) -> None"}, |
| 3188 | {"FrameOval", (PyCFunction)Qd_FrameOval, 1, |
| 3189 | "(Rect r) -> None"}, |
| 3190 | {"PaintOval", (PyCFunction)Qd_PaintOval, 1, |
| 3191 | "(Rect r) -> None"}, |
| 3192 | {"EraseOval", (PyCFunction)Qd_EraseOval, 1, |
| 3193 | "(Rect r) -> None"}, |
| 3194 | {"InvertOval", (PyCFunction)Qd_InvertOval, 1, |
| 3195 | "(Rect r) -> None"}, |
| 3196 | {"FrameRoundRect", (PyCFunction)Qd_FrameRoundRect, 1, |
| 3197 | "(Rect r, short ovalWidth, short ovalHeight) -> None"}, |
| 3198 | {"PaintRoundRect", (PyCFunction)Qd_PaintRoundRect, 1, |
| 3199 | "(Rect r, short ovalWidth, short ovalHeight) -> None"}, |
| 3200 | {"EraseRoundRect", (PyCFunction)Qd_EraseRoundRect, 1, |
| 3201 | "(Rect r, short ovalWidth, short ovalHeight) -> None"}, |
| 3202 | {"InvertRoundRect", (PyCFunction)Qd_InvertRoundRect, 1, |
| 3203 | "(Rect r, short ovalWidth, short ovalHeight) -> None"}, |
| 3204 | {"FrameArc", (PyCFunction)Qd_FrameArc, 1, |
| 3205 | "(Rect r, short startAngle, short arcAngle) -> None"}, |
| 3206 | {"PaintArc", (PyCFunction)Qd_PaintArc, 1, |
| 3207 | "(Rect r, short startAngle, short arcAngle) -> None"}, |
| 3208 | {"EraseArc", (PyCFunction)Qd_EraseArc, 1, |
| 3209 | "(Rect r, short startAngle, short arcAngle) -> None"}, |
| 3210 | {"InvertArc", (PyCFunction)Qd_InvertArc, 1, |
| 3211 | "(Rect r, short startAngle, short arcAngle) -> None"}, |
| 3212 | {"NewRgn", (PyCFunction)Qd_NewRgn, 1, |
| 3213 | "() -> (RgnHandle _rv)"}, |
| 3214 | {"OpenRgn", (PyCFunction)Qd_OpenRgn, 1, |
| 3215 | "() -> None"}, |
| 3216 | {"CloseRgn", (PyCFunction)Qd_CloseRgn, 1, |
| 3217 | "(RgnHandle dstRgn) -> None"}, |
Jack Jansen | 41058c0 | 1995-11-16 22:48:29 +0000 | [diff] [blame] | 3218 | {"BitMapToRegion", (PyCFunction)Qd_BitMapToRegion, 1, |
| 3219 | "(RgnHandle region, BitMapPtr bMap) -> None"}, |
Guido van Rossum | e56db43 | 1995-03-19 22:49:50 +0000 | [diff] [blame] | 3220 | {"DisposeRgn", (PyCFunction)Qd_DisposeRgn, 1, |
| 3221 | "(RgnHandle rgn) -> None"}, |
| 3222 | {"CopyRgn", (PyCFunction)Qd_CopyRgn, 1, |
| 3223 | "(RgnHandle srcRgn, RgnHandle dstRgn) -> None"}, |
| 3224 | {"SetEmptyRgn", (PyCFunction)Qd_SetEmptyRgn, 1, |
| 3225 | "(RgnHandle rgn) -> None"}, |
| 3226 | {"SetRectRgn", (PyCFunction)Qd_SetRectRgn, 1, |
| 3227 | "(RgnHandle rgn, short left, short top, short right, short bottom) -> None"}, |
| 3228 | {"RectRgn", (PyCFunction)Qd_RectRgn, 1, |
| 3229 | "(RgnHandle rgn, Rect r) -> None"}, |
| 3230 | {"OffsetRgn", (PyCFunction)Qd_OffsetRgn, 1, |
| 3231 | "(RgnHandle rgn, short dh, short dv) -> None"}, |
| 3232 | {"InsetRgn", (PyCFunction)Qd_InsetRgn, 1, |
| 3233 | "(RgnHandle rgn, short dh, short dv) -> None"}, |
| 3234 | {"SectRgn", (PyCFunction)Qd_SectRgn, 1, |
| 3235 | "(RgnHandle srcRgnA, RgnHandle srcRgnB, RgnHandle dstRgn) -> None"}, |
| 3236 | {"UnionRgn", (PyCFunction)Qd_UnionRgn, 1, |
| 3237 | "(RgnHandle srcRgnA, RgnHandle srcRgnB, RgnHandle dstRgn) -> None"}, |
| 3238 | {"DiffRgn", (PyCFunction)Qd_DiffRgn, 1, |
| 3239 | "(RgnHandle srcRgnA, RgnHandle srcRgnB, RgnHandle dstRgn) -> None"}, |
| 3240 | {"XorRgn", (PyCFunction)Qd_XorRgn, 1, |
| 3241 | "(RgnHandle srcRgnA, RgnHandle srcRgnB, RgnHandle dstRgn) -> None"}, |
| 3242 | {"RectInRgn", (PyCFunction)Qd_RectInRgn, 1, |
| 3243 | "(Rect r, RgnHandle rgn) -> (Boolean _rv)"}, |
| 3244 | {"EqualRgn", (PyCFunction)Qd_EqualRgn, 1, |
| 3245 | "(RgnHandle rgnA, RgnHandle rgnB) -> (Boolean _rv)"}, |
| 3246 | {"EmptyRgn", (PyCFunction)Qd_EmptyRgn, 1, |
| 3247 | "(RgnHandle rgn) -> (Boolean _rv)"}, |
| 3248 | {"FrameRgn", (PyCFunction)Qd_FrameRgn, 1, |
| 3249 | "(RgnHandle rgn) -> None"}, |
| 3250 | {"PaintRgn", (PyCFunction)Qd_PaintRgn, 1, |
| 3251 | "(RgnHandle rgn) -> None"}, |
| 3252 | {"EraseRgn", (PyCFunction)Qd_EraseRgn, 1, |
| 3253 | "(RgnHandle rgn) -> None"}, |
| 3254 | {"InvertRgn", (PyCFunction)Qd_InvertRgn, 1, |
| 3255 | "(RgnHandle rgn) -> None"}, |
| 3256 | {"ScrollRect", (PyCFunction)Qd_ScrollRect, 1, |
| 3257 | "(Rect r, short dh, short dv, RgnHandle updateRgn) -> None"}, |
Jack Jansen | 41058c0 | 1995-11-16 22:48:29 +0000 | [diff] [blame] | 3258 | {"CopyBits", (PyCFunction)Qd_CopyBits, 1, |
| 3259 | "(BitMapPtr srcBits, BitMapPtr dstBits, Rect srcRect, Rect dstRect, short mode, RgnHandle maskRgn) -> None"}, |
| 3260 | {"CopyMask", (PyCFunction)Qd_CopyMask, 1, |
| 3261 | "(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] | 3262 | {"OpenPicture", (PyCFunction)Qd_OpenPicture, 1, |
| 3263 | "(Rect picFrame) -> (PicHandle _rv)"}, |
| 3264 | {"PicComment", (PyCFunction)Qd_PicComment, 1, |
| 3265 | "(short kind, short dataSize, Handle dataHandle) -> None"}, |
| 3266 | {"ClosePicture", (PyCFunction)Qd_ClosePicture, 1, |
| 3267 | "() -> None"}, |
| 3268 | {"DrawPicture", (PyCFunction)Qd_DrawPicture, 1, |
| 3269 | "(PicHandle myPicture, Rect dstRect) -> None"}, |
| 3270 | {"KillPicture", (PyCFunction)Qd_KillPicture, 1, |
| 3271 | "(PicHandle myPicture) -> None"}, |
| 3272 | {"OpenPoly", (PyCFunction)Qd_OpenPoly, 1, |
| 3273 | "() -> (PolyHandle _rv)"}, |
| 3274 | {"ClosePoly", (PyCFunction)Qd_ClosePoly, 1, |
| 3275 | "() -> None"}, |
| 3276 | {"KillPoly", (PyCFunction)Qd_KillPoly, 1, |
| 3277 | "(PolyHandle poly) -> None"}, |
| 3278 | {"OffsetPoly", (PyCFunction)Qd_OffsetPoly, 1, |
| 3279 | "(PolyHandle poly, short dh, short dv) -> None"}, |
| 3280 | {"FramePoly", (PyCFunction)Qd_FramePoly, 1, |
| 3281 | "(PolyHandle poly) -> None"}, |
| 3282 | {"PaintPoly", (PyCFunction)Qd_PaintPoly, 1, |
| 3283 | "(PolyHandle poly) -> None"}, |
| 3284 | {"ErasePoly", (PyCFunction)Qd_ErasePoly, 1, |
| 3285 | "(PolyHandle poly) -> None"}, |
| 3286 | {"InvertPoly", (PyCFunction)Qd_InvertPoly, 1, |
| 3287 | "(PolyHandle poly) -> None"}, |
| 3288 | {"SetPt", (PyCFunction)Qd_SetPt, 1, |
| 3289 | "(Point pt, short h, short v) -> (Point pt)"}, |
| 3290 | {"LocalToGlobal", (PyCFunction)Qd_LocalToGlobal, 1, |
| 3291 | "(Point pt) -> (Point pt)"}, |
| 3292 | {"GlobalToLocal", (PyCFunction)Qd_GlobalToLocal, 1, |
| 3293 | "(Point pt) -> (Point pt)"}, |
| 3294 | {"Random", (PyCFunction)Qd_Random, 1, |
| 3295 | "() -> (short _rv)"}, |
| 3296 | {"GetPixel", (PyCFunction)Qd_GetPixel, 1, |
| 3297 | "(short h, short v) -> (Boolean _rv)"}, |
| 3298 | {"ScalePt", (PyCFunction)Qd_ScalePt, 1, |
| 3299 | "(Point pt, Rect srcRect, Rect dstRect) -> (Point pt)"}, |
| 3300 | {"MapPt", (PyCFunction)Qd_MapPt, 1, |
| 3301 | "(Point pt, Rect srcRect, Rect dstRect) -> (Point pt)"}, |
| 3302 | {"MapRect", (PyCFunction)Qd_MapRect, 1, |
Jack Jansen | 54c8f7e | 1995-11-14 10:46:01 +0000 | [diff] [blame] | 3303 | "(Rect r, Rect srcRect, Rect dstRect) -> (Rect r)"}, |
Guido van Rossum | e56db43 | 1995-03-19 22:49:50 +0000 | [diff] [blame] | 3304 | {"MapRgn", (PyCFunction)Qd_MapRgn, 1, |
| 3305 | "(RgnHandle rgn, Rect srcRect, Rect dstRect) -> None"}, |
| 3306 | {"MapPoly", (PyCFunction)Qd_MapPoly, 1, |
| 3307 | "(PolyHandle poly, Rect srcRect, Rect dstRect) -> None"}, |
Jack Jansen | 41058c0 | 1995-11-16 22:48:29 +0000 | [diff] [blame] | 3308 | {"StdBits", (PyCFunction)Qd_StdBits, 1, |
| 3309 | "(BitMapPtr srcBits, Rect srcRect, Rect dstRect, short mode, RgnHandle maskRgn) -> None"}, |
Guido van Rossum | e56db43 | 1995-03-19 22:49:50 +0000 | [diff] [blame] | 3310 | {"AddPt", (PyCFunction)Qd_AddPt, 1, |
| 3311 | "(Point src, Point dst) -> (Point dst)"}, |
| 3312 | {"EqualPt", (PyCFunction)Qd_EqualPt, 1, |
| 3313 | "(Point pt1, Point pt2) -> (Boolean _rv)"}, |
| 3314 | {"PtInRect", (PyCFunction)Qd_PtInRect, 1, |
| 3315 | "(Point pt, Rect r) -> (Boolean _rv)"}, |
| 3316 | {"Pt2Rect", (PyCFunction)Qd_Pt2Rect, 1, |
| 3317 | "(Point pt1, Point pt2) -> (Rect dstRect)"}, |
| 3318 | {"PtToAngle", (PyCFunction)Qd_PtToAngle, 1, |
| 3319 | "(Rect r, Point pt) -> (short angle)"}, |
Jack Jansen | b81cf9d | 1995-06-06 13:08:40 +0000 | [diff] [blame] | 3320 | {"SubPt", (PyCFunction)Qd_SubPt, 1, |
| 3321 | "(Point src, Point dst) -> (Point dst)"}, |
Guido van Rossum | e56db43 | 1995-03-19 22:49:50 +0000 | [diff] [blame] | 3322 | {"PtInRgn", (PyCFunction)Qd_PtInRgn, 1, |
| 3323 | "(Point pt, RgnHandle rgn) -> (Boolean _rv)"}, |
| 3324 | {"NewPixMap", (PyCFunction)Qd_NewPixMap, 1, |
| 3325 | "() -> (PixMapHandle _rv)"}, |
Guido van Rossum | e56db43 | 1995-03-19 22:49:50 +0000 | [diff] [blame] | 3326 | {"DisposePixMap", (PyCFunction)Qd_DisposePixMap, 1, |
| 3327 | "(PixMapHandle pm) -> None"}, |
| 3328 | {"CopyPixMap", (PyCFunction)Qd_CopyPixMap, 1, |
| 3329 | "(PixMapHandle srcPM, PixMapHandle dstPM) -> None"}, |
| 3330 | {"NewPixPat", (PyCFunction)Qd_NewPixPat, 1, |
| 3331 | "() -> (PixPatHandle _rv)"}, |
Guido van Rossum | e56db43 | 1995-03-19 22:49:50 +0000 | [diff] [blame] | 3332 | {"DisposePixPat", (PyCFunction)Qd_DisposePixPat, 1, |
| 3333 | "(PixPatHandle pp) -> None"}, |
| 3334 | {"CopyPixPat", (PyCFunction)Qd_CopyPixPat, 1, |
| 3335 | "(PixPatHandle srcPP, PixPatHandle dstPP) -> None"}, |
| 3336 | {"PenPixPat", (PyCFunction)Qd_PenPixPat, 1, |
| 3337 | "(PixPatHandle pp) -> None"}, |
| 3338 | {"BackPixPat", (PyCFunction)Qd_BackPixPat, 1, |
| 3339 | "(PixPatHandle pp) -> None"}, |
| 3340 | {"GetPixPat", (PyCFunction)Qd_GetPixPat, 1, |
| 3341 | "(short patID) -> (PixPatHandle _rv)"}, |
Jack Jansen | 232f3cd | 1995-12-09 14:04:31 +0000 | [diff] [blame] | 3342 | {"MakeRGBPat", (PyCFunction)Qd_MakeRGBPat, 1, |
| 3343 | "(PixPatHandle pp, RGBColor myColor) -> None"}, |
Guido van Rossum | e56db43 | 1995-03-19 22:49:50 +0000 | [diff] [blame] | 3344 | {"FillCRect", (PyCFunction)Qd_FillCRect, 1, |
| 3345 | "(Rect r, PixPatHandle pp) -> None"}, |
| 3346 | {"FillCOval", (PyCFunction)Qd_FillCOval, 1, |
| 3347 | "(Rect r, PixPatHandle pp) -> None"}, |
| 3348 | {"FillCRoundRect", (PyCFunction)Qd_FillCRoundRect, 1, |
| 3349 | "(Rect r, short ovalWidth, short ovalHeight, PixPatHandle pp) -> None"}, |
| 3350 | {"FillCArc", (PyCFunction)Qd_FillCArc, 1, |
| 3351 | "(Rect r, short startAngle, short arcAngle, PixPatHandle pp) -> None"}, |
| 3352 | {"FillCRgn", (PyCFunction)Qd_FillCRgn, 1, |
| 3353 | "(RgnHandle rgn, PixPatHandle pp) -> None"}, |
| 3354 | {"FillCPoly", (PyCFunction)Qd_FillCPoly, 1, |
| 3355 | "(PolyHandle poly, PixPatHandle pp) -> None"}, |
Jack Jansen | 232f3cd | 1995-12-09 14:04:31 +0000 | [diff] [blame] | 3356 | {"RGBForeColor", (PyCFunction)Qd_RGBForeColor, 1, |
| 3357 | "(RGBColor color) -> None"}, |
| 3358 | {"RGBBackColor", (PyCFunction)Qd_RGBBackColor, 1, |
| 3359 | "(RGBColor color) -> None"}, |
| 3360 | {"SetCPixel", (PyCFunction)Qd_SetCPixel, 1, |
| 3361 | "(short h, short v, RGBColor cPix) -> None"}, |
Guido van Rossum | e56db43 | 1995-03-19 22:49:50 +0000 | [diff] [blame] | 3362 | {"SetPortPix", (PyCFunction)Qd_SetPortPix, 1, |
| 3363 | "(PixMapHandle pm) -> None"}, |
Jack Jansen | 232f3cd | 1995-12-09 14:04:31 +0000 | [diff] [blame] | 3364 | {"GetCPixel", (PyCFunction)Qd_GetCPixel, 1, |
| 3365 | "(short h, short v) -> (RGBColor cPix)"}, |
| 3366 | {"GetForeColor", (PyCFunction)Qd_GetForeColor, 1, |
| 3367 | "() -> (RGBColor color)"}, |
| 3368 | {"GetBackColor", (PyCFunction)Qd_GetBackColor, 1, |
| 3369 | "() -> (RGBColor color)"}, |
| 3370 | {"OpColor", (PyCFunction)Qd_OpColor, 1, |
| 3371 | "(RGBColor color) -> None"}, |
| 3372 | {"HiliteColor", (PyCFunction)Qd_HiliteColor, 1, |
| 3373 | "(RGBColor color) -> None"}, |
Guido van Rossum | e56db43 | 1995-03-19 22:49:50 +0000 | [diff] [blame] | 3374 | {"AllocCursor", (PyCFunction)Qd_AllocCursor, 1, |
| 3375 | "() -> None"}, |
Guido van Rossum | e56db43 | 1995-03-19 22:49:50 +0000 | [diff] [blame] | 3376 | {"GetCTSeed", (PyCFunction)Qd_GetCTSeed, 1, |
| 3377 | "() -> (long _rv)"}, |
Jack Jansen | 232f3cd | 1995-12-09 14:04:31 +0000 | [diff] [blame] | 3378 | {"Color2Index", (PyCFunction)Qd_Color2Index, 1, |
| 3379 | "(RGBColor myColor) -> (long _rv)"}, |
| 3380 | {"Index2Color", (PyCFunction)Qd_Index2Color, 1, |
| 3381 | "(long index) -> (RGBColor aColor)"}, |
| 3382 | {"InvertColor", (PyCFunction)Qd_InvertColor, 1, |
| 3383 | "() -> (RGBColor myColor)"}, |
| 3384 | {"RealColor", (PyCFunction)Qd_RealColor, 1, |
| 3385 | "(RGBColor color) -> (Boolean _rv)"}, |
Guido van Rossum | e56db43 | 1995-03-19 22:49:50 +0000 | [diff] [blame] | 3386 | {"SetClientID", (PyCFunction)Qd_SetClientID, 1, |
| 3387 | "(short id) -> None"}, |
| 3388 | {"ProtectEntry", (PyCFunction)Qd_ProtectEntry, 1, |
| 3389 | "(short index, Boolean protect) -> None"}, |
| 3390 | {"ReserveEntry", (PyCFunction)Qd_ReserveEntry, 1, |
| 3391 | "(short index, Boolean reserve) -> None"}, |
| 3392 | {"QDError", (PyCFunction)Qd_QDError, 1, |
| 3393 | "() -> (short _rv)"}, |
Jack Jansen | 41058c0 | 1995-11-16 22:48:29 +0000 | [diff] [blame] | 3394 | {"CopyDeepMask", (PyCFunction)Qd_CopyDeepMask, 1, |
| 3395 | "(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] | 3396 | {"GetPattern", (PyCFunction)Qd_GetPattern, 1, |
| 3397 | "(short patternID) -> (PatHandle _rv)"}, |
| 3398 | {"GetCursor", (PyCFunction)Qd_GetCursor, 1, |
| 3399 | "(short cursorID) -> (CursHandle _rv)"}, |
| 3400 | {"GetPicture", (PyCFunction)Qd_GetPicture, 1, |
| 3401 | "(short pictureID) -> (PicHandle _rv)"}, |
| 3402 | {"DeltaPoint", (PyCFunction)Qd_DeltaPoint, 1, |
| 3403 | "(Point ptA, Point ptB) -> (long _rv)"}, |
| 3404 | {"ShieldCursor", (PyCFunction)Qd_ShieldCursor, 1, |
| 3405 | "(Rect shieldRect, Point offsetPt) -> None"}, |
| 3406 | {"ScreenRes", (PyCFunction)Qd_ScreenRes, 1, |
| 3407 | "() -> (short scrnHRes, short scrnVRes)"}, |
Jack Jansen | b81cf9d | 1995-06-06 13:08:40 +0000 | [diff] [blame] | 3408 | {"TextFont", (PyCFunction)Qd_TextFont, 1, |
| 3409 | "(short font) -> None"}, |
| 3410 | {"TextFace", (PyCFunction)Qd_TextFace, 1, |
| 3411 | "(short face) -> None"}, |
| 3412 | {"TextMode", (PyCFunction)Qd_TextMode, 1, |
| 3413 | "(short mode) -> None"}, |
| 3414 | {"TextSize", (PyCFunction)Qd_TextSize, 1, |
| 3415 | "(short size) -> None"}, |
| 3416 | {"SpaceExtra", (PyCFunction)Qd_SpaceExtra, 1, |
Jack Jansen | 330381c | 1995-11-15 15:18:01 +0000 | [diff] [blame] | 3417 | "(Fixed extra) -> None"}, |
Jack Jansen | b81cf9d | 1995-06-06 13:08:40 +0000 | [diff] [blame] | 3418 | {"DrawChar", (PyCFunction)Qd_DrawChar, 1, |
| 3419 | "(short ch) -> None"}, |
| 3420 | {"DrawString", (PyCFunction)Qd_DrawString, 1, |
| 3421 | "(Str255 s) -> None"}, |
| 3422 | {"DrawText", (PyCFunction)Qd_DrawText, 1, |
| 3423 | "(Buffer textBuf, short firstByte, short byteCount) -> None"}, |
| 3424 | {"CharWidth", (PyCFunction)Qd_CharWidth, 1, |
| 3425 | "(short ch) -> (short _rv)"}, |
| 3426 | {"StringWidth", (PyCFunction)Qd_StringWidth, 1, |
| 3427 | "(Str255 s) -> (short _rv)"}, |
| 3428 | {"TextWidth", (PyCFunction)Qd_TextWidth, 1, |
| 3429 | "(Buffer textBuf, short firstByte, short byteCount) -> (short _rv)"}, |
| 3430 | {"CharExtra", (PyCFunction)Qd_CharExtra, 1, |
Jack Jansen | 330381c | 1995-11-15 15:18:01 +0000 | [diff] [blame] | 3431 | "(Fixed extra) -> None"}, |
Jack Jansen | 41058c0 | 1995-11-16 22:48:29 +0000 | [diff] [blame] | 3432 | {"BitMap", (PyCFunction)Qd_BitMap, 1, |
| 3433 | "Take (string, int, Rect) argument and create BitMap"}, |
Jack Jansen | 425e9eb | 1995-12-12 15:02:03 +0000 | [diff] [blame^] | 3434 | {"RawBitMap", (PyCFunction)Qd_RawBitMap, 1, |
| 3435 | "Take string BitMap and turn into BitMap object"}, |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 3436 | {NULL, NULL, 0} |
| 3437 | }; |
| 3438 | |
| 3439 | |
| 3440 | |
| 3441 | |
| 3442 | void initQd() |
| 3443 | { |
| 3444 | PyObject *m; |
| 3445 | PyObject *d; |
| 3446 | |
| 3447 | |
| 3448 | |
| 3449 | |
| 3450 | m = Py_InitModule("Qd", Qd_methods); |
| 3451 | d = PyModule_GetDict(m); |
| 3452 | Qd_Error = PyMac_GetOSErrException(); |
| 3453 | if (Qd_Error == NULL || |
| 3454 | PyDict_SetItemString(d, "Error", Qd_Error) != 0) |
| 3455 | Py_FatalError("can't initialize Qd.Error"); |
| 3456 | } |
| 3457 | |
| 3458 | /* ========================= End module Qd ========================== */ |
| 3459 | |