Mercurial > projects > dstep
comparison dstep/applicationservices/coregraphics/CGContext.d @ 12:9f0b49a2f64e
Added the ApplicationServices frameworks: ATS, ColorSync and CoreGraphics
author | Jacob Carlborg <doob@me.com> |
---|---|
date | Mon, 03 Aug 2009 14:00:21 +0200 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
11:07194b026fa4 | 12:9f0b49a2f64e |
---|---|
1 /** | |
2 * Copyright: Copyright (c) 2009 Jacob Carlborg. | |
3 * Authors: Jacob Carlborg | |
4 * Version: Initial created: Aug 1, 2009 | |
5 * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) | |
6 */ | |
7 module dstep.applicationservices.coregraphics.CGContext; | |
8 | |
9 import dstep.applicationservices.coregraphics.CGAffineTransform; | |
10 import dstep.applicationservices.coregraphics.CGBase; | |
11 import dstep.applicationservices.coregraphics.CGColor; | |
12 import dstep.applicationservices.coregraphics.CGColorSpace; | |
13 import dstep.applicationservices.coregraphics.CGContext; | |
14 import dstep.applicationservices.coregraphics.CGFont; | |
15 import dstep.applicationservices.coregraphics.CGGeometry; | |
16 import dstep.applicationservices.coregraphics.CGGradient; | |
17 import dstep.applicationservices.coregraphics.CGImage; | |
18 import dstep.applicationservices.coregraphics.CGPDFDocument; | |
19 import dstep.applicationservices.coregraphics.CGPath; | |
20 import dstep.applicationservices.coregraphics.CGPattern; | |
21 import dstep.applicationservices.coregraphics.CGPDFPage; | |
22 import dstep.applicationservices.coregraphics.CGShading; | |
23 import dstep.corefoundation.CFDictionary; | |
24 | |
25 struct CGContext; | |
26 | |
27 alias CGContext* CGContextRef; | |
28 alias int CGLineJoin; | |
29 alias int CGLineCap; | |
30 alias int CGPathDrawingMode; | |
31 alias int CGTextDrawingMode; | |
32 alias int CGTextEncoding; | |
33 alias int CGInterpolationQuality; | |
34 alias int CGBlendMode; | |
35 | |
36 enum /*CGLineJoin*/ | |
37 { | |
38 kCGLineJoinMiter, | |
39 kCGLineJoinRound, | |
40 kCGLineJoinBevel | |
41 } | |
42 | |
43 enum /*CGLineCap*/ | |
44 { | |
45 kCGLineCapButt, | |
46 kCGLineCapRound, | |
47 kCGLineCapSquare | |
48 } | |
49 | |
50 enum /*CGPathDrawingMode*/ | |
51 { | |
52 kCGPathFill, | |
53 kCGPathEOFill, | |
54 kCGPathStroke, | |
55 kCGPathFillStroke, | |
56 kCGPathEOFillStroke | |
57 } | |
58 | |
59 enum /*CGTextDrawingMode*/ | |
60 { | |
61 kCGTextFill, | |
62 kCGTextStroke, | |
63 kCGTextFillStroke, | |
64 kCGTextInvisible, | |
65 kCGTextFillClip, | |
66 kCGTextStrokeClip, | |
67 kCGTextFillStrokeClip, | |
68 kCGTextClip | |
69 } | |
70 | |
71 enum /*CGTextEncoding*/ | |
72 { | |
73 kCGEncodingFontSpecific, | |
74 kCGEncodingMacRoman | |
75 } | |
76 | |
77 enum /*CGInterpolationQuality*/ | |
78 { | |
79 kCGInterpolationDefault, | |
80 kCGInterpolationNone, | |
81 kCGInterpolationLow, | |
82 kCGInterpolationHigh | |
83 } | |
84 | |
85 enum /*CGBlendMode*/ | |
86 { | |
87 kCGBlendModeNormal, | |
88 kCGBlendModeMultiply, | |
89 kCGBlendModeScreen, | |
90 kCGBlendModeOverlay, | |
91 kCGBlendModeDarken, | |
92 kCGBlendModeLighten, | |
93 kCGBlendModeColorDodge, | |
94 kCGBlendModeColorBurn, | |
95 kCGBlendModeSoftLight, | |
96 kCGBlendModeHardLight, | |
97 kCGBlendModeDifference, | |
98 kCGBlendModeExclusion, | |
99 kCGBlendModeHue, | |
100 kCGBlendModeSaturation, | |
101 kCGBlendModeColor, | |
102 kCGBlendModeLuminosity, | |
103 kCGBlendModeClear, | |
104 kCGBlendModeCopy, | |
105 kCGBlendModeSourceIn, | |
106 kCGBlendModeSourceOut, | |
107 kCGBlendModeSourceAtop, | |
108 kCGBlendModeDestinationOver, | |
109 kCGBlendModeDestinationIn, | |
110 kCGBlendModeDestinationOut, | |
111 kCGBlendModeDestinationAtop, | |
112 kCGBlendModeXOR, | |
113 kCGBlendModePlusDarker, | |
114 kCGBlendModePlusLighter | |
115 } | |
116 | |
117 extern (C) | |
118 { | |
119 uint CGContextGetTypeID (); | |
120 void CGContextSaveGState (CGContextRef c); | |
121 void CGContextRestoreGState (CGContextRef c); | |
122 void CGContextScaleCTM (CGContextRef c, CGFloat sx, CGFloat sy); | |
123 void CGContextTranslateCTM (CGContextRef c, CGFloat tx, CGFloat ty); | |
124 void CGContextRotateCTM (CGContextRef c, CGFloat angle); | |
125 void CGContextConcatCTM (CGContextRef c, CGAffineTransform transform); | |
126 CGAffineTransform CGContextGetCTM (CGContextRef c); | |
127 void CGContextSetLineWidth (CGContextRef c, CGFloat width); | |
128 void CGContextSetLineCap (CGContextRef c, int cap); | |
129 void CGContextSetLineJoin (CGContextRef c, int join); | |
130 void CGContextSetMiterLimit (CGContextRef c, CGFloat limit); | |
131 void CGContextSetLineDash (CGContextRef c, CGFloat phase, CGFloat* lengths, uint count); | |
132 void CGContextSetFlatness (CGContextRef c, CGFloat flatness); | |
133 void CGContextSetAlpha (CGContextRef c, CGFloat alpha); | |
134 void CGContextSetBlendMode (CGContextRef context, int mode); | |
135 void CGContextBeginPath (CGContextRef c); | |
136 void CGContextMoveToPoint (CGContextRef c, CGFloat x, CGFloat y); | |
137 void CGContextAddLineToPoint (CGContextRef c, CGFloat x, CGFloat y); | |
138 void CGContextAddCurveToPoint (CGContextRef c, CGFloat cp1x, CGFloat cp1y, CGFloat cp2x, CGFloat cp2y, CGFloat x, CGFloat y); | |
139 void CGContextAddQuadCurveToPoint (CGContextRef c, CGFloat cpx, CGFloat cpy, CGFloat x, CGFloat y); | |
140 void CGContextClosePath (CGContextRef c); | |
141 void CGContextAddRect (CGContextRef c, CGRect rect); | |
142 void CGContextAddRects (CGContextRef c, CGRect* rects, uint count); | |
143 void CGContextAddLines (CGContextRef c, CGPoint* points, uint count); | |
144 void CGContextAddEllipseInRect (CGContextRef context, CGRect rect); | |
145 void CGContextAddArc (CGContextRef c, CGFloat x, CGFloat y, CGFloat radius, CGFloat startAngle, CGFloat endAngle, int clockwise); | |
146 void CGContextAddArcToPoint (CGContextRef c, CGFloat x1, CGFloat y1, CGFloat x2, CGFloat y2, CGFloat radius); | |
147 void CGContextAddPath (CGContextRef context, CGPathRef path); | |
148 void CGContextReplacePathWithStrokedPath (CGContextRef c); | |
149 bool CGContextIsPathEmpty (CGContextRef c); | |
150 CGPoint CGContextGetPathCurrentPoint (CGContextRef c); | |
151 CGRect CGContextGetPathBoundingBox (CGContextRef c); | |
152 bool CGContextPathContainsPoint (CGContextRef context, CGPoint point, int mode); | |
153 void CGContextDrawPath (CGContextRef c, int mode); | |
154 void CGContextFillPath (CGContextRef c); | |
155 void CGContextEOFillPath (CGContextRef c); | |
156 void CGContextStrokePath (CGContextRef c); | |
157 void CGContextFillRect (CGContextRef c, CGRect rect); | |
158 void CGContextFillRects (CGContextRef c, CGRect* rects, uint count); | |
159 void CGContextStrokeRect (CGContextRef c, CGRect rect); | |
160 void CGContextStrokeRectWithWidth (CGContextRef c, CGRect rect, CGFloat width); | |
161 void CGContextClearRect (CGContextRef c, CGRect rect); | |
162 void CGContextFillEllipseInRect (CGContextRef context, CGRect rect); | |
163 void CGContextStrokeEllipseInRect (CGContextRef context, CGRect rect); | |
164 void CGContextStrokeLineSegments (CGContextRef c, CGPoint* points, uint count); | |
165 void CGContextClip (CGContextRef c); | |
166 void CGContextEOClip (CGContextRef c); | |
167 void CGContextClipToMask (CGContextRef c, CGRect rect, CGImageRef mask); | |
168 CGRect CGContextGetClipBoundingBox (CGContextRef c); | |
169 void CGContextClipToRect (CGContextRef c, CGRect rect); | |
170 void CGContextClipToRects (CGContextRef c, CGRect* rects, uint count); | |
171 void CGContextSetFillColorWithColor (CGContextRef c, CGColorRef color); | |
172 void CGContextSetStrokeColorWithColor (CGContextRef c, CGColorRef color); | |
173 void CGContextSetFillColorSpace (CGContextRef c, CGColorSpaceRef colorspace); | |
174 void CGContextSetStrokeColorSpace (CGContextRef c, CGColorSpaceRef colorspace); | |
175 void CGContextSetFillColor (CGContextRef c, CGFloat* components); | |
176 void CGContextSetStrokeColor (CGContextRef c, CGFloat* components); | |
177 void CGContextSetFillPattern (CGContextRef c, CGPatternRef pattern, CGFloat* components); | |
178 void CGContextSetStrokePattern (CGContextRef c, CGPatternRef pattern, CGFloat* components); | |
179 void CGContextSetPatternPhase (CGContextRef c, CGSize phase); | |
180 void CGContextSetGrayFillColor (CGContextRef c, CGFloat gray, CGFloat alpha); | |
181 void CGContextSetGrayStrokeColor (CGContextRef c, CGFloat gray, CGFloat alpha); | |
182 void CGContextSetRGBFillColor (CGContextRef c, CGFloat red, CGFloat green, CGFloat blue, CGFloat alpha); | |
183 void CGContextSetRGBStrokeColor (CGContextRef c, CGFloat red, CGFloat green, CGFloat blue, CGFloat alpha); | |
184 void CGContextSetCMYKFillColor (CGContextRef c, CGFloat cyan, CGFloat magenta, CGFloat yellow, CGFloat black, CGFloat alpha); | |
185 void CGContextSetCMYKStrokeColor (CGContextRef c, CGFloat cyan, CGFloat magenta, CGFloat yellow, CGFloat black, CGFloat alpha); | |
186 void CGContextSetRenderingIntent (CGContextRef c, int intent); | |
187 void CGContextDrawImage (CGContextRef c, CGRect rect, CGImageRef image); | |
188 void CGContextDrawTiledImage (CGContextRef c, CGRect rect, CGImageRef image); | |
189 int CGContextGetInterpolationQuality (CGContextRef c); | |
190 void CGContextSetInterpolationQuality (CGContextRef c, int quality); | |
191 void CGContextSetShadowWithColor (CGContextRef context, CGSize offset, CGFloat blur, CGColorRef color); | |
192 void CGContextSetShadow (CGContextRef context, CGSize offset, CGFloat blur); | |
193 void CGContextDrawLinearGradient (CGContextRef context, CGGradientRef gradient, CGPoint startPoint, CGPoint endPoint, uint options); | |
194 void CGContextDrawRadialGradient (CGContextRef context, CGGradientRef gradient, CGPoint startCenter, CGFloat startRadius, CGPoint endCenter, CGFloat endRadius, uint options); | |
195 void CGContextDrawShading (CGContextRef context, CGShadingRef shading); | |
196 void CGContextSetCharacterSpacing (CGContextRef c, CGFloat spacing); | |
197 void CGContextSetTextPosition (CGContextRef c, CGFloat x, CGFloat y); | |
198 CGPoint CGContextGetTextPosition (CGContextRef c); | |
199 void CGContextSetTextMatrix (CGContextRef c, CGAffineTransform t); | |
200 CGAffineTransform CGContextGetTextMatrix (CGContextRef c); | |
201 void CGContextSetTextDrawingMode (CGContextRef c, int mode); | |
202 void CGContextSetFont (CGContextRef c, CGFontRef font); | |
203 void CGContextSetFontSize (CGContextRef c, CGFloat size); | |
204 void CGContextSelectFont (CGContextRef c, char* name, CGFloat size, int textEncoding); | |
205 void CGContextShowGlyphsAtPositions (CGContextRef context, CGGlyph* glyphs, CGPoint* positions, uint count); | |
206 void CGContextShowText (CGContextRef c, char* string, uint length); | |
207 void CGContextShowTextAtPoint (CGContextRef c, CGFloat x, CGFloat y, char* string, uint length); | |
208 void CGContextShowGlyphs (CGContextRef c, CGGlyph* g, uint count); | |
209 void CGContextShowGlyphsAtPoint (CGContextRef c, CGFloat x, CGFloat y, CGGlyph* glyphs, uint count); | |
210 void CGContextShowGlyphsWithAdvances (CGContextRef c, CGGlyph* glyphs, CGSize* advances, uint count); | |
211 void CGContextDrawPDFPage (CGContextRef c, CGPDFPageRef page); | |
212 void CGContextDrawPDFDocument (CGContextRef c, CGRect rect, CGPDFDocumentRef document, int page); | |
213 void CGContextBeginPage (CGContextRef c, CGRect* mediaBox); | |
214 void CGContextEndPage (CGContextRef c); | |
215 CGContextRef CGContextRetain (CGContextRef c); | |
216 void CGContextRelease (CGContextRef c); | |
217 void CGContextFlush (CGContextRef c); | |
218 void CGContextSynchronize (CGContextRef c); | |
219 void CGContextSetShouldAntialias (CGContextRef c, bool shouldAntialias); | |
220 void CGContextSetAllowsAntialiasing (CGContextRef context, bool allowsAntialiasing); | |
221 void CGContextSetShouldSmoothFonts (CGContextRef c, bool shouldSmoothFonts); | |
222 void CGContextBeginTransparencyLayer (CGContextRef context, CFDictionaryRef auxiliaryInfo); | |
223 void CGContextBeginTransparencyLayerWithRect (CGContextRef context, CGRect rect, CFDictionaryRef auxiliaryInfo); | |
224 void CGContextEndTransparencyLayer (CGContextRef context); | |
225 CGAffineTransform CGContextGetUserSpaceToDeviceSpaceTransform (CGContextRef c); | |
226 CGPoint CGContextConvertPointToDeviceSpace (CGContextRef c, CGPoint point); | |
227 CGPoint CGContextConvertPointToUserSpace (CGContextRef c, CGPoint point); | |
228 CGSize CGContextConvertSizeToDeviceSpace (CGContextRef c, CGSize size); | |
229 CGSize CGContextConvertSizeToUserSpace (CGContextRef c, CGSize size); | |
230 CGRect CGContextConvertRectToDeviceSpace (CGContextRef c, CGRect rect); | |
231 CGRect CGContextConvertRectToUserSpace (CGContextRef c, CGRect rect); | |
232 } |