source: python/trunk/Mac/Modules/cg/_CGmodule.c

Last change on this file was 391, checked in by dmik, 11 years ago

python: Merge vendor 2.7.6 to trunk.

  • Property svn:eol-style set to native
File size: 39.8 KB
Line 
1
2/* =========================== Module _CG =========================== */
3
4#include "Python.h"
5
6
7
8#include "pymactoolbox.h"
9
10/* Macro to test whether a weak-loaded CFM function exists */
11#define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\
12 PyErr_SetString(PyExc_NotImplementedError, \
13 "Not available in this shared library/OS version"); \
14 return NULL; \
15 }} while(0)
16
17
18#include <ApplicationServices/ApplicationServices.h>
19
20extern int GrafObj_Convert(PyObject *, GrafPtr *);
21
22/*
23** Manual converters
24*/
25
26PyObject *CGPoint_New(CGPoint *itself)
27{
28
29 return Py_BuildValue("(ff)",
30 itself->x,
31 itself->y);
32}
33
34int
35CGPoint_Convert(PyObject *v, CGPoint *p_itself)
36{
37 if( !PyArg_Parse(v, "(ff)",
38 &p_itself->x,
39 &p_itself->y) )
40 return 0;
41 return 1;
42}
43
44PyObject *CGRect_New(CGRect *itself)
45{
46
47 return Py_BuildValue("(ffff)",
48 itself->origin.x,
49 itself->origin.y,
50 itself->size.width,
51 itself->size.height);
52}
53
54int
55CGRect_Convert(PyObject *v, CGRect *p_itself)
56{
57 if( !PyArg_Parse(v, "(ffff)",
58 &p_itself->origin.x,
59 &p_itself->origin.y,
60 &p_itself->size.width,
61 &p_itself->size.height) )
62 return 0;
63 return 1;
64}
65
66PyObject *CGAffineTransform_New(CGAffineTransform *itself)
67{
68
69 return Py_BuildValue("(ffffff)",
70 itself->a,
71 itself->b,
72 itself->c,
73 itself->d,
74 itself->tx,
75 itself->ty);
76}
77
78int
79CGAffineTransform_Convert(PyObject *v, CGAffineTransform *p_itself)
80{
81 if( !PyArg_Parse(v, "(ffffff)",
82 &p_itself->a,
83 &p_itself->b,
84 &p_itself->c,
85 &p_itself->d,
86 &p_itself->tx,
87 &p_itself->ty) )
88 return 0;
89 return 1;
90}
91
92static PyObject *CG_Error;
93
94/* -------------------- Object type CGContextRef -------------------- */
95
96PyTypeObject CGContextRef_Type;
97
98#define CGContextRefObj_Check(x) ((x)->ob_type == &CGContextRef_Type || PyObject_TypeCheck((x), &CGContextRef_Type))
99
100typedef struct CGContextRefObject {
101 PyObject_HEAD
102 CGContextRef ob_itself;
103} CGContextRefObject;
104
105PyObject *CGContextRefObj_New(CGContextRef itself)
106{
107 CGContextRefObject *it;
108 it = PyObject_NEW(CGContextRefObject, &CGContextRef_Type);
109 if (it == NULL) return NULL;
110 it->ob_itself = itself;
111 return (PyObject *)it;
112}
113
114int CGContextRefObj_Convert(PyObject *v, CGContextRef *p_itself)
115{
116 if (!CGContextRefObj_Check(v))
117 {
118 PyErr_SetString(PyExc_TypeError, "CGContextRef required");
119 return 0;
120 }
121 *p_itself = ((CGContextRefObject *)v)->ob_itself;
122 return 1;
123}
124
125static void CGContextRefObj_dealloc(CGContextRefObject *self)
126{
127 CGContextRelease(self->ob_itself);
128 self->ob_type->tp_free((PyObject *)self);
129}
130
131static PyObject *CGContextRefObj_CGContextSaveGState(CGContextRefObject *_self, PyObject *_args)
132{
133 PyObject *_res = NULL;
134 if (!PyArg_ParseTuple(_args, ""))
135 return NULL;
136 CGContextSaveGState(_self->ob_itself);
137 Py_INCREF(Py_None);
138 _res = Py_None;
139 return _res;
140}
141
142static PyObject *CGContextRefObj_CGContextRestoreGState(CGContextRefObject *_self, PyObject *_args)
143{
144 PyObject *_res = NULL;
145 if (!PyArg_ParseTuple(_args, ""))
146 return NULL;
147 CGContextRestoreGState(_self->ob_itself);
148 Py_INCREF(Py_None);
149 _res = Py_None;
150 return _res;
151}
152
153static PyObject *CGContextRefObj_CGContextScaleCTM(CGContextRefObject *_self, PyObject *_args)
154{
155 PyObject *_res = NULL;
156 float sx;
157 float sy;
158 if (!PyArg_ParseTuple(_args, "ff",
159 &sx,
160 &sy))
161 return NULL;
162 CGContextScaleCTM(_self->ob_itself,
163 sx,
164 sy);
165 Py_INCREF(Py_None);
166 _res = Py_None;
167 return _res;
168}
169
170static PyObject *CGContextRefObj_CGContextTranslateCTM(CGContextRefObject *_self, PyObject *_args)
171{
172 PyObject *_res = NULL;
173 float tx;
174 float ty;
175 if (!PyArg_ParseTuple(_args, "ff",
176 &tx,
177 &ty))
178 return NULL;
179 CGContextTranslateCTM(_self->ob_itself,
180 tx,
181 ty);
182 Py_INCREF(Py_None);
183 _res = Py_None;
184 return _res;
185}
186
187static PyObject *CGContextRefObj_CGContextRotateCTM(CGContextRefObject *_self, PyObject *_args)
188{
189 PyObject *_res = NULL;
190 float angle;
191 if (!PyArg_ParseTuple(_args, "f",
192 &angle))
193 return NULL;
194 CGContextRotateCTM(_self->ob_itself,
195 angle);
196 Py_INCREF(Py_None);
197 _res = Py_None;
198 return _res;
199}
200
201static PyObject *CGContextRefObj_CGContextConcatCTM(CGContextRefObject *_self, PyObject *_args)
202{
203 PyObject *_res = NULL;
204 CGAffineTransform transform;
205 if (!PyArg_ParseTuple(_args, "O&",
206 CGAffineTransform_Convert, &transform))
207 return NULL;
208 CGContextConcatCTM(_self->ob_itself,
209 transform);
210 Py_INCREF(Py_None);
211 _res = Py_None;
212 return _res;
213}
214
215static PyObject *CGContextRefObj_CGContextGetCTM(CGContextRefObject *_self, PyObject *_args)
216{
217 PyObject *_res = NULL;
218 CGAffineTransform _rv;
219 if (!PyArg_ParseTuple(_args, ""))
220 return NULL;
221 _rv = CGContextGetCTM(_self->ob_itself);
222 _res = Py_BuildValue("O&",
223 CGAffineTransform_New, &_rv);
224 return _res;
225}
226
227static PyObject *CGContextRefObj_CGContextSetLineWidth(CGContextRefObject *_self, PyObject *_args)
228{
229 PyObject *_res = NULL;
230 float width;
231 if (!PyArg_ParseTuple(_args, "f",
232 &width))
233 return NULL;
234 CGContextSetLineWidth(_self->ob_itself,
235 width);
236 Py_INCREF(Py_None);
237 _res = Py_None;
238 return _res;
239}
240
241static PyObject *CGContextRefObj_CGContextSetLineCap(CGContextRefObject *_self, PyObject *_args)
242{
243 PyObject *_res = NULL;
244 int cap;
245 if (!PyArg_ParseTuple(_args, "i",
246 &cap))
247 return NULL;
248 CGContextSetLineCap(_self->ob_itself,
249 cap);
250 Py_INCREF(Py_None);
251 _res = Py_None;
252 return _res;
253}
254
255static PyObject *CGContextRefObj_CGContextSetLineJoin(CGContextRefObject *_self, PyObject *_args)
256{
257 PyObject *_res = NULL;
258 int join;
259 if (!PyArg_ParseTuple(_args, "i",
260 &join))
261 return NULL;
262 CGContextSetLineJoin(_self->ob_itself,
263 join);
264 Py_INCREF(Py_None);
265 _res = Py_None;
266 return _res;
267}
268
269static PyObject *CGContextRefObj_CGContextSetMiterLimit(CGContextRefObject *_self, PyObject *_args)
270{
271 PyObject *_res = NULL;
272 float limit;
273 if (!PyArg_ParseTuple(_args, "f",
274 &limit))
275 return NULL;
276 CGContextSetMiterLimit(_self->ob_itself,
277 limit);
278 Py_INCREF(Py_None);
279 _res = Py_None;
280 return _res;
281}
282
283static PyObject *CGContextRefObj_CGContextSetFlatness(CGContextRefObject *_self, PyObject *_args)
284{
285 PyObject *_res = NULL;
286 float flatness;
287 if (!PyArg_ParseTuple(_args, "f",
288 &flatness))
289 return NULL;
290 CGContextSetFlatness(_self->ob_itself,
291 flatness);
292 Py_INCREF(Py_None);
293 _res = Py_None;
294 return _res;
295}
296
297static PyObject *CGContextRefObj_CGContextSetAlpha(CGContextRefObject *_self, PyObject *_args)
298{
299 PyObject *_res = NULL;
300 float alpha;
301 if (!PyArg_ParseTuple(_args, "f",
302 &alpha))
303 return NULL;
304 CGContextSetAlpha(_self->ob_itself,
305 alpha);
306 Py_INCREF(Py_None);
307 _res = Py_None;
308 return _res;
309}
310
311static PyObject *CGContextRefObj_CGContextBeginPath(CGContextRefObject *_self, PyObject *_args)
312{
313 PyObject *_res = NULL;
314 if (!PyArg_ParseTuple(_args, ""))
315 return NULL;
316 CGContextBeginPath(_self->ob_itself);
317 Py_INCREF(Py_None);
318 _res = Py_None;
319 return _res;
320}
321
322static PyObject *CGContextRefObj_CGContextMoveToPoint(CGContextRefObject *_self, PyObject *_args)
323{
324 PyObject *_res = NULL;
325 float x;
326 float y;
327 if (!PyArg_ParseTuple(_args, "ff",
328 &x,
329 &y))
330 return NULL;
331 CGContextMoveToPoint(_self->ob_itself,
332 x,
333 y);
334 Py_INCREF(Py_None);
335 _res = Py_None;
336 return _res;
337}
338
339static PyObject *CGContextRefObj_CGContextAddLineToPoint(CGContextRefObject *_self, PyObject *_args)
340{
341 PyObject *_res = NULL;
342 float x;
343 float y;
344 if (!PyArg_ParseTuple(_args, "ff",
345 &x,
346 &y))
347 return NULL;
348 CGContextAddLineToPoint(_self->ob_itself,
349 x,
350 y);
351 Py_INCREF(Py_None);
352 _res = Py_None;
353 return _res;
354}
355
356static PyObject *CGContextRefObj_CGContextAddCurveToPoint(CGContextRefObject *_self, PyObject *_args)
357{
358 PyObject *_res = NULL;
359 float cp1x;
360 float cp1y;
361 float cp2x;
362 float cp2y;
363 float x;
364 float y;
365 if (!PyArg_ParseTuple(_args, "ffffff",
366 &cp1x,
367 &cp1y,
368 &cp2x,
369 &cp2y,
370 &x,
371 &y))
372 return NULL;
373 CGContextAddCurveToPoint(_self->ob_itself,
374 cp1x,
375 cp1y,
376 cp2x,
377 cp2y,
378 x,
379 y);
380 Py_INCREF(Py_None);
381 _res = Py_None;
382 return _res;
383}
384
385static PyObject *CGContextRefObj_CGContextAddQuadCurveToPoint(CGContextRefObject *_self, PyObject *_args)
386{
387 PyObject *_res = NULL;
388 float cpx;
389 float cpy;
390 float x;
391 float y;
392 if (!PyArg_ParseTuple(_args, "ffff",
393 &cpx,
394 &cpy,
395 &x,
396 &y))
397 return NULL;
398 CGContextAddQuadCurveToPoint(_self->ob_itself,
399 cpx,
400 cpy,
401 x,
402 y);
403 Py_INCREF(Py_None);
404 _res = Py_None;
405 return _res;
406}
407
408static PyObject *CGContextRefObj_CGContextClosePath(CGContextRefObject *_self, PyObject *_args)
409{
410 PyObject *_res = NULL;
411 if (!PyArg_ParseTuple(_args, ""))
412 return NULL;
413 CGContextClosePath(_self->ob_itself);
414 Py_INCREF(Py_None);
415 _res = Py_None;
416 return _res;
417}
418
419static PyObject *CGContextRefObj_CGContextAddRect(CGContextRefObject *_self, PyObject *_args)
420{
421 PyObject *_res = NULL;
422 CGRect rect;
423 if (!PyArg_ParseTuple(_args, "O&",
424 CGRect_Convert, &rect))
425 return NULL;
426 CGContextAddRect(_self->ob_itself,
427 rect);
428 Py_INCREF(Py_None);
429 _res = Py_None;
430 return _res;
431}
432
433static PyObject *CGContextRefObj_CGContextAddArc(CGContextRefObject *_self, PyObject *_args)
434{
435 PyObject *_res = NULL;
436 float x;
437 float y;
438 float radius;
439 float startAngle;
440 float endAngle;
441 int clockwise;
442 if (!PyArg_ParseTuple(_args, "fffffi",
443 &x,
444 &y,
445 &radius,
446 &startAngle,
447 &endAngle,
448 &clockwise))
449 return NULL;
450 CGContextAddArc(_self->ob_itself,
451 x,
452 y,
453 radius,
454 startAngle,
455 endAngle,
456 clockwise);
457 Py_INCREF(Py_None);
458 _res = Py_None;
459 return _res;
460}
461
462static PyObject *CGContextRefObj_CGContextAddArcToPoint(CGContextRefObject *_self, PyObject *_args)
463{
464 PyObject *_res = NULL;
465 float x1;
466 float y1;
467 float x2;
468 float y2;
469 float radius;
470 if (!PyArg_ParseTuple(_args, "fffff",
471 &x1,
472 &y1,
473 &x2,
474 &y2,
475 &radius))
476 return NULL;
477 CGContextAddArcToPoint(_self->ob_itself,
478 x1,
479 y1,
480 x2,
481 y2,
482 radius);
483 Py_INCREF(Py_None);
484 _res = Py_None;
485 return _res;
486}
487
488static PyObject *CGContextRefObj_CGContextIsPathEmpty(CGContextRefObject *_self, PyObject *_args)
489{
490 PyObject *_res = NULL;
491 int _rv;
492 if (!PyArg_ParseTuple(_args, ""))
493 return NULL;
494 _rv = CGContextIsPathEmpty(_self->ob_itself);
495 _res = Py_BuildValue("i",
496 _rv);
497 return _res;
498}
499
500static PyObject *CGContextRefObj_CGContextGetPathCurrentPoint(CGContextRefObject *_self, PyObject *_args)
501{
502 PyObject *_res = NULL;
503 CGPoint _rv;
504 if (!PyArg_ParseTuple(_args, ""))
505 return NULL;
506 _rv = CGContextGetPathCurrentPoint(_self->ob_itself);
507 _res = Py_BuildValue("O&",
508 CGPoint_New, &_rv);
509 return _res;
510}
511
512static PyObject *CGContextRefObj_CGContextGetPathBoundingBox(CGContextRefObject *_self, PyObject *_args)
513{
514 PyObject *_res = NULL;
515 CGRect _rv;
516 if (!PyArg_ParseTuple(_args, ""))
517 return NULL;
518 _rv = CGContextGetPathBoundingBox(_self->ob_itself);
519 _res = Py_BuildValue("O&",
520 CGRect_New, &_rv);
521 return _res;
522}
523
524static PyObject *CGContextRefObj_CGContextDrawPath(CGContextRefObject *_self, PyObject *_args)
525{
526 PyObject *_res = NULL;
527 int mode;
528 if (!PyArg_ParseTuple(_args, "i",
529 &mode))
530 return NULL;
531 CGContextDrawPath(_self->ob_itself,
532 mode);
533 Py_INCREF(Py_None);
534 _res = Py_None;
535 return _res;
536}
537
538static PyObject *CGContextRefObj_CGContextFillPath(CGContextRefObject *_self, PyObject *_args)
539{
540 PyObject *_res = NULL;
541 if (!PyArg_ParseTuple(_args, ""))
542 return NULL;
543 CGContextFillPath(_self->ob_itself);
544 Py_INCREF(Py_None);
545 _res = Py_None;
546 return _res;
547}
548
549static PyObject *CGContextRefObj_CGContextEOFillPath(CGContextRefObject *_self, PyObject *_args)
550{
551 PyObject *_res = NULL;
552 if (!PyArg_ParseTuple(_args, ""))
553 return NULL;
554 CGContextEOFillPath(_self->ob_itself);
555 Py_INCREF(Py_None);
556 _res = Py_None;
557 return _res;
558}
559
560static PyObject *CGContextRefObj_CGContextStrokePath(CGContextRefObject *_self, PyObject *_args)
561{
562 PyObject *_res = NULL;
563 if (!PyArg_ParseTuple(_args, ""))
564 return NULL;
565 CGContextStrokePath(_self->ob_itself);
566 Py_INCREF(Py_None);
567 _res = Py_None;
568 return _res;
569}
570
571static PyObject *CGContextRefObj_CGContextFillRect(CGContextRefObject *_self, PyObject *_args)
572{
573 PyObject *_res = NULL;
574 CGRect rect;
575 if (!PyArg_ParseTuple(_args, "O&",
576 CGRect_Convert, &rect))
577 return NULL;
578 CGContextFillRect(_self->ob_itself,
579 rect);
580 Py_INCREF(Py_None);
581 _res = Py_None;
582 return _res;
583}
584
585static PyObject *CGContextRefObj_CGContextStrokeRect(CGContextRefObject *_self, PyObject *_args)
586{
587 PyObject *_res = NULL;
588 CGRect rect;
589 if (!PyArg_ParseTuple(_args, "O&",
590 CGRect_Convert, &rect))
591 return NULL;
592 CGContextStrokeRect(_self->ob_itself,
593 rect);
594 Py_INCREF(Py_None);
595 _res = Py_None;
596 return _res;
597}
598
599static PyObject *CGContextRefObj_CGContextStrokeRectWithWidth(CGContextRefObject *_self, PyObject *_args)
600{
601 PyObject *_res = NULL;
602 CGRect rect;
603 float width;
604 if (!PyArg_ParseTuple(_args, "O&f",
605 CGRect_Convert, &rect,
606 &width))
607 return NULL;
608 CGContextStrokeRectWithWidth(_self->ob_itself,
609 rect,
610 width);
611 Py_INCREF(Py_None);
612 _res = Py_None;
613 return _res;
614}
615
616static PyObject *CGContextRefObj_CGContextClearRect(CGContextRefObject *_self, PyObject *_args)
617{
618 PyObject *_res = NULL;
619 CGRect rect;
620 if (!PyArg_ParseTuple(_args, "O&",
621 CGRect_Convert, &rect))
622 return NULL;
623 CGContextClearRect(_self->ob_itself,
624 rect);
625 Py_INCREF(Py_None);
626 _res = Py_None;
627 return _res;
628}
629
630static PyObject *CGContextRefObj_CGContextClip(CGContextRefObject *_self, PyObject *_args)
631{
632 PyObject *_res = NULL;
633 if (!PyArg_ParseTuple(_args, ""))
634 return NULL;
635 CGContextClip(_self->ob_itself);
636 Py_INCREF(Py_None);
637 _res = Py_None;
638 return _res;
639}
640
641static PyObject *CGContextRefObj_CGContextEOClip(CGContextRefObject *_self, PyObject *_args)
642{
643 PyObject *_res = NULL;
644 if (!PyArg_ParseTuple(_args, ""))
645 return NULL;
646 CGContextEOClip(_self->ob_itself);
647 Py_INCREF(Py_None);
648 _res = Py_None;
649 return _res;
650}
651
652static PyObject *CGContextRefObj_CGContextClipToRect(CGContextRefObject *_self, PyObject *_args)
653{
654 PyObject *_res = NULL;
655 CGRect rect;
656 if (!PyArg_ParseTuple(_args, "O&",
657 CGRect_Convert, &rect))
658 return NULL;
659 CGContextClipToRect(_self->ob_itself,
660 rect);
661 Py_INCREF(Py_None);
662 _res = Py_None;
663 return _res;
664}
665
666static PyObject *CGContextRefObj_CGContextSetGrayFillColor(CGContextRefObject *_self, PyObject *_args)
667{
668 PyObject *_res = NULL;
669 float gray;
670 float alpha;
671 if (!PyArg_ParseTuple(_args, "ff",
672 &gray,
673 &alpha))
674 return NULL;
675 CGContextSetGrayFillColor(_self->ob_itself,
676 gray,
677 alpha);
678 Py_INCREF(Py_None);
679 _res = Py_None;
680 return _res;
681}
682
683static PyObject *CGContextRefObj_CGContextSetGrayStrokeColor(CGContextRefObject *_self, PyObject *_args)
684{
685 PyObject *_res = NULL;
686 float gray;
687 float alpha;
688 if (!PyArg_ParseTuple(_args, "ff",
689 &gray,
690 &alpha))
691 return NULL;
692 CGContextSetGrayStrokeColor(_self->ob_itself,
693 gray,
694 alpha);
695 Py_INCREF(Py_None);
696 _res = Py_None;
697 return _res;
698}
699
700static PyObject *CGContextRefObj_CGContextSetRGBFillColor(CGContextRefObject *_self, PyObject *_args)
701{
702 PyObject *_res = NULL;
703 float red;
704 float green;
705 float blue;
706 float alpha;
707 if (!PyArg_ParseTuple(_args, "ffff",
708 &red,
709 &green,
710 &blue,
711 &alpha))
712 return NULL;
713 CGContextSetRGBFillColor(_self->ob_itself,
714 red,
715 green,
716 blue,
717 alpha);
718 Py_INCREF(Py_None);
719 _res = Py_None;
720 return _res;
721}
722
723static PyObject *CGContextRefObj_CGContextSetRGBStrokeColor(CGContextRefObject *_self, PyObject *_args)
724{
725 PyObject *_res = NULL;
726 float red;
727 float green;
728 float blue;
729 float alpha;
730 if (!PyArg_ParseTuple(_args, "ffff",
731 &red,
732 &green,
733 &blue,
734 &alpha))
735 return NULL;
736 CGContextSetRGBStrokeColor(_self->ob_itself,
737 red,
738 green,
739 blue,
740 alpha);
741 Py_INCREF(Py_None);
742 _res = Py_None;
743 return _res;
744}
745
746static PyObject *CGContextRefObj_CGContextSetCMYKFillColor(CGContextRefObject *_self, PyObject *_args)
747{
748 PyObject *_res = NULL;
749 float cyan;
750 float magenta;
751 float yellow;
752 float black;
753 float alpha;
754 if (!PyArg_ParseTuple(_args, "fffff",
755 &cyan,
756 &magenta,
757 &yellow,
758 &black,
759 &alpha))
760 return NULL;
761 CGContextSetCMYKFillColor(_self->ob_itself,
762 cyan,
763 magenta,
764 yellow,
765 black,
766 alpha);
767 Py_INCREF(Py_None);
768 _res = Py_None;
769 return _res;
770}
771
772static PyObject *CGContextRefObj_CGContextSetCMYKStrokeColor(CGContextRefObject *_self, PyObject *_args)
773{
774 PyObject *_res = NULL;
775 float cyan;
776 float magenta;
777 float yellow;
778 float black;
779 float alpha;
780 if (!PyArg_ParseTuple(_args, "fffff",
781 &cyan,
782 &magenta,
783 &yellow,
784 &black,
785 &alpha))
786 return NULL;
787 CGContextSetCMYKStrokeColor(_self->ob_itself,
788 cyan,
789 magenta,
790 yellow,
791 black,
792 alpha);
793 Py_INCREF(Py_None);
794 _res = Py_None;
795 return _res;
796}
797
798static PyObject *CGContextRefObj_CGContextGetInterpolationQuality(CGContextRefObject *_self, PyObject *_args)
799{
800 PyObject *_res = NULL;
801 int _rv;
802 if (!PyArg_ParseTuple(_args, ""))
803 return NULL;
804 _rv = CGContextGetInterpolationQuality(_self->ob_itself);
805 _res = Py_BuildValue("i",
806 _rv);
807 return _res;
808}
809
810static PyObject *CGContextRefObj_CGContextSetInterpolationQuality(CGContextRefObject *_self, PyObject *_args)
811{
812 PyObject *_res = NULL;
813 int quality;
814 if (!PyArg_ParseTuple(_args, "i",
815 &quality))
816 return NULL;
817 CGContextSetInterpolationQuality(_self->ob_itself,
818 quality);
819 Py_INCREF(Py_None);
820 _res = Py_None;
821 return _res;
822}
823
824static PyObject *CGContextRefObj_CGContextSetCharacterSpacing(CGContextRefObject *_self, PyObject *_args)
825{
826 PyObject *_res = NULL;
827 float spacing;
828 if (!PyArg_ParseTuple(_args, "f",
829 &spacing))
830 return NULL;
831 CGContextSetCharacterSpacing(_self->ob_itself,
832 spacing);
833 Py_INCREF(Py_None);
834 _res = Py_None;
835 return _res;
836}
837
838static PyObject *CGContextRefObj_CGContextSetTextPosition(CGContextRefObject *_self, PyObject *_args)
839{
840 PyObject *_res = NULL;
841 float x;
842 float y;
843 if (!PyArg_ParseTuple(_args, "ff",
844 &x,
845 &y))
846 return NULL;
847 CGContextSetTextPosition(_self->ob_itself,
848 x,
849 y);
850 Py_INCREF(Py_None);
851 _res = Py_None;
852 return _res;
853}
854
855static PyObject *CGContextRefObj_CGContextGetTextPosition(CGContextRefObject *_self, PyObject *_args)
856{
857 PyObject *_res = NULL;
858 CGPoint _rv;
859 if (!PyArg_ParseTuple(_args, ""))
860 return NULL;
861 _rv = CGContextGetTextPosition(_self->ob_itself);
862 _res = Py_BuildValue("O&",
863 CGPoint_New, &_rv);
864 return _res;
865}
866
867static PyObject *CGContextRefObj_CGContextSetTextMatrix(CGContextRefObject *_self, PyObject *_args)
868{
869 PyObject *_res = NULL;
870 CGAffineTransform transform;
871 if (!PyArg_ParseTuple(_args, "O&",
872 CGAffineTransform_Convert, &transform))
873 return NULL;
874 CGContextSetTextMatrix(_self->ob_itself,
875 transform);
876 Py_INCREF(Py_None);
877 _res = Py_None;
878 return _res;
879}
880
881static PyObject *CGContextRefObj_CGContextGetTextMatrix(CGContextRefObject *_self, PyObject *_args)
882{
883 PyObject *_res = NULL;
884 CGAffineTransform _rv;
885 if (!PyArg_ParseTuple(_args, ""))
886 return NULL;
887 _rv = CGContextGetTextMatrix(_self->ob_itself);
888 _res = Py_BuildValue("O&",
889 CGAffineTransform_New, &_rv);
890 return _res;
891}
892
893static PyObject *CGContextRefObj_CGContextSetTextDrawingMode(CGContextRefObject *_self, PyObject *_args)
894{
895 PyObject *_res = NULL;
896 int mode;
897 if (!PyArg_ParseTuple(_args, "i",
898 &mode))
899 return NULL;
900 CGContextSetTextDrawingMode(_self->ob_itself,
901 mode);
902 Py_INCREF(Py_None);
903 _res = Py_None;
904 return _res;
905}
906
907static PyObject *CGContextRefObj_CGContextSetFontSize(CGContextRefObject *_self, PyObject *_args)
908{
909 PyObject *_res = NULL;
910 float size;
911 if (!PyArg_ParseTuple(_args, "f",
912 &size))
913 return NULL;
914 CGContextSetFontSize(_self->ob_itself,
915 size);
916 Py_INCREF(Py_None);
917 _res = Py_None;
918 return _res;
919}
920
921static PyObject *CGContextRefObj_CGContextSelectFont(CGContextRefObject *_self, PyObject *_args)
922{
923 PyObject *_res = NULL;
924 char * name;
925 float size;
926 int textEncoding;
927 if (!PyArg_ParseTuple(_args, "sfi",
928 &name,
929 &size,
930 &textEncoding))
931 return NULL;
932 CGContextSelectFont(_self->ob_itself,
933 name,
934 size,
935 textEncoding);
936 Py_INCREF(Py_None);
937 _res = Py_None;
938 return _res;
939}
940
941static PyObject *CGContextRefObj_CGContextShowText(CGContextRefObject *_self, PyObject *_args)
942{
943 PyObject *_res = NULL;
944 char *cstring__in__;
945 long cstring__len__;
946 int cstring__in_len__;
947 if (!PyArg_ParseTuple(_args, "s#",
948 &cstring__in__, &cstring__in_len__))
949 return NULL;
950 cstring__len__ = cstring__in_len__;
951 CGContextShowText(_self->ob_itself,
952 cstring__in__, cstring__len__);
953 Py_INCREF(Py_None);
954 _res = Py_None;
955 return _res;
956}
957
958static PyObject *CGContextRefObj_CGContextShowTextAtPoint(CGContextRefObject *_self, PyObject *_args)
959{
960 PyObject *_res = NULL;
961 float x;
962 float y;
963 char *cstring__in__;
964 long cstring__len__;
965 int cstring__in_len__;
966 if (!PyArg_ParseTuple(_args, "ffs#",
967 &x,
968 &y,
969 &cstring__in__, &cstring__in_len__))
970 return NULL;
971 cstring__len__ = cstring__in_len__;
972 CGContextShowTextAtPoint(_self->ob_itself,
973 x,
974 y,
975 cstring__in__, cstring__len__);
976 Py_INCREF(Py_None);
977 _res = Py_None;
978 return _res;
979}
980
981static PyObject *CGContextRefObj_CGContextEndPage(CGContextRefObject *_self, PyObject *_args)
982{
983 PyObject *_res = NULL;
984 if (!PyArg_ParseTuple(_args, ""))
985 return NULL;
986 CGContextEndPage(_self->ob_itself);
987 Py_INCREF(Py_None);
988 _res = Py_None;
989 return _res;
990}
991
992static PyObject *CGContextRefObj_CGContextFlush(CGContextRefObject *_self, PyObject *_args)
993{
994 PyObject *_res = NULL;
995 if (!PyArg_ParseTuple(_args, ""))
996 return NULL;
997 CGContextFlush(_self->ob_itself);
998 Py_INCREF(Py_None);
999 _res = Py_None;
1000 return _res;
1001}
1002
1003static PyObject *CGContextRefObj_CGContextSynchronize(CGContextRefObject *_self, PyObject *_args)
1004{
1005 PyObject *_res = NULL;
1006 if (!PyArg_ParseTuple(_args, ""))
1007 return NULL;
1008 CGContextSynchronize(_self->ob_itself);
1009 Py_INCREF(Py_None);
1010 _res = Py_None;
1011 return _res;
1012}
1013
1014static PyObject *CGContextRefObj_CGContextSetShouldAntialias(CGContextRefObject *_self, PyObject *_args)
1015{
1016 PyObject *_res = NULL;
1017 int shouldAntialias;
1018 if (!PyArg_ParseTuple(_args, "i",
1019 &shouldAntialias))
1020 return NULL;
1021 CGContextSetShouldAntialias(_self->ob_itself,
1022 shouldAntialias);
1023 Py_INCREF(Py_None);
1024 _res = Py_None;
1025 return _res;
1026}
1027
1028#ifndef __LP64__
1029static PyObject *CGContextRefObj_SyncCGContextOriginWithPort(CGContextRefObject *_self, PyObject *_args)
1030{
1031 PyObject *_res = NULL;
1032 CGrafPtr port;
1033 if (!PyArg_ParseTuple(_args, "O&",
1034 GrafObj_Convert, &port))
1035 return NULL;
1036 SyncCGContextOriginWithPort(_self->ob_itself,
1037 port);
1038 Py_INCREF(Py_None);
1039 _res = Py_None;
1040 return _res;
1041}
1042
1043static PyObject *CGContextRefObj_ClipCGContextToRegion(CGContextRefObject *_self, PyObject *_args)
1044{
1045 PyObject *_res = NULL;
1046 Rect portRect;
1047 RgnHandle region;
1048 if (!PyArg_ParseTuple(_args, "O&O&",
1049 PyMac_GetRect, &portRect,
1050 ResObj_Convert, &region))
1051 return NULL;
1052 ClipCGContextToRegion(_self->ob_itself,
1053 &portRect,
1054 region);
1055 Py_INCREF(Py_None);
1056 _res = Py_None;
1057 return _res;
1058}
1059#endif
1060
1061static PyMethodDef CGContextRefObj_methods[] = {
1062 {"CGContextSaveGState", (PyCFunction)CGContextRefObj_CGContextSaveGState, 1,
1063 PyDoc_STR("() -> None")},
1064 {"CGContextRestoreGState", (PyCFunction)CGContextRefObj_CGContextRestoreGState, 1,
1065 PyDoc_STR("() -> None")},
1066 {"CGContextScaleCTM", (PyCFunction)CGContextRefObj_CGContextScaleCTM, 1,
1067 PyDoc_STR("(float sx, float sy) -> None")},
1068 {"CGContextTranslateCTM", (PyCFunction)CGContextRefObj_CGContextTranslateCTM, 1,
1069 PyDoc_STR("(float tx, float ty) -> None")},
1070 {"CGContextRotateCTM", (PyCFunction)CGContextRefObj_CGContextRotateCTM, 1,
1071 PyDoc_STR("(float angle) -> None")},
1072 {"CGContextConcatCTM", (PyCFunction)CGContextRefObj_CGContextConcatCTM, 1,
1073 PyDoc_STR("(CGAffineTransform transform) -> None")},
1074 {"CGContextGetCTM", (PyCFunction)CGContextRefObj_CGContextGetCTM, 1,
1075 PyDoc_STR("() -> (CGAffineTransform _rv)")},
1076 {"CGContextSetLineWidth", (PyCFunction)CGContextRefObj_CGContextSetLineWidth, 1,
1077 PyDoc_STR("(float width) -> None")},
1078 {"CGContextSetLineCap", (PyCFunction)CGContextRefObj_CGContextSetLineCap, 1,
1079 PyDoc_STR("(int cap) -> None")},
1080 {"CGContextSetLineJoin", (PyCFunction)CGContextRefObj_CGContextSetLineJoin, 1,
1081 PyDoc_STR("(int join) -> None")},
1082 {"CGContextSetMiterLimit", (PyCFunction)CGContextRefObj_CGContextSetMiterLimit, 1,
1083 PyDoc_STR("(float limit) -> None")},
1084 {"CGContextSetFlatness", (PyCFunction)CGContextRefObj_CGContextSetFlatness, 1,
1085 PyDoc_STR("(float flatness) -> None")},
1086 {"CGContextSetAlpha", (PyCFunction)CGContextRefObj_CGContextSetAlpha, 1,
1087 PyDoc_STR("(float alpha) -> None")},
1088 {"CGContextBeginPath", (PyCFunction)CGContextRefObj_CGContextBeginPath, 1,
1089 PyDoc_STR("() -> None")},
1090 {"CGContextMoveToPoint", (PyCFunction)CGContextRefObj_CGContextMoveToPoint, 1,
1091 PyDoc_STR("(float x, float y) -> None")},
1092 {"CGContextAddLineToPoint", (PyCFunction)CGContextRefObj_CGContextAddLineToPoint, 1,
1093 PyDoc_STR("(float x, float y) -> None")},
1094 {"CGContextAddCurveToPoint", (PyCFunction)CGContextRefObj_CGContextAddCurveToPoint, 1,
1095 PyDoc_STR("(float cp1x, float cp1y, float cp2x, float cp2y, float x, float y) -> None")},
1096 {"CGContextAddQuadCurveToPoint", (PyCFunction)CGContextRefObj_CGContextAddQuadCurveToPoint, 1,
1097 PyDoc_STR("(float cpx, float cpy, float x, float y) -> None")},
1098 {"CGContextClosePath", (PyCFunction)CGContextRefObj_CGContextClosePath, 1,
1099 PyDoc_STR("() -> None")},
1100 {"CGContextAddRect", (PyCFunction)CGContextRefObj_CGContextAddRect, 1,
1101 PyDoc_STR("(CGRect rect) -> None")},
1102 {"CGContextAddArc", (PyCFunction)CGContextRefObj_CGContextAddArc, 1,
1103 PyDoc_STR("(float x, float y, float radius, float startAngle, float endAngle, int clockwise) -> None")},
1104 {"CGContextAddArcToPoint", (PyCFunction)CGContextRefObj_CGContextAddArcToPoint, 1,
1105 PyDoc_STR("(float x1, float y1, float x2, float y2, float radius) -> None")},
1106 {"CGContextIsPathEmpty", (PyCFunction)CGContextRefObj_CGContextIsPathEmpty, 1,
1107 PyDoc_STR("() -> (int _rv)")},
1108 {"CGContextGetPathCurrentPoint", (PyCFunction)CGContextRefObj_CGContextGetPathCurrentPoint, 1,
1109 PyDoc_STR("() -> (CGPoint _rv)")},
1110 {"CGContextGetPathBoundingBox", (PyCFunction)CGContextRefObj_CGContextGetPathBoundingBox, 1,
1111 PyDoc_STR("() -> (CGRect _rv)")},
1112 {"CGContextDrawPath", (PyCFunction)CGContextRefObj_CGContextDrawPath, 1,
1113 PyDoc_STR("(int mode) -> None")},
1114 {"CGContextFillPath", (PyCFunction)CGContextRefObj_CGContextFillPath, 1,
1115 PyDoc_STR("() -> None")},
1116 {"CGContextEOFillPath", (PyCFunction)CGContextRefObj_CGContextEOFillPath, 1,
1117 PyDoc_STR("() -> None")},
1118 {"CGContextStrokePath", (PyCFunction)CGContextRefObj_CGContextStrokePath, 1,
1119 PyDoc_STR("() -> None")},
1120 {"CGContextFillRect", (PyCFunction)CGContextRefObj_CGContextFillRect, 1,
1121 PyDoc_STR("(CGRect rect) -> None")},
1122 {"CGContextStrokeRect", (PyCFunction)CGContextRefObj_CGContextStrokeRect, 1,
1123 PyDoc_STR("(CGRect rect) -> None")},
1124 {"CGContextStrokeRectWithWidth", (PyCFunction)CGContextRefObj_CGContextStrokeRectWithWidth, 1,
1125 PyDoc_STR("(CGRect rect, float width) -> None")},
1126 {"CGContextClearRect", (PyCFunction)CGContextRefObj_CGContextClearRect, 1,
1127 PyDoc_STR("(CGRect rect) -> None")},
1128 {"CGContextClip", (PyCFunction)CGContextRefObj_CGContextClip, 1,
1129 PyDoc_STR("() -> None")},
1130 {"CGContextEOClip", (PyCFunction)CGContextRefObj_CGContextEOClip, 1,
1131 PyDoc_STR("() -> None")},
1132 {"CGContextClipToRect", (PyCFunction)CGContextRefObj_CGContextClipToRect, 1,
1133 PyDoc_STR("(CGRect rect) -> None")},
1134 {"CGContextSetGrayFillColor", (PyCFunction)CGContextRefObj_CGContextSetGrayFillColor, 1,
1135 PyDoc_STR("(float gray, float alpha) -> None")},
1136 {"CGContextSetGrayStrokeColor", (PyCFunction)CGContextRefObj_CGContextSetGrayStrokeColor, 1,
1137 PyDoc_STR("(float gray, float alpha) -> None")},
1138 {"CGContextSetRGBFillColor", (PyCFunction)CGContextRefObj_CGContextSetRGBFillColor, 1,
1139 PyDoc_STR("(float red, float green, float blue, float alpha) -> None")},
1140 {"CGContextSetRGBStrokeColor", (PyCFunction)CGContextRefObj_CGContextSetRGBStrokeColor, 1,
1141 PyDoc_STR("(float red, float green, float blue, float alpha) -> None")},
1142 {"CGContextSetCMYKFillColor", (PyCFunction)CGContextRefObj_CGContextSetCMYKFillColor, 1,
1143 PyDoc_STR("(float cyan, float magenta, float yellow, float black, float alpha) -> None")},
1144 {"CGContextSetCMYKStrokeColor", (PyCFunction)CGContextRefObj_CGContextSetCMYKStrokeColor, 1,
1145 PyDoc_STR("(float cyan, float magenta, float yellow, float black, float alpha) -> None")},
1146 {"CGContextGetInterpolationQuality", (PyCFunction)CGContextRefObj_CGContextGetInterpolationQuality, 1,
1147 PyDoc_STR("() -> (int _rv)")},
1148 {"CGContextSetInterpolationQuality", (PyCFunction)CGContextRefObj_CGContextSetInterpolationQuality, 1,
1149 PyDoc_STR("(int quality) -> None")},
1150 {"CGContextSetCharacterSpacing", (PyCFunction)CGContextRefObj_CGContextSetCharacterSpacing, 1,
1151 PyDoc_STR("(float spacing) -> None")},
1152 {"CGContextSetTextPosition", (PyCFunction)CGContextRefObj_CGContextSetTextPosition, 1,
1153 PyDoc_STR("(float x, float y) -> None")},
1154 {"CGContextGetTextPosition", (PyCFunction)CGContextRefObj_CGContextGetTextPosition, 1,
1155 PyDoc_STR("() -> (CGPoint _rv)")},
1156 {"CGContextSetTextMatrix", (PyCFunction)CGContextRefObj_CGContextSetTextMatrix, 1,
1157 PyDoc_STR("(CGAffineTransform transform) -> None")},
1158 {"CGContextGetTextMatrix", (PyCFunction)CGContextRefObj_CGContextGetTextMatrix, 1,
1159 PyDoc_STR("() -> (CGAffineTransform _rv)")},
1160 {"CGContextSetTextDrawingMode", (PyCFunction)CGContextRefObj_CGContextSetTextDrawingMode, 1,
1161 PyDoc_STR("(int mode) -> None")},
1162 {"CGContextSetFontSize", (PyCFunction)CGContextRefObj_CGContextSetFontSize, 1,
1163 PyDoc_STR("(float size) -> None")},
1164 {"CGContextSelectFont", (PyCFunction)CGContextRefObj_CGContextSelectFont, 1,
1165 PyDoc_STR("(char * name, float size, int textEncoding) -> None")},
1166 {"CGContextShowText", (PyCFunction)CGContextRefObj_CGContextShowText, 1,
1167 PyDoc_STR("(Buffer cstring) -> None")},
1168 {"CGContextShowTextAtPoint", (PyCFunction)CGContextRefObj_CGContextShowTextAtPoint, 1,
1169 PyDoc_STR("(float x, float y, Buffer cstring) -> None")},
1170 {"CGContextEndPage", (PyCFunction)CGContextRefObj_CGContextEndPage, 1,
1171 PyDoc_STR("() -> None")},
1172 {"CGContextFlush", (PyCFunction)CGContextRefObj_CGContextFlush, 1,
1173 PyDoc_STR("() -> None")},
1174 {"CGContextSynchronize", (PyCFunction)CGContextRefObj_CGContextSynchronize, 1,
1175 PyDoc_STR("() -> None")},
1176 {"CGContextSetShouldAntialias", (PyCFunction)CGContextRefObj_CGContextSetShouldAntialias, 1,
1177 PyDoc_STR("(int shouldAntialias) -> None")},
1178#ifndef __LP64__
1179 {"SyncCGContextOriginWithPort", (PyCFunction)CGContextRefObj_SyncCGContextOriginWithPort, 1,
1180 PyDoc_STR("(CGrafPtr port) -> None")},
1181 {"ClipCGContextToRegion", (PyCFunction)CGContextRefObj_ClipCGContextToRegion, 1,
1182 PyDoc_STR("(Rect portRect, RgnHandle region) -> None")},
1183#endif
1184 {NULL, NULL, 0}
1185};
1186
1187#define CGContextRefObj_getsetlist NULL
1188
1189
1190#define CGContextRefObj_compare NULL
1191
1192#define CGContextRefObj_repr NULL
1193
1194#define CGContextRefObj_hash NULL
1195#define CGContextRefObj_tp_init 0
1196
1197#define CGContextRefObj_tp_alloc PyType_GenericAlloc
1198
1199static PyObject *CGContextRefObj_tp_new(PyTypeObject *type, PyObject *_args, PyObject *_kwds)
1200{
1201 PyObject *_self;
1202 CGContextRef itself;
1203 char *kw[] = {"itself", 0};
1204
1205 if (!PyArg_ParseTupleAndKeywords(_args, _kwds, "O&", kw, CGContextRefObj_Convert, &itself)) return NULL;
1206 if ((_self = type->tp_alloc(type, 0)) == NULL) return NULL;
1207 ((CGContextRefObject *)_self)->ob_itself = itself;
1208 return _self;
1209}
1210
1211#define CGContextRefObj_tp_free PyObject_Del
1212
1213
1214PyTypeObject CGContextRef_Type = {
1215 PyObject_HEAD_INIT(NULL)
1216 0, /*ob_size*/
1217 "_CG.CGContextRef", /*tp_name*/
1218 sizeof(CGContextRefObject), /*tp_basicsize*/
1219 0, /*tp_itemsize*/
1220 /* methods */
1221 (destructor) CGContextRefObj_dealloc, /*tp_dealloc*/
1222 0, /*tp_print*/
1223 (getattrfunc)0, /*tp_getattr*/
1224 (setattrfunc)0, /*tp_setattr*/
1225 (cmpfunc) CGContextRefObj_compare, /*tp_compare*/
1226 (reprfunc) CGContextRefObj_repr, /*tp_repr*/
1227 (PyNumberMethods *)0, /* tp_as_number */
1228 (PySequenceMethods *)0, /* tp_as_sequence */
1229 (PyMappingMethods *)0, /* tp_as_mapping */
1230 (hashfunc) CGContextRefObj_hash, /*tp_hash*/
1231 0, /*tp_call*/
1232 0, /*tp_str*/
1233 PyObject_GenericGetAttr, /*tp_getattro*/
1234 PyObject_GenericSetAttr, /*tp_setattro */
1235 0, /*tp_as_buffer*/
1236 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /* tp_flags */
1237 0, /*tp_doc*/
1238 0, /*tp_traverse*/
1239 0, /*tp_clear*/
1240 0, /*tp_richcompare*/
1241 0, /*tp_weaklistoffset*/
1242 0, /*tp_iter*/
1243 0, /*tp_iternext*/
1244 CGContextRefObj_methods, /* tp_methods */
1245 0, /*tp_members*/
1246 CGContextRefObj_getsetlist, /*tp_getset*/
1247 0, /*tp_base*/
1248 0, /*tp_dict*/
1249 0, /*tp_descr_get*/
1250 0, /*tp_descr_set*/
1251 0, /*tp_dictoffset*/
1252 CGContextRefObj_tp_init, /* tp_init */
1253 CGContextRefObj_tp_alloc, /* tp_alloc */
1254 CGContextRefObj_tp_new, /* tp_new */
1255 CGContextRefObj_tp_free, /* tp_free */
1256};
1257
1258/* ------------------ End object type CGContextRef ------------------ */
1259
1260
1261#ifndef __LP64__
1262static PyObject *CG_CreateCGContextForPort(PyObject *_self, PyObject *_args)
1263{
1264 PyObject *_res = NULL;
1265 GrafPtr port;
1266 CGContextRef ctx;
1267 OSStatus _err;
1268
1269 if (!PyArg_ParseTuple(_args, "O&", GrafObj_Convert, &port))
1270 return NULL;
1271
1272 _err = CreateCGContextForPort(port, &ctx);
1273 if (_err != noErr)
1274 if (_err != noErr) return PyMac_Error(_err);
1275 _res = Py_BuildValue("O&", CGContextRefObj_New, ctx);
1276 return _res;
1277
1278}
1279#endif
1280
1281static PyMethodDef CG_methods[] = {
1282#ifndef __LP64__
1283 {"CreateCGContextForPort", (PyCFunction)CG_CreateCGContextForPort, 1,
1284 PyDoc_STR("(CGrafPtr) -> CGContextRef")},
1285#endif
1286 {NULL, NULL, 0}
1287};
1288
1289
1290
1291
1292void init_CG(void)
1293{
1294 PyObject *m;
1295 PyObject *d;
1296
1297
1298
1299
1300 m = Py_InitModule("_CG", CG_methods);
1301 d = PyModule_GetDict(m);
1302 CG_Error = PyMac_GetOSErrException();
1303 if (CG_Error == NULL ||
1304 PyDict_SetItemString(d, "Error", CG_Error) != 0)
1305 return;
1306 CGContextRef_Type.ob_type = &PyType_Type;
1307 if (PyType_Ready(&CGContextRef_Type) < 0) return;
1308 Py_INCREF(&CGContextRef_Type);
1309 PyModule_AddObject(m, "CGContextRef", (PyObject *)&CGContextRef_Type);
1310 /* Backward-compatible name */
1311 Py_INCREF(&CGContextRef_Type);
1312 PyModule_AddObject(m, "CGContextRefType", (PyObject *)&CGContextRef_Type);
1313}
1314
1315/* ========================= End module _CG ========================= */
1316
Note: See TracBrowser for help on using the repository browser.