PageRenderTime 77ms CodeModel.GetById 21ms RepoModel.GetById 0ms app.codeStats 0ms

/Mac/Modules/qd/_Qdmodule.c

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