_make_boundary(): Fix for SF bug #745478, broken boundary calculation
[python/dscho.git] / Mac / Modules / qdoffs / _Qdoffsmodule.c
blob8d9f7efd0d0cdf4205299d0422c2cfec5839c5f0
2 /* ========================= Module _Qdoffs ========================= */
4 #include "Python.h"
8 #ifdef _WIN32
9 #include "pywintoolbox.h"
10 #else
11 #include "macglue.h"
12 #include "pymactoolbox.h"
13 #endif
15 /* Macro to test whether a weak-loaded CFM function exists */
16 #define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\
17 PyErr_SetString(PyExc_NotImplementedError, \
18 "Not available in this shared library/OS version"); \
19 return NULL; \
20 }} while(0)
23 #ifdef WITHOUT_FRAMEWORKS
24 #include <QDOffscreen.h>
25 #else
26 #include <Carbon/Carbon.h>
27 #endif
29 #ifdef USE_TOOLBOX_OBJECT_GLUE
30 extern PyObject *_GWorldObj_New(GWorldPtr);
31 extern int _GWorldObj_Convert(PyObject *, GWorldPtr *);
33 #define GWorldObj_New _GWorldObj_New
34 #define GWorldObj_Convert _GWorldObj_Convert
35 #endif
37 #define as_GrafPtr(gworld) ((GrafPtr)(gworld))
40 static PyObject *Qdoffs_Error;
42 /* ----------------------- Object type GWorld ----------------------- */
44 PyTypeObject GWorld_Type;
46 #define GWorldObj_Check(x) ((x)->ob_type == &GWorld_Type || PyObject_TypeCheck((x), &GWorld_Type))
48 typedef struct GWorldObject {
49 PyObject_HEAD
50 GWorldPtr ob_itself;
51 } GWorldObject;
53 PyObject *GWorldObj_New(GWorldPtr itself)
55 GWorldObject *it;
56 if (itself == NULL) return PyMac_Error(resNotFound);
57 it = PyObject_NEW(GWorldObject, &GWorld_Type);
58 if (it == NULL) return NULL;
59 it->ob_itself = itself;
60 return (PyObject *)it;
62 int GWorldObj_Convert(PyObject *v, GWorldPtr *p_itself)
64 if (!GWorldObj_Check(v))
66 PyErr_SetString(PyExc_TypeError, "GWorld required");
67 return 0;
69 *p_itself = ((GWorldObject *)v)->ob_itself;
70 return 1;
73 static void GWorldObj_dealloc(GWorldObject *self)
75 DisposeGWorld(self->ob_itself);
76 self->ob_type->tp_free((PyObject *)self);
79 static PyObject *GWorldObj_GetGWorldDevice(GWorldObject *_self, PyObject *_args)
81 PyObject *_res = NULL;
82 GDHandle _rv;
83 #ifndef GetGWorldDevice
84 PyMac_PRECHECK(GetGWorldDevice);
85 #endif
86 if (!PyArg_ParseTuple(_args, ""))
87 return NULL;
88 _rv = GetGWorldDevice(_self->ob_itself);
89 _res = Py_BuildValue("O&",
90 ResObj_New, _rv);
91 return _res;
94 static PyObject *GWorldObj_GetGWorldPixMap(GWorldObject *_self, PyObject *_args)
96 PyObject *_res = NULL;
97 PixMapHandle _rv;
98 #ifndef GetGWorldPixMap
99 PyMac_PRECHECK(GetGWorldPixMap);
100 #endif
101 if (!PyArg_ParseTuple(_args, ""))
102 return NULL;
103 _rv = GetGWorldPixMap(_self->ob_itself);
104 _res = Py_BuildValue("O&",
105 ResObj_New, _rv);
106 return _res;
109 static PyObject *GWorldObj_as_GrafPtr(GWorldObject *_self, PyObject *_args)
111 PyObject *_res = NULL;
112 GrafPtr _rv;
113 #ifndef as_GrafPtr
114 PyMac_PRECHECK(as_GrafPtr);
115 #endif
116 if (!PyArg_ParseTuple(_args, ""))
117 return NULL;
118 _rv = as_GrafPtr(_self->ob_itself);
119 _res = Py_BuildValue("O&",
120 GrafObj_New, _rv);
121 return _res;
124 static PyMethodDef GWorldObj_methods[] = {
125 {"GetGWorldDevice", (PyCFunction)GWorldObj_GetGWorldDevice, 1,
126 PyDoc_STR("() -> (GDHandle _rv)")},
127 {"GetGWorldPixMap", (PyCFunction)GWorldObj_GetGWorldPixMap, 1,
128 PyDoc_STR("() -> (PixMapHandle _rv)")},
129 {"as_GrafPtr", (PyCFunction)GWorldObj_as_GrafPtr, 1,
130 PyDoc_STR("() -> (GrafPtr _rv)")},
131 {NULL, NULL, 0}
134 #define GWorldObj_getsetlist NULL
137 #define GWorldObj_compare NULL
139 #define GWorldObj_repr NULL
141 #define GWorldObj_hash NULL
142 #define GWorldObj_tp_init 0
144 #define GWorldObj_tp_alloc PyType_GenericAlloc
146 static PyObject *GWorldObj_tp_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
148 PyObject *self;
149 GWorldPtr itself;
150 char *kw[] = {"itself", 0};
152 if (!PyArg_ParseTupleAndKeywords(args, kwds, "O&", kw, GWorldObj_Convert, &itself)) return NULL;
153 if ((self = type->tp_alloc(type, 0)) == NULL) return NULL;
154 ((GWorldObject *)self)->ob_itself = itself;
155 return self;
158 #define GWorldObj_tp_free PyObject_Del
161 PyTypeObject GWorld_Type = {
162 PyObject_HEAD_INIT(NULL)
163 0, /*ob_size*/
164 "_Qdoffs.GWorld", /*tp_name*/
165 sizeof(GWorldObject), /*tp_basicsize*/
166 0, /*tp_itemsize*/
167 /* methods */
168 (destructor) GWorldObj_dealloc, /*tp_dealloc*/
169 0, /*tp_print*/
170 (getattrfunc)0, /*tp_getattr*/
171 (setattrfunc)0, /*tp_setattr*/
172 (cmpfunc) GWorldObj_compare, /*tp_compare*/
173 (reprfunc) GWorldObj_repr, /*tp_repr*/
174 (PyNumberMethods *)0, /* tp_as_number */
175 (PySequenceMethods *)0, /* tp_as_sequence */
176 (PyMappingMethods *)0, /* tp_as_mapping */
177 (hashfunc) GWorldObj_hash, /*tp_hash*/
178 0, /*tp_call*/
179 0, /*tp_str*/
180 PyObject_GenericGetAttr, /*tp_getattro*/
181 PyObject_GenericSetAttr, /*tp_setattro */
182 0, /*tp_as_buffer*/
183 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /* tp_flags */
184 0, /*tp_doc*/
185 0, /*tp_traverse*/
186 0, /*tp_clear*/
187 0, /*tp_richcompare*/
188 0, /*tp_weaklistoffset*/
189 0, /*tp_iter*/
190 0, /*tp_iternext*/
191 GWorldObj_methods, /* tp_methods */
192 0, /*tp_members*/
193 GWorldObj_getsetlist, /*tp_getset*/
194 0, /*tp_base*/
195 0, /*tp_dict*/
196 0, /*tp_descr_get*/
197 0, /*tp_descr_set*/
198 0, /*tp_dictoffset*/
199 GWorldObj_tp_init, /* tp_init */
200 GWorldObj_tp_alloc, /* tp_alloc */
201 GWorldObj_tp_new, /* tp_new */
202 GWorldObj_tp_free, /* tp_free */
205 /* --------------------- End object type GWorld --------------------- */
208 static PyObject *Qdoffs_NewGWorld(PyObject *_self, PyObject *_args)
210 PyObject *_res = NULL;
211 QDErr _err;
212 GWorldPtr offscreenGWorld;
213 short PixelDepth;
214 Rect boundsRect;
215 CTabHandle cTable;
216 GDHandle aGDevice;
217 GWorldFlags flags;
218 #ifndef NewGWorld
219 PyMac_PRECHECK(NewGWorld);
220 #endif
221 if (!PyArg_ParseTuple(_args, "hO&O&O&l",
222 &PixelDepth,
223 PyMac_GetRect, &boundsRect,
224 OptResObj_Convert, &cTable,
225 OptResObj_Convert, &aGDevice,
226 &flags))
227 return NULL;
228 _err = NewGWorld(&offscreenGWorld,
229 PixelDepth,
230 &boundsRect,
231 cTable,
232 aGDevice,
233 flags);
234 if (_err != noErr) return PyMac_Error(_err);
235 _res = Py_BuildValue("O&",
236 GWorldObj_New, offscreenGWorld);
237 return _res;
240 static PyObject *Qdoffs_LockPixels(PyObject *_self, PyObject *_args)
242 PyObject *_res = NULL;
243 Boolean _rv;
244 PixMapHandle pm;
245 #ifndef LockPixels
246 PyMac_PRECHECK(LockPixels);
247 #endif
248 if (!PyArg_ParseTuple(_args, "O&",
249 ResObj_Convert, &pm))
250 return NULL;
251 _rv = LockPixels(pm);
252 _res = Py_BuildValue("b",
253 _rv);
254 return _res;
257 static PyObject *Qdoffs_UnlockPixels(PyObject *_self, PyObject *_args)
259 PyObject *_res = NULL;
260 PixMapHandle pm;
261 #ifndef UnlockPixels
262 PyMac_PRECHECK(UnlockPixels);
263 #endif
264 if (!PyArg_ParseTuple(_args, "O&",
265 ResObj_Convert, &pm))
266 return NULL;
267 UnlockPixels(pm);
268 Py_INCREF(Py_None);
269 _res = Py_None;
270 return _res;
273 static PyObject *Qdoffs_UpdateGWorld(PyObject *_self, PyObject *_args)
275 PyObject *_res = NULL;
276 GWorldFlags _rv;
277 GWorldPtr offscreenGWorld;
278 short pixelDepth;
279 Rect boundsRect;
280 CTabHandle cTable;
281 GDHandle aGDevice;
282 GWorldFlags flags;
283 #ifndef UpdateGWorld
284 PyMac_PRECHECK(UpdateGWorld);
285 #endif
286 if (!PyArg_ParseTuple(_args, "hO&O&O&l",
287 &pixelDepth,
288 PyMac_GetRect, &boundsRect,
289 OptResObj_Convert, &cTable,
290 OptResObj_Convert, &aGDevice,
291 &flags))
292 return NULL;
293 _rv = UpdateGWorld(&offscreenGWorld,
294 pixelDepth,
295 &boundsRect,
296 cTable,
297 aGDevice,
298 flags);
299 _res = Py_BuildValue("lO&",
300 _rv,
301 GWorldObj_New, offscreenGWorld);
302 return _res;
305 static PyObject *Qdoffs_GetGWorld(PyObject *_self, PyObject *_args)
307 PyObject *_res = NULL;
308 CGrafPtr port;
309 GDHandle gdh;
310 #ifndef GetGWorld
311 PyMac_PRECHECK(GetGWorld);
312 #endif
313 if (!PyArg_ParseTuple(_args, ""))
314 return NULL;
315 GetGWorld(&port,
316 &gdh);
317 _res = Py_BuildValue("O&O&",
318 GrafObj_New, port,
319 ResObj_New, gdh);
320 return _res;
323 static PyObject *Qdoffs_SetGWorld(PyObject *_self, PyObject *_args)
325 PyObject *_res = NULL;
326 CGrafPtr port;
327 GDHandle gdh;
328 #ifndef SetGWorld
329 PyMac_PRECHECK(SetGWorld);
330 #endif
331 if (!PyArg_ParseTuple(_args, "O&O&",
332 GrafObj_Convert, &port,
333 OptResObj_Convert, &gdh))
334 return NULL;
335 SetGWorld(port,
336 gdh);
337 Py_INCREF(Py_None);
338 _res = Py_None;
339 return _res;
342 static PyObject *Qdoffs_CTabChanged(PyObject *_self, PyObject *_args)
344 PyObject *_res = NULL;
345 CTabHandle ctab;
346 #ifndef CTabChanged
347 PyMac_PRECHECK(CTabChanged);
348 #endif
349 if (!PyArg_ParseTuple(_args, "O&",
350 OptResObj_Convert, &ctab))
351 return NULL;
352 CTabChanged(ctab);
353 Py_INCREF(Py_None);
354 _res = Py_None;
355 return _res;
358 static PyObject *Qdoffs_PixPatChanged(PyObject *_self, PyObject *_args)
360 PyObject *_res = NULL;
361 PixPatHandle ppat;
362 #ifndef PixPatChanged
363 PyMac_PRECHECK(PixPatChanged);
364 #endif
365 if (!PyArg_ParseTuple(_args, "O&",
366 ResObj_Convert, &ppat))
367 return NULL;
368 PixPatChanged(ppat);
369 Py_INCREF(Py_None);
370 _res = Py_None;
371 return _res;
374 static PyObject *Qdoffs_PortChanged(PyObject *_self, PyObject *_args)
376 PyObject *_res = NULL;
377 GrafPtr port;
378 #ifndef PortChanged
379 PyMac_PRECHECK(PortChanged);
380 #endif
381 if (!PyArg_ParseTuple(_args, "O&",
382 GrafObj_Convert, &port))
383 return NULL;
384 PortChanged(port);
385 Py_INCREF(Py_None);
386 _res = Py_None;
387 return _res;
390 static PyObject *Qdoffs_GDeviceChanged(PyObject *_self, PyObject *_args)
392 PyObject *_res = NULL;
393 GDHandle gdh;
394 #ifndef GDeviceChanged
395 PyMac_PRECHECK(GDeviceChanged);
396 #endif
397 if (!PyArg_ParseTuple(_args, "O&",
398 OptResObj_Convert, &gdh))
399 return NULL;
400 GDeviceChanged(gdh);
401 Py_INCREF(Py_None);
402 _res = Py_None;
403 return _res;
406 static PyObject *Qdoffs_AllowPurgePixels(PyObject *_self, PyObject *_args)
408 PyObject *_res = NULL;
409 PixMapHandle pm;
410 #ifndef AllowPurgePixels
411 PyMac_PRECHECK(AllowPurgePixels);
412 #endif
413 if (!PyArg_ParseTuple(_args, "O&",
414 ResObj_Convert, &pm))
415 return NULL;
416 AllowPurgePixels(pm);
417 Py_INCREF(Py_None);
418 _res = Py_None;
419 return _res;
422 static PyObject *Qdoffs_NoPurgePixels(PyObject *_self, PyObject *_args)
424 PyObject *_res = NULL;
425 PixMapHandle pm;
426 #ifndef NoPurgePixels
427 PyMac_PRECHECK(NoPurgePixels);
428 #endif
429 if (!PyArg_ParseTuple(_args, "O&",
430 ResObj_Convert, &pm))
431 return NULL;
432 NoPurgePixels(pm);
433 Py_INCREF(Py_None);
434 _res = Py_None;
435 return _res;
438 static PyObject *Qdoffs_GetPixelsState(PyObject *_self, PyObject *_args)
440 PyObject *_res = NULL;
441 GWorldFlags _rv;
442 PixMapHandle pm;
443 #ifndef GetPixelsState
444 PyMac_PRECHECK(GetPixelsState);
445 #endif
446 if (!PyArg_ParseTuple(_args, "O&",
447 ResObj_Convert, &pm))
448 return NULL;
449 _rv = GetPixelsState(pm);
450 _res = Py_BuildValue("l",
451 _rv);
452 return _res;
455 static PyObject *Qdoffs_SetPixelsState(PyObject *_self, PyObject *_args)
457 PyObject *_res = NULL;
458 PixMapHandle pm;
459 GWorldFlags state;
460 #ifndef SetPixelsState
461 PyMac_PRECHECK(SetPixelsState);
462 #endif
463 if (!PyArg_ParseTuple(_args, "O&l",
464 ResObj_Convert, &pm,
465 &state))
466 return NULL;
467 SetPixelsState(pm,
468 state);
469 Py_INCREF(Py_None);
470 _res = Py_None;
471 return _res;
474 static PyObject *Qdoffs_GetPixRowBytes(PyObject *_self, PyObject *_args)
476 PyObject *_res = NULL;
477 long _rv;
478 PixMapHandle pm;
479 #ifndef GetPixRowBytes
480 PyMac_PRECHECK(GetPixRowBytes);
481 #endif
482 if (!PyArg_ParseTuple(_args, "O&",
483 ResObj_Convert, &pm))
484 return NULL;
485 _rv = GetPixRowBytes(pm);
486 _res = Py_BuildValue("l",
487 _rv);
488 return _res;
491 static PyObject *Qdoffs_NewScreenBuffer(PyObject *_self, PyObject *_args)
493 PyObject *_res = NULL;
494 QDErr _err;
495 Rect globalRect;
496 Boolean purgeable;
497 GDHandle gdh;
498 PixMapHandle offscreenPixMap;
499 #ifndef NewScreenBuffer
500 PyMac_PRECHECK(NewScreenBuffer);
501 #endif
502 if (!PyArg_ParseTuple(_args, "O&b",
503 PyMac_GetRect, &globalRect,
504 &purgeable))
505 return NULL;
506 _err = NewScreenBuffer(&globalRect,
507 purgeable,
508 &gdh,
509 &offscreenPixMap);
510 if (_err != noErr) return PyMac_Error(_err);
511 _res = Py_BuildValue("O&O&",
512 ResObj_New, gdh,
513 ResObj_New, offscreenPixMap);
514 return _res;
517 static PyObject *Qdoffs_DisposeScreenBuffer(PyObject *_self, PyObject *_args)
519 PyObject *_res = NULL;
520 PixMapHandle offscreenPixMap;
521 #ifndef DisposeScreenBuffer
522 PyMac_PRECHECK(DisposeScreenBuffer);
523 #endif
524 if (!PyArg_ParseTuple(_args, "O&",
525 ResObj_Convert, &offscreenPixMap))
526 return NULL;
527 DisposeScreenBuffer(offscreenPixMap);
528 Py_INCREF(Py_None);
529 _res = Py_None;
530 return _res;
533 static PyObject *Qdoffs_QDDone(PyObject *_self, PyObject *_args)
535 PyObject *_res = NULL;
536 Boolean _rv;
537 GrafPtr port;
538 #ifndef QDDone
539 PyMac_PRECHECK(QDDone);
540 #endif
541 if (!PyArg_ParseTuple(_args, "O&",
542 GrafObj_Convert, &port))
543 return NULL;
544 _rv = QDDone(port);
545 _res = Py_BuildValue("b",
546 _rv);
547 return _res;
550 static PyObject *Qdoffs_OffscreenVersion(PyObject *_self, PyObject *_args)
552 PyObject *_res = NULL;
553 long _rv;
554 #ifndef OffscreenVersion
555 PyMac_PRECHECK(OffscreenVersion);
556 #endif
557 if (!PyArg_ParseTuple(_args, ""))
558 return NULL;
559 _rv = OffscreenVersion();
560 _res = Py_BuildValue("l",
561 _rv);
562 return _res;
565 static PyObject *Qdoffs_NewTempScreenBuffer(PyObject *_self, PyObject *_args)
567 PyObject *_res = NULL;
568 QDErr _err;
569 Rect globalRect;
570 Boolean purgeable;
571 GDHandle gdh;
572 PixMapHandle offscreenPixMap;
573 #ifndef NewTempScreenBuffer
574 PyMac_PRECHECK(NewTempScreenBuffer);
575 #endif
576 if (!PyArg_ParseTuple(_args, "O&b",
577 PyMac_GetRect, &globalRect,
578 &purgeable))
579 return NULL;
580 _err = NewTempScreenBuffer(&globalRect,
581 purgeable,
582 &gdh,
583 &offscreenPixMap);
584 if (_err != noErr) return PyMac_Error(_err);
585 _res = Py_BuildValue("O&O&",
586 ResObj_New, gdh,
587 ResObj_New, offscreenPixMap);
588 return _res;
591 static PyObject *Qdoffs_PixMap32Bit(PyObject *_self, PyObject *_args)
593 PyObject *_res = NULL;
594 Boolean _rv;
595 PixMapHandle pmHandle;
596 #ifndef PixMap32Bit
597 PyMac_PRECHECK(PixMap32Bit);
598 #endif
599 if (!PyArg_ParseTuple(_args, "O&",
600 ResObj_Convert, &pmHandle))
601 return NULL;
602 _rv = PixMap32Bit(pmHandle);
603 _res = Py_BuildValue("b",
604 _rv);
605 return _res;
608 static PyObject *Qdoffs_GetPixMapBytes(PyObject *_self, PyObject *_args)
610 PyObject *_res = NULL;
612 PixMapHandle pm;
613 int from, length;
614 char *cp;
616 if ( !PyArg_ParseTuple(_args, "O&ii", ResObj_Convert, &pm, &from, &length) )
617 return NULL;
618 cp = GetPixBaseAddr(pm)+from;
619 _res = PyString_FromStringAndSize(cp, length);
620 return _res;
624 static PyObject *Qdoffs_PutPixMapBytes(PyObject *_self, PyObject *_args)
626 PyObject *_res = NULL;
628 PixMapHandle pm;
629 int from, length;
630 char *cp, *icp;
632 if ( !PyArg_ParseTuple(_args, "O&is#", ResObj_Convert, &pm, &from, &icp, &length) )
633 return NULL;
634 cp = GetPixBaseAddr(pm)+from;
635 memcpy(cp, icp, length);
636 Py_INCREF(Py_None);
637 _res = Py_None;
638 return _res;
642 static PyMethodDef Qdoffs_methods[] = {
643 {"NewGWorld", (PyCFunction)Qdoffs_NewGWorld, 1,
644 PyDoc_STR("(short PixelDepth, Rect boundsRect, CTabHandle cTable, GDHandle aGDevice, GWorldFlags flags) -> (GWorldPtr offscreenGWorld)")},
645 {"LockPixels", (PyCFunction)Qdoffs_LockPixels, 1,
646 PyDoc_STR("(PixMapHandle pm) -> (Boolean _rv)")},
647 {"UnlockPixels", (PyCFunction)Qdoffs_UnlockPixels, 1,
648 PyDoc_STR("(PixMapHandle pm) -> None")},
649 {"UpdateGWorld", (PyCFunction)Qdoffs_UpdateGWorld, 1,
650 PyDoc_STR("(short pixelDepth, Rect boundsRect, CTabHandle cTable, GDHandle aGDevice, GWorldFlags flags) -> (GWorldFlags _rv, GWorldPtr offscreenGWorld)")},
651 {"GetGWorld", (PyCFunction)Qdoffs_GetGWorld, 1,
652 PyDoc_STR("() -> (CGrafPtr port, GDHandle gdh)")},
653 {"SetGWorld", (PyCFunction)Qdoffs_SetGWorld, 1,
654 PyDoc_STR("(CGrafPtr port, GDHandle gdh) -> None")},
655 {"CTabChanged", (PyCFunction)Qdoffs_CTabChanged, 1,
656 PyDoc_STR("(CTabHandle ctab) -> None")},
657 {"PixPatChanged", (PyCFunction)Qdoffs_PixPatChanged, 1,
658 PyDoc_STR("(PixPatHandle ppat) -> None")},
659 {"PortChanged", (PyCFunction)Qdoffs_PortChanged, 1,
660 PyDoc_STR("(GrafPtr port) -> None")},
661 {"GDeviceChanged", (PyCFunction)Qdoffs_GDeviceChanged, 1,
662 PyDoc_STR("(GDHandle gdh) -> None")},
663 {"AllowPurgePixels", (PyCFunction)Qdoffs_AllowPurgePixels, 1,
664 PyDoc_STR("(PixMapHandle pm) -> None")},
665 {"NoPurgePixels", (PyCFunction)Qdoffs_NoPurgePixels, 1,
666 PyDoc_STR("(PixMapHandle pm) -> None")},
667 {"GetPixelsState", (PyCFunction)Qdoffs_GetPixelsState, 1,
668 PyDoc_STR("(PixMapHandle pm) -> (GWorldFlags _rv)")},
669 {"SetPixelsState", (PyCFunction)Qdoffs_SetPixelsState, 1,
670 PyDoc_STR("(PixMapHandle pm, GWorldFlags state) -> None")},
671 {"GetPixRowBytes", (PyCFunction)Qdoffs_GetPixRowBytes, 1,
672 PyDoc_STR("(PixMapHandle pm) -> (long _rv)")},
673 {"NewScreenBuffer", (PyCFunction)Qdoffs_NewScreenBuffer, 1,
674 PyDoc_STR("(Rect globalRect, Boolean purgeable) -> (GDHandle gdh, PixMapHandle offscreenPixMap)")},
675 {"DisposeScreenBuffer", (PyCFunction)Qdoffs_DisposeScreenBuffer, 1,
676 PyDoc_STR("(PixMapHandle offscreenPixMap) -> None")},
677 {"QDDone", (PyCFunction)Qdoffs_QDDone, 1,
678 PyDoc_STR("(GrafPtr port) -> (Boolean _rv)")},
679 {"OffscreenVersion", (PyCFunction)Qdoffs_OffscreenVersion, 1,
680 PyDoc_STR("() -> (long _rv)")},
681 {"NewTempScreenBuffer", (PyCFunction)Qdoffs_NewTempScreenBuffer, 1,
682 PyDoc_STR("(Rect globalRect, Boolean purgeable) -> (GDHandle gdh, PixMapHandle offscreenPixMap)")},
683 {"PixMap32Bit", (PyCFunction)Qdoffs_PixMap32Bit, 1,
684 PyDoc_STR("(PixMapHandle pmHandle) -> (Boolean _rv)")},
685 {"GetPixMapBytes", (PyCFunction)Qdoffs_GetPixMapBytes, 1,
686 PyDoc_STR("(pixmap, int start, int size) -> string. Return bytes from the pixmap")},
687 {"PutPixMapBytes", (PyCFunction)Qdoffs_PutPixMapBytes, 1,
688 PyDoc_STR("(pixmap, int start, string data). Store bytes into the pixmap")},
689 {NULL, NULL, 0}
695 void init_Qdoffs(void)
697 PyObject *m;
698 PyObject *d;
702 PyMac_INIT_TOOLBOX_OBJECT_NEW(GWorldPtr, GWorldObj_New);
703 PyMac_INIT_TOOLBOX_OBJECT_CONVERT(GWorldPtr, GWorldObj_Convert);
706 m = Py_InitModule("_Qdoffs", Qdoffs_methods);
707 d = PyModule_GetDict(m);
708 Qdoffs_Error = PyMac_GetOSErrException();
709 if (Qdoffs_Error == NULL ||
710 PyDict_SetItemString(d, "Error", Qdoffs_Error) != 0)
711 return;
712 GWorld_Type.ob_type = &PyType_Type;
713 if (PyType_Ready(&GWorld_Type) < 0) return;
714 Py_INCREF(&GWorld_Type);
715 PyModule_AddObject(m, "GWorld", (PyObject *)&GWorld_Type);
716 /* Backward-compatible name */
717 Py_INCREF(&GWorld_Type);
718 PyModule_AddObject(m, "GWorldType", (PyObject *)&GWorld_Type);
721 /* ======================= End module _Qdoffs ======================= */