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