PyObject_Del(self);
}
-static PyMethodDef GrafObj_methods[] = {
- {NULL, NULL, 0}
-};
-
-PyMethodChain GrafObj_chain = { GrafObj_methods, NULL };
-
-static PyObject *GrafObj_getattr(GrafPortObject *self, char *name)
-{
-#if !ACCESSOR_CALLS_ARE_FUNCTIONS
-
- { CGrafPtr itself_color = (CGrafPtr)self->ob_itself;
-
- if ( strcmp(name, "data") == 0 )
- return PyString_FromStringAndSize((char *)self->ob_itself, sizeof(GrafPort));
-
- if ( (itself_color->portVersion&0xc000) == 0xc000 ) {
- /* Color-only attributes */
-
- if ( strcmp(name, "portBits") == 0 )
- /* XXXX Do we need HLock() stuff here?? */
- return BMObj_New((BitMapPtr)*itself_color->portPixMap);
- if ( strcmp(name, "grafVars") == 0 )
- return Py_BuildValue("O&", ResObj_New, (Handle)itself_color->visRgn);
- if ( strcmp(name, "chExtra") == 0 )
- return Py_BuildValue("h", itself_color->chExtra);
- if ( strcmp(name, "pnLocHFrac") == 0 )
- return Py_BuildValue("h", itself_color->pnLocHFrac);
- if ( strcmp(name, "bkPixPat") == 0 )
- return Py_BuildValue("O&", ResObj_New, (Handle)itself_color->bkPixPat);
- if ( strcmp(name, "rgbFgColor") == 0 )
- return Py_BuildValue("O&", QdRGB_New, &itself_color->rgbFgColor);
- if ( strcmp(name, "rgbBkColor") == 0 )
- return Py_BuildValue("O&", QdRGB_New, &itself_color->rgbBkColor);
- if ( strcmp(name, "pnPixPat") == 0 )
- return Py_BuildValue("O&", ResObj_New, (Handle)itself_color->pnPixPat);
- if ( strcmp(name, "fillPixPat") == 0 )
- return Py_BuildValue("O&", ResObj_New, (Handle)itself_color->fillPixPat);
- } else {
- /* Mono-only attributes */
- if ( strcmp(name, "portBits") == 0 )
- return BMObj_New(&self->ob_itself->portBits);
- if ( strcmp(name, "bkPat") == 0 )
- return Py_BuildValue("s#", (char *)&self->ob_itself->bkPat, sizeof(Pattern));
- if ( strcmp(name, "fillPat") == 0 )
- return Py_BuildValue("s#", (char *)&self->ob_itself->fillPat, sizeof(Pattern));
- if ( strcmp(name, "pnPat") == 0 )
- return Py_BuildValue("s#", (char *)&self->ob_itself->pnPat, sizeof(Pattern));
- }
- /*
- ** Accessible for both color/mono windows.
- ** portVersion is really color-only, but we put it here
- ** for convenience
- */
- if ( strcmp(name, "portVersion") == 0 )
- return Py_BuildValue("h", itself_color->portVersion);
- if ( strcmp(name, "device") == 0 )
- return PyInt_FromLong((long)self->ob_itself->device);
- if ( strcmp(name, "portRect") == 0 )
- return Py_BuildValue("O&", PyMac_BuildRect, &self->ob_itself->portRect);
- if ( strcmp(name, "visRgn") == 0 )
- return Py_BuildValue("O&", ResObj_New, (Handle)self->ob_itself->visRgn);
- if ( strcmp(name, "clipRgn") == 0 )
- return Py_BuildValue("O&", ResObj_New, (Handle)self->ob_itself->clipRgn);
- if ( strcmp(name, "pnLoc") == 0 )
- return Py_BuildValue("O&", PyMac_BuildPoint, self->ob_itself->pnLoc);
- if ( strcmp(name, "pnSize") == 0 )
- return Py_BuildValue("O&", PyMac_BuildPoint, self->ob_itself->pnSize);
- if ( strcmp(name, "pnMode") == 0 )
- return Py_BuildValue("h", self->ob_itself->pnMode);
- if ( strcmp(name, "pnVis") == 0 )
- return Py_BuildValue("h", self->ob_itself->pnVis);
- if ( strcmp(name, "txFont") == 0 )
- return Py_BuildValue("h", self->ob_itself->txFont);
- if ( strcmp(name, "txFace") == 0 )
- return Py_BuildValue("h", (short)self->ob_itself->txFace);
- if ( strcmp(name, "txMode") == 0 )
- return Py_BuildValue("h", self->ob_itself->txMode);
- if ( strcmp(name, "txSize") == 0 )
- return Py_BuildValue("h", self->ob_itself->txSize);
- if ( strcmp(name, "spExtra") == 0 )
- return Py_BuildValue("O&", PyMac_BuildFixed, self->ob_itself->spExtra);
- /* XXXX Add more, as needed */
- /* This one is so we can compare grafports: */
- if ( strcmp(name, "_id") == 0 )
- return Py_BuildValue("l", (long)self->ob_itself);
- }
-#else
-
- { CGrafPtr itself_color = (CGrafPtr)self->ob_itself;
- if ( strcmp(name, "portBits") == 0 )
- return BMObj_New((BitMapPtr)GetPortBitMapForCopyBits(itself_color));
- if ( strcmp(name, "chExtra") == 0 )
- return Py_BuildValue("h", GetPortChExtra(itself_color));
- if ( strcmp(name, "pnLocHFrac") == 0 )
- return Py_BuildValue("h", GetPortFracHPenLocation(itself_color));
- if ( strcmp(name, "bkPixPat") == 0 ) {
- PixPatHandle h=0;
- return Py_BuildValue("O&", ResObj_New, (Handle)GetPortBackPixPat(itself_color, h));
- }
- if ( strcmp(name, "rgbFgColor") == 0 ) {
- RGBColor c;
- return Py_BuildValue("O&", QdRGB_New, GetPortForeColor(itself_color, &c));
- }
- if ( strcmp(name, "rgbBkColor") == 0 ) {
- RGBColor c;
- return Py_BuildValue("O&", QdRGB_New, GetPortBackColor(itself_color, &c));
- }
- if ( strcmp(name, "pnPixPat") == 0 ) {
- PixPatHandle h=NewPixPat(); /* XXXX wrong dispose routine */
-
- return Py_BuildValue("O&", ResObj_New, (Handle)GetPortPenPixPat(itself_color, h));
- }
- if ( strcmp(name, "fillPixPat") == 0 ) {
- PixPatHandle h=NewPixPat(); /* XXXX wrong dispose routine */
- return Py_BuildValue("O&", ResObj_New, (Handle)GetPortFillPixPat(itself_color, h));
- }
- if ( strcmp(name, "portRect") == 0 ) {
- Rect r;
- return Py_BuildValue("O&", PyMac_BuildRect, GetPortBounds(itself_color, &r));
- }
- if ( strcmp(name, "visRgn") == 0 ) {
- RgnHandle h=NewRgn(); /* XXXX wrong dispose routine */
- return Py_BuildValue("O&", ResObj_New, (Handle)GetPortVisibleRegion(itself_color, h));
- }
- if ( strcmp(name, "clipRgn") == 0 ) {
- RgnHandle h=NewRgn(); /* XXXX wrong dispose routine */
- return Py_BuildValue("O&", ResObj_New, (Handle)GetPortClipRegion(itself_color, h));
- }
- if ( strcmp(name, "pnLoc") == 0 ) {
- Point p;
- return Py_BuildValue("O&", PyMac_BuildPoint, *GetPortPenLocation(itself_color, &p));
- }
- if ( strcmp(name, "pnSize") == 0 ) {
- Point p;
- return Py_BuildValue("O&", PyMac_BuildPoint, *GetPortPenSize(itself_color, &p));
- }
- if ( strcmp(name, "pnMode") == 0 )
- return Py_BuildValue("h", GetPortPenMode(itself_color));
- if ( strcmp(name, "pnVis") == 0 )
- return Py_BuildValue("h", GetPortPenVisibility(itself_color));
- if ( strcmp(name, "txFont") == 0 )
- return Py_BuildValue("h", GetPortTextFont(itself_color));
- if ( strcmp(name, "txFace") == 0 )
- return Py_BuildValue("h", (short)GetPortTextFace(itself_color));
- if ( strcmp(name, "txMode") == 0 )
- return Py_BuildValue("h", GetPortTextMode(itself_color));
- if ( strcmp(name, "txSize") == 0 )
- return Py_BuildValue("h", GetPortTextSize(itself_color));
- if ( strcmp(name, "spExtra") == 0 )
- return Py_BuildValue("O&", PyMac_BuildFixed, GetPortSpExtra(itself_color));
- /* XXXX Add more, as needed */
- /* This one is so we can compare grafports: */
- if ( strcmp(name, "_id") == 0 )
- return Py_BuildValue("l", (long)self->ob_itself);
- }
-#endif
- return Py_FindMethodInChain(&GrafObj_chain, (PyObject *)self, name);
-}
-
-#define GrafObj_setattr NULL
-
-#define GrafObj_compare NULL
-
-#define GrafObj_repr NULL
-
-#define GrafObj_hash NULL
-
-PyTypeObject GrafPort_Type = {
- PyObject_HEAD_INIT(NULL)
- 0, /*ob_size*/
- "_Qd.GrafPort", /*tp_name*/
- sizeof(GrafPortObject), /*tp_basicsize*/
- 0, /*tp_itemsize*/
- /* methods */
- (destructor) GrafObj_dealloc, /*tp_dealloc*/
- 0, /*tp_print*/
- (getattrfunc) GrafObj_getattr, /*tp_getattr*/
- (setattrfunc) GrafObj_setattr, /*tp_setattr*/
- (cmpfunc) GrafObj_compare, /*tp_compare*/
- (reprfunc) GrafObj_repr, /*tp_repr*/
- (PyNumberMethods *)0, /* tp_as_number */
- (PySequenceMethods *)0, /* tp_as_sequence */
- (PyMappingMethods *)0, /* tp_as_mapping */
- (hashfunc) GrafObj_hash, /*tp_hash*/
-};
-
-/* -------------------- End object type GrafPort -------------------- */
-
-
-/* ----------------------- Object type BitMap ----------------------- */
-
-PyTypeObject BitMap_Type;
-
-#define BMObj_Check(x) ((x)->ob_type == &BitMap_Type)
-
-typedef struct BitMapObject {
- PyObject_HEAD
- BitMapPtr ob_itself;
- PyObject *referred_object;
- BitMap *referred_bitmap;
-} BitMapObject;
-
-PyObject *BMObj_New(BitMapPtr itself)
-{
- BitMapObject *it;
- if (itself == NULL) return PyMac_Error(resNotFound);
- it = PyObject_NEW(BitMapObject, &BitMap_Type);
- if (it == NULL) return NULL;
- it->ob_itself = itself;
- it->referred_object = NULL;
- it->referred_bitmap = NULL;
- return (PyObject *)it;
-}
-int BMObj_Convert(PyObject *v, BitMapPtr *p_itself)
+static PyObject *GrafObj_MacSetPort(GrafPortObject *_self, PyObject *_args)
{
- if (!BMObj_Check(v))
- {
- PyErr_SetString(PyExc_TypeError, "BitMap required");
- return 0;
- }
- *p_itself = ((BitMapObject *)v)->ob_itself;
- return 1;
+ PyObject *_res = NULL;
+#ifndef MacSetPort
+ PyMac_PRECHECK(MacSetPort);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ MacSetPort(_self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
}
-static void BMObj_dealloc(BitMapObject *self)
-{
- Py_XDECREF(self->referred_object);
- if (self->referred_bitmap) free(self->referred_bitmap);
- PyObject_Del(self);
-}
+#if TARGET_API_MAC_CARBON
-static PyObject *BMObj_getdata(BitMapObject *_self, PyObject *_args)
+static PyObject *GrafObj_IsValidPort(GrafPortObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
-
- int from, length;
- char *cp;
-
- if ( !PyArg_ParseTuple(_args, "ii", &from, &length) )
+ Boolean _rv;
+#ifndef IsValidPort
+ PyMac_PRECHECK(IsValidPort);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
return NULL;
- cp = _self->ob_itself->baseAddr+from;
- _res = PyString_FromStringAndSize(cp, length);
+ _rv = IsValidPort(_self->ob_itself);
+ _res = Py_BuildValue("b",
+ _rv);
return _res;
-
}
+#endif
-static PyObject *BMObj_putdata(BitMapObject *_self, PyObject *_args)
+static PyObject *GrafObj_GetPortPixMap(GrafPortObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
-
- int from, length;
- char *cp, *icp;
-
- if ( !PyArg_ParseTuple(_args, "is#", &from, &icp, &length) )
+ PixMapHandle _rv;
+#ifndef GetPortPixMap
+ PyMac_PRECHECK(GetPortPixMap);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
return NULL;
- cp = _self->ob_itself->baseAddr+from;
- memcpy(cp, icp, length);
- Py_INCREF(Py_None);
- _res = Py_None;
+ _rv = GetPortPixMap(_self->ob_itself);
+ _res = Py_BuildValue("O&",
+ ResObj_New, _rv);
return _res;
-
-}
-
-static PyMethodDef BMObj_methods[] = {
- {"getdata", (PyCFunction)BMObj_getdata, 1,
- PyDoc_STR("(int start, int size) -> string. Return bytes from the bitmap")},
- {"putdata", (PyCFunction)BMObj_putdata, 1,
- PyDoc_STR("(int start, string data). Store bytes into the bitmap")},
- {NULL, NULL, 0}
-};
-
-PyMethodChain BMObj_chain = { BMObj_methods, NULL };
-
-static PyObject *BMObj_getattr(BitMapObject *self, char *name)
-{
- if ( strcmp(name, "baseAddr") == 0 )
- return PyInt_FromLong((long)self->ob_itself->baseAddr);
- if ( strcmp(name, "rowBytes") == 0 )
- return PyInt_FromLong((long)self->ob_itself->rowBytes);
- if ( strcmp(name, "bounds") == 0 )
- return Py_BuildValue("O&", PyMac_BuildRect, &self->ob_itself->bounds);
- /* XXXX Add more, as needed */
- if ( strcmp(name, "bitmap_data") == 0 )
- return PyString_FromStringAndSize((char *)self->ob_itself, sizeof(BitMap));
- if ( strcmp(name, "pixmap_data") == 0 )
- return PyString_FromStringAndSize((char *)self->ob_itself, sizeof(PixMap));
-
- return Py_FindMethodInChain(&BMObj_chain, (PyObject *)self, name);
-}
-
-#define BMObj_setattr NULL
-
-#define BMObj_compare NULL
-
-#define BMObj_repr NULL
-
-#define BMObj_hash NULL
-
-PyTypeObject BitMap_Type = {
- PyObject_HEAD_INIT(NULL)
- 0, /*ob_size*/
- "_Qd.BitMap", /*tp_name*/
- sizeof(BitMapObject), /*tp_basicsize*/
- 0, /*tp_itemsize*/
- /* methods */
- (destructor) BMObj_dealloc, /*tp_dealloc*/
- 0, /*tp_print*/
- (getattrfunc) BMObj_getattr, /*tp_getattr*/
- (setattrfunc) BMObj_setattr, /*tp_setattr*/
- (cmpfunc) BMObj_compare, /*tp_compare*/
- (reprfunc) BMObj_repr, /*tp_repr*/
- (PyNumberMethods *)0, /* tp_as_number */
- (PySequenceMethods *)0, /* tp_as_sequence */
- (PyMappingMethods *)0, /* tp_as_mapping */
- (hashfunc) BMObj_hash, /*tp_hash*/
-};
-
-/* --------------------- End object type BitMap --------------------- */
-
-
-/* ------------------ Object type QDGlobalsAccess ------------------- */
-
-static PyTypeObject QDGlobalsAccess_Type;
-
-#define QDGA_Check(x) ((x)->ob_type == &QDGlobalsAccess_Type)
-
-typedef struct QDGlobalsAccessObject {
- PyObject_HEAD
-} QDGlobalsAccessObject;
-
-static PyObject *QDGA_New(void)
-{
- QDGlobalsAccessObject *it;
- it = PyObject_NEW(QDGlobalsAccessObject, &QDGlobalsAccess_Type);
- if (it == NULL) return NULL;
- return (PyObject *)it;
-}
-
-static void QDGA_dealloc(QDGlobalsAccessObject *self)
-{
- PyObject_Del(self);
}
-static PyMethodDef QDGA_methods[] = {
- {NULL, NULL, 0}
-};
-
-static PyMethodChain QDGA_chain = { QDGA_methods, NULL };
-
-static PyObject *QDGA_getattr(QDGlobalsAccessObject *self, char *name)
+static PyObject *GrafObj_GetPortBitMapForCopyBits(GrafPortObject *_self, PyObject *_args)
{
-#if !ACCESSOR_CALLS_ARE_FUNCTIONS
-
- if ( strcmp(name, "arrow") == 0 )
- return PyString_FromStringAndSize((char *)&qd.arrow, sizeof(qd.arrow));
- if ( strcmp(name, "black") == 0 )
- return PyString_FromStringAndSize((char *)&qd.black, sizeof(qd.black));
- if ( strcmp(name, "white") == 0 )
- return PyString_FromStringAndSize((char *)&qd.white, sizeof(qd.white));
- if ( strcmp(name, "gray") == 0 )
- return PyString_FromStringAndSize((char *)&qd.gray, sizeof(qd.gray));
- if ( strcmp(name, "ltGray") == 0 )
- return PyString_FromStringAndSize((char *)&qd.ltGray, sizeof(qd.ltGray));
- if ( strcmp(name, "dkGray") == 0 )
- return PyString_FromStringAndSize((char *)&qd.dkGray, sizeof(qd.dkGray));
- if ( strcmp(name, "screenBits") == 0 )
- return BMObj_New(&qd.screenBits);
- if ( strcmp(name, "thePort") == 0 )
- return GrafObj_New(qd.thePort);
- if ( strcmp(name, "randSeed") == 0 )
- return Py_BuildValue("l", &qd.randSeed);
-
-#else
-
- if ( strcmp(name, "arrow") == 0 ) {
- Cursor rv;
- GetQDGlobalsArrow(&rv);
- return PyString_FromStringAndSize((char *)&rv, sizeof(rv));
- }
- if ( strcmp(name, "black") == 0 ) {
- Pattern rv;
- GetQDGlobalsBlack(&rv);
- return PyString_FromStringAndSize((char *)&rv, sizeof(rv));
- }
- if ( strcmp(name, "white") == 0 ) {
- Pattern rv;
- GetQDGlobalsWhite(&rv);
- return PyString_FromStringAndSize((char *)&rv, sizeof(rv));
- }
- if ( strcmp(name, "gray") == 0 ) {
- Pattern rv;
- GetQDGlobalsGray(&rv);
- return PyString_FromStringAndSize((char *)&rv, sizeof(rv));
- }
- if ( strcmp(name, "ltGray") == 0 ) {
- Pattern rv;
- GetQDGlobalsLightGray(&rv);
- return PyString_FromStringAndSize((char *)&rv, sizeof(rv));
- }
- if ( strcmp(name, "dkGray") == 0 ) {
- Pattern rv;
- GetQDGlobalsDarkGray(&rv);
- return PyString_FromStringAndSize((char *)&rv, sizeof(rv));
- }
- if ( strcmp(name, "screenBits") == 0 ) {
- BitMap rv;
- GetQDGlobalsScreenBits(&rv);
- return BMObj_NewCopied(&rv);
- }
- if ( strcmp(name, "thePort") == 0 )
- return GrafObj_New(GetQDGlobalsThePort());
- if ( strcmp(name, "randSeed") == 0 )
- return Py_BuildValue("l", GetQDGlobalsRandomSeed());
-
+ PyObject *_res = NULL;
+ const BitMap * _rv;
+#ifndef GetPortBitMapForCopyBits
+ PyMac_PRECHECK(GetPortBitMapForCopyBits);
#endif
- return Py_FindMethodInChain(&QDGA_chain, (PyObject *)self, name);
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetPortBitMapForCopyBits(_self->ob_itself);
+ _res = Py_BuildValue("O&",
+ BMObj_New, _rv);
+ return _res;
}
-#define QDGA_setattr NULL
-
-#define QDGA_compare NULL
-
-#define QDGA_repr NULL
-
-#define QDGA_hash NULL
-
-static PyTypeObject QDGlobalsAccess_Type = {
- PyObject_HEAD_INIT(NULL)
- 0, /*ob_size*/
- "_Qd.QDGlobalsAccess", /*tp_name*/
- sizeof(QDGlobalsAccessObject), /*tp_basicsize*/
- 0, /*tp_itemsize*/
- /* methods */
- (destructor) QDGA_dealloc, /*tp_dealloc*/
- 0, /*tp_print*/
- (getattrfunc) QDGA_getattr, /*tp_getattr*/
- (setattrfunc) QDGA_setattr, /*tp_setattr*/
- (cmpfunc) QDGA_compare, /*tp_compare*/
- (reprfunc) QDGA_repr, /*tp_repr*/
- (PyNumberMethods *)0, /* tp_as_number */
- (PySequenceMethods *)0, /* tp_as_sequence */
- (PyMappingMethods *)0, /* tp_as_mapping */
- (hashfunc) QDGA_hash, /*tp_hash*/
-};
-
-/* ---------------- End object type QDGlobalsAccess ----------------- */
-
-
-static PyObject *Qd_MacSetPort(PyObject *_self, PyObject *_args)
+static PyObject *GrafObj_GetPortBounds(GrafPortObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- GrafPtr port;
-#ifndef MacSetPort
- PyMac_PRECHECK(MacSetPort);
+ Rect rect;
+#ifndef GetPortBounds
+ PyMac_PRECHECK(GetPortBounds);
#endif
- if (!PyArg_ParseTuple(_args, "O&",
- GrafObj_Convert, &port))
+ if (!PyArg_ParseTuple(_args, ""))
return NULL;
- MacSetPort(port);
- Py_INCREF(Py_None);
- _res = Py_None;
+ GetPortBounds(_self->ob_itself,
+ &rect);
+ _res = Py_BuildValue("O&",
+ PyMac_BuildRect, &rect);
return _res;
}
-static PyObject *Qd_GetPort(PyObject *_self, PyObject *_args)
+static PyObject *GrafObj_GetPortForeColor(GrafPortObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- GrafPtr port;
-#ifndef GetPort
- PyMac_PRECHECK(GetPort);
+ RGBColor foreColor;
+#ifndef GetPortForeColor
+ PyMac_PRECHECK(GetPortForeColor);
#endif
if (!PyArg_ParseTuple(_args, ""))
return NULL;
- GetPort(&port);
+ GetPortForeColor(_self->ob_itself,
+ &foreColor);
_res = Py_BuildValue("O&",
- GrafObj_New, port);
+ QdRGB_New, &foreColor);
return _res;
}
-static PyObject *Qd_GrafDevice(PyObject *_self, PyObject *_args)
+static PyObject *GrafObj_GetPortBackColor(GrafPortObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- short device;
-#ifndef GrafDevice
- PyMac_PRECHECK(GrafDevice);
+ RGBColor backColor;
+#ifndef GetPortBackColor
+ PyMac_PRECHECK(GetPortBackColor);
#endif
- if (!PyArg_ParseTuple(_args, "h",
- &device))
+ if (!PyArg_ParseTuple(_args, ""))
return NULL;
- GrafDevice(device);
- Py_INCREF(Py_None);
- _res = Py_None;
+ GetPortBackColor(_self->ob_itself,
+ &backColor);
+ _res = Py_BuildValue("O&",
+ QdRGB_New, &backColor);
return _res;
}
-static PyObject *Qd_SetPortBits(PyObject *_self, PyObject *_args)
+static PyObject *GrafObj_GetPortOpColor(GrafPortObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- BitMapPtr bm;
-#ifndef SetPortBits
- PyMac_PRECHECK(SetPortBits);
+ RGBColor opColor;
+#ifndef GetPortOpColor
+ PyMac_PRECHECK(GetPortOpColor);
#endif
- if (!PyArg_ParseTuple(_args, "O&",
- BMObj_Convert, &bm))
+ if (!PyArg_ParseTuple(_args, ""))
return NULL;
- SetPortBits(bm);
- Py_INCREF(Py_None);
- _res = Py_None;
+ GetPortOpColor(_self->ob_itself,
+ &opColor);
+ _res = Py_BuildValue("O&",
+ QdRGB_New, &opColor);
return _res;
}
-static PyObject *Qd_PortSize(PyObject *_self, PyObject *_args)
+static PyObject *GrafObj_GetPortHiliteColor(GrafPortObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- short width;
- short height;
-#ifndef PortSize
- PyMac_PRECHECK(PortSize);
+ RGBColor hiliteColor;
+#ifndef GetPortHiliteColor
+ PyMac_PRECHECK(GetPortHiliteColor);
#endif
- if (!PyArg_ParseTuple(_args, "hh",
- &width,
- &height))
+ if (!PyArg_ParseTuple(_args, ""))
return NULL;
- PortSize(width,
- height);
- Py_INCREF(Py_None);
- _res = Py_None;
+ GetPortHiliteColor(_self->ob_itself,
+ &hiliteColor);
+ _res = Py_BuildValue("O&",
+ QdRGB_New, &hiliteColor);
return _res;
}
-static PyObject *Qd_MovePortTo(PyObject *_self, PyObject *_args)
+static PyObject *GrafObj_GetPortTextFont(GrafPortObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- short leftGlobal;
- short topGlobal;
-#ifndef MovePortTo
- PyMac_PRECHECK(MovePortTo);
+ short _rv;
+#ifndef GetPortTextFont
+ PyMac_PRECHECK(GetPortTextFont);
#endif
- if (!PyArg_ParseTuple(_args, "hh",
- &leftGlobal,
- &topGlobal))
+ if (!PyArg_ParseTuple(_args, ""))
return NULL;
- MovePortTo(leftGlobal,
- topGlobal);
- Py_INCREF(Py_None);
- _res = Py_None;
+ _rv = GetPortTextFont(_self->ob_itself);
+ _res = Py_BuildValue("h",
+ _rv);
return _res;
}
-static PyObject *Qd_SetOrigin(PyObject *_self, PyObject *_args)
+static PyObject *GrafObj_GetPortTextFace(GrafPortObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- short h;
- short v;
-#ifndef SetOrigin
- PyMac_PRECHECK(SetOrigin);
+ Style _rv;
+#ifndef GetPortTextFace
+ PyMac_PRECHECK(GetPortTextFace);
#endif
- if (!PyArg_ParseTuple(_args, "hh",
- &h,
- &v))
+ if (!PyArg_ParseTuple(_args, ""))
return NULL;
- SetOrigin(h,
- v);
- Py_INCREF(Py_None);
- _res = Py_None;
+ _rv = GetPortTextFace(_self->ob_itself);
+ _res = Py_BuildValue("b",
+ _rv);
return _res;
}
-static PyObject *Qd_SetClip(PyObject *_self, PyObject *_args)
+static PyObject *GrafObj_GetPortTextMode(GrafPortObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- RgnHandle rgn;
-#ifndef SetClip
- PyMac_PRECHECK(SetClip);
+ short _rv;
+#ifndef GetPortTextMode
+ PyMac_PRECHECK(GetPortTextMode);
#endif
- if (!PyArg_ParseTuple(_args, "O&",
- ResObj_Convert, &rgn))
+ if (!PyArg_ParseTuple(_args, ""))
return NULL;
- SetClip(rgn);
- Py_INCREF(Py_None);
- _res = Py_None;
+ _rv = GetPortTextMode(_self->ob_itself);
+ _res = Py_BuildValue("h",
+ _rv);
return _res;
}
-static PyObject *Qd_GetClip(PyObject *_self, PyObject *_args)
+static PyObject *GrafObj_GetPortTextSize(GrafPortObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- RgnHandle rgn;
-#ifndef GetClip
- PyMac_PRECHECK(GetClip);
+ short _rv;
+#ifndef GetPortTextSize
+ PyMac_PRECHECK(GetPortTextSize);
#endif
- if (!PyArg_ParseTuple(_args, "O&",
- ResObj_Convert, &rgn))
+ if (!PyArg_ParseTuple(_args, ""))
return NULL;
- GetClip(rgn);
- Py_INCREF(Py_None);
- _res = Py_None;
+ _rv = GetPortTextSize(_self->ob_itself);
+ _res = Py_BuildValue("h",
+ _rv);
return _res;
}
-static PyObject *Qd_ClipRect(PyObject *_self, PyObject *_args)
+static PyObject *GrafObj_GetPortChExtra(GrafPortObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- Rect r;
-#ifndef ClipRect
- PyMac_PRECHECK(ClipRect);
+ short _rv;
+#ifndef GetPortChExtra
+ PyMac_PRECHECK(GetPortChExtra);
#endif
- if (!PyArg_ParseTuple(_args, "O&",
- PyMac_GetRect, &r))
+ if (!PyArg_ParseTuple(_args, ""))
return NULL;
- ClipRect(&r);
- Py_INCREF(Py_None);
- _res = Py_None;
+ _rv = GetPortChExtra(_self->ob_itself);
+ _res = Py_BuildValue("h",
+ _rv);
return _res;
}
-static PyObject *Qd_BackPat(PyObject *_self, PyObject *_args)
+static PyObject *GrafObj_GetPortFracHPenLocation(GrafPortObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- Pattern *pat__in__;
- int pat__in_len__;
-#ifndef BackPat
- PyMac_PRECHECK(BackPat);
+ short _rv;
+#ifndef GetPortFracHPenLocation
+ PyMac_PRECHECK(GetPortFracHPenLocation);
#endif
- if (!PyArg_ParseTuple(_args, "s#",
- (char **)&pat__in__, &pat__in_len__))
+ if (!PyArg_ParseTuple(_args, ""))
return NULL;
- if (pat__in_len__ != sizeof(Pattern))
- {
- PyErr_SetString(PyExc_TypeError, "buffer length should be sizeof(Pattern)");
- goto pat__error__;
- }
- BackPat(pat__in__);
- Py_INCREF(Py_None);
- _res = Py_None;
- pat__error__: ;
+ _rv = GetPortFracHPenLocation(_self->ob_itself);
+ _res = Py_BuildValue("h",
+ _rv);
return _res;
}
-static PyObject *Qd_InitCursor(PyObject *_self, PyObject *_args)
+static PyObject *GrafObj_GetPortSpExtra(GrafPortObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
-#ifndef InitCursor
- PyMac_PRECHECK(InitCursor);
+ Fixed _rv;
+#ifndef GetPortSpExtra
+ PyMac_PRECHECK(GetPortSpExtra);
#endif
if (!PyArg_ParseTuple(_args, ""))
return NULL;
- InitCursor();
- Py_INCREF(Py_None);
- _res = Py_None;
+ _rv = GetPortSpExtra(_self->ob_itself);
+ _res = Py_BuildValue("O&",
+ PyMac_BuildFixed, _rv);
return _res;
}
-static PyObject *Qd_MacSetCursor(PyObject *_self, PyObject *_args)
+static PyObject *GrafObj_GetPortPenVisibility(GrafPortObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- Cursor *crsr__in__;
- int crsr__in_len__;
-#ifndef MacSetCursor
- PyMac_PRECHECK(MacSetCursor);
+ short _rv;
+#ifndef GetPortPenVisibility
+ PyMac_PRECHECK(GetPortPenVisibility);
#endif
- if (!PyArg_ParseTuple(_args, "s#",
- (char **)&crsr__in__, &crsr__in_len__))
+ if (!PyArg_ParseTuple(_args, ""))
return NULL;
- if (crsr__in_len__ != sizeof(Cursor))
- {
- PyErr_SetString(PyExc_TypeError, "buffer length should be sizeof(Cursor)");
- goto crsr__error__;
- }
- MacSetCursor(crsr__in__);
- Py_INCREF(Py_None);
- _res = Py_None;
- crsr__error__: ;
+ _rv = GetPortPenVisibility(_self->ob_itself);
+ _res = Py_BuildValue("h",
+ _rv);
return _res;
}
-static PyObject *Qd_HideCursor(PyObject *_self, PyObject *_args)
+static PyObject *GrafObj_GetPortVisibleRegion(GrafPortObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
-#ifndef HideCursor
- PyMac_PRECHECK(HideCursor);
+ RgnHandle _rv;
+ RgnHandle visRgn;
+#ifndef GetPortVisibleRegion
+ PyMac_PRECHECK(GetPortVisibleRegion);
#endif
- if (!PyArg_ParseTuple(_args, ""))
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &visRgn))
return NULL;
- HideCursor();
- Py_INCREF(Py_None);
- _res = Py_None;
+ _rv = GetPortVisibleRegion(_self->ob_itself,
+ visRgn);
+ _res = Py_BuildValue("O&",
+ ResObj_New, _rv);
return _res;
}
-static PyObject *Qd_MacShowCursor(PyObject *_self, PyObject *_args)
+static PyObject *GrafObj_GetPortClipRegion(GrafPortObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
-#ifndef MacShowCursor
- PyMac_PRECHECK(MacShowCursor);
+ RgnHandle _rv;
+ RgnHandle clipRgn;
+#ifndef GetPortClipRegion
+ PyMac_PRECHECK(GetPortClipRegion);
#endif
- if (!PyArg_ParseTuple(_args, ""))
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &clipRgn))
return NULL;
- MacShowCursor();
- Py_INCREF(Py_None);
- _res = Py_None;
+ _rv = GetPortClipRegion(_self->ob_itself,
+ clipRgn);
+ _res = Py_BuildValue("O&",
+ ResObj_New, _rv);
return _res;
}
-static PyObject *Qd_ObscureCursor(PyObject *_self, PyObject *_args)
+static PyObject *GrafObj_GetPortBackPixPat(GrafPortObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
-#ifndef ObscureCursor
- PyMac_PRECHECK(ObscureCursor);
+ PixPatHandle _rv;
+ PixPatHandle backPattern;
+#ifndef GetPortBackPixPat
+ PyMac_PRECHECK(GetPortBackPixPat);
#endif
- if (!PyArg_ParseTuple(_args, ""))
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &backPattern))
return NULL;
- ObscureCursor();
- Py_INCREF(Py_None);
- _res = Py_None;
+ _rv = GetPortBackPixPat(_self->ob_itself,
+ backPattern);
+ _res = Py_BuildValue("O&",
+ ResObj_New, _rv);
return _res;
}
-static PyObject *Qd_HidePen(PyObject *_self, PyObject *_args)
+static PyObject *GrafObj_GetPortPenPixPat(GrafPortObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
-#ifndef HidePen
- PyMac_PRECHECK(HidePen);
+ PixPatHandle _rv;
+ PixPatHandle penPattern;
+#ifndef GetPortPenPixPat
+ PyMac_PRECHECK(GetPortPenPixPat);
#endif
- if (!PyArg_ParseTuple(_args, ""))
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &penPattern))
return NULL;
- HidePen();
- Py_INCREF(Py_None);
- _res = Py_None;
+ _rv = GetPortPenPixPat(_self->ob_itself,
+ penPattern);
+ _res = Py_BuildValue("O&",
+ ResObj_New, _rv);
return _res;
}
-static PyObject *Qd_ShowPen(PyObject *_self, PyObject *_args)
+static PyObject *GrafObj_GetPortFillPixPat(GrafPortObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
-#ifndef ShowPen
- PyMac_PRECHECK(ShowPen);
+ PixPatHandle _rv;
+ PixPatHandle fillPattern;
+#ifndef GetPortFillPixPat
+ PyMac_PRECHECK(GetPortFillPixPat);
#endif
- if (!PyArg_ParseTuple(_args, ""))
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &fillPattern))
return NULL;
- ShowPen();
- Py_INCREF(Py_None);
- _res = Py_None;
+ _rv = GetPortFillPixPat(_self->ob_itself,
+ fillPattern);
+ _res = Py_BuildValue("O&",
+ ResObj_New, _rv);
return _res;
}
-static PyObject *Qd_GetPen(PyObject *_self, PyObject *_args)
+static PyObject *GrafObj_GetPortPenSize(GrafPortObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- Point pt;
-#ifndef GetPen
- PyMac_PRECHECK(GetPen);
-#endif
- if (!PyArg_ParseTuple(_args, ""))
+ Point penSize;
+#ifndef GetPortPenSize
+ PyMac_PRECHECK(GetPortPenSize);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetPoint, &penSize))
return NULL;
- GetPen(&pt);
+ GetPortPenSize(_self->ob_itself,
+ &penSize);
_res = Py_BuildValue("O&",
- PyMac_BuildPoint, pt);
+ PyMac_BuildPoint, penSize);
return _res;
}
-static PyObject *Qd_GetPenState(PyObject *_self, PyObject *_args)
+static PyObject *GrafObj_GetPortPenMode(GrafPortObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- PenState pnState__out__;
-#ifndef GetPenState
- PyMac_PRECHECK(GetPenState);
+ SInt32 _rv;
+#ifndef GetPortPenMode
+ PyMac_PRECHECK(GetPortPenMode);
#endif
if (!PyArg_ParseTuple(_args, ""))
return NULL;
- GetPenState(&pnState__out__);
- _res = Py_BuildValue("s#",
- (char *)&pnState__out__, (int)sizeof(PenState));
+ _rv = GetPortPenMode(_self->ob_itself);
+ _res = Py_BuildValue("l",
+ _rv);
return _res;
}
-static PyObject *Qd_SetPenState(PyObject *_self, PyObject *_args)
+static PyObject *GrafObj_GetPortPenLocation(GrafPortObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- PenState *pnState__in__;
- int pnState__in_len__;
-#ifndef SetPenState
- PyMac_PRECHECK(SetPenState);
+ Point penLocation;
+#ifndef GetPortPenLocation
+ PyMac_PRECHECK(GetPortPenLocation);
#endif
- if (!PyArg_ParseTuple(_args, "s#",
- (char **)&pnState__in__, &pnState__in_len__))
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetPoint, &penLocation))
return NULL;
- if (pnState__in_len__ != sizeof(PenState))
- {
- PyErr_SetString(PyExc_TypeError, "buffer length should be sizeof(PenState)");
- goto pnState__error__;
- }
- SetPenState(pnState__in__);
- Py_INCREF(Py_None);
- _res = Py_None;
- pnState__error__: ;
+ GetPortPenLocation(_self->ob_itself,
+ &penLocation);
+ _res = Py_BuildValue("O&",
+ PyMac_BuildPoint, penLocation);
return _res;
}
-static PyObject *Qd_PenSize(PyObject *_self, PyObject *_args)
+static PyObject *GrafObj_IsPortRegionBeingDefined(GrafPortObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- short width;
- short height;
-#ifndef PenSize
- PyMac_PRECHECK(PenSize);
+ Boolean _rv;
+#ifndef IsPortRegionBeingDefined
+ PyMac_PRECHECK(IsPortRegionBeingDefined);
#endif
- if (!PyArg_ParseTuple(_args, "hh",
- &width,
- &height))
+ if (!PyArg_ParseTuple(_args, ""))
return NULL;
- PenSize(width,
- height);
- Py_INCREF(Py_None);
- _res = Py_None;
+ _rv = IsPortRegionBeingDefined(_self->ob_itself);
+ _res = Py_BuildValue("b",
+ _rv);
return _res;
}
-static PyObject *Qd_PenMode(PyObject *_self, PyObject *_args)
+static PyObject *GrafObj_IsPortPictureBeingDefined(GrafPortObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- short mode;
-#ifndef PenMode
- PyMac_PRECHECK(PenMode);
+ Boolean _rv;
+#ifndef IsPortPictureBeingDefined
+ PyMac_PRECHECK(IsPortPictureBeingDefined);
#endif
- if (!PyArg_ParseTuple(_args, "h",
- &mode))
+ if (!PyArg_ParseTuple(_args, ""))
return NULL;
- PenMode(mode);
- Py_INCREF(Py_None);
- _res = Py_None;
+ _rv = IsPortPictureBeingDefined(_self->ob_itself);
+ _res = Py_BuildValue("b",
+ _rv);
return _res;
}
-static PyObject *Qd_PenPat(PyObject *_self, PyObject *_args)
+#if TARGET_API_MAC_CARBON
+
+static PyObject *GrafObj_IsPortPolyBeingDefined(GrafPortObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- Pattern *pat__in__;
- int pat__in_len__;
-#ifndef PenPat
- PyMac_PRECHECK(PenPat);
+ Boolean _rv;
+#ifndef IsPortPolyBeingDefined
+ PyMac_PRECHECK(IsPortPolyBeingDefined);
#endif
- if (!PyArg_ParseTuple(_args, "s#",
- (char **)&pat__in__, &pat__in_len__))
+ if (!PyArg_ParseTuple(_args, ""))
return NULL;
- if (pat__in_len__ != sizeof(Pattern))
- {
- PyErr_SetString(PyExc_TypeError, "buffer length should be sizeof(Pattern)");
- goto pat__error__;
- }
- PenPat(pat__in__);
- Py_INCREF(Py_None);
- _res = Py_None;
- pat__error__: ;
+ _rv = IsPortPolyBeingDefined(_self->ob_itself);
+ _res = Py_BuildValue("b",
+ _rv);
return _res;
}
+#endif
-static PyObject *Qd_PenNormal(PyObject *_self, PyObject *_args)
+#if TARGET_API_MAC_CARBON
+
+static PyObject *GrafObj_IsPortOffscreen(GrafPortObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
-#ifndef PenNormal
- PyMac_PRECHECK(PenNormal);
+ Boolean _rv;
+#ifndef IsPortOffscreen
+ PyMac_PRECHECK(IsPortOffscreen);
#endif
if (!PyArg_ParseTuple(_args, ""))
return NULL;
- PenNormal();
- Py_INCREF(Py_None);
- _res = Py_None;
+ _rv = IsPortOffscreen(_self->ob_itself);
+ _res = Py_BuildValue("b",
+ _rv);
return _res;
}
+#endif
-static PyObject *Qd_MoveTo(PyObject *_self, PyObject *_args)
+#if TARGET_API_MAC_CARBON
+
+static PyObject *GrafObj_IsPortColor(GrafPortObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- short h;
- short v;
-#ifndef MoveTo
- PyMac_PRECHECK(MoveTo);
+ Boolean _rv;
+#ifndef IsPortColor
+ PyMac_PRECHECK(IsPortColor);
#endif
- if (!PyArg_ParseTuple(_args, "hh",
- &h,
- &v))
+ if (!PyArg_ParseTuple(_args, ""))
return NULL;
- MoveTo(h,
- v);
- Py_INCREF(Py_None);
- _res = Py_None;
+ _rv = IsPortColor(_self->ob_itself);
+ _res = Py_BuildValue("b",
+ _rv);
return _res;
}
+#endif
-static PyObject *Qd_Move(PyObject *_self, PyObject *_args)
+static PyObject *GrafObj_SetPortBounds(GrafPortObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- short dh;
- short dv;
-#ifndef Move
- PyMac_PRECHECK(Move);
+ Rect rect;
+#ifndef SetPortBounds
+ PyMac_PRECHECK(SetPortBounds);
#endif
- if (!PyArg_ParseTuple(_args, "hh",
- &dh,
- &dv))
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetRect, &rect))
return NULL;
- Move(dh,
- dv);
+ SetPortBounds(_self->ob_itself,
+ &rect);
Py_INCREF(Py_None);
_res = Py_None;
return _res;
}
-static PyObject *Qd_MacLineTo(PyObject *_self, PyObject *_args)
+static PyObject *GrafObj_SetPortOpColor(GrafPortObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- short h;
- short v;
-#ifndef MacLineTo
- PyMac_PRECHECK(MacLineTo);
+ RGBColor opColor;
+#ifndef SetPortOpColor
+ PyMac_PRECHECK(SetPortOpColor);
#endif
- if (!PyArg_ParseTuple(_args, "hh",
- &h,
- &v))
+ if (!PyArg_ParseTuple(_args, "O&",
+ QdRGB_Convert, &opColor))
return NULL;
- MacLineTo(h,
- v);
+ SetPortOpColor(_self->ob_itself,
+ &opColor);
Py_INCREF(Py_None);
_res = Py_None;
return _res;
}
-static PyObject *Qd_Line(PyObject *_self, PyObject *_args)
+static PyObject *GrafObj_SetPortVisibleRegion(GrafPortObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- short dh;
- short dv;
-#ifndef Line
- PyMac_PRECHECK(Line);
+ RgnHandle visRgn;
+#ifndef SetPortVisibleRegion
+ PyMac_PRECHECK(SetPortVisibleRegion);
#endif
- if (!PyArg_ParseTuple(_args, "hh",
- &dh,
- &dv))
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &visRgn))
return NULL;
- Line(dh,
- dv);
+ SetPortVisibleRegion(_self->ob_itself,
+ visRgn);
Py_INCREF(Py_None);
_res = Py_None;
return _res;
}
-static PyObject *Qd_ForeColor(PyObject *_self, PyObject *_args)
+static PyObject *GrafObj_SetPortClipRegion(GrafPortObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- long color;
-#ifndef ForeColor
- PyMac_PRECHECK(ForeColor);
+ RgnHandle clipRgn;
+#ifndef SetPortClipRegion
+ PyMac_PRECHECK(SetPortClipRegion);
#endif
- if (!PyArg_ParseTuple(_args, "l",
- &color))
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &clipRgn))
return NULL;
- ForeColor(color);
+ SetPortClipRegion(_self->ob_itself,
+ clipRgn);
Py_INCREF(Py_None);
_res = Py_None;
return _res;
}
-static PyObject *Qd_BackColor(PyObject *_self, PyObject *_args)
+static PyObject *GrafObj_SetPortPenPixPat(GrafPortObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- long color;
-#ifndef BackColor
- PyMac_PRECHECK(BackColor);
+ PixPatHandle penPattern;
+#ifndef SetPortPenPixPat
+ PyMac_PRECHECK(SetPortPenPixPat);
#endif
- if (!PyArg_ParseTuple(_args, "l",
- &color))
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &penPattern))
return NULL;
- BackColor(color);
+ SetPortPenPixPat(_self->ob_itself,
+ penPattern);
Py_INCREF(Py_None);
_res = Py_None;
return _res;
}
-static PyObject *Qd_ColorBit(PyObject *_self, PyObject *_args)
+static PyObject *GrafObj_SetPortFillPixPat(GrafPortObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- short whichBit;
-#ifndef ColorBit
- PyMac_PRECHECK(ColorBit);
+ PixPatHandle penPattern;
+#ifndef SetPortFillPixPat
+ PyMac_PRECHECK(SetPortFillPixPat);
#endif
- if (!PyArg_ParseTuple(_args, "h",
- &whichBit))
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &penPattern))
return NULL;
- ColorBit(whichBit);
+ SetPortFillPixPat(_self->ob_itself,
+ penPattern);
Py_INCREF(Py_None);
_res = Py_None;
return _res;
}
-static PyObject *Qd_MacSetRect(PyObject *_self, PyObject *_args)
+static PyObject *GrafObj_SetPortBackPixPat(GrafPortObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- Rect r;
- short left;
- short top;
- short right;
- short bottom;
-#ifndef MacSetRect
- PyMac_PRECHECK(MacSetRect);
+ PixPatHandle backPattern;
+#ifndef SetPortBackPixPat
+ PyMac_PRECHECK(SetPortBackPixPat);
#endif
- if (!PyArg_ParseTuple(_args, "hhhh",
- &left,
- &top,
- &right,
- &bottom))
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &backPattern))
return NULL;
- MacSetRect(&r,
- left,
- top,
- right,
- bottom);
- _res = Py_BuildValue("O&",
- PyMac_BuildRect, &r);
+ SetPortBackPixPat(_self->ob_itself,
+ backPattern);
+ Py_INCREF(Py_None);
+ _res = Py_None;
return _res;
}
-static PyObject *Qd_MacOffsetRect(PyObject *_self, PyObject *_args)
+static PyObject *GrafObj_SetPortPenSize(GrafPortObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- Rect r;
- short dh;
- short dv;
-#ifndef MacOffsetRect
- PyMac_PRECHECK(MacOffsetRect);
+ Point penSize;
+#ifndef SetPortPenSize
+ PyMac_PRECHECK(SetPortPenSize);
#endif
- if (!PyArg_ParseTuple(_args, "O&hh",
- PyMac_GetRect, &r,
- &dh,
- &dv))
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetPoint, &penSize))
return NULL;
- MacOffsetRect(&r,
- dh,
- dv);
- _res = Py_BuildValue("O&",
- PyMac_BuildRect, &r);
+ SetPortPenSize(_self->ob_itself,
+ penSize);
+ Py_INCREF(Py_None);
+ _res = Py_None;
return _res;
}
-static PyObject *Qd_MacInsetRect(PyObject *_self, PyObject *_args)
+static PyObject *GrafObj_SetPortPenMode(GrafPortObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- Rect r;
- short dh;
- short dv;
-#ifndef MacInsetRect
- PyMac_PRECHECK(MacInsetRect);
+ SInt32 penMode;
+#ifndef SetPortPenMode
+ PyMac_PRECHECK(SetPortPenMode);
#endif
- if (!PyArg_ParseTuple(_args, "O&hh",
- PyMac_GetRect, &r,
- &dh,
- &dv))
+ if (!PyArg_ParseTuple(_args, "l",
+ &penMode))
return NULL;
- MacInsetRect(&r,
- dh,
- dv);
- _res = Py_BuildValue("O&",
- PyMac_BuildRect, &r);
+ SetPortPenMode(_self->ob_itself,
+ penMode);
+ Py_INCREF(Py_None);
+ _res = Py_None;
return _res;
}
-static PyObject *Qd_SectRect(PyObject *_self, PyObject *_args)
+static PyObject *GrafObj_SetPortFracHPenLocation(GrafPortObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- Boolean _rv;
- Rect src1;
- Rect src2;
- Rect dstRect;
-#ifndef SectRect
- PyMac_PRECHECK(SectRect);
+ short pnLocHFrac;
+#ifndef SetPortFracHPenLocation
+ PyMac_PRECHECK(SetPortFracHPenLocation);
#endif
- if (!PyArg_ParseTuple(_args, "O&O&",
- PyMac_GetRect, &src1,
- PyMac_GetRect, &src2))
+ if (!PyArg_ParseTuple(_args, "h",
+ &pnLocHFrac))
return NULL;
- _rv = SectRect(&src1,
- &src2,
- &dstRect);
- _res = Py_BuildValue("bO&",
- _rv,
- PyMac_BuildRect, &dstRect);
+ SetPortFracHPenLocation(_self->ob_itself,
+ pnLocHFrac);
+ Py_INCREF(Py_None);
+ _res = Py_None;
return _res;
}
-static PyObject *Qd_MacUnionRect(PyObject *_self, PyObject *_args)
+#if TARGET_API_MAC_CARBON
+
+static PyObject *GrafObj_DisposePort(GrafPortObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- Rect src1;
- Rect src2;
- Rect dstRect;
-#ifndef MacUnionRect
- PyMac_PRECHECK(MacUnionRect);
+#ifndef DisposePort
+ PyMac_PRECHECK(DisposePort);
#endif
- if (!PyArg_ParseTuple(_args, "O&O&",
- PyMac_GetRect, &src1,
- PyMac_GetRect, &src2))
+ if (!PyArg_ParseTuple(_args, ""))
return NULL;
- MacUnionRect(&src1,
- &src2,
- &dstRect);
- _res = Py_BuildValue("O&",
- PyMac_BuildRect, &dstRect);
+ DisposePort(_self->ob_itself);
+ Py_INCREF(Py_None);
+ _res = Py_None;
return _res;
}
+#endif
-static PyObject *Qd_MacEqualRect(PyObject *_self, PyObject *_args)
+static PyObject *GrafObj_QDIsPortBuffered(GrafPortObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
Boolean _rv;
- Rect rect1;
- Rect rect2;
-#ifndef MacEqualRect
- PyMac_PRECHECK(MacEqualRect);
+#ifndef QDIsPortBuffered
+ PyMac_PRECHECK(QDIsPortBuffered);
#endif
- if (!PyArg_ParseTuple(_args, "O&O&",
- PyMac_GetRect, &rect1,
- PyMac_GetRect, &rect2))
+ if (!PyArg_ParseTuple(_args, ""))
return NULL;
- _rv = MacEqualRect(&rect1,
- &rect2);
+ _rv = QDIsPortBuffered(_self->ob_itself);
_res = Py_BuildValue("b",
_rv);
return _res;
}
-static PyObject *Qd_EmptyRect(PyObject *_self, PyObject *_args)
+static PyObject *GrafObj_QDIsPortBufferDirty(GrafPortObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
Boolean _rv;
- Rect r;
-#ifndef EmptyRect
- PyMac_PRECHECK(EmptyRect);
+#ifndef QDIsPortBufferDirty
+ PyMac_PRECHECK(QDIsPortBufferDirty);
#endif
- if (!PyArg_ParseTuple(_args, "O&",
- PyMac_GetRect, &r))
+ if (!PyArg_ParseTuple(_args, ""))
return NULL;
- _rv = EmptyRect(&r);
+ _rv = QDIsPortBufferDirty(_self->ob_itself);
_res = Py_BuildValue("b",
_rv);
return _res;
}
-static PyObject *Qd_MacFrameRect(PyObject *_self, PyObject *_args)
+static PyObject *GrafObj_QDFlushPortBuffer(GrafPortObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ RgnHandle region;
+#ifndef QDFlushPortBuffer
+ PyMac_PRECHECK(QDFlushPortBuffer);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ OptResObj_Convert, ®ion))
+ return NULL;
+ QDFlushPortBuffer(_self->ob_itself,
+ region);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+#if TARGET_API_MAC_CARBON
+
+static PyObject *GrafObj_QDGetDirtyRegion(GrafPortObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ RgnHandle rgn;
+#ifndef QDGetDirtyRegion
+ PyMac_PRECHECK(QDGetDirtyRegion);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &rgn))
+ return NULL;
+ _err = QDGetDirtyRegion(_self->ob_itself,
+ rgn);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+#endif
+
+#if TARGET_API_MAC_CARBON
+
+static PyObject *GrafObj_QDSetDirtyRegion(GrafPortObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ RgnHandle rgn;
+#ifndef QDSetDirtyRegion
+ PyMac_PRECHECK(QDSetDirtyRegion);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &rgn))
+ return NULL;
+ _err = QDSetDirtyRegion(_self->ob_itself,
+ rgn);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+#endif
+
+static PyMethodDef GrafObj_methods[] = {
+ {"MacSetPort", (PyCFunction)GrafObj_MacSetPort, 1,
+ PyDoc_STR("() -> None")},
+
+#if TARGET_API_MAC_CARBON
+ {"IsValidPort", (PyCFunction)GrafObj_IsValidPort, 1,
+ PyDoc_STR("() -> (Boolean _rv)")},
+#endif
+ {"GetPortPixMap", (PyCFunction)GrafObj_GetPortPixMap, 1,
+ PyDoc_STR("() -> (PixMapHandle _rv)")},
+ {"GetPortBitMapForCopyBits", (PyCFunction)GrafObj_GetPortBitMapForCopyBits, 1,
+ PyDoc_STR("() -> (const BitMap * _rv)")},
+ {"GetPortBounds", (PyCFunction)GrafObj_GetPortBounds, 1,
+ PyDoc_STR("() -> (Rect rect)")},
+ {"GetPortForeColor", (PyCFunction)GrafObj_GetPortForeColor, 1,
+ PyDoc_STR("() -> (RGBColor foreColor)")},
+ {"GetPortBackColor", (PyCFunction)GrafObj_GetPortBackColor, 1,
+ PyDoc_STR("() -> (RGBColor backColor)")},
+ {"GetPortOpColor", (PyCFunction)GrafObj_GetPortOpColor, 1,
+ PyDoc_STR("() -> (RGBColor opColor)")},
+ {"GetPortHiliteColor", (PyCFunction)GrafObj_GetPortHiliteColor, 1,
+ PyDoc_STR("() -> (RGBColor hiliteColor)")},
+ {"GetPortTextFont", (PyCFunction)GrafObj_GetPortTextFont, 1,
+ PyDoc_STR("() -> (short _rv)")},
+ {"GetPortTextFace", (PyCFunction)GrafObj_GetPortTextFace, 1,
+ PyDoc_STR("() -> (Style _rv)")},
+ {"GetPortTextMode", (PyCFunction)GrafObj_GetPortTextMode, 1,
+ PyDoc_STR("() -> (short _rv)")},
+ {"GetPortTextSize", (PyCFunction)GrafObj_GetPortTextSize, 1,
+ PyDoc_STR("() -> (short _rv)")},
+ {"GetPortChExtra", (PyCFunction)GrafObj_GetPortChExtra, 1,
+ PyDoc_STR("() -> (short _rv)")},
+ {"GetPortFracHPenLocation", (PyCFunction)GrafObj_GetPortFracHPenLocation, 1,
+ PyDoc_STR("() -> (short _rv)")},
+ {"GetPortSpExtra", (PyCFunction)GrafObj_GetPortSpExtra, 1,
+ PyDoc_STR("() -> (Fixed _rv)")},
+ {"GetPortPenVisibility", (PyCFunction)GrafObj_GetPortPenVisibility, 1,
+ PyDoc_STR("() -> (short _rv)")},
+ {"GetPortVisibleRegion", (PyCFunction)GrafObj_GetPortVisibleRegion, 1,
+ PyDoc_STR("(RgnHandle visRgn) -> (RgnHandle _rv)")},
+ {"GetPortClipRegion", (PyCFunction)GrafObj_GetPortClipRegion, 1,
+ PyDoc_STR("(RgnHandle clipRgn) -> (RgnHandle _rv)")},
+ {"GetPortBackPixPat", (PyCFunction)GrafObj_GetPortBackPixPat, 1,
+ PyDoc_STR("(PixPatHandle backPattern) -> (PixPatHandle _rv)")},
+ {"GetPortPenPixPat", (PyCFunction)GrafObj_GetPortPenPixPat, 1,
+ PyDoc_STR("(PixPatHandle penPattern) -> (PixPatHandle _rv)")},
+ {"GetPortFillPixPat", (PyCFunction)GrafObj_GetPortFillPixPat, 1,
+ PyDoc_STR("(PixPatHandle fillPattern) -> (PixPatHandle _rv)")},
+ {"GetPortPenSize", (PyCFunction)GrafObj_GetPortPenSize, 1,
+ PyDoc_STR("(Point penSize) -> (Point penSize)")},
+ {"GetPortPenMode", (PyCFunction)GrafObj_GetPortPenMode, 1,
+ PyDoc_STR("() -> (SInt32 _rv)")},
+ {"GetPortPenLocation", (PyCFunction)GrafObj_GetPortPenLocation, 1,
+ PyDoc_STR("(Point penLocation) -> (Point penLocation)")},
+ {"IsPortRegionBeingDefined", (PyCFunction)GrafObj_IsPortRegionBeingDefined, 1,
+ PyDoc_STR("() -> (Boolean _rv)")},
+ {"IsPortPictureBeingDefined", (PyCFunction)GrafObj_IsPortPictureBeingDefined, 1,
+ PyDoc_STR("() -> (Boolean _rv)")},
+
+#if TARGET_API_MAC_CARBON
+ {"IsPortPolyBeingDefined", (PyCFunction)GrafObj_IsPortPolyBeingDefined, 1,
+ PyDoc_STR("() -> (Boolean _rv)")},
+#endif
+
+#if TARGET_API_MAC_CARBON
+ {"IsPortOffscreen", (PyCFunction)GrafObj_IsPortOffscreen, 1,
+ PyDoc_STR("() -> (Boolean _rv)")},
+#endif
+
+#if TARGET_API_MAC_CARBON
+ {"IsPortColor", (PyCFunction)GrafObj_IsPortColor, 1,
+ PyDoc_STR("() -> (Boolean _rv)")},
+#endif
+ {"SetPortBounds", (PyCFunction)GrafObj_SetPortBounds, 1,
+ PyDoc_STR("(Rect rect) -> None")},
+ {"SetPortOpColor", (PyCFunction)GrafObj_SetPortOpColor, 1,
+ PyDoc_STR("(RGBColor opColor) -> None")},
+ {"SetPortVisibleRegion", (PyCFunction)GrafObj_SetPortVisibleRegion, 1,
+ PyDoc_STR("(RgnHandle visRgn) -> None")},
+ {"SetPortClipRegion", (PyCFunction)GrafObj_SetPortClipRegion, 1,
+ PyDoc_STR("(RgnHandle clipRgn) -> None")},
+ {"SetPortPenPixPat", (PyCFunction)GrafObj_SetPortPenPixPat, 1,
+ PyDoc_STR("(PixPatHandle penPattern) -> None")},
+ {"SetPortFillPixPat", (PyCFunction)GrafObj_SetPortFillPixPat, 1,
+ PyDoc_STR("(PixPatHandle penPattern) -> None")},
+ {"SetPortBackPixPat", (PyCFunction)GrafObj_SetPortBackPixPat, 1,
+ PyDoc_STR("(PixPatHandle backPattern) -> None")},
+ {"SetPortPenSize", (PyCFunction)GrafObj_SetPortPenSize, 1,
+ PyDoc_STR("(Point penSize) -> None")},
+ {"SetPortPenMode", (PyCFunction)GrafObj_SetPortPenMode, 1,
+ PyDoc_STR("(SInt32 penMode) -> None")},
+ {"SetPortFracHPenLocation", (PyCFunction)GrafObj_SetPortFracHPenLocation, 1,
+ PyDoc_STR("(short pnLocHFrac) -> None")},
+
+#if TARGET_API_MAC_CARBON
+ {"DisposePort", (PyCFunction)GrafObj_DisposePort, 1,
+ PyDoc_STR("() -> None")},
+#endif
+ {"QDIsPortBuffered", (PyCFunction)GrafObj_QDIsPortBuffered, 1,
+ PyDoc_STR("() -> (Boolean _rv)")},
+ {"QDIsPortBufferDirty", (PyCFunction)GrafObj_QDIsPortBufferDirty, 1,
+ PyDoc_STR("() -> (Boolean _rv)")},
+ {"QDFlushPortBuffer", (PyCFunction)GrafObj_QDFlushPortBuffer, 1,
+ PyDoc_STR("(RgnHandle region) -> None")},
+
+#if TARGET_API_MAC_CARBON
+ {"QDGetDirtyRegion", (PyCFunction)GrafObj_QDGetDirtyRegion, 1,
+ PyDoc_STR("(RgnHandle rgn) -> None")},
+#endif
+
+#if TARGET_API_MAC_CARBON
+ {"QDSetDirtyRegion", (PyCFunction)GrafObj_QDSetDirtyRegion, 1,
+ PyDoc_STR("(RgnHandle rgn) -> None")},
+#endif
+ {NULL, NULL, 0}
+};
+
+static PyObject *GrafObj_get_visRgn(GrafPortObject *self, void *closure)
+{
+ RgnHandle h=NewRgn(); /* XXXX wrong dispose routine */
+ return Py_BuildValue("O&", ResObj_New, (Handle)GetPortVisibleRegion(self->ob_itself, h));
+
+}
+
+#define GrafObj_set_visRgn NULL
+
+static PyObject *GrafObj_get_clipRgn(GrafPortObject *self, void *closure)
+{
+ RgnHandle h=NewRgn(); /* XXXX wrong dispose routine */
+ return Py_BuildValue("O&", ResObj_New, (Handle)GetPortClipRegion(self->ob_itself, h));
+
+}
+
+#define GrafObj_set_clipRgn NULL
+
+static PyGetSetDef GrafObj_getsetlist[] = {
+ {"visRgn", (getter)GrafObj_get_visRgn, (setter)GrafObj_set_visRgn, "Convenience attribute: return a copy of the visible region"},
+ {"clipRgn", (getter)GrafObj_get_clipRgn, (setter)GrafObj_set_clipRgn, "Convenience attribute: return a copy of the clipping region"},
+ {NULL, NULL, NULL, NULL},
+};
+
+
+#define GrafObj_compare NULL
+
+#define GrafObj_repr NULL
+
+#define GrafObj_hash NULL
+
+PyTypeObject GrafPort_Type = {
+ PyObject_HEAD_INIT(NULL)
+ 0, /*ob_size*/
+ "_Qd.GrafPort", /*tp_name*/
+ sizeof(GrafPortObject), /*tp_basicsize*/
+ 0, /*tp_itemsize*/
+ /* methods */
+ (destructor) GrafObj_dealloc, /*tp_dealloc*/
+ 0, /*tp_print*/
+ (getattrfunc)0, /*tp_getattr*/
+ (setattrfunc)0, /*tp_setattr*/
+ (cmpfunc) GrafObj_compare, /*tp_compare*/
+ (reprfunc) GrafObj_repr, /*tp_repr*/
+ (PyNumberMethods *)0, /* tp_as_number */
+ (PySequenceMethods *)0, /* tp_as_sequence */
+ (PyMappingMethods *)0, /* tp_as_mapping */
+ (hashfunc) GrafObj_hash, /*tp_hash*/
+ 0, /*tp_call*/
+ 0, /*tp_str*/
+ PyObject_GenericGetAttr, /*tp_getattro*/
+ PyObject_GenericSetAttr, /*tp_setattro */
+ 0, /*outputHook_tp_as_buffer*/
+ 0, /*outputHook_tp_flags*/
+ 0, /*outputHook_tp_doc*/
+ 0, /*outputHook_tp_traverse*/
+ 0, /*outputHook_tp_clear*/
+ 0, /*outputHook_tp_richcompare*/
+ 0, /*outputHook_tp_weaklistoffset*/
+ 0, /*outputHook_tp_iter*/
+ 0, /*outputHook_tp_iternext*/
+ GrafObj_methods, /* tp_methods */
+ 0, /*outputHook_tp_members*/
+ GrafObj_getsetlist, /*tp_getset*/
+ 0, /*outputHook_tp_base*/
+};
+
+/* -------------------- End object type GrafPort -------------------- */
+
+
+/* ----------------------- Object type BitMap ----------------------- */
+
+PyTypeObject BitMap_Type;
+
+#define BMObj_Check(x) ((x)->ob_type == &BitMap_Type)
+
+typedef struct BitMapObject {
+ PyObject_HEAD
+ BitMapPtr ob_itself;
+ PyObject *referred_object;
+ BitMap *referred_bitmap;
+} BitMapObject;
+
+PyObject *BMObj_New(BitMapPtr itself)
+{
+ BitMapObject *it;
+ if (itself == NULL) return PyMac_Error(resNotFound);
+ it = PyObject_NEW(BitMapObject, &BitMap_Type);
+ if (it == NULL) return NULL;
+ it->ob_itself = itself;
+ it->referred_object = NULL;
+ it->referred_bitmap = NULL;
+ return (PyObject *)it;
+}
+int BMObj_Convert(PyObject *v, BitMapPtr *p_itself)
+{
+ if (!BMObj_Check(v))
+ {
+ PyErr_SetString(PyExc_TypeError, "BitMap required");
+ return 0;
+ }
+ *p_itself = ((BitMapObject *)v)->ob_itself;
+ return 1;
+}
+
+static void BMObj_dealloc(BitMapObject *self)
+{
+ Py_XDECREF(self->referred_object);
+ if (self->referred_bitmap) free(self->referred_bitmap);
+ PyObject_Del(self);
+}
+
+static PyObject *BMObj_getdata(BitMapObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+
+ int from, length;
+ char *cp;
+
+ if ( !PyArg_ParseTuple(_args, "ii", &from, &length) )
+ return NULL;
+ cp = _self->ob_itself->baseAddr+from;
+ _res = PyString_FromStringAndSize(cp, length);
+ return _res;
+
+}
+
+static PyObject *BMObj_putdata(BitMapObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+
+ int from, length;
+ char *cp, *icp;
+
+ if ( !PyArg_ParseTuple(_args, "is#", &from, &icp, &length) )
+ return NULL;
+ cp = _self->ob_itself->baseAddr+from;
+ memcpy(cp, icp, length);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+
+}
+
+static PyMethodDef BMObj_methods[] = {
+ {"getdata", (PyCFunction)BMObj_getdata, 1,
+ PyDoc_STR("(int start, int size) -> string. Return bytes from the bitmap")},
+ {"putdata", (PyCFunction)BMObj_putdata, 1,
+ PyDoc_STR("(int start, string data). Store bytes into the bitmap")},
+ {NULL, NULL, 0}
+};
+
+static PyObject *BMObj_get_baseAddr(BitMapObject *self, void *closure)
+{
+ return PyInt_FromLong((long)self->ob_itself->baseAddr);
+}
+
+#define BMObj_set_baseAddr NULL
+
+static PyObject *BMObj_get_rowBytes(BitMapObject *self, void *closure)
+{
+ return PyInt_FromLong((long)self->ob_itself->rowBytes);
+}
+
+#define BMObj_set_rowBytes NULL
+
+static PyObject *BMObj_get_bounds(BitMapObject *self, void *closure)
+{
+ return Py_BuildValue("O&", PyMac_BuildRect, &self->ob_itself->bounds);
+}
+
+#define BMObj_set_bounds NULL
+
+static PyObject *BMObj_get_bitmap_data(BitMapObject *self, void *closure)
+{
+ return PyString_FromStringAndSize((char *)self->ob_itself, sizeof(BitMap));
+}
+
+#define BMObj_set_bitmap_data NULL
+
+static PyObject *BMObj_get_pixmap_data(BitMapObject *self, void *closure)
+{
+ return PyString_FromStringAndSize((char *)self->ob_itself, sizeof(PixMap));
+}
+
+#define BMObj_set_pixmap_data NULL
+
+static PyGetSetDef BMObj_getsetlist[] = {
+ {"baseAddr", (getter)BMObj_get_baseAddr, (setter)BMObj_set_baseAddr, NULL},
+ {"rowBytes", (getter)BMObj_get_rowBytes, (setter)BMObj_set_rowBytes, NULL},
+ {"bounds", (getter)BMObj_get_bounds, (setter)BMObj_set_bounds, NULL},
+ {"bitmap_data", (getter)BMObj_get_bitmap_data, (setter)BMObj_set_bitmap_data, NULL},
+ {"pixmap_data", (getter)BMObj_get_pixmap_data, (setter)BMObj_set_pixmap_data, NULL},
+ {NULL, NULL, NULL, NULL},
+};
+
+
+#define BMObj_compare NULL
+
+#define BMObj_repr NULL
+
+#define BMObj_hash NULL
+
+PyTypeObject BitMap_Type = {
+ PyObject_HEAD_INIT(NULL)
+ 0, /*ob_size*/
+ "_Qd.BitMap", /*tp_name*/
+ sizeof(BitMapObject), /*tp_basicsize*/
+ 0, /*tp_itemsize*/
+ /* methods */
+ (destructor) BMObj_dealloc, /*tp_dealloc*/
+ 0, /*tp_print*/
+ (getattrfunc)0, /*tp_getattr*/
+ (setattrfunc)0, /*tp_setattr*/
+ (cmpfunc) BMObj_compare, /*tp_compare*/
+ (reprfunc) BMObj_repr, /*tp_repr*/
+ (PyNumberMethods *)0, /* tp_as_number */
+ (PySequenceMethods *)0, /* tp_as_sequence */
+ (PyMappingMethods *)0, /* tp_as_mapping */
+ (hashfunc) BMObj_hash, /*tp_hash*/
+ 0, /*tp_call*/
+ 0, /*tp_str*/
+ PyObject_GenericGetAttr, /*tp_getattro*/
+ PyObject_GenericSetAttr, /*tp_setattro */
+ 0, /*outputHook_tp_as_buffer*/
+ 0, /*outputHook_tp_flags*/
+ 0, /*outputHook_tp_doc*/
+ 0, /*outputHook_tp_traverse*/
+ 0, /*outputHook_tp_clear*/
+ 0, /*outputHook_tp_richcompare*/
+ 0, /*outputHook_tp_weaklistoffset*/
+ 0, /*outputHook_tp_iter*/
+ 0, /*outputHook_tp_iternext*/
+ BMObj_methods, /* tp_methods */
+ 0, /*outputHook_tp_members*/
+ BMObj_getsetlist, /*tp_getset*/
+ 0, /*outputHook_tp_base*/
+};
+
+/* --------------------- End object type BitMap --------------------- */
+
+
+static PyObject *Qd_GetPort(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- Rect r;
-#ifndef MacFrameRect
- PyMac_PRECHECK(MacFrameRect);
+ GrafPtr port;
+#ifndef GetPort
+ PyMac_PRECHECK(GetPort);
#endif
- if (!PyArg_ParseTuple(_args, "O&",
- PyMac_GetRect, &r))
+ if (!PyArg_ParseTuple(_args, ""))
return NULL;
- MacFrameRect(&r);
- Py_INCREF(Py_None);
- _res = Py_None;
+ GetPort(&port);
+ _res = Py_BuildValue("O&",
+ GrafObj_New, port);
return _res;
}
-static PyObject *Qd_PaintRect(PyObject *_self, PyObject *_args)
+static PyObject *Qd_GrafDevice(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- Rect r;
-#ifndef PaintRect
- PyMac_PRECHECK(PaintRect);
+ short device;
+#ifndef GrafDevice
+ PyMac_PRECHECK(GrafDevice);
#endif
- if (!PyArg_ParseTuple(_args, "O&",
- PyMac_GetRect, &r))
+ if (!PyArg_ParseTuple(_args, "h",
+ &device))
return NULL;
- PaintRect(&r);
+ GrafDevice(device);
Py_INCREF(Py_None);
_res = Py_None;
return _res;
}
-static PyObject *Qd_EraseRect(PyObject *_self, PyObject *_args)
+static PyObject *Qd_SetPortBits(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- Rect r;
-#ifndef EraseRect
- PyMac_PRECHECK(EraseRect);
+ BitMapPtr bm;
+#ifndef SetPortBits
+ PyMac_PRECHECK(SetPortBits);
#endif
if (!PyArg_ParseTuple(_args, "O&",
- PyMac_GetRect, &r))
+ BMObj_Convert, &bm))
return NULL;
- EraseRect(&r);
+ SetPortBits(bm);
Py_INCREF(Py_None);
_res = Py_None;
return _res;
}
-static PyObject *Qd_MacInvertRect(PyObject *_self, PyObject *_args)
+static PyObject *Qd_PortSize(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- Rect r;
-#ifndef MacInvertRect
- PyMac_PRECHECK(MacInvertRect);
+ short width;
+ short height;
+#ifndef PortSize
+ PyMac_PRECHECK(PortSize);
#endif
- if (!PyArg_ParseTuple(_args, "O&",
- PyMac_GetRect, &r))
+ if (!PyArg_ParseTuple(_args, "hh",
+ &width,
+ &height))
return NULL;
- MacInvertRect(&r);
+ PortSize(width,
+ height);
Py_INCREF(Py_None);
_res = Py_None;
return _res;
}
-static PyObject *Qd_MacFillRect(PyObject *_self, PyObject *_args)
+static PyObject *Qd_MovePortTo(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- Rect r;
- Pattern *pat__in__;
- int pat__in_len__;
-#ifndef MacFillRect
- PyMac_PRECHECK(MacFillRect);
+ short leftGlobal;
+ short topGlobal;
+#ifndef MovePortTo
+ PyMac_PRECHECK(MovePortTo);
#endif
- if (!PyArg_ParseTuple(_args, "O&s#",
- PyMac_GetRect, &r,
- (char **)&pat__in__, &pat__in_len__))
+ if (!PyArg_ParseTuple(_args, "hh",
+ &leftGlobal,
+ &topGlobal))
return NULL;
- if (pat__in_len__ != sizeof(Pattern))
- {
- PyErr_SetString(PyExc_TypeError, "buffer length should be sizeof(Pattern)");
- goto pat__error__;
- }
- MacFillRect(&r,
- pat__in__);
+ MovePortTo(leftGlobal,
+ topGlobal);
Py_INCREF(Py_None);
_res = Py_None;
- pat__error__: ;
return _res;
}
-static PyObject *Qd_FrameOval(PyObject *_self, PyObject *_args)
+static PyObject *Qd_SetOrigin(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- Rect r;
-#ifndef FrameOval
- PyMac_PRECHECK(FrameOval);
+ short h;
+ short v;
+#ifndef SetOrigin
+ PyMac_PRECHECK(SetOrigin);
#endif
- if (!PyArg_ParseTuple(_args, "O&",
- PyMac_GetRect, &r))
+ if (!PyArg_ParseTuple(_args, "hh",
+ &h,
+ &v))
return NULL;
- FrameOval(&r);
+ SetOrigin(h,
+ v);
Py_INCREF(Py_None);
_res = Py_None;
return _res;
}
-static PyObject *Qd_PaintOval(PyObject *_self, PyObject *_args)
+static PyObject *Qd_SetClip(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- Rect r;
-#ifndef PaintOval
- PyMac_PRECHECK(PaintOval);
+ RgnHandle rgn;
+#ifndef SetClip
+ PyMac_PRECHECK(SetClip);
#endif
if (!PyArg_ParseTuple(_args, "O&",
- PyMac_GetRect, &r))
+ ResObj_Convert, &rgn))
return NULL;
- PaintOval(&r);
+ SetClip(rgn);
Py_INCREF(Py_None);
_res = Py_None;
return _res;
}
-static PyObject *Qd_EraseOval(PyObject *_self, PyObject *_args)
+static PyObject *Qd_GetClip(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- Rect r;
-#ifndef EraseOval
- PyMac_PRECHECK(EraseOval);
+ RgnHandle rgn;
+#ifndef GetClip
+ PyMac_PRECHECK(GetClip);
#endif
if (!PyArg_ParseTuple(_args, "O&",
- PyMac_GetRect, &r))
+ ResObj_Convert, &rgn))
return NULL;
- EraseOval(&r);
+ GetClip(rgn);
Py_INCREF(Py_None);
_res = Py_None;
return _res;
}
-static PyObject *Qd_InvertOval(PyObject *_self, PyObject *_args)
+static PyObject *Qd_ClipRect(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
Rect r;
-#ifndef InvertOval
- PyMac_PRECHECK(InvertOval);
+#ifndef ClipRect
+ PyMac_PRECHECK(ClipRect);
#endif
if (!PyArg_ParseTuple(_args, "O&",
PyMac_GetRect, &r))
return NULL;
- InvertOval(&r);
+ ClipRect(&r);
Py_INCREF(Py_None);
_res = Py_None;
return _res;
}
-static PyObject *Qd_FillOval(PyObject *_self, PyObject *_args)
+static PyObject *Qd_BackPat(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- Rect r;
Pattern *pat__in__;
int pat__in_len__;
-#ifndef FillOval
- PyMac_PRECHECK(FillOval);
+#ifndef BackPat
+ PyMac_PRECHECK(BackPat);
#endif
- if (!PyArg_ParseTuple(_args, "O&s#",
- PyMac_GetRect, &r,
+ if (!PyArg_ParseTuple(_args, "s#",
(char **)&pat__in__, &pat__in_len__))
return NULL;
if (pat__in_len__ != sizeof(Pattern))
PyErr_SetString(PyExc_TypeError, "buffer length should be sizeof(Pattern)");
goto pat__error__;
}
- FillOval(&r,
- pat__in__);
+ BackPat(pat__in__);
Py_INCREF(Py_None);
_res = Py_None;
pat__error__: ;
return _res;
}
-static PyObject *Qd_FrameRoundRect(PyObject *_self, PyObject *_args)
-{
- PyObject *_res = NULL;
- Rect r;
- short ovalWidth;
- short ovalHeight;
-#ifndef FrameRoundRect
- PyMac_PRECHECK(FrameRoundRect);
-#endif
- if (!PyArg_ParseTuple(_args, "O&hh",
- PyMac_GetRect, &r,
- &ovalWidth,
- &ovalHeight))
- return NULL;
- FrameRoundRect(&r,
- ovalWidth,
- ovalHeight);
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
-}
-
-static PyObject *Qd_PaintRoundRect(PyObject *_self, PyObject *_args)
-{
- PyObject *_res = NULL;
- Rect r;
- short ovalWidth;
- short ovalHeight;
-#ifndef PaintRoundRect
- PyMac_PRECHECK(PaintRoundRect);
-#endif
- if (!PyArg_ParseTuple(_args, "O&hh",
- PyMac_GetRect, &r,
- &ovalWidth,
- &ovalHeight))
- return NULL;
- PaintRoundRect(&r,
- ovalWidth,
- ovalHeight);
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
-}
-
-static PyObject *Qd_EraseRoundRect(PyObject *_self, PyObject *_args)
-{
- PyObject *_res = NULL;
- Rect r;
- short ovalWidth;
- short ovalHeight;
-#ifndef EraseRoundRect
- PyMac_PRECHECK(EraseRoundRect);
-#endif
- if (!PyArg_ParseTuple(_args, "O&hh",
- PyMac_GetRect, &r,
- &ovalWidth,
- &ovalHeight))
- return NULL;
- EraseRoundRect(&r,
- ovalWidth,
- ovalHeight);
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
-}
-
-static PyObject *Qd_InvertRoundRect(PyObject *_self, PyObject *_args)
-{
- PyObject *_res = NULL;
- Rect r;
- short ovalWidth;
- short ovalHeight;
-#ifndef InvertRoundRect
- PyMac_PRECHECK(InvertRoundRect);
+static PyObject *Qd_InitCursor(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+#ifndef InitCursor
+ PyMac_PRECHECK(InitCursor);
#endif
- if (!PyArg_ParseTuple(_args, "O&hh",
- PyMac_GetRect, &r,
- &ovalWidth,
- &ovalHeight))
+ if (!PyArg_ParseTuple(_args, ""))
return NULL;
- InvertRoundRect(&r,
- ovalWidth,
- ovalHeight);
+ InitCursor();
Py_INCREF(Py_None);
_res = Py_None;
return _res;
}
-static PyObject *Qd_FillRoundRect(PyObject *_self, PyObject *_args)
+static PyObject *Qd_MacSetCursor(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- Rect r;
- short ovalWidth;
- short ovalHeight;
- Pattern *pat__in__;
- int pat__in_len__;
-#ifndef FillRoundRect
- PyMac_PRECHECK(FillRoundRect);
+ Cursor *crsr__in__;
+ int crsr__in_len__;
+#ifndef MacSetCursor
+ PyMac_PRECHECK(MacSetCursor);
#endif
- if (!PyArg_ParseTuple(_args, "O&hhs#",
- PyMac_GetRect, &r,
- &ovalWidth,
- &ovalHeight,
- (char **)&pat__in__, &pat__in_len__))
+ if (!PyArg_ParseTuple(_args, "s#",
+ (char **)&crsr__in__, &crsr__in_len__))
return NULL;
- if (pat__in_len__ != sizeof(Pattern))
+ if (crsr__in_len__ != sizeof(Cursor))
{
- PyErr_SetString(PyExc_TypeError, "buffer length should be sizeof(Pattern)");
- goto pat__error__;
+ PyErr_SetString(PyExc_TypeError, "buffer length should be sizeof(Cursor)");
+ goto crsr__error__;
}
- FillRoundRect(&r,
- ovalWidth,
- ovalHeight,
- pat__in__);
+ MacSetCursor(crsr__in__);
Py_INCREF(Py_None);
_res = Py_None;
- pat__error__: ;
+ crsr__error__: ;
return _res;
}
-static PyObject *Qd_FrameArc(PyObject *_self, PyObject *_args)
+static PyObject *Qd_HideCursor(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- Rect r;
- short startAngle;
- short arcAngle;
-#ifndef FrameArc
- PyMac_PRECHECK(FrameArc);
+#ifndef HideCursor
+ PyMac_PRECHECK(HideCursor);
#endif
- if (!PyArg_ParseTuple(_args, "O&hh",
- PyMac_GetRect, &r,
- &startAngle,
- &arcAngle))
+ if (!PyArg_ParseTuple(_args, ""))
return NULL;
- FrameArc(&r,
- startAngle,
- arcAngle);
+ HideCursor();
Py_INCREF(Py_None);
_res = Py_None;
return _res;
}
-static PyObject *Qd_PaintArc(PyObject *_self, PyObject *_args)
+static PyObject *Qd_MacShowCursor(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- Rect r;
- short startAngle;
- short arcAngle;
-#ifndef PaintArc
- PyMac_PRECHECK(PaintArc);
+#ifndef MacShowCursor
+ PyMac_PRECHECK(MacShowCursor);
#endif
- if (!PyArg_ParseTuple(_args, "O&hh",
- PyMac_GetRect, &r,
- &startAngle,
- &arcAngle))
+ if (!PyArg_ParseTuple(_args, ""))
return NULL;
- PaintArc(&r,
- startAngle,
- arcAngle);
+ MacShowCursor();
Py_INCREF(Py_None);
_res = Py_None;
return _res;
}
-static PyObject *Qd_EraseArc(PyObject *_self, PyObject *_args)
+static PyObject *Qd_ObscureCursor(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- Rect r;
- short startAngle;
- short arcAngle;
-#ifndef EraseArc
- PyMac_PRECHECK(EraseArc);
+#ifndef ObscureCursor
+ PyMac_PRECHECK(ObscureCursor);
#endif
- if (!PyArg_ParseTuple(_args, "O&hh",
- PyMac_GetRect, &r,
- &startAngle,
- &arcAngle))
+ if (!PyArg_ParseTuple(_args, ""))
return NULL;
- EraseArc(&r,
- startAngle,
- arcAngle);
+ ObscureCursor();
Py_INCREF(Py_None);
_res = Py_None;
return _res;
}
-static PyObject *Qd_InvertArc(PyObject *_self, PyObject *_args)
+static PyObject *Qd_HidePen(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- Rect r;
- short startAngle;
- short arcAngle;
-#ifndef InvertArc
- PyMac_PRECHECK(InvertArc);
+#ifndef HidePen
+ PyMac_PRECHECK(HidePen);
#endif
- if (!PyArg_ParseTuple(_args, "O&hh",
- PyMac_GetRect, &r,
- &startAngle,
- &arcAngle))
+ if (!PyArg_ParseTuple(_args, ""))
return NULL;
- InvertArc(&r,
- startAngle,
- arcAngle);
+ HidePen();
Py_INCREF(Py_None);
_res = Py_None;
return _res;
}
-static PyObject *Qd_FillArc(PyObject *_self, PyObject *_args)
+static PyObject *Qd_ShowPen(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- Rect r;
- short startAngle;
- short arcAngle;
- Pattern *pat__in__;
- int pat__in_len__;
-#ifndef FillArc
- PyMac_PRECHECK(FillArc);
+#ifndef ShowPen
+ PyMac_PRECHECK(ShowPen);
#endif
- if (!PyArg_ParseTuple(_args, "O&hhs#",
- PyMac_GetRect, &r,
- &startAngle,
- &arcAngle,
- (char **)&pat__in__, &pat__in_len__))
+ if (!PyArg_ParseTuple(_args, ""))
return NULL;
- if (pat__in_len__ != sizeof(Pattern))
- {
- PyErr_SetString(PyExc_TypeError, "buffer length should be sizeof(Pattern)");
- goto pat__error__;
- }
- FillArc(&r,
- startAngle,
- arcAngle,
- pat__in__);
+ ShowPen();
Py_INCREF(Py_None);
_res = Py_None;
- pat__error__: ;
return _res;
}
-static PyObject *Qd_NewRgn(PyObject *_self, PyObject *_args)
+static PyObject *Qd_GetPen(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- RgnHandle _rv;
-#ifndef NewRgn
- PyMac_PRECHECK(NewRgn);
+ Point pt;
+#ifndef GetPen
+ PyMac_PRECHECK(GetPen);
#endif
if (!PyArg_ParseTuple(_args, ""))
return NULL;
- _rv = NewRgn();
+ GetPen(&pt);
_res = Py_BuildValue("O&",
- ResObj_New, _rv);
+ PyMac_BuildPoint, pt);
return _res;
}
-static PyObject *Qd_OpenRgn(PyObject *_self, PyObject *_args)
+static PyObject *Qd_GetPenState(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
-#ifndef OpenRgn
- PyMac_PRECHECK(OpenRgn);
+ PenState pnState__out__;
+#ifndef GetPenState
+ PyMac_PRECHECK(GetPenState);
#endif
if (!PyArg_ParseTuple(_args, ""))
return NULL;
- OpenRgn();
- Py_INCREF(Py_None);
- _res = Py_None;
+ GetPenState(&pnState__out__);
+ _res = Py_BuildValue("s#",
+ (char *)&pnState__out__, (int)sizeof(PenState));
return _res;
}
-static PyObject *Qd_CloseRgn(PyObject *_self, PyObject *_args)
+static PyObject *Qd_SetPenState(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- RgnHandle dstRgn;
-#ifndef CloseRgn
- PyMac_PRECHECK(CloseRgn);
+ PenState *pnState__in__;
+ int pnState__in_len__;
+#ifndef SetPenState
+ PyMac_PRECHECK(SetPenState);
#endif
- if (!PyArg_ParseTuple(_args, "O&",
- ResObj_Convert, &dstRgn))
+ if (!PyArg_ParseTuple(_args, "s#",
+ (char **)&pnState__in__, &pnState__in_len__))
return NULL;
- CloseRgn(dstRgn);
+ if (pnState__in_len__ != sizeof(PenState))
+ {
+ PyErr_SetString(PyExc_TypeError, "buffer length should be sizeof(PenState)");
+ goto pnState__error__;
+ }
+ SetPenState(pnState__in__);
Py_INCREF(Py_None);
_res = Py_None;
+ pnState__error__: ;
return _res;
}
-static PyObject *Qd_BitMapToRegion(PyObject *_self, PyObject *_args)
+static PyObject *Qd_PenSize(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- OSErr _err;
- RgnHandle region;
- BitMapPtr bMap;
-#ifndef BitMapToRegion
- PyMac_PRECHECK(BitMapToRegion);
+ short width;
+ short height;
+#ifndef PenSize
+ PyMac_PRECHECK(PenSize);
#endif
- if (!PyArg_ParseTuple(_args, "O&O&",
- ResObj_Convert, ®ion,
- BMObj_Convert, &bMap))
+ if (!PyArg_ParseTuple(_args, "hh",
+ &width,
+ &height))
return NULL;
- _err = BitMapToRegion(region,
- bMap);
- if (_err != noErr) return PyMac_Error(_err);
+ PenSize(width,
+ height);
Py_INCREF(Py_None);
_res = Py_None;
return _res;
}
-#if TARGET_API_MAC_CARBON
-
-static PyObject *Qd_RgnToHandle(PyObject *_self, PyObject *_args)
+static PyObject *Qd_PenMode(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- RgnHandle region;
- Handle flattenedRgnDataHdl;
-#ifndef RgnToHandle
- PyMac_PRECHECK(RgnToHandle);
+ short mode;
+#ifndef PenMode
+ PyMac_PRECHECK(PenMode);
#endif
- if (!PyArg_ParseTuple(_args, "O&O&",
- ResObj_Convert, ®ion,
- ResObj_Convert, &flattenedRgnDataHdl))
+ if (!PyArg_ParseTuple(_args, "h",
+ &mode))
return NULL;
- RgnToHandle(region,
- flattenedRgnDataHdl);
+ PenMode(mode);
Py_INCREF(Py_None);
_res = Py_None;
return _res;
}
-#endif
-static PyObject *Qd_DisposeRgn(PyObject *_self, PyObject *_args)
+static PyObject *Qd_PenPat(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- RgnHandle rgn;
-#ifndef DisposeRgn
- PyMac_PRECHECK(DisposeRgn);
+ Pattern *pat__in__;
+ int pat__in_len__;
+#ifndef PenPat
+ PyMac_PRECHECK(PenPat);
#endif
- if (!PyArg_ParseTuple(_args, "O&",
- ResObj_Convert, &rgn))
+ if (!PyArg_ParseTuple(_args, "s#",
+ (char **)&pat__in__, &pat__in_len__))
return NULL;
- DisposeRgn(rgn);
+ if (pat__in_len__ != sizeof(Pattern))
+ {
+ PyErr_SetString(PyExc_TypeError, "buffer length should be sizeof(Pattern)");
+ goto pat__error__;
+ }
+ PenPat(pat__in__);
Py_INCREF(Py_None);
_res = Py_None;
+ pat__error__: ;
return _res;
}
-static PyObject *Qd_MacCopyRgn(PyObject *_self, PyObject *_args)
+static PyObject *Qd_PenNormal(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- RgnHandle srcRgn;
- RgnHandle dstRgn;
-#ifndef MacCopyRgn
- PyMac_PRECHECK(MacCopyRgn);
+#ifndef PenNormal
+ PyMac_PRECHECK(PenNormal);
#endif
- if (!PyArg_ParseTuple(_args, "O&O&",
- ResObj_Convert, &srcRgn,
- ResObj_Convert, &dstRgn))
+ if (!PyArg_ParseTuple(_args, ""))
return NULL;
- MacCopyRgn(srcRgn,
- dstRgn);
+ PenNormal();
Py_INCREF(Py_None);
_res = Py_None;
return _res;
}
-static PyObject *Qd_SetEmptyRgn(PyObject *_self, PyObject *_args)
+static PyObject *Qd_MoveTo(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- RgnHandle rgn;
-#ifndef SetEmptyRgn
- PyMac_PRECHECK(SetEmptyRgn);
+ short h;
+ short v;
+#ifndef MoveTo
+ PyMac_PRECHECK(MoveTo);
#endif
- if (!PyArg_ParseTuple(_args, "O&",
- ResObj_Convert, &rgn))
+ if (!PyArg_ParseTuple(_args, "hh",
+ &h,
+ &v))
return NULL;
- SetEmptyRgn(rgn);
+ MoveTo(h,
+ v);
Py_INCREF(Py_None);
_res = Py_None;
return _res;
}
-static PyObject *Qd_MacSetRectRgn(PyObject *_self, PyObject *_args)
+static PyObject *Qd_Move(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- RgnHandle rgn;
- short left;
- short top;
- short right;
- short bottom;
-#ifndef MacSetRectRgn
- PyMac_PRECHECK(MacSetRectRgn);
+ short dh;
+ short dv;
+#ifndef Move
+ PyMac_PRECHECK(Move);
#endif
- if (!PyArg_ParseTuple(_args, "O&hhhh",
- ResObj_Convert, &rgn,
- &left,
- &top,
- &right,
- &bottom))
+ if (!PyArg_ParseTuple(_args, "hh",
+ &dh,
+ &dv))
return NULL;
- MacSetRectRgn(rgn,
- left,
- top,
- right,
- bottom);
+ Move(dh,
+ dv);
Py_INCREF(Py_None);
_res = Py_None;
return _res;
}
-static PyObject *Qd_RectRgn(PyObject *_self, PyObject *_args)
+static PyObject *Qd_MacLineTo(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- RgnHandle rgn;
- Rect r;
-#ifndef RectRgn
- PyMac_PRECHECK(RectRgn);
+ short h;
+ short v;
+#ifndef MacLineTo
+ PyMac_PRECHECK(MacLineTo);
#endif
- if (!PyArg_ParseTuple(_args, "O&O&",
- ResObj_Convert, &rgn,
- PyMac_GetRect, &r))
+ if (!PyArg_ParseTuple(_args, "hh",
+ &h,
+ &v))
return NULL;
- RectRgn(rgn,
- &r);
+ MacLineTo(h,
+ v);
Py_INCREF(Py_None);
_res = Py_None;
return _res;
}
-static PyObject *Qd_MacOffsetRgn(PyObject *_self, PyObject *_args)
+static PyObject *Qd_Line(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- RgnHandle rgn;
short dh;
short dv;
-#ifndef MacOffsetRgn
- PyMac_PRECHECK(MacOffsetRgn);
+#ifndef Line
+ PyMac_PRECHECK(Line);
#endif
- if (!PyArg_ParseTuple(_args, "O&hh",
- ResObj_Convert, &rgn,
+ if (!PyArg_ParseTuple(_args, "hh",
&dh,
&dv))
return NULL;
- MacOffsetRgn(rgn,
- dh,
- dv);
+ Line(dh,
+ dv);
Py_INCREF(Py_None);
_res = Py_None;
return _res;
}
-static PyObject *Qd_InsetRgn(PyObject *_self, PyObject *_args)
+static PyObject *Qd_ForeColor(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- RgnHandle rgn;
- short dh;
- short dv;
-#ifndef InsetRgn
- PyMac_PRECHECK(InsetRgn);
+ long color;
+#ifndef ForeColor
+ PyMac_PRECHECK(ForeColor);
#endif
- if (!PyArg_ParseTuple(_args, "O&hh",
- ResObj_Convert, &rgn,
- &dh,
- &dv))
+ if (!PyArg_ParseTuple(_args, "l",
+ &color))
return NULL;
- InsetRgn(rgn,
- dh,
- dv);
+ ForeColor(color);
Py_INCREF(Py_None);
_res = Py_None;
return _res;
}
-static PyObject *Qd_SectRgn(PyObject *_self, PyObject *_args)
+static PyObject *Qd_BackColor(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- RgnHandle srcRgnA;
- RgnHandle srcRgnB;
- RgnHandle dstRgn;
-#ifndef SectRgn
- PyMac_PRECHECK(SectRgn);
+ long color;
+#ifndef BackColor
+ PyMac_PRECHECK(BackColor);
#endif
- if (!PyArg_ParseTuple(_args, "O&O&O&",
- ResObj_Convert, &srcRgnA,
- ResObj_Convert, &srcRgnB,
- ResObj_Convert, &dstRgn))
+ if (!PyArg_ParseTuple(_args, "l",
+ &color))
return NULL;
- SectRgn(srcRgnA,
- srcRgnB,
- dstRgn);
+ BackColor(color);
Py_INCREF(Py_None);
_res = Py_None;
return _res;
}
-static PyObject *Qd_MacUnionRgn(PyObject *_self, PyObject *_args)
+static PyObject *Qd_ColorBit(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- RgnHandle srcRgnA;
- RgnHandle srcRgnB;
- RgnHandle dstRgn;
-#ifndef MacUnionRgn
- PyMac_PRECHECK(MacUnionRgn);
+ short whichBit;
+#ifndef ColorBit
+ PyMac_PRECHECK(ColorBit);
#endif
- if (!PyArg_ParseTuple(_args, "O&O&O&",
- ResObj_Convert, &srcRgnA,
- ResObj_Convert, &srcRgnB,
- ResObj_Convert, &dstRgn))
+ if (!PyArg_ParseTuple(_args, "h",
+ &whichBit))
return NULL;
- MacUnionRgn(srcRgnA,
- srcRgnB,
- dstRgn);
+ ColorBit(whichBit);
Py_INCREF(Py_None);
_res = Py_None;
return _res;
}
-static PyObject *Qd_DiffRgn(PyObject *_self, PyObject *_args)
+static PyObject *Qd_MacSetRect(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- RgnHandle srcRgnA;
- RgnHandle srcRgnB;
- RgnHandle dstRgn;
-#ifndef DiffRgn
- PyMac_PRECHECK(DiffRgn);
+ Rect r;
+ short left;
+ short top;
+ short right;
+ short bottom;
+#ifndef MacSetRect
+ PyMac_PRECHECK(MacSetRect);
#endif
- if (!PyArg_ParseTuple(_args, "O&O&O&",
- ResObj_Convert, &srcRgnA,
- ResObj_Convert, &srcRgnB,
- ResObj_Convert, &dstRgn))
+ if (!PyArg_ParseTuple(_args, "hhhh",
+ &left,
+ &top,
+ &right,
+ &bottom))
return NULL;
- DiffRgn(srcRgnA,
- srcRgnB,
- dstRgn);
- Py_INCREF(Py_None);
- _res = Py_None;
+ MacSetRect(&r,
+ left,
+ top,
+ right,
+ bottom);
+ _res = Py_BuildValue("O&",
+ PyMac_BuildRect, &r);
return _res;
}
-static PyObject *Qd_MacXorRgn(PyObject *_self, PyObject *_args)
+static PyObject *Qd_MacOffsetRect(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- RgnHandle srcRgnA;
- RgnHandle srcRgnB;
- RgnHandle dstRgn;
-#ifndef MacXorRgn
- PyMac_PRECHECK(MacXorRgn);
+ Rect r;
+ short dh;
+ short dv;
+#ifndef MacOffsetRect
+ PyMac_PRECHECK(MacOffsetRect);
#endif
- if (!PyArg_ParseTuple(_args, "O&O&O&",
- ResObj_Convert, &srcRgnA,
- ResObj_Convert, &srcRgnB,
- ResObj_Convert, &dstRgn))
+ if (!PyArg_ParseTuple(_args, "O&hh",
+ PyMac_GetRect, &r,
+ &dh,
+ &dv))
return NULL;
- MacXorRgn(srcRgnA,
- srcRgnB,
- dstRgn);
- Py_INCREF(Py_None);
- _res = Py_None;
+ MacOffsetRect(&r,
+ dh,
+ dv);
+ _res = Py_BuildValue("O&",
+ PyMac_BuildRect, &r);
+ return _res;
+}
+
+static PyObject *Qd_MacInsetRect(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Rect r;
+ short dh;
+ short dv;
+#ifndef MacInsetRect
+ PyMac_PRECHECK(MacInsetRect);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&hh",
+ PyMac_GetRect, &r,
+ &dh,
+ &dv))
+ return NULL;
+ MacInsetRect(&r,
+ dh,
+ dv);
+ _res = Py_BuildValue("O&",
+ PyMac_BuildRect, &r);
+ return _res;
+}
+
+static PyObject *Qd_SectRect(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ Rect src1;
+ Rect src2;
+ Rect dstRect;
+#ifndef SectRect
+ PyMac_PRECHECK(SectRect);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ PyMac_GetRect, &src1,
+ PyMac_GetRect, &src2))
+ return NULL;
+ _rv = SectRect(&src1,
+ &src2,
+ &dstRect);
+ _res = Py_BuildValue("bO&",
+ _rv,
+ PyMac_BuildRect, &dstRect);
return _res;
}
-static PyObject *Qd_RectInRgn(PyObject *_self, PyObject *_args)
+static PyObject *Qd_MacUnionRect(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- Boolean _rv;
- Rect r;
- RgnHandle rgn;
-#ifndef RectInRgn
- PyMac_PRECHECK(RectInRgn);
+ Rect src1;
+ Rect src2;
+ Rect dstRect;
+#ifndef MacUnionRect
+ PyMac_PRECHECK(MacUnionRect);
#endif
if (!PyArg_ParseTuple(_args, "O&O&",
- PyMac_GetRect, &r,
- ResObj_Convert, &rgn))
+ PyMac_GetRect, &src1,
+ PyMac_GetRect, &src2))
return NULL;
- _rv = RectInRgn(&r,
- rgn);
- _res = Py_BuildValue("b",
- _rv);
+ MacUnionRect(&src1,
+ &src2,
+ &dstRect);
+ _res = Py_BuildValue("O&",
+ PyMac_BuildRect, &dstRect);
return _res;
}
-static PyObject *Qd_MacEqualRgn(PyObject *_self, PyObject *_args)
+static PyObject *Qd_MacEqualRect(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
Boolean _rv;
- RgnHandle rgnA;
- RgnHandle rgnB;
-#ifndef MacEqualRgn
- PyMac_PRECHECK(MacEqualRgn);
+ Rect rect1;
+ Rect rect2;
+#ifndef MacEqualRect
+ PyMac_PRECHECK(MacEqualRect);
#endif
if (!PyArg_ParseTuple(_args, "O&O&",
- ResObj_Convert, &rgnA,
- ResObj_Convert, &rgnB))
+ PyMac_GetRect, &rect1,
+ PyMac_GetRect, &rect2))
return NULL;
- _rv = MacEqualRgn(rgnA,
- rgnB);
+ _rv = MacEqualRect(&rect1,
+ &rect2);
_res = Py_BuildValue("b",
_rv);
return _res;
}
-static PyObject *Qd_EmptyRgn(PyObject *_self, PyObject *_args)
+static PyObject *Qd_EmptyRect(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
Boolean _rv;
- RgnHandle rgn;
-#ifndef EmptyRgn
- PyMac_PRECHECK(EmptyRgn);
+ Rect r;
+#ifndef EmptyRect
+ PyMac_PRECHECK(EmptyRect);
#endif
if (!PyArg_ParseTuple(_args, "O&",
- ResObj_Convert, &rgn))
+ PyMac_GetRect, &r))
return NULL;
- _rv = EmptyRgn(rgn);
+ _rv = EmptyRect(&r);
_res = Py_BuildValue("b",
_rv);
return _res;
}
-static PyObject *Qd_MacFrameRgn(PyObject *_self, PyObject *_args)
+static PyObject *Qd_MacFrameRect(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- RgnHandle rgn;
-#ifndef MacFrameRgn
- PyMac_PRECHECK(MacFrameRgn);
+ Rect r;
+#ifndef MacFrameRect
+ PyMac_PRECHECK(MacFrameRect);
#endif
if (!PyArg_ParseTuple(_args, "O&",
- ResObj_Convert, &rgn))
+ PyMac_GetRect, &r))
return NULL;
- MacFrameRgn(rgn);
+ MacFrameRect(&r);
Py_INCREF(Py_None);
_res = Py_None;
return _res;
}
-static PyObject *Qd_MacPaintRgn(PyObject *_self, PyObject *_args)
+static PyObject *Qd_PaintRect(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- RgnHandle rgn;
-#ifndef MacPaintRgn
- PyMac_PRECHECK(MacPaintRgn);
+ Rect r;
+#ifndef PaintRect
+ PyMac_PRECHECK(PaintRect);
#endif
if (!PyArg_ParseTuple(_args, "O&",
- ResObj_Convert, &rgn))
+ PyMac_GetRect, &r))
return NULL;
- MacPaintRgn(rgn);
+ PaintRect(&r);
Py_INCREF(Py_None);
_res = Py_None;
return _res;
}
-static PyObject *Qd_EraseRgn(PyObject *_self, PyObject *_args)
+static PyObject *Qd_EraseRect(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- RgnHandle rgn;
-#ifndef EraseRgn
- PyMac_PRECHECK(EraseRgn);
+ Rect r;
+#ifndef EraseRect
+ PyMac_PRECHECK(EraseRect);
#endif
if (!PyArg_ParseTuple(_args, "O&",
- ResObj_Convert, &rgn))
+ PyMac_GetRect, &r))
return NULL;
- EraseRgn(rgn);
+ EraseRect(&r);
Py_INCREF(Py_None);
_res = Py_None;
return _res;
}
-static PyObject *Qd_MacInvertRgn(PyObject *_self, PyObject *_args)
+static PyObject *Qd_MacInvertRect(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- RgnHandle rgn;
-#ifndef MacInvertRgn
- PyMac_PRECHECK(MacInvertRgn);
+ Rect r;
+#ifndef MacInvertRect
+ PyMac_PRECHECK(MacInvertRect);
#endif
if (!PyArg_ParseTuple(_args, "O&",
- ResObj_Convert, &rgn))
+ PyMac_GetRect, &r))
return NULL;
- MacInvertRgn(rgn);
+ MacInvertRect(&r);
Py_INCREF(Py_None);
_res = Py_None;
return _res;
}
-static PyObject *Qd_MacFillRgn(PyObject *_self, PyObject *_args)
+static PyObject *Qd_MacFillRect(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- RgnHandle rgn;
+ Rect r;
Pattern *pat__in__;
int pat__in_len__;
-#ifndef MacFillRgn
- PyMac_PRECHECK(MacFillRgn);
+#ifndef MacFillRect
+ PyMac_PRECHECK(MacFillRect);
#endif
if (!PyArg_ParseTuple(_args, "O&s#",
- ResObj_Convert, &rgn,
+ PyMac_GetRect, &r,
(char **)&pat__in__, &pat__in_len__))
return NULL;
if (pat__in_len__ != sizeof(Pattern))
PyErr_SetString(PyExc_TypeError, "buffer length should be sizeof(Pattern)");
goto pat__error__;
}
- MacFillRgn(rgn,
- pat__in__);
+ MacFillRect(&r,
+ pat__in__);
Py_INCREF(Py_None);
_res = Py_None;
pat__error__: ;
return _res;
}
-static PyObject *Qd_ScrollRect(PyObject *_self, PyObject *_args)
+static PyObject *Qd_FrameOval(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
Rect r;
- short dh;
- short dv;
- RgnHandle updateRgn;
-#ifndef ScrollRect
- PyMac_PRECHECK(ScrollRect);
+#ifndef FrameOval
+ PyMac_PRECHECK(FrameOval);
#endif
- if (!PyArg_ParseTuple(_args, "O&hhO&",
- PyMac_GetRect, &r,
- &dh,
- &dv,
- ResObj_Convert, &updateRgn))
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetRect, &r))
return NULL;
- ScrollRect(&r,
- dh,
- dv,
- updateRgn);
+ FrameOval(&r);
Py_INCREF(Py_None);
_res = Py_None;
return _res;
}
-static PyObject *Qd_CopyBits(PyObject *_self, PyObject *_args)
+static PyObject *Qd_PaintOval(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- BitMapPtr srcBits;
- BitMapPtr dstBits;
- Rect srcRect;
- Rect dstRect;
- short mode;
- RgnHandle maskRgn;
-#ifndef CopyBits
- PyMac_PRECHECK(CopyBits);
+ Rect r;
+#ifndef PaintOval
+ PyMac_PRECHECK(PaintOval);
#endif
- if (!PyArg_ParseTuple(_args, "O&O&O&O&hO&",
- BMObj_Convert, &srcBits,
- BMObj_Convert, &dstBits,
- PyMac_GetRect, &srcRect,
- PyMac_GetRect, &dstRect,
- &mode,
- OptResObj_Convert, &maskRgn))
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetRect, &r))
return NULL;
- CopyBits(srcBits,
- dstBits,
- &srcRect,
- &dstRect,
- mode,
- maskRgn);
+ PaintOval(&r);
Py_INCREF(Py_None);
_res = Py_None;
return _res;
}
-static PyObject *Qd_CopyMask(PyObject *_self, PyObject *_args)
+static PyObject *Qd_EraseOval(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- BitMapPtr srcBits;
- BitMapPtr maskBits;
- BitMapPtr dstBits;
- Rect srcRect;
- Rect maskRect;
- Rect dstRect;
-#ifndef CopyMask
- PyMac_PRECHECK(CopyMask);
+ Rect r;
+#ifndef EraseOval
+ PyMac_PRECHECK(EraseOval);
#endif
- if (!PyArg_ParseTuple(_args, "O&O&O&O&O&O&",
- BMObj_Convert, &srcBits,
- BMObj_Convert, &maskBits,
- BMObj_Convert, &dstBits,
- PyMac_GetRect, &srcRect,
- PyMac_GetRect, &maskRect,
- PyMac_GetRect, &dstRect))
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetRect, &r))
return NULL;
- CopyMask(srcBits,
- maskBits,
- dstBits,
- &srcRect,
- &maskRect,
- &dstRect);
+ EraseOval(&r);
Py_INCREF(Py_None);
_res = Py_None;
return _res;
}
-static PyObject *Qd_OpenPicture(PyObject *_self, PyObject *_args)
+static PyObject *Qd_InvertOval(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- PicHandle _rv;
- Rect picFrame;
-#ifndef OpenPicture
- PyMac_PRECHECK(OpenPicture);
+ Rect r;
+#ifndef InvertOval
+ PyMac_PRECHECK(InvertOval);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetRect, &r))
+ return NULL;
+ InvertOval(&r);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Qd_FillOval(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Rect r;
+ Pattern *pat__in__;
+ int pat__in_len__;
+#ifndef FillOval
+ PyMac_PRECHECK(FillOval);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&s#",
+ PyMac_GetRect, &r,
+ (char **)&pat__in__, &pat__in_len__))
+ return NULL;
+ if (pat__in_len__ != sizeof(Pattern))
+ {
+ PyErr_SetString(PyExc_TypeError, "buffer length should be sizeof(Pattern)");
+ goto pat__error__;
+ }
+ FillOval(&r,
+ pat__in__);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ pat__error__: ;
+ return _res;
+}
+
+static PyObject *Qd_FrameRoundRect(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Rect r;
+ short ovalWidth;
+ short ovalHeight;
+#ifndef FrameRoundRect
+ PyMac_PRECHECK(FrameRoundRect);
#endif
- if (!PyArg_ParseTuple(_args, "O&",
- PyMac_GetRect, &picFrame))
+ if (!PyArg_ParseTuple(_args, "O&hh",
+ PyMac_GetRect, &r,
+ &ovalWidth,
+ &ovalHeight))
return NULL;
- _rv = OpenPicture(&picFrame);
- _res = Py_BuildValue("O&",
- ResObj_New, _rv);
+ FrameRoundRect(&r,
+ ovalWidth,
+ ovalHeight);
+ Py_INCREF(Py_None);
+ _res = Py_None;
return _res;
}
-static PyObject *Qd_PicComment(PyObject *_self, PyObject *_args)
+static PyObject *Qd_PaintRoundRect(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- short kind;
- short dataSize;
- Handle dataHandle;
-#ifndef PicComment
- PyMac_PRECHECK(PicComment);
+ Rect r;
+ short ovalWidth;
+ short ovalHeight;
+#ifndef PaintRoundRect
+ PyMac_PRECHECK(PaintRoundRect);
#endif
- if (!PyArg_ParseTuple(_args, "hhO&",
- &kind,
- &dataSize,
- ResObj_Convert, &dataHandle))
+ if (!PyArg_ParseTuple(_args, "O&hh",
+ PyMac_GetRect, &r,
+ &ovalWidth,
+ &ovalHeight))
return NULL;
- PicComment(kind,
- dataSize,
- dataHandle);
+ PaintRoundRect(&r,
+ ovalWidth,
+ ovalHeight);
Py_INCREF(Py_None);
_res = Py_None;
return _res;
}
-static PyObject *Qd_ClosePicture(PyObject *_self, PyObject *_args)
+static PyObject *Qd_EraseRoundRect(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
-#ifndef ClosePicture
- PyMac_PRECHECK(ClosePicture);
+ Rect r;
+ short ovalWidth;
+ short ovalHeight;
+#ifndef EraseRoundRect
+ PyMac_PRECHECK(EraseRoundRect);
#endif
- if (!PyArg_ParseTuple(_args, ""))
+ if (!PyArg_ParseTuple(_args, "O&hh",
+ PyMac_GetRect, &r,
+ &ovalWidth,
+ &ovalHeight))
return NULL;
- ClosePicture();
+ EraseRoundRect(&r,
+ ovalWidth,
+ ovalHeight);
Py_INCREF(Py_None);
_res = Py_None;
return _res;
}
-static PyObject *Qd_DrawPicture(PyObject *_self, PyObject *_args)
+static PyObject *Qd_InvertRoundRect(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- PicHandle myPicture;
- Rect dstRect;
-#ifndef DrawPicture
- PyMac_PRECHECK(DrawPicture);
+ Rect r;
+ short ovalWidth;
+ short ovalHeight;
+#ifndef InvertRoundRect
+ PyMac_PRECHECK(InvertRoundRect);
#endif
- if (!PyArg_ParseTuple(_args, "O&O&",
- ResObj_Convert, &myPicture,
- PyMac_GetRect, &dstRect))
+ if (!PyArg_ParseTuple(_args, "O&hh",
+ PyMac_GetRect, &r,
+ &ovalWidth,
+ &ovalHeight))
return NULL;
- DrawPicture(myPicture,
- &dstRect);
+ InvertRoundRect(&r,
+ ovalWidth,
+ ovalHeight);
Py_INCREF(Py_None);
_res = Py_None;
return _res;
}
-static PyObject *Qd_KillPicture(PyObject *_self, PyObject *_args)
+static PyObject *Qd_FillRoundRect(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- PicHandle myPicture;
-#ifndef KillPicture
- PyMac_PRECHECK(KillPicture);
+ Rect r;
+ short ovalWidth;
+ short ovalHeight;
+ Pattern *pat__in__;
+ int pat__in_len__;
+#ifndef FillRoundRect
+ PyMac_PRECHECK(FillRoundRect);
#endif
- if (!PyArg_ParseTuple(_args, "O&",
- ResObj_Convert, &myPicture))
+ if (!PyArg_ParseTuple(_args, "O&hhs#",
+ PyMac_GetRect, &r,
+ &ovalWidth,
+ &ovalHeight,
+ (char **)&pat__in__, &pat__in_len__))
return NULL;
- KillPicture(myPicture);
+ if (pat__in_len__ != sizeof(Pattern))
+ {
+ PyErr_SetString(PyExc_TypeError, "buffer length should be sizeof(Pattern)");
+ goto pat__error__;
+ }
+ FillRoundRect(&r,
+ ovalWidth,
+ ovalHeight,
+ pat__in__);
Py_INCREF(Py_None);
_res = Py_None;
+ pat__error__: ;
return _res;
}
-static PyObject *Qd_OpenPoly(PyObject *_self, PyObject *_args)
+static PyObject *Qd_FrameArc(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- PolyHandle _rv;
-#ifndef OpenPoly
- PyMac_PRECHECK(OpenPoly);
+ Rect r;
+ short startAngle;
+ short arcAngle;
+#ifndef FrameArc
+ PyMac_PRECHECK(FrameArc);
#endif
- if (!PyArg_ParseTuple(_args, ""))
+ if (!PyArg_ParseTuple(_args, "O&hh",
+ PyMac_GetRect, &r,
+ &startAngle,
+ &arcAngle))
return NULL;
- _rv = OpenPoly();
- _res = Py_BuildValue("O&",
- ResObj_New, _rv);
+ FrameArc(&r,
+ startAngle,
+ arcAngle);
+ Py_INCREF(Py_None);
+ _res = Py_None;
return _res;
}
-static PyObject *Qd_ClosePoly(PyObject *_self, PyObject *_args)
+static PyObject *Qd_PaintArc(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
-#ifndef ClosePoly
- PyMac_PRECHECK(ClosePoly);
+ Rect r;
+ short startAngle;
+ short arcAngle;
+#ifndef PaintArc
+ PyMac_PRECHECK(PaintArc);
#endif
- if (!PyArg_ParseTuple(_args, ""))
+ if (!PyArg_ParseTuple(_args, "O&hh",
+ PyMac_GetRect, &r,
+ &startAngle,
+ &arcAngle))
return NULL;
- ClosePoly();
+ PaintArc(&r,
+ startAngle,
+ arcAngle);
Py_INCREF(Py_None);
_res = Py_None;
return _res;
}
-static PyObject *Qd_KillPoly(PyObject *_self, PyObject *_args)
+static PyObject *Qd_EraseArc(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- PolyHandle poly;
-#ifndef KillPoly
- PyMac_PRECHECK(KillPoly);
+ Rect r;
+ short startAngle;
+ short arcAngle;
+#ifndef EraseArc
+ PyMac_PRECHECK(EraseArc);
#endif
- if (!PyArg_ParseTuple(_args, "O&",
- ResObj_Convert, &poly))
+ if (!PyArg_ParseTuple(_args, "O&hh",
+ PyMac_GetRect, &r,
+ &startAngle,
+ &arcAngle))
return NULL;
- KillPoly(poly);
+ EraseArc(&r,
+ startAngle,
+ arcAngle);
Py_INCREF(Py_None);
_res = Py_None;
return _res;
}
-static PyObject *Qd_OffsetPoly(PyObject *_self, PyObject *_args)
+static PyObject *Qd_InvertArc(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- PolyHandle poly;
- short dh;
- short dv;
-#ifndef OffsetPoly
- PyMac_PRECHECK(OffsetPoly);
+ Rect r;
+ short startAngle;
+ short arcAngle;
+#ifndef InvertArc
+ PyMac_PRECHECK(InvertArc);
#endif
if (!PyArg_ParseTuple(_args, "O&hh",
- ResObj_Convert, &poly,
- &dh,
- &dv))
+ PyMac_GetRect, &r,
+ &startAngle,
+ &arcAngle))
return NULL;
- OffsetPoly(poly,
- dh,
- dv);
+ InvertArc(&r,
+ startAngle,
+ arcAngle);
Py_INCREF(Py_None);
_res = Py_None;
return _res;
}
-static PyObject *Qd_FramePoly(PyObject *_self, PyObject *_args)
+static PyObject *Qd_FillArc(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- PolyHandle poly;
-#ifndef FramePoly
- PyMac_PRECHECK(FramePoly);
+ Rect r;
+ short startAngle;
+ short arcAngle;
+ Pattern *pat__in__;
+ int pat__in_len__;
+#ifndef FillArc
+ PyMac_PRECHECK(FillArc);
#endif
- if (!PyArg_ParseTuple(_args, "O&",
- ResObj_Convert, &poly))
+ if (!PyArg_ParseTuple(_args, "O&hhs#",
+ PyMac_GetRect, &r,
+ &startAngle,
+ &arcAngle,
+ (char **)&pat__in__, &pat__in_len__))
return NULL;
- FramePoly(poly);
+ if (pat__in_len__ != sizeof(Pattern))
+ {
+ PyErr_SetString(PyExc_TypeError, "buffer length should be sizeof(Pattern)");
+ goto pat__error__;
+ }
+ FillArc(&r,
+ startAngle,
+ arcAngle,
+ pat__in__);
Py_INCREF(Py_None);
_res = Py_None;
+ pat__error__: ;
return _res;
}
-static PyObject *Qd_PaintPoly(PyObject *_self, PyObject *_args)
+static PyObject *Qd_NewRgn(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- PolyHandle poly;
-#ifndef PaintPoly
- PyMac_PRECHECK(PaintPoly);
+ RgnHandle _rv;
+#ifndef NewRgn
+ PyMac_PRECHECK(NewRgn);
#endif
- if (!PyArg_ParseTuple(_args, "O&",
- ResObj_Convert, &poly))
+ if (!PyArg_ParseTuple(_args, ""))
return NULL;
- PaintPoly(poly);
- Py_INCREF(Py_None);
- _res = Py_None;
+ _rv = NewRgn();
+ _res = Py_BuildValue("O&",
+ ResObj_New, _rv);
return _res;
}
-static PyObject *Qd_ErasePoly(PyObject *_self, PyObject *_args)
+static PyObject *Qd_OpenRgn(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- PolyHandle poly;
-#ifndef ErasePoly
- PyMac_PRECHECK(ErasePoly);
+#ifndef OpenRgn
+ PyMac_PRECHECK(OpenRgn);
#endif
- if (!PyArg_ParseTuple(_args, "O&",
- ResObj_Convert, &poly))
+ if (!PyArg_ParseTuple(_args, ""))
return NULL;
- ErasePoly(poly);
+ OpenRgn();
Py_INCREF(Py_None);
_res = Py_None;
return _res;
}
-static PyObject *Qd_InvertPoly(PyObject *_self, PyObject *_args)
+static PyObject *Qd_CloseRgn(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- PolyHandle poly;
-#ifndef InvertPoly
- PyMac_PRECHECK(InvertPoly);
+ RgnHandle dstRgn;
+#ifndef CloseRgn
+ PyMac_PRECHECK(CloseRgn);
#endif
if (!PyArg_ParseTuple(_args, "O&",
- ResObj_Convert, &poly))
+ ResObj_Convert, &dstRgn))
return NULL;
- InvertPoly(poly);
+ CloseRgn(dstRgn);
Py_INCREF(Py_None);
_res = Py_None;
return _res;
}
-static PyObject *Qd_FillPoly(PyObject *_self, PyObject *_args)
+static PyObject *Qd_BitMapToRegion(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- PolyHandle poly;
- Pattern *pat__in__;
- int pat__in_len__;
-#ifndef FillPoly
- PyMac_PRECHECK(FillPoly);
+ OSErr _err;
+ RgnHandle region;
+ BitMapPtr bMap;
+#ifndef BitMapToRegion
+ PyMac_PRECHECK(BitMapToRegion);
#endif
- if (!PyArg_ParseTuple(_args, "O&s#",
- ResObj_Convert, &poly,
- (char **)&pat__in__, &pat__in_len__))
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ ResObj_Convert, ®ion,
+ BMObj_Convert, &bMap))
return NULL;
- if (pat__in_len__ != sizeof(Pattern))
- {
- PyErr_SetString(PyExc_TypeError, "buffer length should be sizeof(Pattern)");
- goto pat__error__;
- }
- FillPoly(poly,
- pat__in__);
+ _err = BitMapToRegion(region,
+ bMap);
+ if (_err != noErr) return PyMac_Error(_err);
Py_INCREF(Py_None);
_res = Py_None;
- pat__error__: ;
return _res;
}
-static PyObject *Qd_SetPt(PyObject *_self, PyObject *_args)
-{
- PyObject *_res = NULL;
- Point pt;
- short h;
- short v;
-#ifndef SetPt
- PyMac_PRECHECK(SetPt);
-#endif
- if (!PyArg_ParseTuple(_args, "hh",
- &h,
- &v))
- return NULL;
- SetPt(&pt,
- h,
- v);
- _res = Py_BuildValue("O&",
- PyMac_BuildPoint, pt);
- return _res;
-}
+#if TARGET_API_MAC_CARBON
-static PyObject *Qd_LocalToGlobal(PyObject *_self, PyObject *_args)
+static PyObject *Qd_RgnToHandle(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- Point pt;
-#ifndef LocalToGlobal
- PyMac_PRECHECK(LocalToGlobal);
+ RgnHandle region;
+ Handle flattenedRgnDataHdl;
+#ifndef RgnToHandle
+ PyMac_PRECHECK(RgnToHandle);
#endif
- if (!PyArg_ParseTuple(_args, "O&",
- PyMac_GetPoint, &pt))
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ ResObj_Convert, ®ion,
+ ResObj_Convert, &flattenedRgnDataHdl))
return NULL;
- LocalToGlobal(&pt);
- _res = Py_BuildValue("O&",
- PyMac_BuildPoint, pt);
+ RgnToHandle(region,
+ flattenedRgnDataHdl);
+ Py_INCREF(Py_None);
+ _res = Py_None;
return _res;
}
+#endif
-static PyObject *Qd_GlobalToLocal(PyObject *_self, PyObject *_args)
+static PyObject *Qd_DisposeRgn(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- Point pt;
-#ifndef GlobalToLocal
- PyMac_PRECHECK(GlobalToLocal);
+ RgnHandle rgn;
+#ifndef DisposeRgn
+ PyMac_PRECHECK(DisposeRgn);
#endif
if (!PyArg_ParseTuple(_args, "O&",
- PyMac_GetPoint, &pt))
+ ResObj_Convert, &rgn))
return NULL;
- GlobalToLocal(&pt);
- _res = Py_BuildValue("O&",
- PyMac_BuildPoint, pt);
+ DisposeRgn(rgn);
+ Py_INCREF(Py_None);
+ _res = Py_None;
return _res;
}
-static PyObject *Qd_Random(PyObject *_self, PyObject *_args)
+static PyObject *Qd_MacCopyRgn(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- short _rv;
-#ifndef Random
- PyMac_PRECHECK(Random);
+ RgnHandle srcRgn;
+ RgnHandle dstRgn;
+#ifndef MacCopyRgn
+ PyMac_PRECHECK(MacCopyRgn);
#endif
- if (!PyArg_ParseTuple(_args, ""))
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ ResObj_Convert, &srcRgn,
+ ResObj_Convert, &dstRgn))
return NULL;
- _rv = Random();
- _res = Py_BuildValue("h",
- _rv);
+ MacCopyRgn(srcRgn,
+ dstRgn);
+ Py_INCREF(Py_None);
+ _res = Py_None;
return _res;
}
-static PyObject *Qd_MacGetPixel(PyObject *_self, PyObject *_args)
+static PyObject *Qd_SetEmptyRgn(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- Boolean _rv;
- short h;
- short v;
-#ifndef MacGetPixel
- PyMac_PRECHECK(MacGetPixel);
+ RgnHandle rgn;
+#ifndef SetEmptyRgn
+ PyMac_PRECHECK(SetEmptyRgn);
#endif
- if (!PyArg_ParseTuple(_args, "hh",
- &h,
- &v))
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &rgn))
return NULL;
- _rv = MacGetPixel(h,
- v);
- _res = Py_BuildValue("b",
- _rv);
+ SetEmptyRgn(rgn);
+ Py_INCREF(Py_None);
+ _res = Py_None;
return _res;
}
-static PyObject *Qd_ScalePt(PyObject *_self, PyObject *_args)
+static PyObject *Qd_MacSetRectRgn(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- Point pt;
- Rect srcRect;
- Rect dstRect;
-#ifndef ScalePt
- PyMac_PRECHECK(ScalePt);
+ RgnHandle rgn;
+ short left;
+ short top;
+ short right;
+ short bottom;
+#ifndef MacSetRectRgn
+ PyMac_PRECHECK(MacSetRectRgn);
#endif
- if (!PyArg_ParseTuple(_args, "O&O&O&",
- PyMac_GetPoint, &pt,
- PyMac_GetRect, &srcRect,
- PyMac_GetRect, &dstRect))
+ if (!PyArg_ParseTuple(_args, "O&hhhh",
+ ResObj_Convert, &rgn,
+ &left,
+ &top,
+ &right,
+ &bottom))
return NULL;
- ScalePt(&pt,
- &srcRect,
- &dstRect);
- _res = Py_BuildValue("O&",
- PyMac_BuildPoint, pt);
+ MacSetRectRgn(rgn,
+ left,
+ top,
+ right,
+ bottom);
+ Py_INCREF(Py_None);
+ _res = Py_None;
return _res;
}
-static PyObject *Qd_MapPt(PyObject *_self, PyObject *_args)
+static PyObject *Qd_RectRgn(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- Point pt;
- Rect srcRect;
- Rect dstRect;
-#ifndef MapPt
- PyMac_PRECHECK(MapPt);
+ RgnHandle rgn;
+ Rect r;
+#ifndef RectRgn
+ PyMac_PRECHECK(RectRgn);
#endif
- if (!PyArg_ParseTuple(_args, "O&O&O&",
- PyMac_GetPoint, &pt,
- PyMac_GetRect, &srcRect,
- PyMac_GetRect, &dstRect))
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ ResObj_Convert, &rgn,
+ PyMac_GetRect, &r))
return NULL;
- MapPt(&pt,
- &srcRect,
- &dstRect);
- _res = Py_BuildValue("O&",
- PyMac_BuildPoint, pt);
+ RectRgn(rgn,
+ &r);
+ Py_INCREF(Py_None);
+ _res = Py_None;
return _res;
}
-static PyObject *Qd_MapRect(PyObject *_self, PyObject *_args)
+static PyObject *Qd_MacOffsetRgn(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- Rect r;
- Rect srcRect;
- Rect dstRect;
-#ifndef MapRect
- PyMac_PRECHECK(MapRect);
+ RgnHandle rgn;
+ short dh;
+ short dv;
+#ifndef MacOffsetRgn
+ PyMac_PRECHECK(MacOffsetRgn);
#endif
- if (!PyArg_ParseTuple(_args, "O&O&O&",
- PyMac_GetRect, &r,
- PyMac_GetRect, &srcRect,
- PyMac_GetRect, &dstRect))
+ if (!PyArg_ParseTuple(_args, "O&hh",
+ ResObj_Convert, &rgn,
+ &dh,
+ &dv))
return NULL;
- MapRect(&r,
- &srcRect,
- &dstRect);
- _res = Py_BuildValue("O&",
- PyMac_BuildRect, &r);
+ MacOffsetRgn(rgn,
+ dh,
+ dv);
+ Py_INCREF(Py_None);
+ _res = Py_None;
return _res;
}
-static PyObject *Qd_MapRgn(PyObject *_self, PyObject *_args)
+static PyObject *Qd_InsetRgn(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
RgnHandle rgn;
- Rect srcRect;
- Rect dstRect;
-#ifndef MapRgn
- PyMac_PRECHECK(MapRgn);
+ short dh;
+ short dv;
+#ifndef InsetRgn
+ PyMac_PRECHECK(InsetRgn);
#endif
- if (!PyArg_ParseTuple(_args, "O&O&O&",
+ if (!PyArg_ParseTuple(_args, "O&hh",
ResObj_Convert, &rgn,
- PyMac_GetRect, &srcRect,
- PyMac_GetRect, &dstRect))
+ &dh,
+ &dv))
return NULL;
- MapRgn(rgn,
- &srcRect,
- &dstRect);
+ InsetRgn(rgn,
+ dh,
+ dv);
Py_INCREF(Py_None);
_res = Py_None;
return _res;
}
-static PyObject *Qd_MapPoly(PyObject *_self, PyObject *_args)
+static PyObject *Qd_SectRgn(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- PolyHandle poly;
- Rect srcRect;
- Rect dstRect;
-#ifndef MapPoly
- PyMac_PRECHECK(MapPoly);
+ RgnHandle srcRgnA;
+ RgnHandle srcRgnB;
+ RgnHandle dstRgn;
+#ifndef SectRgn
+ PyMac_PRECHECK(SectRgn);
#endif
if (!PyArg_ParseTuple(_args, "O&O&O&",
- ResObj_Convert, &poly,
- PyMac_GetRect, &srcRect,
- PyMac_GetRect, &dstRect))
+ ResObj_Convert, &srcRgnA,
+ ResObj_Convert, &srcRgnB,
+ ResObj_Convert, &dstRgn))
return NULL;
- MapPoly(poly,
- &srcRect,
- &dstRect);
+ SectRgn(srcRgnA,
+ srcRgnB,
+ dstRgn);
Py_INCREF(Py_None);
_res = Py_None;
return _res;
}
-static PyObject *Qd_StdBits(PyObject *_self, PyObject *_args)
+static PyObject *Qd_MacUnionRgn(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- BitMapPtr srcBits;
- Rect srcRect;
- Rect dstRect;
- short mode;
- RgnHandle maskRgn;
-#ifndef StdBits
- PyMac_PRECHECK(StdBits);
+ RgnHandle srcRgnA;
+ RgnHandle srcRgnB;
+ RgnHandle dstRgn;
+#ifndef MacUnionRgn
+ PyMac_PRECHECK(MacUnionRgn);
#endif
- if (!PyArg_ParseTuple(_args, "O&O&O&hO&",
- BMObj_Convert, &srcBits,
- PyMac_GetRect, &srcRect,
- PyMac_GetRect, &dstRect,
- &mode,
- OptResObj_Convert, &maskRgn))
+ if (!PyArg_ParseTuple(_args, "O&O&O&",
+ ResObj_Convert, &srcRgnA,
+ ResObj_Convert, &srcRgnB,
+ ResObj_Convert, &dstRgn))
return NULL;
- StdBits(srcBits,
- &srcRect,
- &dstRect,
- mode,
- maskRgn);
+ MacUnionRgn(srcRgnA,
+ srcRgnB,
+ dstRgn);
Py_INCREF(Py_None);
_res = Py_None;
return _res;
}
-static PyObject *Qd_AddPt(PyObject *_self, PyObject *_args)
+static PyObject *Qd_DiffRgn(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- Point src;
- Point dst;
-#ifndef AddPt
- PyMac_PRECHECK(AddPt);
+ RgnHandle srcRgnA;
+ RgnHandle srcRgnB;
+ RgnHandle dstRgn;
+#ifndef DiffRgn
+ PyMac_PRECHECK(DiffRgn);
#endif
- if (!PyArg_ParseTuple(_args, "O&O&",
- PyMac_GetPoint, &src,
- PyMac_GetPoint, &dst))
+ if (!PyArg_ParseTuple(_args, "O&O&O&",
+ ResObj_Convert, &srcRgnA,
+ ResObj_Convert, &srcRgnB,
+ ResObj_Convert, &dstRgn))
return NULL;
- AddPt(src,
- &dst);
- _res = Py_BuildValue("O&",
- PyMac_BuildPoint, dst);
+ DiffRgn(srcRgnA,
+ srcRgnB,
+ dstRgn);
+ Py_INCREF(Py_None);
+ _res = Py_None;
return _res;
}
-static PyObject *Qd_EqualPt(PyObject *_self, PyObject *_args)
+static PyObject *Qd_MacXorRgn(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- Boolean _rv;
- Point pt1;
- Point pt2;
-#ifndef EqualPt
- PyMac_PRECHECK(EqualPt);
+ RgnHandle srcRgnA;
+ RgnHandle srcRgnB;
+ RgnHandle dstRgn;
+#ifndef MacXorRgn
+ PyMac_PRECHECK(MacXorRgn);
#endif
- if (!PyArg_ParseTuple(_args, "O&O&",
- PyMac_GetPoint, &pt1,
- PyMac_GetPoint, &pt2))
+ if (!PyArg_ParseTuple(_args, "O&O&O&",
+ ResObj_Convert, &srcRgnA,
+ ResObj_Convert, &srcRgnB,
+ ResObj_Convert, &dstRgn))
return NULL;
- _rv = EqualPt(pt1,
- pt2);
- _res = Py_BuildValue("b",
- _rv);
+ MacXorRgn(srcRgnA,
+ srcRgnB,
+ dstRgn);
+ Py_INCREF(Py_None);
+ _res = Py_None;
return _res;
}
-static PyObject *Qd_MacPtInRect(PyObject *_self, PyObject *_args)
+static PyObject *Qd_RectInRgn(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
Boolean _rv;
- Point pt;
Rect r;
-#ifndef MacPtInRect
- PyMac_PRECHECK(MacPtInRect);
+ RgnHandle rgn;
+#ifndef RectInRgn
+ PyMac_PRECHECK(RectInRgn);
#endif
if (!PyArg_ParseTuple(_args, "O&O&",
- PyMac_GetPoint, &pt,
- PyMac_GetRect, &r))
+ PyMac_GetRect, &r,
+ ResObj_Convert, &rgn))
return NULL;
- _rv = MacPtInRect(pt,
- &r);
+ _rv = RectInRgn(&r,
+ rgn);
_res = Py_BuildValue("b",
_rv);
return _res;
}
-static PyObject *Qd_Pt2Rect(PyObject *_self, PyObject *_args)
+static PyObject *Qd_MacEqualRgn(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- Point pt1;
- Point pt2;
- Rect dstRect;
-#ifndef Pt2Rect
- PyMac_PRECHECK(Pt2Rect);
+ Boolean _rv;
+ RgnHandle rgnA;
+ RgnHandle rgnB;
+#ifndef MacEqualRgn
+ PyMac_PRECHECK(MacEqualRgn);
#endif
if (!PyArg_ParseTuple(_args, "O&O&",
- PyMac_GetPoint, &pt1,
- PyMac_GetPoint, &pt2))
+ ResObj_Convert, &rgnA,
+ ResObj_Convert, &rgnB))
return NULL;
- Pt2Rect(pt1,
- pt2,
- &dstRect);
- _res = Py_BuildValue("O&",
- PyMac_BuildRect, &dstRect);
+ _rv = MacEqualRgn(rgnA,
+ rgnB);
+ _res = Py_BuildValue("b",
+ _rv);
return _res;
}
-static PyObject *Qd_PtToAngle(PyObject *_self, PyObject *_args)
+static PyObject *Qd_EmptyRgn(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- Rect r;
- Point pt;
- short angle;
-#ifndef PtToAngle
- PyMac_PRECHECK(PtToAngle);
+ Boolean _rv;
+ RgnHandle rgn;
+#ifndef EmptyRgn
+ PyMac_PRECHECK(EmptyRgn);
#endif
- if (!PyArg_ParseTuple(_args, "O&O&",
- PyMac_GetRect, &r,
- PyMac_GetPoint, &pt))
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &rgn))
return NULL;
- PtToAngle(&r,
- pt,
- &angle);
- _res = Py_BuildValue("h",
- angle);
+ _rv = EmptyRgn(rgn);
+ _res = Py_BuildValue("b",
+ _rv);
return _res;
}
-static PyObject *Qd_SubPt(PyObject *_self, PyObject *_args)
+static PyObject *Qd_MacFrameRgn(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- Point src;
- Point dst;
-#ifndef SubPt
- PyMac_PRECHECK(SubPt);
+ RgnHandle rgn;
+#ifndef MacFrameRgn
+ PyMac_PRECHECK(MacFrameRgn);
#endif
- if (!PyArg_ParseTuple(_args, "O&O&",
- PyMac_GetPoint, &src,
- PyMac_GetPoint, &dst))
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &rgn))
return NULL;
- SubPt(src,
- &dst);
- _res = Py_BuildValue("O&",
- PyMac_BuildPoint, dst);
+ MacFrameRgn(rgn);
+ Py_INCREF(Py_None);
+ _res = Py_None;
return _res;
}
-static PyObject *Qd_PtInRgn(PyObject *_self, PyObject *_args)
+static PyObject *Qd_MacPaintRgn(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- Boolean _rv;
- Point pt;
RgnHandle rgn;
-#ifndef PtInRgn
- PyMac_PRECHECK(PtInRgn);
+#ifndef MacPaintRgn
+ PyMac_PRECHECK(MacPaintRgn);
#endif
- if (!PyArg_ParseTuple(_args, "O&O&",
- PyMac_GetPoint, &pt,
+ if (!PyArg_ParseTuple(_args, "O&",
ResObj_Convert, &rgn))
return NULL;
- _rv = PtInRgn(pt,
- rgn);
- _res = Py_BuildValue("b",
- _rv);
+ MacPaintRgn(rgn);
+ Py_INCREF(Py_None);
+ _res = Py_None;
return _res;
}
-static PyObject *Qd_NewPixMap(PyObject *_self, PyObject *_args)
+static PyObject *Qd_EraseRgn(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- PixMapHandle _rv;
-#ifndef NewPixMap
- PyMac_PRECHECK(NewPixMap);
+ RgnHandle rgn;
+#ifndef EraseRgn
+ PyMac_PRECHECK(EraseRgn);
#endif
- if (!PyArg_ParseTuple(_args, ""))
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &rgn))
return NULL;
- _rv = NewPixMap();
- _res = Py_BuildValue("O&",
- ResObj_New, _rv);
+ EraseRgn(rgn);
+ Py_INCREF(Py_None);
+ _res = Py_None;
return _res;
}
-static PyObject *Qd_DisposePixMap(PyObject *_self, PyObject *_args)
+static PyObject *Qd_MacInvertRgn(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- PixMapHandle pm;
-#ifndef DisposePixMap
- PyMac_PRECHECK(DisposePixMap);
+ RgnHandle rgn;
+#ifndef MacInvertRgn
+ PyMac_PRECHECK(MacInvertRgn);
#endif
if (!PyArg_ParseTuple(_args, "O&",
- ResObj_Convert, &pm))
+ ResObj_Convert, &rgn))
return NULL;
- DisposePixMap(pm);
+ MacInvertRgn(rgn);
Py_INCREF(Py_None);
_res = Py_None;
return _res;
}
-static PyObject *Qd_CopyPixMap(PyObject *_self, PyObject *_args)
+static PyObject *Qd_MacFillRgn(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- PixMapHandle srcPM;
- PixMapHandle dstPM;
-#ifndef CopyPixMap
- PyMac_PRECHECK(CopyPixMap);
+ RgnHandle rgn;
+ Pattern *pat__in__;
+ int pat__in_len__;
+#ifndef MacFillRgn
+ PyMac_PRECHECK(MacFillRgn);
#endif
- if (!PyArg_ParseTuple(_args, "O&O&",
- ResObj_Convert, &srcPM,
- ResObj_Convert, &dstPM))
+ if (!PyArg_ParseTuple(_args, "O&s#",
+ ResObj_Convert, &rgn,
+ (char **)&pat__in__, &pat__in_len__))
return NULL;
- CopyPixMap(srcPM,
- dstPM);
+ if (pat__in_len__ != sizeof(Pattern))
+ {
+ PyErr_SetString(PyExc_TypeError, "buffer length should be sizeof(Pattern)");
+ goto pat__error__;
+ }
+ MacFillRgn(rgn,
+ pat__in__);
Py_INCREF(Py_None);
_res = Py_None;
+ pat__error__: ;
return _res;
}
-static PyObject *Qd_NewPixPat(PyObject *_self, PyObject *_args)
+static PyObject *Qd_ScrollRect(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- PixPatHandle _rv;
-#ifndef NewPixPat
- PyMac_PRECHECK(NewPixPat);
+ Rect r;
+ short dh;
+ short dv;
+ RgnHandle updateRgn;
+#ifndef ScrollRect
+ PyMac_PRECHECK(ScrollRect);
#endif
- if (!PyArg_ParseTuple(_args, ""))
+ if (!PyArg_ParseTuple(_args, "O&hhO&",
+ PyMac_GetRect, &r,
+ &dh,
+ &dv,
+ ResObj_Convert, &updateRgn))
return NULL;
- _rv = NewPixPat();
- _res = Py_BuildValue("O&",
- ResObj_New, _rv);
+ ScrollRect(&r,
+ dh,
+ dv,
+ updateRgn);
+ Py_INCREF(Py_None);
+ _res = Py_None;
return _res;
}
-static PyObject *Qd_DisposePixPat(PyObject *_self, PyObject *_args)
+static PyObject *Qd_CopyBits(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- PixPatHandle pp;
-#ifndef DisposePixPat
- PyMac_PRECHECK(DisposePixPat);
+ BitMapPtr srcBits;
+ BitMapPtr dstBits;
+ Rect srcRect;
+ Rect dstRect;
+ short mode;
+ RgnHandle maskRgn;
+#ifndef CopyBits
+ PyMac_PRECHECK(CopyBits);
#endif
- if (!PyArg_ParseTuple(_args, "O&",
- ResObj_Convert, &pp))
+ if (!PyArg_ParseTuple(_args, "O&O&O&O&hO&",
+ BMObj_Convert, &srcBits,
+ BMObj_Convert, &dstBits,
+ PyMac_GetRect, &srcRect,
+ PyMac_GetRect, &dstRect,
+ &mode,
+ OptResObj_Convert, &maskRgn))
return NULL;
- DisposePixPat(pp);
+ CopyBits(srcBits,
+ dstBits,
+ &srcRect,
+ &dstRect,
+ mode,
+ maskRgn);
Py_INCREF(Py_None);
_res = Py_None;
return _res;
}
-static PyObject *Qd_CopyPixPat(PyObject *_self, PyObject *_args)
+static PyObject *Qd_CopyMask(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- PixPatHandle srcPP;
- PixPatHandle dstPP;
-#ifndef CopyPixPat
- PyMac_PRECHECK(CopyPixPat);
+ BitMapPtr srcBits;
+ BitMapPtr maskBits;
+ BitMapPtr dstBits;
+ Rect srcRect;
+ Rect maskRect;
+ Rect dstRect;
+#ifndef CopyMask
+ PyMac_PRECHECK(CopyMask);
#endif
- if (!PyArg_ParseTuple(_args, "O&O&",
- ResObj_Convert, &srcPP,
- ResObj_Convert, &dstPP))
+ if (!PyArg_ParseTuple(_args, "O&O&O&O&O&O&",
+ BMObj_Convert, &srcBits,
+ BMObj_Convert, &maskBits,
+ BMObj_Convert, &dstBits,
+ PyMac_GetRect, &srcRect,
+ PyMac_GetRect, &maskRect,
+ PyMac_GetRect, &dstRect))
return NULL;
- CopyPixPat(srcPP,
- dstPP);
+ CopyMask(srcBits,
+ maskBits,
+ dstBits,
+ &srcRect,
+ &maskRect,
+ &dstRect);
Py_INCREF(Py_None);
_res = Py_None;
return _res;
}
-static PyObject *Qd_PenPixPat(PyObject *_self, PyObject *_args)
+static PyObject *Qd_OpenPicture(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- PixPatHandle pp;
-#ifndef PenPixPat
- PyMac_PRECHECK(PenPixPat);
+ PicHandle _rv;
+ Rect picFrame;
+#ifndef OpenPicture
+ PyMac_PRECHECK(OpenPicture);
#endif
if (!PyArg_ParseTuple(_args, "O&",
- ResObj_Convert, &pp))
+ PyMac_GetRect, &picFrame))
return NULL;
- PenPixPat(pp);
- Py_INCREF(Py_None);
- _res = Py_None;
+ _rv = OpenPicture(&picFrame);
+ _res = Py_BuildValue("O&",
+ ResObj_New, _rv);
return _res;
}
-static PyObject *Qd_BackPixPat(PyObject *_self, PyObject *_args)
+static PyObject *Qd_PicComment(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- PixPatHandle pp;
-#ifndef BackPixPat
- PyMac_PRECHECK(BackPixPat);
+ short kind;
+ short dataSize;
+ Handle dataHandle;
+#ifndef PicComment
+ PyMac_PRECHECK(PicComment);
#endif
- if (!PyArg_ParseTuple(_args, "O&",
- ResObj_Convert, &pp))
+ if (!PyArg_ParseTuple(_args, "hhO&",
+ &kind,
+ &dataSize,
+ ResObj_Convert, &dataHandle))
return NULL;
- BackPixPat(pp);
+ PicComment(kind,
+ dataSize,
+ dataHandle);
Py_INCREF(Py_None);
_res = Py_None;
return _res;
}
-static PyObject *Qd_GetPixPat(PyObject *_self, PyObject *_args)
+static PyObject *Qd_ClosePicture(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- PixPatHandle _rv;
- short patID;
-#ifndef GetPixPat
- PyMac_PRECHECK(GetPixPat);
+#ifndef ClosePicture
+ PyMac_PRECHECK(ClosePicture);
#endif
- if (!PyArg_ParseTuple(_args, "h",
- &patID))
+ if (!PyArg_ParseTuple(_args, ""))
return NULL;
- _rv = GetPixPat(patID);
- _res = Py_BuildValue("O&",
- ResObj_New, _rv);
+ ClosePicture();
+ Py_INCREF(Py_None);
+ _res = Py_None;
return _res;
}
-static PyObject *Qd_MakeRGBPat(PyObject *_self, PyObject *_args)
+static PyObject *Qd_DrawPicture(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- PixPatHandle pp;
- RGBColor myColor;
-#ifndef MakeRGBPat
- PyMac_PRECHECK(MakeRGBPat);
+ PicHandle myPicture;
+ Rect dstRect;
+#ifndef DrawPicture
+ PyMac_PRECHECK(DrawPicture);
#endif
if (!PyArg_ParseTuple(_args, "O&O&",
- ResObj_Convert, &pp,
- QdRGB_Convert, &myColor))
+ ResObj_Convert, &myPicture,
+ PyMac_GetRect, &dstRect))
return NULL;
- MakeRGBPat(pp,
- &myColor);
+ DrawPicture(myPicture,
+ &dstRect);
Py_INCREF(Py_None);
_res = Py_None;
return _res;
}
-static PyObject *Qd_FillCRect(PyObject *_self, PyObject *_args)
+static PyObject *Qd_KillPicture(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- Rect r;
- PixPatHandle pp;
-#ifndef FillCRect
- PyMac_PRECHECK(FillCRect);
+ PicHandle myPicture;
+#ifndef KillPicture
+ PyMac_PRECHECK(KillPicture);
#endif
- if (!PyArg_ParseTuple(_args, "O&O&",
- PyMac_GetRect, &r,
- ResObj_Convert, &pp))
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &myPicture))
return NULL;
- FillCRect(&r,
- pp);
+ KillPicture(myPicture);
Py_INCREF(Py_None);
_res = Py_None;
return _res;
}
-static PyObject *Qd_FillCOval(PyObject *_self, PyObject *_args)
+static PyObject *Qd_OpenPoly(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- Rect r;
- PixPatHandle pp;
-#ifndef FillCOval
- PyMac_PRECHECK(FillCOval);
+ PolyHandle _rv;
+#ifndef OpenPoly
+ PyMac_PRECHECK(OpenPoly);
#endif
- if (!PyArg_ParseTuple(_args, "O&O&",
- PyMac_GetRect, &r,
- ResObj_Convert, &pp))
+ if (!PyArg_ParseTuple(_args, ""))
return NULL;
- FillCOval(&r,
- pp);
- Py_INCREF(Py_None);
- _res = Py_None;
+ _rv = OpenPoly();
+ _res = Py_BuildValue("O&",
+ ResObj_New, _rv);
return _res;
}
-static PyObject *Qd_FillCRoundRect(PyObject *_self, PyObject *_args)
+static PyObject *Qd_ClosePoly(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- Rect r;
- short ovalWidth;
- short ovalHeight;
- PixPatHandle pp;
-#ifndef FillCRoundRect
- PyMac_PRECHECK(FillCRoundRect);
+#ifndef ClosePoly
+ PyMac_PRECHECK(ClosePoly);
#endif
- if (!PyArg_ParseTuple(_args, "O&hhO&",
- PyMac_GetRect, &r,
- &ovalWidth,
- &ovalHeight,
- ResObj_Convert, &pp))
+ if (!PyArg_ParseTuple(_args, ""))
return NULL;
- FillCRoundRect(&r,
- ovalWidth,
- ovalHeight,
- pp);
+ ClosePoly();
Py_INCREF(Py_None);
_res = Py_None;
return _res;
}
-static PyObject *Qd_FillCArc(PyObject *_self, PyObject *_args)
+static PyObject *Qd_KillPoly(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- Rect r;
- short startAngle;
- short arcAngle;
- PixPatHandle pp;
-#ifndef FillCArc
- PyMac_PRECHECK(FillCArc);
+ PolyHandle poly;
+#ifndef KillPoly
+ PyMac_PRECHECK(KillPoly);
#endif
- if (!PyArg_ParseTuple(_args, "O&hhO&",
- PyMac_GetRect, &r,
- &startAngle,
- &arcAngle,
- ResObj_Convert, &pp))
- return NULL;
- FillCArc(&r,
- startAngle,
- arcAngle,
- pp);
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &poly))
+ return NULL;
+ KillPoly(poly);
Py_INCREF(Py_None);
_res = Py_None;
return _res;
}
-static PyObject *Qd_FillCRgn(PyObject *_self, PyObject *_args)
+static PyObject *Qd_OffsetPoly(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- RgnHandle rgn;
- PixPatHandle pp;
-#ifndef FillCRgn
- PyMac_PRECHECK(FillCRgn);
+ PolyHandle poly;
+ short dh;
+ short dv;
+#ifndef OffsetPoly
+ PyMac_PRECHECK(OffsetPoly);
#endif
- if (!PyArg_ParseTuple(_args, "O&O&",
- ResObj_Convert, &rgn,
- ResObj_Convert, &pp))
+ if (!PyArg_ParseTuple(_args, "O&hh",
+ ResObj_Convert, &poly,
+ &dh,
+ &dv))
return NULL;
- FillCRgn(rgn,
- pp);
+ OffsetPoly(poly,
+ dh,
+ dv);
Py_INCREF(Py_None);
_res = Py_None;
return _res;
}
-static PyObject *Qd_FillCPoly(PyObject *_self, PyObject *_args)
+static PyObject *Qd_FramePoly(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
PolyHandle poly;
- PixPatHandle pp;
-#ifndef FillCPoly
- PyMac_PRECHECK(FillCPoly);
+#ifndef FramePoly
+ PyMac_PRECHECK(FramePoly);
#endif
- if (!PyArg_ParseTuple(_args, "O&O&",
- ResObj_Convert, &poly,
- ResObj_Convert, &pp))
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &poly))
return NULL;
- FillCPoly(poly,
- pp);
+ FramePoly(poly);
Py_INCREF(Py_None);
_res = Py_None;
return _res;
}
-static PyObject *Qd_RGBForeColor(PyObject *_self, PyObject *_args)
+static PyObject *Qd_PaintPoly(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- RGBColor color;
-#ifndef RGBForeColor
- PyMac_PRECHECK(RGBForeColor);
+ PolyHandle poly;
+#ifndef PaintPoly
+ PyMac_PRECHECK(PaintPoly);
#endif
if (!PyArg_ParseTuple(_args, "O&",
- QdRGB_Convert, &color))
+ ResObj_Convert, &poly))
return NULL;
- RGBForeColor(&color);
+ PaintPoly(poly);
Py_INCREF(Py_None);
_res = Py_None;
return _res;
}
-static PyObject *Qd_RGBBackColor(PyObject *_self, PyObject *_args)
+static PyObject *Qd_ErasePoly(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- RGBColor color;
-#ifndef RGBBackColor
- PyMac_PRECHECK(RGBBackColor);
+ PolyHandle poly;
+#ifndef ErasePoly
+ PyMac_PRECHECK(ErasePoly);
#endif
if (!PyArg_ParseTuple(_args, "O&",
- QdRGB_Convert, &color))
+ ResObj_Convert, &poly))
return NULL;
- RGBBackColor(&color);
+ ErasePoly(poly);
Py_INCREF(Py_None);
_res = Py_None;
return _res;
}
-static PyObject *Qd_SetCPixel(PyObject *_self, PyObject *_args)
+static PyObject *Qd_InvertPoly(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- short h;
- short v;
- RGBColor cPix;
-#ifndef SetCPixel
- PyMac_PRECHECK(SetCPixel);
+ PolyHandle poly;
+#ifndef InvertPoly
+ PyMac_PRECHECK(InvertPoly);
#endif
- if (!PyArg_ParseTuple(_args, "hhO&",
- &h,
- &v,
- QdRGB_Convert, &cPix))
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &poly))
return NULL;
- SetCPixel(h,
- v,
- &cPix);
+ InvertPoly(poly);
Py_INCREF(Py_None);
_res = Py_None;
return _res;
}
-static PyObject *Qd_SetPortPix(PyObject *_self, PyObject *_args)
+static PyObject *Qd_FillPoly(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- PixMapHandle pm;
-#ifndef SetPortPix
- PyMac_PRECHECK(SetPortPix);
+ PolyHandle poly;
+ Pattern *pat__in__;
+ int pat__in_len__;
+#ifndef FillPoly
+ PyMac_PRECHECK(FillPoly);
#endif
- if (!PyArg_ParseTuple(_args, "O&",
- ResObj_Convert, &pm))
+ if (!PyArg_ParseTuple(_args, "O&s#",
+ ResObj_Convert, &poly,
+ (char **)&pat__in__, &pat__in_len__))
return NULL;
- SetPortPix(pm);
+ if (pat__in_len__ != sizeof(Pattern))
+ {
+ PyErr_SetString(PyExc_TypeError, "buffer length should be sizeof(Pattern)");
+ goto pat__error__;
+ }
+ FillPoly(poly,
+ pat__in__);
Py_INCREF(Py_None);
_res = Py_None;
+ pat__error__: ;
return _res;
}
-static PyObject *Qd_GetCPixel(PyObject *_self, PyObject *_args)
+static PyObject *Qd_SetPt(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
+ Point pt;
short h;
short v;
- RGBColor cPix;
-#ifndef GetCPixel
- PyMac_PRECHECK(GetCPixel);
+#ifndef SetPt
+ PyMac_PRECHECK(SetPt);
#endif
if (!PyArg_ParseTuple(_args, "hh",
&h,
&v))
return NULL;
- GetCPixel(h,
- v,
- &cPix);
+ SetPt(&pt,
+ h,
+ v);
_res = Py_BuildValue("O&",
- QdRGB_New, &cPix);
+ PyMac_BuildPoint, pt);
return _res;
}
-static PyObject *Qd_GetForeColor(PyObject *_self, PyObject *_args)
+static PyObject *Qd_LocalToGlobal(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- RGBColor color;
-#ifndef GetForeColor
- PyMac_PRECHECK(GetForeColor);
+ Point pt;
+#ifndef LocalToGlobal
+ PyMac_PRECHECK(LocalToGlobal);
#endif
- if (!PyArg_ParseTuple(_args, ""))
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetPoint, &pt))
return NULL;
- GetForeColor(&color);
+ LocalToGlobal(&pt);
_res = Py_BuildValue("O&",
- QdRGB_New, &color);
+ PyMac_BuildPoint, pt);
return _res;
}
-static PyObject *Qd_GetBackColor(PyObject *_self, PyObject *_args)
+static PyObject *Qd_GlobalToLocal(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- RGBColor color;
-#ifndef GetBackColor
- PyMac_PRECHECK(GetBackColor);
+ Point pt;
+#ifndef GlobalToLocal
+ PyMac_PRECHECK(GlobalToLocal);
#endif
- if (!PyArg_ParseTuple(_args, ""))
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetPoint, &pt))
return NULL;
- GetBackColor(&color);
+ GlobalToLocal(&pt);
_res = Py_BuildValue("O&",
- QdRGB_New, &color);
+ PyMac_BuildPoint, pt);
return _res;
}
-static PyObject *Qd_OpColor(PyObject *_self, PyObject *_args)
+static PyObject *Qd_Random(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- RGBColor color;
-#ifndef OpColor
- PyMac_PRECHECK(OpColor);
+ short _rv;
+#ifndef Random
+ PyMac_PRECHECK(Random);
#endif
- if (!PyArg_ParseTuple(_args, "O&",
- QdRGB_Convert, &color))
+ if (!PyArg_ParseTuple(_args, ""))
return NULL;
- OpColor(&color);
- Py_INCREF(Py_None);
- _res = Py_None;
+ _rv = Random();
+ _res = Py_BuildValue("h",
+ _rv);
return _res;
}
-static PyObject *Qd_HiliteColor(PyObject *_self, PyObject *_args)
+static PyObject *Qd_MacGetPixel(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- RGBColor color;
-#ifndef HiliteColor
- PyMac_PRECHECK(HiliteColor);
+ Boolean _rv;
+ short h;
+ short v;
+#ifndef MacGetPixel
+ PyMac_PRECHECK(MacGetPixel);
#endif
- if (!PyArg_ParseTuple(_args, "O&",
- QdRGB_Convert, &color))
+ if (!PyArg_ParseTuple(_args, "hh",
+ &h,
+ &v))
return NULL;
- HiliteColor(&color);
- Py_INCREF(Py_None);
- _res = Py_None;
+ _rv = MacGetPixel(h,
+ v);
+ _res = Py_BuildValue("b",
+ _rv);
return _res;
}
-static PyObject *Qd_DisposeCTable(PyObject *_self, PyObject *_args)
+static PyObject *Qd_ScalePt(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- CTabHandle cTable;
-#ifndef DisposeCTable
- PyMac_PRECHECK(DisposeCTable);
+ Point pt;
+ Rect srcRect;
+ Rect dstRect;
+#ifndef ScalePt
+ PyMac_PRECHECK(ScalePt);
#endif
- if (!PyArg_ParseTuple(_args, "O&",
- ResObj_Convert, &cTable))
+ if (!PyArg_ParseTuple(_args, "O&O&O&",
+ PyMac_GetPoint, &pt,
+ PyMac_GetRect, &srcRect,
+ PyMac_GetRect, &dstRect))
return NULL;
- DisposeCTable(cTable);
- Py_INCREF(Py_None);
- _res = Py_None;
+ ScalePt(&pt,
+ &srcRect,
+ &dstRect);
+ _res = Py_BuildValue("O&",
+ PyMac_BuildPoint, pt);
return _res;
}
-static PyObject *Qd_GetCTable(PyObject *_self, PyObject *_args)
+static PyObject *Qd_MapPt(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- CTabHandle _rv;
- short ctID;
-#ifndef GetCTable
- PyMac_PRECHECK(GetCTable);
+ Point pt;
+ Rect srcRect;
+ Rect dstRect;
+#ifndef MapPt
+ PyMac_PRECHECK(MapPt);
#endif
- if (!PyArg_ParseTuple(_args, "h",
- &ctID))
+ if (!PyArg_ParseTuple(_args, "O&O&O&",
+ PyMac_GetPoint, &pt,
+ PyMac_GetRect, &srcRect,
+ PyMac_GetRect, &dstRect))
return NULL;
- _rv = GetCTable(ctID);
+ MapPt(&pt,
+ &srcRect,
+ &dstRect);
_res = Py_BuildValue("O&",
- ResObj_New, _rv);
+ PyMac_BuildPoint, pt);
return _res;
}
-static PyObject *Qd_GetCCursor(PyObject *_self, PyObject *_args)
+static PyObject *Qd_MapRect(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- CCrsrHandle _rv;
- short crsrID;
-#ifndef GetCCursor
- PyMac_PRECHECK(GetCCursor);
-#endif
- if (!PyArg_ParseTuple(_args, "h",
- &crsrID))
+ Rect r;
+ Rect srcRect;
+ Rect dstRect;
+#ifndef MapRect
+ PyMac_PRECHECK(MapRect);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&O&",
+ PyMac_GetRect, &r,
+ PyMac_GetRect, &srcRect,
+ PyMac_GetRect, &dstRect))
return NULL;
- _rv = GetCCursor(crsrID);
+ MapRect(&r,
+ &srcRect,
+ &dstRect);
_res = Py_BuildValue("O&",
- ResObj_New, _rv);
+ PyMac_BuildRect, &r);
return _res;
}
-static PyObject *Qd_SetCCursor(PyObject *_self, PyObject *_args)
+static PyObject *Qd_MapRgn(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- CCrsrHandle cCrsr;
-#ifndef SetCCursor
- PyMac_PRECHECK(SetCCursor);
+ RgnHandle rgn;
+ Rect srcRect;
+ Rect dstRect;
+#ifndef MapRgn
+ PyMac_PRECHECK(MapRgn);
#endif
- if (!PyArg_ParseTuple(_args, "O&",
- ResObj_Convert, &cCrsr))
+ if (!PyArg_ParseTuple(_args, "O&O&O&",
+ ResObj_Convert, &rgn,
+ PyMac_GetRect, &srcRect,
+ PyMac_GetRect, &dstRect))
return NULL;
- SetCCursor(cCrsr);
+ MapRgn(rgn,
+ &srcRect,
+ &dstRect);
Py_INCREF(Py_None);
_res = Py_None;
return _res;
}
-static PyObject *Qd_AllocCursor(PyObject *_self, PyObject *_args)
+static PyObject *Qd_MapPoly(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
-#ifndef AllocCursor
- PyMac_PRECHECK(AllocCursor);
+ PolyHandle poly;
+ Rect srcRect;
+ Rect dstRect;
+#ifndef MapPoly
+ PyMac_PRECHECK(MapPoly);
#endif
- if (!PyArg_ParseTuple(_args, ""))
+ if (!PyArg_ParseTuple(_args, "O&O&O&",
+ ResObj_Convert, &poly,
+ PyMac_GetRect, &srcRect,
+ PyMac_GetRect, &dstRect))
return NULL;
- AllocCursor();
+ MapPoly(poly,
+ &srcRect,
+ &dstRect);
Py_INCREF(Py_None);
_res = Py_None;
return _res;
}
-static PyObject *Qd_DisposeCCursor(PyObject *_self, PyObject *_args)
+static PyObject *Qd_StdBits(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- CCrsrHandle cCrsr;
-#ifndef DisposeCCursor
- PyMac_PRECHECK(DisposeCCursor);
+ BitMapPtr srcBits;
+ Rect srcRect;
+ Rect dstRect;
+ short mode;
+ RgnHandle maskRgn;
+#ifndef StdBits
+ PyMac_PRECHECK(StdBits);
#endif
- if (!PyArg_ParseTuple(_args, "O&",
- ResObj_Convert, &cCrsr))
+ if (!PyArg_ParseTuple(_args, "O&O&O&hO&",
+ BMObj_Convert, &srcBits,
+ PyMac_GetRect, &srcRect,
+ PyMac_GetRect, &dstRect,
+ &mode,
+ OptResObj_Convert, &maskRgn))
return NULL;
- DisposeCCursor(cCrsr);
+ StdBits(srcBits,
+ &srcRect,
+ &dstRect,
+ mode,
+ maskRgn);
Py_INCREF(Py_None);
_res = Py_None;
return _res;
}
-static PyObject *Qd_GetMaxDevice(PyObject *_self, PyObject *_args)
+static PyObject *Qd_AddPt(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- GDHandle _rv;
- Rect globalRect;
-#ifndef GetMaxDevice
- PyMac_PRECHECK(GetMaxDevice);
+ Point src;
+ Point dst;
+#ifndef AddPt
+ PyMac_PRECHECK(AddPt);
#endif
- if (!PyArg_ParseTuple(_args, "O&",
- PyMac_GetRect, &globalRect))
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ PyMac_GetPoint, &src,
+ PyMac_GetPoint, &dst))
return NULL;
- _rv = GetMaxDevice(&globalRect);
+ AddPt(src,
+ &dst);
_res = Py_BuildValue("O&",
- ResObj_New, _rv);
+ PyMac_BuildPoint, dst);
return _res;
}
-static PyObject *Qd_GetCTSeed(PyObject *_self, PyObject *_args)
+static PyObject *Qd_EqualPt(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- long _rv;
-#ifndef GetCTSeed
- PyMac_PRECHECK(GetCTSeed);
+ Boolean _rv;
+ Point pt1;
+ Point pt2;
+#ifndef EqualPt
+ PyMac_PRECHECK(EqualPt);
#endif
- if (!PyArg_ParseTuple(_args, ""))
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ PyMac_GetPoint, &pt1,
+ PyMac_GetPoint, &pt2))
return NULL;
- _rv = GetCTSeed();
- _res = Py_BuildValue("l",
+ _rv = EqualPt(pt1,
+ pt2);
+ _res = Py_BuildValue("b",
_rv);
return _res;
}
-static PyObject *Qd_GetDeviceList(PyObject *_self, PyObject *_args)
-{
- PyObject *_res = NULL;
- GDHandle _rv;
-#ifndef GetDeviceList
- PyMac_PRECHECK(GetDeviceList);
-#endif
- if (!PyArg_ParseTuple(_args, ""))
- return NULL;
- _rv = GetDeviceList();
- _res = Py_BuildValue("O&",
- ResObj_New, _rv);
- return _res;
-}
-
-static PyObject *Qd_GetMainDevice(PyObject *_self, PyObject *_args)
+static PyObject *Qd_MacPtInRect(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- GDHandle _rv;
-#ifndef GetMainDevice
- PyMac_PRECHECK(GetMainDevice);
+ Boolean _rv;
+ Point pt;
+ Rect r;
+#ifndef MacPtInRect
+ PyMac_PRECHECK(MacPtInRect);
#endif
- if (!PyArg_ParseTuple(_args, ""))
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ PyMac_GetPoint, &pt,
+ PyMac_GetRect, &r))
return NULL;
- _rv = GetMainDevice();
- _res = Py_BuildValue("O&",
- ResObj_New, _rv);
+ _rv = MacPtInRect(pt,
+ &r);
+ _res = Py_BuildValue("b",
+ _rv);
return _res;
}
-static PyObject *Qd_GetNextDevice(PyObject *_self, PyObject *_args)
+static PyObject *Qd_Pt2Rect(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- GDHandle _rv;
- GDHandle curDevice;
-#ifndef GetNextDevice
- PyMac_PRECHECK(GetNextDevice);
+ Point pt1;
+ Point pt2;
+ Rect dstRect;
+#ifndef Pt2Rect
+ PyMac_PRECHECK(Pt2Rect);
#endif
- if (!PyArg_ParseTuple(_args, "O&",
- ResObj_Convert, &curDevice))
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ PyMac_GetPoint, &pt1,
+ PyMac_GetPoint, &pt2))
return NULL;
- _rv = GetNextDevice(curDevice);
+ Pt2Rect(pt1,
+ pt2,
+ &dstRect);
_res = Py_BuildValue("O&",
- ResObj_New, _rv);
+ PyMac_BuildRect, &dstRect);
return _res;
}
-static PyObject *Qd_TestDeviceAttribute(PyObject *_self, PyObject *_args)
+static PyObject *Qd_PtToAngle(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- Boolean _rv;
- GDHandle gdh;
- short attribute;
-#ifndef TestDeviceAttribute
- PyMac_PRECHECK(TestDeviceAttribute);
+ Rect r;
+ Point pt;
+ short angle;
+#ifndef PtToAngle
+ PyMac_PRECHECK(PtToAngle);
#endif
- if (!PyArg_ParseTuple(_args, "O&h",
- ResObj_Convert, &gdh,
- &attribute))
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ PyMac_GetRect, &r,
+ PyMac_GetPoint, &pt))
return NULL;
- _rv = TestDeviceAttribute(gdh,
- attribute);
- _res = Py_BuildValue("b",
- _rv);
+ PtToAngle(&r,
+ pt,
+ &angle);
+ _res = Py_BuildValue("h",
+ angle);
return _res;
}
-static PyObject *Qd_SetDeviceAttribute(PyObject *_self, PyObject *_args)
+static PyObject *Qd_SubPt(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- GDHandle gdh;
- short attribute;
- Boolean value;
-#ifndef SetDeviceAttribute
- PyMac_PRECHECK(SetDeviceAttribute);
+ Point src;
+ Point dst;
+#ifndef SubPt
+ PyMac_PRECHECK(SubPt);
#endif
- if (!PyArg_ParseTuple(_args, "O&hb",
- ResObj_Convert, &gdh,
- &attribute,
- &value))
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ PyMac_GetPoint, &src,
+ PyMac_GetPoint, &dst))
return NULL;
- SetDeviceAttribute(gdh,
- attribute,
- value);
- Py_INCREF(Py_None);
- _res = Py_None;
+ SubPt(src,
+ &dst);
+ _res = Py_BuildValue("O&",
+ PyMac_BuildPoint, dst);
return _res;
}
-static PyObject *Qd_InitGDevice(PyObject *_self, PyObject *_args)
+static PyObject *Qd_PtInRgn(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- short qdRefNum;
- long mode;
- GDHandle gdh;
-#ifndef InitGDevice
- PyMac_PRECHECK(InitGDevice);
+ Boolean _rv;
+ Point pt;
+ RgnHandle rgn;
+#ifndef PtInRgn
+ PyMac_PRECHECK(PtInRgn);
#endif
- if (!PyArg_ParseTuple(_args, "hlO&",
- &qdRefNum,
- &mode,
- ResObj_Convert, &gdh))
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ PyMac_GetPoint, &pt,
+ ResObj_Convert, &rgn))
return NULL;
- InitGDevice(qdRefNum,
- mode,
- gdh);
- Py_INCREF(Py_None);
- _res = Py_None;
+ _rv = PtInRgn(pt,
+ rgn);
+ _res = Py_BuildValue("b",
+ _rv);
return _res;
}
-static PyObject *Qd_NewGDevice(PyObject *_self, PyObject *_args)
+static PyObject *Qd_NewPixMap(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- GDHandle _rv;
- short refNum;
- long mode;
-#ifndef NewGDevice
- PyMac_PRECHECK(NewGDevice);
+ PixMapHandle _rv;
+#ifndef NewPixMap
+ PyMac_PRECHECK(NewPixMap);
#endif
- if (!PyArg_ParseTuple(_args, "hl",
- &refNum,
- &mode))
+ if (!PyArg_ParseTuple(_args, ""))
return NULL;
- _rv = NewGDevice(refNum,
- mode);
+ _rv = NewPixMap();
_res = Py_BuildValue("O&",
ResObj_New, _rv);
return _res;
}
-static PyObject *Qd_DisposeGDevice(PyObject *_self, PyObject *_args)
+static PyObject *Qd_DisposePixMap(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- GDHandle gdh;
-#ifndef DisposeGDevice
- PyMac_PRECHECK(DisposeGDevice);
+ PixMapHandle pm;
+#ifndef DisposePixMap
+ PyMac_PRECHECK(DisposePixMap);
#endif
if (!PyArg_ParseTuple(_args, "O&",
- ResObj_Convert, &gdh))
+ ResObj_Convert, &pm))
return NULL;
- DisposeGDevice(gdh);
+ DisposePixMap(pm);
Py_INCREF(Py_None);
_res = Py_None;
return _res;
}
-static PyObject *Qd_SetGDevice(PyObject *_self, PyObject *_args)
+static PyObject *Qd_CopyPixMap(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- GDHandle gd;
-#ifndef SetGDevice
- PyMac_PRECHECK(SetGDevice);
+ PixMapHandle srcPM;
+ PixMapHandle dstPM;
+#ifndef CopyPixMap
+ PyMac_PRECHECK(CopyPixMap);
#endif
- if (!PyArg_ParseTuple(_args, "O&",
- ResObj_Convert, &gd))
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ ResObj_Convert, &srcPM,
+ ResObj_Convert, &dstPM))
return NULL;
- SetGDevice(gd);
+ CopyPixMap(srcPM,
+ dstPM);
Py_INCREF(Py_None);
_res = Py_None;
return _res;
}
-static PyObject *Qd_GetGDevice(PyObject *_self, PyObject *_args)
+static PyObject *Qd_NewPixPat(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- GDHandle _rv;
-#ifndef GetGDevice
- PyMac_PRECHECK(GetGDevice);
+ PixPatHandle _rv;
+#ifndef NewPixPat
+ PyMac_PRECHECK(NewPixPat);
#endif
if (!PyArg_ParseTuple(_args, ""))
return NULL;
- _rv = GetGDevice();
+ _rv = NewPixPat();
_res = Py_BuildValue("O&",
ResObj_New, _rv);
return _res;
}
-static PyObject *Qd_Color2Index(PyObject *_self, PyObject *_args)
+static PyObject *Qd_DisposePixPat(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- long _rv;
- RGBColor myColor;
-#ifndef Color2Index
- PyMac_PRECHECK(Color2Index);
+ PixPatHandle pp;
+#ifndef DisposePixPat
+ PyMac_PRECHECK(DisposePixPat);
#endif
if (!PyArg_ParseTuple(_args, "O&",
- QdRGB_Convert, &myColor))
+ ResObj_Convert, &pp))
return NULL;
- _rv = Color2Index(&myColor);
- _res = Py_BuildValue("l",
- _rv);
+ DisposePixPat(pp);
+ Py_INCREF(Py_None);
+ _res = Py_None;
return _res;
}
-static PyObject *Qd_Index2Color(PyObject *_self, PyObject *_args)
+static PyObject *Qd_CopyPixPat(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- long index;
- RGBColor aColor;
-#ifndef Index2Color
- PyMac_PRECHECK(Index2Color);
+ PixPatHandle srcPP;
+ PixPatHandle dstPP;
+#ifndef CopyPixPat
+ PyMac_PRECHECK(CopyPixPat);
#endif
- if (!PyArg_ParseTuple(_args, "l",
- &index))
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ ResObj_Convert, &srcPP,
+ ResObj_Convert, &dstPP))
return NULL;
- Index2Color(index,
- &aColor);
- _res = Py_BuildValue("O&",
- QdRGB_New, &aColor);
+ CopyPixPat(srcPP,
+ dstPP);
+ Py_INCREF(Py_None);
+ _res = Py_None;
return _res;
}
-static PyObject *Qd_InvertColor(PyObject *_self, PyObject *_args)
+static PyObject *Qd_PenPixPat(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- RGBColor myColor;
-#ifndef InvertColor
- PyMac_PRECHECK(InvertColor);
+ PixPatHandle pp;
+#ifndef PenPixPat
+ PyMac_PRECHECK(PenPixPat);
#endif
- if (!PyArg_ParseTuple(_args, ""))
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &pp))
return NULL;
- InvertColor(&myColor);
- _res = Py_BuildValue("O&",
- QdRGB_New, &myColor);
+ PenPixPat(pp);
+ Py_INCREF(Py_None);
+ _res = Py_None;
return _res;
}
-static PyObject *Qd_RealColor(PyObject *_self, PyObject *_args)
+static PyObject *Qd_BackPixPat(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- Boolean _rv;
- RGBColor color;
-#ifndef RealColor
- PyMac_PRECHECK(RealColor);
+ PixPatHandle pp;
+#ifndef BackPixPat
+ PyMac_PRECHECK(BackPixPat);
#endif
if (!PyArg_ParseTuple(_args, "O&",
- QdRGB_Convert, &color))
+ ResObj_Convert, &pp))
return NULL;
- _rv = RealColor(&color);
- _res = Py_BuildValue("b",
- _rv);
+ BackPixPat(pp);
+ Py_INCREF(Py_None);
+ _res = Py_None;
return _res;
}
-static PyObject *Qd_GetSubTable(PyObject *_self, PyObject *_args)
+static PyObject *Qd_GetPixPat(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- CTabHandle myColors;
- short iTabRes;
- CTabHandle targetTbl;
-#ifndef GetSubTable
- PyMac_PRECHECK(GetSubTable);
+ PixPatHandle _rv;
+ short patID;
+#ifndef GetPixPat
+ PyMac_PRECHECK(GetPixPat);
#endif
- if (!PyArg_ParseTuple(_args, "O&hO&",
- ResObj_Convert, &myColors,
- &iTabRes,
- ResObj_Convert, &targetTbl))
+ if (!PyArg_ParseTuple(_args, "h",
+ &patID))
return NULL;
- GetSubTable(myColors,
- iTabRes,
- targetTbl);
- Py_INCREF(Py_None);
- _res = Py_None;
+ _rv = GetPixPat(patID);
+ _res = Py_BuildValue("O&",
+ ResObj_New, _rv);
return _res;
}
-static PyObject *Qd_MakeITable(PyObject *_self, PyObject *_args)
+static PyObject *Qd_MakeRGBPat(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- CTabHandle cTabH;
- ITabHandle iTabH;
- short res;
-#ifndef MakeITable
- PyMac_PRECHECK(MakeITable);
+ PixPatHandle pp;
+ RGBColor myColor;
+#ifndef MakeRGBPat
+ PyMac_PRECHECK(MakeRGBPat);
#endif
- if (!PyArg_ParseTuple(_args, "O&O&h",
- ResObj_Convert, &cTabH,
- ResObj_Convert, &iTabH,
- &res))
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ ResObj_Convert, &pp,
+ QdRGB_Convert, &myColor))
return NULL;
- MakeITable(cTabH,
- iTabH,
- res);
+ MakeRGBPat(pp,
+ &myColor);
Py_INCREF(Py_None);
_res = Py_None;
return _res;
}
-static PyObject *Qd_SetClientID(PyObject *_self, PyObject *_args)
+static PyObject *Qd_FillCRect(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- short id;
-#ifndef SetClientID
- PyMac_PRECHECK(SetClientID);
+ Rect r;
+ PixPatHandle pp;
+#ifndef FillCRect
+ PyMac_PRECHECK(FillCRect);
#endif
- if (!PyArg_ParseTuple(_args, "h",
- &id))
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ PyMac_GetRect, &r,
+ ResObj_Convert, &pp))
return NULL;
- SetClientID(id);
+ FillCRect(&r,
+ pp);
Py_INCREF(Py_None);
_res = Py_None;
return _res;
}
-static PyObject *Qd_ProtectEntry(PyObject *_self, PyObject *_args)
+static PyObject *Qd_FillCOval(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- short index;
- Boolean protect;
-#ifndef ProtectEntry
- PyMac_PRECHECK(ProtectEntry);
+ Rect r;
+ PixPatHandle pp;
+#ifndef FillCOval
+ PyMac_PRECHECK(FillCOval);
#endif
- if (!PyArg_ParseTuple(_args, "hb",
- &index,
- &protect))
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ PyMac_GetRect, &r,
+ ResObj_Convert, &pp))
return NULL;
- ProtectEntry(index,
- protect);
+ FillCOval(&r,
+ pp);
Py_INCREF(Py_None);
_res = Py_None;
return _res;
}
-static PyObject *Qd_ReserveEntry(PyObject *_self, PyObject *_args)
+static PyObject *Qd_FillCRoundRect(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- short index;
- Boolean reserve;
-#ifndef ReserveEntry
- PyMac_PRECHECK(ReserveEntry);
+ Rect r;
+ short ovalWidth;
+ short ovalHeight;
+ PixPatHandle pp;
+#ifndef FillCRoundRect
+ PyMac_PRECHECK(FillCRoundRect);
#endif
- if (!PyArg_ParseTuple(_args, "hb",
- &index,
- &reserve))
+ if (!PyArg_ParseTuple(_args, "O&hhO&",
+ PyMac_GetRect, &r,
+ &ovalWidth,
+ &ovalHeight,
+ ResObj_Convert, &pp))
return NULL;
- ReserveEntry(index,
- reserve);
+ FillCRoundRect(&r,
+ ovalWidth,
+ ovalHeight,
+ pp);
Py_INCREF(Py_None);
_res = Py_None;
return _res;
}
-static PyObject *Qd_QDError(PyObject *_self, PyObject *_args)
+static PyObject *Qd_FillCArc(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- short _rv;
-#ifndef QDError
- PyMac_PRECHECK(QDError);
+ Rect r;
+ short startAngle;
+ short arcAngle;
+ PixPatHandle pp;
+#ifndef FillCArc
+ PyMac_PRECHECK(FillCArc);
#endif
- if (!PyArg_ParseTuple(_args, ""))
+ if (!PyArg_ParseTuple(_args, "O&hhO&",
+ PyMac_GetRect, &r,
+ &startAngle,
+ &arcAngle,
+ ResObj_Convert, &pp))
return NULL;
- _rv = QDError();
- _res = Py_BuildValue("h",
- _rv);
+ FillCArc(&r,
+ startAngle,
+ arcAngle,
+ pp);
+ Py_INCREF(Py_None);
+ _res = Py_None;
return _res;
}
-static PyObject *Qd_CopyDeepMask(PyObject *_self, PyObject *_args)
+static PyObject *Qd_FillCRgn(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- BitMapPtr srcBits;
- BitMapPtr maskBits;
- BitMapPtr dstBits;
- Rect srcRect;
- Rect maskRect;
- Rect dstRect;
- short mode;
- RgnHandle maskRgn;
-#ifndef CopyDeepMask
- PyMac_PRECHECK(CopyDeepMask);
+ RgnHandle rgn;
+ PixPatHandle pp;
+#ifndef FillCRgn
+ PyMac_PRECHECK(FillCRgn);
#endif
- if (!PyArg_ParseTuple(_args, "O&O&O&O&O&O&hO&",
- BMObj_Convert, &srcBits,
- BMObj_Convert, &maskBits,
- BMObj_Convert, &dstBits,
- PyMac_GetRect, &srcRect,
- PyMac_GetRect, &maskRect,
- PyMac_GetRect, &dstRect,
- &mode,
- OptResObj_Convert, &maskRgn))
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ ResObj_Convert, &rgn,
+ ResObj_Convert, &pp))
return NULL;
- CopyDeepMask(srcBits,
- maskBits,
- dstBits,
- &srcRect,
- &maskRect,
- &dstRect,
- mode,
- maskRgn);
+ FillCRgn(rgn,
+ pp);
Py_INCREF(Py_None);
_res = Py_None;
return _res;
}
-static PyObject *Qd_GetPattern(PyObject *_self, PyObject *_args)
+static PyObject *Qd_FillCPoly(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- PatHandle _rv;
- short patternID;
-#ifndef GetPattern
- PyMac_PRECHECK(GetPattern);
+ PolyHandle poly;
+ PixPatHandle pp;
+#ifndef FillCPoly
+ PyMac_PRECHECK(FillCPoly);
#endif
- if (!PyArg_ParseTuple(_args, "h",
- &patternID))
+ if (!PyArg_ParseTuple(_args, "O&O&",
+ ResObj_Convert, &poly,
+ ResObj_Convert, &pp))
return NULL;
- _rv = GetPattern(patternID);
- _res = Py_BuildValue("O&",
- ResObj_New, _rv);
+ FillCPoly(poly,
+ pp);
+ Py_INCREF(Py_None);
+ _res = Py_None;
return _res;
}
-static PyObject *Qd_MacGetCursor(PyObject *_self, PyObject *_args)
+static PyObject *Qd_RGBForeColor(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- CursHandle _rv;
- short cursorID;
-#ifndef MacGetCursor
- PyMac_PRECHECK(MacGetCursor);
+ RGBColor color;
+#ifndef RGBForeColor
+ PyMac_PRECHECK(RGBForeColor);
#endif
- if (!PyArg_ParseTuple(_args, "h",
- &cursorID))
+ if (!PyArg_ParseTuple(_args, "O&",
+ QdRGB_Convert, &color))
return NULL;
- _rv = MacGetCursor(cursorID);
- _res = Py_BuildValue("O&",
- ResObj_New, _rv);
+ RGBForeColor(&color);
+ Py_INCREF(Py_None);
+ _res = Py_None;
return _res;
}
-static PyObject *Qd_GetPicture(PyObject *_self, PyObject *_args)
+static PyObject *Qd_RGBBackColor(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- PicHandle _rv;
- short pictureID;
-#ifndef GetPicture
- PyMac_PRECHECK(GetPicture);
+ RGBColor color;
+#ifndef RGBBackColor
+ PyMac_PRECHECK(RGBBackColor);
#endif
- if (!PyArg_ParseTuple(_args, "h",
- &pictureID))
+ if (!PyArg_ParseTuple(_args, "O&",
+ QdRGB_Convert, &color))
return NULL;
- _rv = GetPicture(pictureID);
- _res = Py_BuildValue("O&",
- ResObj_New, _rv);
+ RGBBackColor(&color);
+ Py_INCREF(Py_None);
+ _res = Py_None;
return _res;
}
-static PyObject *Qd_DeltaPoint(PyObject *_self, PyObject *_args)
+static PyObject *Qd_SetCPixel(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- long _rv;
- Point ptA;
- Point ptB;
-#ifndef DeltaPoint
- PyMac_PRECHECK(DeltaPoint);
+ short h;
+ short v;
+ RGBColor cPix;
+#ifndef SetCPixel
+ PyMac_PRECHECK(SetCPixel);
#endif
- if (!PyArg_ParseTuple(_args, "O&O&",
- PyMac_GetPoint, &ptA,
- PyMac_GetPoint, &ptB))
+ if (!PyArg_ParseTuple(_args, "hhO&",
+ &h,
+ &v,
+ QdRGB_Convert, &cPix))
return NULL;
- _rv = DeltaPoint(ptA,
- ptB);
- _res = Py_BuildValue("l",
- _rv);
+ SetCPixel(h,
+ v,
+ &cPix);
+ Py_INCREF(Py_None);
+ _res = Py_None;
return _res;
}
-static PyObject *Qd_ShieldCursor(PyObject *_self, PyObject *_args)
+static PyObject *Qd_SetPortPix(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- Rect shieldRect;
- Point offsetPt;
-#ifndef ShieldCursor
- PyMac_PRECHECK(ShieldCursor);
+ PixMapHandle pm;
+#ifndef SetPortPix
+ PyMac_PRECHECK(SetPortPix);
#endif
- if (!PyArg_ParseTuple(_args, "O&O&",
- PyMac_GetRect, &shieldRect,
- PyMac_GetPoint, &offsetPt))
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &pm))
return NULL;
- ShieldCursor(&shieldRect,
- offsetPt);
+ SetPortPix(pm);
Py_INCREF(Py_None);
_res = Py_None;
return _res;
}
-static PyObject *Qd_ScreenRes(PyObject *_self, PyObject *_args)
+static PyObject *Qd_GetCPixel(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- short scrnHRes;
- short scrnVRes;
-#ifndef ScreenRes
- PyMac_PRECHECK(ScreenRes);
+ short h;
+ short v;
+ RGBColor cPix;
+#ifndef GetCPixel
+ PyMac_PRECHECK(GetCPixel);
#endif
- if (!PyArg_ParseTuple(_args, ""))
+ if (!PyArg_ParseTuple(_args, "hh",
+ &h,
+ &v))
return NULL;
- ScreenRes(&scrnHRes,
- &scrnVRes);
- _res = Py_BuildValue("hh",
- scrnHRes,
- scrnVRes);
+ GetCPixel(h,
+ v,
+ &cPix);
+ _res = Py_BuildValue("O&",
+ QdRGB_New, &cPix);
return _res;
}
-static PyObject *Qd_GetIndPattern(PyObject *_self, PyObject *_args)
+static PyObject *Qd_GetForeColor(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- Pattern thePat__out__;
- short patternListID;
- short index;
-#ifndef GetIndPattern
- PyMac_PRECHECK(GetIndPattern);
+ RGBColor color;
+#ifndef GetForeColor
+ PyMac_PRECHECK(GetForeColor);
#endif
- if (!PyArg_ParseTuple(_args, "hh",
- &patternListID,
- &index))
+ if (!PyArg_ParseTuple(_args, ""))
return NULL;
- GetIndPattern(&thePat__out__,
- patternListID,
- index);
- _res = Py_BuildValue("s#",
- (char *)&thePat__out__, (int)sizeof(Pattern));
+ GetForeColor(&color);
+ _res = Py_BuildValue("O&",
+ QdRGB_New, &color);
return _res;
}
-static PyObject *Qd_SlopeFromAngle(PyObject *_self, PyObject *_args)
+static PyObject *Qd_GetBackColor(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- Fixed _rv;
- short angle;
-#ifndef SlopeFromAngle
- PyMac_PRECHECK(SlopeFromAngle);
+ RGBColor color;
+#ifndef GetBackColor
+ PyMac_PRECHECK(GetBackColor);
#endif
- if (!PyArg_ParseTuple(_args, "h",
- &angle))
+ if (!PyArg_ParseTuple(_args, ""))
return NULL;
- _rv = SlopeFromAngle(angle);
+ GetBackColor(&color);
_res = Py_BuildValue("O&",
- PyMac_BuildFixed, _rv);
+ QdRGB_New, &color);
return _res;
}
-static PyObject *Qd_AngleFromSlope(PyObject *_self, PyObject *_args)
+static PyObject *Qd_OpColor(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- short _rv;
- Fixed slope;
-#ifndef AngleFromSlope
- PyMac_PRECHECK(AngleFromSlope);
+ RGBColor color;
+#ifndef OpColor
+ PyMac_PRECHECK(OpColor);
#endif
if (!PyArg_ParseTuple(_args, "O&",
- PyMac_GetFixed, &slope))
+ QdRGB_Convert, &color))
return NULL;
- _rv = AngleFromSlope(slope);
- _res = Py_BuildValue("h",
- _rv);
+ OpColor(&color);
+ Py_INCREF(Py_None);
+ _res = Py_None;
return _res;
}
-#if TARGET_API_MAC_CARBON
-
-static PyObject *Qd_IsValidPort(PyObject *_self, PyObject *_args)
+static PyObject *Qd_HiliteColor(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- Boolean _rv;
- CGrafPtr port;
-#ifndef IsValidPort
- PyMac_PRECHECK(IsValidPort);
+ RGBColor color;
+#ifndef HiliteColor
+ PyMac_PRECHECK(HiliteColor);
#endif
if (!PyArg_ParseTuple(_args, "O&",
- GrafObj_Convert, &port))
+ QdRGB_Convert, &color))
return NULL;
- _rv = IsValidPort(port);
- _res = Py_BuildValue("b",
- _rv);
+ HiliteColor(&color);
+ Py_INCREF(Py_None);
+ _res = Py_None;
return _res;
}
-#endif
-static PyObject *Qd_GetPortPixMap(PyObject *_self, PyObject *_args)
+static PyObject *Qd_DisposeCTable(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- PixMapHandle _rv;
- CGrafPtr port;
-#ifndef GetPortPixMap
- PyMac_PRECHECK(GetPortPixMap);
+ CTabHandle cTable;
+#ifndef DisposeCTable
+ PyMac_PRECHECK(DisposeCTable);
#endif
if (!PyArg_ParseTuple(_args, "O&",
- GrafObj_Convert, &port))
+ ResObj_Convert, &cTable))
return NULL;
- _rv = GetPortPixMap(port);
- _res = Py_BuildValue("O&",
- ResObj_New, _rv);
+ DisposeCTable(cTable);
+ Py_INCREF(Py_None);
+ _res = Py_None;
return _res;
}
-static PyObject *Qd_GetPortBitMapForCopyBits(PyObject *_self, PyObject *_args)
+static PyObject *Qd_GetCTable(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- const BitMap * _rv;
- CGrafPtr port;
-#ifndef GetPortBitMapForCopyBits
- PyMac_PRECHECK(GetPortBitMapForCopyBits);
+ CTabHandle _rv;
+ short ctID;
+#ifndef GetCTable
+ PyMac_PRECHECK(GetCTable);
#endif
- if (!PyArg_ParseTuple(_args, "O&",
- GrafObj_Convert, &port))
+ if (!PyArg_ParseTuple(_args, "h",
+ &ctID))
return NULL;
- _rv = GetPortBitMapForCopyBits(port);
+ _rv = GetCTable(ctID);
_res = Py_BuildValue("O&",
- BMObj_New, _rv);
+ ResObj_New, _rv);
return _res;
}
-static PyObject *Qd_GetPortBounds(PyObject *_self, PyObject *_args)
+static PyObject *Qd_GetCCursor(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- CGrafPtr port;
- Rect rect;
-#ifndef GetPortBounds
- PyMac_PRECHECK(GetPortBounds);
+ CCrsrHandle _rv;
+ short crsrID;
+#ifndef GetCCursor
+ PyMac_PRECHECK(GetCCursor);
#endif
- if (!PyArg_ParseTuple(_args, "O&",
- GrafObj_Convert, &port))
+ if (!PyArg_ParseTuple(_args, "h",
+ &crsrID))
return NULL;
- GetPortBounds(port,
- &rect);
+ _rv = GetCCursor(crsrID);
_res = Py_BuildValue("O&",
- PyMac_BuildRect, &rect);
+ ResObj_New, _rv);
return _res;
}
-static PyObject *Qd_GetPortForeColor(PyObject *_self, PyObject *_args)
+static PyObject *Qd_SetCCursor(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- CGrafPtr port;
- RGBColor foreColor;
-#ifndef GetPortForeColor
- PyMac_PRECHECK(GetPortForeColor);
+ CCrsrHandle cCrsr;
+#ifndef SetCCursor
+ PyMac_PRECHECK(SetCCursor);
#endif
if (!PyArg_ParseTuple(_args, "O&",
- GrafObj_Convert, &port))
+ ResObj_Convert, &cCrsr))
return NULL;
- GetPortForeColor(port,
- &foreColor);
- _res = Py_BuildValue("O&",
- QdRGB_New, &foreColor);
+ SetCCursor(cCrsr);
+ Py_INCREF(Py_None);
+ _res = Py_None;
return _res;
}
-static PyObject *Qd_GetPortBackColor(PyObject *_self, PyObject *_args)
+static PyObject *Qd_AllocCursor(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- CGrafPtr port;
- RGBColor backColor;
-#ifndef GetPortBackColor
- PyMac_PRECHECK(GetPortBackColor);
+#ifndef AllocCursor
+ PyMac_PRECHECK(AllocCursor);
#endif
- if (!PyArg_ParseTuple(_args, "O&",
- GrafObj_Convert, &port))
+ if (!PyArg_ParseTuple(_args, ""))
return NULL;
- GetPortBackColor(port,
- &backColor);
- _res = Py_BuildValue("O&",
- QdRGB_New, &backColor);
+ AllocCursor();
+ Py_INCREF(Py_None);
+ _res = Py_None;
return _res;
}
-static PyObject *Qd_GetPortOpColor(PyObject *_self, PyObject *_args)
+static PyObject *Qd_DisposeCCursor(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- CGrafPtr port;
- RGBColor opColor;
-#ifndef GetPortOpColor
- PyMac_PRECHECK(GetPortOpColor);
+ CCrsrHandle cCrsr;
+#ifndef DisposeCCursor
+ PyMac_PRECHECK(DisposeCCursor);
#endif
if (!PyArg_ParseTuple(_args, "O&",
- GrafObj_Convert, &port))
+ ResObj_Convert, &cCrsr))
return NULL;
- GetPortOpColor(port,
- &opColor);
- _res = Py_BuildValue("O&",
- QdRGB_New, &opColor);
+ DisposeCCursor(cCrsr);
+ Py_INCREF(Py_None);
+ _res = Py_None;
return _res;
}
-static PyObject *Qd_GetPortHiliteColor(PyObject *_self, PyObject *_args)
+static PyObject *Qd_GetMaxDevice(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- CGrafPtr port;
- RGBColor hiliteColor;
-#ifndef GetPortHiliteColor
- PyMac_PRECHECK(GetPortHiliteColor);
+ GDHandle _rv;
+ Rect globalRect;
+#ifndef GetMaxDevice
+ PyMac_PRECHECK(GetMaxDevice);
#endif
if (!PyArg_ParseTuple(_args, "O&",
- GrafObj_Convert, &port))
+ PyMac_GetRect, &globalRect))
return NULL;
- GetPortHiliteColor(port,
- &hiliteColor);
+ _rv = GetMaxDevice(&globalRect);
_res = Py_BuildValue("O&",
- QdRGB_New, &hiliteColor);
+ ResObj_New, _rv);
return _res;
}
-static PyObject *Qd_GetPortTextFont(PyObject *_self, PyObject *_args)
+static PyObject *Qd_GetCTSeed(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- short _rv;
- CGrafPtr port;
-#ifndef GetPortTextFont
- PyMac_PRECHECK(GetPortTextFont);
+ long _rv;
+#ifndef GetCTSeed
+ PyMac_PRECHECK(GetCTSeed);
#endif
- if (!PyArg_ParseTuple(_args, "O&",
- GrafObj_Convert, &port))
+ if (!PyArg_ParseTuple(_args, ""))
return NULL;
- _rv = GetPortTextFont(port);
- _res = Py_BuildValue("h",
+ _rv = GetCTSeed();
+ _res = Py_BuildValue("l",
_rv);
return _res;
}
-static PyObject *Qd_GetPortTextFace(PyObject *_self, PyObject *_args)
+static PyObject *Qd_GetDeviceList(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- Style _rv;
- CGrafPtr port;
-#ifndef GetPortTextFace
- PyMac_PRECHECK(GetPortTextFace);
+ GDHandle _rv;
+#ifndef GetDeviceList
+ PyMac_PRECHECK(GetDeviceList);
#endif
- if (!PyArg_ParseTuple(_args, "O&",
- GrafObj_Convert, &port))
+ if (!PyArg_ParseTuple(_args, ""))
return NULL;
- _rv = GetPortTextFace(port);
- _res = Py_BuildValue("b",
- _rv);
+ _rv = GetDeviceList();
+ _res = Py_BuildValue("O&",
+ ResObj_New, _rv);
return _res;
}
-static PyObject *Qd_GetPortTextMode(PyObject *_self, PyObject *_args)
+static PyObject *Qd_GetMainDevice(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- short _rv;
- CGrafPtr port;
-#ifndef GetPortTextMode
- PyMac_PRECHECK(GetPortTextMode);
+ GDHandle _rv;
+#ifndef GetMainDevice
+ PyMac_PRECHECK(GetMainDevice);
#endif
- if (!PyArg_ParseTuple(_args, "O&",
- GrafObj_Convert, &port))
+ if (!PyArg_ParseTuple(_args, ""))
return NULL;
- _rv = GetPortTextMode(port);
- _res = Py_BuildValue("h",
- _rv);
+ _rv = GetMainDevice();
+ _res = Py_BuildValue("O&",
+ ResObj_New, _rv);
return _res;
}
-static PyObject *Qd_GetPortTextSize(PyObject *_self, PyObject *_args)
+static PyObject *Qd_GetNextDevice(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- short _rv;
- CGrafPtr port;
-#ifndef GetPortTextSize
- PyMac_PRECHECK(GetPortTextSize);
+ GDHandle _rv;
+ GDHandle curDevice;
+#ifndef GetNextDevice
+ PyMac_PRECHECK(GetNextDevice);
#endif
if (!PyArg_ParseTuple(_args, "O&",
- GrafObj_Convert, &port))
+ ResObj_Convert, &curDevice))
return NULL;
- _rv = GetPortTextSize(port);
- _res = Py_BuildValue("h",
- _rv);
+ _rv = GetNextDevice(curDevice);
+ _res = Py_BuildValue("O&",
+ ResObj_New, _rv);
return _res;
}
-static PyObject *Qd_GetPortChExtra(PyObject *_self, PyObject *_args)
+static PyObject *Qd_TestDeviceAttribute(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- short _rv;
- CGrafPtr port;
-#ifndef GetPortChExtra
- PyMac_PRECHECK(GetPortChExtra);
+ Boolean _rv;
+ GDHandle gdh;
+ short attribute;
+#ifndef TestDeviceAttribute
+ PyMac_PRECHECK(TestDeviceAttribute);
#endif
- if (!PyArg_ParseTuple(_args, "O&",
- GrafObj_Convert, &port))
+ if (!PyArg_ParseTuple(_args, "O&h",
+ ResObj_Convert, &gdh,
+ &attribute))
return NULL;
- _rv = GetPortChExtra(port);
- _res = Py_BuildValue("h",
+ _rv = TestDeviceAttribute(gdh,
+ attribute);
+ _res = Py_BuildValue("b",
_rv);
return _res;
}
-static PyObject *Qd_GetPortFracHPenLocation(PyObject *_self, PyObject *_args)
+static PyObject *Qd_SetDeviceAttribute(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- short _rv;
- CGrafPtr port;
-#ifndef GetPortFracHPenLocation
- PyMac_PRECHECK(GetPortFracHPenLocation);
+ GDHandle gdh;
+ short attribute;
+ Boolean value;
+#ifndef SetDeviceAttribute
+ PyMac_PRECHECK(SetDeviceAttribute);
#endif
- if (!PyArg_ParseTuple(_args, "O&",
- GrafObj_Convert, &port))
+ if (!PyArg_ParseTuple(_args, "O&hb",
+ ResObj_Convert, &gdh,
+ &attribute,
+ &value))
return NULL;
- _rv = GetPortFracHPenLocation(port);
- _res = Py_BuildValue("h",
- _rv);
+ SetDeviceAttribute(gdh,
+ attribute,
+ value);
+ Py_INCREF(Py_None);
+ _res = Py_None;
return _res;
}
-static PyObject *Qd_GetPortSpExtra(PyObject *_self, PyObject *_args)
+static PyObject *Qd_InitGDevice(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- Fixed _rv;
- CGrafPtr port;
-#ifndef GetPortSpExtra
- PyMac_PRECHECK(GetPortSpExtra);
+ short qdRefNum;
+ long mode;
+ GDHandle gdh;
+#ifndef InitGDevice
+ PyMac_PRECHECK(InitGDevice);
#endif
- if (!PyArg_ParseTuple(_args, "O&",
- GrafObj_Convert, &port))
+ if (!PyArg_ParseTuple(_args, "hlO&",
+ &qdRefNum,
+ &mode,
+ ResObj_Convert, &gdh))
return NULL;
- _rv = GetPortSpExtra(port);
- _res = Py_BuildValue("O&",
- PyMac_BuildFixed, _rv);
+ InitGDevice(qdRefNum,
+ mode,
+ gdh);
+ Py_INCREF(Py_None);
+ _res = Py_None;
return _res;
}
-static PyObject *Qd_GetPortPenVisibility(PyObject *_self, PyObject *_args)
+static PyObject *Qd_NewGDevice(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- short _rv;
- CGrafPtr port;
-#ifndef GetPortPenVisibility
- PyMac_PRECHECK(GetPortPenVisibility);
+ GDHandle _rv;
+ short refNum;
+ long mode;
+#ifndef NewGDevice
+ PyMac_PRECHECK(NewGDevice);
#endif
- if (!PyArg_ParseTuple(_args, "O&",
- GrafObj_Convert, &port))
+ if (!PyArg_ParseTuple(_args, "hl",
+ &refNum,
+ &mode))
return NULL;
- _rv = GetPortPenVisibility(port);
- _res = Py_BuildValue("h",
- _rv);
+ _rv = NewGDevice(refNum,
+ mode);
+ _res = Py_BuildValue("O&",
+ ResObj_New, _rv);
return _res;
}
-static PyObject *Qd_GetPortVisibleRegion(PyObject *_self, PyObject *_args)
+static PyObject *Qd_DisposeGDevice(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- RgnHandle _rv;
- CGrafPtr port;
- RgnHandle visRgn;
-#ifndef GetPortVisibleRegion
- PyMac_PRECHECK(GetPortVisibleRegion);
+ GDHandle gdh;
+#ifndef DisposeGDevice
+ PyMac_PRECHECK(DisposeGDevice);
#endif
- if (!PyArg_ParseTuple(_args, "O&O&",
- GrafObj_Convert, &port,
- ResObj_Convert, &visRgn))
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &gdh))
return NULL;
- _rv = GetPortVisibleRegion(port,
- visRgn);
- _res = Py_BuildValue("O&",
- ResObj_New, _rv);
+ DisposeGDevice(gdh);
+ Py_INCREF(Py_None);
+ _res = Py_None;
return _res;
}
-static PyObject *Qd_GetPortClipRegion(PyObject *_self, PyObject *_args)
+static PyObject *Qd_SetGDevice(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- RgnHandle _rv;
- CGrafPtr port;
- RgnHandle clipRgn;
-#ifndef GetPortClipRegion
- PyMac_PRECHECK(GetPortClipRegion);
+ GDHandle gd;
+#ifndef SetGDevice
+ PyMac_PRECHECK(SetGDevice);
#endif
- if (!PyArg_ParseTuple(_args, "O&O&",
- GrafObj_Convert, &port,
- ResObj_Convert, &clipRgn))
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &gd))
return NULL;
- _rv = GetPortClipRegion(port,
- clipRgn);
- _res = Py_BuildValue("O&",
- ResObj_New, _rv);
+ SetGDevice(gd);
+ Py_INCREF(Py_None);
+ _res = Py_None;
return _res;
}
-static PyObject *Qd_GetPortBackPixPat(PyObject *_self, PyObject *_args)
+static PyObject *Qd_GetGDevice(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- PixPatHandle _rv;
- CGrafPtr port;
- PixPatHandle backPattern;
-#ifndef GetPortBackPixPat
- PyMac_PRECHECK(GetPortBackPixPat);
+ GDHandle _rv;
+#ifndef GetGDevice
+ PyMac_PRECHECK(GetGDevice);
#endif
- if (!PyArg_ParseTuple(_args, "O&O&",
- GrafObj_Convert, &port,
- ResObj_Convert, &backPattern))
+ if (!PyArg_ParseTuple(_args, ""))
return NULL;
- _rv = GetPortBackPixPat(port,
- backPattern);
+ _rv = GetGDevice();
_res = Py_BuildValue("O&",
ResObj_New, _rv);
return _res;
}
-static PyObject *Qd_GetPortPenPixPat(PyObject *_self, PyObject *_args)
+static PyObject *Qd_Color2Index(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- PixPatHandle _rv;
- CGrafPtr port;
- PixPatHandle penPattern;
-#ifndef GetPortPenPixPat
- PyMac_PRECHECK(GetPortPenPixPat);
+ long _rv;
+ RGBColor myColor;
+#ifndef Color2Index
+ PyMac_PRECHECK(Color2Index);
#endif
- if (!PyArg_ParseTuple(_args, "O&O&",
- GrafObj_Convert, &port,
- ResObj_Convert, &penPattern))
+ if (!PyArg_ParseTuple(_args, "O&",
+ QdRGB_Convert, &myColor))
return NULL;
- _rv = GetPortPenPixPat(port,
- penPattern);
- _res = Py_BuildValue("O&",
- ResObj_New, _rv);
+ _rv = Color2Index(&myColor);
+ _res = Py_BuildValue("l",
+ _rv);
return _res;
}
-static PyObject *Qd_GetPortFillPixPat(PyObject *_self, PyObject *_args)
+static PyObject *Qd_Index2Color(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- PixPatHandle _rv;
- CGrafPtr port;
- PixPatHandle fillPattern;
-#ifndef GetPortFillPixPat
- PyMac_PRECHECK(GetPortFillPixPat);
+ long index;
+ RGBColor aColor;
+#ifndef Index2Color
+ PyMac_PRECHECK(Index2Color);
#endif
- if (!PyArg_ParseTuple(_args, "O&O&",
- GrafObj_Convert, &port,
- ResObj_Convert, &fillPattern))
+ if (!PyArg_ParseTuple(_args, "l",
+ &index))
return NULL;
- _rv = GetPortFillPixPat(port,
- fillPattern);
+ Index2Color(index,
+ &aColor);
_res = Py_BuildValue("O&",
- ResObj_New, _rv);
+ QdRGB_New, &aColor);
return _res;
}
-static PyObject *Qd_GetPortPenSize(PyObject *_self, PyObject *_args)
+static PyObject *Qd_InvertColor(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- CGrafPtr port;
- Point penSize;
-#ifndef GetPortPenSize
- PyMac_PRECHECK(GetPortPenSize);
+ RGBColor myColor;
+#ifndef InvertColor
+ PyMac_PRECHECK(InvertColor);
#endif
- if (!PyArg_ParseTuple(_args, "O&O&",
- GrafObj_Convert, &port,
- PyMac_GetPoint, &penSize))
+ if (!PyArg_ParseTuple(_args, ""))
return NULL;
- GetPortPenSize(port,
- &penSize);
+ InvertColor(&myColor);
_res = Py_BuildValue("O&",
- PyMac_BuildPoint, penSize);
+ QdRGB_New, &myColor);
return _res;
}
-static PyObject *Qd_GetPortPenMode(PyObject *_self, PyObject *_args)
+static PyObject *Qd_RealColor(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- SInt32 _rv;
- CGrafPtr port;
-#ifndef GetPortPenMode
- PyMac_PRECHECK(GetPortPenMode);
+ Boolean _rv;
+ RGBColor color;
+#ifndef RealColor
+ PyMac_PRECHECK(RealColor);
#endif
if (!PyArg_ParseTuple(_args, "O&",
- GrafObj_Convert, &port))
+ QdRGB_Convert, &color))
return NULL;
- _rv = GetPortPenMode(port);
- _res = Py_BuildValue("l",
+ _rv = RealColor(&color);
+ _res = Py_BuildValue("b",
_rv);
return _res;
}
-static PyObject *Qd_GetPortPenLocation(PyObject *_self, PyObject *_args)
+static PyObject *Qd_GetSubTable(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- CGrafPtr port;
- Point penLocation;
-#ifndef GetPortPenLocation
- PyMac_PRECHECK(GetPortPenLocation);
+ CTabHandle myColors;
+ short iTabRes;
+ CTabHandle targetTbl;
+#ifndef GetSubTable
+ PyMac_PRECHECK(GetSubTable);
#endif
- if (!PyArg_ParseTuple(_args, "O&O&",
- GrafObj_Convert, &port,
- PyMac_GetPoint, &penLocation))
+ if (!PyArg_ParseTuple(_args, "O&hO&",
+ ResObj_Convert, &myColors,
+ &iTabRes,
+ ResObj_Convert, &targetTbl))
return NULL;
- GetPortPenLocation(port,
- &penLocation);
- _res = Py_BuildValue("O&",
- PyMac_BuildPoint, penLocation);
+ GetSubTable(myColors,
+ iTabRes,
+ targetTbl);
+ Py_INCREF(Py_None);
+ _res = Py_None;
return _res;
}
-static PyObject *Qd_IsPortRegionBeingDefined(PyObject *_self, PyObject *_args)
+static PyObject *Qd_MakeITable(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- Boolean _rv;
- CGrafPtr port;
-#ifndef IsPortRegionBeingDefined
- PyMac_PRECHECK(IsPortRegionBeingDefined);
+ CTabHandle cTabH;
+ ITabHandle iTabH;
+ short res;
+#ifndef MakeITable
+ PyMac_PRECHECK(MakeITable);
#endif
- if (!PyArg_ParseTuple(_args, "O&",
- GrafObj_Convert, &port))
+ if (!PyArg_ParseTuple(_args, "O&O&h",
+ ResObj_Convert, &cTabH,
+ ResObj_Convert, &iTabH,
+ &res))
return NULL;
- _rv = IsPortRegionBeingDefined(port);
- _res = Py_BuildValue("b",
- _rv);
+ MakeITable(cTabH,
+ iTabH,
+ res);
+ Py_INCREF(Py_None);
+ _res = Py_None;
return _res;
}
-static PyObject *Qd_IsPortPictureBeingDefined(PyObject *_self, PyObject *_args)
+static PyObject *Qd_SetClientID(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- Boolean _rv;
- CGrafPtr port;
-#ifndef IsPortPictureBeingDefined
- PyMac_PRECHECK(IsPortPictureBeingDefined);
+ short id;
+#ifndef SetClientID
+ PyMac_PRECHECK(SetClientID);
#endif
- if (!PyArg_ParseTuple(_args, "O&",
- GrafObj_Convert, &port))
+ if (!PyArg_ParseTuple(_args, "h",
+ &id))
return NULL;
- _rv = IsPortPictureBeingDefined(port);
- _res = Py_BuildValue("b",
- _rv);
+ SetClientID(id);
+ Py_INCREF(Py_None);
+ _res = Py_None;
return _res;
}
-#if TARGET_API_MAC_CARBON
-
-static PyObject *Qd_IsPortPolyBeingDefined(PyObject *_self, PyObject *_args)
+static PyObject *Qd_ProtectEntry(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- Boolean _rv;
- CGrafPtr port;
-#ifndef IsPortPolyBeingDefined
- PyMac_PRECHECK(IsPortPolyBeingDefined);
+ short index;
+ Boolean protect;
+#ifndef ProtectEntry
+ PyMac_PRECHECK(ProtectEntry);
#endif
- if (!PyArg_ParseTuple(_args, "O&",
- GrafObj_Convert, &port))
+ if (!PyArg_ParseTuple(_args, "hb",
+ &index,
+ &protect))
return NULL;
- _rv = IsPortPolyBeingDefined(port);
- _res = Py_BuildValue("b",
- _rv);
+ ProtectEntry(index,
+ protect);
+ Py_INCREF(Py_None);
+ _res = Py_None;
return _res;
}
-#endif
-
-#if TARGET_API_MAC_CARBON
-static PyObject *Qd_IsPortOffscreen(PyObject *_self, PyObject *_args)
+static PyObject *Qd_ReserveEntry(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- Boolean _rv;
- CGrafPtr port;
-#ifndef IsPortOffscreen
- PyMac_PRECHECK(IsPortOffscreen);
+ short index;
+ Boolean reserve;
+#ifndef ReserveEntry
+ PyMac_PRECHECK(ReserveEntry);
#endif
- if (!PyArg_ParseTuple(_args, "O&",
- GrafObj_Convert, &port))
+ if (!PyArg_ParseTuple(_args, "hb",
+ &index,
+ &reserve))
return NULL;
- _rv = IsPortOffscreen(port);
- _res = Py_BuildValue("b",
- _rv);
+ ReserveEntry(index,
+ reserve);
+ Py_INCREF(Py_None);
+ _res = Py_None;
return _res;
}
-#endif
-
-#if TARGET_API_MAC_CARBON
-static PyObject *Qd_IsPortColor(PyObject *_self, PyObject *_args)
+static PyObject *Qd_QDError(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- Boolean _rv;
- CGrafPtr port;
-#ifndef IsPortColor
- PyMac_PRECHECK(IsPortColor);
+ short _rv;
+#ifndef QDError
+ PyMac_PRECHECK(QDError);
#endif
- if (!PyArg_ParseTuple(_args, "O&",
- GrafObj_Convert, &port))
+ if (!PyArg_ParseTuple(_args, ""))
return NULL;
- _rv = IsPortColor(port);
- _res = Py_BuildValue("b",
+ _rv = QDError();
+ _res = Py_BuildValue("h",
_rv);
return _res;
}
-#endif
-static PyObject *Qd_SetPortBounds(PyObject *_self, PyObject *_args)
+static PyObject *Qd_CopyDeepMask(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- CGrafPtr port;
- Rect rect;
-#ifndef SetPortBounds
- PyMac_PRECHECK(SetPortBounds);
+ BitMapPtr srcBits;
+ BitMapPtr maskBits;
+ BitMapPtr dstBits;
+ Rect srcRect;
+ Rect maskRect;
+ Rect dstRect;
+ short mode;
+ RgnHandle maskRgn;
+#ifndef CopyDeepMask
+ PyMac_PRECHECK(CopyDeepMask);
#endif
- if (!PyArg_ParseTuple(_args, "O&O&",
- GrafObj_Convert, &port,
- PyMac_GetRect, &rect))
+ if (!PyArg_ParseTuple(_args, "O&O&O&O&O&O&hO&",
+ BMObj_Convert, &srcBits,
+ BMObj_Convert, &maskBits,
+ BMObj_Convert, &dstBits,
+ PyMac_GetRect, &srcRect,
+ PyMac_GetRect, &maskRect,
+ PyMac_GetRect, &dstRect,
+ &mode,
+ OptResObj_Convert, &maskRgn))
return NULL;
- SetPortBounds(port,
- &rect);
+ CopyDeepMask(srcBits,
+ maskBits,
+ dstBits,
+ &srcRect,
+ &maskRect,
+ &dstRect,
+ mode,
+ maskRgn);
Py_INCREF(Py_None);
_res = Py_None;
return _res;
}
-static PyObject *Qd_SetPortOpColor(PyObject *_self, PyObject *_args)
+static PyObject *Qd_GetPattern(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- CGrafPtr port;
- RGBColor opColor;
-#ifndef SetPortOpColor
- PyMac_PRECHECK(SetPortOpColor);
+ PatHandle _rv;
+ short patternID;
+#ifndef GetPattern
+ PyMac_PRECHECK(GetPattern);
#endif
- if (!PyArg_ParseTuple(_args, "O&O&",
- GrafObj_Convert, &port,
- QdRGB_Convert, &opColor))
+ if (!PyArg_ParseTuple(_args, "h",
+ &patternID))
return NULL;
- SetPortOpColor(port,
- &opColor);
- Py_INCREF(Py_None);
- _res = Py_None;
+ _rv = GetPattern(patternID);
+ _res = Py_BuildValue("O&",
+ ResObj_New, _rv);
return _res;
}
-static PyObject *Qd_SetPortVisibleRegion(PyObject *_self, PyObject *_args)
+static PyObject *Qd_MacGetCursor(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- CGrafPtr port;
- RgnHandle visRgn;
-#ifndef SetPortVisibleRegion
- PyMac_PRECHECK(SetPortVisibleRegion);
-#endif
- if (!PyArg_ParseTuple(_args, "O&O&",
- GrafObj_Convert, &port,
- ResObj_Convert, &visRgn))
+ CursHandle _rv;
+ short cursorID;
+#ifndef MacGetCursor
+ PyMac_PRECHECK(MacGetCursor);
+#endif
+ if (!PyArg_ParseTuple(_args, "h",
+ &cursorID))
return NULL;
- SetPortVisibleRegion(port,
- visRgn);
- Py_INCREF(Py_None);
- _res = Py_None;
+ _rv = MacGetCursor(cursorID);
+ _res = Py_BuildValue("O&",
+ ResObj_New, _rv);
return _res;
}
-static PyObject *Qd_SetPortClipRegion(PyObject *_self, PyObject *_args)
+static PyObject *Qd_GetPicture(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- CGrafPtr port;
- RgnHandle clipRgn;
-#ifndef SetPortClipRegion
- PyMac_PRECHECK(SetPortClipRegion);
+ PicHandle _rv;
+ short pictureID;
+#ifndef GetPicture
+ PyMac_PRECHECK(GetPicture);
#endif
- if (!PyArg_ParseTuple(_args, "O&O&",
- GrafObj_Convert, &port,
- ResObj_Convert, &clipRgn))
+ if (!PyArg_ParseTuple(_args, "h",
+ &pictureID))
return NULL;
- SetPortClipRegion(port,
- clipRgn);
- Py_INCREF(Py_None);
- _res = Py_None;
+ _rv = GetPicture(pictureID);
+ _res = Py_BuildValue("O&",
+ ResObj_New, _rv);
return _res;
}
-static PyObject *Qd_SetPortPenPixPat(PyObject *_self, PyObject *_args)
+static PyObject *Qd_DeltaPoint(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- CGrafPtr port;
- PixPatHandle penPattern;
-#ifndef SetPortPenPixPat
- PyMac_PRECHECK(SetPortPenPixPat);
+ long _rv;
+ Point ptA;
+ Point ptB;
+#ifndef DeltaPoint
+ PyMac_PRECHECK(DeltaPoint);
#endif
if (!PyArg_ParseTuple(_args, "O&O&",
- GrafObj_Convert, &port,
- ResObj_Convert, &penPattern))
+ PyMac_GetPoint, &ptA,
+ PyMac_GetPoint, &ptB))
return NULL;
- SetPortPenPixPat(port,
- penPattern);
- Py_INCREF(Py_None);
- _res = Py_None;
+ _rv = DeltaPoint(ptA,
+ ptB);
+ _res = Py_BuildValue("l",
+ _rv);
return _res;
}
-static PyObject *Qd_SetPortFillPixPat(PyObject *_self, PyObject *_args)
+static PyObject *Qd_ShieldCursor(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- CGrafPtr port;
- PixPatHandle penPattern;
-#ifndef SetPortFillPixPat
- PyMac_PRECHECK(SetPortFillPixPat);
+ Rect shieldRect;
+ Point offsetPt;
+#ifndef ShieldCursor
+ PyMac_PRECHECK(ShieldCursor);
#endif
if (!PyArg_ParseTuple(_args, "O&O&",
- GrafObj_Convert, &port,
- ResObj_Convert, &penPattern))
+ PyMac_GetRect, &shieldRect,
+ PyMac_GetPoint, &offsetPt))
return NULL;
- SetPortFillPixPat(port,
- penPattern);
+ ShieldCursor(&shieldRect,
+ offsetPt);
Py_INCREF(Py_None);
_res = Py_None;
return _res;
}
-static PyObject *Qd_SetPortBackPixPat(PyObject *_self, PyObject *_args)
+static PyObject *Qd_ScreenRes(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- CGrafPtr port;
- PixPatHandle backPattern;
-#ifndef SetPortBackPixPat
- PyMac_PRECHECK(SetPortBackPixPat);
+ short scrnHRes;
+ short scrnVRes;
+#ifndef ScreenRes
+ PyMac_PRECHECK(ScreenRes);
#endif
- if (!PyArg_ParseTuple(_args, "O&O&",
- GrafObj_Convert, &port,
- ResObj_Convert, &backPattern))
+ if (!PyArg_ParseTuple(_args, ""))
return NULL;
- SetPortBackPixPat(port,
- backPattern);
- Py_INCREF(Py_None);
- _res = Py_None;
+ ScreenRes(&scrnHRes,
+ &scrnVRes);
+ _res = Py_BuildValue("hh",
+ scrnHRes,
+ scrnVRes);
return _res;
}
-static PyObject *Qd_SetPortPenSize(PyObject *_self, PyObject *_args)
+static PyObject *Qd_GetIndPattern(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- CGrafPtr port;
- Point penSize;
-#ifndef SetPortPenSize
- PyMac_PRECHECK(SetPortPenSize);
+ Pattern thePat__out__;
+ short patternListID;
+ short index;
+#ifndef GetIndPattern
+ PyMac_PRECHECK(GetIndPattern);
#endif
- if (!PyArg_ParseTuple(_args, "O&O&",
- GrafObj_Convert, &port,
- PyMac_GetPoint, &penSize))
+ if (!PyArg_ParseTuple(_args, "hh",
+ &patternListID,
+ &index))
return NULL;
- SetPortPenSize(port,
- penSize);
- Py_INCREF(Py_None);
- _res = Py_None;
+ GetIndPattern(&thePat__out__,
+ patternListID,
+ index);
+ _res = Py_BuildValue("s#",
+ (char *)&thePat__out__, (int)sizeof(Pattern));
return _res;
}
-static PyObject *Qd_SetPortPenMode(PyObject *_self, PyObject *_args)
+static PyObject *Qd_SlopeFromAngle(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- CGrafPtr port;
- SInt32 penMode;
-#ifndef SetPortPenMode
- PyMac_PRECHECK(SetPortPenMode);
+ Fixed _rv;
+ short angle;
+#ifndef SlopeFromAngle
+ PyMac_PRECHECK(SlopeFromAngle);
#endif
- if (!PyArg_ParseTuple(_args, "O&l",
- GrafObj_Convert, &port,
- &penMode))
+ if (!PyArg_ParseTuple(_args, "h",
+ &angle))
return NULL;
- SetPortPenMode(port,
- penMode);
- Py_INCREF(Py_None);
- _res = Py_None;
+ _rv = SlopeFromAngle(angle);
+ _res = Py_BuildValue("O&",
+ PyMac_BuildFixed, _rv);
return _res;
}
-static PyObject *Qd_SetPortFracHPenLocation(PyObject *_self, PyObject *_args)
+static PyObject *Qd_AngleFromSlope(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
- CGrafPtr port;
- short pnLocHFrac;
-#ifndef SetPortFracHPenLocation
- PyMac_PRECHECK(SetPortFracHPenLocation);
+ short _rv;
+ Fixed slope;
+#ifndef AngleFromSlope
+ PyMac_PRECHECK(AngleFromSlope);
#endif
- if (!PyArg_ParseTuple(_args, "O&h",
- GrafObj_Convert, &port,
- &pnLocHFrac))
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetFixed, &slope))
return NULL;
- SetPortFracHPenLocation(port,
- pnLocHFrac);
- Py_INCREF(Py_None);
- _res = Py_None;
+ _rv = AngleFromSlope(slope);
+ _res = Py_BuildValue("h",
+ _rv);
return _res;
}
#if TARGET_API_MAC_CARBON
-static PyObject *Qd_DisposePort(PyObject *_self, PyObject *_args)
-{
- PyObject *_res = NULL;
- CGrafPtr port;
-#ifndef DisposePort
- PyMac_PRECHECK(DisposePort);
-#endif
- if (!PyArg_ParseTuple(_args, "O&",
- GrafObj_Convert, &port))
- return NULL;
- DisposePort(port);
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
-}
-#endif
-
-#if TARGET_API_MAC_CARBON
-
static PyObject *Qd_SetQDError(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
}
#endif
-static PyObject *Qd_QDIsPortBuffered(PyObject *_self, PyObject *_args)
-{
- PyObject *_res = NULL;
- Boolean _rv;
- CGrafPtr port;
-#ifndef QDIsPortBuffered
- PyMac_PRECHECK(QDIsPortBuffered);
-#endif
- if (!PyArg_ParseTuple(_args, "O&",
- GrafObj_Convert, &port))
- return NULL;
- _rv = QDIsPortBuffered(port);
- _res = Py_BuildValue("b",
- _rv);
- return _res;
-}
-
-static PyObject *Qd_QDIsPortBufferDirty(PyObject *_self, PyObject *_args)
-{
- PyObject *_res = NULL;
- Boolean _rv;
- CGrafPtr port;
-#ifndef QDIsPortBufferDirty
- PyMac_PRECHECK(QDIsPortBufferDirty);
-#endif
- if (!PyArg_ParseTuple(_args, "O&",
- GrafObj_Convert, &port))
- return NULL;
- _rv = QDIsPortBufferDirty(port);
- _res = Py_BuildValue("b",
- _rv);
- return _res;
-}
-
-static PyObject *Qd_QDFlushPortBuffer(PyObject *_self, PyObject *_args)
-{
- PyObject *_res = NULL;
- CGrafPtr port;
- RgnHandle region;
-#ifndef QDFlushPortBuffer
- PyMac_PRECHECK(QDFlushPortBuffer);
-#endif
- if (!PyArg_ParseTuple(_args, "O&O&",
- GrafObj_Convert, &port,
- OptResObj_Convert, ®ion))
- return NULL;
- QDFlushPortBuffer(port,
- region);
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
-}
-
-#if TARGET_API_MAC_CARBON
-
-static PyObject *Qd_QDGetDirtyRegion(PyObject *_self, PyObject *_args)
-{
- PyObject *_res = NULL;
- OSStatus _err;
- CGrafPtr port;
- RgnHandle rgn;
-#ifndef QDGetDirtyRegion
- PyMac_PRECHECK(QDGetDirtyRegion);
-#endif
- if (!PyArg_ParseTuple(_args, "O&O&",
- GrafObj_Convert, &port,
- ResObj_Convert, &rgn))
- return NULL;
- _err = QDGetDirtyRegion(port,
- rgn);
- if (_err != noErr) return PyMac_Error(_err);
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
-}
-#endif
-
-#if TARGET_API_MAC_CARBON
-
-static PyObject *Qd_QDSetDirtyRegion(PyObject *_self, PyObject *_args)
-{
- PyObject *_res = NULL;
- OSStatus _err;
- CGrafPtr port;
- RgnHandle rgn;
-#ifndef QDSetDirtyRegion
- PyMac_PRECHECK(QDSetDirtyRegion);
-#endif
- if (!PyArg_ParseTuple(_args, "O&O&",
- GrafObj_Convert, &port,
- ResObj_Convert, &rgn))
- return NULL;
- _err = QDSetDirtyRegion(port,
- rgn);
- if (_err != noErr) return PyMac_Error(_err);
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
-}
-#endif
-
static PyObject *Qd_LMGetScrVRes(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
}
static PyMethodDef Qd_methods[] = {
- {"MacSetPort", (PyCFunction)Qd_MacSetPort, 1,
- PyDoc_STR("(GrafPtr port) -> None")},
{"GetPort", (PyCFunction)Qd_GetPort, 1,
PyDoc_STR("() -> (GrafPtr port)")},
{"GrafDevice", (PyCFunction)Qd_GrafDevice, 1,
PyDoc_STR("(short angle) -> (Fixed _rv)")},
{"AngleFromSlope", (PyCFunction)Qd_AngleFromSlope, 1,
PyDoc_STR("(Fixed slope) -> (short _rv)")},
-
-#if TARGET_API_MAC_CARBON
- {"IsValidPort", (PyCFunction)Qd_IsValidPort, 1,
- PyDoc_STR("(CGrafPtr port) -> (Boolean _rv)")},
-#endif
- {"GetPortPixMap", (PyCFunction)Qd_GetPortPixMap, 1,
- PyDoc_STR("(CGrafPtr port) -> (PixMapHandle _rv)")},
- {"GetPortBitMapForCopyBits", (PyCFunction)Qd_GetPortBitMapForCopyBits, 1,
- PyDoc_STR("(CGrafPtr port) -> (const BitMap * _rv)")},
- {"GetPortBounds", (PyCFunction)Qd_GetPortBounds, 1,
- PyDoc_STR("(CGrafPtr port) -> (Rect rect)")},
- {"GetPortForeColor", (PyCFunction)Qd_GetPortForeColor, 1,
- PyDoc_STR("(CGrafPtr port) -> (RGBColor foreColor)")},
- {"GetPortBackColor", (PyCFunction)Qd_GetPortBackColor, 1,
- PyDoc_STR("(CGrafPtr port) -> (RGBColor backColor)")},
- {"GetPortOpColor", (PyCFunction)Qd_GetPortOpColor, 1,
- PyDoc_STR("(CGrafPtr port) -> (RGBColor opColor)")},
- {"GetPortHiliteColor", (PyCFunction)Qd_GetPortHiliteColor, 1,
- PyDoc_STR("(CGrafPtr port) -> (RGBColor hiliteColor)")},
- {"GetPortTextFont", (PyCFunction)Qd_GetPortTextFont, 1,
- PyDoc_STR("(CGrafPtr port) -> (short _rv)")},
- {"GetPortTextFace", (PyCFunction)Qd_GetPortTextFace, 1,
- PyDoc_STR("(CGrafPtr port) -> (Style _rv)")},
- {"GetPortTextMode", (PyCFunction)Qd_GetPortTextMode, 1,
- PyDoc_STR("(CGrafPtr port) -> (short _rv)")},
- {"GetPortTextSize", (PyCFunction)Qd_GetPortTextSize, 1,
- PyDoc_STR("(CGrafPtr port) -> (short _rv)")},
- {"GetPortChExtra", (PyCFunction)Qd_GetPortChExtra, 1,
- PyDoc_STR("(CGrafPtr port) -> (short _rv)")},
- {"GetPortFracHPenLocation", (PyCFunction)Qd_GetPortFracHPenLocation, 1,
- PyDoc_STR("(CGrafPtr port) -> (short _rv)")},
- {"GetPortSpExtra", (PyCFunction)Qd_GetPortSpExtra, 1,
- PyDoc_STR("(CGrafPtr port) -> (Fixed _rv)")},
- {"GetPortPenVisibility", (PyCFunction)Qd_GetPortPenVisibility, 1,
- PyDoc_STR("(CGrafPtr port) -> (short _rv)")},
- {"GetPortVisibleRegion", (PyCFunction)Qd_GetPortVisibleRegion, 1,
- PyDoc_STR("(CGrafPtr port, RgnHandle visRgn) -> (RgnHandle _rv)")},
- {"GetPortClipRegion", (PyCFunction)Qd_GetPortClipRegion, 1,
- PyDoc_STR("(CGrafPtr port, RgnHandle clipRgn) -> (RgnHandle _rv)")},
- {"GetPortBackPixPat", (PyCFunction)Qd_GetPortBackPixPat, 1,
- PyDoc_STR("(CGrafPtr port, PixPatHandle backPattern) -> (PixPatHandle _rv)")},
- {"GetPortPenPixPat", (PyCFunction)Qd_GetPortPenPixPat, 1,
- PyDoc_STR("(CGrafPtr port, PixPatHandle penPattern) -> (PixPatHandle _rv)")},
- {"GetPortFillPixPat", (PyCFunction)Qd_GetPortFillPixPat, 1,
- PyDoc_STR("(CGrafPtr port, PixPatHandle fillPattern) -> (PixPatHandle _rv)")},
- {"GetPortPenSize", (PyCFunction)Qd_GetPortPenSize, 1,
- PyDoc_STR("(CGrafPtr port, Point penSize) -> (Point penSize)")},
- {"GetPortPenMode", (PyCFunction)Qd_GetPortPenMode, 1,
- PyDoc_STR("(CGrafPtr port) -> (SInt32 _rv)")},
- {"GetPortPenLocation", (PyCFunction)Qd_GetPortPenLocation, 1,
- PyDoc_STR("(CGrafPtr port, Point penLocation) -> (Point penLocation)")},
- {"IsPortRegionBeingDefined", (PyCFunction)Qd_IsPortRegionBeingDefined, 1,
- PyDoc_STR("(CGrafPtr port) -> (Boolean _rv)")},
- {"IsPortPictureBeingDefined", (PyCFunction)Qd_IsPortPictureBeingDefined, 1,
- PyDoc_STR("(CGrafPtr port) -> (Boolean _rv)")},
-
-#if TARGET_API_MAC_CARBON
- {"IsPortPolyBeingDefined", (PyCFunction)Qd_IsPortPolyBeingDefined, 1,
- PyDoc_STR("(CGrafPtr port) -> (Boolean _rv)")},
-#endif
-
-#if TARGET_API_MAC_CARBON
- {"IsPortOffscreen", (PyCFunction)Qd_IsPortOffscreen, 1,
- PyDoc_STR("(CGrafPtr port) -> (Boolean _rv)")},
-#endif
-
-#if TARGET_API_MAC_CARBON
- {"IsPortColor", (PyCFunction)Qd_IsPortColor, 1,
- PyDoc_STR("(CGrafPtr port) -> (Boolean _rv)")},
-#endif
- {"SetPortBounds", (PyCFunction)Qd_SetPortBounds, 1,
- PyDoc_STR("(CGrafPtr port, Rect rect) -> None")},
- {"SetPortOpColor", (PyCFunction)Qd_SetPortOpColor, 1,
- PyDoc_STR("(CGrafPtr port, RGBColor opColor) -> None")},
- {"SetPortVisibleRegion", (PyCFunction)Qd_SetPortVisibleRegion, 1,
- PyDoc_STR("(CGrafPtr port, RgnHandle visRgn) -> None")},
- {"SetPortClipRegion", (PyCFunction)Qd_SetPortClipRegion, 1,
- PyDoc_STR("(CGrafPtr port, RgnHandle clipRgn) -> None")},
- {"SetPortPenPixPat", (PyCFunction)Qd_SetPortPenPixPat, 1,
- PyDoc_STR("(CGrafPtr port, PixPatHandle penPattern) -> None")},
- {"SetPortFillPixPat", (PyCFunction)Qd_SetPortFillPixPat, 1,
- PyDoc_STR("(CGrafPtr port, PixPatHandle penPattern) -> None")},
- {"SetPortBackPixPat", (PyCFunction)Qd_SetPortBackPixPat, 1,
- PyDoc_STR("(CGrafPtr port, PixPatHandle backPattern) -> None")},
- {"SetPortPenSize", (PyCFunction)Qd_SetPortPenSize, 1,
- PyDoc_STR("(CGrafPtr port, Point penSize) -> None")},
- {"SetPortPenMode", (PyCFunction)Qd_SetPortPenMode, 1,
- PyDoc_STR("(CGrafPtr port, SInt32 penMode) -> None")},
- {"SetPortFracHPenLocation", (PyCFunction)Qd_SetPortFracHPenLocation, 1,
- PyDoc_STR("(CGrafPtr port, short pnLocHFrac) -> None")},
{"GetPixBounds", (PyCFunction)Qd_GetPixBounds, 1,
PyDoc_STR("(PixMapHandle pixMap) -> (Rect bounds)")},
{"GetPixDepth", (PyCFunction)Qd_GetPixDepth, 1,
PyDoc_STR("() -> (CGrafPtr _rv)")},
#endif
-#if TARGET_API_MAC_CARBON
- {"DisposePort", (PyCFunction)Qd_DisposePort, 1,
- PyDoc_STR("(CGrafPtr port) -> None")},
-#endif
-
#if TARGET_API_MAC_CARBON
{"SetQDError", (PyCFunction)Qd_SetQDError, 1,
PyDoc_STR("(OSErr err) -> None")},
-#endif
- {"QDIsPortBuffered", (PyCFunction)Qd_QDIsPortBuffered, 1,
- PyDoc_STR("(CGrafPtr port) -> (Boolean _rv)")},
- {"QDIsPortBufferDirty", (PyCFunction)Qd_QDIsPortBufferDirty, 1,
- PyDoc_STR("(CGrafPtr port) -> (Boolean _rv)")},
- {"QDFlushPortBuffer", (PyCFunction)Qd_QDFlushPortBuffer, 1,
- PyDoc_STR("(CGrafPtr port, RgnHandle region) -> None")},
-
-#if TARGET_API_MAC_CARBON
- {"QDGetDirtyRegion", (PyCFunction)Qd_QDGetDirtyRegion, 1,
- PyDoc_STR("(CGrafPtr port, RgnHandle rgn) -> None")},
-#endif
-
-#if TARGET_API_MAC_CARBON
- {"QDSetDirtyRegion", (PyCFunction)Qd_QDSetDirtyRegion, 1,
- PyDoc_STR("(CGrafPtr port, RgnHandle rgn) -> None")},
#endif
{"LMGetScrVRes", (PyCFunction)Qd_LMGetScrVRes, 1,
PyDoc_STR("() -> (SInt16 _rv)")},
Py_INCREF(&BitMap_Type);
if (PyDict_SetItemString(d, "BitMapType", (PyObject *)&BitMap_Type) != 0)
Py_FatalError("can't initialize BitMapType");
- QDGlobalsAccess_Type.ob_type = &PyType_Type;
- Py_INCREF(&QDGlobalsAccess_Type);
- if (PyDict_SetItemString(d, "QDGlobalsAccessType", (PyObject *)&QDGlobalsAccess_Type) != 0)
- Py_FatalError("can't initialize QDGlobalsAccessType");
-
- {
- PyObject *o;
-
- o = QDGA_New();
- if (o == NULL || PyDict_SetItemString(d, "qd", o) != 0)
- return;
- }
-
-
}
/* ========================= End module _Qd ========================= */