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