symbian-qemu-0.9.1-12/python-2.6.1/Mac/Modules/qd/_Qdmodule.c
changeset 1 2fb8b9db1c86
equal deleted inserted replaced
0:ffa851df0825 1:2fb8b9db1c86
       
     1 
       
     2 /* =========================== Module _Qd =========================== */
       
     3 
       
     4 #include "Python.h"
       
     5 
       
     6 
       
     7 #ifndef __LP64__
       
     8 
       
     9 #include "pymactoolbox.h"
       
    10 
       
    11 /* Macro to test whether a weak-loaded CFM function exists */
       
    12 #define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL )  {\
       
    13         PyErr_SetString(PyExc_NotImplementedError, \
       
    14         "Not available in this shared library/OS version"); \
       
    15         return NULL; \
       
    16     }} while(0)
       
    17 
       
    18 
       
    19 #include <Carbon/Carbon.h>
       
    20 
       
    21 #ifdef USE_TOOLBOX_OBJECT_GLUE
       
    22 extern PyObject *_GrafObj_New(GrafPtr);
       
    23 extern int _GrafObj_Convert(PyObject *, GrafPtr *);
       
    24 extern PyObject *_BMObj_New(BitMapPtr);
       
    25 extern int _BMObj_Convert(PyObject *, BitMapPtr *);
       
    26 extern PyObject *_QdRGB_New(RGBColorPtr);
       
    27 extern int _QdRGB_Convert(PyObject *, RGBColorPtr);
       
    28 
       
    29 #define GrafObj_New _GrafObj_New
       
    30 #define GrafObj_Convert _GrafObj_Convert
       
    31 #define BMObj_New _BMObj_New
       
    32 #define BMObj_Convert _BMObj_Convert
       
    33 #define QdRGB_New _QdRGB_New
       
    34 #define QdRGB_Convert _QdRGB_Convert
       
    35 #endif
       
    36 
       
    37 static PyObject *BMObj_NewCopied(BitMapPtr);
       
    38 
       
    39 /*
       
    40 ** Parse/generate RGB records
       
    41 */
       
    42 PyObject *QdRGB_New(RGBColorPtr itself)
       
    43 {
       
    44 
       
    45         return Py_BuildValue("lll", (long)itself->red, (long)itself->green, (long)itself->blue);
       
    46 }
       
    47 
       
    48 int QdRGB_Convert(PyObject *v, RGBColorPtr p_itself)
       
    49 {
       
    50         long red, green, blue;
       
    51 
       
    52         if( !PyArg_ParseTuple(v, "lll", &red, &green, &blue) )
       
    53                 return 0;
       
    54         p_itself->red = (unsigned short)red;
       
    55         p_itself->green = (unsigned short)green;
       
    56         p_itself->blue = (unsigned short)blue;
       
    57         return 1;
       
    58 }
       
    59 
       
    60 /*
       
    61 ** Generate FontInfo records
       
    62 */
       
    63 static
       
    64 PyObject *QdFI_New(FontInfo *itself)
       
    65 {
       
    66 
       
    67         return Py_BuildValue("hhhh", itself->ascent, itself->descent,
       
    68                         itself->widMax, itself->leading);
       
    69 }
       
    70 
       
    71 static PyObject *Qd_Error;
       
    72 
       
    73 /* ---------------------- Object type GrafPort ---------------------- */
       
    74 
       
    75 PyTypeObject GrafPort_Type;
       
    76 
       
    77 #define GrafObj_Check(x) ((x)->ob_type == &GrafPort_Type || PyObject_TypeCheck((x), &GrafPort_Type))
       
    78 
       
    79 typedef struct GrafPortObject {
       
    80 	PyObject_HEAD
       
    81 	GrafPtr ob_itself;
       
    82 } GrafPortObject;
       
    83 
       
    84 PyObject *GrafObj_New(GrafPtr itself)
       
    85 {
       
    86 	GrafPortObject *it;
       
    87 	if (itself == NULL) return PyMac_Error(resNotFound);
       
    88 	it = PyObject_NEW(GrafPortObject, &GrafPort_Type);
       
    89 	if (it == NULL) return NULL;
       
    90 	it->ob_itself = itself;
       
    91 	return (PyObject *)it;
       
    92 }
       
    93 
       
    94 int GrafObj_Convert(PyObject *v, GrafPtr *p_itself)
       
    95 {
       
    96 #if 1
       
    97 	{
       
    98 		WindowRef win;
       
    99 		if (WinObj_Convert(v, &win) && v) {
       
   100 			*p_itself = (GrafPtr)GetWindowPort(win);
       
   101 			return 1;
       
   102 		}
       
   103 		PyErr_Clear();
       
   104 	}
       
   105 #else
       
   106 	if (DlgObj_Check(v)) {
       
   107 		DialogRef dlg = (DialogRef)((GrafPortObject *)v)->ob_itself;
       
   108 		*p_itself = (GrafPtr)GetWindowPort(GetDialogWindow(dlg));
       
   109 		return 1;
       
   110 	}
       
   111 	if (WinObj_Check(v)) {
       
   112 		WindowRef win = (WindowRef)((GrafPortObject *)v)->ob_itself;
       
   113 		*p_itself = (GrafPtr)GetWindowPort(win);
       
   114 		return 1;
       
   115 	}
       
   116 #endif
       
   117 	if (!GrafObj_Check(v))
       
   118 	{
       
   119 		PyErr_SetString(PyExc_TypeError, "GrafPort required");
       
   120 		return 0;
       
   121 	}
       
   122 	*p_itself = ((GrafPortObject *)v)->ob_itself;
       
   123 	return 1;
       
   124 }
       
   125 
       
   126 static void GrafObj_dealloc(GrafPortObject *self)
       
   127 {
       
   128 	/* Cleanup of self->ob_itself goes here */
       
   129 	self->ob_type->tp_free((PyObject *)self);
       
   130 }
       
   131 
       
   132 static PyObject *GrafObj_MacSetPort(GrafPortObject *_self, PyObject *_args)
       
   133 {
       
   134 	PyObject *_res = NULL;
       
   135 #ifndef MacSetPort
       
   136 	PyMac_PRECHECK(MacSetPort);
       
   137 #endif
       
   138 	if (!PyArg_ParseTuple(_args, ""))
       
   139 		return NULL;
       
   140 	MacSetPort(_self->ob_itself);
       
   141 	Py_INCREF(Py_None);
       
   142 	_res = Py_None;
       
   143 	return _res;
       
   144 }
       
   145 
       
   146 static PyObject *GrafObj_QDSwapPort(GrafPortObject *_self, PyObject *_args)
       
   147 {
       
   148 	PyObject *_res = NULL;
       
   149 	Boolean _rv;
       
   150 	CGrafPtr outOldPort;
       
   151 #ifndef QDSwapPort
       
   152 	PyMac_PRECHECK(QDSwapPort);
       
   153 #endif
       
   154 	if (!PyArg_ParseTuple(_args, ""))
       
   155 		return NULL;
       
   156 	_rv = QDSwapPort(_self->ob_itself,
       
   157 	                 &outOldPort);
       
   158 	_res = Py_BuildValue("bO&",
       
   159 	                     _rv,
       
   160 	                     GrafObj_New, outOldPort);
       
   161 	return _res;
       
   162 }
       
   163 
       
   164 static PyObject *GrafObj_IsValidPort(GrafPortObject *_self, PyObject *_args)
       
   165 {
       
   166 	PyObject *_res = NULL;
       
   167 	Boolean _rv;
       
   168 #ifndef IsValidPort
       
   169 	PyMac_PRECHECK(IsValidPort);
       
   170 #endif
       
   171 	if (!PyArg_ParseTuple(_args, ""))
       
   172 		return NULL;
       
   173 	_rv = IsValidPort(_self->ob_itself);
       
   174 	_res = Py_BuildValue("b",
       
   175 	                     _rv);
       
   176 	return _res;
       
   177 }
       
   178 
       
   179 static PyObject *GrafObj_GetPortPixMap(GrafPortObject *_self, PyObject *_args)
       
   180 {
       
   181 	PyObject *_res = NULL;
       
   182 	PixMapHandle _rv;
       
   183 #ifndef GetPortPixMap
       
   184 	PyMac_PRECHECK(GetPortPixMap);
       
   185 #endif
       
   186 	if (!PyArg_ParseTuple(_args, ""))
       
   187 		return NULL;
       
   188 	_rv = GetPortPixMap(_self->ob_itself);
       
   189 	_res = Py_BuildValue("O&",
       
   190 	                     ResObj_New, _rv);
       
   191 	return _res;
       
   192 }
       
   193 
       
   194 static PyObject *GrafObj_GetPortBitMapForCopyBits(GrafPortObject *_self, PyObject *_args)
       
   195 {
       
   196 	PyObject *_res = NULL;
       
   197 	const BitMap * _rv;
       
   198 #ifndef GetPortBitMapForCopyBits
       
   199 	PyMac_PRECHECK(GetPortBitMapForCopyBits);
       
   200 #endif
       
   201 	if (!PyArg_ParseTuple(_args, ""))
       
   202 		return NULL;
       
   203 	_rv = GetPortBitMapForCopyBits(_self->ob_itself);
       
   204 	_res = Py_BuildValue("O&",
       
   205 	                     BMObj_New, _rv);
       
   206 	return _res;
       
   207 }
       
   208 
       
   209 static PyObject *GrafObj_GetPortBounds(GrafPortObject *_self, PyObject *_args)
       
   210 {
       
   211 	PyObject *_res = NULL;
       
   212 	Rect rect;
       
   213 #ifndef GetPortBounds
       
   214 	PyMac_PRECHECK(GetPortBounds);
       
   215 #endif
       
   216 	if (!PyArg_ParseTuple(_args, ""))
       
   217 		return NULL;
       
   218 	GetPortBounds(_self->ob_itself,
       
   219 	              &rect);
       
   220 	_res = Py_BuildValue("O&",
       
   221 	                     PyMac_BuildRect, &rect);
       
   222 	return _res;
       
   223 }
       
   224 
       
   225 static PyObject *GrafObj_GetPortForeColor(GrafPortObject *_self, PyObject *_args)
       
   226 {
       
   227 	PyObject *_res = NULL;
       
   228 	RGBColor foreColor;
       
   229 #ifndef GetPortForeColor
       
   230 	PyMac_PRECHECK(GetPortForeColor);
       
   231 #endif
       
   232 	if (!PyArg_ParseTuple(_args, ""))
       
   233 		return NULL;
       
   234 	GetPortForeColor(_self->ob_itself,
       
   235 	                 &foreColor);
       
   236 	_res = Py_BuildValue("O&",
       
   237 	                     QdRGB_New, &foreColor);
       
   238 	return _res;
       
   239 }
       
   240 
       
   241 static PyObject *GrafObj_GetPortBackColor(GrafPortObject *_self, PyObject *_args)
       
   242 {
       
   243 	PyObject *_res = NULL;
       
   244 	RGBColor backColor;
       
   245 #ifndef GetPortBackColor
       
   246 	PyMac_PRECHECK(GetPortBackColor);
       
   247 #endif
       
   248 	if (!PyArg_ParseTuple(_args, ""))
       
   249 		return NULL;
       
   250 	GetPortBackColor(_self->ob_itself,
       
   251 	                 &backColor);
       
   252 	_res = Py_BuildValue("O&",
       
   253 	                     QdRGB_New, &backColor);
       
   254 	return _res;
       
   255 }
       
   256 
       
   257 static PyObject *GrafObj_GetPortOpColor(GrafPortObject *_self, PyObject *_args)
       
   258 {
       
   259 	PyObject *_res = NULL;
       
   260 	RGBColor opColor;
       
   261 #ifndef GetPortOpColor
       
   262 	PyMac_PRECHECK(GetPortOpColor);
       
   263 #endif
       
   264 	if (!PyArg_ParseTuple(_args, ""))
       
   265 		return NULL;
       
   266 	GetPortOpColor(_self->ob_itself,
       
   267 	               &opColor);
       
   268 	_res = Py_BuildValue("O&",
       
   269 	                     QdRGB_New, &opColor);
       
   270 	return _res;
       
   271 }
       
   272 
       
   273 static PyObject *GrafObj_GetPortHiliteColor(GrafPortObject *_self, PyObject *_args)
       
   274 {
       
   275 	PyObject *_res = NULL;
       
   276 	RGBColor hiliteColor;
       
   277 #ifndef GetPortHiliteColor
       
   278 	PyMac_PRECHECK(GetPortHiliteColor);
       
   279 #endif
       
   280 	if (!PyArg_ParseTuple(_args, ""))
       
   281 		return NULL;
       
   282 	GetPortHiliteColor(_self->ob_itself,
       
   283 	                   &hiliteColor);
       
   284 	_res = Py_BuildValue("O&",
       
   285 	                     QdRGB_New, &hiliteColor);
       
   286 	return _res;
       
   287 }
       
   288 
       
   289 static PyObject *GrafObj_GetPortTextFont(GrafPortObject *_self, PyObject *_args)
       
   290 {
       
   291 	PyObject *_res = NULL;
       
   292 	short _rv;
       
   293 #ifndef GetPortTextFont
       
   294 	PyMac_PRECHECK(GetPortTextFont);
       
   295 #endif
       
   296 	if (!PyArg_ParseTuple(_args, ""))
       
   297 		return NULL;
       
   298 	_rv = GetPortTextFont(_self->ob_itself);
       
   299 	_res = Py_BuildValue("h",
       
   300 	                     _rv);
       
   301 	return _res;
       
   302 }
       
   303 
       
   304 static PyObject *GrafObj_GetPortTextFace(GrafPortObject *_self, PyObject *_args)
       
   305 {
       
   306 	PyObject *_res = NULL;
       
   307 	Style _rv;
       
   308 #ifndef GetPortTextFace
       
   309 	PyMac_PRECHECK(GetPortTextFace);
       
   310 #endif
       
   311 	if (!PyArg_ParseTuple(_args, ""))
       
   312 		return NULL;
       
   313 	_rv = GetPortTextFace(_self->ob_itself);
       
   314 	_res = Py_BuildValue("b",
       
   315 	                     _rv);
       
   316 	return _res;
       
   317 }
       
   318 
       
   319 static PyObject *GrafObj_GetPortTextMode(GrafPortObject *_self, PyObject *_args)
       
   320 {
       
   321 	PyObject *_res = NULL;
       
   322 	short _rv;
       
   323 #ifndef GetPortTextMode
       
   324 	PyMac_PRECHECK(GetPortTextMode);
       
   325 #endif
       
   326 	if (!PyArg_ParseTuple(_args, ""))
       
   327 		return NULL;
       
   328 	_rv = GetPortTextMode(_self->ob_itself);
       
   329 	_res = Py_BuildValue("h",
       
   330 	                     _rv);
       
   331 	return _res;
       
   332 }
       
   333 
       
   334 static PyObject *GrafObj_GetPortTextSize(GrafPortObject *_self, PyObject *_args)
       
   335 {
       
   336 	PyObject *_res = NULL;
       
   337 	short _rv;
       
   338 #ifndef GetPortTextSize
       
   339 	PyMac_PRECHECK(GetPortTextSize);
       
   340 #endif
       
   341 	if (!PyArg_ParseTuple(_args, ""))
       
   342 		return NULL;
       
   343 	_rv = GetPortTextSize(_self->ob_itself);
       
   344 	_res = Py_BuildValue("h",
       
   345 	                     _rv);
       
   346 	return _res;
       
   347 }
       
   348 
       
   349 static PyObject *GrafObj_GetPortChExtra(GrafPortObject *_self, PyObject *_args)
       
   350 {
       
   351 	PyObject *_res = NULL;
       
   352 	short _rv;
       
   353 #ifndef GetPortChExtra
       
   354 	PyMac_PRECHECK(GetPortChExtra);
       
   355 #endif
       
   356 	if (!PyArg_ParseTuple(_args, ""))
       
   357 		return NULL;
       
   358 	_rv = GetPortChExtra(_self->ob_itself);
       
   359 	_res = Py_BuildValue("h",
       
   360 	                     _rv);
       
   361 	return _res;
       
   362 }
       
   363 
       
   364 static PyObject *GrafObj_GetPortFracHPenLocation(GrafPortObject *_self, PyObject *_args)
       
   365 {
       
   366 	PyObject *_res = NULL;
       
   367 	short _rv;
       
   368 #ifndef GetPortFracHPenLocation
       
   369 	PyMac_PRECHECK(GetPortFracHPenLocation);
       
   370 #endif
       
   371 	if (!PyArg_ParseTuple(_args, ""))
       
   372 		return NULL;
       
   373 	_rv = GetPortFracHPenLocation(_self->ob_itself);
       
   374 	_res = Py_BuildValue("h",
       
   375 	                     _rv);
       
   376 	return _res;
       
   377 }
       
   378 
       
   379 static PyObject *GrafObj_GetPortSpExtra(GrafPortObject *_self, PyObject *_args)
       
   380 {
       
   381 	PyObject *_res = NULL;
       
   382 	Fixed _rv;
       
   383 #ifndef GetPortSpExtra
       
   384 	PyMac_PRECHECK(GetPortSpExtra);
       
   385 #endif
       
   386 	if (!PyArg_ParseTuple(_args, ""))
       
   387 		return NULL;
       
   388 	_rv = GetPortSpExtra(_self->ob_itself);
       
   389 	_res = Py_BuildValue("O&",
       
   390 	                     PyMac_BuildFixed, _rv);
       
   391 	return _res;
       
   392 }
       
   393 
       
   394 static PyObject *GrafObj_GetPortPenVisibility(GrafPortObject *_self, PyObject *_args)
       
   395 {
       
   396 	PyObject *_res = NULL;
       
   397 	short _rv;
       
   398 #ifndef GetPortPenVisibility
       
   399 	PyMac_PRECHECK(GetPortPenVisibility);
       
   400 #endif
       
   401 	if (!PyArg_ParseTuple(_args, ""))
       
   402 		return NULL;
       
   403 	_rv = GetPortPenVisibility(_self->ob_itself);
       
   404 	_res = Py_BuildValue("h",
       
   405 	                     _rv);
       
   406 	return _res;
       
   407 }
       
   408 
       
   409 static PyObject *GrafObj_GetPortVisibleRegion(GrafPortObject *_self, PyObject *_args)
       
   410 {
       
   411 	PyObject *_res = NULL;
       
   412 	RgnHandle _rv;
       
   413 	RgnHandle visRgn;
       
   414 #ifndef GetPortVisibleRegion
       
   415 	PyMac_PRECHECK(GetPortVisibleRegion);
       
   416 #endif
       
   417 	if (!PyArg_ParseTuple(_args, "O&",
       
   418 	                      ResObj_Convert, &visRgn))
       
   419 		return NULL;
       
   420 	_rv = GetPortVisibleRegion(_self->ob_itself,
       
   421 	                           visRgn);
       
   422 	_res = Py_BuildValue("O&",
       
   423 	                     ResObj_New, _rv);
       
   424 	return _res;
       
   425 }
       
   426 
       
   427 static PyObject *GrafObj_GetPortClipRegion(GrafPortObject *_self, PyObject *_args)
       
   428 {
       
   429 	PyObject *_res = NULL;
       
   430 	RgnHandle _rv;
       
   431 	RgnHandle clipRgn;
       
   432 #ifndef GetPortClipRegion
       
   433 	PyMac_PRECHECK(GetPortClipRegion);
       
   434 #endif
       
   435 	if (!PyArg_ParseTuple(_args, "O&",
       
   436 	                      ResObj_Convert, &clipRgn))
       
   437 		return NULL;
       
   438 	_rv = GetPortClipRegion(_self->ob_itself,
       
   439 	                        clipRgn);
       
   440 	_res = Py_BuildValue("O&",
       
   441 	                     ResObj_New, _rv);
       
   442 	return _res;
       
   443 }
       
   444 
       
   445 static PyObject *GrafObj_GetPortBackPixPat(GrafPortObject *_self, PyObject *_args)
       
   446 {
       
   447 	PyObject *_res = NULL;
       
   448 	PixPatHandle _rv;
       
   449 	PixPatHandle backPattern;
       
   450 #ifndef GetPortBackPixPat
       
   451 	PyMac_PRECHECK(GetPortBackPixPat);
       
   452 #endif
       
   453 	if (!PyArg_ParseTuple(_args, "O&",
       
   454 	                      ResObj_Convert, &backPattern))
       
   455 		return NULL;
       
   456 	_rv = GetPortBackPixPat(_self->ob_itself,
       
   457 	                        backPattern);
       
   458 	_res = Py_BuildValue("O&",
       
   459 	                     ResObj_New, _rv);
       
   460 	return _res;
       
   461 }
       
   462 
       
   463 static PyObject *GrafObj_GetPortPenPixPat(GrafPortObject *_self, PyObject *_args)
       
   464 {
       
   465 	PyObject *_res = NULL;
       
   466 	PixPatHandle _rv;
       
   467 	PixPatHandle penPattern;
       
   468 #ifndef GetPortPenPixPat
       
   469 	PyMac_PRECHECK(GetPortPenPixPat);
       
   470 #endif
       
   471 	if (!PyArg_ParseTuple(_args, "O&",
       
   472 	                      ResObj_Convert, &penPattern))
       
   473 		return NULL;
       
   474 	_rv = GetPortPenPixPat(_self->ob_itself,
       
   475 	                       penPattern);
       
   476 	_res = Py_BuildValue("O&",
       
   477 	                     ResObj_New, _rv);
       
   478 	return _res;
       
   479 }
       
   480 
       
   481 static PyObject *GrafObj_GetPortFillPixPat(GrafPortObject *_self, PyObject *_args)
       
   482 {
       
   483 	PyObject *_res = NULL;
       
   484 	PixPatHandle _rv;
       
   485 	PixPatHandle fillPattern;
       
   486 #ifndef GetPortFillPixPat
       
   487 	PyMac_PRECHECK(GetPortFillPixPat);
       
   488 #endif
       
   489 	if (!PyArg_ParseTuple(_args, "O&",
       
   490 	                      ResObj_Convert, &fillPattern))
       
   491 		return NULL;
       
   492 	_rv = GetPortFillPixPat(_self->ob_itself,
       
   493 	                        fillPattern);
       
   494 	_res = Py_BuildValue("O&",
       
   495 	                     ResObj_New, _rv);
       
   496 	return _res;
       
   497 }
       
   498 
       
   499 static PyObject *GrafObj_GetPortPenSize(GrafPortObject *_self, PyObject *_args)
       
   500 {
       
   501 	PyObject *_res = NULL;
       
   502 	Point penSize;
       
   503 #ifndef GetPortPenSize
       
   504 	PyMac_PRECHECK(GetPortPenSize);
       
   505 #endif
       
   506 	if (!PyArg_ParseTuple(_args, "O&",
       
   507 	                      PyMac_GetPoint, &penSize))
       
   508 		return NULL;
       
   509 	GetPortPenSize(_self->ob_itself,
       
   510 	               &penSize);
       
   511 	_res = Py_BuildValue("O&",
       
   512 	                     PyMac_BuildPoint, penSize);
       
   513 	return _res;
       
   514 }
       
   515 
       
   516 static PyObject *GrafObj_GetPortPenMode(GrafPortObject *_self, PyObject *_args)
       
   517 {
       
   518 	PyObject *_res = NULL;
       
   519 	SInt32 _rv;
       
   520 #ifndef GetPortPenMode
       
   521 	PyMac_PRECHECK(GetPortPenMode);
       
   522 #endif
       
   523 	if (!PyArg_ParseTuple(_args, ""))
       
   524 		return NULL;
       
   525 	_rv = GetPortPenMode(_self->ob_itself);
       
   526 	_res = Py_BuildValue("l",
       
   527 	                     _rv);
       
   528 	return _res;
       
   529 }
       
   530 
       
   531 static PyObject *GrafObj_GetPortPenLocation(GrafPortObject *_self, PyObject *_args)
       
   532 {
       
   533 	PyObject *_res = NULL;
       
   534 	Point penLocation;
       
   535 #ifndef GetPortPenLocation
       
   536 	PyMac_PRECHECK(GetPortPenLocation);
       
   537 #endif
       
   538 	if (!PyArg_ParseTuple(_args, "O&",
       
   539 	                      PyMac_GetPoint, &penLocation))
       
   540 		return NULL;
       
   541 	GetPortPenLocation(_self->ob_itself,
       
   542 	                   &penLocation);
       
   543 	_res = Py_BuildValue("O&",
       
   544 	                     PyMac_BuildPoint, penLocation);
       
   545 	return _res;
       
   546 }
       
   547 
       
   548 static PyObject *GrafObj_IsPortRegionBeingDefined(GrafPortObject *_self, PyObject *_args)
       
   549 {
       
   550 	PyObject *_res = NULL;
       
   551 	Boolean _rv;
       
   552 #ifndef IsPortRegionBeingDefined
       
   553 	PyMac_PRECHECK(IsPortRegionBeingDefined);
       
   554 #endif
       
   555 	if (!PyArg_ParseTuple(_args, ""))
       
   556 		return NULL;
       
   557 	_rv = IsPortRegionBeingDefined(_self->ob_itself);
       
   558 	_res = Py_BuildValue("b",
       
   559 	                     _rv);
       
   560 	return _res;
       
   561 }
       
   562 
       
   563 static PyObject *GrafObj_IsPortPictureBeingDefined(GrafPortObject *_self, PyObject *_args)
       
   564 {
       
   565 	PyObject *_res = NULL;
       
   566 	Boolean _rv;
       
   567 #ifndef IsPortPictureBeingDefined
       
   568 	PyMac_PRECHECK(IsPortPictureBeingDefined);
       
   569 #endif
       
   570 	if (!PyArg_ParseTuple(_args, ""))
       
   571 		return NULL;
       
   572 	_rv = IsPortPictureBeingDefined(_self->ob_itself);
       
   573 	_res = Py_BuildValue("b",
       
   574 	                     _rv);
       
   575 	return _res;
       
   576 }
       
   577 
       
   578 static PyObject *GrafObj_IsPortPolyBeingDefined(GrafPortObject *_self, PyObject *_args)
       
   579 {
       
   580 	PyObject *_res = NULL;
       
   581 	Boolean _rv;
       
   582 #ifndef IsPortPolyBeingDefined
       
   583 	PyMac_PRECHECK(IsPortPolyBeingDefined);
       
   584 #endif
       
   585 	if (!PyArg_ParseTuple(_args, ""))
       
   586 		return NULL;
       
   587 	_rv = IsPortPolyBeingDefined(_self->ob_itself);
       
   588 	_res = Py_BuildValue("b",
       
   589 	                     _rv);
       
   590 	return _res;
       
   591 }
       
   592 
       
   593 static PyObject *GrafObj_IsPortOffscreen(GrafPortObject *_self, PyObject *_args)
       
   594 {
       
   595 	PyObject *_res = NULL;
       
   596 	Boolean _rv;
       
   597 #ifndef IsPortOffscreen
       
   598 	PyMac_PRECHECK(IsPortOffscreen);
       
   599 #endif
       
   600 	if (!PyArg_ParseTuple(_args, ""))
       
   601 		return NULL;
       
   602 	_rv = IsPortOffscreen(_self->ob_itself);
       
   603 	_res = Py_BuildValue("b",
       
   604 	                     _rv);
       
   605 	return _res;
       
   606 }
       
   607 
       
   608 static PyObject *GrafObj_IsPortColor(GrafPortObject *_self, PyObject *_args)
       
   609 {
       
   610 	PyObject *_res = NULL;
       
   611 	Boolean _rv;
       
   612 #ifndef IsPortColor
       
   613 	PyMac_PRECHECK(IsPortColor);
       
   614 #endif
       
   615 	if (!PyArg_ParseTuple(_args, ""))
       
   616 		return NULL;
       
   617 	_rv = IsPortColor(_self->ob_itself);
       
   618 	_res = Py_BuildValue("b",
       
   619 	                     _rv);
       
   620 	return _res;
       
   621 }
       
   622 
       
   623 static PyObject *GrafObj_IsPortVisibleRegionEmpty(GrafPortObject *_self, PyObject *_args)
       
   624 {
       
   625 	PyObject *_res = NULL;
       
   626 	Boolean _rv;
       
   627 #ifndef IsPortVisibleRegionEmpty
       
   628 	PyMac_PRECHECK(IsPortVisibleRegionEmpty);
       
   629 #endif
       
   630 	if (!PyArg_ParseTuple(_args, ""))
       
   631 		return NULL;
       
   632 	_rv = IsPortVisibleRegionEmpty(_self->ob_itself);
       
   633 	_res = Py_BuildValue("b",
       
   634 	                     _rv);
       
   635 	return _res;
       
   636 }
       
   637 
       
   638 static PyObject *GrafObj_IsPortClipRegionEmpty(GrafPortObject *_self, PyObject *_args)
       
   639 {
       
   640 	PyObject *_res = NULL;
       
   641 	Boolean _rv;
       
   642 #ifndef IsPortClipRegionEmpty
       
   643 	PyMac_PRECHECK(IsPortClipRegionEmpty);
       
   644 #endif
       
   645 	if (!PyArg_ParseTuple(_args, ""))
       
   646 		return NULL;
       
   647 	_rv = IsPortClipRegionEmpty(_self->ob_itself);
       
   648 	_res = Py_BuildValue("b",
       
   649 	                     _rv);
       
   650 	return _res;
       
   651 }
       
   652 
       
   653 static PyObject *GrafObj_SectRegionWithPortClipRegion(GrafPortObject *_self, PyObject *_args)
       
   654 {
       
   655 	PyObject *_res = NULL;
       
   656 	RgnHandle ioRegion;
       
   657 #ifndef SectRegionWithPortClipRegion
       
   658 	PyMac_PRECHECK(SectRegionWithPortClipRegion);
       
   659 #endif
       
   660 	if (!PyArg_ParseTuple(_args, "O&",
       
   661 	                      ResObj_Convert, &ioRegion))
       
   662 		return NULL;
       
   663 	SectRegionWithPortClipRegion(_self->ob_itself,
       
   664 	                             ioRegion);
       
   665 	Py_INCREF(Py_None);
       
   666 	_res = Py_None;
       
   667 	return _res;
       
   668 }
       
   669 
       
   670 static PyObject *GrafObj_SectRegionWithPortVisibleRegion(GrafPortObject *_self, PyObject *_args)
       
   671 {
       
   672 	PyObject *_res = NULL;
       
   673 	RgnHandle ioRegion;
       
   674 #ifndef SectRegionWithPortVisibleRegion
       
   675 	PyMac_PRECHECK(SectRegionWithPortVisibleRegion);
       
   676 #endif
       
   677 	if (!PyArg_ParseTuple(_args, "O&",
       
   678 	                      ResObj_Convert, &ioRegion))
       
   679 		return NULL;
       
   680 	SectRegionWithPortVisibleRegion(_self->ob_itself,
       
   681 	                                ioRegion);
       
   682 	Py_INCREF(Py_None);
       
   683 	_res = Py_None;
       
   684 	return _res;
       
   685 }
       
   686 
       
   687 static PyObject *GrafObj_SwapPortPicSaveHandle(GrafPortObject *_self, PyObject *_args)
       
   688 {
       
   689 	PyObject *_res = NULL;
       
   690 	Handle _rv;
       
   691 	Handle inPicSaveHdl;
       
   692 #ifndef SwapPortPicSaveHandle
       
   693 	PyMac_PRECHECK(SwapPortPicSaveHandle);
       
   694 #endif
       
   695 	if (!PyArg_ParseTuple(_args, "O&",
       
   696 	                      ResObj_Convert, &inPicSaveHdl))
       
   697 		return NULL;
       
   698 	_rv = SwapPortPicSaveHandle(_self->ob_itself,
       
   699 	                            inPicSaveHdl);
       
   700 	_res = Py_BuildValue("O&",
       
   701 	                     ResObj_New, _rv);
       
   702 	return _res;
       
   703 }
       
   704 
       
   705 static PyObject *GrafObj_SwapPortPolySaveHandle(GrafPortObject *_self, PyObject *_args)
       
   706 {
       
   707 	PyObject *_res = NULL;
       
   708 	Handle _rv;
       
   709 	Handle inPolySaveHdl;
       
   710 #ifndef SwapPortPolySaveHandle
       
   711 	PyMac_PRECHECK(SwapPortPolySaveHandle);
       
   712 #endif
       
   713 	if (!PyArg_ParseTuple(_args, "O&",
       
   714 	                      ResObj_Convert, &inPolySaveHdl))
       
   715 		return NULL;
       
   716 	_rv = SwapPortPolySaveHandle(_self->ob_itself,
       
   717 	                             inPolySaveHdl);
       
   718 	_res = Py_BuildValue("O&",
       
   719 	                     ResObj_New, _rv);
       
   720 	return _res;
       
   721 }
       
   722 
       
   723 static PyObject *GrafObj_SwapPortRegionSaveHandle(GrafPortObject *_self, PyObject *_args)
       
   724 {
       
   725 	PyObject *_res = NULL;
       
   726 	Handle _rv;
       
   727 	Handle inRegionSaveHdl;
       
   728 #ifndef SwapPortRegionSaveHandle
       
   729 	PyMac_PRECHECK(SwapPortRegionSaveHandle);
       
   730 #endif
       
   731 	if (!PyArg_ParseTuple(_args, "O&",
       
   732 	                      ResObj_Convert, &inRegionSaveHdl))
       
   733 		return NULL;
       
   734 	_rv = SwapPortRegionSaveHandle(_self->ob_itself,
       
   735 	                               inRegionSaveHdl);
       
   736 	_res = Py_BuildValue("O&",
       
   737 	                     ResObj_New, _rv);
       
   738 	return _res;
       
   739 }
       
   740 
       
   741 static PyObject *GrafObj_SetPortBounds(GrafPortObject *_self, PyObject *_args)
       
   742 {
       
   743 	PyObject *_res = NULL;
       
   744 	Rect rect;
       
   745 #ifndef SetPortBounds
       
   746 	PyMac_PRECHECK(SetPortBounds);
       
   747 #endif
       
   748 	if (!PyArg_ParseTuple(_args, "O&",
       
   749 	                      PyMac_GetRect, &rect))
       
   750 		return NULL;
       
   751 	SetPortBounds(_self->ob_itself,
       
   752 	              &rect);
       
   753 	Py_INCREF(Py_None);
       
   754 	_res = Py_None;
       
   755 	return _res;
       
   756 }
       
   757 
       
   758 static PyObject *GrafObj_SetPortOpColor(GrafPortObject *_self, PyObject *_args)
       
   759 {
       
   760 	PyObject *_res = NULL;
       
   761 	RGBColor opColor;
       
   762 #ifndef SetPortOpColor
       
   763 	PyMac_PRECHECK(SetPortOpColor);
       
   764 #endif
       
   765 	if (!PyArg_ParseTuple(_args, "O&",
       
   766 	                      QdRGB_Convert, &opColor))
       
   767 		return NULL;
       
   768 	SetPortOpColor(_self->ob_itself,
       
   769 	               &opColor);
       
   770 	Py_INCREF(Py_None);
       
   771 	_res = Py_None;
       
   772 	return _res;
       
   773 }
       
   774 
       
   775 static PyObject *GrafObj_SetPortTextFont(GrafPortObject *_self, PyObject *_args)
       
   776 {
       
   777 	PyObject *_res = NULL;
       
   778 	short txFont;
       
   779 #ifndef SetPortTextFont
       
   780 	PyMac_PRECHECK(SetPortTextFont);
       
   781 #endif
       
   782 	if (!PyArg_ParseTuple(_args, "h",
       
   783 	                      &txFont))
       
   784 		return NULL;
       
   785 	SetPortTextFont(_self->ob_itself,
       
   786 	                txFont);
       
   787 	Py_INCREF(Py_None);
       
   788 	_res = Py_None;
       
   789 	return _res;
       
   790 }
       
   791 
       
   792 static PyObject *GrafObj_SetPortTextSize(GrafPortObject *_self, PyObject *_args)
       
   793 {
       
   794 	PyObject *_res = NULL;
       
   795 	short txSize;
       
   796 #ifndef SetPortTextSize
       
   797 	PyMac_PRECHECK(SetPortTextSize);
       
   798 #endif
       
   799 	if (!PyArg_ParseTuple(_args, "h",
       
   800 	                      &txSize))
       
   801 		return NULL;
       
   802 	SetPortTextSize(_self->ob_itself,
       
   803 	                txSize);
       
   804 	Py_INCREF(Py_None);
       
   805 	_res = Py_None;
       
   806 	return _res;
       
   807 }
       
   808 
       
   809 static PyObject *GrafObj_SetPortTextFace(GrafPortObject *_self, PyObject *_args)
       
   810 {
       
   811 	PyObject *_res = NULL;
       
   812 	StyleParameter face;
       
   813 #ifndef SetPortTextFace
       
   814 	PyMac_PRECHECK(SetPortTextFace);
       
   815 #endif
       
   816 	if (!PyArg_ParseTuple(_args, "h",
       
   817 	                      &face))
       
   818 		return NULL;
       
   819 	SetPortTextFace(_self->ob_itself,
       
   820 	                face);
       
   821 	Py_INCREF(Py_None);
       
   822 	_res = Py_None;
       
   823 	return _res;
       
   824 }
       
   825 
       
   826 static PyObject *GrafObj_SetPortTextMode(GrafPortObject *_self, PyObject *_args)
       
   827 {
       
   828 	PyObject *_res = NULL;
       
   829 	short mode;
       
   830 #ifndef SetPortTextMode
       
   831 	PyMac_PRECHECK(SetPortTextMode);
       
   832 #endif
       
   833 	if (!PyArg_ParseTuple(_args, "h",
       
   834 	                      &mode))
       
   835 		return NULL;
       
   836 	SetPortTextMode(_self->ob_itself,
       
   837 	                mode);
       
   838 	Py_INCREF(Py_None);
       
   839 	_res = Py_None;
       
   840 	return _res;
       
   841 }
       
   842 
       
   843 static PyObject *GrafObj_SetPortVisibleRegion(GrafPortObject *_self, PyObject *_args)
       
   844 {
       
   845 	PyObject *_res = NULL;
       
   846 	RgnHandle visRgn;
       
   847 #ifndef SetPortVisibleRegion
       
   848 	PyMac_PRECHECK(SetPortVisibleRegion);
       
   849 #endif
       
   850 	if (!PyArg_ParseTuple(_args, "O&",
       
   851 	                      ResObj_Convert, &visRgn))
       
   852 		return NULL;
       
   853 	SetPortVisibleRegion(_self->ob_itself,
       
   854 	                     visRgn);
       
   855 	Py_INCREF(Py_None);
       
   856 	_res = Py_None;
       
   857 	return _res;
       
   858 }
       
   859 
       
   860 static PyObject *GrafObj_SetPortClipRegion(GrafPortObject *_self, PyObject *_args)
       
   861 {
       
   862 	PyObject *_res = NULL;
       
   863 	RgnHandle clipRgn;
       
   864 #ifndef SetPortClipRegion
       
   865 	PyMac_PRECHECK(SetPortClipRegion);
       
   866 #endif
       
   867 	if (!PyArg_ParseTuple(_args, "O&",
       
   868 	                      ResObj_Convert, &clipRgn))
       
   869 		return NULL;
       
   870 	SetPortClipRegion(_self->ob_itself,
       
   871 	                  clipRgn);
       
   872 	Py_INCREF(Py_None);
       
   873 	_res = Py_None;
       
   874 	return _res;
       
   875 }
       
   876 
       
   877 static PyObject *GrafObj_SetPortPenPixPat(GrafPortObject *_self, PyObject *_args)
       
   878 {
       
   879 	PyObject *_res = NULL;
       
   880 	PixPatHandle penPattern;
       
   881 #ifndef SetPortPenPixPat
       
   882 	PyMac_PRECHECK(SetPortPenPixPat);
       
   883 #endif
       
   884 	if (!PyArg_ParseTuple(_args, "O&",
       
   885 	                      ResObj_Convert, &penPattern))
       
   886 		return NULL;
       
   887 	SetPortPenPixPat(_self->ob_itself,
       
   888 	                 penPattern);
       
   889 	Py_INCREF(Py_None);
       
   890 	_res = Py_None;
       
   891 	return _res;
       
   892 }
       
   893 
       
   894 static PyObject *GrafObj_SetPortFillPixPat(GrafPortObject *_self, PyObject *_args)
       
   895 {
       
   896 	PyObject *_res = NULL;
       
   897 	PixPatHandle penPattern;
       
   898 #ifndef SetPortFillPixPat
       
   899 	PyMac_PRECHECK(SetPortFillPixPat);
       
   900 #endif
       
   901 	if (!PyArg_ParseTuple(_args, "O&",
       
   902 	                      ResObj_Convert, &penPattern))
       
   903 		return NULL;
       
   904 	SetPortFillPixPat(_self->ob_itself,
       
   905 	                  penPattern);
       
   906 	Py_INCREF(Py_None);
       
   907 	_res = Py_None;
       
   908 	return _res;
       
   909 }
       
   910 
       
   911 static PyObject *GrafObj_SetPortBackPixPat(GrafPortObject *_self, PyObject *_args)
       
   912 {
       
   913 	PyObject *_res = NULL;
       
   914 	PixPatHandle backPattern;
       
   915 #ifndef SetPortBackPixPat
       
   916 	PyMac_PRECHECK(SetPortBackPixPat);
       
   917 #endif
       
   918 	if (!PyArg_ParseTuple(_args, "O&",
       
   919 	                      ResObj_Convert, &backPattern))
       
   920 		return NULL;
       
   921 	SetPortBackPixPat(_self->ob_itself,
       
   922 	                  backPattern);
       
   923 	Py_INCREF(Py_None);
       
   924 	_res = Py_None;
       
   925 	return _res;
       
   926 }
       
   927 
       
   928 static PyObject *GrafObj_SetPortPenSize(GrafPortObject *_self, PyObject *_args)
       
   929 {
       
   930 	PyObject *_res = NULL;
       
   931 	Point penSize;
       
   932 #ifndef SetPortPenSize
       
   933 	PyMac_PRECHECK(SetPortPenSize);
       
   934 #endif
       
   935 	if (!PyArg_ParseTuple(_args, "O&",
       
   936 	                      PyMac_GetPoint, &penSize))
       
   937 		return NULL;
       
   938 	SetPortPenSize(_self->ob_itself,
       
   939 	               penSize);
       
   940 	Py_INCREF(Py_None);
       
   941 	_res = Py_None;
       
   942 	return _res;
       
   943 }
       
   944 
       
   945 static PyObject *GrafObj_SetPortPenMode(GrafPortObject *_self, PyObject *_args)
       
   946 {
       
   947 	PyObject *_res = NULL;
       
   948 	SInt32 penMode;
       
   949 #ifndef SetPortPenMode
       
   950 	PyMac_PRECHECK(SetPortPenMode);
       
   951 #endif
       
   952 	if (!PyArg_ParseTuple(_args, "l",
       
   953 	                      &penMode))
       
   954 		return NULL;
       
   955 	SetPortPenMode(_self->ob_itself,
       
   956 	               penMode);
       
   957 	Py_INCREF(Py_None);
       
   958 	_res = Py_None;
       
   959 	return _res;
       
   960 }
       
   961 
       
   962 static PyObject *GrafObj_SetPortFracHPenLocation(GrafPortObject *_self, PyObject *_args)
       
   963 {
       
   964 	PyObject *_res = NULL;
       
   965 	short pnLocHFrac;
       
   966 #ifndef SetPortFracHPenLocation
       
   967 	PyMac_PRECHECK(SetPortFracHPenLocation);
       
   968 #endif
       
   969 	if (!PyArg_ParseTuple(_args, "h",
       
   970 	                      &pnLocHFrac))
       
   971 		return NULL;
       
   972 	SetPortFracHPenLocation(_self->ob_itself,
       
   973 	                        pnLocHFrac);
       
   974 	Py_INCREF(Py_None);
       
   975 	_res = Py_None;
       
   976 	return _res;
       
   977 }
       
   978 
       
   979 static PyObject *GrafObj_DisposePort(GrafPortObject *_self, PyObject *_args)
       
   980 {
       
   981 	PyObject *_res = NULL;
       
   982 #ifndef DisposePort
       
   983 	PyMac_PRECHECK(DisposePort);
       
   984 #endif
       
   985 	if (!PyArg_ParseTuple(_args, ""))
       
   986 		return NULL;
       
   987 	DisposePort(_self->ob_itself);
       
   988 	Py_INCREF(Py_None);
       
   989 	_res = Py_None;
       
   990 	return _res;
       
   991 }
       
   992 
       
   993 static PyObject *GrafObj_QDLocalToGlobalPoint(GrafPortObject *_self, PyObject *_args)
       
   994 {
       
   995 	PyObject *_res = NULL;
       
   996 	Point point;
       
   997 #ifndef QDLocalToGlobalPoint
       
   998 	PyMac_PRECHECK(QDLocalToGlobalPoint);
       
   999 #endif
       
  1000 	if (!PyArg_ParseTuple(_args, "O&",
       
  1001 	                      PyMac_GetPoint, &point))
       
  1002 		return NULL;
       
  1003 	QDLocalToGlobalPoint(_self->ob_itself,
       
  1004 	                     &point);
       
  1005 	_res = Py_BuildValue("O&",
       
  1006 	                     PyMac_BuildPoint, point);
       
  1007 	return _res;
       
  1008 }
       
  1009 
       
  1010 static PyObject *GrafObj_QDGlobalToLocalPoint(GrafPortObject *_self, PyObject *_args)
       
  1011 {
       
  1012 	PyObject *_res = NULL;
       
  1013 	Point point;
       
  1014 #ifndef QDGlobalToLocalPoint
       
  1015 	PyMac_PRECHECK(QDGlobalToLocalPoint);
       
  1016 #endif
       
  1017 	if (!PyArg_ParseTuple(_args, "O&",
       
  1018 	                      PyMac_GetPoint, &point))
       
  1019 		return NULL;
       
  1020 	QDGlobalToLocalPoint(_self->ob_itself,
       
  1021 	                     &point);
       
  1022 	_res = Py_BuildValue("O&",
       
  1023 	                     PyMac_BuildPoint, point);
       
  1024 	return _res;
       
  1025 }
       
  1026 
       
  1027 static PyObject *GrafObj_QDLocalToGlobalRect(GrafPortObject *_self, PyObject *_args)
       
  1028 {
       
  1029 	PyObject *_res = NULL;
       
  1030 	Rect bounds;
       
  1031 #ifndef QDLocalToGlobalRect
       
  1032 	PyMac_PRECHECK(QDLocalToGlobalRect);
       
  1033 #endif
       
  1034 	if (!PyArg_ParseTuple(_args, ""))
       
  1035 		return NULL;
       
  1036 	QDLocalToGlobalRect(_self->ob_itself,
       
  1037 	                    &bounds);
       
  1038 	_res = Py_BuildValue("O&",
       
  1039 	                     PyMac_BuildRect, &bounds);
       
  1040 	return _res;
       
  1041 }
       
  1042 
       
  1043 static PyObject *GrafObj_QDGlobalToLocalRect(GrafPortObject *_self, PyObject *_args)
       
  1044 {
       
  1045 	PyObject *_res = NULL;
       
  1046 	Rect bounds;
       
  1047 #ifndef QDGlobalToLocalRect
       
  1048 	PyMac_PRECHECK(QDGlobalToLocalRect);
       
  1049 #endif
       
  1050 	if (!PyArg_ParseTuple(_args, ""))
       
  1051 		return NULL;
       
  1052 	QDGlobalToLocalRect(_self->ob_itself,
       
  1053 	                    &bounds);
       
  1054 	_res = Py_BuildValue("O&",
       
  1055 	                     PyMac_BuildRect, &bounds);
       
  1056 	return _res;
       
  1057 }
       
  1058 
       
  1059 static PyObject *GrafObj_QDLocalToGlobalRegion(GrafPortObject *_self, PyObject *_args)
       
  1060 {
       
  1061 	PyObject *_res = NULL;
       
  1062 	RgnHandle _rv;
       
  1063 	RgnHandle region;
       
  1064 #ifndef QDLocalToGlobalRegion
       
  1065 	PyMac_PRECHECK(QDLocalToGlobalRegion);
       
  1066 #endif
       
  1067 	if (!PyArg_ParseTuple(_args, "O&",
       
  1068 	                      ResObj_Convert, &region))
       
  1069 		return NULL;
       
  1070 	_rv = QDLocalToGlobalRegion(_self->ob_itself,
       
  1071 	                            region);
       
  1072 	_res = Py_BuildValue("O&",
       
  1073 	                     ResObj_New, _rv);
       
  1074 	return _res;
       
  1075 }
       
  1076 
       
  1077 static PyObject *GrafObj_QDGlobalToLocalRegion(GrafPortObject *_self, PyObject *_args)
       
  1078 {
       
  1079 	PyObject *_res = NULL;
       
  1080 	RgnHandle _rv;
       
  1081 	RgnHandle region;
       
  1082 #ifndef QDGlobalToLocalRegion
       
  1083 	PyMac_PRECHECK(QDGlobalToLocalRegion);
       
  1084 #endif
       
  1085 	if (!PyArg_ParseTuple(_args, "O&",
       
  1086 	                      ResObj_Convert, &region))
       
  1087 		return NULL;
       
  1088 	_rv = QDGlobalToLocalRegion(_self->ob_itself,
       
  1089 	                            region);
       
  1090 	_res = Py_BuildValue("O&",
       
  1091 	                     ResObj_New, _rv);
       
  1092 	return _res;
       
  1093 }
       
  1094 
       
  1095 static PyObject *GrafObj_QDIsPortBuffered(GrafPortObject *_self, PyObject *_args)
       
  1096 {
       
  1097 	PyObject *_res = NULL;
       
  1098 	Boolean _rv;
       
  1099 #ifndef QDIsPortBuffered
       
  1100 	PyMac_PRECHECK(QDIsPortBuffered);
       
  1101 #endif
       
  1102 	if (!PyArg_ParseTuple(_args, ""))
       
  1103 		return NULL;
       
  1104 	_rv = QDIsPortBuffered(_self->ob_itself);
       
  1105 	_res = Py_BuildValue("b",
       
  1106 	                     _rv);
       
  1107 	return _res;
       
  1108 }
       
  1109 
       
  1110 static PyObject *GrafObj_QDIsPortBufferDirty(GrafPortObject *_self, PyObject *_args)
       
  1111 {
       
  1112 	PyObject *_res = NULL;
       
  1113 	Boolean _rv;
       
  1114 #ifndef QDIsPortBufferDirty
       
  1115 	PyMac_PRECHECK(QDIsPortBufferDirty);
       
  1116 #endif
       
  1117 	if (!PyArg_ParseTuple(_args, ""))
       
  1118 		return NULL;
       
  1119 	_rv = QDIsPortBufferDirty(_self->ob_itself);
       
  1120 	_res = Py_BuildValue("b",
       
  1121 	                     _rv);
       
  1122 	return _res;
       
  1123 }
       
  1124 
       
  1125 static PyObject *GrafObj_QDFlushPortBuffer(GrafPortObject *_self, PyObject *_args)
       
  1126 {
       
  1127 	PyObject *_res = NULL;
       
  1128 	RgnHandle region;
       
  1129 #ifndef QDFlushPortBuffer
       
  1130 	PyMac_PRECHECK(QDFlushPortBuffer);
       
  1131 #endif
       
  1132 	if (!PyArg_ParseTuple(_args, "O&",
       
  1133 	                      OptResObj_Convert, &region))
       
  1134 		return NULL;
       
  1135 	QDFlushPortBuffer(_self->ob_itself,
       
  1136 	                  region);
       
  1137 	Py_INCREF(Py_None);
       
  1138 	_res = Py_None;
       
  1139 	return _res;
       
  1140 }
       
  1141 
       
  1142 static PyObject *GrafObj_QDGetDirtyRegion(GrafPortObject *_self, PyObject *_args)
       
  1143 {
       
  1144 	PyObject *_res = NULL;
       
  1145 	OSStatus _err;
       
  1146 	RgnHandle rgn;
       
  1147 #ifndef QDGetDirtyRegion
       
  1148 	PyMac_PRECHECK(QDGetDirtyRegion);
       
  1149 #endif
       
  1150 	if (!PyArg_ParseTuple(_args, "O&",
       
  1151 	                      ResObj_Convert, &rgn))
       
  1152 		return NULL;
       
  1153 	_err = QDGetDirtyRegion(_self->ob_itself,
       
  1154 	                        rgn);
       
  1155 	if (_err != noErr) return PyMac_Error(_err);
       
  1156 	Py_INCREF(Py_None);
       
  1157 	_res = Py_None;
       
  1158 	return _res;
       
  1159 }
       
  1160 
       
  1161 static PyObject *GrafObj_QDSetDirtyRegion(GrafPortObject *_self, PyObject *_args)
       
  1162 {
       
  1163 	PyObject *_res = NULL;
       
  1164 	OSStatus _err;
       
  1165 	RgnHandle rgn;
       
  1166 #ifndef QDSetDirtyRegion
       
  1167 	PyMac_PRECHECK(QDSetDirtyRegion);
       
  1168 #endif
       
  1169 	if (!PyArg_ParseTuple(_args, "O&",
       
  1170 	                      ResObj_Convert, &rgn))
       
  1171 		return NULL;
       
  1172 	_err = QDSetDirtyRegion(_self->ob_itself,
       
  1173 	                        rgn);
       
  1174 	if (_err != noErr) return PyMac_Error(_err);
       
  1175 	Py_INCREF(Py_None);
       
  1176 	_res = Py_None;
       
  1177 	return _res;
       
  1178 }
       
  1179 
       
  1180 static PyMethodDef GrafObj_methods[] = {
       
  1181 	{"MacSetPort", (PyCFunction)GrafObj_MacSetPort, 1,
       
  1182 	 PyDoc_STR("() -> None")},
       
  1183 	{"QDSwapPort", (PyCFunction)GrafObj_QDSwapPort, 1,
       
  1184 	 PyDoc_STR("() -> (Boolean _rv, CGrafPtr outOldPort)")},
       
  1185 	{"IsValidPort", (PyCFunction)GrafObj_IsValidPort, 1,
       
  1186 	 PyDoc_STR("() -> (Boolean _rv)")},
       
  1187 	{"GetPortPixMap", (PyCFunction)GrafObj_GetPortPixMap, 1,
       
  1188 	 PyDoc_STR("() -> (PixMapHandle _rv)")},
       
  1189 	{"GetPortBitMapForCopyBits", (PyCFunction)GrafObj_GetPortBitMapForCopyBits, 1,
       
  1190 	 PyDoc_STR("() -> (const BitMap * _rv)")},
       
  1191 	{"GetPortBounds", (PyCFunction)GrafObj_GetPortBounds, 1,
       
  1192 	 PyDoc_STR("() -> (Rect rect)")},
       
  1193 	{"GetPortForeColor", (PyCFunction)GrafObj_GetPortForeColor, 1,
       
  1194 	 PyDoc_STR("() -> (RGBColor foreColor)")},
       
  1195 	{"GetPortBackColor", (PyCFunction)GrafObj_GetPortBackColor, 1,
       
  1196 	 PyDoc_STR("() -> (RGBColor backColor)")},
       
  1197 	{"GetPortOpColor", (PyCFunction)GrafObj_GetPortOpColor, 1,
       
  1198 	 PyDoc_STR("() -> (RGBColor opColor)")},
       
  1199 	{"GetPortHiliteColor", (PyCFunction)GrafObj_GetPortHiliteColor, 1,
       
  1200 	 PyDoc_STR("() -> (RGBColor hiliteColor)")},
       
  1201 	{"GetPortTextFont", (PyCFunction)GrafObj_GetPortTextFont, 1,
       
  1202 	 PyDoc_STR("() -> (short _rv)")},
       
  1203 	{"GetPortTextFace", (PyCFunction)GrafObj_GetPortTextFace, 1,
       
  1204 	 PyDoc_STR("() -> (Style _rv)")},
       
  1205 	{"GetPortTextMode", (PyCFunction)GrafObj_GetPortTextMode, 1,
       
  1206 	 PyDoc_STR("() -> (short _rv)")},
       
  1207 	{"GetPortTextSize", (PyCFunction)GrafObj_GetPortTextSize, 1,
       
  1208 	 PyDoc_STR("() -> (short _rv)")},
       
  1209 	{"GetPortChExtra", (PyCFunction)GrafObj_GetPortChExtra, 1,
       
  1210 	 PyDoc_STR("() -> (short _rv)")},
       
  1211 	{"GetPortFracHPenLocation", (PyCFunction)GrafObj_GetPortFracHPenLocation, 1,
       
  1212 	 PyDoc_STR("() -> (short _rv)")},
       
  1213 	{"GetPortSpExtra", (PyCFunction)GrafObj_GetPortSpExtra, 1,
       
  1214 	 PyDoc_STR("() -> (Fixed _rv)")},
       
  1215 	{"GetPortPenVisibility", (PyCFunction)GrafObj_GetPortPenVisibility, 1,
       
  1216 	 PyDoc_STR("() -> (short _rv)")},
       
  1217 	{"GetPortVisibleRegion", (PyCFunction)GrafObj_GetPortVisibleRegion, 1,
       
  1218 	 PyDoc_STR("(RgnHandle visRgn) -> (RgnHandle _rv)")},
       
  1219 	{"GetPortClipRegion", (PyCFunction)GrafObj_GetPortClipRegion, 1,
       
  1220 	 PyDoc_STR("(RgnHandle clipRgn) -> (RgnHandle _rv)")},
       
  1221 	{"GetPortBackPixPat", (PyCFunction)GrafObj_GetPortBackPixPat, 1,
       
  1222 	 PyDoc_STR("(PixPatHandle backPattern) -> (PixPatHandle _rv)")},
       
  1223 	{"GetPortPenPixPat", (PyCFunction)GrafObj_GetPortPenPixPat, 1,
       
  1224 	 PyDoc_STR("(PixPatHandle penPattern) -> (PixPatHandle _rv)")},
       
  1225 	{"GetPortFillPixPat", (PyCFunction)GrafObj_GetPortFillPixPat, 1,
       
  1226 	 PyDoc_STR("(PixPatHandle fillPattern) -> (PixPatHandle _rv)")},
       
  1227 	{"GetPortPenSize", (PyCFunction)GrafObj_GetPortPenSize, 1,
       
  1228 	 PyDoc_STR("(Point penSize) -> (Point penSize)")},
       
  1229 	{"GetPortPenMode", (PyCFunction)GrafObj_GetPortPenMode, 1,
       
  1230 	 PyDoc_STR("() -> (SInt32 _rv)")},
       
  1231 	{"GetPortPenLocation", (PyCFunction)GrafObj_GetPortPenLocation, 1,
       
  1232 	 PyDoc_STR("(Point penLocation) -> (Point penLocation)")},
       
  1233 	{"IsPortRegionBeingDefined", (PyCFunction)GrafObj_IsPortRegionBeingDefined, 1,
       
  1234 	 PyDoc_STR("() -> (Boolean _rv)")},
       
  1235 	{"IsPortPictureBeingDefined", (PyCFunction)GrafObj_IsPortPictureBeingDefined, 1,
       
  1236 	 PyDoc_STR("() -> (Boolean _rv)")},
       
  1237 	{"IsPortPolyBeingDefined", (PyCFunction)GrafObj_IsPortPolyBeingDefined, 1,
       
  1238 	 PyDoc_STR("() -> (Boolean _rv)")},
       
  1239 	{"IsPortOffscreen", (PyCFunction)GrafObj_IsPortOffscreen, 1,
       
  1240 	 PyDoc_STR("() -> (Boolean _rv)")},
       
  1241 	{"IsPortColor", (PyCFunction)GrafObj_IsPortColor, 1,
       
  1242 	 PyDoc_STR("() -> (Boolean _rv)")},
       
  1243 	{"IsPortVisibleRegionEmpty", (PyCFunction)GrafObj_IsPortVisibleRegionEmpty, 1,
       
  1244 	 PyDoc_STR("() -> (Boolean _rv)")},
       
  1245 	{"IsPortClipRegionEmpty", (PyCFunction)GrafObj_IsPortClipRegionEmpty, 1,
       
  1246 	 PyDoc_STR("() -> (Boolean _rv)")},
       
  1247 	{"SectRegionWithPortClipRegion", (PyCFunction)GrafObj_SectRegionWithPortClipRegion, 1,
       
  1248 	 PyDoc_STR("(RgnHandle ioRegion) -> None")},
       
  1249 	{"SectRegionWithPortVisibleRegion", (PyCFunction)GrafObj_SectRegionWithPortVisibleRegion, 1,
       
  1250 	 PyDoc_STR("(RgnHandle ioRegion) -> None")},
       
  1251 	{"SwapPortPicSaveHandle", (PyCFunction)GrafObj_SwapPortPicSaveHandle, 1,
       
  1252 	 PyDoc_STR("(Handle inPicSaveHdl) -> (Handle _rv)")},
       
  1253 	{"SwapPortPolySaveHandle", (PyCFunction)GrafObj_SwapPortPolySaveHandle, 1,
       
  1254 	 PyDoc_STR("(Handle inPolySaveHdl) -> (Handle _rv)")},
       
  1255 	{"SwapPortRegionSaveHandle", (PyCFunction)GrafObj_SwapPortRegionSaveHandle, 1,
       
  1256 	 PyDoc_STR("(Handle inRegionSaveHdl) -> (Handle _rv)")},
       
  1257 	{"SetPortBounds", (PyCFunction)GrafObj_SetPortBounds, 1,
       
  1258 	 PyDoc_STR("(Rect rect) -> None")},
       
  1259 	{"SetPortOpColor", (PyCFunction)GrafObj_SetPortOpColor, 1,
       
  1260 	 PyDoc_STR("(RGBColor opColor) -> None")},
       
  1261 	{"SetPortTextFont", (PyCFunction)GrafObj_SetPortTextFont, 1,
       
  1262 	 PyDoc_STR("(short txFont) -> None")},
       
  1263 	{"SetPortTextSize", (PyCFunction)GrafObj_SetPortTextSize, 1,
       
  1264 	 PyDoc_STR("(short txSize) -> None")},
       
  1265 	{"SetPortTextFace", (PyCFunction)GrafObj_SetPortTextFace, 1,
       
  1266 	 PyDoc_STR("(StyleParameter face) -> None")},
       
  1267 	{"SetPortTextMode", (PyCFunction)GrafObj_SetPortTextMode, 1,
       
  1268 	 PyDoc_STR("(short mode) -> None")},
       
  1269 	{"SetPortVisibleRegion", (PyCFunction)GrafObj_SetPortVisibleRegion, 1,
       
  1270 	 PyDoc_STR("(RgnHandle visRgn) -> None")},
       
  1271 	{"SetPortClipRegion", (PyCFunction)GrafObj_SetPortClipRegion, 1,
       
  1272 	 PyDoc_STR("(RgnHandle clipRgn) -> None")},
       
  1273 	{"SetPortPenPixPat", (PyCFunction)GrafObj_SetPortPenPixPat, 1,
       
  1274 	 PyDoc_STR("(PixPatHandle penPattern) -> None")},
       
  1275 	{"SetPortFillPixPat", (PyCFunction)GrafObj_SetPortFillPixPat, 1,
       
  1276 	 PyDoc_STR("(PixPatHandle penPattern) -> None")},
       
  1277 	{"SetPortBackPixPat", (PyCFunction)GrafObj_SetPortBackPixPat, 1,
       
  1278 	 PyDoc_STR("(PixPatHandle backPattern) -> None")},
       
  1279 	{"SetPortPenSize", (PyCFunction)GrafObj_SetPortPenSize, 1,
       
  1280 	 PyDoc_STR("(Point penSize) -> None")},
       
  1281 	{"SetPortPenMode", (PyCFunction)GrafObj_SetPortPenMode, 1,
       
  1282 	 PyDoc_STR("(SInt32 penMode) -> None")},
       
  1283 	{"SetPortFracHPenLocation", (PyCFunction)GrafObj_SetPortFracHPenLocation, 1,
       
  1284 	 PyDoc_STR("(short pnLocHFrac) -> None")},
       
  1285 	{"DisposePort", (PyCFunction)GrafObj_DisposePort, 1,
       
  1286 	 PyDoc_STR("() -> None")},
       
  1287 	{"QDLocalToGlobalPoint", (PyCFunction)GrafObj_QDLocalToGlobalPoint, 1,
       
  1288 	 PyDoc_STR("(Point point) -> (Point point)")},
       
  1289 	{"QDGlobalToLocalPoint", (PyCFunction)GrafObj_QDGlobalToLocalPoint, 1,
       
  1290 	 PyDoc_STR("(Point point) -> (Point point)")},
       
  1291 	{"QDLocalToGlobalRect", (PyCFunction)GrafObj_QDLocalToGlobalRect, 1,
       
  1292 	 PyDoc_STR("() -> (Rect bounds)")},
       
  1293 	{"QDGlobalToLocalRect", (PyCFunction)GrafObj_QDGlobalToLocalRect, 1,
       
  1294 	 PyDoc_STR("() -> (Rect bounds)")},
       
  1295 	{"QDLocalToGlobalRegion", (PyCFunction)GrafObj_QDLocalToGlobalRegion, 1,
       
  1296 	 PyDoc_STR("(RgnHandle region) -> (RgnHandle _rv)")},
       
  1297 	{"QDGlobalToLocalRegion", (PyCFunction)GrafObj_QDGlobalToLocalRegion, 1,
       
  1298 	 PyDoc_STR("(RgnHandle region) -> (RgnHandle _rv)")},
       
  1299 	{"QDIsPortBuffered", (PyCFunction)GrafObj_QDIsPortBuffered, 1,
       
  1300 	 PyDoc_STR("() -> (Boolean _rv)")},
       
  1301 	{"QDIsPortBufferDirty", (PyCFunction)GrafObj_QDIsPortBufferDirty, 1,
       
  1302 	 PyDoc_STR("() -> (Boolean _rv)")},
       
  1303 	{"QDFlushPortBuffer", (PyCFunction)GrafObj_QDFlushPortBuffer, 1,
       
  1304 	 PyDoc_STR("(RgnHandle region) -> None")},
       
  1305 	{"QDGetDirtyRegion", (PyCFunction)GrafObj_QDGetDirtyRegion, 1,
       
  1306 	 PyDoc_STR("(RgnHandle rgn) -> None")},
       
  1307 	{"QDSetDirtyRegion", (PyCFunction)GrafObj_QDSetDirtyRegion, 1,
       
  1308 	 PyDoc_STR("(RgnHandle rgn) -> None")},
       
  1309 	{NULL, NULL, 0}
       
  1310 };
       
  1311 
       
  1312 static PyObject *GrafObj_get_visRgn(GrafPortObject *self, void *closure)
       
  1313 {
       
  1314 	RgnHandle h=NewRgn(); /* XXXX wrong dispose routine */
       
  1315 	            return Py_BuildValue("O&", ResObj_New, (Handle)GetPortVisibleRegion(self->ob_itself, h));
       
  1316 	            
       
  1317 }
       
  1318 
       
  1319 #define GrafObj_set_visRgn NULL
       
  1320 
       
  1321 static PyObject *GrafObj_get_clipRgn(GrafPortObject *self, void *closure)
       
  1322 {
       
  1323 	RgnHandle h=NewRgn(); /* XXXX wrong dispose routine */
       
  1324 	            return Py_BuildValue("O&", ResObj_New, (Handle)GetPortClipRegion(self->ob_itself, h));
       
  1325 	            
       
  1326 }
       
  1327 
       
  1328 #define GrafObj_set_clipRgn NULL
       
  1329 
       
  1330 static PyGetSetDef GrafObj_getsetlist[] = {
       
  1331 	{"visRgn", (getter)GrafObj_get_visRgn, (setter)GrafObj_set_visRgn, "Convenience attribute: return a copy of the visible region"},
       
  1332 	{"clipRgn", (getter)GrafObj_get_clipRgn, (setter)GrafObj_set_clipRgn, "Convenience attribute: return a copy of the clipping region"},
       
  1333 	{NULL, NULL, NULL, NULL},
       
  1334 };
       
  1335 
       
  1336 
       
  1337 #define GrafObj_compare NULL
       
  1338 
       
  1339 #define GrafObj_repr NULL
       
  1340 
       
  1341 #define GrafObj_hash NULL
       
  1342 #define GrafObj_tp_init 0
       
  1343 
       
  1344 #define GrafObj_tp_alloc PyType_GenericAlloc
       
  1345 
       
  1346 static PyObject *GrafObj_tp_new(PyTypeObject *type, PyObject *_args, PyObject *_kwds)
       
  1347 {
       
  1348 	PyObject *_self;
       
  1349 	GrafPtr itself;
       
  1350 	char *kw[] = {"itself", 0};
       
  1351 
       
  1352 	if (!PyArg_ParseTupleAndKeywords(_args, _kwds, "O&", kw, GrafObj_Convert, &itself)) return NULL;
       
  1353 	if ((_self = type->tp_alloc(type, 0)) == NULL) return NULL;
       
  1354 	((GrafPortObject *)_self)->ob_itself = itself;
       
  1355 	return _self;
       
  1356 }
       
  1357 
       
  1358 #define GrafObj_tp_free PyObject_Del
       
  1359 
       
  1360 
       
  1361 PyTypeObject GrafPort_Type = {
       
  1362 	PyObject_HEAD_INIT(NULL)
       
  1363 	0, /*ob_size*/
       
  1364 	"_Qd.GrafPort", /*tp_name*/
       
  1365 	sizeof(GrafPortObject), /*tp_basicsize*/
       
  1366 	0, /*tp_itemsize*/
       
  1367 	/* methods */
       
  1368 	(destructor) GrafObj_dealloc, /*tp_dealloc*/
       
  1369 	0, /*tp_print*/
       
  1370 	(getattrfunc)0, /*tp_getattr*/
       
  1371 	(setattrfunc)0, /*tp_setattr*/
       
  1372 	(cmpfunc) GrafObj_compare, /*tp_compare*/
       
  1373 	(reprfunc) GrafObj_repr, /*tp_repr*/
       
  1374 	(PyNumberMethods *)0, /* tp_as_number */
       
  1375 	(PySequenceMethods *)0, /* tp_as_sequence */
       
  1376 	(PyMappingMethods *)0, /* tp_as_mapping */
       
  1377 	(hashfunc) GrafObj_hash, /*tp_hash*/
       
  1378 	0, /*tp_call*/
       
  1379 	0, /*tp_str*/
       
  1380 	PyObject_GenericGetAttr, /*tp_getattro*/
       
  1381 	PyObject_GenericSetAttr, /*tp_setattro */
       
  1382 	0, /*tp_as_buffer*/
       
  1383 	Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /* tp_flags */
       
  1384 	0, /*tp_doc*/
       
  1385 	0, /*tp_traverse*/
       
  1386 	0, /*tp_clear*/
       
  1387 	0, /*tp_richcompare*/
       
  1388 	0, /*tp_weaklistoffset*/
       
  1389 	0, /*tp_iter*/
       
  1390 	0, /*tp_iternext*/
       
  1391 	GrafObj_methods, /* tp_methods */
       
  1392 	0, /*tp_members*/
       
  1393 	GrafObj_getsetlist, /*tp_getset*/
       
  1394 	0, /*tp_base*/
       
  1395 	0, /*tp_dict*/
       
  1396 	0, /*tp_descr_get*/
       
  1397 	0, /*tp_descr_set*/
       
  1398 	0, /*tp_dictoffset*/
       
  1399 	GrafObj_tp_init, /* tp_init */
       
  1400 	GrafObj_tp_alloc, /* tp_alloc */
       
  1401 	GrafObj_tp_new, /* tp_new */
       
  1402 	GrafObj_tp_free, /* tp_free */
       
  1403 };
       
  1404 
       
  1405 /* -------------------- End object type GrafPort -------------------- */
       
  1406 
       
  1407 
       
  1408 /* ----------------------- Object type BitMap ----------------------- */
       
  1409 
       
  1410 PyTypeObject BitMap_Type;
       
  1411 
       
  1412 #define BMObj_Check(x) ((x)->ob_type == &BitMap_Type || PyObject_TypeCheck((x), &BitMap_Type))
       
  1413 
       
  1414 typedef struct BitMapObject {
       
  1415 	PyObject_HEAD
       
  1416 	BitMapPtr ob_itself;
       
  1417 	PyObject *referred_object;
       
  1418 	BitMap *referred_bitmap;
       
  1419 } BitMapObject;
       
  1420 
       
  1421 PyObject *BMObj_New(BitMapPtr itself)
       
  1422 {
       
  1423 	BitMapObject *it;
       
  1424 	if (itself == NULL) return PyMac_Error(resNotFound);
       
  1425 	it = PyObject_NEW(BitMapObject, &BitMap_Type);
       
  1426 	if (it == NULL) return NULL;
       
  1427 	it->ob_itself = itself;
       
  1428 	it->referred_object = NULL;
       
  1429 	it->referred_bitmap = NULL;
       
  1430 	return (PyObject *)it;
       
  1431 }
       
  1432 
       
  1433 int BMObj_Convert(PyObject *v, BitMapPtr *p_itself)
       
  1434 {
       
  1435 	if (!BMObj_Check(v))
       
  1436 	{
       
  1437 		PyErr_SetString(PyExc_TypeError, "BitMap required");
       
  1438 		return 0;
       
  1439 	}
       
  1440 	*p_itself = ((BitMapObject *)v)->ob_itself;
       
  1441 	return 1;
       
  1442 }
       
  1443 
       
  1444 static void BMObj_dealloc(BitMapObject *self)
       
  1445 {
       
  1446 	Py_XDECREF(self->referred_object);
       
  1447 	if (self->referred_bitmap) free(self->referred_bitmap);
       
  1448 	self->ob_type->tp_free((PyObject *)self);
       
  1449 }
       
  1450 
       
  1451 static PyObject *BMObj_getdata(BitMapObject *_self, PyObject *_args)
       
  1452 {
       
  1453 	PyObject *_res = NULL;
       
  1454 
       
  1455 	int from, length;
       
  1456 	char *cp;
       
  1457 
       
  1458 	if ( !PyArg_ParseTuple(_args, "ii", &from, &length) )
       
  1459 	        return NULL;
       
  1460 	cp = _self->ob_itself->baseAddr+from;
       
  1461 	_res = PyString_FromStringAndSize(cp, length);
       
  1462 	return _res;
       
  1463 
       
  1464 }
       
  1465 
       
  1466 static PyObject *BMObj_putdata(BitMapObject *_self, PyObject *_args)
       
  1467 {
       
  1468 	PyObject *_res = NULL;
       
  1469 
       
  1470 	int from, length;
       
  1471 	char *cp, *icp;
       
  1472 
       
  1473 	if ( !PyArg_ParseTuple(_args, "is#", &from, &icp, &length) )
       
  1474 	        return NULL;
       
  1475 	cp = _self->ob_itself->baseAddr+from;
       
  1476 	memcpy(cp, icp, length);
       
  1477 	Py_INCREF(Py_None);
       
  1478 	_res = Py_None;
       
  1479 	return _res;
       
  1480 
       
  1481 }
       
  1482 
       
  1483 static PyMethodDef BMObj_methods[] = {
       
  1484 	{"getdata", (PyCFunction)BMObj_getdata, 1,
       
  1485 	 PyDoc_STR("(int start, int size) -> string. Return bytes from the bitmap")},
       
  1486 	{"putdata", (PyCFunction)BMObj_putdata, 1,
       
  1487 	 PyDoc_STR("(int start, string data). Store bytes into the bitmap")},
       
  1488 	{NULL, NULL, 0}
       
  1489 };
       
  1490 
       
  1491 static PyObject *BMObj_get_baseAddr(BitMapObject *self, void *closure)
       
  1492 {
       
  1493 	return PyInt_FromLong((long)self->ob_itself->baseAddr);
       
  1494 }
       
  1495 
       
  1496 #define BMObj_set_baseAddr NULL
       
  1497 
       
  1498 static PyObject *BMObj_get_rowBytes(BitMapObject *self, void *closure)
       
  1499 {
       
  1500 	return PyInt_FromLong((long)self->ob_itself->rowBytes);
       
  1501 }
       
  1502 
       
  1503 #define BMObj_set_rowBytes NULL
       
  1504 
       
  1505 static PyObject *BMObj_get_bounds(BitMapObject *self, void *closure)
       
  1506 {
       
  1507 	return Py_BuildValue("O&", PyMac_BuildRect, &self->ob_itself->bounds);
       
  1508 }
       
  1509 
       
  1510 #define BMObj_set_bounds NULL
       
  1511 
       
  1512 static PyObject *BMObj_get_bitmap_data(BitMapObject *self, void *closure)
       
  1513 {
       
  1514 	return PyString_FromStringAndSize((char *)self->ob_itself, sizeof(BitMap));
       
  1515 }
       
  1516 
       
  1517 #define BMObj_set_bitmap_data NULL
       
  1518 
       
  1519 static PyObject *BMObj_get_pixmap_data(BitMapObject *self, void *closure)
       
  1520 {
       
  1521 	return PyString_FromStringAndSize((char *)self->ob_itself, sizeof(PixMap));
       
  1522 }
       
  1523 
       
  1524 #define BMObj_set_pixmap_data NULL
       
  1525 
       
  1526 static PyGetSetDef BMObj_getsetlist[] = {
       
  1527 	{"baseAddr", (getter)BMObj_get_baseAddr, (setter)BMObj_set_baseAddr, NULL},
       
  1528 	{"rowBytes", (getter)BMObj_get_rowBytes, (setter)BMObj_set_rowBytes, NULL},
       
  1529 	{"bounds", (getter)BMObj_get_bounds, (setter)BMObj_set_bounds, NULL},
       
  1530 	{"bitmap_data", (getter)BMObj_get_bitmap_data, (setter)BMObj_set_bitmap_data, NULL},
       
  1531 	{"pixmap_data", (getter)BMObj_get_pixmap_data, (setter)BMObj_set_pixmap_data, NULL},
       
  1532 	{NULL, NULL, NULL, NULL},
       
  1533 };
       
  1534 
       
  1535 
       
  1536 #define BMObj_compare NULL
       
  1537 
       
  1538 #define BMObj_repr NULL
       
  1539 
       
  1540 #define BMObj_hash NULL
       
  1541 #define BMObj_tp_init 0
       
  1542 
       
  1543 #define BMObj_tp_alloc PyType_GenericAlloc
       
  1544 
       
  1545 static PyObject *BMObj_tp_new(PyTypeObject *type, PyObject *_args, PyObject *_kwds)
       
  1546 {
       
  1547 	PyObject *_self;
       
  1548 	BitMapPtr itself;
       
  1549 	char *kw[] = {"itself", 0};
       
  1550 
       
  1551 	if (!PyArg_ParseTupleAndKeywords(_args, _kwds, "O&", kw, BMObj_Convert, &itself)) return NULL;
       
  1552 	if ((_self = type->tp_alloc(type, 0)) == NULL) return NULL;
       
  1553 	((BitMapObject *)_self)->ob_itself = itself;
       
  1554 	return _self;
       
  1555 }
       
  1556 
       
  1557 #define BMObj_tp_free PyObject_Del
       
  1558 
       
  1559 
       
  1560 PyTypeObject BitMap_Type = {
       
  1561 	PyObject_HEAD_INIT(NULL)
       
  1562 	0, /*ob_size*/
       
  1563 	"_Qd.BitMap", /*tp_name*/
       
  1564 	sizeof(BitMapObject), /*tp_basicsize*/
       
  1565 	0, /*tp_itemsize*/
       
  1566 	/* methods */
       
  1567 	(destructor) BMObj_dealloc, /*tp_dealloc*/
       
  1568 	0, /*tp_print*/
       
  1569 	(getattrfunc)0, /*tp_getattr*/
       
  1570 	(setattrfunc)0, /*tp_setattr*/
       
  1571 	(cmpfunc) BMObj_compare, /*tp_compare*/
       
  1572 	(reprfunc) BMObj_repr, /*tp_repr*/
       
  1573 	(PyNumberMethods *)0, /* tp_as_number */
       
  1574 	(PySequenceMethods *)0, /* tp_as_sequence */
       
  1575 	(PyMappingMethods *)0, /* tp_as_mapping */
       
  1576 	(hashfunc) BMObj_hash, /*tp_hash*/
       
  1577 	0, /*tp_call*/
       
  1578 	0, /*tp_str*/
       
  1579 	PyObject_GenericGetAttr, /*tp_getattro*/
       
  1580 	PyObject_GenericSetAttr, /*tp_setattro */
       
  1581 	0, /*tp_as_buffer*/
       
  1582 	Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /* tp_flags */
       
  1583 	0, /*tp_doc*/
       
  1584 	0, /*tp_traverse*/
       
  1585 	0, /*tp_clear*/
       
  1586 	0, /*tp_richcompare*/
       
  1587 	0, /*tp_weaklistoffset*/
       
  1588 	0, /*tp_iter*/
       
  1589 	0, /*tp_iternext*/
       
  1590 	BMObj_methods, /* tp_methods */
       
  1591 	0, /*tp_members*/
       
  1592 	BMObj_getsetlist, /*tp_getset*/
       
  1593 	0, /*tp_base*/
       
  1594 	0, /*tp_dict*/
       
  1595 	0, /*tp_descr_get*/
       
  1596 	0, /*tp_descr_set*/
       
  1597 	0, /*tp_dictoffset*/
       
  1598 	BMObj_tp_init, /* tp_init */
       
  1599 	BMObj_tp_alloc, /* tp_alloc */
       
  1600 	BMObj_tp_new, /* tp_new */
       
  1601 	BMObj_tp_free, /* tp_free */
       
  1602 };
       
  1603 
       
  1604 /* --------------------- End object type BitMap --------------------- */
       
  1605 
       
  1606 
       
  1607 static PyObject *Qd_GetPort(PyObject *_self, PyObject *_args)
       
  1608 {
       
  1609 	PyObject *_res = NULL;
       
  1610 	GrafPtr port;
       
  1611 #ifndef GetPort
       
  1612 	PyMac_PRECHECK(GetPort);
       
  1613 #endif
       
  1614 	if (!PyArg_ParseTuple(_args, ""))
       
  1615 		return NULL;
       
  1616 	GetPort(&port);
       
  1617 	_res = Py_BuildValue("O&",
       
  1618 	                     GrafObj_New, port);
       
  1619 	return _res;
       
  1620 }
       
  1621 
       
  1622 static PyObject *Qd_GrafDevice(PyObject *_self, PyObject *_args)
       
  1623 {
       
  1624 	PyObject *_res = NULL;
       
  1625 	short device;
       
  1626 #ifndef GrafDevice
       
  1627 	PyMac_PRECHECK(GrafDevice);
       
  1628 #endif
       
  1629 	if (!PyArg_ParseTuple(_args, "h",
       
  1630 	                      &device))
       
  1631 		return NULL;
       
  1632 	GrafDevice(device);
       
  1633 	Py_INCREF(Py_None);
       
  1634 	_res = Py_None;
       
  1635 	return _res;
       
  1636 }
       
  1637 
       
  1638 static PyObject *Qd_SetPortBits(PyObject *_self, PyObject *_args)
       
  1639 {
       
  1640 	PyObject *_res = NULL;
       
  1641 	BitMapPtr bm;
       
  1642 #ifndef SetPortBits
       
  1643 	PyMac_PRECHECK(SetPortBits);
       
  1644 #endif
       
  1645 	if (!PyArg_ParseTuple(_args, "O&",
       
  1646 	                      BMObj_Convert, &bm))
       
  1647 		return NULL;
       
  1648 	SetPortBits(bm);
       
  1649 	Py_INCREF(Py_None);
       
  1650 	_res = Py_None;
       
  1651 	return _res;
       
  1652 }
       
  1653 
       
  1654 static PyObject *Qd_PortSize(PyObject *_self, PyObject *_args)
       
  1655 {
       
  1656 	PyObject *_res = NULL;
       
  1657 	short width;
       
  1658 	short height;
       
  1659 #ifndef PortSize
       
  1660 	PyMac_PRECHECK(PortSize);
       
  1661 #endif
       
  1662 	if (!PyArg_ParseTuple(_args, "hh",
       
  1663 	                      &width,
       
  1664 	                      &height))
       
  1665 		return NULL;
       
  1666 	PortSize(width,
       
  1667 	         height);
       
  1668 	Py_INCREF(Py_None);
       
  1669 	_res = Py_None;
       
  1670 	return _res;
       
  1671 }
       
  1672 
       
  1673 static PyObject *Qd_MovePortTo(PyObject *_self, PyObject *_args)
       
  1674 {
       
  1675 	PyObject *_res = NULL;
       
  1676 	short leftGlobal;
       
  1677 	short topGlobal;
       
  1678 #ifndef MovePortTo
       
  1679 	PyMac_PRECHECK(MovePortTo);
       
  1680 #endif
       
  1681 	if (!PyArg_ParseTuple(_args, "hh",
       
  1682 	                      &leftGlobal,
       
  1683 	                      &topGlobal))
       
  1684 		return NULL;
       
  1685 	MovePortTo(leftGlobal,
       
  1686 	           topGlobal);
       
  1687 	Py_INCREF(Py_None);
       
  1688 	_res = Py_None;
       
  1689 	return _res;
       
  1690 }
       
  1691 
       
  1692 static PyObject *Qd_SetOrigin(PyObject *_self, PyObject *_args)
       
  1693 {
       
  1694 	PyObject *_res = NULL;
       
  1695 	short h;
       
  1696 	short v;
       
  1697 #ifndef SetOrigin
       
  1698 	PyMac_PRECHECK(SetOrigin);
       
  1699 #endif
       
  1700 	if (!PyArg_ParseTuple(_args, "hh",
       
  1701 	                      &h,
       
  1702 	                      &v))
       
  1703 		return NULL;
       
  1704 	SetOrigin(h,
       
  1705 	          v);
       
  1706 	Py_INCREF(Py_None);
       
  1707 	_res = Py_None;
       
  1708 	return _res;
       
  1709 }
       
  1710 
       
  1711 static PyObject *Qd_SetClip(PyObject *_self, PyObject *_args)
       
  1712 {
       
  1713 	PyObject *_res = NULL;
       
  1714 	RgnHandle rgn;
       
  1715 #ifndef SetClip
       
  1716 	PyMac_PRECHECK(SetClip);
       
  1717 #endif
       
  1718 	if (!PyArg_ParseTuple(_args, "O&",
       
  1719 	                      ResObj_Convert, &rgn))
       
  1720 		return NULL;
       
  1721 	SetClip(rgn);
       
  1722 	Py_INCREF(Py_None);
       
  1723 	_res = Py_None;
       
  1724 	return _res;
       
  1725 }
       
  1726 
       
  1727 static PyObject *Qd_GetClip(PyObject *_self, PyObject *_args)
       
  1728 {
       
  1729 	PyObject *_res = NULL;
       
  1730 	RgnHandle rgn;
       
  1731 #ifndef GetClip
       
  1732 	PyMac_PRECHECK(GetClip);
       
  1733 #endif
       
  1734 	if (!PyArg_ParseTuple(_args, "O&",
       
  1735 	                      ResObj_Convert, &rgn))
       
  1736 		return NULL;
       
  1737 	GetClip(rgn);
       
  1738 	Py_INCREF(Py_None);
       
  1739 	_res = Py_None;
       
  1740 	return _res;
       
  1741 }
       
  1742 
       
  1743 static PyObject *Qd_ClipRect(PyObject *_self, PyObject *_args)
       
  1744 {
       
  1745 	PyObject *_res = NULL;
       
  1746 	Rect r;
       
  1747 #ifndef ClipRect
       
  1748 	PyMac_PRECHECK(ClipRect);
       
  1749 #endif
       
  1750 	if (!PyArg_ParseTuple(_args, "O&",
       
  1751 	                      PyMac_GetRect, &r))
       
  1752 		return NULL;
       
  1753 	ClipRect(&r);
       
  1754 	Py_INCREF(Py_None);
       
  1755 	_res = Py_None;
       
  1756 	return _res;
       
  1757 }
       
  1758 
       
  1759 static PyObject *Qd_BackPat(PyObject *_self, PyObject *_args)
       
  1760 {
       
  1761 	PyObject *_res = NULL;
       
  1762 	Pattern *pat__in__;
       
  1763 	int pat__in_len__;
       
  1764 #ifndef BackPat
       
  1765 	PyMac_PRECHECK(BackPat);
       
  1766 #endif
       
  1767 	if (!PyArg_ParseTuple(_args, "s#",
       
  1768 	                      (char **)&pat__in__, &pat__in_len__))
       
  1769 		return NULL;
       
  1770 	if (pat__in_len__ != sizeof(Pattern))
       
  1771 	{
       
  1772 		PyErr_SetString(PyExc_TypeError, "buffer length should be sizeof(Pattern)");
       
  1773 		goto pat__error__;
       
  1774 	}
       
  1775 	BackPat(pat__in__);
       
  1776 	Py_INCREF(Py_None);
       
  1777 	_res = Py_None;
       
  1778  pat__error__: ;
       
  1779 	return _res;
       
  1780 }
       
  1781 
       
  1782 static PyObject *Qd_InitCursor(PyObject *_self, PyObject *_args)
       
  1783 {
       
  1784 	PyObject *_res = NULL;
       
  1785 #ifndef InitCursor
       
  1786 	PyMac_PRECHECK(InitCursor);
       
  1787 #endif
       
  1788 	if (!PyArg_ParseTuple(_args, ""))
       
  1789 		return NULL;
       
  1790 	InitCursor();
       
  1791 	Py_INCREF(Py_None);
       
  1792 	_res = Py_None;
       
  1793 	return _res;
       
  1794 }
       
  1795 
       
  1796 static PyObject *Qd_MacSetCursor(PyObject *_self, PyObject *_args)
       
  1797 {
       
  1798 	PyObject *_res = NULL;
       
  1799 	Cursor *crsr__in__;
       
  1800 	int crsr__in_len__;
       
  1801 #ifndef MacSetCursor
       
  1802 	PyMac_PRECHECK(MacSetCursor);
       
  1803 #endif
       
  1804 	if (!PyArg_ParseTuple(_args, "s#",
       
  1805 	                      (char **)&crsr__in__, &crsr__in_len__))
       
  1806 		return NULL;
       
  1807 	if (crsr__in_len__ != sizeof(Cursor))
       
  1808 	{
       
  1809 		PyErr_SetString(PyExc_TypeError, "buffer length should be sizeof(Cursor)");
       
  1810 		goto crsr__error__;
       
  1811 	}
       
  1812 	MacSetCursor(crsr__in__);
       
  1813 	Py_INCREF(Py_None);
       
  1814 	_res = Py_None;
       
  1815  crsr__error__: ;
       
  1816 	return _res;
       
  1817 }
       
  1818 
       
  1819 static PyObject *Qd_HideCursor(PyObject *_self, PyObject *_args)
       
  1820 {
       
  1821 	PyObject *_res = NULL;
       
  1822 #ifndef HideCursor
       
  1823 	PyMac_PRECHECK(HideCursor);
       
  1824 #endif
       
  1825 	if (!PyArg_ParseTuple(_args, ""))
       
  1826 		return NULL;
       
  1827 	HideCursor();
       
  1828 	Py_INCREF(Py_None);
       
  1829 	_res = Py_None;
       
  1830 	return _res;
       
  1831 }
       
  1832 
       
  1833 static PyObject *Qd_MacShowCursor(PyObject *_self, PyObject *_args)
       
  1834 {
       
  1835 	PyObject *_res = NULL;
       
  1836 #ifndef MacShowCursor
       
  1837 	PyMac_PRECHECK(MacShowCursor);
       
  1838 #endif
       
  1839 	if (!PyArg_ParseTuple(_args, ""))
       
  1840 		return NULL;
       
  1841 	MacShowCursor();
       
  1842 	Py_INCREF(Py_None);
       
  1843 	_res = Py_None;
       
  1844 	return _res;
       
  1845 }
       
  1846 
       
  1847 static PyObject *Qd_ObscureCursor(PyObject *_self, PyObject *_args)
       
  1848 {
       
  1849 	PyObject *_res = NULL;
       
  1850 #ifndef ObscureCursor
       
  1851 	PyMac_PRECHECK(ObscureCursor);
       
  1852 #endif
       
  1853 	if (!PyArg_ParseTuple(_args, ""))
       
  1854 		return NULL;
       
  1855 	ObscureCursor();
       
  1856 	Py_INCREF(Py_None);
       
  1857 	_res = Py_None;
       
  1858 	return _res;
       
  1859 }
       
  1860 
       
  1861 static PyObject *Qd_HidePen(PyObject *_self, PyObject *_args)
       
  1862 {
       
  1863 	PyObject *_res = NULL;
       
  1864 #ifndef HidePen
       
  1865 	PyMac_PRECHECK(HidePen);
       
  1866 #endif
       
  1867 	if (!PyArg_ParseTuple(_args, ""))
       
  1868 		return NULL;
       
  1869 	HidePen();
       
  1870 	Py_INCREF(Py_None);
       
  1871 	_res = Py_None;
       
  1872 	return _res;
       
  1873 }
       
  1874 
       
  1875 static PyObject *Qd_ShowPen(PyObject *_self, PyObject *_args)
       
  1876 {
       
  1877 	PyObject *_res = NULL;
       
  1878 #ifndef ShowPen
       
  1879 	PyMac_PRECHECK(ShowPen);
       
  1880 #endif
       
  1881 	if (!PyArg_ParseTuple(_args, ""))
       
  1882 		return NULL;
       
  1883 	ShowPen();
       
  1884 	Py_INCREF(Py_None);
       
  1885 	_res = Py_None;
       
  1886 	return _res;
       
  1887 }
       
  1888 
       
  1889 static PyObject *Qd_GetPen(PyObject *_self, PyObject *_args)
       
  1890 {
       
  1891 	PyObject *_res = NULL;
       
  1892 	Point pt;
       
  1893 #ifndef GetPen
       
  1894 	PyMac_PRECHECK(GetPen);
       
  1895 #endif
       
  1896 	if (!PyArg_ParseTuple(_args, ""))
       
  1897 		return NULL;
       
  1898 	GetPen(&pt);
       
  1899 	_res = Py_BuildValue("O&",
       
  1900 	                     PyMac_BuildPoint, pt);
       
  1901 	return _res;
       
  1902 }
       
  1903 
       
  1904 static PyObject *Qd_GetPenState(PyObject *_self, PyObject *_args)
       
  1905 {
       
  1906 	PyObject *_res = NULL;
       
  1907 	PenState pnState__out__;
       
  1908 #ifndef GetPenState
       
  1909 	PyMac_PRECHECK(GetPenState);
       
  1910 #endif
       
  1911 	if (!PyArg_ParseTuple(_args, ""))
       
  1912 		return NULL;
       
  1913 	GetPenState(&pnState__out__);
       
  1914 	_res = Py_BuildValue("s#",
       
  1915 	                     (char *)&pnState__out__, (int)sizeof(PenState));
       
  1916 	return _res;
       
  1917 }
       
  1918 
       
  1919 static PyObject *Qd_SetPenState(PyObject *_self, PyObject *_args)
       
  1920 {
       
  1921 	PyObject *_res = NULL;
       
  1922 	PenState *pnState__in__;
       
  1923 	int pnState__in_len__;
       
  1924 #ifndef SetPenState
       
  1925 	PyMac_PRECHECK(SetPenState);
       
  1926 #endif
       
  1927 	if (!PyArg_ParseTuple(_args, "s#",
       
  1928 	                      (char **)&pnState__in__, &pnState__in_len__))
       
  1929 		return NULL;
       
  1930 	if (pnState__in_len__ != sizeof(PenState))
       
  1931 	{
       
  1932 		PyErr_SetString(PyExc_TypeError, "buffer length should be sizeof(PenState)");
       
  1933 		goto pnState__error__;
       
  1934 	}
       
  1935 	SetPenState(pnState__in__);
       
  1936 	Py_INCREF(Py_None);
       
  1937 	_res = Py_None;
       
  1938  pnState__error__: ;
       
  1939 	return _res;
       
  1940 }
       
  1941 
       
  1942 static PyObject *Qd_PenSize(PyObject *_self, PyObject *_args)
       
  1943 {
       
  1944 	PyObject *_res = NULL;
       
  1945 	short width;
       
  1946 	short height;
       
  1947 #ifndef PenSize
       
  1948 	PyMac_PRECHECK(PenSize);
       
  1949 #endif
       
  1950 	if (!PyArg_ParseTuple(_args, "hh",
       
  1951 	                      &width,
       
  1952 	                      &height))
       
  1953 		return NULL;
       
  1954 	PenSize(width,
       
  1955 	        height);
       
  1956 	Py_INCREF(Py_None);
       
  1957 	_res = Py_None;
       
  1958 	return _res;
       
  1959 }
       
  1960 
       
  1961 static PyObject *Qd_PenMode(PyObject *_self, PyObject *_args)
       
  1962 {
       
  1963 	PyObject *_res = NULL;
       
  1964 	short mode;
       
  1965 #ifndef PenMode
       
  1966 	PyMac_PRECHECK(PenMode);
       
  1967 #endif
       
  1968 	if (!PyArg_ParseTuple(_args, "h",
       
  1969 	                      &mode))
       
  1970 		return NULL;
       
  1971 	PenMode(mode);
       
  1972 	Py_INCREF(Py_None);
       
  1973 	_res = Py_None;
       
  1974 	return _res;
       
  1975 }
       
  1976 
       
  1977 static PyObject *Qd_PenPat(PyObject *_self, PyObject *_args)
       
  1978 {
       
  1979 	PyObject *_res = NULL;
       
  1980 	Pattern *pat__in__;
       
  1981 	int pat__in_len__;
       
  1982 #ifndef PenPat
       
  1983 	PyMac_PRECHECK(PenPat);
       
  1984 #endif
       
  1985 	if (!PyArg_ParseTuple(_args, "s#",
       
  1986 	                      (char **)&pat__in__, &pat__in_len__))
       
  1987 		return NULL;
       
  1988 	if (pat__in_len__ != sizeof(Pattern))
       
  1989 	{
       
  1990 		PyErr_SetString(PyExc_TypeError, "buffer length should be sizeof(Pattern)");
       
  1991 		goto pat__error__;
       
  1992 	}
       
  1993 	PenPat(pat__in__);
       
  1994 	Py_INCREF(Py_None);
       
  1995 	_res = Py_None;
       
  1996  pat__error__: ;
       
  1997 	return _res;
       
  1998 }
       
  1999 
       
  2000 static PyObject *Qd_PenNormal(PyObject *_self, PyObject *_args)
       
  2001 {
       
  2002 	PyObject *_res = NULL;
       
  2003 #ifndef PenNormal
       
  2004 	PyMac_PRECHECK(PenNormal);
       
  2005 #endif
       
  2006 	if (!PyArg_ParseTuple(_args, ""))
       
  2007 		return NULL;
       
  2008 	PenNormal();
       
  2009 	Py_INCREF(Py_None);
       
  2010 	_res = Py_None;
       
  2011 	return _res;
       
  2012 }
       
  2013 
       
  2014 static PyObject *Qd_MoveTo(PyObject *_self, PyObject *_args)
       
  2015 {
       
  2016 	PyObject *_res = NULL;
       
  2017 	short h;
       
  2018 	short v;
       
  2019 #ifndef MoveTo
       
  2020 	PyMac_PRECHECK(MoveTo);
       
  2021 #endif
       
  2022 	if (!PyArg_ParseTuple(_args, "hh",
       
  2023 	                      &h,
       
  2024 	                      &v))
       
  2025 		return NULL;
       
  2026 	MoveTo(h,
       
  2027 	       v);
       
  2028 	Py_INCREF(Py_None);
       
  2029 	_res = Py_None;
       
  2030 	return _res;
       
  2031 }
       
  2032 
       
  2033 static PyObject *Qd_Move(PyObject *_self, PyObject *_args)
       
  2034 {
       
  2035 	PyObject *_res = NULL;
       
  2036 	short dh;
       
  2037 	short dv;
       
  2038 #ifndef Move
       
  2039 	PyMac_PRECHECK(Move);
       
  2040 #endif
       
  2041 	if (!PyArg_ParseTuple(_args, "hh",
       
  2042 	                      &dh,
       
  2043 	                      &dv))
       
  2044 		return NULL;
       
  2045 	Move(dh,
       
  2046 	     dv);
       
  2047 	Py_INCREF(Py_None);
       
  2048 	_res = Py_None;
       
  2049 	return _res;
       
  2050 }
       
  2051 
       
  2052 static PyObject *Qd_MacLineTo(PyObject *_self, PyObject *_args)
       
  2053 {
       
  2054 	PyObject *_res = NULL;
       
  2055 	short h;
       
  2056 	short v;
       
  2057 #ifndef MacLineTo
       
  2058 	PyMac_PRECHECK(MacLineTo);
       
  2059 #endif
       
  2060 	if (!PyArg_ParseTuple(_args, "hh",
       
  2061 	                      &h,
       
  2062 	                      &v))
       
  2063 		return NULL;
       
  2064 	MacLineTo(h,
       
  2065 	          v);
       
  2066 	Py_INCREF(Py_None);
       
  2067 	_res = Py_None;
       
  2068 	return _res;
       
  2069 }
       
  2070 
       
  2071 static PyObject *Qd_Line(PyObject *_self, PyObject *_args)
       
  2072 {
       
  2073 	PyObject *_res = NULL;
       
  2074 	short dh;
       
  2075 	short dv;
       
  2076 #ifndef Line
       
  2077 	PyMac_PRECHECK(Line);
       
  2078 #endif
       
  2079 	if (!PyArg_ParseTuple(_args, "hh",
       
  2080 	                      &dh,
       
  2081 	                      &dv))
       
  2082 		return NULL;
       
  2083 	Line(dh,
       
  2084 	     dv);
       
  2085 	Py_INCREF(Py_None);
       
  2086 	_res = Py_None;
       
  2087 	return _res;
       
  2088 }
       
  2089 
       
  2090 static PyObject *Qd_ForeColor(PyObject *_self, PyObject *_args)
       
  2091 {
       
  2092 	PyObject *_res = NULL;
       
  2093 	long color;
       
  2094 #ifndef ForeColor
       
  2095 	PyMac_PRECHECK(ForeColor);
       
  2096 #endif
       
  2097 	if (!PyArg_ParseTuple(_args, "l",
       
  2098 	                      &color))
       
  2099 		return NULL;
       
  2100 	ForeColor(color);
       
  2101 	Py_INCREF(Py_None);
       
  2102 	_res = Py_None;
       
  2103 	return _res;
       
  2104 }
       
  2105 
       
  2106 static PyObject *Qd_BackColor(PyObject *_self, PyObject *_args)
       
  2107 {
       
  2108 	PyObject *_res = NULL;
       
  2109 	long color;
       
  2110 #ifndef BackColor
       
  2111 	PyMac_PRECHECK(BackColor);
       
  2112 #endif
       
  2113 	if (!PyArg_ParseTuple(_args, "l",
       
  2114 	                      &color))
       
  2115 		return NULL;
       
  2116 	BackColor(color);
       
  2117 	Py_INCREF(Py_None);
       
  2118 	_res = Py_None;
       
  2119 	return _res;
       
  2120 }
       
  2121 
       
  2122 static PyObject *Qd_ColorBit(PyObject *_self, PyObject *_args)
       
  2123 {
       
  2124 	PyObject *_res = NULL;
       
  2125 	short whichBit;
       
  2126 #ifndef ColorBit
       
  2127 	PyMac_PRECHECK(ColorBit);
       
  2128 #endif
       
  2129 	if (!PyArg_ParseTuple(_args, "h",
       
  2130 	                      &whichBit))
       
  2131 		return NULL;
       
  2132 	ColorBit(whichBit);
       
  2133 	Py_INCREF(Py_None);
       
  2134 	_res = Py_None;
       
  2135 	return _res;
       
  2136 }
       
  2137 
       
  2138 static PyObject *Qd_MacSetRect(PyObject *_self, PyObject *_args)
       
  2139 {
       
  2140 	PyObject *_res = NULL;
       
  2141 	Rect r;
       
  2142 	short left;
       
  2143 	short top;
       
  2144 	short right;
       
  2145 	short bottom;
       
  2146 #ifndef MacSetRect
       
  2147 	PyMac_PRECHECK(MacSetRect);
       
  2148 #endif
       
  2149 	if (!PyArg_ParseTuple(_args, "hhhh",
       
  2150 	                      &left,
       
  2151 	                      &top,
       
  2152 	                      &right,
       
  2153 	                      &bottom))
       
  2154 		return NULL;
       
  2155 	MacSetRect(&r,
       
  2156 	           left,
       
  2157 	           top,
       
  2158 	           right,
       
  2159 	           bottom);
       
  2160 	_res = Py_BuildValue("O&",
       
  2161 	                     PyMac_BuildRect, &r);
       
  2162 	return _res;
       
  2163 }
       
  2164 
       
  2165 static PyObject *Qd_MacOffsetRect(PyObject *_self, PyObject *_args)
       
  2166 {
       
  2167 	PyObject *_res = NULL;
       
  2168 	Rect r;
       
  2169 	short dh;
       
  2170 	short dv;
       
  2171 #ifndef MacOffsetRect
       
  2172 	PyMac_PRECHECK(MacOffsetRect);
       
  2173 #endif
       
  2174 	if (!PyArg_ParseTuple(_args, "O&hh",
       
  2175 	                      PyMac_GetRect, &r,
       
  2176 	                      &dh,
       
  2177 	                      &dv))
       
  2178 		return NULL;
       
  2179 	MacOffsetRect(&r,
       
  2180 	              dh,
       
  2181 	              dv);
       
  2182 	_res = Py_BuildValue("O&",
       
  2183 	                     PyMac_BuildRect, &r);
       
  2184 	return _res;
       
  2185 }
       
  2186 
       
  2187 static PyObject *Qd_MacInsetRect(PyObject *_self, PyObject *_args)
       
  2188 {
       
  2189 	PyObject *_res = NULL;
       
  2190 	Rect r;
       
  2191 	short dh;
       
  2192 	short dv;
       
  2193 #ifndef MacInsetRect
       
  2194 	PyMac_PRECHECK(MacInsetRect);
       
  2195 #endif
       
  2196 	if (!PyArg_ParseTuple(_args, "O&hh",
       
  2197 	                      PyMac_GetRect, &r,
       
  2198 	                      &dh,
       
  2199 	                      &dv))
       
  2200 		return NULL;
       
  2201 	MacInsetRect(&r,
       
  2202 	             dh,
       
  2203 	             dv);
       
  2204 	_res = Py_BuildValue("O&",
       
  2205 	                     PyMac_BuildRect, &r);
       
  2206 	return _res;
       
  2207 }
       
  2208 
       
  2209 static PyObject *Qd_SectRect(PyObject *_self, PyObject *_args)
       
  2210 {
       
  2211 	PyObject *_res = NULL;
       
  2212 	Boolean _rv;
       
  2213 	Rect src1;
       
  2214 	Rect src2;
       
  2215 	Rect dstRect;
       
  2216 #ifndef SectRect
       
  2217 	PyMac_PRECHECK(SectRect);
       
  2218 #endif
       
  2219 	if (!PyArg_ParseTuple(_args, "O&O&",
       
  2220 	                      PyMac_GetRect, &src1,
       
  2221 	                      PyMac_GetRect, &src2))
       
  2222 		return NULL;
       
  2223 	_rv = SectRect(&src1,
       
  2224 	               &src2,
       
  2225 	               &dstRect);
       
  2226 	_res = Py_BuildValue("bO&",
       
  2227 	                     _rv,
       
  2228 	                     PyMac_BuildRect, &dstRect);
       
  2229 	return _res;
       
  2230 }
       
  2231 
       
  2232 static PyObject *Qd_MacUnionRect(PyObject *_self, PyObject *_args)
       
  2233 {
       
  2234 	PyObject *_res = NULL;
       
  2235 	Rect src1;
       
  2236 	Rect src2;
       
  2237 	Rect dstRect;
       
  2238 #ifndef MacUnionRect
       
  2239 	PyMac_PRECHECK(MacUnionRect);
       
  2240 #endif
       
  2241 	if (!PyArg_ParseTuple(_args, "O&O&",
       
  2242 	                      PyMac_GetRect, &src1,
       
  2243 	                      PyMac_GetRect, &src2))
       
  2244 		return NULL;
       
  2245 	MacUnionRect(&src1,
       
  2246 	             &src2,
       
  2247 	             &dstRect);
       
  2248 	_res = Py_BuildValue("O&",
       
  2249 	                     PyMac_BuildRect, &dstRect);
       
  2250 	return _res;
       
  2251 }
       
  2252 
       
  2253 static PyObject *Qd_MacEqualRect(PyObject *_self, PyObject *_args)
       
  2254 {
       
  2255 	PyObject *_res = NULL;
       
  2256 	Boolean _rv;
       
  2257 	Rect rect1;
       
  2258 	Rect rect2;
       
  2259 #ifndef MacEqualRect
       
  2260 	PyMac_PRECHECK(MacEqualRect);
       
  2261 #endif
       
  2262 	if (!PyArg_ParseTuple(_args, "O&O&",
       
  2263 	                      PyMac_GetRect, &rect1,
       
  2264 	                      PyMac_GetRect, &rect2))
       
  2265 		return NULL;
       
  2266 	_rv = MacEqualRect(&rect1,
       
  2267 	                   &rect2);
       
  2268 	_res = Py_BuildValue("b",
       
  2269 	                     _rv);
       
  2270 	return _res;
       
  2271 }
       
  2272 
       
  2273 static PyObject *Qd_EmptyRect(PyObject *_self, PyObject *_args)
       
  2274 {
       
  2275 	PyObject *_res = NULL;
       
  2276 	Boolean _rv;
       
  2277 	Rect r;
       
  2278 #ifndef EmptyRect
       
  2279 	PyMac_PRECHECK(EmptyRect);
       
  2280 #endif
       
  2281 	if (!PyArg_ParseTuple(_args, "O&",
       
  2282 	                      PyMac_GetRect, &r))
       
  2283 		return NULL;
       
  2284 	_rv = EmptyRect(&r);
       
  2285 	_res = Py_BuildValue("b",
       
  2286 	                     _rv);
       
  2287 	return _res;
       
  2288 }
       
  2289 
       
  2290 static PyObject *Qd_MacFrameRect(PyObject *_self, PyObject *_args)
       
  2291 {
       
  2292 	PyObject *_res = NULL;
       
  2293 	Rect r;
       
  2294 #ifndef MacFrameRect
       
  2295 	PyMac_PRECHECK(MacFrameRect);
       
  2296 #endif
       
  2297 	if (!PyArg_ParseTuple(_args, "O&",
       
  2298 	                      PyMac_GetRect, &r))
       
  2299 		return NULL;
       
  2300 	MacFrameRect(&r);
       
  2301 	Py_INCREF(Py_None);
       
  2302 	_res = Py_None;
       
  2303 	return _res;
       
  2304 }
       
  2305 
       
  2306 static PyObject *Qd_PaintRect(PyObject *_self, PyObject *_args)
       
  2307 {
       
  2308 	PyObject *_res = NULL;
       
  2309 	Rect r;
       
  2310 #ifndef PaintRect
       
  2311 	PyMac_PRECHECK(PaintRect);
       
  2312 #endif
       
  2313 	if (!PyArg_ParseTuple(_args, "O&",
       
  2314 	                      PyMac_GetRect, &r))
       
  2315 		return NULL;
       
  2316 	PaintRect(&r);
       
  2317 	Py_INCREF(Py_None);
       
  2318 	_res = Py_None;
       
  2319 	return _res;
       
  2320 }
       
  2321 
       
  2322 static PyObject *Qd_EraseRect(PyObject *_self, PyObject *_args)
       
  2323 {
       
  2324 	PyObject *_res = NULL;
       
  2325 	Rect r;
       
  2326 #ifndef EraseRect
       
  2327 	PyMac_PRECHECK(EraseRect);
       
  2328 #endif
       
  2329 	if (!PyArg_ParseTuple(_args, "O&",
       
  2330 	                      PyMac_GetRect, &r))
       
  2331 		return NULL;
       
  2332 	EraseRect(&r);
       
  2333 	Py_INCREF(Py_None);
       
  2334 	_res = Py_None;
       
  2335 	return _res;
       
  2336 }
       
  2337 
       
  2338 static PyObject *Qd_MacInvertRect(PyObject *_self, PyObject *_args)
       
  2339 {
       
  2340 	PyObject *_res = NULL;
       
  2341 	Rect r;
       
  2342 #ifndef MacInvertRect
       
  2343 	PyMac_PRECHECK(MacInvertRect);
       
  2344 #endif
       
  2345 	if (!PyArg_ParseTuple(_args, "O&",
       
  2346 	                      PyMac_GetRect, &r))
       
  2347 		return NULL;
       
  2348 	MacInvertRect(&r);
       
  2349 	Py_INCREF(Py_None);
       
  2350 	_res = Py_None;
       
  2351 	return _res;
       
  2352 }
       
  2353 
       
  2354 static PyObject *Qd_MacFillRect(PyObject *_self, PyObject *_args)
       
  2355 {
       
  2356 	PyObject *_res = NULL;
       
  2357 	Rect r;
       
  2358 	Pattern *pat__in__;
       
  2359 	int pat__in_len__;
       
  2360 #ifndef MacFillRect
       
  2361 	PyMac_PRECHECK(MacFillRect);
       
  2362 #endif
       
  2363 	if (!PyArg_ParseTuple(_args, "O&s#",
       
  2364 	                      PyMac_GetRect, &r,
       
  2365 	                      (char **)&pat__in__, &pat__in_len__))
       
  2366 		return NULL;
       
  2367 	if (pat__in_len__ != sizeof(Pattern))
       
  2368 	{
       
  2369 		PyErr_SetString(PyExc_TypeError, "buffer length should be sizeof(Pattern)");
       
  2370 		goto pat__error__;
       
  2371 	}
       
  2372 	MacFillRect(&r,
       
  2373 	            pat__in__);
       
  2374 	Py_INCREF(Py_None);
       
  2375 	_res = Py_None;
       
  2376  pat__error__: ;
       
  2377 	return _res;
       
  2378 }
       
  2379 
       
  2380 static PyObject *Qd_FrameOval(PyObject *_self, PyObject *_args)
       
  2381 {
       
  2382 	PyObject *_res = NULL;
       
  2383 	Rect r;
       
  2384 #ifndef FrameOval
       
  2385 	PyMac_PRECHECK(FrameOval);
       
  2386 #endif
       
  2387 	if (!PyArg_ParseTuple(_args, "O&",
       
  2388 	                      PyMac_GetRect, &r))
       
  2389 		return NULL;
       
  2390 	FrameOval(&r);
       
  2391 	Py_INCREF(Py_None);
       
  2392 	_res = Py_None;
       
  2393 	return _res;
       
  2394 }
       
  2395 
       
  2396 static PyObject *Qd_PaintOval(PyObject *_self, PyObject *_args)
       
  2397 {
       
  2398 	PyObject *_res = NULL;
       
  2399 	Rect r;
       
  2400 #ifndef PaintOval
       
  2401 	PyMac_PRECHECK(PaintOval);
       
  2402 #endif
       
  2403 	if (!PyArg_ParseTuple(_args, "O&",
       
  2404 	                      PyMac_GetRect, &r))
       
  2405 		return NULL;
       
  2406 	PaintOval(&r);
       
  2407 	Py_INCREF(Py_None);
       
  2408 	_res = Py_None;
       
  2409 	return _res;
       
  2410 }
       
  2411 
       
  2412 static PyObject *Qd_EraseOval(PyObject *_self, PyObject *_args)
       
  2413 {
       
  2414 	PyObject *_res = NULL;
       
  2415 	Rect r;
       
  2416 #ifndef EraseOval
       
  2417 	PyMac_PRECHECK(EraseOval);
       
  2418 #endif
       
  2419 	if (!PyArg_ParseTuple(_args, "O&",
       
  2420 	                      PyMac_GetRect, &r))
       
  2421 		return NULL;
       
  2422 	EraseOval(&r);
       
  2423 	Py_INCREF(Py_None);
       
  2424 	_res = Py_None;
       
  2425 	return _res;
       
  2426 }
       
  2427 
       
  2428 static PyObject *Qd_InvertOval(PyObject *_self, PyObject *_args)
       
  2429 {
       
  2430 	PyObject *_res = NULL;
       
  2431 	Rect r;
       
  2432 #ifndef InvertOval
       
  2433 	PyMac_PRECHECK(InvertOval);
       
  2434 #endif
       
  2435 	if (!PyArg_ParseTuple(_args, "O&",
       
  2436 	                      PyMac_GetRect, &r))
       
  2437 		return NULL;
       
  2438 	InvertOval(&r);
       
  2439 	Py_INCREF(Py_None);
       
  2440 	_res = Py_None;
       
  2441 	return _res;
       
  2442 }
       
  2443 
       
  2444 static PyObject *Qd_FillOval(PyObject *_self, PyObject *_args)
       
  2445 {
       
  2446 	PyObject *_res = NULL;
       
  2447 	Rect r;
       
  2448 	Pattern *pat__in__;
       
  2449 	int pat__in_len__;
       
  2450 #ifndef FillOval
       
  2451 	PyMac_PRECHECK(FillOval);
       
  2452 #endif
       
  2453 	if (!PyArg_ParseTuple(_args, "O&s#",
       
  2454 	                      PyMac_GetRect, &r,
       
  2455 	                      (char **)&pat__in__, &pat__in_len__))
       
  2456 		return NULL;
       
  2457 	if (pat__in_len__ != sizeof(Pattern))
       
  2458 	{
       
  2459 		PyErr_SetString(PyExc_TypeError, "buffer length should be sizeof(Pattern)");
       
  2460 		goto pat__error__;
       
  2461 	}
       
  2462 	FillOval(&r,
       
  2463 	         pat__in__);
       
  2464 	Py_INCREF(Py_None);
       
  2465 	_res = Py_None;
       
  2466  pat__error__: ;
       
  2467 	return _res;
       
  2468 }
       
  2469 
       
  2470 static PyObject *Qd_FrameRoundRect(PyObject *_self, PyObject *_args)
       
  2471 {
       
  2472 	PyObject *_res = NULL;
       
  2473 	Rect r;
       
  2474 	short ovalWidth;
       
  2475 	short ovalHeight;
       
  2476 #ifndef FrameRoundRect
       
  2477 	PyMac_PRECHECK(FrameRoundRect);
       
  2478 #endif
       
  2479 	if (!PyArg_ParseTuple(_args, "O&hh",
       
  2480 	                      PyMac_GetRect, &r,
       
  2481 	                      &ovalWidth,
       
  2482 	                      &ovalHeight))
       
  2483 		return NULL;
       
  2484 	FrameRoundRect(&r,
       
  2485 	               ovalWidth,
       
  2486 	               ovalHeight);
       
  2487 	Py_INCREF(Py_None);
       
  2488 	_res = Py_None;
       
  2489 	return _res;
       
  2490 }
       
  2491 
       
  2492 static PyObject *Qd_PaintRoundRect(PyObject *_self, PyObject *_args)
       
  2493 {
       
  2494 	PyObject *_res = NULL;
       
  2495 	Rect r;
       
  2496 	short ovalWidth;
       
  2497 	short ovalHeight;
       
  2498 #ifndef PaintRoundRect
       
  2499 	PyMac_PRECHECK(PaintRoundRect);
       
  2500 #endif
       
  2501 	if (!PyArg_ParseTuple(_args, "O&hh",
       
  2502 	                      PyMac_GetRect, &r,
       
  2503 	                      &ovalWidth,
       
  2504 	                      &ovalHeight))
       
  2505 		return NULL;
       
  2506 	PaintRoundRect(&r,
       
  2507 	               ovalWidth,
       
  2508 	               ovalHeight);
       
  2509 	Py_INCREF(Py_None);
       
  2510 	_res = Py_None;
       
  2511 	return _res;
       
  2512 }
       
  2513 
       
  2514 static PyObject *Qd_EraseRoundRect(PyObject *_self, PyObject *_args)
       
  2515 {
       
  2516 	PyObject *_res = NULL;
       
  2517 	Rect r;
       
  2518 	short ovalWidth;
       
  2519 	short ovalHeight;
       
  2520 #ifndef EraseRoundRect
       
  2521 	PyMac_PRECHECK(EraseRoundRect);
       
  2522 #endif
       
  2523 	if (!PyArg_ParseTuple(_args, "O&hh",
       
  2524 	                      PyMac_GetRect, &r,
       
  2525 	                      &ovalWidth,
       
  2526 	                      &ovalHeight))
       
  2527 		return NULL;
       
  2528 	EraseRoundRect(&r,
       
  2529 	               ovalWidth,
       
  2530 	               ovalHeight);
       
  2531 	Py_INCREF(Py_None);
       
  2532 	_res = Py_None;
       
  2533 	return _res;
       
  2534 }
       
  2535 
       
  2536 static PyObject *Qd_InvertRoundRect(PyObject *_self, PyObject *_args)
       
  2537 {
       
  2538 	PyObject *_res = NULL;
       
  2539 	Rect r;
       
  2540 	short ovalWidth;
       
  2541 	short ovalHeight;
       
  2542 #ifndef InvertRoundRect
       
  2543 	PyMac_PRECHECK(InvertRoundRect);
       
  2544 #endif
       
  2545 	if (!PyArg_ParseTuple(_args, "O&hh",
       
  2546 	                      PyMac_GetRect, &r,
       
  2547 	                      &ovalWidth,
       
  2548 	                      &ovalHeight))
       
  2549 		return NULL;
       
  2550 	InvertRoundRect(&r,
       
  2551 	                ovalWidth,
       
  2552 	                ovalHeight);
       
  2553 	Py_INCREF(Py_None);
       
  2554 	_res = Py_None;
       
  2555 	return _res;
       
  2556 }
       
  2557 
       
  2558 static PyObject *Qd_FillRoundRect(PyObject *_self, PyObject *_args)
       
  2559 {
       
  2560 	PyObject *_res = NULL;
       
  2561 	Rect r;
       
  2562 	short ovalWidth;
       
  2563 	short ovalHeight;
       
  2564 	Pattern *pat__in__;
       
  2565 	int pat__in_len__;
       
  2566 #ifndef FillRoundRect
       
  2567 	PyMac_PRECHECK(FillRoundRect);
       
  2568 #endif
       
  2569 	if (!PyArg_ParseTuple(_args, "O&hhs#",
       
  2570 	                      PyMac_GetRect, &r,
       
  2571 	                      &ovalWidth,
       
  2572 	                      &ovalHeight,
       
  2573 	                      (char **)&pat__in__, &pat__in_len__))
       
  2574 		return NULL;
       
  2575 	if (pat__in_len__ != sizeof(Pattern))
       
  2576 	{
       
  2577 		PyErr_SetString(PyExc_TypeError, "buffer length should be sizeof(Pattern)");
       
  2578 		goto pat__error__;
       
  2579 	}
       
  2580 	FillRoundRect(&r,
       
  2581 	              ovalWidth,
       
  2582 	              ovalHeight,
       
  2583 	              pat__in__);
       
  2584 	Py_INCREF(Py_None);
       
  2585 	_res = Py_None;
       
  2586  pat__error__: ;
       
  2587 	return _res;
       
  2588 }
       
  2589 
       
  2590 static PyObject *Qd_FrameArc(PyObject *_self, PyObject *_args)
       
  2591 {
       
  2592 	PyObject *_res = NULL;
       
  2593 	Rect r;
       
  2594 	short startAngle;
       
  2595 	short arcAngle;
       
  2596 #ifndef FrameArc
       
  2597 	PyMac_PRECHECK(FrameArc);
       
  2598 #endif
       
  2599 	if (!PyArg_ParseTuple(_args, "O&hh",
       
  2600 	                      PyMac_GetRect, &r,
       
  2601 	                      &startAngle,
       
  2602 	                      &arcAngle))
       
  2603 		return NULL;
       
  2604 	FrameArc(&r,
       
  2605 	         startAngle,
       
  2606 	         arcAngle);
       
  2607 	Py_INCREF(Py_None);
       
  2608 	_res = Py_None;
       
  2609 	return _res;
       
  2610 }
       
  2611 
       
  2612 static PyObject *Qd_PaintArc(PyObject *_self, PyObject *_args)
       
  2613 {
       
  2614 	PyObject *_res = NULL;
       
  2615 	Rect r;
       
  2616 	short startAngle;
       
  2617 	short arcAngle;
       
  2618 #ifndef PaintArc
       
  2619 	PyMac_PRECHECK(PaintArc);
       
  2620 #endif
       
  2621 	if (!PyArg_ParseTuple(_args, "O&hh",
       
  2622 	                      PyMac_GetRect, &r,
       
  2623 	                      &startAngle,
       
  2624 	                      &arcAngle))
       
  2625 		return NULL;
       
  2626 	PaintArc(&r,
       
  2627 	         startAngle,
       
  2628 	         arcAngle);
       
  2629 	Py_INCREF(Py_None);
       
  2630 	_res = Py_None;
       
  2631 	return _res;
       
  2632 }
       
  2633 
       
  2634 static PyObject *Qd_EraseArc(PyObject *_self, PyObject *_args)
       
  2635 {
       
  2636 	PyObject *_res = NULL;
       
  2637 	Rect r;
       
  2638 	short startAngle;
       
  2639 	short arcAngle;
       
  2640 #ifndef EraseArc
       
  2641 	PyMac_PRECHECK(EraseArc);
       
  2642 #endif
       
  2643 	if (!PyArg_ParseTuple(_args, "O&hh",
       
  2644 	                      PyMac_GetRect, &r,
       
  2645 	                      &startAngle,
       
  2646 	                      &arcAngle))
       
  2647 		return NULL;
       
  2648 	EraseArc(&r,
       
  2649 	         startAngle,
       
  2650 	         arcAngle);
       
  2651 	Py_INCREF(Py_None);
       
  2652 	_res = Py_None;
       
  2653 	return _res;
       
  2654 }
       
  2655 
       
  2656 static PyObject *Qd_InvertArc(PyObject *_self, PyObject *_args)
       
  2657 {
       
  2658 	PyObject *_res = NULL;
       
  2659 	Rect r;
       
  2660 	short startAngle;
       
  2661 	short arcAngle;
       
  2662 #ifndef InvertArc
       
  2663 	PyMac_PRECHECK(InvertArc);
       
  2664 #endif
       
  2665 	if (!PyArg_ParseTuple(_args, "O&hh",
       
  2666 	                      PyMac_GetRect, &r,
       
  2667 	                      &startAngle,
       
  2668 	                      &arcAngle))
       
  2669 		return NULL;
       
  2670 	InvertArc(&r,
       
  2671 	          startAngle,
       
  2672 	          arcAngle);
       
  2673 	Py_INCREF(Py_None);
       
  2674 	_res = Py_None;
       
  2675 	return _res;
       
  2676 }
       
  2677 
       
  2678 static PyObject *Qd_FillArc(PyObject *_self, PyObject *_args)
       
  2679 {
       
  2680 	PyObject *_res = NULL;
       
  2681 	Rect r;
       
  2682 	short startAngle;
       
  2683 	short arcAngle;
       
  2684 	Pattern *pat__in__;
       
  2685 	int pat__in_len__;
       
  2686 #ifndef FillArc
       
  2687 	PyMac_PRECHECK(FillArc);
       
  2688 #endif
       
  2689 	if (!PyArg_ParseTuple(_args, "O&hhs#",
       
  2690 	                      PyMac_GetRect, &r,
       
  2691 	                      &startAngle,
       
  2692 	                      &arcAngle,
       
  2693 	                      (char **)&pat__in__, &pat__in_len__))
       
  2694 		return NULL;
       
  2695 	if (pat__in_len__ != sizeof(Pattern))
       
  2696 	{
       
  2697 		PyErr_SetString(PyExc_TypeError, "buffer length should be sizeof(Pattern)");
       
  2698 		goto pat__error__;
       
  2699 	}
       
  2700 	FillArc(&r,
       
  2701 	        startAngle,
       
  2702 	        arcAngle,
       
  2703 	        pat__in__);
       
  2704 	Py_INCREF(Py_None);
       
  2705 	_res = Py_None;
       
  2706  pat__error__: ;
       
  2707 	return _res;
       
  2708 }
       
  2709 
       
  2710 static PyObject *Qd_NewRgn(PyObject *_self, PyObject *_args)
       
  2711 {
       
  2712 	PyObject *_res = NULL;
       
  2713 	RgnHandle _rv;
       
  2714 #ifndef NewRgn
       
  2715 	PyMac_PRECHECK(NewRgn);
       
  2716 #endif
       
  2717 	if (!PyArg_ParseTuple(_args, ""))
       
  2718 		return NULL;
       
  2719 	_rv = NewRgn();
       
  2720 	_res = Py_BuildValue("O&",
       
  2721 	                     ResObj_New, _rv);
       
  2722 	return _res;
       
  2723 }
       
  2724 
       
  2725 static PyObject *Qd_OpenRgn(PyObject *_self, PyObject *_args)
       
  2726 {
       
  2727 	PyObject *_res = NULL;
       
  2728 #ifndef OpenRgn
       
  2729 	PyMac_PRECHECK(OpenRgn);
       
  2730 #endif
       
  2731 	if (!PyArg_ParseTuple(_args, ""))
       
  2732 		return NULL;
       
  2733 	OpenRgn();
       
  2734 	Py_INCREF(Py_None);
       
  2735 	_res = Py_None;
       
  2736 	return _res;
       
  2737 }
       
  2738 
       
  2739 static PyObject *Qd_CloseRgn(PyObject *_self, PyObject *_args)
       
  2740 {
       
  2741 	PyObject *_res = NULL;
       
  2742 	RgnHandle dstRgn;
       
  2743 #ifndef CloseRgn
       
  2744 	PyMac_PRECHECK(CloseRgn);
       
  2745 #endif
       
  2746 	if (!PyArg_ParseTuple(_args, "O&",
       
  2747 	                      ResObj_Convert, &dstRgn))
       
  2748 		return NULL;
       
  2749 	CloseRgn(dstRgn);
       
  2750 	Py_INCREF(Py_None);
       
  2751 	_res = Py_None;
       
  2752 	return _res;
       
  2753 }
       
  2754 
       
  2755 static PyObject *Qd_BitMapToRegion(PyObject *_self, PyObject *_args)
       
  2756 {
       
  2757 	PyObject *_res = NULL;
       
  2758 	OSErr _err;
       
  2759 	RgnHandle region;
       
  2760 	BitMapPtr bMap;
       
  2761 #ifndef BitMapToRegion
       
  2762 	PyMac_PRECHECK(BitMapToRegion);
       
  2763 #endif
       
  2764 	if (!PyArg_ParseTuple(_args, "O&O&",
       
  2765 	                      ResObj_Convert, &region,
       
  2766 	                      BMObj_Convert, &bMap))
       
  2767 		return NULL;
       
  2768 	_err = BitMapToRegion(region,
       
  2769 	                      bMap);
       
  2770 	if (_err != noErr) return PyMac_Error(_err);
       
  2771 	Py_INCREF(Py_None);
       
  2772 	_res = Py_None;
       
  2773 	return _res;
       
  2774 }
       
  2775 
       
  2776 static PyObject *Qd_RgnToHandle(PyObject *_self, PyObject *_args)
       
  2777 {
       
  2778 	PyObject *_res = NULL;
       
  2779 	RgnHandle region;
       
  2780 	Handle flattenedRgnDataHdl;
       
  2781 #ifndef RgnToHandle
       
  2782 	PyMac_PRECHECK(RgnToHandle);
       
  2783 #endif
       
  2784 	if (!PyArg_ParseTuple(_args, "O&O&",
       
  2785 	                      ResObj_Convert, &region,
       
  2786 	                      ResObj_Convert, &flattenedRgnDataHdl))
       
  2787 		return NULL;
       
  2788 	RgnToHandle(region,
       
  2789 	            flattenedRgnDataHdl);
       
  2790 	Py_INCREF(Py_None);
       
  2791 	_res = Py_None;
       
  2792 	return _res;
       
  2793 }
       
  2794 
       
  2795 static PyObject *Qd_DisposeRgn(PyObject *_self, PyObject *_args)
       
  2796 {
       
  2797 	PyObject *_res = NULL;
       
  2798 	RgnHandle rgn;
       
  2799 #ifndef DisposeRgn
       
  2800 	PyMac_PRECHECK(DisposeRgn);
       
  2801 #endif
       
  2802 	if (!PyArg_ParseTuple(_args, "O&",
       
  2803 	                      ResObj_Convert, &rgn))
       
  2804 		return NULL;
       
  2805 	DisposeRgn(rgn);
       
  2806 	Py_INCREF(Py_None);
       
  2807 	_res = Py_None;
       
  2808 	return _res;
       
  2809 }
       
  2810 
       
  2811 static PyObject *Qd_MacCopyRgn(PyObject *_self, PyObject *_args)
       
  2812 {
       
  2813 	PyObject *_res = NULL;
       
  2814 	RgnHandle srcRgn;
       
  2815 	RgnHandle dstRgn;
       
  2816 #ifndef MacCopyRgn
       
  2817 	PyMac_PRECHECK(MacCopyRgn);
       
  2818 #endif
       
  2819 	if (!PyArg_ParseTuple(_args, "O&O&",
       
  2820 	                      ResObj_Convert, &srcRgn,
       
  2821 	                      ResObj_Convert, &dstRgn))
       
  2822 		return NULL;
       
  2823 	MacCopyRgn(srcRgn,
       
  2824 	           dstRgn);
       
  2825 	Py_INCREF(Py_None);
       
  2826 	_res = Py_None;
       
  2827 	return _res;
       
  2828 }
       
  2829 
       
  2830 static PyObject *Qd_SetEmptyRgn(PyObject *_self, PyObject *_args)
       
  2831 {
       
  2832 	PyObject *_res = NULL;
       
  2833 	RgnHandle rgn;
       
  2834 #ifndef SetEmptyRgn
       
  2835 	PyMac_PRECHECK(SetEmptyRgn);
       
  2836 #endif
       
  2837 	if (!PyArg_ParseTuple(_args, "O&",
       
  2838 	                      ResObj_Convert, &rgn))
       
  2839 		return NULL;
       
  2840 	SetEmptyRgn(rgn);
       
  2841 	Py_INCREF(Py_None);
       
  2842 	_res = Py_None;
       
  2843 	return _res;
       
  2844 }
       
  2845 
       
  2846 static PyObject *Qd_MacSetRectRgn(PyObject *_self, PyObject *_args)
       
  2847 {
       
  2848 	PyObject *_res = NULL;
       
  2849 	RgnHandle rgn;
       
  2850 	short left;
       
  2851 	short top;
       
  2852 	short right;
       
  2853 	short bottom;
       
  2854 #ifndef MacSetRectRgn
       
  2855 	PyMac_PRECHECK(MacSetRectRgn);
       
  2856 #endif
       
  2857 	if (!PyArg_ParseTuple(_args, "O&hhhh",
       
  2858 	                      ResObj_Convert, &rgn,
       
  2859 	                      &left,
       
  2860 	                      &top,
       
  2861 	                      &right,
       
  2862 	                      &bottom))
       
  2863 		return NULL;
       
  2864 	MacSetRectRgn(rgn,
       
  2865 	              left,
       
  2866 	              top,
       
  2867 	              right,
       
  2868 	              bottom);
       
  2869 	Py_INCREF(Py_None);
       
  2870 	_res = Py_None;
       
  2871 	return _res;
       
  2872 }
       
  2873 
       
  2874 static PyObject *Qd_RectRgn(PyObject *_self, PyObject *_args)
       
  2875 {
       
  2876 	PyObject *_res = NULL;
       
  2877 	RgnHandle rgn;
       
  2878 	Rect r;
       
  2879 #ifndef RectRgn
       
  2880 	PyMac_PRECHECK(RectRgn);
       
  2881 #endif
       
  2882 	if (!PyArg_ParseTuple(_args, "O&O&",
       
  2883 	                      ResObj_Convert, &rgn,
       
  2884 	                      PyMac_GetRect, &r))
       
  2885 		return NULL;
       
  2886 	RectRgn(rgn,
       
  2887 	        &r);
       
  2888 	Py_INCREF(Py_None);
       
  2889 	_res = Py_None;
       
  2890 	return _res;
       
  2891 }
       
  2892 
       
  2893 static PyObject *Qd_MacOffsetRgn(PyObject *_self, PyObject *_args)
       
  2894 {
       
  2895 	PyObject *_res = NULL;
       
  2896 	RgnHandle rgn;
       
  2897 	short dh;
       
  2898 	short dv;
       
  2899 #ifndef MacOffsetRgn
       
  2900 	PyMac_PRECHECK(MacOffsetRgn);
       
  2901 #endif
       
  2902 	if (!PyArg_ParseTuple(_args, "O&hh",
       
  2903 	                      ResObj_Convert, &rgn,
       
  2904 	                      &dh,
       
  2905 	                      &dv))
       
  2906 		return NULL;
       
  2907 	MacOffsetRgn(rgn,
       
  2908 	             dh,
       
  2909 	             dv);
       
  2910 	Py_INCREF(Py_None);
       
  2911 	_res = Py_None;
       
  2912 	return _res;
       
  2913 }
       
  2914 
       
  2915 static PyObject *Qd_InsetRgn(PyObject *_self, PyObject *_args)
       
  2916 {
       
  2917 	PyObject *_res = NULL;
       
  2918 	RgnHandle rgn;
       
  2919 	short dh;
       
  2920 	short dv;
       
  2921 #ifndef InsetRgn
       
  2922 	PyMac_PRECHECK(InsetRgn);
       
  2923 #endif
       
  2924 	if (!PyArg_ParseTuple(_args, "O&hh",
       
  2925 	                      ResObj_Convert, &rgn,
       
  2926 	                      &dh,
       
  2927 	                      &dv))
       
  2928 		return NULL;
       
  2929 	InsetRgn(rgn,
       
  2930 	         dh,
       
  2931 	         dv);
       
  2932 	Py_INCREF(Py_None);
       
  2933 	_res = Py_None;
       
  2934 	return _res;
       
  2935 }
       
  2936 
       
  2937 static PyObject *Qd_SectRgn(PyObject *_self, PyObject *_args)
       
  2938 {
       
  2939 	PyObject *_res = NULL;
       
  2940 	RgnHandle srcRgnA;
       
  2941 	RgnHandle srcRgnB;
       
  2942 	RgnHandle dstRgn;
       
  2943 #ifndef SectRgn
       
  2944 	PyMac_PRECHECK(SectRgn);
       
  2945 #endif
       
  2946 	if (!PyArg_ParseTuple(_args, "O&O&O&",
       
  2947 	                      ResObj_Convert, &srcRgnA,
       
  2948 	                      ResObj_Convert, &srcRgnB,
       
  2949 	                      ResObj_Convert, &dstRgn))
       
  2950 		return NULL;
       
  2951 	SectRgn(srcRgnA,
       
  2952 	        srcRgnB,
       
  2953 	        dstRgn);
       
  2954 	Py_INCREF(Py_None);
       
  2955 	_res = Py_None;
       
  2956 	return _res;
       
  2957 }
       
  2958 
       
  2959 static PyObject *Qd_MacUnionRgn(PyObject *_self, PyObject *_args)
       
  2960 {
       
  2961 	PyObject *_res = NULL;
       
  2962 	RgnHandle srcRgnA;
       
  2963 	RgnHandle srcRgnB;
       
  2964 	RgnHandle dstRgn;
       
  2965 #ifndef MacUnionRgn
       
  2966 	PyMac_PRECHECK(MacUnionRgn);
       
  2967 #endif
       
  2968 	if (!PyArg_ParseTuple(_args, "O&O&O&",
       
  2969 	                      ResObj_Convert, &srcRgnA,
       
  2970 	                      ResObj_Convert, &srcRgnB,
       
  2971 	                      ResObj_Convert, &dstRgn))
       
  2972 		return NULL;
       
  2973 	MacUnionRgn(srcRgnA,
       
  2974 	            srcRgnB,
       
  2975 	            dstRgn);
       
  2976 	Py_INCREF(Py_None);
       
  2977 	_res = Py_None;
       
  2978 	return _res;
       
  2979 }
       
  2980 
       
  2981 static PyObject *Qd_DiffRgn(PyObject *_self, PyObject *_args)
       
  2982 {
       
  2983 	PyObject *_res = NULL;
       
  2984 	RgnHandle srcRgnA;
       
  2985 	RgnHandle srcRgnB;
       
  2986 	RgnHandle dstRgn;
       
  2987 #ifndef DiffRgn
       
  2988 	PyMac_PRECHECK(DiffRgn);
       
  2989 #endif
       
  2990 	if (!PyArg_ParseTuple(_args, "O&O&O&",
       
  2991 	                      ResObj_Convert, &srcRgnA,
       
  2992 	                      ResObj_Convert, &srcRgnB,
       
  2993 	                      ResObj_Convert, &dstRgn))
       
  2994 		return NULL;
       
  2995 	DiffRgn(srcRgnA,
       
  2996 	        srcRgnB,
       
  2997 	        dstRgn);
       
  2998 	Py_INCREF(Py_None);
       
  2999 	_res = Py_None;
       
  3000 	return _res;
       
  3001 }
       
  3002 
       
  3003 static PyObject *Qd_MacXorRgn(PyObject *_self, PyObject *_args)
       
  3004 {
       
  3005 	PyObject *_res = NULL;
       
  3006 	RgnHandle srcRgnA;
       
  3007 	RgnHandle srcRgnB;
       
  3008 	RgnHandle dstRgn;
       
  3009 #ifndef MacXorRgn
       
  3010 	PyMac_PRECHECK(MacXorRgn);
       
  3011 #endif
       
  3012 	if (!PyArg_ParseTuple(_args, "O&O&O&",
       
  3013 	                      ResObj_Convert, &srcRgnA,
       
  3014 	                      ResObj_Convert, &srcRgnB,
       
  3015 	                      ResObj_Convert, &dstRgn))
       
  3016 		return NULL;
       
  3017 	MacXorRgn(srcRgnA,
       
  3018 	          srcRgnB,
       
  3019 	          dstRgn);
       
  3020 	Py_INCREF(Py_None);
       
  3021 	_res = Py_None;
       
  3022 	return _res;
       
  3023 }
       
  3024 
       
  3025 static PyObject *Qd_RectInRgn(PyObject *_self, PyObject *_args)
       
  3026 {
       
  3027 	PyObject *_res = NULL;
       
  3028 	Boolean _rv;
       
  3029 	Rect r;
       
  3030 	RgnHandle rgn;
       
  3031 #ifndef RectInRgn
       
  3032 	PyMac_PRECHECK(RectInRgn);
       
  3033 #endif
       
  3034 	if (!PyArg_ParseTuple(_args, "O&O&",
       
  3035 	                      PyMac_GetRect, &r,
       
  3036 	                      ResObj_Convert, &rgn))
       
  3037 		return NULL;
       
  3038 	_rv = RectInRgn(&r,
       
  3039 	                rgn);
       
  3040 	_res = Py_BuildValue("b",
       
  3041 	                     _rv);
       
  3042 	return _res;
       
  3043 }
       
  3044 
       
  3045 static PyObject *Qd_MacEqualRgn(PyObject *_self, PyObject *_args)
       
  3046 {
       
  3047 	PyObject *_res = NULL;
       
  3048 	Boolean _rv;
       
  3049 	RgnHandle rgnA;
       
  3050 	RgnHandle rgnB;
       
  3051 #ifndef MacEqualRgn
       
  3052 	PyMac_PRECHECK(MacEqualRgn);
       
  3053 #endif
       
  3054 	if (!PyArg_ParseTuple(_args, "O&O&",
       
  3055 	                      ResObj_Convert, &rgnA,
       
  3056 	                      ResObj_Convert, &rgnB))
       
  3057 		return NULL;
       
  3058 	_rv = MacEqualRgn(rgnA,
       
  3059 	                  rgnB);
       
  3060 	_res = Py_BuildValue("b",
       
  3061 	                     _rv);
       
  3062 	return _res;
       
  3063 }
       
  3064 
       
  3065 static PyObject *Qd_EmptyRgn(PyObject *_self, PyObject *_args)
       
  3066 {
       
  3067 	PyObject *_res = NULL;
       
  3068 	Boolean _rv;
       
  3069 	RgnHandle rgn;
       
  3070 #ifndef EmptyRgn
       
  3071 	PyMac_PRECHECK(EmptyRgn);
       
  3072 #endif
       
  3073 	if (!PyArg_ParseTuple(_args, "O&",
       
  3074 	                      ResObj_Convert, &rgn))
       
  3075 		return NULL;
       
  3076 	_rv = EmptyRgn(rgn);
       
  3077 	_res = Py_BuildValue("b",
       
  3078 	                     _rv);
       
  3079 	return _res;
       
  3080 }
       
  3081 
       
  3082 static PyObject *Qd_MacFrameRgn(PyObject *_self, PyObject *_args)
       
  3083 {
       
  3084 	PyObject *_res = NULL;
       
  3085 	RgnHandle rgn;
       
  3086 #ifndef MacFrameRgn
       
  3087 	PyMac_PRECHECK(MacFrameRgn);
       
  3088 #endif
       
  3089 	if (!PyArg_ParseTuple(_args, "O&",
       
  3090 	                      ResObj_Convert, &rgn))
       
  3091 		return NULL;
       
  3092 	MacFrameRgn(rgn);
       
  3093 	Py_INCREF(Py_None);
       
  3094 	_res = Py_None;
       
  3095 	return _res;
       
  3096 }
       
  3097 
       
  3098 static PyObject *Qd_MacPaintRgn(PyObject *_self, PyObject *_args)
       
  3099 {
       
  3100 	PyObject *_res = NULL;
       
  3101 	RgnHandle rgn;
       
  3102 #ifndef MacPaintRgn
       
  3103 	PyMac_PRECHECK(MacPaintRgn);
       
  3104 #endif
       
  3105 	if (!PyArg_ParseTuple(_args, "O&",
       
  3106 	                      ResObj_Convert, &rgn))
       
  3107 		return NULL;
       
  3108 	MacPaintRgn(rgn);
       
  3109 	Py_INCREF(Py_None);
       
  3110 	_res = Py_None;
       
  3111 	return _res;
       
  3112 }
       
  3113 
       
  3114 static PyObject *Qd_EraseRgn(PyObject *_self, PyObject *_args)
       
  3115 {
       
  3116 	PyObject *_res = NULL;
       
  3117 	RgnHandle rgn;
       
  3118 #ifndef EraseRgn
       
  3119 	PyMac_PRECHECK(EraseRgn);
       
  3120 #endif
       
  3121 	if (!PyArg_ParseTuple(_args, "O&",
       
  3122 	                      ResObj_Convert, &rgn))
       
  3123 		return NULL;
       
  3124 	EraseRgn(rgn);
       
  3125 	Py_INCREF(Py_None);
       
  3126 	_res = Py_None;
       
  3127 	return _res;
       
  3128 }
       
  3129 
       
  3130 static PyObject *Qd_MacInvertRgn(PyObject *_self, PyObject *_args)
       
  3131 {
       
  3132 	PyObject *_res = NULL;
       
  3133 	RgnHandle rgn;
       
  3134 #ifndef MacInvertRgn
       
  3135 	PyMac_PRECHECK(MacInvertRgn);
       
  3136 #endif
       
  3137 	if (!PyArg_ParseTuple(_args, "O&",
       
  3138 	                      ResObj_Convert, &rgn))
       
  3139 		return NULL;
       
  3140 	MacInvertRgn(rgn);
       
  3141 	Py_INCREF(Py_None);
       
  3142 	_res = Py_None;
       
  3143 	return _res;
       
  3144 }
       
  3145 
       
  3146 static PyObject *Qd_MacFillRgn(PyObject *_self, PyObject *_args)
       
  3147 {
       
  3148 	PyObject *_res = NULL;
       
  3149 	RgnHandle rgn;
       
  3150 	Pattern *pat__in__;
       
  3151 	int pat__in_len__;
       
  3152 #ifndef MacFillRgn
       
  3153 	PyMac_PRECHECK(MacFillRgn);
       
  3154 #endif
       
  3155 	if (!PyArg_ParseTuple(_args, "O&s#",
       
  3156 	                      ResObj_Convert, &rgn,
       
  3157 	                      (char **)&pat__in__, &pat__in_len__))
       
  3158 		return NULL;
       
  3159 	if (pat__in_len__ != sizeof(Pattern))
       
  3160 	{
       
  3161 		PyErr_SetString(PyExc_TypeError, "buffer length should be sizeof(Pattern)");
       
  3162 		goto pat__error__;
       
  3163 	}
       
  3164 	MacFillRgn(rgn,
       
  3165 	           pat__in__);
       
  3166 	Py_INCREF(Py_None);
       
  3167 	_res = Py_None;
       
  3168  pat__error__: ;
       
  3169 	return _res;
       
  3170 }
       
  3171 
       
  3172 static PyObject *Qd_ScrollRect(PyObject *_self, PyObject *_args)
       
  3173 {
       
  3174 	PyObject *_res = NULL;
       
  3175 	Rect r;
       
  3176 	short dh;
       
  3177 	short dv;
       
  3178 	RgnHandle updateRgn;
       
  3179 #ifndef ScrollRect
       
  3180 	PyMac_PRECHECK(ScrollRect);
       
  3181 #endif
       
  3182 	if (!PyArg_ParseTuple(_args, "O&hhO&",
       
  3183 	                      PyMac_GetRect, &r,
       
  3184 	                      &dh,
       
  3185 	                      &dv,
       
  3186 	                      ResObj_Convert, &updateRgn))
       
  3187 		return NULL;
       
  3188 	ScrollRect(&r,
       
  3189 	           dh,
       
  3190 	           dv,
       
  3191 	           updateRgn);
       
  3192 	Py_INCREF(Py_None);
       
  3193 	_res = Py_None;
       
  3194 	return _res;
       
  3195 }
       
  3196 
       
  3197 static PyObject *Qd_CopyBits(PyObject *_self, PyObject *_args)
       
  3198 {
       
  3199 	PyObject *_res = NULL;
       
  3200 	BitMapPtr srcBits;
       
  3201 	BitMapPtr dstBits;
       
  3202 	Rect srcRect;
       
  3203 	Rect dstRect;
       
  3204 	short mode;
       
  3205 	RgnHandle maskRgn;
       
  3206 #ifndef CopyBits
       
  3207 	PyMac_PRECHECK(CopyBits);
       
  3208 #endif
       
  3209 	if (!PyArg_ParseTuple(_args, "O&O&O&O&hO&",
       
  3210 	                      BMObj_Convert, &srcBits,
       
  3211 	                      BMObj_Convert, &dstBits,
       
  3212 	                      PyMac_GetRect, &srcRect,
       
  3213 	                      PyMac_GetRect, &dstRect,
       
  3214 	                      &mode,
       
  3215 	                      OptResObj_Convert, &maskRgn))
       
  3216 		return NULL;
       
  3217 	CopyBits(srcBits,
       
  3218 	         dstBits,
       
  3219 	         &srcRect,
       
  3220 	         &dstRect,
       
  3221 	         mode,
       
  3222 	         maskRgn);
       
  3223 	Py_INCREF(Py_None);
       
  3224 	_res = Py_None;
       
  3225 	return _res;
       
  3226 }
       
  3227 
       
  3228 static PyObject *Qd_CopyMask(PyObject *_self, PyObject *_args)
       
  3229 {
       
  3230 	PyObject *_res = NULL;
       
  3231 	BitMapPtr srcBits;
       
  3232 	BitMapPtr maskBits;
       
  3233 	BitMapPtr dstBits;
       
  3234 	Rect srcRect;
       
  3235 	Rect maskRect;
       
  3236 	Rect dstRect;
       
  3237 #ifndef CopyMask
       
  3238 	PyMac_PRECHECK(CopyMask);
       
  3239 #endif
       
  3240 	if (!PyArg_ParseTuple(_args, "O&O&O&O&O&O&",
       
  3241 	                      BMObj_Convert, &srcBits,
       
  3242 	                      BMObj_Convert, &maskBits,
       
  3243 	                      BMObj_Convert, &dstBits,
       
  3244 	                      PyMac_GetRect, &srcRect,
       
  3245 	                      PyMac_GetRect, &maskRect,
       
  3246 	                      PyMac_GetRect, &dstRect))
       
  3247 		return NULL;
       
  3248 	CopyMask(srcBits,
       
  3249 	         maskBits,
       
  3250 	         dstBits,
       
  3251 	         &srcRect,
       
  3252 	         &maskRect,
       
  3253 	         &dstRect);
       
  3254 	Py_INCREF(Py_None);
       
  3255 	_res = Py_None;
       
  3256 	return _res;
       
  3257 }
       
  3258 
       
  3259 static PyObject *Qd_OpenPicture(PyObject *_self, PyObject *_args)
       
  3260 {
       
  3261 	PyObject *_res = NULL;
       
  3262 	PicHandle _rv;
       
  3263 	Rect picFrame;
       
  3264 #ifndef OpenPicture
       
  3265 	PyMac_PRECHECK(OpenPicture);
       
  3266 #endif
       
  3267 	if (!PyArg_ParseTuple(_args, "O&",
       
  3268 	                      PyMac_GetRect, &picFrame))
       
  3269 		return NULL;
       
  3270 	_rv = OpenPicture(&picFrame);
       
  3271 	_res = Py_BuildValue("O&",
       
  3272 	                     ResObj_New, _rv);
       
  3273 	return _res;
       
  3274 }
       
  3275 
       
  3276 static PyObject *Qd_PicComment(PyObject *_self, PyObject *_args)
       
  3277 {
       
  3278 	PyObject *_res = NULL;
       
  3279 	short kind;
       
  3280 	short dataSize;
       
  3281 	Handle dataHandle;
       
  3282 #ifndef PicComment
       
  3283 	PyMac_PRECHECK(PicComment);
       
  3284 #endif
       
  3285 	if (!PyArg_ParseTuple(_args, "hhO&",
       
  3286 	                      &kind,
       
  3287 	                      &dataSize,
       
  3288 	                      ResObj_Convert, &dataHandle))
       
  3289 		return NULL;
       
  3290 	PicComment(kind,
       
  3291 	           dataSize,
       
  3292 	           dataHandle);
       
  3293 	Py_INCREF(Py_None);
       
  3294 	_res = Py_None;
       
  3295 	return _res;
       
  3296 }
       
  3297 
       
  3298 static PyObject *Qd_ClosePicture(PyObject *_self, PyObject *_args)
       
  3299 {
       
  3300 	PyObject *_res = NULL;
       
  3301 #ifndef ClosePicture
       
  3302 	PyMac_PRECHECK(ClosePicture);
       
  3303 #endif
       
  3304 	if (!PyArg_ParseTuple(_args, ""))
       
  3305 		return NULL;
       
  3306 	ClosePicture();
       
  3307 	Py_INCREF(Py_None);
       
  3308 	_res = Py_None;
       
  3309 	return _res;
       
  3310 }
       
  3311 
       
  3312 static PyObject *Qd_DrawPicture(PyObject *_self, PyObject *_args)
       
  3313 {
       
  3314 	PyObject *_res = NULL;
       
  3315 	PicHandle myPicture;
       
  3316 	Rect dstRect;
       
  3317 #ifndef DrawPicture
       
  3318 	PyMac_PRECHECK(DrawPicture);
       
  3319 #endif
       
  3320 	if (!PyArg_ParseTuple(_args, "O&O&",
       
  3321 	                      ResObj_Convert, &myPicture,
       
  3322 	                      PyMac_GetRect, &dstRect))
       
  3323 		return NULL;
       
  3324 	DrawPicture(myPicture,
       
  3325 	            &dstRect);
       
  3326 	Py_INCREF(Py_None);
       
  3327 	_res = Py_None;
       
  3328 	return _res;
       
  3329 }
       
  3330 
       
  3331 static PyObject *Qd_KillPicture(PyObject *_self, PyObject *_args)
       
  3332 {
       
  3333 	PyObject *_res = NULL;
       
  3334 	PicHandle myPicture;
       
  3335 #ifndef KillPicture
       
  3336 	PyMac_PRECHECK(KillPicture);
       
  3337 #endif
       
  3338 	if (!PyArg_ParseTuple(_args, "O&",
       
  3339 	                      ResObj_Convert, &myPicture))
       
  3340 		return NULL;
       
  3341 	KillPicture(myPicture);
       
  3342 	Py_INCREF(Py_None);
       
  3343 	_res = Py_None;
       
  3344 	return _res;
       
  3345 }
       
  3346 
       
  3347 static PyObject *Qd_OpenPoly(PyObject *_self, PyObject *_args)
       
  3348 {
       
  3349 	PyObject *_res = NULL;
       
  3350 	PolyHandle _rv;
       
  3351 #ifndef OpenPoly
       
  3352 	PyMac_PRECHECK(OpenPoly);
       
  3353 #endif
       
  3354 	if (!PyArg_ParseTuple(_args, ""))
       
  3355 		return NULL;
       
  3356 	_rv = OpenPoly();
       
  3357 	_res = Py_BuildValue("O&",
       
  3358 	                     ResObj_New, _rv);
       
  3359 	return _res;
       
  3360 }
       
  3361 
       
  3362 static PyObject *Qd_ClosePoly(PyObject *_self, PyObject *_args)
       
  3363 {
       
  3364 	PyObject *_res = NULL;
       
  3365 #ifndef ClosePoly
       
  3366 	PyMac_PRECHECK(ClosePoly);
       
  3367 #endif
       
  3368 	if (!PyArg_ParseTuple(_args, ""))
       
  3369 		return NULL;
       
  3370 	ClosePoly();
       
  3371 	Py_INCREF(Py_None);
       
  3372 	_res = Py_None;
       
  3373 	return _res;
       
  3374 }
       
  3375 
       
  3376 static PyObject *Qd_KillPoly(PyObject *_self, PyObject *_args)
       
  3377 {
       
  3378 	PyObject *_res = NULL;
       
  3379 	PolyHandle poly;
       
  3380 #ifndef KillPoly
       
  3381 	PyMac_PRECHECK(KillPoly);
       
  3382 #endif
       
  3383 	if (!PyArg_ParseTuple(_args, "O&",
       
  3384 	                      ResObj_Convert, &poly))
       
  3385 		return NULL;
       
  3386 	KillPoly(poly);
       
  3387 	Py_INCREF(Py_None);
       
  3388 	_res = Py_None;
       
  3389 	return _res;
       
  3390 }
       
  3391 
       
  3392 static PyObject *Qd_OffsetPoly(PyObject *_self, PyObject *_args)
       
  3393 {
       
  3394 	PyObject *_res = NULL;
       
  3395 	PolyHandle poly;
       
  3396 	short dh;
       
  3397 	short dv;
       
  3398 #ifndef OffsetPoly
       
  3399 	PyMac_PRECHECK(OffsetPoly);
       
  3400 #endif
       
  3401 	if (!PyArg_ParseTuple(_args, "O&hh",
       
  3402 	                      ResObj_Convert, &poly,
       
  3403 	                      &dh,
       
  3404 	                      &dv))
       
  3405 		return NULL;
       
  3406 	OffsetPoly(poly,
       
  3407 	           dh,
       
  3408 	           dv);
       
  3409 	Py_INCREF(Py_None);
       
  3410 	_res = Py_None;
       
  3411 	return _res;
       
  3412 }
       
  3413 
       
  3414 static PyObject *Qd_FramePoly(PyObject *_self, PyObject *_args)
       
  3415 {
       
  3416 	PyObject *_res = NULL;
       
  3417 	PolyHandle poly;
       
  3418 #ifndef FramePoly
       
  3419 	PyMac_PRECHECK(FramePoly);
       
  3420 #endif
       
  3421 	if (!PyArg_ParseTuple(_args, "O&",
       
  3422 	                      ResObj_Convert, &poly))
       
  3423 		return NULL;
       
  3424 	FramePoly(poly);
       
  3425 	Py_INCREF(Py_None);
       
  3426 	_res = Py_None;
       
  3427 	return _res;
       
  3428 }
       
  3429 
       
  3430 static PyObject *Qd_PaintPoly(PyObject *_self, PyObject *_args)
       
  3431 {
       
  3432 	PyObject *_res = NULL;
       
  3433 	PolyHandle poly;
       
  3434 #ifndef PaintPoly
       
  3435 	PyMac_PRECHECK(PaintPoly);
       
  3436 #endif
       
  3437 	if (!PyArg_ParseTuple(_args, "O&",
       
  3438 	                      ResObj_Convert, &poly))
       
  3439 		return NULL;
       
  3440 	PaintPoly(poly);
       
  3441 	Py_INCREF(Py_None);
       
  3442 	_res = Py_None;
       
  3443 	return _res;
       
  3444 }
       
  3445 
       
  3446 static PyObject *Qd_ErasePoly(PyObject *_self, PyObject *_args)
       
  3447 {
       
  3448 	PyObject *_res = NULL;
       
  3449 	PolyHandle poly;
       
  3450 #ifndef ErasePoly
       
  3451 	PyMac_PRECHECK(ErasePoly);
       
  3452 #endif
       
  3453 	if (!PyArg_ParseTuple(_args, "O&",
       
  3454 	                      ResObj_Convert, &poly))
       
  3455 		return NULL;
       
  3456 	ErasePoly(poly);
       
  3457 	Py_INCREF(Py_None);
       
  3458 	_res = Py_None;
       
  3459 	return _res;
       
  3460 }
       
  3461 
       
  3462 static PyObject *Qd_InvertPoly(PyObject *_self, PyObject *_args)
       
  3463 {
       
  3464 	PyObject *_res = NULL;
       
  3465 	PolyHandle poly;
       
  3466 #ifndef InvertPoly
       
  3467 	PyMac_PRECHECK(InvertPoly);
       
  3468 #endif
       
  3469 	if (!PyArg_ParseTuple(_args, "O&",
       
  3470 	                      ResObj_Convert, &poly))
       
  3471 		return NULL;
       
  3472 	InvertPoly(poly);
       
  3473 	Py_INCREF(Py_None);
       
  3474 	_res = Py_None;
       
  3475 	return _res;
       
  3476 }
       
  3477 
       
  3478 static PyObject *Qd_FillPoly(PyObject *_self, PyObject *_args)
       
  3479 {
       
  3480 	PyObject *_res = NULL;
       
  3481 	PolyHandle poly;
       
  3482 	Pattern *pat__in__;
       
  3483 	int pat__in_len__;
       
  3484 #ifndef FillPoly
       
  3485 	PyMac_PRECHECK(FillPoly);
       
  3486 #endif
       
  3487 	if (!PyArg_ParseTuple(_args, "O&s#",
       
  3488 	                      ResObj_Convert, &poly,
       
  3489 	                      (char **)&pat__in__, &pat__in_len__))
       
  3490 		return NULL;
       
  3491 	if (pat__in_len__ != sizeof(Pattern))
       
  3492 	{
       
  3493 		PyErr_SetString(PyExc_TypeError, "buffer length should be sizeof(Pattern)");
       
  3494 		goto pat__error__;
       
  3495 	}
       
  3496 	FillPoly(poly,
       
  3497 	         pat__in__);
       
  3498 	Py_INCREF(Py_None);
       
  3499 	_res = Py_None;
       
  3500  pat__error__: ;
       
  3501 	return _res;
       
  3502 }
       
  3503 
       
  3504 static PyObject *Qd_SetPt(PyObject *_self, PyObject *_args)
       
  3505 {
       
  3506 	PyObject *_res = NULL;
       
  3507 	Point pt;
       
  3508 	short h;
       
  3509 	short v;
       
  3510 #ifndef SetPt
       
  3511 	PyMac_PRECHECK(SetPt);
       
  3512 #endif
       
  3513 	if (!PyArg_ParseTuple(_args, "hh",
       
  3514 	                      &h,
       
  3515 	                      &v))
       
  3516 		return NULL;
       
  3517 	SetPt(&pt,
       
  3518 	      h,
       
  3519 	      v);
       
  3520 	_res = Py_BuildValue("O&",
       
  3521 	                     PyMac_BuildPoint, pt);
       
  3522 	return _res;
       
  3523 }
       
  3524 
       
  3525 static PyObject *Qd_LocalToGlobal(PyObject *_self, PyObject *_args)
       
  3526 {
       
  3527 	PyObject *_res = NULL;
       
  3528 	Point pt;
       
  3529 #ifndef LocalToGlobal
       
  3530 	PyMac_PRECHECK(LocalToGlobal);
       
  3531 #endif
       
  3532 	if (!PyArg_ParseTuple(_args, "O&",
       
  3533 	                      PyMac_GetPoint, &pt))
       
  3534 		return NULL;
       
  3535 	LocalToGlobal(&pt);
       
  3536 	_res = Py_BuildValue("O&",
       
  3537 	                     PyMac_BuildPoint, pt);
       
  3538 	return _res;
       
  3539 }
       
  3540 
       
  3541 static PyObject *Qd_GlobalToLocal(PyObject *_self, PyObject *_args)
       
  3542 {
       
  3543 	PyObject *_res = NULL;
       
  3544 	Point pt;
       
  3545 #ifndef GlobalToLocal
       
  3546 	PyMac_PRECHECK(GlobalToLocal);
       
  3547 #endif
       
  3548 	if (!PyArg_ParseTuple(_args, "O&",
       
  3549 	                      PyMac_GetPoint, &pt))
       
  3550 		return NULL;
       
  3551 	GlobalToLocal(&pt);
       
  3552 	_res = Py_BuildValue("O&",
       
  3553 	                     PyMac_BuildPoint, pt);
       
  3554 	return _res;
       
  3555 }
       
  3556 
       
  3557 static PyObject *Qd_Random(PyObject *_self, PyObject *_args)
       
  3558 {
       
  3559 	PyObject *_res = NULL;
       
  3560 	short _rv;
       
  3561 #ifndef Random
       
  3562 	PyMac_PRECHECK(Random);
       
  3563 #endif
       
  3564 	if (!PyArg_ParseTuple(_args, ""))
       
  3565 		return NULL;
       
  3566 	_rv = Random();
       
  3567 	_res = Py_BuildValue("h",
       
  3568 	                     _rv);
       
  3569 	return _res;
       
  3570 }
       
  3571 
       
  3572 static PyObject *Qd_MacGetPixel(PyObject *_self, PyObject *_args)
       
  3573 {
       
  3574 	PyObject *_res = NULL;
       
  3575 	Boolean _rv;
       
  3576 	short h;
       
  3577 	short v;
       
  3578 #ifndef MacGetPixel
       
  3579 	PyMac_PRECHECK(MacGetPixel);
       
  3580 #endif
       
  3581 	if (!PyArg_ParseTuple(_args, "hh",
       
  3582 	                      &h,
       
  3583 	                      &v))
       
  3584 		return NULL;
       
  3585 	_rv = MacGetPixel(h,
       
  3586 	                  v);
       
  3587 	_res = Py_BuildValue("b",
       
  3588 	                     _rv);
       
  3589 	return _res;
       
  3590 }
       
  3591 
       
  3592 static PyObject *Qd_ScalePt(PyObject *_self, PyObject *_args)
       
  3593 {
       
  3594 	PyObject *_res = NULL;
       
  3595 	Point pt;
       
  3596 	Rect srcRect;
       
  3597 	Rect dstRect;
       
  3598 #ifndef ScalePt
       
  3599 	PyMac_PRECHECK(ScalePt);
       
  3600 #endif
       
  3601 	if (!PyArg_ParseTuple(_args, "O&O&O&",
       
  3602 	                      PyMac_GetPoint, &pt,
       
  3603 	                      PyMac_GetRect, &srcRect,
       
  3604 	                      PyMac_GetRect, &dstRect))
       
  3605 		return NULL;
       
  3606 	ScalePt(&pt,
       
  3607 	        &srcRect,
       
  3608 	        &dstRect);
       
  3609 	_res = Py_BuildValue("O&",
       
  3610 	                     PyMac_BuildPoint, pt);
       
  3611 	return _res;
       
  3612 }
       
  3613 
       
  3614 static PyObject *Qd_MapPt(PyObject *_self, PyObject *_args)
       
  3615 {
       
  3616 	PyObject *_res = NULL;
       
  3617 	Point pt;
       
  3618 	Rect srcRect;
       
  3619 	Rect dstRect;
       
  3620 #ifndef MapPt
       
  3621 	PyMac_PRECHECK(MapPt);
       
  3622 #endif
       
  3623 	if (!PyArg_ParseTuple(_args, "O&O&O&",
       
  3624 	                      PyMac_GetPoint, &pt,
       
  3625 	                      PyMac_GetRect, &srcRect,
       
  3626 	                      PyMac_GetRect, &dstRect))
       
  3627 		return NULL;
       
  3628 	MapPt(&pt,
       
  3629 	      &srcRect,
       
  3630 	      &dstRect);
       
  3631 	_res = Py_BuildValue("O&",
       
  3632 	                     PyMac_BuildPoint, pt);
       
  3633 	return _res;
       
  3634 }
       
  3635 
       
  3636 static PyObject *Qd_MapRect(PyObject *_self, PyObject *_args)
       
  3637 {
       
  3638 	PyObject *_res = NULL;
       
  3639 	Rect r;
       
  3640 	Rect srcRect;
       
  3641 	Rect dstRect;
       
  3642 #ifndef MapRect
       
  3643 	PyMac_PRECHECK(MapRect);
       
  3644 #endif
       
  3645 	if (!PyArg_ParseTuple(_args, "O&O&O&",
       
  3646 	                      PyMac_GetRect, &r,
       
  3647 	                      PyMac_GetRect, &srcRect,
       
  3648 	                      PyMac_GetRect, &dstRect))
       
  3649 		return NULL;
       
  3650 	MapRect(&r,
       
  3651 	        &srcRect,
       
  3652 	        &dstRect);
       
  3653 	_res = Py_BuildValue("O&",
       
  3654 	                     PyMac_BuildRect, &r);
       
  3655 	return _res;
       
  3656 }
       
  3657 
       
  3658 static PyObject *Qd_MapRgn(PyObject *_self, PyObject *_args)
       
  3659 {
       
  3660 	PyObject *_res = NULL;
       
  3661 	RgnHandle rgn;
       
  3662 	Rect srcRect;
       
  3663 	Rect dstRect;
       
  3664 #ifndef MapRgn
       
  3665 	PyMac_PRECHECK(MapRgn);
       
  3666 #endif
       
  3667 	if (!PyArg_ParseTuple(_args, "O&O&O&",
       
  3668 	                      ResObj_Convert, &rgn,
       
  3669 	                      PyMac_GetRect, &srcRect,
       
  3670 	                      PyMac_GetRect, &dstRect))
       
  3671 		return NULL;
       
  3672 	MapRgn(rgn,
       
  3673 	       &srcRect,
       
  3674 	       &dstRect);
       
  3675 	Py_INCREF(Py_None);
       
  3676 	_res = Py_None;
       
  3677 	return _res;
       
  3678 }
       
  3679 
       
  3680 static PyObject *Qd_MapPoly(PyObject *_self, PyObject *_args)
       
  3681 {
       
  3682 	PyObject *_res = NULL;
       
  3683 	PolyHandle poly;
       
  3684 	Rect srcRect;
       
  3685 	Rect dstRect;
       
  3686 #ifndef MapPoly
       
  3687 	PyMac_PRECHECK(MapPoly);
       
  3688 #endif
       
  3689 	if (!PyArg_ParseTuple(_args, "O&O&O&",
       
  3690 	                      ResObj_Convert, &poly,
       
  3691 	                      PyMac_GetRect, &srcRect,
       
  3692 	                      PyMac_GetRect, &dstRect))
       
  3693 		return NULL;
       
  3694 	MapPoly(poly,
       
  3695 	        &srcRect,
       
  3696 	        &dstRect);
       
  3697 	Py_INCREF(Py_None);
       
  3698 	_res = Py_None;
       
  3699 	return _res;
       
  3700 }
       
  3701 
       
  3702 static PyObject *Qd_StdBits(PyObject *_self, PyObject *_args)
       
  3703 {
       
  3704 	PyObject *_res = NULL;
       
  3705 	BitMapPtr srcBits;
       
  3706 	Rect srcRect;
       
  3707 	Rect dstRect;
       
  3708 	short mode;
       
  3709 	RgnHandle maskRgn;
       
  3710 #ifndef StdBits
       
  3711 	PyMac_PRECHECK(StdBits);
       
  3712 #endif
       
  3713 	if (!PyArg_ParseTuple(_args, "O&O&O&hO&",
       
  3714 	                      BMObj_Convert, &srcBits,
       
  3715 	                      PyMac_GetRect, &srcRect,
       
  3716 	                      PyMac_GetRect, &dstRect,
       
  3717 	                      &mode,
       
  3718 	                      OptResObj_Convert, &maskRgn))
       
  3719 		return NULL;
       
  3720 	StdBits(srcBits,
       
  3721 	        &srcRect,
       
  3722 	        &dstRect,
       
  3723 	        mode,
       
  3724 	        maskRgn);
       
  3725 	Py_INCREF(Py_None);
       
  3726 	_res = Py_None;
       
  3727 	return _res;
       
  3728 }
       
  3729 
       
  3730 static PyObject *Qd_AddPt(PyObject *_self, PyObject *_args)
       
  3731 {
       
  3732 	PyObject *_res = NULL;
       
  3733 	Point src;
       
  3734 	Point dst;
       
  3735 #ifndef AddPt
       
  3736 	PyMac_PRECHECK(AddPt);
       
  3737 #endif
       
  3738 	if (!PyArg_ParseTuple(_args, "O&O&",
       
  3739 	                      PyMac_GetPoint, &src,
       
  3740 	                      PyMac_GetPoint, &dst))
       
  3741 		return NULL;
       
  3742 	AddPt(src,
       
  3743 	      &dst);
       
  3744 	_res = Py_BuildValue("O&",
       
  3745 	                     PyMac_BuildPoint, dst);
       
  3746 	return _res;
       
  3747 }
       
  3748 
       
  3749 static PyObject *Qd_EqualPt(PyObject *_self, PyObject *_args)
       
  3750 {
       
  3751 	PyObject *_res = NULL;
       
  3752 	Boolean _rv;
       
  3753 	Point pt1;
       
  3754 	Point pt2;
       
  3755 #ifndef EqualPt
       
  3756 	PyMac_PRECHECK(EqualPt);
       
  3757 #endif
       
  3758 	if (!PyArg_ParseTuple(_args, "O&O&",
       
  3759 	                      PyMac_GetPoint, &pt1,
       
  3760 	                      PyMac_GetPoint, &pt2))
       
  3761 		return NULL;
       
  3762 	_rv = EqualPt(pt1,
       
  3763 	              pt2);
       
  3764 	_res = Py_BuildValue("b",
       
  3765 	                     _rv);
       
  3766 	return _res;
       
  3767 }
       
  3768 
       
  3769 static PyObject *Qd_MacPtInRect(PyObject *_self, PyObject *_args)
       
  3770 {
       
  3771 	PyObject *_res = NULL;
       
  3772 	Boolean _rv;
       
  3773 	Point pt;
       
  3774 	Rect r;
       
  3775 #ifndef MacPtInRect
       
  3776 	PyMac_PRECHECK(MacPtInRect);
       
  3777 #endif
       
  3778 	if (!PyArg_ParseTuple(_args, "O&O&",
       
  3779 	                      PyMac_GetPoint, &pt,
       
  3780 	                      PyMac_GetRect, &r))
       
  3781 		return NULL;
       
  3782 	_rv = MacPtInRect(pt,
       
  3783 	                  &r);
       
  3784 	_res = Py_BuildValue("b",
       
  3785 	                     _rv);
       
  3786 	return _res;
       
  3787 }
       
  3788 
       
  3789 static PyObject *Qd_Pt2Rect(PyObject *_self, PyObject *_args)
       
  3790 {
       
  3791 	PyObject *_res = NULL;
       
  3792 	Point pt1;
       
  3793 	Point pt2;
       
  3794 	Rect dstRect;
       
  3795 #ifndef Pt2Rect
       
  3796 	PyMac_PRECHECK(Pt2Rect);
       
  3797 #endif
       
  3798 	if (!PyArg_ParseTuple(_args, "O&O&",
       
  3799 	                      PyMac_GetPoint, &pt1,
       
  3800 	                      PyMac_GetPoint, &pt2))
       
  3801 		return NULL;
       
  3802 	Pt2Rect(pt1,
       
  3803 	        pt2,
       
  3804 	        &dstRect);
       
  3805 	_res = Py_BuildValue("O&",
       
  3806 	                     PyMac_BuildRect, &dstRect);
       
  3807 	return _res;
       
  3808 }
       
  3809 
       
  3810 static PyObject *Qd_PtToAngle(PyObject *_self, PyObject *_args)
       
  3811 {
       
  3812 	PyObject *_res = NULL;
       
  3813 	Rect r;
       
  3814 	Point pt;
       
  3815 	short angle;
       
  3816 #ifndef PtToAngle
       
  3817 	PyMac_PRECHECK(PtToAngle);
       
  3818 #endif
       
  3819 	if (!PyArg_ParseTuple(_args, "O&O&",
       
  3820 	                      PyMac_GetRect, &r,
       
  3821 	                      PyMac_GetPoint, &pt))
       
  3822 		return NULL;
       
  3823 	PtToAngle(&r,
       
  3824 	          pt,
       
  3825 	          &angle);
       
  3826 	_res = Py_BuildValue("h",
       
  3827 	                     angle);
       
  3828 	return _res;
       
  3829 }
       
  3830 
       
  3831 static PyObject *Qd_SubPt(PyObject *_self, PyObject *_args)
       
  3832 {
       
  3833 	PyObject *_res = NULL;
       
  3834 	Point src;
       
  3835 	Point dst;
       
  3836 #ifndef SubPt
       
  3837 	PyMac_PRECHECK(SubPt);
       
  3838 #endif
       
  3839 	if (!PyArg_ParseTuple(_args, "O&O&",
       
  3840 	                      PyMac_GetPoint, &src,
       
  3841 	                      PyMac_GetPoint, &dst))
       
  3842 		return NULL;
       
  3843 	SubPt(src,
       
  3844 	      &dst);
       
  3845 	_res = Py_BuildValue("O&",
       
  3846 	                     PyMac_BuildPoint, dst);
       
  3847 	return _res;
       
  3848 }
       
  3849 
       
  3850 static PyObject *Qd_PtInRgn(PyObject *_self, PyObject *_args)
       
  3851 {
       
  3852 	PyObject *_res = NULL;
       
  3853 	Boolean _rv;
       
  3854 	Point pt;
       
  3855 	RgnHandle rgn;
       
  3856 #ifndef PtInRgn
       
  3857 	PyMac_PRECHECK(PtInRgn);
       
  3858 #endif
       
  3859 	if (!PyArg_ParseTuple(_args, "O&O&",
       
  3860 	                      PyMac_GetPoint, &pt,
       
  3861 	                      ResObj_Convert, &rgn))
       
  3862 		return NULL;
       
  3863 	_rv = PtInRgn(pt,
       
  3864 	              rgn);
       
  3865 	_res = Py_BuildValue("b",
       
  3866 	                     _rv);
       
  3867 	return _res;
       
  3868 }
       
  3869 
       
  3870 static PyObject *Qd_NewPixMap(PyObject *_self, PyObject *_args)
       
  3871 {
       
  3872 	PyObject *_res = NULL;
       
  3873 	PixMapHandle _rv;
       
  3874 #ifndef NewPixMap
       
  3875 	PyMac_PRECHECK(NewPixMap);
       
  3876 #endif
       
  3877 	if (!PyArg_ParseTuple(_args, ""))
       
  3878 		return NULL;
       
  3879 	_rv = NewPixMap();
       
  3880 	_res = Py_BuildValue("O&",
       
  3881 	                     ResObj_New, _rv);
       
  3882 	return _res;
       
  3883 }
       
  3884 
       
  3885 static PyObject *Qd_DisposePixMap(PyObject *_self, PyObject *_args)
       
  3886 {
       
  3887 	PyObject *_res = NULL;
       
  3888 	PixMapHandle pm;
       
  3889 #ifndef DisposePixMap
       
  3890 	PyMac_PRECHECK(DisposePixMap);
       
  3891 #endif
       
  3892 	if (!PyArg_ParseTuple(_args, "O&",
       
  3893 	                      ResObj_Convert, &pm))
       
  3894 		return NULL;
       
  3895 	DisposePixMap(pm);
       
  3896 	Py_INCREF(Py_None);
       
  3897 	_res = Py_None;
       
  3898 	return _res;
       
  3899 }
       
  3900 
       
  3901 static PyObject *Qd_CopyPixMap(PyObject *_self, PyObject *_args)
       
  3902 {
       
  3903 	PyObject *_res = NULL;
       
  3904 	PixMapHandle srcPM;
       
  3905 	PixMapHandle dstPM;
       
  3906 #ifndef CopyPixMap
       
  3907 	PyMac_PRECHECK(CopyPixMap);
       
  3908 #endif
       
  3909 	if (!PyArg_ParseTuple(_args, "O&O&",
       
  3910 	                      ResObj_Convert, &srcPM,
       
  3911 	                      ResObj_Convert, &dstPM))
       
  3912 		return NULL;
       
  3913 	CopyPixMap(srcPM,
       
  3914 	           dstPM);
       
  3915 	Py_INCREF(Py_None);
       
  3916 	_res = Py_None;
       
  3917 	return _res;
       
  3918 }
       
  3919 
       
  3920 static PyObject *Qd_NewPixPat(PyObject *_self, PyObject *_args)
       
  3921 {
       
  3922 	PyObject *_res = NULL;
       
  3923 	PixPatHandle _rv;
       
  3924 #ifndef NewPixPat
       
  3925 	PyMac_PRECHECK(NewPixPat);
       
  3926 #endif
       
  3927 	if (!PyArg_ParseTuple(_args, ""))
       
  3928 		return NULL;
       
  3929 	_rv = NewPixPat();
       
  3930 	_res = Py_BuildValue("O&",
       
  3931 	                     ResObj_New, _rv);
       
  3932 	return _res;
       
  3933 }
       
  3934 
       
  3935 static PyObject *Qd_DisposePixPat(PyObject *_self, PyObject *_args)
       
  3936 {
       
  3937 	PyObject *_res = NULL;
       
  3938 	PixPatHandle pp;
       
  3939 #ifndef DisposePixPat
       
  3940 	PyMac_PRECHECK(DisposePixPat);
       
  3941 #endif
       
  3942 	if (!PyArg_ParseTuple(_args, "O&",
       
  3943 	                      ResObj_Convert, &pp))
       
  3944 		return NULL;
       
  3945 	DisposePixPat(pp);
       
  3946 	Py_INCREF(Py_None);
       
  3947 	_res = Py_None;
       
  3948 	return _res;
       
  3949 }
       
  3950 
       
  3951 static PyObject *Qd_CopyPixPat(PyObject *_self, PyObject *_args)
       
  3952 {
       
  3953 	PyObject *_res = NULL;
       
  3954 	PixPatHandle srcPP;
       
  3955 	PixPatHandle dstPP;
       
  3956 #ifndef CopyPixPat
       
  3957 	PyMac_PRECHECK(CopyPixPat);
       
  3958 #endif
       
  3959 	if (!PyArg_ParseTuple(_args, "O&O&",
       
  3960 	                      ResObj_Convert, &srcPP,
       
  3961 	                      ResObj_Convert, &dstPP))
       
  3962 		return NULL;
       
  3963 	CopyPixPat(srcPP,
       
  3964 	           dstPP);
       
  3965 	Py_INCREF(Py_None);
       
  3966 	_res = Py_None;
       
  3967 	return _res;
       
  3968 }
       
  3969 
       
  3970 static PyObject *Qd_PenPixPat(PyObject *_self, PyObject *_args)
       
  3971 {
       
  3972 	PyObject *_res = NULL;
       
  3973 	PixPatHandle pp;
       
  3974 #ifndef PenPixPat
       
  3975 	PyMac_PRECHECK(PenPixPat);
       
  3976 #endif
       
  3977 	if (!PyArg_ParseTuple(_args, "O&",
       
  3978 	                      ResObj_Convert, &pp))
       
  3979 		return NULL;
       
  3980 	PenPixPat(pp);
       
  3981 	Py_INCREF(Py_None);
       
  3982 	_res = Py_None;
       
  3983 	return _res;
       
  3984 }
       
  3985 
       
  3986 static PyObject *Qd_BackPixPat(PyObject *_self, PyObject *_args)
       
  3987 {
       
  3988 	PyObject *_res = NULL;
       
  3989 	PixPatHandle pp;
       
  3990 #ifndef BackPixPat
       
  3991 	PyMac_PRECHECK(BackPixPat);
       
  3992 #endif
       
  3993 	if (!PyArg_ParseTuple(_args, "O&",
       
  3994 	                      ResObj_Convert, &pp))
       
  3995 		return NULL;
       
  3996 	BackPixPat(pp);
       
  3997 	Py_INCREF(Py_None);
       
  3998 	_res = Py_None;
       
  3999 	return _res;
       
  4000 }
       
  4001 
       
  4002 static PyObject *Qd_GetPixPat(PyObject *_self, PyObject *_args)
       
  4003 {
       
  4004 	PyObject *_res = NULL;
       
  4005 	PixPatHandle _rv;
       
  4006 	short patID;
       
  4007 #ifndef GetPixPat
       
  4008 	PyMac_PRECHECK(GetPixPat);
       
  4009 #endif
       
  4010 	if (!PyArg_ParseTuple(_args, "h",
       
  4011 	                      &patID))
       
  4012 		return NULL;
       
  4013 	_rv = GetPixPat(patID);
       
  4014 	_res = Py_BuildValue("O&",
       
  4015 	                     ResObj_New, _rv);
       
  4016 	return _res;
       
  4017 }
       
  4018 
       
  4019 static PyObject *Qd_MakeRGBPat(PyObject *_self, PyObject *_args)
       
  4020 {
       
  4021 	PyObject *_res = NULL;
       
  4022 	PixPatHandle pp;
       
  4023 	RGBColor myColor;
       
  4024 #ifndef MakeRGBPat
       
  4025 	PyMac_PRECHECK(MakeRGBPat);
       
  4026 #endif
       
  4027 	if (!PyArg_ParseTuple(_args, "O&O&",
       
  4028 	                      ResObj_Convert, &pp,
       
  4029 	                      QdRGB_Convert, &myColor))
       
  4030 		return NULL;
       
  4031 	MakeRGBPat(pp,
       
  4032 	           &myColor);
       
  4033 	Py_INCREF(Py_None);
       
  4034 	_res = Py_None;
       
  4035 	return _res;
       
  4036 }
       
  4037 
       
  4038 static PyObject *Qd_FillCRect(PyObject *_self, PyObject *_args)
       
  4039 {
       
  4040 	PyObject *_res = NULL;
       
  4041 	Rect r;
       
  4042 	PixPatHandle pp;
       
  4043 #ifndef FillCRect
       
  4044 	PyMac_PRECHECK(FillCRect);
       
  4045 #endif
       
  4046 	if (!PyArg_ParseTuple(_args, "O&O&",
       
  4047 	                      PyMac_GetRect, &r,
       
  4048 	                      ResObj_Convert, &pp))
       
  4049 		return NULL;
       
  4050 	FillCRect(&r,
       
  4051 	          pp);
       
  4052 	Py_INCREF(Py_None);
       
  4053 	_res = Py_None;
       
  4054 	return _res;
       
  4055 }
       
  4056 
       
  4057 static PyObject *Qd_FillCOval(PyObject *_self, PyObject *_args)
       
  4058 {
       
  4059 	PyObject *_res = NULL;
       
  4060 	Rect r;
       
  4061 	PixPatHandle pp;
       
  4062 #ifndef FillCOval
       
  4063 	PyMac_PRECHECK(FillCOval);
       
  4064 #endif
       
  4065 	if (!PyArg_ParseTuple(_args, "O&O&",
       
  4066 	                      PyMac_GetRect, &r,
       
  4067 	                      ResObj_Convert, &pp))
       
  4068 		return NULL;
       
  4069 	FillCOval(&r,
       
  4070 	          pp);
       
  4071 	Py_INCREF(Py_None);
       
  4072 	_res = Py_None;
       
  4073 	return _res;
       
  4074 }
       
  4075 
       
  4076 static PyObject *Qd_FillCRoundRect(PyObject *_self, PyObject *_args)
       
  4077 {
       
  4078 	PyObject *_res = NULL;
       
  4079 	Rect r;
       
  4080 	short ovalWidth;
       
  4081 	short ovalHeight;
       
  4082 	PixPatHandle pp;
       
  4083 #ifndef FillCRoundRect
       
  4084 	PyMac_PRECHECK(FillCRoundRect);
       
  4085 #endif
       
  4086 	if (!PyArg_ParseTuple(_args, "O&hhO&",
       
  4087 	                      PyMac_GetRect, &r,
       
  4088 	                      &ovalWidth,
       
  4089 	                      &ovalHeight,
       
  4090 	                      ResObj_Convert, &pp))
       
  4091 		return NULL;
       
  4092 	FillCRoundRect(&r,
       
  4093 	               ovalWidth,
       
  4094 	               ovalHeight,
       
  4095 	               pp);
       
  4096 	Py_INCREF(Py_None);
       
  4097 	_res = Py_None;
       
  4098 	return _res;
       
  4099 }
       
  4100 
       
  4101 static PyObject *Qd_FillCArc(PyObject *_self, PyObject *_args)
       
  4102 {
       
  4103 	PyObject *_res = NULL;
       
  4104 	Rect r;
       
  4105 	short startAngle;
       
  4106 	short arcAngle;
       
  4107 	PixPatHandle pp;
       
  4108 #ifndef FillCArc
       
  4109 	PyMac_PRECHECK(FillCArc);
       
  4110 #endif
       
  4111 	if (!PyArg_ParseTuple(_args, "O&hhO&",
       
  4112 	                      PyMac_GetRect, &r,
       
  4113 	                      &startAngle,
       
  4114 	                      &arcAngle,
       
  4115 	                      ResObj_Convert, &pp))
       
  4116 		return NULL;
       
  4117 	FillCArc(&r,
       
  4118 	         startAngle,
       
  4119 	         arcAngle,
       
  4120 	         pp);
       
  4121 	Py_INCREF(Py_None);
       
  4122 	_res = Py_None;
       
  4123 	return _res;
       
  4124 }
       
  4125 
       
  4126 static PyObject *Qd_FillCRgn(PyObject *_self, PyObject *_args)
       
  4127 {
       
  4128 	PyObject *_res = NULL;
       
  4129 	RgnHandle rgn;
       
  4130 	PixPatHandle pp;
       
  4131 #ifndef FillCRgn
       
  4132 	PyMac_PRECHECK(FillCRgn);
       
  4133 #endif
       
  4134 	if (!PyArg_ParseTuple(_args, "O&O&",
       
  4135 	                      ResObj_Convert, &rgn,
       
  4136 	                      ResObj_Convert, &pp))
       
  4137 		return NULL;
       
  4138 	FillCRgn(rgn,
       
  4139 	         pp);
       
  4140 	Py_INCREF(Py_None);
       
  4141 	_res = Py_None;
       
  4142 	return _res;
       
  4143 }
       
  4144 
       
  4145 static PyObject *Qd_FillCPoly(PyObject *_self, PyObject *_args)
       
  4146 {
       
  4147 	PyObject *_res = NULL;
       
  4148 	PolyHandle poly;
       
  4149 	PixPatHandle pp;
       
  4150 #ifndef FillCPoly
       
  4151 	PyMac_PRECHECK(FillCPoly);
       
  4152 #endif
       
  4153 	if (!PyArg_ParseTuple(_args, "O&O&",
       
  4154 	                      ResObj_Convert, &poly,
       
  4155 	                      ResObj_Convert, &pp))
       
  4156 		return NULL;
       
  4157 	FillCPoly(poly,
       
  4158 	          pp);
       
  4159 	Py_INCREF(Py_None);
       
  4160 	_res = Py_None;
       
  4161 	return _res;
       
  4162 }
       
  4163 
       
  4164 static PyObject *Qd_RGBForeColor(PyObject *_self, PyObject *_args)
       
  4165 {
       
  4166 	PyObject *_res = NULL;
       
  4167 	RGBColor color;
       
  4168 #ifndef RGBForeColor
       
  4169 	PyMac_PRECHECK(RGBForeColor);
       
  4170 #endif
       
  4171 	if (!PyArg_ParseTuple(_args, "O&",
       
  4172 	                      QdRGB_Convert, &color))
       
  4173 		return NULL;
       
  4174 	RGBForeColor(&color);
       
  4175 	Py_INCREF(Py_None);
       
  4176 	_res = Py_None;
       
  4177 	return _res;
       
  4178 }
       
  4179 
       
  4180 static PyObject *Qd_RGBBackColor(PyObject *_self, PyObject *_args)
       
  4181 {
       
  4182 	PyObject *_res = NULL;
       
  4183 	RGBColor color;
       
  4184 #ifndef RGBBackColor
       
  4185 	PyMac_PRECHECK(RGBBackColor);
       
  4186 #endif
       
  4187 	if (!PyArg_ParseTuple(_args, "O&",
       
  4188 	                      QdRGB_Convert, &color))
       
  4189 		return NULL;
       
  4190 	RGBBackColor(&color);
       
  4191 	Py_INCREF(Py_None);
       
  4192 	_res = Py_None;
       
  4193 	return _res;
       
  4194 }
       
  4195 
       
  4196 static PyObject *Qd_SetCPixel(PyObject *_self, PyObject *_args)
       
  4197 {
       
  4198 	PyObject *_res = NULL;
       
  4199 	short h;
       
  4200 	short v;
       
  4201 	RGBColor cPix;
       
  4202 #ifndef SetCPixel
       
  4203 	PyMac_PRECHECK(SetCPixel);
       
  4204 #endif
       
  4205 	if (!PyArg_ParseTuple(_args, "hhO&",
       
  4206 	                      &h,
       
  4207 	                      &v,
       
  4208 	                      QdRGB_Convert, &cPix))
       
  4209 		return NULL;
       
  4210 	SetCPixel(h,
       
  4211 	          v,
       
  4212 	          &cPix);
       
  4213 	Py_INCREF(Py_None);
       
  4214 	_res = Py_None;
       
  4215 	return _res;
       
  4216 }
       
  4217 
       
  4218 static PyObject *Qd_SetPortPix(PyObject *_self, PyObject *_args)
       
  4219 {
       
  4220 	PyObject *_res = NULL;
       
  4221 	PixMapHandle pm;
       
  4222 #ifndef SetPortPix
       
  4223 	PyMac_PRECHECK(SetPortPix);
       
  4224 #endif
       
  4225 	if (!PyArg_ParseTuple(_args, "O&",
       
  4226 	                      ResObj_Convert, &pm))
       
  4227 		return NULL;
       
  4228 	SetPortPix(pm);
       
  4229 	Py_INCREF(Py_None);
       
  4230 	_res = Py_None;
       
  4231 	return _res;
       
  4232 }
       
  4233 
       
  4234 static PyObject *Qd_GetCPixel(PyObject *_self, PyObject *_args)
       
  4235 {
       
  4236 	PyObject *_res = NULL;
       
  4237 	short h;
       
  4238 	short v;
       
  4239 	RGBColor cPix;
       
  4240 #ifndef GetCPixel
       
  4241 	PyMac_PRECHECK(GetCPixel);
       
  4242 #endif
       
  4243 	if (!PyArg_ParseTuple(_args, "hh",
       
  4244 	                      &h,
       
  4245 	                      &v))
       
  4246 		return NULL;
       
  4247 	GetCPixel(h,
       
  4248 	          v,
       
  4249 	          &cPix);
       
  4250 	_res = Py_BuildValue("O&",
       
  4251 	                     QdRGB_New, &cPix);
       
  4252 	return _res;
       
  4253 }
       
  4254 
       
  4255 static PyObject *Qd_GetForeColor(PyObject *_self, PyObject *_args)
       
  4256 {
       
  4257 	PyObject *_res = NULL;
       
  4258 	RGBColor color;
       
  4259 #ifndef GetForeColor
       
  4260 	PyMac_PRECHECK(GetForeColor);
       
  4261 #endif
       
  4262 	if (!PyArg_ParseTuple(_args, ""))
       
  4263 		return NULL;
       
  4264 	GetForeColor(&color);
       
  4265 	_res = Py_BuildValue("O&",
       
  4266 	                     QdRGB_New, &color);
       
  4267 	return _res;
       
  4268 }
       
  4269 
       
  4270 static PyObject *Qd_GetBackColor(PyObject *_self, PyObject *_args)
       
  4271 {
       
  4272 	PyObject *_res = NULL;
       
  4273 	RGBColor color;
       
  4274 #ifndef GetBackColor
       
  4275 	PyMac_PRECHECK(GetBackColor);
       
  4276 #endif
       
  4277 	if (!PyArg_ParseTuple(_args, ""))
       
  4278 		return NULL;
       
  4279 	GetBackColor(&color);
       
  4280 	_res = Py_BuildValue("O&",
       
  4281 	                     QdRGB_New, &color);
       
  4282 	return _res;
       
  4283 }
       
  4284 
       
  4285 static PyObject *Qd_OpColor(PyObject *_self, PyObject *_args)
       
  4286 {
       
  4287 	PyObject *_res = NULL;
       
  4288 	RGBColor color;
       
  4289 #ifndef OpColor
       
  4290 	PyMac_PRECHECK(OpColor);
       
  4291 #endif
       
  4292 	if (!PyArg_ParseTuple(_args, "O&",
       
  4293 	                      QdRGB_Convert, &color))
       
  4294 		return NULL;
       
  4295 	OpColor(&color);
       
  4296 	Py_INCREF(Py_None);
       
  4297 	_res = Py_None;
       
  4298 	return _res;
       
  4299 }
       
  4300 
       
  4301 static PyObject *Qd_HiliteColor(PyObject *_self, PyObject *_args)
       
  4302 {
       
  4303 	PyObject *_res = NULL;
       
  4304 	RGBColor color;
       
  4305 #ifndef HiliteColor
       
  4306 	PyMac_PRECHECK(HiliteColor);
       
  4307 #endif
       
  4308 	if (!PyArg_ParseTuple(_args, "O&",
       
  4309 	                      QdRGB_Convert, &color))
       
  4310 		return NULL;
       
  4311 	HiliteColor(&color);
       
  4312 	Py_INCREF(Py_None);
       
  4313 	_res = Py_None;
       
  4314 	return _res;
       
  4315 }
       
  4316 
       
  4317 static PyObject *Qd_DisposeCTable(PyObject *_self, PyObject *_args)
       
  4318 {
       
  4319 	PyObject *_res = NULL;
       
  4320 	CTabHandle cTable;
       
  4321 #ifndef DisposeCTable
       
  4322 	PyMac_PRECHECK(DisposeCTable);
       
  4323 #endif
       
  4324 	if (!PyArg_ParseTuple(_args, "O&",
       
  4325 	                      ResObj_Convert, &cTable))
       
  4326 		return NULL;
       
  4327 	DisposeCTable(cTable);
       
  4328 	Py_INCREF(Py_None);
       
  4329 	_res = Py_None;
       
  4330 	return _res;
       
  4331 }
       
  4332 
       
  4333 static PyObject *Qd_GetCTable(PyObject *_self, PyObject *_args)
       
  4334 {
       
  4335 	PyObject *_res = NULL;
       
  4336 	CTabHandle _rv;
       
  4337 	short ctID;
       
  4338 #ifndef GetCTable
       
  4339 	PyMac_PRECHECK(GetCTable);
       
  4340 #endif
       
  4341 	if (!PyArg_ParseTuple(_args, "h",
       
  4342 	                      &ctID))
       
  4343 		return NULL;
       
  4344 	_rv = GetCTable(ctID);
       
  4345 	_res = Py_BuildValue("O&",
       
  4346 	                     ResObj_New, _rv);
       
  4347 	return _res;
       
  4348 }
       
  4349 
       
  4350 static PyObject *Qd_GetCCursor(PyObject *_self, PyObject *_args)
       
  4351 {
       
  4352 	PyObject *_res = NULL;
       
  4353 	CCrsrHandle _rv;
       
  4354 	short crsrID;
       
  4355 #ifndef GetCCursor
       
  4356 	PyMac_PRECHECK(GetCCursor);
       
  4357 #endif
       
  4358 	if (!PyArg_ParseTuple(_args, "h",
       
  4359 	                      &crsrID))
       
  4360 		return NULL;
       
  4361 	_rv = GetCCursor(crsrID);
       
  4362 	_res = Py_BuildValue("O&",
       
  4363 	                     ResObj_New, _rv);
       
  4364 	return _res;
       
  4365 }
       
  4366 
       
  4367 static PyObject *Qd_SetCCursor(PyObject *_self, PyObject *_args)
       
  4368 {
       
  4369 	PyObject *_res = NULL;
       
  4370 	CCrsrHandle cCrsr;
       
  4371 #ifndef SetCCursor
       
  4372 	PyMac_PRECHECK(SetCCursor);
       
  4373 #endif
       
  4374 	if (!PyArg_ParseTuple(_args, "O&",
       
  4375 	                      ResObj_Convert, &cCrsr))
       
  4376 		return NULL;
       
  4377 	SetCCursor(cCrsr);
       
  4378 	Py_INCREF(Py_None);
       
  4379 	_res = Py_None;
       
  4380 	return _res;
       
  4381 }
       
  4382 
       
  4383 static PyObject *Qd_AllocCursor(PyObject *_self, PyObject *_args)
       
  4384 {
       
  4385 	PyObject *_res = NULL;
       
  4386 #ifndef AllocCursor
       
  4387 	PyMac_PRECHECK(AllocCursor);
       
  4388 #endif
       
  4389 	if (!PyArg_ParseTuple(_args, ""))
       
  4390 		return NULL;
       
  4391 	AllocCursor();
       
  4392 	Py_INCREF(Py_None);
       
  4393 	_res = Py_None;
       
  4394 	return _res;
       
  4395 }
       
  4396 
       
  4397 static PyObject *Qd_DisposeCCursor(PyObject *_self, PyObject *_args)
       
  4398 {
       
  4399 	PyObject *_res = NULL;
       
  4400 	CCrsrHandle cCrsr;
       
  4401 #ifndef DisposeCCursor
       
  4402 	PyMac_PRECHECK(DisposeCCursor);
       
  4403 #endif
       
  4404 	if (!PyArg_ParseTuple(_args, "O&",
       
  4405 	                      ResObj_Convert, &cCrsr))
       
  4406 		return NULL;
       
  4407 	DisposeCCursor(cCrsr);
       
  4408 	Py_INCREF(Py_None);
       
  4409 	_res = Py_None;
       
  4410 	return _res;
       
  4411 }
       
  4412 
       
  4413 static PyObject *Qd_GetMaxDevice(PyObject *_self, PyObject *_args)
       
  4414 {
       
  4415 	PyObject *_res = NULL;
       
  4416 	GDHandle _rv;
       
  4417 	Rect globalRect;
       
  4418 #ifndef GetMaxDevice
       
  4419 	PyMac_PRECHECK(GetMaxDevice);
       
  4420 #endif
       
  4421 	if (!PyArg_ParseTuple(_args, "O&",
       
  4422 	                      PyMac_GetRect, &globalRect))
       
  4423 		return NULL;
       
  4424 	_rv = GetMaxDevice(&globalRect);
       
  4425 	_res = Py_BuildValue("O&",
       
  4426 	                     ResObj_New, _rv);
       
  4427 	return _res;
       
  4428 }
       
  4429 
       
  4430 static PyObject *Qd_GetCTSeed(PyObject *_self, PyObject *_args)
       
  4431 {
       
  4432 	PyObject *_res = NULL;
       
  4433 	long _rv;
       
  4434 #ifndef GetCTSeed
       
  4435 	PyMac_PRECHECK(GetCTSeed);
       
  4436 #endif
       
  4437 	if (!PyArg_ParseTuple(_args, ""))
       
  4438 		return NULL;
       
  4439 	_rv = GetCTSeed();
       
  4440 	_res = Py_BuildValue("l",
       
  4441 	                     _rv);
       
  4442 	return _res;
       
  4443 }
       
  4444 
       
  4445 static PyObject *Qd_GetDeviceList(PyObject *_self, PyObject *_args)
       
  4446 {
       
  4447 	PyObject *_res = NULL;
       
  4448 	GDHandle _rv;
       
  4449 #ifndef GetDeviceList
       
  4450 	PyMac_PRECHECK(GetDeviceList);
       
  4451 #endif
       
  4452 	if (!PyArg_ParseTuple(_args, ""))
       
  4453 		return NULL;
       
  4454 	_rv = GetDeviceList();
       
  4455 	_res = Py_BuildValue("O&",
       
  4456 	                     ResObj_New, _rv);
       
  4457 	return _res;
       
  4458 }
       
  4459 
       
  4460 static PyObject *Qd_GetMainDevice(PyObject *_self, PyObject *_args)
       
  4461 {
       
  4462 	PyObject *_res = NULL;
       
  4463 	GDHandle _rv;
       
  4464 #ifndef GetMainDevice
       
  4465 	PyMac_PRECHECK(GetMainDevice);
       
  4466 #endif
       
  4467 	if (!PyArg_ParseTuple(_args, ""))
       
  4468 		return NULL;
       
  4469 	_rv = GetMainDevice();
       
  4470 	_res = Py_BuildValue("O&",
       
  4471 	                     ResObj_New, _rv);
       
  4472 	return _res;
       
  4473 }
       
  4474 
       
  4475 static PyObject *Qd_GetNextDevice(PyObject *_self, PyObject *_args)
       
  4476 {
       
  4477 	PyObject *_res = NULL;
       
  4478 	GDHandle _rv;
       
  4479 	GDHandle curDevice;
       
  4480 #ifndef GetNextDevice
       
  4481 	PyMac_PRECHECK(GetNextDevice);
       
  4482 #endif
       
  4483 	if (!PyArg_ParseTuple(_args, "O&",
       
  4484 	                      ResObj_Convert, &curDevice))
       
  4485 		return NULL;
       
  4486 	_rv = GetNextDevice(curDevice);
       
  4487 	_res = Py_BuildValue("O&",
       
  4488 	                     ResObj_New, _rv);
       
  4489 	return _res;
       
  4490 }
       
  4491 
       
  4492 static PyObject *Qd_TestDeviceAttribute(PyObject *_self, PyObject *_args)
       
  4493 {
       
  4494 	PyObject *_res = NULL;
       
  4495 	Boolean _rv;
       
  4496 	GDHandle gdh;
       
  4497 	short attribute;
       
  4498 #ifndef TestDeviceAttribute
       
  4499 	PyMac_PRECHECK(TestDeviceAttribute);
       
  4500 #endif
       
  4501 	if (!PyArg_ParseTuple(_args, "O&h",
       
  4502 	                      ResObj_Convert, &gdh,
       
  4503 	                      &attribute))
       
  4504 		return NULL;
       
  4505 	_rv = TestDeviceAttribute(gdh,
       
  4506 	                          attribute);
       
  4507 	_res = Py_BuildValue("b",
       
  4508 	                     _rv);
       
  4509 	return _res;
       
  4510 }
       
  4511 
       
  4512 static PyObject *Qd_SetDeviceAttribute(PyObject *_self, PyObject *_args)
       
  4513 {
       
  4514 	PyObject *_res = NULL;
       
  4515 	GDHandle gdh;
       
  4516 	short attribute;
       
  4517 	Boolean value;
       
  4518 #ifndef SetDeviceAttribute
       
  4519 	PyMac_PRECHECK(SetDeviceAttribute);
       
  4520 #endif
       
  4521 	if (!PyArg_ParseTuple(_args, "O&hb",
       
  4522 	                      ResObj_Convert, &gdh,
       
  4523 	                      &attribute,
       
  4524 	                      &value))
       
  4525 		return NULL;
       
  4526 	SetDeviceAttribute(gdh,
       
  4527 	                   attribute,
       
  4528 	                   value);
       
  4529 	Py_INCREF(Py_None);
       
  4530 	_res = Py_None;
       
  4531 	return _res;
       
  4532 }
       
  4533 
       
  4534 static PyObject *Qd_InitGDevice(PyObject *_self, PyObject *_args)
       
  4535 {
       
  4536 	PyObject *_res = NULL;
       
  4537 	short qdRefNum;
       
  4538 	long mode;
       
  4539 	GDHandle gdh;
       
  4540 #ifndef InitGDevice
       
  4541 	PyMac_PRECHECK(InitGDevice);
       
  4542 #endif
       
  4543 	if (!PyArg_ParseTuple(_args, "hlO&",
       
  4544 	                      &qdRefNum,
       
  4545 	                      &mode,
       
  4546 	                      ResObj_Convert, &gdh))
       
  4547 		return NULL;
       
  4548 	InitGDevice(qdRefNum,
       
  4549 	            mode,
       
  4550 	            gdh);
       
  4551 	Py_INCREF(Py_None);
       
  4552 	_res = Py_None;
       
  4553 	return _res;
       
  4554 }
       
  4555 
       
  4556 static PyObject *Qd_NewGDevice(PyObject *_self, PyObject *_args)
       
  4557 {
       
  4558 	PyObject *_res = NULL;
       
  4559 	GDHandle _rv;
       
  4560 	short refNum;
       
  4561 	long mode;
       
  4562 #ifndef NewGDevice
       
  4563 	PyMac_PRECHECK(NewGDevice);
       
  4564 #endif
       
  4565 	if (!PyArg_ParseTuple(_args, "hl",
       
  4566 	                      &refNum,
       
  4567 	                      &mode))
       
  4568 		return NULL;
       
  4569 	_rv = NewGDevice(refNum,
       
  4570 	                 mode);
       
  4571 	_res = Py_BuildValue("O&",
       
  4572 	                     ResObj_New, _rv);
       
  4573 	return _res;
       
  4574 }
       
  4575 
       
  4576 static PyObject *Qd_DisposeGDevice(PyObject *_self, PyObject *_args)
       
  4577 {
       
  4578 	PyObject *_res = NULL;
       
  4579 	GDHandle gdh;
       
  4580 #ifndef DisposeGDevice
       
  4581 	PyMac_PRECHECK(DisposeGDevice);
       
  4582 #endif
       
  4583 	if (!PyArg_ParseTuple(_args, "O&",
       
  4584 	                      ResObj_Convert, &gdh))
       
  4585 		return NULL;
       
  4586 	DisposeGDevice(gdh);
       
  4587 	Py_INCREF(Py_None);
       
  4588 	_res = Py_None;
       
  4589 	return _res;
       
  4590 }
       
  4591 
       
  4592 static PyObject *Qd_SetGDevice(PyObject *_self, PyObject *_args)
       
  4593 {
       
  4594 	PyObject *_res = NULL;
       
  4595 	GDHandle gd;
       
  4596 #ifndef SetGDevice
       
  4597 	PyMac_PRECHECK(SetGDevice);
       
  4598 #endif
       
  4599 	if (!PyArg_ParseTuple(_args, "O&",
       
  4600 	                      ResObj_Convert, &gd))
       
  4601 		return NULL;
       
  4602 	SetGDevice(gd);
       
  4603 	Py_INCREF(Py_None);
       
  4604 	_res = Py_None;
       
  4605 	return _res;
       
  4606 }
       
  4607 
       
  4608 static PyObject *Qd_GetGDevice(PyObject *_self, PyObject *_args)
       
  4609 {
       
  4610 	PyObject *_res = NULL;
       
  4611 	GDHandle _rv;
       
  4612 #ifndef GetGDevice
       
  4613 	PyMac_PRECHECK(GetGDevice);
       
  4614 #endif
       
  4615 	if (!PyArg_ParseTuple(_args, ""))
       
  4616 		return NULL;
       
  4617 	_rv = GetGDevice();
       
  4618 	_res = Py_BuildValue("O&",
       
  4619 	                     ResObj_New, _rv);
       
  4620 	return _res;
       
  4621 }
       
  4622 
       
  4623 static PyObject *Qd_Color2Index(PyObject *_self, PyObject *_args)
       
  4624 {
       
  4625 	PyObject *_res = NULL;
       
  4626 	long _rv;
       
  4627 	RGBColor myColor;
       
  4628 #ifndef Color2Index
       
  4629 	PyMac_PRECHECK(Color2Index);
       
  4630 #endif
       
  4631 	if (!PyArg_ParseTuple(_args, "O&",
       
  4632 	                      QdRGB_Convert, &myColor))
       
  4633 		return NULL;
       
  4634 	_rv = Color2Index(&myColor);
       
  4635 	_res = Py_BuildValue("l",
       
  4636 	                     _rv);
       
  4637 	return _res;
       
  4638 }
       
  4639 
       
  4640 static PyObject *Qd_Index2Color(PyObject *_self, PyObject *_args)
       
  4641 {
       
  4642 	PyObject *_res = NULL;
       
  4643 	long index;
       
  4644 	RGBColor aColor;
       
  4645 #ifndef Index2Color
       
  4646 	PyMac_PRECHECK(Index2Color);
       
  4647 #endif
       
  4648 	if (!PyArg_ParseTuple(_args, "l",
       
  4649 	                      &index))
       
  4650 		return NULL;
       
  4651 	Index2Color(index,
       
  4652 	            &aColor);
       
  4653 	_res = Py_BuildValue("O&",
       
  4654 	                     QdRGB_New, &aColor);
       
  4655 	return _res;
       
  4656 }
       
  4657 
       
  4658 static PyObject *Qd_InvertColor(PyObject *_self, PyObject *_args)
       
  4659 {
       
  4660 	PyObject *_res = NULL;
       
  4661 	RGBColor myColor;
       
  4662 #ifndef InvertColor
       
  4663 	PyMac_PRECHECK(InvertColor);
       
  4664 #endif
       
  4665 	if (!PyArg_ParseTuple(_args, ""))
       
  4666 		return NULL;
       
  4667 	InvertColor(&myColor);
       
  4668 	_res = Py_BuildValue("O&",
       
  4669 	                     QdRGB_New, &myColor);
       
  4670 	return _res;
       
  4671 }
       
  4672 
       
  4673 static PyObject *Qd_RealColor(PyObject *_self, PyObject *_args)
       
  4674 {
       
  4675 	PyObject *_res = NULL;
       
  4676 	Boolean _rv;
       
  4677 	RGBColor color;
       
  4678 #ifndef RealColor
       
  4679 	PyMac_PRECHECK(RealColor);
       
  4680 #endif
       
  4681 	if (!PyArg_ParseTuple(_args, "O&",
       
  4682 	                      QdRGB_Convert, &color))
       
  4683 		return NULL;
       
  4684 	_rv = RealColor(&color);
       
  4685 	_res = Py_BuildValue("b",
       
  4686 	                     _rv);
       
  4687 	return _res;
       
  4688 }
       
  4689 
       
  4690 static PyObject *Qd_GetSubTable(PyObject *_self, PyObject *_args)
       
  4691 {
       
  4692 	PyObject *_res = NULL;
       
  4693 	CTabHandle myColors;
       
  4694 	short iTabRes;
       
  4695 	CTabHandle targetTbl;
       
  4696 #ifndef GetSubTable
       
  4697 	PyMac_PRECHECK(GetSubTable);
       
  4698 #endif
       
  4699 	if (!PyArg_ParseTuple(_args, "O&hO&",
       
  4700 	                      ResObj_Convert, &myColors,
       
  4701 	                      &iTabRes,
       
  4702 	                      ResObj_Convert, &targetTbl))
       
  4703 		return NULL;
       
  4704 	GetSubTable(myColors,
       
  4705 	            iTabRes,
       
  4706 	            targetTbl);
       
  4707 	Py_INCREF(Py_None);
       
  4708 	_res = Py_None;
       
  4709 	return _res;
       
  4710 }
       
  4711 
       
  4712 static PyObject *Qd_MakeITable(PyObject *_self, PyObject *_args)
       
  4713 {
       
  4714 	PyObject *_res = NULL;
       
  4715 	CTabHandle cTabH;
       
  4716 	ITabHandle iTabH;
       
  4717 	short res;
       
  4718 #ifndef MakeITable
       
  4719 	PyMac_PRECHECK(MakeITable);
       
  4720 #endif
       
  4721 	if (!PyArg_ParseTuple(_args, "O&O&h",
       
  4722 	                      ResObj_Convert, &cTabH,
       
  4723 	                      ResObj_Convert, &iTabH,
       
  4724 	                      &res))
       
  4725 		return NULL;
       
  4726 	MakeITable(cTabH,
       
  4727 	           iTabH,
       
  4728 	           res);
       
  4729 	Py_INCREF(Py_None);
       
  4730 	_res = Py_None;
       
  4731 	return _res;
       
  4732 }
       
  4733 
       
  4734 static PyObject *Qd_SetClientID(PyObject *_self, PyObject *_args)
       
  4735 {
       
  4736 	PyObject *_res = NULL;
       
  4737 	short id;
       
  4738 #ifndef SetClientID
       
  4739 	PyMac_PRECHECK(SetClientID);
       
  4740 #endif
       
  4741 	if (!PyArg_ParseTuple(_args, "h",
       
  4742 	                      &id))
       
  4743 		return NULL;
       
  4744 	SetClientID(id);
       
  4745 	Py_INCREF(Py_None);
       
  4746 	_res = Py_None;
       
  4747 	return _res;
       
  4748 }
       
  4749 
       
  4750 static PyObject *Qd_ProtectEntry(PyObject *_self, PyObject *_args)
       
  4751 {
       
  4752 	PyObject *_res = NULL;
       
  4753 	short index;
       
  4754 	Boolean protect;
       
  4755 #ifndef ProtectEntry
       
  4756 	PyMac_PRECHECK(ProtectEntry);
       
  4757 #endif
       
  4758 	if (!PyArg_ParseTuple(_args, "hb",
       
  4759 	                      &index,
       
  4760 	                      &protect))
       
  4761 		return NULL;
       
  4762 	ProtectEntry(index,
       
  4763 	             protect);
       
  4764 	Py_INCREF(Py_None);
       
  4765 	_res = Py_None;
       
  4766 	return _res;
       
  4767 }
       
  4768 
       
  4769 static PyObject *Qd_ReserveEntry(PyObject *_self, PyObject *_args)
       
  4770 {
       
  4771 	PyObject *_res = NULL;
       
  4772 	short index;
       
  4773 	Boolean reserve;
       
  4774 #ifndef ReserveEntry
       
  4775 	PyMac_PRECHECK(ReserveEntry);
       
  4776 #endif
       
  4777 	if (!PyArg_ParseTuple(_args, "hb",
       
  4778 	                      &index,
       
  4779 	                      &reserve))
       
  4780 		return NULL;
       
  4781 	ReserveEntry(index,
       
  4782 	             reserve);
       
  4783 	Py_INCREF(Py_None);
       
  4784 	_res = Py_None;
       
  4785 	return _res;
       
  4786 }
       
  4787 
       
  4788 static PyObject *Qd_QDError(PyObject *_self, PyObject *_args)
       
  4789 {
       
  4790 	PyObject *_res = NULL;
       
  4791 	short _rv;
       
  4792 #ifndef QDError
       
  4793 	PyMac_PRECHECK(QDError);
       
  4794 #endif
       
  4795 	if (!PyArg_ParseTuple(_args, ""))
       
  4796 		return NULL;
       
  4797 	_rv = QDError();
       
  4798 	_res = Py_BuildValue("h",
       
  4799 	                     _rv);
       
  4800 	return _res;
       
  4801 }
       
  4802 
       
  4803 static PyObject *Qd_CopyDeepMask(PyObject *_self, PyObject *_args)
       
  4804 {
       
  4805 	PyObject *_res = NULL;
       
  4806 	BitMapPtr srcBits;
       
  4807 	BitMapPtr maskBits;
       
  4808 	BitMapPtr dstBits;
       
  4809 	Rect srcRect;
       
  4810 	Rect maskRect;
       
  4811 	Rect dstRect;
       
  4812 	short mode;
       
  4813 	RgnHandle maskRgn;
       
  4814 #ifndef CopyDeepMask
       
  4815 	PyMac_PRECHECK(CopyDeepMask);
       
  4816 #endif
       
  4817 	if (!PyArg_ParseTuple(_args, "O&O&O&O&O&O&hO&",
       
  4818 	                      BMObj_Convert, &srcBits,
       
  4819 	                      BMObj_Convert, &maskBits,
       
  4820 	                      BMObj_Convert, &dstBits,
       
  4821 	                      PyMac_GetRect, &srcRect,
       
  4822 	                      PyMac_GetRect, &maskRect,
       
  4823 	                      PyMac_GetRect, &dstRect,
       
  4824 	                      &mode,
       
  4825 	                      OptResObj_Convert, &maskRgn))
       
  4826 		return NULL;
       
  4827 	CopyDeepMask(srcBits,
       
  4828 	             maskBits,
       
  4829 	             dstBits,
       
  4830 	             &srcRect,
       
  4831 	             &maskRect,
       
  4832 	             &dstRect,
       
  4833 	             mode,
       
  4834 	             maskRgn);
       
  4835 	Py_INCREF(Py_None);
       
  4836 	_res = Py_None;
       
  4837 	return _res;
       
  4838 }
       
  4839 
       
  4840 static PyObject *Qd_GetPattern(PyObject *_self, PyObject *_args)
       
  4841 {
       
  4842 	PyObject *_res = NULL;
       
  4843 	PatHandle _rv;
       
  4844 	short patternID;
       
  4845 #ifndef GetPattern
       
  4846 	PyMac_PRECHECK(GetPattern);
       
  4847 #endif
       
  4848 	if (!PyArg_ParseTuple(_args, "h",
       
  4849 	                      &patternID))
       
  4850 		return NULL;
       
  4851 	_rv = GetPattern(patternID);
       
  4852 	_res = Py_BuildValue("O&",
       
  4853 	                     ResObj_New, _rv);
       
  4854 	return _res;
       
  4855 }
       
  4856 
       
  4857 static PyObject *Qd_MacGetCursor(PyObject *_self, PyObject *_args)
       
  4858 {
       
  4859 	PyObject *_res = NULL;
       
  4860 	CursHandle _rv;
       
  4861 	short cursorID;
       
  4862 #ifndef MacGetCursor
       
  4863 	PyMac_PRECHECK(MacGetCursor);
       
  4864 #endif
       
  4865 	if (!PyArg_ParseTuple(_args, "h",
       
  4866 	                      &cursorID))
       
  4867 		return NULL;
       
  4868 	_rv = MacGetCursor(cursorID);
       
  4869 	_res = Py_BuildValue("O&",
       
  4870 	                     ResObj_New, _rv);
       
  4871 	return _res;
       
  4872 }
       
  4873 
       
  4874 static PyObject *Qd_GetPicture(PyObject *_self, PyObject *_args)
       
  4875 {
       
  4876 	PyObject *_res = NULL;
       
  4877 	PicHandle _rv;
       
  4878 	short pictureID;
       
  4879 #ifndef GetPicture
       
  4880 	PyMac_PRECHECK(GetPicture);
       
  4881 #endif
       
  4882 	if (!PyArg_ParseTuple(_args, "h",
       
  4883 	                      &pictureID))
       
  4884 		return NULL;
       
  4885 	_rv = GetPicture(pictureID);
       
  4886 	_res = Py_BuildValue("O&",
       
  4887 	                     ResObj_New, _rv);
       
  4888 	return _res;
       
  4889 }
       
  4890 
       
  4891 static PyObject *Qd_DeltaPoint(PyObject *_self, PyObject *_args)
       
  4892 {
       
  4893 	PyObject *_res = NULL;
       
  4894 	long _rv;
       
  4895 	Point ptA;
       
  4896 	Point ptB;
       
  4897 #ifndef DeltaPoint
       
  4898 	PyMac_PRECHECK(DeltaPoint);
       
  4899 #endif
       
  4900 	if (!PyArg_ParseTuple(_args, "O&O&",
       
  4901 	                      PyMac_GetPoint, &ptA,
       
  4902 	                      PyMac_GetPoint, &ptB))
       
  4903 		return NULL;
       
  4904 	_rv = DeltaPoint(ptA,
       
  4905 	                 ptB);
       
  4906 	_res = Py_BuildValue("l",
       
  4907 	                     _rv);
       
  4908 	return _res;
       
  4909 }
       
  4910 
       
  4911 static PyObject *Qd_ShieldCursor(PyObject *_self, PyObject *_args)
       
  4912 {
       
  4913 	PyObject *_res = NULL;
       
  4914 	Rect shieldRect;
       
  4915 	Point offsetPt;
       
  4916 #ifndef ShieldCursor
       
  4917 	PyMac_PRECHECK(ShieldCursor);
       
  4918 #endif
       
  4919 	if (!PyArg_ParseTuple(_args, "O&O&",
       
  4920 	                      PyMac_GetRect, &shieldRect,
       
  4921 	                      PyMac_GetPoint, &offsetPt))
       
  4922 		return NULL;
       
  4923 	ShieldCursor(&shieldRect,
       
  4924 	             offsetPt);
       
  4925 	Py_INCREF(Py_None);
       
  4926 	_res = Py_None;
       
  4927 	return _res;
       
  4928 }
       
  4929 
       
  4930 static PyObject *Qd_ScreenRes(PyObject *_self, PyObject *_args)
       
  4931 {
       
  4932 	PyObject *_res = NULL;
       
  4933 	short scrnHRes;
       
  4934 	short scrnVRes;
       
  4935 #ifndef ScreenRes
       
  4936 	PyMac_PRECHECK(ScreenRes);
       
  4937 #endif
       
  4938 	if (!PyArg_ParseTuple(_args, ""))
       
  4939 		return NULL;
       
  4940 	ScreenRes(&scrnHRes,
       
  4941 	          &scrnVRes);
       
  4942 	_res = Py_BuildValue("hh",
       
  4943 	                     scrnHRes,
       
  4944 	                     scrnVRes);
       
  4945 	return _res;
       
  4946 }
       
  4947 
       
  4948 static PyObject *Qd_GetIndPattern(PyObject *_self, PyObject *_args)
       
  4949 {
       
  4950 	PyObject *_res = NULL;
       
  4951 	Pattern thePat__out__;
       
  4952 	short patternListID;
       
  4953 	short index;
       
  4954 #ifndef GetIndPattern
       
  4955 	PyMac_PRECHECK(GetIndPattern);
       
  4956 #endif
       
  4957 	if (!PyArg_ParseTuple(_args, "hh",
       
  4958 	                      &patternListID,
       
  4959 	                      &index))
       
  4960 		return NULL;
       
  4961 	GetIndPattern(&thePat__out__,
       
  4962 	              patternListID,
       
  4963 	              index);
       
  4964 	_res = Py_BuildValue("s#",
       
  4965 	                     (char *)&thePat__out__, (int)sizeof(Pattern));
       
  4966 	return _res;
       
  4967 }
       
  4968 
       
  4969 static PyObject *Qd_SlopeFromAngle(PyObject *_self, PyObject *_args)
       
  4970 {
       
  4971 	PyObject *_res = NULL;
       
  4972 	Fixed _rv;
       
  4973 	short angle;
       
  4974 #ifndef SlopeFromAngle
       
  4975 	PyMac_PRECHECK(SlopeFromAngle);
       
  4976 #endif
       
  4977 	if (!PyArg_ParseTuple(_args, "h",
       
  4978 	                      &angle))
       
  4979 		return NULL;
       
  4980 	_rv = SlopeFromAngle(angle);
       
  4981 	_res = Py_BuildValue("O&",
       
  4982 	                     PyMac_BuildFixed, _rv);
       
  4983 	return _res;
       
  4984 }
       
  4985 
       
  4986 static PyObject *Qd_AngleFromSlope(PyObject *_self, PyObject *_args)
       
  4987 {
       
  4988 	PyObject *_res = NULL;
       
  4989 	short _rv;
       
  4990 	Fixed slope;
       
  4991 #ifndef AngleFromSlope
       
  4992 	PyMac_PRECHECK(AngleFromSlope);
       
  4993 #endif
       
  4994 	if (!PyArg_ParseTuple(_args, "O&",
       
  4995 	                      PyMac_GetFixed, &slope))
       
  4996 		return NULL;
       
  4997 	_rv = AngleFromSlope(slope);
       
  4998 	_res = Py_BuildValue("h",
       
  4999 	                     _rv);
       
  5000 	return _res;
       
  5001 }
       
  5002 
       
  5003 static PyObject *Qd_GetPixBounds(PyObject *_self, PyObject *_args)
       
  5004 {
       
  5005 	PyObject *_res = NULL;
       
  5006 	PixMapHandle pixMap;
       
  5007 	Rect bounds;
       
  5008 #ifndef GetPixBounds
       
  5009 	PyMac_PRECHECK(GetPixBounds);
       
  5010 #endif
       
  5011 	if (!PyArg_ParseTuple(_args, "O&",
       
  5012 	                      ResObj_Convert, &pixMap))
       
  5013 		return NULL;
       
  5014 	GetPixBounds(pixMap,
       
  5015 	             &bounds);
       
  5016 	_res = Py_BuildValue("O&",
       
  5017 	                     PyMac_BuildRect, &bounds);
       
  5018 	return _res;
       
  5019 }
       
  5020 
       
  5021 static PyObject *Qd_GetPixDepth(PyObject *_self, PyObject *_args)
       
  5022 {
       
  5023 	PyObject *_res = NULL;
       
  5024 	short _rv;
       
  5025 	PixMapHandle pixMap;
       
  5026 #ifndef GetPixDepth
       
  5027 	PyMac_PRECHECK(GetPixDepth);
       
  5028 #endif
       
  5029 	if (!PyArg_ParseTuple(_args, "O&",
       
  5030 	                      ResObj_Convert, &pixMap))
       
  5031 		return NULL;
       
  5032 	_rv = GetPixDepth(pixMap);
       
  5033 	_res = Py_BuildValue("h",
       
  5034 	                     _rv);
       
  5035 	return _res;
       
  5036 }
       
  5037 
       
  5038 static PyObject *Qd_GetQDGlobalsRandomSeed(PyObject *_self, PyObject *_args)
       
  5039 {
       
  5040 	PyObject *_res = NULL;
       
  5041 	long _rv;
       
  5042 #ifndef GetQDGlobalsRandomSeed
       
  5043 	PyMac_PRECHECK(GetQDGlobalsRandomSeed);
       
  5044 #endif
       
  5045 	if (!PyArg_ParseTuple(_args, ""))
       
  5046 		return NULL;
       
  5047 	_rv = GetQDGlobalsRandomSeed();
       
  5048 	_res = Py_BuildValue("l",
       
  5049 	                     _rv);
       
  5050 	return _res;
       
  5051 }
       
  5052 
       
  5053 static PyObject *Qd_GetQDGlobalsScreenBits(PyObject *_self, PyObject *_args)
       
  5054 {
       
  5055 	PyObject *_res = NULL;
       
  5056 	BitMap screenBits;
       
  5057 #ifndef GetQDGlobalsScreenBits
       
  5058 	PyMac_PRECHECK(GetQDGlobalsScreenBits);
       
  5059 #endif
       
  5060 	if (!PyArg_ParseTuple(_args, ""))
       
  5061 		return NULL;
       
  5062 	GetQDGlobalsScreenBits(&screenBits);
       
  5063 	_res = Py_BuildValue("O&",
       
  5064 	                     BMObj_NewCopied, &screenBits);
       
  5065 	return _res;
       
  5066 }
       
  5067 
       
  5068 static PyObject *Qd_GetQDGlobalsArrow(PyObject *_self, PyObject *_args)
       
  5069 {
       
  5070 	PyObject *_res = NULL;
       
  5071 	Cursor arrow__out__;
       
  5072 #ifndef GetQDGlobalsArrow
       
  5073 	PyMac_PRECHECK(GetQDGlobalsArrow);
       
  5074 #endif
       
  5075 	if (!PyArg_ParseTuple(_args, ""))
       
  5076 		return NULL;
       
  5077 	GetQDGlobalsArrow(&arrow__out__);
       
  5078 	_res = Py_BuildValue("s#",
       
  5079 	                     (char *)&arrow__out__, (int)sizeof(Cursor));
       
  5080 	return _res;
       
  5081 }
       
  5082 
       
  5083 static PyObject *Qd_GetQDGlobalsDarkGray(PyObject *_self, PyObject *_args)
       
  5084 {
       
  5085 	PyObject *_res = NULL;
       
  5086 	Pattern dkGray__out__;
       
  5087 #ifndef GetQDGlobalsDarkGray
       
  5088 	PyMac_PRECHECK(GetQDGlobalsDarkGray);
       
  5089 #endif
       
  5090 	if (!PyArg_ParseTuple(_args, ""))
       
  5091 		return NULL;
       
  5092 	GetQDGlobalsDarkGray(&dkGray__out__);
       
  5093 	_res = Py_BuildValue("s#",
       
  5094 	                     (char *)&dkGray__out__, (int)sizeof(Pattern));
       
  5095 	return _res;
       
  5096 }
       
  5097 
       
  5098 static PyObject *Qd_GetQDGlobalsLightGray(PyObject *_self, PyObject *_args)
       
  5099 {
       
  5100 	PyObject *_res = NULL;
       
  5101 	Pattern ltGray__out__;
       
  5102 #ifndef GetQDGlobalsLightGray
       
  5103 	PyMac_PRECHECK(GetQDGlobalsLightGray);
       
  5104 #endif
       
  5105 	if (!PyArg_ParseTuple(_args, ""))
       
  5106 		return NULL;
       
  5107 	GetQDGlobalsLightGray(&ltGray__out__);
       
  5108 	_res = Py_BuildValue("s#",
       
  5109 	                     (char *)&ltGray__out__, (int)sizeof(Pattern));
       
  5110 	return _res;
       
  5111 }
       
  5112 
       
  5113 static PyObject *Qd_GetQDGlobalsGray(PyObject *_self, PyObject *_args)
       
  5114 {
       
  5115 	PyObject *_res = NULL;
       
  5116 	Pattern gray__out__;
       
  5117 #ifndef GetQDGlobalsGray
       
  5118 	PyMac_PRECHECK(GetQDGlobalsGray);
       
  5119 #endif
       
  5120 	if (!PyArg_ParseTuple(_args, ""))
       
  5121 		return NULL;
       
  5122 	GetQDGlobalsGray(&gray__out__);
       
  5123 	_res = Py_BuildValue("s#",
       
  5124 	                     (char *)&gray__out__, (int)sizeof(Pattern));
       
  5125 	return _res;
       
  5126 }
       
  5127 
       
  5128 static PyObject *Qd_GetQDGlobalsBlack(PyObject *_self, PyObject *_args)
       
  5129 {
       
  5130 	PyObject *_res = NULL;
       
  5131 	Pattern black__out__;
       
  5132 #ifndef GetQDGlobalsBlack
       
  5133 	PyMac_PRECHECK(GetQDGlobalsBlack);
       
  5134 #endif
       
  5135 	if (!PyArg_ParseTuple(_args, ""))
       
  5136 		return NULL;
       
  5137 	GetQDGlobalsBlack(&black__out__);
       
  5138 	_res = Py_BuildValue("s#",
       
  5139 	                     (char *)&black__out__, (int)sizeof(Pattern));
       
  5140 	return _res;
       
  5141 }
       
  5142 
       
  5143 static PyObject *Qd_GetQDGlobalsWhite(PyObject *_self, PyObject *_args)
       
  5144 {
       
  5145 	PyObject *_res = NULL;
       
  5146 	Pattern white__out__;
       
  5147 #ifndef GetQDGlobalsWhite
       
  5148 	PyMac_PRECHECK(GetQDGlobalsWhite);
       
  5149 #endif
       
  5150 	if (!PyArg_ParseTuple(_args, ""))
       
  5151 		return NULL;
       
  5152 	GetQDGlobalsWhite(&white__out__);
       
  5153 	_res = Py_BuildValue("s#",
       
  5154 	                     (char *)&white__out__, (int)sizeof(Pattern));
       
  5155 	return _res;
       
  5156 }
       
  5157 
       
  5158 static PyObject *Qd_GetQDGlobalsThePort(PyObject *_self, PyObject *_args)
       
  5159 {
       
  5160 	PyObject *_res = NULL;
       
  5161 	CGrafPtr _rv;
       
  5162 #ifndef GetQDGlobalsThePort
       
  5163 	PyMac_PRECHECK(GetQDGlobalsThePort);
       
  5164 #endif
       
  5165 	if (!PyArg_ParseTuple(_args, ""))
       
  5166 		return NULL;
       
  5167 	_rv = GetQDGlobalsThePort();
       
  5168 	_res = Py_BuildValue("O&",
       
  5169 	                     GrafObj_New, _rv);
       
  5170 	return _res;
       
  5171 }
       
  5172 
       
  5173 static PyObject *Qd_SetQDGlobalsRandomSeed(PyObject *_self, PyObject *_args)
       
  5174 {
       
  5175 	PyObject *_res = NULL;
       
  5176 	long randomSeed;
       
  5177 #ifndef SetQDGlobalsRandomSeed
       
  5178 	PyMac_PRECHECK(SetQDGlobalsRandomSeed);
       
  5179 #endif
       
  5180 	if (!PyArg_ParseTuple(_args, "l",
       
  5181 	                      &randomSeed))
       
  5182 		return NULL;
       
  5183 	SetQDGlobalsRandomSeed(randomSeed);
       
  5184 	Py_INCREF(Py_None);
       
  5185 	_res = Py_None;
       
  5186 	return _res;
       
  5187 }
       
  5188 
       
  5189 static PyObject *Qd_SetQDGlobalsArrow(PyObject *_self, PyObject *_args)
       
  5190 {
       
  5191 	PyObject *_res = NULL;
       
  5192 	Cursor *arrow__in__;
       
  5193 	int arrow__in_len__;
       
  5194 #ifndef SetQDGlobalsArrow
       
  5195 	PyMac_PRECHECK(SetQDGlobalsArrow);
       
  5196 #endif
       
  5197 	if (!PyArg_ParseTuple(_args, "s#",
       
  5198 	                      (char **)&arrow__in__, &arrow__in_len__))
       
  5199 		return NULL;
       
  5200 	if (arrow__in_len__ != sizeof(Cursor))
       
  5201 	{
       
  5202 		PyErr_SetString(PyExc_TypeError, "buffer length should be sizeof(Cursor)");
       
  5203 		goto arrow__error__;
       
  5204 	}
       
  5205 	SetQDGlobalsArrow(arrow__in__);
       
  5206 	Py_INCREF(Py_None);
       
  5207 	_res = Py_None;
       
  5208  arrow__error__: ;
       
  5209 	return _res;
       
  5210 }
       
  5211 
       
  5212 static PyObject *Qd_GetRegionBounds(PyObject *_self, PyObject *_args)
       
  5213 {
       
  5214 	PyObject *_res = NULL;
       
  5215 	RgnHandle region;
       
  5216 	Rect bounds;
       
  5217 #ifndef GetRegionBounds
       
  5218 	PyMac_PRECHECK(GetRegionBounds);
       
  5219 #endif
       
  5220 	if (!PyArg_ParseTuple(_args, "O&",
       
  5221 	                      ResObj_Convert, &region))
       
  5222 		return NULL;
       
  5223 	GetRegionBounds(region,
       
  5224 	                &bounds);
       
  5225 	_res = Py_BuildValue("O&",
       
  5226 	                     PyMac_BuildRect, &bounds);
       
  5227 	return _res;
       
  5228 }
       
  5229 
       
  5230 static PyObject *Qd_IsRegionRectangular(PyObject *_self, PyObject *_args)
       
  5231 {
       
  5232 	PyObject *_res = NULL;
       
  5233 	Boolean _rv;
       
  5234 	RgnHandle region;
       
  5235 #ifndef IsRegionRectangular
       
  5236 	PyMac_PRECHECK(IsRegionRectangular);
       
  5237 #endif
       
  5238 	if (!PyArg_ParseTuple(_args, "O&",
       
  5239 	                      ResObj_Convert, &region))
       
  5240 		return NULL;
       
  5241 	_rv = IsRegionRectangular(region);
       
  5242 	_res = Py_BuildValue("b",
       
  5243 	                     _rv);
       
  5244 	return _res;
       
  5245 }
       
  5246 
       
  5247 static PyObject *Qd_CreateNewPort(PyObject *_self, PyObject *_args)
       
  5248 {
       
  5249 	PyObject *_res = NULL;
       
  5250 	CGrafPtr _rv;
       
  5251 #ifndef CreateNewPort
       
  5252 	PyMac_PRECHECK(CreateNewPort);
       
  5253 #endif
       
  5254 	if (!PyArg_ParseTuple(_args, ""))
       
  5255 		return NULL;
       
  5256 	_rv = CreateNewPort();
       
  5257 	_res = Py_BuildValue("O&",
       
  5258 	                     GrafObj_New, _rv);
       
  5259 	return _res;
       
  5260 }
       
  5261 
       
  5262 static PyObject *Qd_SetQDError(PyObject *_self, PyObject *_args)
       
  5263 {
       
  5264 	PyObject *_res = NULL;
       
  5265 	OSErr err;
       
  5266 #ifndef SetQDError
       
  5267 	PyMac_PRECHECK(SetQDError);
       
  5268 #endif
       
  5269 	if (!PyArg_ParseTuple(_args, "h",
       
  5270 	                      &err))
       
  5271 		return NULL;
       
  5272 	SetQDError(err);
       
  5273 	Py_INCREF(Py_None);
       
  5274 	_res = Py_None;
       
  5275 	return _res;
       
  5276 }
       
  5277 
       
  5278 static PyObject *Qd_LMGetScrVRes(PyObject *_self, PyObject *_args)
       
  5279 {
       
  5280 	PyObject *_res = NULL;
       
  5281 	SInt16 _rv;
       
  5282 #ifndef LMGetScrVRes
       
  5283 	PyMac_PRECHECK(LMGetScrVRes);
       
  5284 #endif
       
  5285 	if (!PyArg_ParseTuple(_args, ""))
       
  5286 		return NULL;
       
  5287 	_rv = LMGetScrVRes();
       
  5288 	_res = Py_BuildValue("h",
       
  5289 	                     _rv);
       
  5290 	return _res;
       
  5291 }
       
  5292 
       
  5293 static PyObject *Qd_LMSetScrVRes(PyObject *_self, PyObject *_args)
       
  5294 {
       
  5295 	PyObject *_res = NULL;
       
  5296 	SInt16 value;
       
  5297 #ifndef LMSetScrVRes
       
  5298 	PyMac_PRECHECK(LMSetScrVRes);
       
  5299 #endif
       
  5300 	if (!PyArg_ParseTuple(_args, "h",
       
  5301 	                      &value))
       
  5302 		return NULL;
       
  5303 	LMSetScrVRes(value);
       
  5304 	Py_INCREF(Py_None);
       
  5305 	_res = Py_None;
       
  5306 	return _res;
       
  5307 }
       
  5308 
       
  5309 static PyObject *Qd_LMGetScrHRes(PyObject *_self, PyObject *_args)
       
  5310 {
       
  5311 	PyObject *_res = NULL;
       
  5312 	SInt16 _rv;
       
  5313 #ifndef LMGetScrHRes
       
  5314 	PyMac_PRECHECK(LMGetScrHRes);
       
  5315 #endif
       
  5316 	if (!PyArg_ParseTuple(_args, ""))
       
  5317 		return NULL;
       
  5318 	_rv = LMGetScrHRes();
       
  5319 	_res = Py_BuildValue("h",
       
  5320 	                     _rv);
       
  5321 	return _res;
       
  5322 }
       
  5323 
       
  5324 static PyObject *Qd_LMSetScrHRes(PyObject *_self, PyObject *_args)
       
  5325 {
       
  5326 	PyObject *_res = NULL;
       
  5327 	SInt16 value;
       
  5328 #ifndef LMSetScrHRes
       
  5329 	PyMac_PRECHECK(LMSetScrHRes);
       
  5330 #endif
       
  5331 	if (!PyArg_ParseTuple(_args, "h",
       
  5332 	                      &value))
       
  5333 		return NULL;
       
  5334 	LMSetScrHRes(value);
       
  5335 	Py_INCREF(Py_None);
       
  5336 	_res = Py_None;
       
  5337 	return _res;
       
  5338 }
       
  5339 
       
  5340 static PyObject *Qd_LMGetMainDevice(PyObject *_self, PyObject *_args)
       
  5341 {
       
  5342 	PyObject *_res = NULL;
       
  5343 	GDHandle _rv;
       
  5344 #ifndef LMGetMainDevice
       
  5345 	PyMac_PRECHECK(LMGetMainDevice);
       
  5346 #endif
       
  5347 	if (!PyArg_ParseTuple(_args, ""))
       
  5348 		return NULL;
       
  5349 	_rv = LMGetMainDevice();
       
  5350 	_res = Py_BuildValue("O&",
       
  5351 	                     ResObj_New, _rv);
       
  5352 	return _res;
       
  5353 }
       
  5354 
       
  5355 static PyObject *Qd_LMSetMainDevice(PyObject *_self, PyObject *_args)
       
  5356 {
       
  5357 	PyObject *_res = NULL;
       
  5358 	GDHandle value;
       
  5359 #ifndef LMSetMainDevice
       
  5360 	PyMac_PRECHECK(LMSetMainDevice);
       
  5361 #endif
       
  5362 	if (!PyArg_ParseTuple(_args, "O&",
       
  5363 	                      ResObj_Convert, &value))
       
  5364 		return NULL;
       
  5365 	LMSetMainDevice(value);
       
  5366 	Py_INCREF(Py_None);
       
  5367 	_res = Py_None;
       
  5368 	return _res;
       
  5369 }
       
  5370 
       
  5371 static PyObject *Qd_LMGetDeviceList(PyObject *_self, PyObject *_args)
       
  5372 {
       
  5373 	PyObject *_res = NULL;
       
  5374 	GDHandle _rv;
       
  5375 #ifndef LMGetDeviceList
       
  5376 	PyMac_PRECHECK(LMGetDeviceList);
       
  5377 #endif
       
  5378 	if (!PyArg_ParseTuple(_args, ""))
       
  5379 		return NULL;
       
  5380 	_rv = LMGetDeviceList();
       
  5381 	_res = Py_BuildValue("O&",
       
  5382 	                     ResObj_New, _rv);
       
  5383 	return _res;
       
  5384 }
       
  5385 
       
  5386 static PyObject *Qd_LMSetDeviceList(PyObject *_self, PyObject *_args)
       
  5387 {
       
  5388 	PyObject *_res = NULL;
       
  5389 	GDHandle value;
       
  5390 #ifndef LMSetDeviceList
       
  5391 	PyMac_PRECHECK(LMSetDeviceList);
       
  5392 #endif
       
  5393 	if (!PyArg_ParseTuple(_args, "O&",
       
  5394 	                      ResObj_Convert, &value))
       
  5395 		return NULL;
       
  5396 	LMSetDeviceList(value);
       
  5397 	Py_INCREF(Py_None);
       
  5398 	_res = Py_None;
       
  5399 	return _res;
       
  5400 }
       
  5401 
       
  5402 static PyObject *Qd_LMGetQDColors(PyObject *_self, PyObject *_args)
       
  5403 {
       
  5404 	PyObject *_res = NULL;
       
  5405 	Handle _rv;
       
  5406 #ifndef LMGetQDColors
       
  5407 	PyMac_PRECHECK(LMGetQDColors);
       
  5408 #endif
       
  5409 	if (!PyArg_ParseTuple(_args, ""))
       
  5410 		return NULL;
       
  5411 	_rv = LMGetQDColors();
       
  5412 	_res = Py_BuildValue("O&",
       
  5413 	                     ResObj_New, _rv);
       
  5414 	return _res;
       
  5415 }
       
  5416 
       
  5417 static PyObject *Qd_LMSetQDColors(PyObject *_self, PyObject *_args)
       
  5418 {
       
  5419 	PyObject *_res = NULL;
       
  5420 	Handle value;
       
  5421 #ifndef LMSetQDColors
       
  5422 	PyMac_PRECHECK(LMSetQDColors);
       
  5423 #endif
       
  5424 	if (!PyArg_ParseTuple(_args, "O&",
       
  5425 	                      ResObj_Convert, &value))
       
  5426 		return NULL;
       
  5427 	LMSetQDColors(value);
       
  5428 	Py_INCREF(Py_None);
       
  5429 	_res = Py_None;
       
  5430 	return _res;
       
  5431 }
       
  5432 
       
  5433 static PyObject *Qd_LMGetWidthListHand(PyObject *_self, PyObject *_args)
       
  5434 {
       
  5435 	PyObject *_res = NULL;
       
  5436 	Handle _rv;
       
  5437 #ifndef LMGetWidthListHand
       
  5438 	PyMac_PRECHECK(LMGetWidthListHand);
       
  5439 #endif
       
  5440 	if (!PyArg_ParseTuple(_args, ""))
       
  5441 		return NULL;
       
  5442 	_rv = LMGetWidthListHand();
       
  5443 	_res = Py_BuildValue("O&",
       
  5444 	                     ResObj_New, _rv);
       
  5445 	return _res;
       
  5446 }
       
  5447 
       
  5448 static PyObject *Qd_LMSetWidthListHand(PyObject *_self, PyObject *_args)
       
  5449 {
       
  5450 	PyObject *_res = NULL;
       
  5451 	Handle value;
       
  5452 #ifndef LMSetWidthListHand
       
  5453 	PyMac_PRECHECK(LMSetWidthListHand);
       
  5454 #endif
       
  5455 	if (!PyArg_ParseTuple(_args, "O&",
       
  5456 	                      ResObj_Convert, &value))
       
  5457 		return NULL;
       
  5458 	LMSetWidthListHand(value);
       
  5459 	Py_INCREF(Py_None);
       
  5460 	_res = Py_None;
       
  5461 	return _res;
       
  5462 }
       
  5463 
       
  5464 static PyObject *Qd_LMGetHiliteMode(PyObject *_self, PyObject *_args)
       
  5465 {
       
  5466 	PyObject *_res = NULL;
       
  5467 	UInt8 _rv;
       
  5468 #ifndef LMGetHiliteMode
       
  5469 	PyMac_PRECHECK(LMGetHiliteMode);
       
  5470 #endif
       
  5471 	if (!PyArg_ParseTuple(_args, ""))
       
  5472 		return NULL;
       
  5473 	_rv = LMGetHiliteMode();
       
  5474 	_res = Py_BuildValue("b",
       
  5475 	                     _rv);
       
  5476 	return _res;
       
  5477 }
       
  5478 
       
  5479 static PyObject *Qd_LMSetHiliteMode(PyObject *_self, PyObject *_args)
       
  5480 {
       
  5481 	PyObject *_res = NULL;
       
  5482 	UInt8 value;
       
  5483 #ifndef LMSetHiliteMode
       
  5484 	PyMac_PRECHECK(LMSetHiliteMode);
       
  5485 #endif
       
  5486 	if (!PyArg_ParseTuple(_args, "b",
       
  5487 	                      &value))
       
  5488 		return NULL;
       
  5489 	LMSetHiliteMode(value);
       
  5490 	Py_INCREF(Py_None);
       
  5491 	_res = Py_None;
       
  5492 	return _res;
       
  5493 }
       
  5494 
       
  5495 static PyObject *Qd_LMGetWidthTabHandle(PyObject *_self, PyObject *_args)
       
  5496 {
       
  5497 	PyObject *_res = NULL;
       
  5498 	Handle _rv;
       
  5499 #ifndef LMGetWidthTabHandle
       
  5500 	PyMac_PRECHECK(LMGetWidthTabHandle);
       
  5501 #endif
       
  5502 	if (!PyArg_ParseTuple(_args, ""))
       
  5503 		return NULL;
       
  5504 	_rv = LMGetWidthTabHandle();
       
  5505 	_res = Py_BuildValue("O&",
       
  5506 	                     ResObj_New, _rv);
       
  5507 	return _res;
       
  5508 }
       
  5509 
       
  5510 static PyObject *Qd_LMSetWidthTabHandle(PyObject *_self, PyObject *_args)
       
  5511 {
       
  5512 	PyObject *_res = NULL;
       
  5513 	Handle value;
       
  5514 #ifndef LMSetWidthTabHandle
       
  5515 	PyMac_PRECHECK(LMSetWidthTabHandle);
       
  5516 #endif
       
  5517 	if (!PyArg_ParseTuple(_args, "O&",
       
  5518 	                      ResObj_Convert, &value))
       
  5519 		return NULL;
       
  5520 	LMSetWidthTabHandle(value);
       
  5521 	Py_INCREF(Py_None);
       
  5522 	_res = Py_None;
       
  5523 	return _res;
       
  5524 }
       
  5525 
       
  5526 static PyObject *Qd_LMGetLastSPExtra(PyObject *_self, PyObject *_args)
       
  5527 {
       
  5528 	PyObject *_res = NULL;
       
  5529 	SInt32 _rv;
       
  5530 #ifndef LMGetLastSPExtra
       
  5531 	PyMac_PRECHECK(LMGetLastSPExtra);
       
  5532 #endif
       
  5533 	if (!PyArg_ParseTuple(_args, ""))
       
  5534 		return NULL;
       
  5535 	_rv = LMGetLastSPExtra();
       
  5536 	_res = Py_BuildValue("l",
       
  5537 	                     _rv);
       
  5538 	return _res;
       
  5539 }
       
  5540 
       
  5541 static PyObject *Qd_LMSetLastSPExtra(PyObject *_self, PyObject *_args)
       
  5542 {
       
  5543 	PyObject *_res = NULL;
       
  5544 	SInt32 value;
       
  5545 #ifndef LMSetLastSPExtra
       
  5546 	PyMac_PRECHECK(LMSetLastSPExtra);
       
  5547 #endif
       
  5548 	if (!PyArg_ParseTuple(_args, "l",
       
  5549 	                      &value))
       
  5550 		return NULL;
       
  5551 	LMSetLastSPExtra(value);
       
  5552 	Py_INCREF(Py_None);
       
  5553 	_res = Py_None;
       
  5554 	return _res;
       
  5555 }
       
  5556 
       
  5557 static PyObject *Qd_LMGetLastFOND(PyObject *_self, PyObject *_args)
       
  5558 {
       
  5559 	PyObject *_res = NULL;
       
  5560 	Handle _rv;
       
  5561 #ifndef LMGetLastFOND
       
  5562 	PyMac_PRECHECK(LMGetLastFOND);
       
  5563 #endif
       
  5564 	if (!PyArg_ParseTuple(_args, ""))
       
  5565 		return NULL;
       
  5566 	_rv = LMGetLastFOND();
       
  5567 	_res = Py_BuildValue("O&",
       
  5568 	                     ResObj_New, _rv);
       
  5569 	return _res;
       
  5570 }
       
  5571 
       
  5572 static PyObject *Qd_LMSetLastFOND(PyObject *_self, PyObject *_args)
       
  5573 {
       
  5574 	PyObject *_res = NULL;
       
  5575 	Handle value;
       
  5576 #ifndef LMSetLastFOND
       
  5577 	PyMac_PRECHECK(LMSetLastFOND);
       
  5578 #endif
       
  5579 	if (!PyArg_ParseTuple(_args, "O&",
       
  5580 	                      ResObj_Convert, &value))
       
  5581 		return NULL;
       
  5582 	LMSetLastFOND(value);
       
  5583 	Py_INCREF(Py_None);
       
  5584 	_res = Py_None;
       
  5585 	return _res;
       
  5586 }
       
  5587 
       
  5588 static PyObject *Qd_LMGetFractEnable(PyObject *_self, PyObject *_args)
       
  5589 {
       
  5590 	PyObject *_res = NULL;
       
  5591 	UInt8 _rv;
       
  5592 #ifndef LMGetFractEnable
       
  5593 	PyMac_PRECHECK(LMGetFractEnable);
       
  5594 #endif
       
  5595 	if (!PyArg_ParseTuple(_args, ""))
       
  5596 		return NULL;
       
  5597 	_rv = LMGetFractEnable();
       
  5598 	_res = Py_BuildValue("b",
       
  5599 	                     _rv);
       
  5600 	return _res;
       
  5601 }
       
  5602 
       
  5603 static PyObject *Qd_LMSetFractEnable(PyObject *_self, PyObject *_args)
       
  5604 {
       
  5605 	PyObject *_res = NULL;
       
  5606 	UInt8 value;
       
  5607 #ifndef LMSetFractEnable
       
  5608 	PyMac_PRECHECK(LMSetFractEnable);
       
  5609 #endif
       
  5610 	if (!PyArg_ParseTuple(_args, "b",
       
  5611 	                      &value))
       
  5612 		return NULL;
       
  5613 	LMSetFractEnable(value);
       
  5614 	Py_INCREF(Py_None);
       
  5615 	_res = Py_None;
       
  5616 	return _res;
       
  5617 }
       
  5618 
       
  5619 static PyObject *Qd_LMGetTheGDevice(PyObject *_self, PyObject *_args)
       
  5620 {
       
  5621 	PyObject *_res = NULL;
       
  5622 	GDHandle _rv;
       
  5623 #ifndef LMGetTheGDevice
       
  5624 	PyMac_PRECHECK(LMGetTheGDevice);
       
  5625 #endif
       
  5626 	if (!PyArg_ParseTuple(_args, ""))
       
  5627 		return NULL;
       
  5628 	_rv = LMGetTheGDevice();
       
  5629 	_res = Py_BuildValue("O&",
       
  5630 	                     ResObj_New, _rv);
       
  5631 	return _res;
       
  5632 }
       
  5633 
       
  5634 static PyObject *Qd_LMSetTheGDevice(PyObject *_self, PyObject *_args)
       
  5635 {
       
  5636 	PyObject *_res = NULL;
       
  5637 	GDHandle value;
       
  5638 #ifndef LMSetTheGDevice
       
  5639 	PyMac_PRECHECK(LMSetTheGDevice);
       
  5640 #endif
       
  5641 	if (!PyArg_ParseTuple(_args, "O&",
       
  5642 	                      ResObj_Convert, &value))
       
  5643 		return NULL;
       
  5644 	LMSetTheGDevice(value);
       
  5645 	Py_INCREF(Py_None);
       
  5646 	_res = Py_None;
       
  5647 	return _res;
       
  5648 }
       
  5649 
       
  5650 static PyObject *Qd_LMGetHiliteRGB(PyObject *_self, PyObject *_args)
       
  5651 {
       
  5652 	PyObject *_res = NULL;
       
  5653 	RGBColor hiliteRGBValue;
       
  5654 #ifndef LMGetHiliteRGB
       
  5655 	PyMac_PRECHECK(LMGetHiliteRGB);
       
  5656 #endif
       
  5657 	if (!PyArg_ParseTuple(_args, ""))
       
  5658 		return NULL;
       
  5659 	LMGetHiliteRGB(&hiliteRGBValue);
       
  5660 	_res = Py_BuildValue("O&",
       
  5661 	                     QdRGB_New, &hiliteRGBValue);
       
  5662 	return _res;
       
  5663 }
       
  5664 
       
  5665 static PyObject *Qd_LMSetHiliteRGB(PyObject *_self, PyObject *_args)
       
  5666 {
       
  5667 	PyObject *_res = NULL;
       
  5668 	RGBColor hiliteRGBValue;
       
  5669 #ifndef LMSetHiliteRGB
       
  5670 	PyMac_PRECHECK(LMSetHiliteRGB);
       
  5671 #endif
       
  5672 	if (!PyArg_ParseTuple(_args, "O&",
       
  5673 	                      QdRGB_Convert, &hiliteRGBValue))
       
  5674 		return NULL;
       
  5675 	LMSetHiliteRGB(&hiliteRGBValue);
       
  5676 	Py_INCREF(Py_None);
       
  5677 	_res = Py_None;
       
  5678 	return _res;
       
  5679 }
       
  5680 
       
  5681 static PyObject *Qd_LMGetCursorNew(PyObject *_self, PyObject *_args)
       
  5682 {
       
  5683 	PyObject *_res = NULL;
       
  5684 	Boolean _rv;
       
  5685 #ifndef LMGetCursorNew
       
  5686 	PyMac_PRECHECK(LMGetCursorNew);
       
  5687 #endif
       
  5688 	if (!PyArg_ParseTuple(_args, ""))
       
  5689 		return NULL;
       
  5690 	_rv = LMGetCursorNew();
       
  5691 	_res = Py_BuildValue("b",
       
  5692 	                     _rv);
       
  5693 	return _res;
       
  5694 }
       
  5695 
       
  5696 static PyObject *Qd_LMSetCursorNew(PyObject *_self, PyObject *_args)
       
  5697 {
       
  5698 	PyObject *_res = NULL;
       
  5699 	Boolean value;
       
  5700 #ifndef LMSetCursorNew
       
  5701 	PyMac_PRECHECK(LMSetCursorNew);
       
  5702 #endif
       
  5703 	if (!PyArg_ParseTuple(_args, "b",
       
  5704 	                      &value))
       
  5705 		return NULL;
       
  5706 	LMSetCursorNew(value);
       
  5707 	Py_INCREF(Py_None);
       
  5708 	_res = Py_None;
       
  5709 	return _res;
       
  5710 }
       
  5711 
       
  5712 static PyObject *Qd_TextFont(PyObject *_self, PyObject *_args)
       
  5713 {
       
  5714 	PyObject *_res = NULL;
       
  5715 	short font;
       
  5716 #ifndef TextFont
       
  5717 	PyMac_PRECHECK(TextFont);
       
  5718 #endif
       
  5719 	if (!PyArg_ParseTuple(_args, "h",
       
  5720 	                      &font))
       
  5721 		return NULL;
       
  5722 	TextFont(font);
       
  5723 	Py_INCREF(Py_None);
       
  5724 	_res = Py_None;
       
  5725 	return _res;
       
  5726 }
       
  5727 
       
  5728 static PyObject *Qd_TextFace(PyObject *_self, PyObject *_args)
       
  5729 {
       
  5730 	PyObject *_res = NULL;
       
  5731 	StyleParameter face;
       
  5732 #ifndef TextFace
       
  5733 	PyMac_PRECHECK(TextFace);
       
  5734 #endif
       
  5735 	if (!PyArg_ParseTuple(_args, "h",
       
  5736 	                      &face))
       
  5737 		return NULL;
       
  5738 	TextFace(face);
       
  5739 	Py_INCREF(Py_None);
       
  5740 	_res = Py_None;
       
  5741 	return _res;
       
  5742 }
       
  5743 
       
  5744 static PyObject *Qd_TextMode(PyObject *_self, PyObject *_args)
       
  5745 {
       
  5746 	PyObject *_res = NULL;
       
  5747 	short mode;
       
  5748 #ifndef TextMode
       
  5749 	PyMac_PRECHECK(TextMode);
       
  5750 #endif
       
  5751 	if (!PyArg_ParseTuple(_args, "h",
       
  5752 	                      &mode))
       
  5753 		return NULL;
       
  5754 	TextMode(mode);
       
  5755 	Py_INCREF(Py_None);
       
  5756 	_res = Py_None;
       
  5757 	return _res;
       
  5758 }
       
  5759 
       
  5760 static PyObject *Qd_TextSize(PyObject *_self, PyObject *_args)
       
  5761 {
       
  5762 	PyObject *_res = NULL;
       
  5763 	short size;
       
  5764 #ifndef TextSize
       
  5765 	PyMac_PRECHECK(TextSize);
       
  5766 #endif
       
  5767 	if (!PyArg_ParseTuple(_args, "h",
       
  5768 	                      &size))
       
  5769 		return NULL;
       
  5770 	TextSize(size);
       
  5771 	Py_INCREF(Py_None);
       
  5772 	_res = Py_None;
       
  5773 	return _res;
       
  5774 }
       
  5775 
       
  5776 static PyObject *Qd_SpaceExtra(PyObject *_self, PyObject *_args)
       
  5777 {
       
  5778 	PyObject *_res = NULL;
       
  5779 	Fixed extra;
       
  5780 #ifndef SpaceExtra
       
  5781 	PyMac_PRECHECK(SpaceExtra);
       
  5782 #endif
       
  5783 	if (!PyArg_ParseTuple(_args, "O&",
       
  5784 	                      PyMac_GetFixed, &extra))
       
  5785 		return NULL;
       
  5786 	SpaceExtra(extra);
       
  5787 	Py_INCREF(Py_None);
       
  5788 	_res = Py_None;
       
  5789 	return _res;
       
  5790 }
       
  5791 
       
  5792 static PyObject *Qd_DrawChar(PyObject *_self, PyObject *_args)
       
  5793 {
       
  5794 	PyObject *_res = NULL;
       
  5795 	CharParameter ch;
       
  5796 #ifndef DrawChar
       
  5797 	PyMac_PRECHECK(DrawChar);
       
  5798 #endif
       
  5799 	if (!PyArg_ParseTuple(_args, "h",
       
  5800 	                      &ch))
       
  5801 		return NULL;
       
  5802 	DrawChar(ch);
       
  5803 	Py_INCREF(Py_None);
       
  5804 	_res = Py_None;
       
  5805 	return _res;
       
  5806 }
       
  5807 
       
  5808 static PyObject *Qd_DrawString(PyObject *_self, PyObject *_args)
       
  5809 {
       
  5810 	PyObject *_res = NULL;
       
  5811 	Str255 s;
       
  5812 #ifndef DrawString
       
  5813 	PyMac_PRECHECK(DrawString);
       
  5814 #endif
       
  5815 	if (!PyArg_ParseTuple(_args, "O&",
       
  5816 	                      PyMac_GetStr255, s))
       
  5817 		return NULL;
       
  5818 	DrawString(s);
       
  5819 	Py_INCREF(Py_None);
       
  5820 	_res = Py_None;
       
  5821 	return _res;
       
  5822 }
       
  5823 
       
  5824 static PyObject *Qd_MacDrawText(PyObject *_self, PyObject *_args)
       
  5825 {
       
  5826 	PyObject *_res = NULL;
       
  5827 	char *textBuf__in__;
       
  5828 	int textBuf__in_len__;
       
  5829 	short firstByte;
       
  5830 	short byteCount;
       
  5831 #ifndef MacDrawText
       
  5832 	PyMac_PRECHECK(MacDrawText);
       
  5833 #endif
       
  5834 	if (!PyArg_ParseTuple(_args, "s#hh",
       
  5835 	                      &textBuf__in__, &textBuf__in_len__,
       
  5836 	                      &firstByte,
       
  5837 	                      &byteCount))
       
  5838 		return NULL;
       
  5839 	/* Fool compiler warnings */
       
  5840 	textBuf__in_len__ = textBuf__in_len__;
       
  5841 	MacDrawText(textBuf__in__,
       
  5842 	            firstByte,
       
  5843 	            byteCount);
       
  5844 	Py_INCREF(Py_None);
       
  5845 	_res = Py_None;
       
  5846 	return _res;
       
  5847 }
       
  5848 
       
  5849 static PyObject *Qd_CharWidth(PyObject *_self, PyObject *_args)
       
  5850 {
       
  5851 	PyObject *_res = NULL;
       
  5852 	short _rv;
       
  5853 	CharParameter ch;
       
  5854 #ifndef CharWidth
       
  5855 	PyMac_PRECHECK(CharWidth);
       
  5856 #endif
       
  5857 	if (!PyArg_ParseTuple(_args, "h",
       
  5858 	                      &ch))
       
  5859 		return NULL;
       
  5860 	_rv = CharWidth(ch);
       
  5861 	_res = Py_BuildValue("h",
       
  5862 	                     _rv);
       
  5863 	return _res;
       
  5864 }
       
  5865 
       
  5866 static PyObject *Qd_StringWidth(PyObject *_self, PyObject *_args)
       
  5867 {
       
  5868 	PyObject *_res = NULL;
       
  5869 	short _rv;
       
  5870 	Str255 s;
       
  5871 #ifndef StringWidth
       
  5872 	PyMac_PRECHECK(StringWidth);
       
  5873 #endif
       
  5874 	if (!PyArg_ParseTuple(_args, "O&",
       
  5875 	                      PyMac_GetStr255, s))
       
  5876 		return NULL;
       
  5877 	_rv = StringWidth(s);
       
  5878 	_res = Py_BuildValue("h",
       
  5879 	                     _rv);
       
  5880 	return _res;
       
  5881 }
       
  5882 
       
  5883 static PyObject *Qd_TextWidth(PyObject *_self, PyObject *_args)
       
  5884 {
       
  5885 	PyObject *_res = NULL;
       
  5886 	short _rv;
       
  5887 	char *textBuf__in__;
       
  5888 	int textBuf__in_len__;
       
  5889 	short firstByte;
       
  5890 	short byteCount;
       
  5891 #ifndef TextWidth
       
  5892 	PyMac_PRECHECK(TextWidth);
       
  5893 #endif
       
  5894 	if (!PyArg_ParseTuple(_args, "s#hh",
       
  5895 	                      &textBuf__in__, &textBuf__in_len__,
       
  5896 	                      &firstByte,
       
  5897 	                      &byteCount))
       
  5898 		return NULL;
       
  5899 	/* Fool compiler warnings */
       
  5900 	textBuf__in_len__ = textBuf__in_len__;
       
  5901 	_rv = TextWidth(textBuf__in__,
       
  5902 	                firstByte,
       
  5903 	                byteCount);
       
  5904 	_res = Py_BuildValue("h",
       
  5905 	                     _rv);
       
  5906 	return _res;
       
  5907 }
       
  5908 
       
  5909 static PyObject *Qd_GetFontInfo(PyObject *_self, PyObject *_args)
       
  5910 {
       
  5911 	PyObject *_res = NULL;
       
  5912 	FontInfo info;
       
  5913 #ifndef GetFontInfo
       
  5914 	PyMac_PRECHECK(GetFontInfo);
       
  5915 #endif
       
  5916 	if (!PyArg_ParseTuple(_args, ""))
       
  5917 		return NULL;
       
  5918 	GetFontInfo(&info);
       
  5919 	_res = Py_BuildValue("O&",
       
  5920 	                     QdFI_New, &info);
       
  5921 	return _res;
       
  5922 }
       
  5923 
       
  5924 static PyObject *Qd_CharExtra(PyObject *_self, PyObject *_args)
       
  5925 {
       
  5926 	PyObject *_res = NULL;
       
  5927 	Fixed extra;
       
  5928 #ifndef CharExtra
       
  5929 	PyMac_PRECHECK(CharExtra);
       
  5930 #endif
       
  5931 	if (!PyArg_ParseTuple(_args, "O&",
       
  5932 	                      PyMac_GetFixed, &extra))
       
  5933 		return NULL;
       
  5934 	CharExtra(extra);
       
  5935 	Py_INCREF(Py_None);
       
  5936 	_res = Py_None;
       
  5937 	return _res;
       
  5938 }
       
  5939 
       
  5940 static PyObject *Qd_TruncString(PyObject *_self, PyObject *_args)
       
  5941 {
       
  5942 	PyObject *_res = NULL;
       
  5943 	short _rv;
       
  5944 	short width;
       
  5945 	Str255 theString;
       
  5946 	TruncCode truncWhere;
       
  5947 #ifndef TruncString
       
  5948 	PyMac_PRECHECK(TruncString);
       
  5949 #endif
       
  5950 	if (!PyArg_ParseTuple(_args, "hO&h",
       
  5951 	                      &width,
       
  5952 	                      PyMac_GetStr255, theString,
       
  5953 	                      &truncWhere))
       
  5954 		return NULL;
       
  5955 	_rv = TruncString(width,
       
  5956 	                  theString,
       
  5957 	                  truncWhere);
       
  5958 	_res = Py_BuildValue("h",
       
  5959 	                     _rv);
       
  5960 	return _res;
       
  5961 }
       
  5962 
       
  5963 static PyObject *Qd_SetPort(PyObject *_self, PyObject *_args)
       
  5964 {
       
  5965 	PyObject *_res = NULL;
       
  5966 	GrafPtr thePort;
       
  5967 #ifndef SetPort
       
  5968 	PyMac_PRECHECK(SetPort);
       
  5969 #endif
       
  5970 	if (!PyArg_ParseTuple(_args, "O&",
       
  5971 	                      GrafObj_Convert, &thePort))
       
  5972 		return NULL;
       
  5973 	SetPort(thePort);
       
  5974 	Py_INCREF(Py_None);
       
  5975 	_res = Py_None;
       
  5976 	return _res;
       
  5977 }
       
  5978 
       
  5979 static PyObject *Qd_GetCursor(PyObject *_self, PyObject *_args)
       
  5980 {
       
  5981 	PyObject *_res = NULL;
       
  5982 	CursHandle _rv;
       
  5983 	short cursorID;
       
  5984 #ifndef GetCursor
       
  5985 	PyMac_PRECHECK(GetCursor);
       
  5986 #endif
       
  5987 	if (!PyArg_ParseTuple(_args, "h",
       
  5988 	                      &cursorID))
       
  5989 		return NULL;
       
  5990 	_rv = GetCursor(cursorID);
       
  5991 	_res = Py_BuildValue("O&",
       
  5992 	                     ResObj_New, _rv);
       
  5993 	return _res;
       
  5994 }
       
  5995 
       
  5996 static PyObject *Qd_SetCursor(PyObject *_self, PyObject *_args)
       
  5997 {
       
  5998 	PyObject *_res = NULL;
       
  5999 	Cursor *crsr__in__;
       
  6000 	int crsr__in_len__;
       
  6001 #ifndef SetCursor
       
  6002 	PyMac_PRECHECK(SetCursor);
       
  6003 #endif
       
  6004 	if (!PyArg_ParseTuple(_args, "s#",
       
  6005 	                      (char **)&crsr__in__, &crsr__in_len__))
       
  6006 		return NULL;
       
  6007 	if (crsr__in_len__ != sizeof(Cursor))
       
  6008 	{
       
  6009 		PyErr_SetString(PyExc_TypeError, "buffer length should be sizeof(Cursor)");
       
  6010 		goto crsr__error__;
       
  6011 	}
       
  6012 	SetCursor(crsr__in__);
       
  6013 	Py_INCREF(Py_None);
       
  6014 	_res = Py_None;
       
  6015  crsr__error__: ;
       
  6016 	return _res;
       
  6017 }
       
  6018 
       
  6019 static PyObject *Qd_ShowCursor(PyObject *_self, PyObject *_args)
       
  6020 {
       
  6021 	PyObject *_res = NULL;
       
  6022 #ifndef ShowCursor
       
  6023 	PyMac_PRECHECK(ShowCursor);
       
  6024 #endif
       
  6025 	if (!PyArg_ParseTuple(_args, ""))
       
  6026 		return NULL;
       
  6027 	ShowCursor();
       
  6028 	Py_INCREF(Py_None);
       
  6029 	_res = Py_None;
       
  6030 	return _res;
       
  6031 }
       
  6032 
       
  6033 static PyObject *Qd_LineTo(PyObject *_self, PyObject *_args)
       
  6034 {
       
  6035 	PyObject *_res = NULL;
       
  6036 	short h;
       
  6037 	short v;
       
  6038 #ifndef LineTo
       
  6039 	PyMac_PRECHECK(LineTo);
       
  6040 #endif
       
  6041 	if (!PyArg_ParseTuple(_args, "hh",
       
  6042 	                      &h,
       
  6043 	                      &v))
       
  6044 		return NULL;
       
  6045 	LineTo(h,
       
  6046 	       v);
       
  6047 	Py_INCREF(Py_None);
       
  6048 	_res = Py_None;
       
  6049 	return _res;
       
  6050 }
       
  6051 
       
  6052 static PyObject *Qd_SetRect(PyObject *_self, PyObject *_args)
       
  6053 {
       
  6054 	PyObject *_res = NULL;
       
  6055 	Rect r;
       
  6056 	short left;
       
  6057 	short top;
       
  6058 	short right;
       
  6059 	short bottom;
       
  6060 #ifndef SetRect
       
  6061 	PyMac_PRECHECK(SetRect);
       
  6062 #endif
       
  6063 	if (!PyArg_ParseTuple(_args, "hhhh",
       
  6064 	                      &left,
       
  6065 	                      &top,
       
  6066 	                      &right,
       
  6067 	                      &bottom))
       
  6068 		return NULL;
       
  6069 	SetRect(&r,
       
  6070 	        left,
       
  6071 	        top,
       
  6072 	        right,
       
  6073 	        bottom);
       
  6074 	_res = Py_BuildValue("O&",
       
  6075 	                     PyMac_BuildRect, &r);
       
  6076 	return _res;
       
  6077 }
       
  6078 
       
  6079 static PyObject *Qd_OffsetRect(PyObject *_self, PyObject *_args)
       
  6080 {
       
  6081 	PyObject *_res = NULL;
       
  6082 	Rect r;
       
  6083 	short dh;
       
  6084 	short dv;
       
  6085 #ifndef OffsetRect
       
  6086 	PyMac_PRECHECK(OffsetRect);
       
  6087 #endif
       
  6088 	if (!PyArg_ParseTuple(_args, "O&hh",
       
  6089 	                      PyMac_GetRect, &r,
       
  6090 	                      &dh,
       
  6091 	                      &dv))
       
  6092 		return NULL;
       
  6093 	OffsetRect(&r,
       
  6094 	           dh,
       
  6095 	           dv);
       
  6096 	_res = Py_BuildValue("O&",
       
  6097 	                     PyMac_BuildRect, &r);
       
  6098 	return _res;
       
  6099 }
       
  6100 
       
  6101 static PyObject *Qd_InsetRect(PyObject *_self, PyObject *_args)
       
  6102 {
       
  6103 	PyObject *_res = NULL;
       
  6104 	Rect r;
       
  6105 	short dh;
       
  6106 	short dv;
       
  6107 #ifndef InsetRect
       
  6108 	PyMac_PRECHECK(InsetRect);
       
  6109 #endif
       
  6110 	if (!PyArg_ParseTuple(_args, "O&hh",
       
  6111 	                      PyMac_GetRect, &r,
       
  6112 	                      &dh,
       
  6113 	                      &dv))
       
  6114 		return NULL;
       
  6115 	InsetRect(&r,
       
  6116 	          dh,
       
  6117 	          dv);
       
  6118 	_res = Py_BuildValue("O&",
       
  6119 	                     PyMac_BuildRect, &r);
       
  6120 	return _res;
       
  6121 }
       
  6122 
       
  6123 static PyObject *Qd_UnionRect(PyObject *_self, PyObject *_args)
       
  6124 {
       
  6125 	PyObject *_res = NULL;
       
  6126 	Rect src1;
       
  6127 	Rect src2;
       
  6128 	Rect dstRect;
       
  6129 #ifndef UnionRect
       
  6130 	PyMac_PRECHECK(UnionRect);
       
  6131 #endif
       
  6132 	if (!PyArg_ParseTuple(_args, "O&O&",
       
  6133 	                      PyMac_GetRect, &src1,
       
  6134 	                      PyMac_GetRect, &src2))
       
  6135 		return NULL;
       
  6136 	UnionRect(&src1,
       
  6137 	          &src2,
       
  6138 	          &dstRect);
       
  6139 	_res = Py_BuildValue("O&",
       
  6140 	                     PyMac_BuildRect, &dstRect);
       
  6141 	return _res;
       
  6142 }
       
  6143 
       
  6144 static PyObject *Qd_EqualRect(PyObject *_self, PyObject *_args)
       
  6145 {
       
  6146 	PyObject *_res = NULL;
       
  6147 	Boolean _rv;
       
  6148 	Rect rect1;
       
  6149 	Rect rect2;
       
  6150 #ifndef EqualRect
       
  6151 	PyMac_PRECHECK(EqualRect);
       
  6152 #endif
       
  6153 	if (!PyArg_ParseTuple(_args, "O&O&",
       
  6154 	                      PyMac_GetRect, &rect1,
       
  6155 	                      PyMac_GetRect, &rect2))
       
  6156 		return NULL;
       
  6157 	_rv = EqualRect(&rect1,
       
  6158 	                &rect2);
       
  6159 	_res = Py_BuildValue("b",
       
  6160 	                     _rv);
       
  6161 	return _res;
       
  6162 }
       
  6163 
       
  6164 static PyObject *Qd_FrameRect(PyObject *_self, PyObject *_args)
       
  6165 {
       
  6166 	PyObject *_res = NULL;
       
  6167 	Rect r;
       
  6168 #ifndef FrameRect
       
  6169 	PyMac_PRECHECK(FrameRect);
       
  6170 #endif
       
  6171 	if (!PyArg_ParseTuple(_args, "O&",
       
  6172 	                      PyMac_GetRect, &r))
       
  6173 		return NULL;
       
  6174 	FrameRect(&r);
       
  6175 	Py_INCREF(Py_None);
       
  6176 	_res = Py_None;
       
  6177 	return _res;
       
  6178 }
       
  6179 
       
  6180 static PyObject *Qd_InvertRect(PyObject *_self, PyObject *_args)
       
  6181 {
       
  6182 	PyObject *_res = NULL;
       
  6183 	Rect r;
       
  6184 #ifndef InvertRect
       
  6185 	PyMac_PRECHECK(InvertRect);
       
  6186 #endif
       
  6187 	if (!PyArg_ParseTuple(_args, "O&",
       
  6188 	                      PyMac_GetRect, &r))
       
  6189 		return NULL;
       
  6190 	InvertRect(&r);
       
  6191 	Py_INCREF(Py_None);
       
  6192 	_res = Py_None;
       
  6193 	return _res;
       
  6194 }
       
  6195 
       
  6196 static PyObject *Qd_FillRect(PyObject *_self, PyObject *_args)
       
  6197 {
       
  6198 	PyObject *_res = NULL;
       
  6199 	Rect r;
       
  6200 	Pattern *pat__in__;
       
  6201 	int pat__in_len__;
       
  6202 #ifndef FillRect
       
  6203 	PyMac_PRECHECK(FillRect);
       
  6204 #endif
       
  6205 	if (!PyArg_ParseTuple(_args, "O&s#",
       
  6206 	                      PyMac_GetRect, &r,
       
  6207 	                      (char **)&pat__in__, &pat__in_len__))
       
  6208 		return NULL;
       
  6209 	if (pat__in_len__ != sizeof(Pattern))
       
  6210 	{
       
  6211 		PyErr_SetString(PyExc_TypeError, "buffer length should be sizeof(Pattern)");
       
  6212 		goto pat__error__;
       
  6213 	}
       
  6214 	FillRect(&r,
       
  6215 	         pat__in__);
       
  6216 	Py_INCREF(Py_None);
       
  6217 	_res = Py_None;
       
  6218  pat__error__: ;
       
  6219 	return _res;
       
  6220 }
       
  6221 
       
  6222 static PyObject *Qd_CopyRgn(PyObject *_self, PyObject *_args)
       
  6223 {
       
  6224 	PyObject *_res = NULL;
       
  6225 	RgnHandle srcRgn;
       
  6226 	RgnHandle dstRgn;
       
  6227 #ifndef CopyRgn
       
  6228 	PyMac_PRECHECK(CopyRgn);
       
  6229 #endif
       
  6230 	if (!PyArg_ParseTuple(_args, "O&O&",
       
  6231 	                      ResObj_Convert, &srcRgn,
       
  6232 	                      ResObj_Convert, &dstRgn))
       
  6233 		return NULL;
       
  6234 	CopyRgn(srcRgn,
       
  6235 	        dstRgn);
       
  6236 	Py_INCREF(Py_None);
       
  6237 	_res = Py_None;
       
  6238 	return _res;
       
  6239 }
       
  6240 
       
  6241 static PyObject *Qd_SetRectRgn(PyObject *_self, PyObject *_args)
       
  6242 {
       
  6243 	PyObject *_res = NULL;
       
  6244 	RgnHandle rgn;
       
  6245 	short left;
       
  6246 	short top;
       
  6247 	short right;
       
  6248 	short bottom;
       
  6249 #ifndef SetRectRgn
       
  6250 	PyMac_PRECHECK(SetRectRgn);
       
  6251 #endif
       
  6252 	if (!PyArg_ParseTuple(_args, "O&hhhh",
       
  6253 	                      ResObj_Convert, &rgn,
       
  6254 	                      &left,
       
  6255 	                      &top,
       
  6256 	                      &right,
       
  6257 	                      &bottom))
       
  6258 		return NULL;
       
  6259 	SetRectRgn(rgn,
       
  6260 	           left,
       
  6261 	           top,
       
  6262 	           right,
       
  6263 	           bottom);
       
  6264 	Py_INCREF(Py_None);
       
  6265 	_res = Py_None;
       
  6266 	return _res;
       
  6267 }
       
  6268 
       
  6269 static PyObject *Qd_OffsetRgn(PyObject *_self, PyObject *_args)
       
  6270 {
       
  6271 	PyObject *_res = NULL;
       
  6272 	RgnHandle rgn;
       
  6273 	short dh;
       
  6274 	short dv;
       
  6275 #ifndef OffsetRgn
       
  6276 	PyMac_PRECHECK(OffsetRgn);
       
  6277 #endif
       
  6278 	if (!PyArg_ParseTuple(_args, "O&hh",
       
  6279 	                      ResObj_Convert, &rgn,
       
  6280 	                      &dh,
       
  6281 	                      &dv))
       
  6282 		return NULL;
       
  6283 	OffsetRgn(rgn,
       
  6284 	          dh,
       
  6285 	          dv);
       
  6286 	Py_INCREF(Py_None);
       
  6287 	_res = Py_None;
       
  6288 	return _res;
       
  6289 }
       
  6290 
       
  6291 static PyObject *Qd_UnionRgn(PyObject *_self, PyObject *_args)
       
  6292 {
       
  6293 	PyObject *_res = NULL;
       
  6294 	RgnHandle srcRgnA;
       
  6295 	RgnHandle srcRgnB;
       
  6296 	RgnHandle dstRgn;
       
  6297 #ifndef UnionRgn
       
  6298 	PyMac_PRECHECK(UnionRgn);
       
  6299 #endif
       
  6300 	if (!PyArg_ParseTuple(_args, "O&O&O&",
       
  6301 	                      ResObj_Convert, &srcRgnA,
       
  6302 	                      ResObj_Convert, &srcRgnB,
       
  6303 	                      ResObj_Convert, &dstRgn))
       
  6304 		return NULL;
       
  6305 	UnionRgn(srcRgnA,
       
  6306 	         srcRgnB,
       
  6307 	         dstRgn);
       
  6308 	Py_INCREF(Py_None);
       
  6309 	_res = Py_None;
       
  6310 	return _res;
       
  6311 }
       
  6312 
       
  6313 static PyObject *Qd_XorRgn(PyObject *_self, PyObject *_args)
       
  6314 {
       
  6315 	PyObject *_res = NULL;
       
  6316 	RgnHandle srcRgnA;
       
  6317 	RgnHandle srcRgnB;
       
  6318 	RgnHandle dstRgn;
       
  6319 #ifndef XorRgn
       
  6320 	PyMac_PRECHECK(XorRgn);
       
  6321 #endif
       
  6322 	if (!PyArg_ParseTuple(_args, "O&O&O&",
       
  6323 	                      ResObj_Convert, &srcRgnA,
       
  6324 	                      ResObj_Convert, &srcRgnB,
       
  6325 	                      ResObj_Convert, &dstRgn))
       
  6326 		return NULL;
       
  6327 	XorRgn(srcRgnA,
       
  6328 	       srcRgnB,
       
  6329 	       dstRgn);
       
  6330 	Py_INCREF(Py_None);
       
  6331 	_res = Py_None;
       
  6332 	return _res;
       
  6333 }
       
  6334 
       
  6335 static PyObject *Qd_EqualRgn(PyObject *_self, PyObject *_args)
       
  6336 {
       
  6337 	PyObject *_res = NULL;
       
  6338 	Boolean _rv;
       
  6339 	RgnHandle rgnA;
       
  6340 	RgnHandle rgnB;
       
  6341 #ifndef EqualRgn
       
  6342 	PyMac_PRECHECK(EqualRgn);
       
  6343 #endif
       
  6344 	if (!PyArg_ParseTuple(_args, "O&O&",
       
  6345 	                      ResObj_Convert, &rgnA,
       
  6346 	                      ResObj_Convert, &rgnB))
       
  6347 		return NULL;
       
  6348 	_rv = EqualRgn(rgnA,
       
  6349 	               rgnB);
       
  6350 	_res = Py_BuildValue("b",
       
  6351 	                     _rv);
       
  6352 	return _res;
       
  6353 }
       
  6354 
       
  6355 static PyObject *Qd_FrameRgn(PyObject *_self, PyObject *_args)
       
  6356 {
       
  6357 	PyObject *_res = NULL;
       
  6358 	RgnHandle rgn;
       
  6359 #ifndef FrameRgn
       
  6360 	PyMac_PRECHECK(FrameRgn);
       
  6361 #endif
       
  6362 	if (!PyArg_ParseTuple(_args, "O&",
       
  6363 	                      ResObj_Convert, &rgn))
       
  6364 		return NULL;
       
  6365 	FrameRgn(rgn);
       
  6366 	Py_INCREF(Py_None);
       
  6367 	_res = Py_None;
       
  6368 	return _res;
       
  6369 }
       
  6370 
       
  6371 static PyObject *Qd_PaintRgn(PyObject *_self, PyObject *_args)
       
  6372 {
       
  6373 	PyObject *_res = NULL;
       
  6374 	RgnHandle rgn;
       
  6375 #ifndef PaintRgn
       
  6376 	PyMac_PRECHECK(PaintRgn);
       
  6377 #endif
       
  6378 	if (!PyArg_ParseTuple(_args, "O&",
       
  6379 	                      ResObj_Convert, &rgn))
       
  6380 		return NULL;
       
  6381 	PaintRgn(rgn);
       
  6382 	Py_INCREF(Py_None);
       
  6383 	_res = Py_None;
       
  6384 	return _res;
       
  6385 }
       
  6386 
       
  6387 static PyObject *Qd_InvertRgn(PyObject *_self, PyObject *_args)
       
  6388 {
       
  6389 	PyObject *_res = NULL;
       
  6390 	RgnHandle rgn;
       
  6391 #ifndef InvertRgn
       
  6392 	PyMac_PRECHECK(InvertRgn);
       
  6393 #endif
       
  6394 	if (!PyArg_ParseTuple(_args, "O&",
       
  6395 	                      ResObj_Convert, &rgn))
       
  6396 		return NULL;
       
  6397 	InvertRgn(rgn);
       
  6398 	Py_INCREF(Py_None);
       
  6399 	_res = Py_None;
       
  6400 	return _res;
       
  6401 }
       
  6402 
       
  6403 static PyObject *Qd_FillRgn(PyObject *_self, PyObject *_args)
       
  6404 {
       
  6405 	PyObject *_res = NULL;
       
  6406 	RgnHandle rgn;
       
  6407 	Pattern *pat__in__;
       
  6408 	int pat__in_len__;
       
  6409 #ifndef FillRgn
       
  6410 	PyMac_PRECHECK(FillRgn);
       
  6411 #endif
       
  6412 	if (!PyArg_ParseTuple(_args, "O&s#",
       
  6413 	                      ResObj_Convert, &rgn,
       
  6414 	                      (char **)&pat__in__, &pat__in_len__))
       
  6415 		return NULL;
       
  6416 	if (pat__in_len__ != sizeof(Pattern))
       
  6417 	{
       
  6418 		PyErr_SetString(PyExc_TypeError, "buffer length should be sizeof(Pattern)");
       
  6419 		goto pat__error__;
       
  6420 	}
       
  6421 	FillRgn(rgn,
       
  6422 	        pat__in__);
       
  6423 	Py_INCREF(Py_None);
       
  6424 	_res = Py_None;
       
  6425  pat__error__: ;
       
  6426 	return _res;
       
  6427 }
       
  6428 
       
  6429 static PyObject *Qd_GetPixel(PyObject *_self, PyObject *_args)
       
  6430 {
       
  6431 	PyObject *_res = NULL;
       
  6432 	Boolean _rv;
       
  6433 	short h;
       
  6434 	short v;
       
  6435 #ifndef GetPixel
       
  6436 	PyMac_PRECHECK(GetPixel);
       
  6437 #endif
       
  6438 	if (!PyArg_ParseTuple(_args, "hh",
       
  6439 	                      &h,
       
  6440 	                      &v))
       
  6441 		return NULL;
       
  6442 	_rv = GetPixel(h,
       
  6443 	               v);
       
  6444 	_res = Py_BuildValue("b",
       
  6445 	                     _rv);
       
  6446 	return _res;
       
  6447 }
       
  6448 
       
  6449 static PyObject *Qd_PtInRect(PyObject *_self, PyObject *_args)
       
  6450 {
       
  6451 	PyObject *_res = NULL;
       
  6452 	Boolean _rv;
       
  6453 	Point pt;
       
  6454 	Rect r;
       
  6455 #ifndef PtInRect
       
  6456 	PyMac_PRECHECK(PtInRect);
       
  6457 #endif
       
  6458 	if (!PyArg_ParseTuple(_args, "O&O&",
       
  6459 	                      PyMac_GetPoint, &pt,
       
  6460 	                      PyMac_GetRect, &r))
       
  6461 		return NULL;
       
  6462 	_rv = PtInRect(pt,
       
  6463 	               &r);
       
  6464 	_res = Py_BuildValue("b",
       
  6465 	                     _rv);
       
  6466 	return _res;
       
  6467 }
       
  6468 
       
  6469 static PyObject *Qd_DrawText(PyObject *_self, PyObject *_args)
       
  6470 {
       
  6471 	PyObject *_res = NULL;
       
  6472 	char *textBuf__in__;
       
  6473 	int textBuf__in_len__;
       
  6474 	short firstByte;
       
  6475 	short byteCount;
       
  6476 #ifndef DrawText
       
  6477 	PyMac_PRECHECK(DrawText);
       
  6478 #endif
       
  6479 	if (!PyArg_ParseTuple(_args, "s#hh",
       
  6480 	                      &textBuf__in__, &textBuf__in_len__,
       
  6481 	                      &firstByte,
       
  6482 	                      &byteCount))
       
  6483 		return NULL;
       
  6484 	/* Fool compiler warnings */
       
  6485 	textBuf__in_len__ = textBuf__in_len__;
       
  6486 	DrawText(textBuf__in__,
       
  6487 	         firstByte,
       
  6488 	         byteCount);
       
  6489 	Py_INCREF(Py_None);
       
  6490 	_res = Py_None;
       
  6491 	return _res;
       
  6492 }
       
  6493 
       
  6494 static PyObject *Qd_BitMap(PyObject *_self, PyObject *_args)
       
  6495 {
       
  6496 	PyObject *_res = NULL;
       
  6497 
       
  6498 	BitMap *ptr;
       
  6499 	PyObject *source;
       
  6500 	Rect bounds;
       
  6501 	int rowbytes;
       
  6502 	char *data;
       
  6503 
       
  6504 	if ( !PyArg_ParseTuple(_args, "O!iO&", &PyString_Type, &source, &rowbytes, PyMac_GetRect,
       
  6505 	                &bounds) )
       
  6506 	        return NULL;
       
  6507 	data = PyString_AsString(source);
       
  6508 	if ((ptr=(BitMap *)malloc(sizeof(BitMap))) == NULL )
       
  6509 	        return PyErr_NoMemory();
       
  6510 	ptr->baseAddr = (Ptr)data;
       
  6511 	ptr->rowBytes = rowbytes;
       
  6512 	ptr->bounds = bounds;
       
  6513 	if ( (_res = BMObj_New(ptr)) == NULL ) {
       
  6514 	        free(ptr);
       
  6515 	        return NULL;
       
  6516 	}
       
  6517 	((BitMapObject *)_res)->referred_object = source;
       
  6518 	Py_INCREF(source);
       
  6519 	((BitMapObject *)_res)->referred_bitmap = ptr;
       
  6520 	return _res;
       
  6521 
       
  6522 }
       
  6523 
       
  6524 static PyObject *Qd_RawBitMap(PyObject *_self, PyObject *_args)
       
  6525 {
       
  6526 	PyObject *_res = NULL;
       
  6527 
       
  6528 	BitMap *ptr;
       
  6529 	PyObject *source;
       
  6530 
       
  6531 	if ( !PyArg_ParseTuple(_args, "O!", &PyString_Type, &source) )
       
  6532 	        return NULL;
       
  6533 	if ( PyString_Size(source) != sizeof(BitMap) && PyString_Size(source) != sizeof(PixMap) ) {
       
  6534 	        PyErr_Format(PyExc_TypeError,
       
  6535 	                "Argument size was %ld, should be %lu (sizeof BitMap) or %lu (sizeof PixMap)",
       
  6536 	                PyString_Size(source), sizeof(BitMap), sizeof(PixMap));
       
  6537 	        return NULL;
       
  6538 	}
       
  6539 	ptr = (BitMapPtr)PyString_AsString(source);
       
  6540 	if ( (_res = BMObj_New(ptr)) == NULL ) {
       
  6541 	        return NULL;
       
  6542 	}
       
  6543 	((BitMapObject *)_res)->referred_object = source;
       
  6544 	Py_INCREF(source);
       
  6545 	return _res;
       
  6546 
       
  6547 }
       
  6548 #endif /* __LP64__ */
       
  6549 
       
  6550 static PyMethodDef Qd_methods[] = {
       
  6551 #ifndef __LP64__
       
  6552 	{"GetPort", (PyCFunction)Qd_GetPort, 1,
       
  6553 	 PyDoc_STR("() -> (GrafPtr port)")},
       
  6554 	{"GrafDevice", (PyCFunction)Qd_GrafDevice, 1,
       
  6555 	 PyDoc_STR("(short device) -> None")},
       
  6556 	{"SetPortBits", (PyCFunction)Qd_SetPortBits, 1,
       
  6557 	 PyDoc_STR("(BitMapPtr bm) -> None")},
       
  6558 	{"PortSize", (PyCFunction)Qd_PortSize, 1,
       
  6559 	 PyDoc_STR("(short width, short height) -> None")},
       
  6560 	{"MovePortTo", (PyCFunction)Qd_MovePortTo, 1,
       
  6561 	 PyDoc_STR("(short leftGlobal, short topGlobal) -> None")},
       
  6562 	{"SetOrigin", (PyCFunction)Qd_SetOrigin, 1,
       
  6563 	 PyDoc_STR("(short h, short v) -> None")},
       
  6564 	{"SetClip", (PyCFunction)Qd_SetClip, 1,
       
  6565 	 PyDoc_STR("(RgnHandle rgn) -> None")},
       
  6566 	{"GetClip", (PyCFunction)Qd_GetClip, 1,
       
  6567 	 PyDoc_STR("(RgnHandle rgn) -> None")},
       
  6568 	{"ClipRect", (PyCFunction)Qd_ClipRect, 1,
       
  6569 	 PyDoc_STR("(Rect r) -> None")},
       
  6570 	{"BackPat", (PyCFunction)Qd_BackPat, 1,
       
  6571 	 PyDoc_STR("(Pattern pat) -> None")},
       
  6572 	{"InitCursor", (PyCFunction)Qd_InitCursor, 1,
       
  6573 	 PyDoc_STR("() -> None")},
       
  6574 	{"MacSetCursor", (PyCFunction)Qd_MacSetCursor, 1,
       
  6575 	 PyDoc_STR("(Cursor crsr) -> None")},
       
  6576 	{"HideCursor", (PyCFunction)Qd_HideCursor, 1,
       
  6577 	 PyDoc_STR("() -> None")},
       
  6578 	{"MacShowCursor", (PyCFunction)Qd_MacShowCursor, 1,
       
  6579 	 PyDoc_STR("() -> None")},
       
  6580 	{"ObscureCursor", (PyCFunction)Qd_ObscureCursor, 1,
       
  6581 	 PyDoc_STR("() -> None")},
       
  6582 	{"HidePen", (PyCFunction)Qd_HidePen, 1,
       
  6583 	 PyDoc_STR("() -> None")},
       
  6584 	{"ShowPen", (PyCFunction)Qd_ShowPen, 1,
       
  6585 	 PyDoc_STR("() -> None")},
       
  6586 	{"GetPen", (PyCFunction)Qd_GetPen, 1,
       
  6587 	 PyDoc_STR("() -> (Point pt)")},
       
  6588 	{"GetPenState", (PyCFunction)Qd_GetPenState, 1,
       
  6589 	 PyDoc_STR("() -> (PenState pnState)")},
       
  6590 	{"SetPenState", (PyCFunction)Qd_SetPenState, 1,
       
  6591 	 PyDoc_STR("(PenState pnState) -> None")},
       
  6592 	{"PenSize", (PyCFunction)Qd_PenSize, 1,
       
  6593 	 PyDoc_STR("(short width, short height) -> None")},
       
  6594 	{"PenMode", (PyCFunction)Qd_PenMode, 1,
       
  6595 	 PyDoc_STR("(short mode) -> None")},
       
  6596 	{"PenPat", (PyCFunction)Qd_PenPat, 1,
       
  6597 	 PyDoc_STR("(Pattern pat) -> None")},
       
  6598 	{"PenNormal", (PyCFunction)Qd_PenNormal, 1,
       
  6599 	 PyDoc_STR("() -> None")},
       
  6600 	{"MoveTo", (PyCFunction)Qd_MoveTo, 1,
       
  6601 	 PyDoc_STR("(short h, short v) -> None")},
       
  6602 	{"Move", (PyCFunction)Qd_Move, 1,
       
  6603 	 PyDoc_STR("(short dh, short dv) -> None")},
       
  6604 	{"MacLineTo", (PyCFunction)Qd_MacLineTo, 1,
       
  6605 	 PyDoc_STR("(short h, short v) -> None")},
       
  6606 	{"Line", (PyCFunction)Qd_Line, 1,
       
  6607 	 PyDoc_STR("(short dh, short dv) -> None")},
       
  6608 	{"ForeColor", (PyCFunction)Qd_ForeColor, 1,
       
  6609 	 PyDoc_STR("(long color) -> None")},
       
  6610 	{"BackColor", (PyCFunction)Qd_BackColor, 1,
       
  6611 	 PyDoc_STR("(long color) -> None")},
       
  6612 	{"ColorBit", (PyCFunction)Qd_ColorBit, 1,
       
  6613 	 PyDoc_STR("(short whichBit) -> None")},
       
  6614 	{"MacSetRect", (PyCFunction)Qd_MacSetRect, 1,
       
  6615 	 PyDoc_STR("(short left, short top, short right, short bottom) -> (Rect r)")},
       
  6616 	{"MacOffsetRect", (PyCFunction)Qd_MacOffsetRect, 1,
       
  6617 	 PyDoc_STR("(Rect r, short dh, short dv) -> (Rect r)")},
       
  6618 	{"MacInsetRect", (PyCFunction)Qd_MacInsetRect, 1,
       
  6619 	 PyDoc_STR("(Rect r, short dh, short dv) -> (Rect r)")},
       
  6620 	{"SectRect", (PyCFunction)Qd_SectRect, 1,
       
  6621 	 PyDoc_STR("(Rect src1, Rect src2) -> (Boolean _rv, Rect dstRect)")},
       
  6622 	{"MacUnionRect", (PyCFunction)Qd_MacUnionRect, 1,
       
  6623 	 PyDoc_STR("(Rect src1, Rect src2) -> (Rect dstRect)")},
       
  6624 	{"MacEqualRect", (PyCFunction)Qd_MacEqualRect, 1,
       
  6625 	 PyDoc_STR("(Rect rect1, Rect rect2) -> (Boolean _rv)")},
       
  6626 	{"EmptyRect", (PyCFunction)Qd_EmptyRect, 1,
       
  6627 	 PyDoc_STR("(Rect r) -> (Boolean _rv)")},
       
  6628 	{"MacFrameRect", (PyCFunction)Qd_MacFrameRect, 1,
       
  6629 	 PyDoc_STR("(Rect r) -> None")},
       
  6630 	{"PaintRect", (PyCFunction)Qd_PaintRect, 1,
       
  6631 	 PyDoc_STR("(Rect r) -> None")},
       
  6632 	{"EraseRect", (PyCFunction)Qd_EraseRect, 1,
       
  6633 	 PyDoc_STR("(Rect r) -> None")},
       
  6634 	{"MacInvertRect", (PyCFunction)Qd_MacInvertRect, 1,
       
  6635 	 PyDoc_STR("(Rect r) -> None")},
       
  6636 	{"MacFillRect", (PyCFunction)Qd_MacFillRect, 1,
       
  6637 	 PyDoc_STR("(Rect r, Pattern pat) -> None")},
       
  6638 	{"FrameOval", (PyCFunction)Qd_FrameOval, 1,
       
  6639 	 PyDoc_STR("(Rect r) -> None")},
       
  6640 	{"PaintOval", (PyCFunction)Qd_PaintOval, 1,
       
  6641 	 PyDoc_STR("(Rect r) -> None")},
       
  6642 	{"EraseOval", (PyCFunction)Qd_EraseOval, 1,
       
  6643 	 PyDoc_STR("(Rect r) -> None")},
       
  6644 	{"InvertOval", (PyCFunction)Qd_InvertOval, 1,
       
  6645 	 PyDoc_STR("(Rect r) -> None")},
       
  6646 	{"FillOval", (PyCFunction)Qd_FillOval, 1,
       
  6647 	 PyDoc_STR("(Rect r, Pattern pat) -> None")},
       
  6648 	{"FrameRoundRect", (PyCFunction)Qd_FrameRoundRect, 1,
       
  6649 	 PyDoc_STR("(Rect r, short ovalWidth, short ovalHeight) -> None")},
       
  6650 	{"PaintRoundRect", (PyCFunction)Qd_PaintRoundRect, 1,
       
  6651 	 PyDoc_STR("(Rect r, short ovalWidth, short ovalHeight) -> None")},
       
  6652 	{"EraseRoundRect", (PyCFunction)Qd_EraseRoundRect, 1,
       
  6653 	 PyDoc_STR("(Rect r, short ovalWidth, short ovalHeight) -> None")},
       
  6654 	{"InvertRoundRect", (PyCFunction)Qd_InvertRoundRect, 1,
       
  6655 	 PyDoc_STR("(Rect r, short ovalWidth, short ovalHeight) -> None")},
       
  6656 	{"FillRoundRect", (PyCFunction)Qd_FillRoundRect, 1,
       
  6657 	 PyDoc_STR("(Rect r, short ovalWidth, short ovalHeight, Pattern pat) -> None")},
       
  6658 	{"FrameArc", (PyCFunction)Qd_FrameArc, 1,
       
  6659 	 PyDoc_STR("(Rect r, short startAngle, short arcAngle) -> None")},
       
  6660 	{"PaintArc", (PyCFunction)Qd_PaintArc, 1,
       
  6661 	 PyDoc_STR("(Rect r, short startAngle, short arcAngle) -> None")},
       
  6662 	{"EraseArc", (PyCFunction)Qd_EraseArc, 1,
       
  6663 	 PyDoc_STR("(Rect r, short startAngle, short arcAngle) -> None")},
       
  6664 	{"InvertArc", (PyCFunction)Qd_InvertArc, 1,
       
  6665 	 PyDoc_STR("(Rect r, short startAngle, short arcAngle) -> None")},
       
  6666 	{"FillArc", (PyCFunction)Qd_FillArc, 1,
       
  6667 	 PyDoc_STR("(Rect r, short startAngle, short arcAngle, Pattern pat) -> None")},
       
  6668 	{"NewRgn", (PyCFunction)Qd_NewRgn, 1,
       
  6669 	 PyDoc_STR("() -> (RgnHandle _rv)")},
       
  6670 	{"OpenRgn", (PyCFunction)Qd_OpenRgn, 1,
       
  6671 	 PyDoc_STR("() -> None")},
       
  6672 	{"CloseRgn", (PyCFunction)Qd_CloseRgn, 1,
       
  6673 	 PyDoc_STR("(RgnHandle dstRgn) -> None")},
       
  6674 	{"BitMapToRegion", (PyCFunction)Qd_BitMapToRegion, 1,
       
  6675 	 PyDoc_STR("(RgnHandle region, BitMapPtr bMap) -> None")},
       
  6676 	{"RgnToHandle", (PyCFunction)Qd_RgnToHandle, 1,
       
  6677 	 PyDoc_STR("(RgnHandle region, Handle flattenedRgnDataHdl) -> None")},
       
  6678 	{"DisposeRgn", (PyCFunction)Qd_DisposeRgn, 1,
       
  6679 	 PyDoc_STR("(RgnHandle rgn) -> None")},
       
  6680 	{"MacCopyRgn", (PyCFunction)Qd_MacCopyRgn, 1,
       
  6681 	 PyDoc_STR("(RgnHandle srcRgn, RgnHandle dstRgn) -> None")},
       
  6682 	{"SetEmptyRgn", (PyCFunction)Qd_SetEmptyRgn, 1,
       
  6683 	 PyDoc_STR("(RgnHandle rgn) -> None")},
       
  6684 	{"MacSetRectRgn", (PyCFunction)Qd_MacSetRectRgn, 1,
       
  6685 	 PyDoc_STR("(RgnHandle rgn, short left, short top, short right, short bottom) -> None")},
       
  6686 	{"RectRgn", (PyCFunction)Qd_RectRgn, 1,
       
  6687 	 PyDoc_STR("(RgnHandle rgn, Rect r) -> None")},
       
  6688 	{"MacOffsetRgn", (PyCFunction)Qd_MacOffsetRgn, 1,
       
  6689 	 PyDoc_STR("(RgnHandle rgn, short dh, short dv) -> None")},
       
  6690 	{"InsetRgn", (PyCFunction)Qd_InsetRgn, 1,
       
  6691 	 PyDoc_STR("(RgnHandle rgn, short dh, short dv) -> None")},
       
  6692 	{"SectRgn", (PyCFunction)Qd_SectRgn, 1,
       
  6693 	 PyDoc_STR("(RgnHandle srcRgnA, RgnHandle srcRgnB, RgnHandle dstRgn) -> None")},
       
  6694 	{"MacUnionRgn", (PyCFunction)Qd_MacUnionRgn, 1,
       
  6695 	 PyDoc_STR("(RgnHandle srcRgnA, RgnHandle srcRgnB, RgnHandle dstRgn) -> None")},
       
  6696 	{"DiffRgn", (PyCFunction)Qd_DiffRgn, 1,
       
  6697 	 PyDoc_STR("(RgnHandle srcRgnA, RgnHandle srcRgnB, RgnHandle dstRgn) -> None")},
       
  6698 	{"MacXorRgn", (PyCFunction)Qd_MacXorRgn, 1,
       
  6699 	 PyDoc_STR("(RgnHandle srcRgnA, RgnHandle srcRgnB, RgnHandle dstRgn) -> None")},
       
  6700 	{"RectInRgn", (PyCFunction)Qd_RectInRgn, 1,
       
  6701 	 PyDoc_STR("(Rect r, RgnHandle rgn) -> (Boolean _rv)")},
       
  6702 	{"MacEqualRgn", (PyCFunction)Qd_MacEqualRgn, 1,
       
  6703 	 PyDoc_STR("(RgnHandle rgnA, RgnHandle rgnB) -> (Boolean _rv)")},
       
  6704 	{"EmptyRgn", (PyCFunction)Qd_EmptyRgn, 1,
       
  6705 	 PyDoc_STR("(RgnHandle rgn) -> (Boolean _rv)")},
       
  6706 	{"MacFrameRgn", (PyCFunction)Qd_MacFrameRgn, 1,
       
  6707 	 PyDoc_STR("(RgnHandle rgn) -> None")},
       
  6708 	{"MacPaintRgn", (PyCFunction)Qd_MacPaintRgn, 1,
       
  6709 	 PyDoc_STR("(RgnHandle rgn) -> None")},
       
  6710 	{"EraseRgn", (PyCFunction)Qd_EraseRgn, 1,
       
  6711 	 PyDoc_STR("(RgnHandle rgn) -> None")},
       
  6712 	{"MacInvertRgn", (PyCFunction)Qd_MacInvertRgn, 1,
       
  6713 	 PyDoc_STR("(RgnHandle rgn) -> None")},
       
  6714 	{"MacFillRgn", (PyCFunction)Qd_MacFillRgn, 1,
       
  6715 	 PyDoc_STR("(RgnHandle rgn, Pattern pat) -> None")},
       
  6716 	{"ScrollRect", (PyCFunction)Qd_ScrollRect, 1,
       
  6717 	 PyDoc_STR("(Rect r, short dh, short dv, RgnHandle updateRgn) -> None")},
       
  6718 	{"CopyBits", (PyCFunction)Qd_CopyBits, 1,
       
  6719 	 PyDoc_STR("(BitMapPtr srcBits, BitMapPtr dstBits, Rect srcRect, Rect dstRect, short mode, RgnHandle maskRgn) -> None")},
       
  6720 	{"CopyMask", (PyCFunction)Qd_CopyMask, 1,
       
  6721 	 PyDoc_STR("(BitMapPtr srcBits, BitMapPtr maskBits, BitMapPtr dstBits, Rect srcRect, Rect maskRect, Rect dstRect) -> None")},
       
  6722 	{"OpenPicture", (PyCFunction)Qd_OpenPicture, 1,
       
  6723 	 PyDoc_STR("(Rect picFrame) -> (PicHandle _rv)")},
       
  6724 	{"PicComment", (PyCFunction)Qd_PicComment, 1,
       
  6725 	 PyDoc_STR("(short kind, short dataSize, Handle dataHandle) -> None")},
       
  6726 	{"ClosePicture", (PyCFunction)Qd_ClosePicture, 1,
       
  6727 	 PyDoc_STR("() -> None")},
       
  6728 	{"DrawPicture", (PyCFunction)Qd_DrawPicture, 1,
       
  6729 	 PyDoc_STR("(PicHandle myPicture, Rect dstRect) -> None")},
       
  6730 	{"KillPicture", (PyCFunction)Qd_KillPicture, 1,
       
  6731 	 PyDoc_STR("(PicHandle myPicture) -> None")},
       
  6732 	{"OpenPoly", (PyCFunction)Qd_OpenPoly, 1,
       
  6733 	 PyDoc_STR("() -> (PolyHandle _rv)")},
       
  6734 	{"ClosePoly", (PyCFunction)Qd_ClosePoly, 1,
       
  6735 	 PyDoc_STR("() -> None")},
       
  6736 	{"KillPoly", (PyCFunction)Qd_KillPoly, 1,
       
  6737 	 PyDoc_STR("(PolyHandle poly) -> None")},
       
  6738 	{"OffsetPoly", (PyCFunction)Qd_OffsetPoly, 1,
       
  6739 	 PyDoc_STR("(PolyHandle poly, short dh, short dv) -> None")},
       
  6740 	{"FramePoly", (PyCFunction)Qd_FramePoly, 1,
       
  6741 	 PyDoc_STR("(PolyHandle poly) -> None")},
       
  6742 	{"PaintPoly", (PyCFunction)Qd_PaintPoly, 1,
       
  6743 	 PyDoc_STR("(PolyHandle poly) -> None")},
       
  6744 	{"ErasePoly", (PyCFunction)Qd_ErasePoly, 1,
       
  6745 	 PyDoc_STR("(PolyHandle poly) -> None")},
       
  6746 	{"InvertPoly", (PyCFunction)Qd_InvertPoly, 1,
       
  6747 	 PyDoc_STR("(PolyHandle poly) -> None")},
       
  6748 	{"FillPoly", (PyCFunction)Qd_FillPoly, 1,
       
  6749 	 PyDoc_STR("(PolyHandle poly, Pattern pat) -> None")},
       
  6750 	{"SetPt", (PyCFunction)Qd_SetPt, 1,
       
  6751 	 PyDoc_STR("(short h, short v) -> (Point pt)")},
       
  6752 	{"LocalToGlobal", (PyCFunction)Qd_LocalToGlobal, 1,
       
  6753 	 PyDoc_STR("(Point pt) -> (Point pt)")},
       
  6754 	{"GlobalToLocal", (PyCFunction)Qd_GlobalToLocal, 1,
       
  6755 	 PyDoc_STR("(Point pt) -> (Point pt)")},
       
  6756 	{"Random", (PyCFunction)Qd_Random, 1,
       
  6757 	 PyDoc_STR("() -> (short _rv)")},
       
  6758 	{"MacGetPixel", (PyCFunction)Qd_MacGetPixel, 1,
       
  6759 	 PyDoc_STR("(short h, short v) -> (Boolean _rv)")},
       
  6760 	{"ScalePt", (PyCFunction)Qd_ScalePt, 1,
       
  6761 	 PyDoc_STR("(Point pt, Rect srcRect, Rect dstRect) -> (Point pt)")},
       
  6762 	{"MapPt", (PyCFunction)Qd_MapPt, 1,
       
  6763 	 PyDoc_STR("(Point pt, Rect srcRect, Rect dstRect) -> (Point pt)")},
       
  6764 	{"MapRect", (PyCFunction)Qd_MapRect, 1,
       
  6765 	 PyDoc_STR("(Rect r, Rect srcRect, Rect dstRect) -> (Rect r)")},
       
  6766 	{"MapRgn", (PyCFunction)Qd_MapRgn, 1,
       
  6767 	 PyDoc_STR("(RgnHandle rgn, Rect srcRect, Rect dstRect) -> None")},
       
  6768 	{"MapPoly", (PyCFunction)Qd_MapPoly, 1,
       
  6769 	 PyDoc_STR("(PolyHandle poly, Rect srcRect, Rect dstRect) -> None")},
       
  6770 	{"StdBits", (PyCFunction)Qd_StdBits, 1,
       
  6771 	 PyDoc_STR("(BitMapPtr srcBits, Rect srcRect, Rect dstRect, short mode, RgnHandle maskRgn) -> None")},
       
  6772 	{"AddPt", (PyCFunction)Qd_AddPt, 1,
       
  6773 	 PyDoc_STR("(Point src, Point dst) -> (Point dst)")},
       
  6774 	{"EqualPt", (PyCFunction)Qd_EqualPt, 1,
       
  6775 	 PyDoc_STR("(Point pt1, Point pt2) -> (Boolean _rv)")},
       
  6776 	{"MacPtInRect", (PyCFunction)Qd_MacPtInRect, 1,
       
  6777 	 PyDoc_STR("(Point pt, Rect r) -> (Boolean _rv)")},
       
  6778 	{"Pt2Rect", (PyCFunction)Qd_Pt2Rect, 1,
       
  6779 	 PyDoc_STR("(Point pt1, Point pt2) -> (Rect dstRect)")},
       
  6780 	{"PtToAngle", (PyCFunction)Qd_PtToAngle, 1,
       
  6781 	 PyDoc_STR("(Rect r, Point pt) -> (short angle)")},
       
  6782 	{"SubPt", (PyCFunction)Qd_SubPt, 1,
       
  6783 	 PyDoc_STR("(Point src, Point dst) -> (Point dst)")},
       
  6784 	{"PtInRgn", (PyCFunction)Qd_PtInRgn, 1,
       
  6785 	 PyDoc_STR("(Point pt, RgnHandle rgn) -> (Boolean _rv)")},
       
  6786 	{"NewPixMap", (PyCFunction)Qd_NewPixMap, 1,
       
  6787 	 PyDoc_STR("() -> (PixMapHandle _rv)")},
       
  6788 	{"DisposePixMap", (PyCFunction)Qd_DisposePixMap, 1,
       
  6789 	 PyDoc_STR("(PixMapHandle pm) -> None")},
       
  6790 	{"CopyPixMap", (PyCFunction)Qd_CopyPixMap, 1,
       
  6791 	 PyDoc_STR("(PixMapHandle srcPM, PixMapHandle dstPM) -> None")},
       
  6792 	{"NewPixPat", (PyCFunction)Qd_NewPixPat, 1,
       
  6793 	 PyDoc_STR("() -> (PixPatHandle _rv)")},
       
  6794 	{"DisposePixPat", (PyCFunction)Qd_DisposePixPat, 1,
       
  6795 	 PyDoc_STR("(PixPatHandle pp) -> None")},
       
  6796 	{"CopyPixPat", (PyCFunction)Qd_CopyPixPat, 1,
       
  6797 	 PyDoc_STR("(PixPatHandle srcPP, PixPatHandle dstPP) -> None")},
       
  6798 	{"PenPixPat", (PyCFunction)Qd_PenPixPat, 1,
       
  6799 	 PyDoc_STR("(PixPatHandle pp) -> None")},
       
  6800 	{"BackPixPat", (PyCFunction)Qd_BackPixPat, 1,
       
  6801 	 PyDoc_STR("(PixPatHandle pp) -> None")},
       
  6802 	{"GetPixPat", (PyCFunction)Qd_GetPixPat, 1,
       
  6803 	 PyDoc_STR("(short patID) -> (PixPatHandle _rv)")},
       
  6804 	{"MakeRGBPat", (PyCFunction)Qd_MakeRGBPat, 1,
       
  6805 	 PyDoc_STR("(PixPatHandle pp, RGBColor myColor) -> None")},
       
  6806 	{"FillCRect", (PyCFunction)Qd_FillCRect, 1,
       
  6807 	 PyDoc_STR("(Rect r, PixPatHandle pp) -> None")},
       
  6808 	{"FillCOval", (PyCFunction)Qd_FillCOval, 1,
       
  6809 	 PyDoc_STR("(Rect r, PixPatHandle pp) -> None")},
       
  6810 	{"FillCRoundRect", (PyCFunction)Qd_FillCRoundRect, 1,
       
  6811 	 PyDoc_STR("(Rect r, short ovalWidth, short ovalHeight, PixPatHandle pp) -> None")},
       
  6812 	{"FillCArc", (PyCFunction)Qd_FillCArc, 1,
       
  6813 	 PyDoc_STR("(Rect r, short startAngle, short arcAngle, PixPatHandle pp) -> None")},
       
  6814 	{"FillCRgn", (PyCFunction)Qd_FillCRgn, 1,
       
  6815 	 PyDoc_STR("(RgnHandle rgn, PixPatHandle pp) -> None")},
       
  6816 	{"FillCPoly", (PyCFunction)Qd_FillCPoly, 1,
       
  6817 	 PyDoc_STR("(PolyHandle poly, PixPatHandle pp) -> None")},
       
  6818 	{"RGBForeColor", (PyCFunction)Qd_RGBForeColor, 1,
       
  6819 	 PyDoc_STR("(RGBColor color) -> None")},
       
  6820 	{"RGBBackColor", (PyCFunction)Qd_RGBBackColor, 1,
       
  6821 	 PyDoc_STR("(RGBColor color) -> None")},
       
  6822 	{"SetCPixel", (PyCFunction)Qd_SetCPixel, 1,
       
  6823 	 PyDoc_STR("(short h, short v, RGBColor cPix) -> None")},
       
  6824 	{"SetPortPix", (PyCFunction)Qd_SetPortPix, 1,
       
  6825 	 PyDoc_STR("(PixMapHandle pm) -> None")},
       
  6826 	{"GetCPixel", (PyCFunction)Qd_GetCPixel, 1,
       
  6827 	 PyDoc_STR("(short h, short v) -> (RGBColor cPix)")},
       
  6828 	{"GetForeColor", (PyCFunction)Qd_GetForeColor, 1,
       
  6829 	 PyDoc_STR("() -> (RGBColor color)")},
       
  6830 	{"GetBackColor", (PyCFunction)Qd_GetBackColor, 1,
       
  6831 	 PyDoc_STR("() -> (RGBColor color)")},
       
  6832 	{"OpColor", (PyCFunction)Qd_OpColor, 1,
       
  6833 	 PyDoc_STR("(RGBColor color) -> None")},
       
  6834 	{"HiliteColor", (PyCFunction)Qd_HiliteColor, 1,
       
  6835 	 PyDoc_STR("(RGBColor color) -> None")},
       
  6836 	{"DisposeCTable", (PyCFunction)Qd_DisposeCTable, 1,
       
  6837 	 PyDoc_STR("(CTabHandle cTable) -> None")},
       
  6838 	{"GetCTable", (PyCFunction)Qd_GetCTable, 1,
       
  6839 	 PyDoc_STR("(short ctID) -> (CTabHandle _rv)")},
       
  6840 	{"GetCCursor", (PyCFunction)Qd_GetCCursor, 1,
       
  6841 	 PyDoc_STR("(short crsrID) -> (CCrsrHandle _rv)")},
       
  6842 	{"SetCCursor", (PyCFunction)Qd_SetCCursor, 1,
       
  6843 	 PyDoc_STR("(CCrsrHandle cCrsr) -> None")},
       
  6844 	{"AllocCursor", (PyCFunction)Qd_AllocCursor, 1,
       
  6845 	 PyDoc_STR("() -> None")},
       
  6846 	{"DisposeCCursor", (PyCFunction)Qd_DisposeCCursor, 1,
       
  6847 	 PyDoc_STR("(CCrsrHandle cCrsr) -> None")},
       
  6848 	{"GetMaxDevice", (PyCFunction)Qd_GetMaxDevice, 1,
       
  6849 	 PyDoc_STR("(Rect globalRect) -> (GDHandle _rv)")},
       
  6850 	{"GetCTSeed", (PyCFunction)Qd_GetCTSeed, 1,
       
  6851 	 PyDoc_STR("() -> (long _rv)")},
       
  6852 	{"GetDeviceList", (PyCFunction)Qd_GetDeviceList, 1,
       
  6853 	 PyDoc_STR("() -> (GDHandle _rv)")},
       
  6854 	{"GetMainDevice", (PyCFunction)Qd_GetMainDevice, 1,
       
  6855 	 PyDoc_STR("() -> (GDHandle _rv)")},
       
  6856 	{"GetNextDevice", (PyCFunction)Qd_GetNextDevice, 1,
       
  6857 	 PyDoc_STR("(GDHandle curDevice) -> (GDHandle _rv)")},
       
  6858 	{"TestDeviceAttribute", (PyCFunction)Qd_TestDeviceAttribute, 1,
       
  6859 	 PyDoc_STR("(GDHandle gdh, short attribute) -> (Boolean _rv)")},
       
  6860 	{"SetDeviceAttribute", (PyCFunction)Qd_SetDeviceAttribute, 1,
       
  6861 	 PyDoc_STR("(GDHandle gdh, short attribute, Boolean value) -> None")},
       
  6862 	{"InitGDevice", (PyCFunction)Qd_InitGDevice, 1,
       
  6863 	 PyDoc_STR("(short qdRefNum, long mode, GDHandle gdh) -> None")},
       
  6864 	{"NewGDevice", (PyCFunction)Qd_NewGDevice, 1,
       
  6865 	 PyDoc_STR("(short refNum, long mode) -> (GDHandle _rv)")},
       
  6866 	{"DisposeGDevice", (PyCFunction)Qd_DisposeGDevice, 1,
       
  6867 	 PyDoc_STR("(GDHandle gdh) -> None")},
       
  6868 	{"SetGDevice", (PyCFunction)Qd_SetGDevice, 1,
       
  6869 	 PyDoc_STR("(GDHandle gd) -> None")},
       
  6870 	{"GetGDevice", (PyCFunction)Qd_GetGDevice, 1,
       
  6871 	 PyDoc_STR("() -> (GDHandle _rv)")},
       
  6872 	{"Color2Index", (PyCFunction)Qd_Color2Index, 1,
       
  6873 	 PyDoc_STR("(RGBColor myColor) -> (long _rv)")},
       
  6874 	{"Index2Color", (PyCFunction)Qd_Index2Color, 1,
       
  6875 	 PyDoc_STR("(long index) -> (RGBColor aColor)")},
       
  6876 	{"InvertColor", (PyCFunction)Qd_InvertColor, 1,
       
  6877 	 PyDoc_STR("() -> (RGBColor myColor)")},
       
  6878 	{"RealColor", (PyCFunction)Qd_RealColor, 1,
       
  6879 	 PyDoc_STR("(RGBColor color) -> (Boolean _rv)")},
       
  6880 	{"GetSubTable", (PyCFunction)Qd_GetSubTable, 1,
       
  6881 	 PyDoc_STR("(CTabHandle myColors, short iTabRes, CTabHandle targetTbl) -> None")},
       
  6882 	{"MakeITable", (PyCFunction)Qd_MakeITable, 1,
       
  6883 	 PyDoc_STR("(CTabHandle cTabH, ITabHandle iTabH, short res) -> None")},
       
  6884 	{"SetClientID", (PyCFunction)Qd_SetClientID, 1,
       
  6885 	 PyDoc_STR("(short id) -> None")},
       
  6886 	{"ProtectEntry", (PyCFunction)Qd_ProtectEntry, 1,
       
  6887 	 PyDoc_STR("(short index, Boolean protect) -> None")},
       
  6888 	{"ReserveEntry", (PyCFunction)Qd_ReserveEntry, 1,
       
  6889 	 PyDoc_STR("(short index, Boolean reserve) -> None")},
       
  6890 	{"QDError", (PyCFunction)Qd_QDError, 1,
       
  6891 	 PyDoc_STR("() -> (short _rv)")},
       
  6892 	{"CopyDeepMask", (PyCFunction)Qd_CopyDeepMask, 1,
       
  6893 	 PyDoc_STR("(BitMapPtr srcBits, BitMapPtr maskBits, BitMapPtr dstBits, Rect srcRect, Rect maskRect, Rect dstRect, short mode, RgnHandle maskRgn) -> None")},
       
  6894 	{"GetPattern", (PyCFunction)Qd_GetPattern, 1,
       
  6895 	 PyDoc_STR("(short patternID) -> (PatHandle _rv)")},
       
  6896 	{"MacGetCursor", (PyCFunction)Qd_MacGetCursor, 1,
       
  6897 	 PyDoc_STR("(short cursorID) -> (CursHandle _rv)")},
       
  6898 	{"GetPicture", (PyCFunction)Qd_GetPicture, 1,
       
  6899 	 PyDoc_STR("(short pictureID) -> (PicHandle _rv)")},
       
  6900 	{"DeltaPoint", (PyCFunction)Qd_DeltaPoint, 1,
       
  6901 	 PyDoc_STR("(Point ptA, Point ptB) -> (long _rv)")},
       
  6902 	{"ShieldCursor", (PyCFunction)Qd_ShieldCursor, 1,
       
  6903 	 PyDoc_STR("(Rect shieldRect, Point offsetPt) -> None")},
       
  6904 	{"ScreenRes", (PyCFunction)Qd_ScreenRes, 1,
       
  6905 	 PyDoc_STR("() -> (short scrnHRes, short scrnVRes)")},
       
  6906 	{"GetIndPattern", (PyCFunction)Qd_GetIndPattern, 1,
       
  6907 	 PyDoc_STR("(short patternListID, short index) -> (Pattern thePat)")},
       
  6908 	{"SlopeFromAngle", (PyCFunction)Qd_SlopeFromAngle, 1,
       
  6909 	 PyDoc_STR("(short angle) -> (Fixed _rv)")},
       
  6910 	{"AngleFromSlope", (PyCFunction)Qd_AngleFromSlope, 1,
       
  6911 	 PyDoc_STR("(Fixed slope) -> (short _rv)")},
       
  6912 	{"GetPixBounds", (PyCFunction)Qd_GetPixBounds, 1,
       
  6913 	 PyDoc_STR("(PixMapHandle pixMap) -> (Rect bounds)")},
       
  6914 	{"GetPixDepth", (PyCFunction)Qd_GetPixDepth, 1,
       
  6915 	 PyDoc_STR("(PixMapHandle pixMap) -> (short _rv)")},
       
  6916 	{"GetQDGlobalsRandomSeed", (PyCFunction)Qd_GetQDGlobalsRandomSeed, 1,
       
  6917 	 PyDoc_STR("() -> (long _rv)")},
       
  6918 	{"GetQDGlobalsScreenBits", (PyCFunction)Qd_GetQDGlobalsScreenBits, 1,
       
  6919 	 PyDoc_STR("() -> (BitMap screenBits)")},
       
  6920 	{"GetQDGlobalsArrow", (PyCFunction)Qd_GetQDGlobalsArrow, 1,
       
  6921 	 PyDoc_STR("() -> (Cursor arrow)")},
       
  6922 	{"GetQDGlobalsDarkGray", (PyCFunction)Qd_GetQDGlobalsDarkGray, 1,
       
  6923 	 PyDoc_STR("() -> (Pattern dkGray)")},
       
  6924 	{"GetQDGlobalsLightGray", (PyCFunction)Qd_GetQDGlobalsLightGray, 1,
       
  6925 	 PyDoc_STR("() -> (Pattern ltGray)")},
       
  6926 	{"GetQDGlobalsGray", (PyCFunction)Qd_GetQDGlobalsGray, 1,
       
  6927 	 PyDoc_STR("() -> (Pattern gray)")},
       
  6928 	{"GetQDGlobalsBlack", (PyCFunction)Qd_GetQDGlobalsBlack, 1,
       
  6929 	 PyDoc_STR("() -> (Pattern black)")},
       
  6930 	{"GetQDGlobalsWhite", (PyCFunction)Qd_GetQDGlobalsWhite, 1,
       
  6931 	 PyDoc_STR("() -> (Pattern white)")},
       
  6932 	{"GetQDGlobalsThePort", (PyCFunction)Qd_GetQDGlobalsThePort, 1,
       
  6933 	 PyDoc_STR("() -> (CGrafPtr _rv)")},
       
  6934 	{"SetQDGlobalsRandomSeed", (PyCFunction)Qd_SetQDGlobalsRandomSeed, 1,
       
  6935 	 PyDoc_STR("(long randomSeed) -> None")},
       
  6936 	{"SetQDGlobalsArrow", (PyCFunction)Qd_SetQDGlobalsArrow, 1,
       
  6937 	 PyDoc_STR("(Cursor arrow) -> None")},
       
  6938 	{"GetRegionBounds", (PyCFunction)Qd_GetRegionBounds, 1,
       
  6939 	 PyDoc_STR("(RgnHandle region) -> (Rect bounds)")},
       
  6940 	{"IsRegionRectangular", (PyCFunction)Qd_IsRegionRectangular, 1,
       
  6941 	 PyDoc_STR("(RgnHandle region) -> (Boolean _rv)")},
       
  6942 	{"CreateNewPort", (PyCFunction)Qd_CreateNewPort, 1,
       
  6943 	 PyDoc_STR("() -> (CGrafPtr _rv)")},
       
  6944 	{"SetQDError", (PyCFunction)Qd_SetQDError, 1,
       
  6945 	 PyDoc_STR("(OSErr err) -> None")},
       
  6946 	{"LMGetScrVRes", (PyCFunction)Qd_LMGetScrVRes, 1,
       
  6947 	 PyDoc_STR("() -> (SInt16 _rv)")},
       
  6948 	{"LMSetScrVRes", (PyCFunction)Qd_LMSetScrVRes, 1,
       
  6949 	 PyDoc_STR("(SInt16 value) -> None")},
       
  6950 	{"LMGetScrHRes", (PyCFunction)Qd_LMGetScrHRes, 1,
       
  6951 	 PyDoc_STR("() -> (SInt16 _rv)")},
       
  6952 	{"LMSetScrHRes", (PyCFunction)Qd_LMSetScrHRes, 1,
       
  6953 	 PyDoc_STR("(SInt16 value) -> None")},
       
  6954 	{"LMGetMainDevice", (PyCFunction)Qd_LMGetMainDevice, 1,
       
  6955 	 PyDoc_STR("() -> (GDHandle _rv)")},
       
  6956 	{"LMSetMainDevice", (PyCFunction)Qd_LMSetMainDevice, 1,
       
  6957 	 PyDoc_STR("(GDHandle value) -> None")},
       
  6958 	{"LMGetDeviceList", (PyCFunction)Qd_LMGetDeviceList, 1,
       
  6959 	 PyDoc_STR("() -> (GDHandle _rv)")},
       
  6960 	{"LMSetDeviceList", (PyCFunction)Qd_LMSetDeviceList, 1,
       
  6961 	 PyDoc_STR("(GDHandle value) -> None")},
       
  6962 	{"LMGetQDColors", (PyCFunction)Qd_LMGetQDColors, 1,
       
  6963 	 PyDoc_STR("() -> (Handle _rv)")},
       
  6964 	{"LMSetQDColors", (PyCFunction)Qd_LMSetQDColors, 1,
       
  6965 	 PyDoc_STR("(Handle value) -> None")},
       
  6966 	{"LMGetWidthListHand", (PyCFunction)Qd_LMGetWidthListHand, 1,
       
  6967 	 PyDoc_STR("() -> (Handle _rv)")},
       
  6968 	{"LMSetWidthListHand", (PyCFunction)Qd_LMSetWidthListHand, 1,
       
  6969 	 PyDoc_STR("(Handle value) -> None")},
       
  6970 	{"LMGetHiliteMode", (PyCFunction)Qd_LMGetHiliteMode, 1,
       
  6971 	 PyDoc_STR("() -> (UInt8 _rv)")},
       
  6972 	{"LMSetHiliteMode", (PyCFunction)Qd_LMSetHiliteMode, 1,
       
  6973 	 PyDoc_STR("(UInt8 value) -> None")},
       
  6974 	{"LMGetWidthTabHandle", (PyCFunction)Qd_LMGetWidthTabHandle, 1,
       
  6975 	 PyDoc_STR("() -> (Handle _rv)")},
       
  6976 	{"LMSetWidthTabHandle", (PyCFunction)Qd_LMSetWidthTabHandle, 1,
       
  6977 	 PyDoc_STR("(Handle value) -> None")},
       
  6978 	{"LMGetLastSPExtra", (PyCFunction)Qd_LMGetLastSPExtra, 1,
       
  6979 	 PyDoc_STR("() -> (SInt32 _rv)")},
       
  6980 	{"LMSetLastSPExtra", (PyCFunction)Qd_LMSetLastSPExtra, 1,
       
  6981 	 PyDoc_STR("(SInt32 value) -> None")},
       
  6982 	{"LMGetLastFOND", (PyCFunction)Qd_LMGetLastFOND, 1,
       
  6983 	 PyDoc_STR("() -> (Handle _rv)")},
       
  6984 	{"LMSetLastFOND", (PyCFunction)Qd_LMSetLastFOND, 1,
       
  6985 	 PyDoc_STR("(Handle value) -> None")},
       
  6986 	{"LMGetFractEnable", (PyCFunction)Qd_LMGetFractEnable, 1,
       
  6987 	 PyDoc_STR("() -> (UInt8 _rv)")},
       
  6988 	{"LMSetFractEnable", (PyCFunction)Qd_LMSetFractEnable, 1,
       
  6989 	 PyDoc_STR("(UInt8 value) -> None")},
       
  6990 	{"LMGetTheGDevice", (PyCFunction)Qd_LMGetTheGDevice, 1,
       
  6991 	 PyDoc_STR("() -> (GDHandle _rv)")},
       
  6992 	{"LMSetTheGDevice", (PyCFunction)Qd_LMSetTheGDevice, 1,
       
  6993 	 PyDoc_STR("(GDHandle value) -> None")},
       
  6994 	{"LMGetHiliteRGB", (PyCFunction)Qd_LMGetHiliteRGB, 1,
       
  6995 	 PyDoc_STR("() -> (RGBColor hiliteRGBValue)")},
       
  6996 	{"LMSetHiliteRGB", (PyCFunction)Qd_LMSetHiliteRGB, 1,
       
  6997 	 PyDoc_STR("(RGBColor hiliteRGBValue) -> None")},
       
  6998 	{"LMGetCursorNew", (PyCFunction)Qd_LMGetCursorNew, 1,
       
  6999 	 PyDoc_STR("() -> (Boolean _rv)")},
       
  7000 	{"LMSetCursorNew", (PyCFunction)Qd_LMSetCursorNew, 1,
       
  7001 	 PyDoc_STR("(Boolean value) -> None")},
       
  7002 	{"TextFont", (PyCFunction)Qd_TextFont, 1,
       
  7003 	 PyDoc_STR("(short font) -> None")},
       
  7004 	{"TextFace", (PyCFunction)Qd_TextFace, 1,
       
  7005 	 PyDoc_STR("(StyleParameter face) -> None")},
       
  7006 	{"TextMode", (PyCFunction)Qd_TextMode, 1,
       
  7007 	 PyDoc_STR("(short mode) -> None")},
       
  7008 	{"TextSize", (PyCFunction)Qd_TextSize, 1,
       
  7009 	 PyDoc_STR("(short size) -> None")},
       
  7010 	{"SpaceExtra", (PyCFunction)Qd_SpaceExtra, 1,
       
  7011 	 PyDoc_STR("(Fixed extra) -> None")},
       
  7012 	{"DrawChar", (PyCFunction)Qd_DrawChar, 1,
       
  7013 	 PyDoc_STR("(CharParameter ch) -> None")},
       
  7014 	{"DrawString", (PyCFunction)Qd_DrawString, 1,
       
  7015 	 PyDoc_STR("(Str255 s) -> None")},
       
  7016 	{"MacDrawText", (PyCFunction)Qd_MacDrawText, 1,
       
  7017 	 PyDoc_STR("(Buffer textBuf, short firstByte, short byteCount) -> None")},
       
  7018 	{"CharWidth", (PyCFunction)Qd_CharWidth, 1,
       
  7019 	 PyDoc_STR("(CharParameter ch) -> (short _rv)")},
       
  7020 	{"StringWidth", (PyCFunction)Qd_StringWidth, 1,
       
  7021 	 PyDoc_STR("(Str255 s) -> (short _rv)")},
       
  7022 	{"TextWidth", (PyCFunction)Qd_TextWidth, 1,
       
  7023 	 PyDoc_STR("(Buffer textBuf, short firstByte, short byteCount) -> (short _rv)")},
       
  7024 	{"GetFontInfo", (PyCFunction)Qd_GetFontInfo, 1,
       
  7025 	 PyDoc_STR("() -> (FontInfo info)")},
       
  7026 	{"CharExtra", (PyCFunction)Qd_CharExtra, 1,
       
  7027 	 PyDoc_STR("(Fixed extra) -> None")},
       
  7028 	{"TruncString", (PyCFunction)Qd_TruncString, 1,
       
  7029 	 PyDoc_STR("(short width, Str255 theString, TruncCode truncWhere) -> (short _rv)")},
       
  7030 	{"SetPort", (PyCFunction)Qd_SetPort, 1,
       
  7031 	 PyDoc_STR("(GrafPtr thePort) -> None")},
       
  7032 	{"GetCursor", (PyCFunction)Qd_GetCursor, 1,
       
  7033 	 PyDoc_STR("(short cursorID) -> (CursHandle _rv)")},
       
  7034 	{"SetCursor", (PyCFunction)Qd_SetCursor, 1,
       
  7035 	 PyDoc_STR("(Cursor crsr) -> None")},
       
  7036 	{"ShowCursor", (PyCFunction)Qd_ShowCursor, 1,
       
  7037 	 PyDoc_STR("() -> None")},
       
  7038 	{"LineTo", (PyCFunction)Qd_LineTo, 1,
       
  7039 	 PyDoc_STR("(short h, short v) -> None")},
       
  7040 	{"SetRect", (PyCFunction)Qd_SetRect, 1,
       
  7041 	 PyDoc_STR("(short left, short top, short right, short bottom) -> (Rect r)")},
       
  7042 	{"OffsetRect", (PyCFunction)Qd_OffsetRect, 1,
       
  7043 	 PyDoc_STR("(Rect r, short dh, short dv) -> (Rect r)")},
       
  7044 	{"InsetRect", (PyCFunction)Qd_InsetRect, 1,
       
  7045 	 PyDoc_STR("(Rect r, short dh, short dv) -> (Rect r)")},
       
  7046 	{"UnionRect", (PyCFunction)Qd_UnionRect, 1,
       
  7047 	 PyDoc_STR("(Rect src1, Rect src2) -> (Rect dstRect)")},
       
  7048 	{"EqualRect", (PyCFunction)Qd_EqualRect, 1,
       
  7049 	 PyDoc_STR("(Rect rect1, Rect rect2) -> (Boolean _rv)")},
       
  7050 	{"FrameRect", (PyCFunction)Qd_FrameRect, 1,
       
  7051 	 PyDoc_STR("(Rect r) -> None")},
       
  7052 	{"InvertRect", (PyCFunction)Qd_InvertRect, 1,
       
  7053 	 PyDoc_STR("(Rect r) -> None")},
       
  7054 	{"FillRect", (PyCFunction)Qd_FillRect, 1,
       
  7055 	 PyDoc_STR("(Rect r, Pattern pat) -> None")},
       
  7056 	{"CopyRgn", (PyCFunction)Qd_CopyRgn, 1,
       
  7057 	 PyDoc_STR("(RgnHandle srcRgn, RgnHandle dstRgn) -> None")},
       
  7058 	{"SetRectRgn", (PyCFunction)Qd_SetRectRgn, 1,
       
  7059 	 PyDoc_STR("(RgnHandle rgn, short left, short top, short right, short bottom) -> None")},
       
  7060 	{"OffsetRgn", (PyCFunction)Qd_OffsetRgn, 1,
       
  7061 	 PyDoc_STR("(RgnHandle rgn, short dh, short dv) -> None")},
       
  7062 	{"UnionRgn", (PyCFunction)Qd_UnionRgn, 1,
       
  7063 	 PyDoc_STR("(RgnHandle srcRgnA, RgnHandle srcRgnB, RgnHandle dstRgn) -> None")},
       
  7064 	{"XorRgn", (PyCFunction)Qd_XorRgn, 1,
       
  7065 	 PyDoc_STR("(RgnHandle srcRgnA, RgnHandle srcRgnB, RgnHandle dstRgn) -> None")},
       
  7066 	{"EqualRgn", (PyCFunction)Qd_EqualRgn, 1,
       
  7067 	 PyDoc_STR("(RgnHandle rgnA, RgnHandle rgnB) -> (Boolean _rv)")},
       
  7068 	{"FrameRgn", (PyCFunction)Qd_FrameRgn, 1,
       
  7069 	 PyDoc_STR("(RgnHandle rgn) -> None")},
       
  7070 	{"PaintRgn", (PyCFunction)Qd_PaintRgn, 1,
       
  7071 	 PyDoc_STR("(RgnHandle rgn) -> None")},
       
  7072 	{"InvertRgn", (PyCFunction)Qd_InvertRgn, 1,
       
  7073 	 PyDoc_STR("(RgnHandle rgn) -> None")},
       
  7074 	{"FillRgn", (PyCFunction)Qd_FillRgn, 1,
       
  7075 	 PyDoc_STR("(RgnHandle rgn, Pattern pat) -> None")},
       
  7076 	{"GetPixel", (PyCFunction)Qd_GetPixel, 1,
       
  7077 	 PyDoc_STR("(short h, short v) -> (Boolean _rv)")},
       
  7078 	{"PtInRect", (PyCFunction)Qd_PtInRect, 1,
       
  7079 	 PyDoc_STR("(Point pt, Rect r) -> (Boolean _rv)")},
       
  7080 	{"DrawText", (PyCFunction)Qd_DrawText, 1,
       
  7081 	 PyDoc_STR("(Buffer textBuf, short firstByte, short byteCount) -> None")},
       
  7082 	{"BitMap", (PyCFunction)Qd_BitMap, 1,
       
  7083 	 PyDoc_STR("Take (string, int, Rect) argument and create BitMap")},
       
  7084 	{"RawBitMap", (PyCFunction)Qd_RawBitMap, 1,
       
  7085 	 PyDoc_STR("Take string BitMap and turn into BitMap object")},
       
  7086 #endif /* __LP64__ */
       
  7087 	{NULL, NULL, 0}
       
  7088 };
       
  7089 
       
  7090 
       
  7091 #ifndef __LP64__
       
  7092 
       
  7093 /* Like BMObj_New, but the original bitmap data structure is copied (and
       
  7094 ** released when the object is released)
       
  7095 */
       
  7096 PyObject *BMObj_NewCopied(BitMapPtr itself)
       
  7097 {
       
  7098         BitMapObject *it;
       
  7099         BitMapPtr itself_copy;
       
  7100 
       
  7101         if ((itself_copy=(BitMapPtr)malloc(sizeof(BitMap))) == NULL)
       
  7102                 return PyErr_NoMemory();
       
  7103         *itself_copy = *itself;
       
  7104         it = (BitMapObject *)BMObj_New(itself_copy);
       
  7105         it->referred_bitmap = itself_copy;
       
  7106         return (PyObject *)it;
       
  7107 }
       
  7108 
       
  7109 #endif /* __LP64__ */
       
  7110 
       
  7111 
       
  7112 void init_Qd(void)
       
  7113 {
       
  7114 	PyObject *m;
       
  7115 #ifndef __LP64__
       
  7116 	PyObject *d;
       
  7117 
       
  7118 
       
  7119 
       
  7120 	        PyMac_INIT_TOOLBOX_OBJECT_NEW(BitMapPtr, BMObj_New);
       
  7121 	        PyMac_INIT_TOOLBOX_OBJECT_CONVERT(BitMapPtr, BMObj_Convert);
       
  7122 	        PyMac_INIT_TOOLBOX_OBJECT_NEW(GrafPtr, GrafObj_New);
       
  7123 	        PyMac_INIT_TOOLBOX_OBJECT_CONVERT(GrafPtr, GrafObj_Convert);
       
  7124 	        PyMac_INIT_TOOLBOX_OBJECT_NEW(RGBColorPtr, QdRGB_New);
       
  7125 	        PyMac_INIT_TOOLBOX_OBJECT_CONVERT(RGBColor, QdRGB_Convert);
       
  7126 
       
  7127 #endif /* __LP64__ */
       
  7128 
       
  7129 	m = Py_InitModule("_Qd", Qd_methods);
       
  7130 #ifndef __LP64__
       
  7131 	d = PyModule_GetDict(m);
       
  7132 	Qd_Error = PyMac_GetOSErrException();
       
  7133 	if (Qd_Error == NULL ||
       
  7134 	    PyDict_SetItemString(d, "Error", Qd_Error) != 0)
       
  7135 		return;
       
  7136 	GrafPort_Type.ob_type = &PyType_Type;
       
  7137 	if (PyType_Ready(&GrafPort_Type) < 0) return;
       
  7138 	Py_INCREF(&GrafPort_Type);
       
  7139 	PyModule_AddObject(m, "GrafPort", (PyObject *)&GrafPort_Type);
       
  7140 	/* Backward-compatible name */
       
  7141 	Py_INCREF(&GrafPort_Type);
       
  7142 	PyModule_AddObject(m, "GrafPortType", (PyObject *)&GrafPort_Type);
       
  7143 	BitMap_Type.ob_type = &PyType_Type;
       
  7144 	if (PyType_Ready(&BitMap_Type) < 0) return;
       
  7145 	Py_INCREF(&BitMap_Type);
       
  7146 	PyModule_AddObject(m, "BitMap", (PyObject *)&BitMap_Type);
       
  7147 	/* Backward-compatible name */
       
  7148 	Py_INCREF(&BitMap_Type);
       
  7149 	PyModule_AddObject(m, "BitMapType", (PyObject *)&BitMap_Type);
       
  7150 #endif /* __LP64__ */
       
  7151 }
       
  7152 
       
  7153 /* ========================= End module _Qd ========================= */
       
  7154