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