|
1 /* |
|
2 * Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: SVG Implementation header file |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef VGRENDERER_H |
|
20 #define VGRENDERER_H |
|
21 |
|
22 #include <e32std.h> |
|
23 #include <e32base.h> |
|
24 |
|
25 #include "MVGRendererImpl.h" |
|
26 #include <SVGRendererId.h> |
|
27 |
|
28 class CVGSurface; |
|
29 |
|
30 /** |
|
31 * CVGRenderer |
|
32 * |
|
33 */ |
|
34 class CVGRenderer : public CBase |
|
35 { |
|
36 |
|
37 public: |
|
38 /** |
|
39 * Destructor. |
|
40 */ |
|
41 ~CVGRenderer(); |
|
42 |
|
43 /*! |
|
44 * @fn NewL() |
|
45 * @bief Creates the renderer abstraction |
|
46 * @param aRendererType Type of the renderer |
|
47 * @param aSurface Type of the surface |
|
48 * @return Renderer abstraction |
|
49 */ |
|
50 IMPORT_C static CVGRenderer* NewL(SVGRendererId aRendererType = ESVGRendererSW, TInt aSurface = 0); |
|
51 |
|
52 /*! |
|
53 * @fn NewLC() |
|
54 * @bief Creates the renderer abstraction |
|
55 * @param aRendererType Type of the renderer |
|
56 * @param aSurface Type of the surface |
|
57 * @return Renderer abstraction |
|
58 */ |
|
59 static CVGRenderer* NewLC(SVGRendererId aRendererType = ESVGRendererSW, TInt aSurface = 0); |
|
60 |
|
61 public: |
|
62 |
|
63 /*! |
|
64 * @fn GetRendererName() |
|
65 * @bief Retrieves the renderer implementation's version |
|
66 * @return version of renderer implementation |
|
67 */ |
|
68 TVersion GetRendererVersion() |
|
69 { |
|
70 return iImpl->GetVersion(); |
|
71 } |
|
72 |
|
73 /*! |
|
74 * @fn GetRendererName() |
|
75 * @bief Retrieves the renderer implementation's name |
|
76 * @return name of renderer implementation |
|
77 */ |
|
78 const TDesC GetRendererName() |
|
79 { |
|
80 return iImpl->GetName(); |
|
81 } |
|
82 |
|
83 // OpenVG function calls |
|
84 |
|
85 void vgClear(TInt x, TInt y, TInt width, TInt height) |
|
86 { |
|
87 iImpl->vgClear(x, y, width, height); |
|
88 } |
|
89 |
|
90 void vgSeti(TInt type, TInt value) |
|
91 { |
|
92 iImpl->vgSeti(type, value); |
|
93 } |
|
94 TInt vgGeti(TInt type) |
|
95 { |
|
96 return iImpl->vgGeti(type); |
|
97 } |
|
98 void vgSetf (TInt type, TReal32 value) |
|
99 { |
|
100 iImpl->vgSetf(type, value); |
|
101 } |
|
102 |
|
103 void vgSetfv(TInt type, TInt count, const TReal32 * values) |
|
104 { |
|
105 iImpl->vgSetfv(type, count, values); |
|
106 } |
|
107 void vgSetiv(TInt type, TInt count, const TInt * values) |
|
108 { |
|
109 iImpl->vgSetiv(type, count, values); |
|
110 } |
|
111 void vgSetParameteri(TUint handle, TInt paramType, TInt value) |
|
112 { |
|
113 iImpl->vgSetParameteri(handle, paramType, value); |
|
114 } |
|
115 |
|
116 void vgSetParameterf(TUint handle, TInt paramType, TReal32 value) |
|
117 { |
|
118 iImpl->vgSetParameterf(handle, paramType, value); |
|
119 } |
|
120 |
|
121 void vgSetParameterfv(TUint object, TInt paramType, TInt count, const TReal32 * values) |
|
122 { |
|
123 iImpl->vgSetParameterfv(object, paramType, count, values); |
|
124 } |
|
125 |
|
126 void vgSetColor(TUint paint, TUint rgba) |
|
127 { |
|
128 iImpl->vgSetColor(paint, rgba); |
|
129 } |
|
130 |
|
131 void vgSetPaint(TUint paint, TUint paintModes) |
|
132 { |
|
133 iImpl->vgSetPaint(paint, paintModes); |
|
134 } |
|
135 |
|
136 TUint vgCreatePaint() |
|
137 { |
|
138 return iImpl->vgCreatePaint(); |
|
139 } |
|
140 |
|
141 TUint vgCreatePath(TInt pathFormat, TInt datatype, TReal32 scale, TReal32 bias, |
|
142 TInt segmentCapacityHint, TInt coordCapacityHint, TInt capabilities) |
|
143 { |
|
144 return iImpl->vgCreatePath(pathFormat, datatype, scale, bias, segmentCapacityHint, coordCapacityHint, capabilities); |
|
145 } |
|
146 |
|
147 void vgLoadMatrix(const TReal32 * m) |
|
148 { |
|
149 iImpl->vgLoadMatrix(m); |
|
150 } |
|
151 |
|
152 void vgMultMatrix(const TReal32 * m) |
|
153 { |
|
154 iImpl->vgMultMatrix(m); |
|
155 } |
|
156 |
|
157 void vgLoadIdentity() |
|
158 { |
|
159 iImpl->vgLoadIdentity(); |
|
160 } |
|
161 |
|
162 void vgScale(TReal32 sx, TReal32 sy) |
|
163 { |
|
164 iImpl->vgScale(sx, sy); |
|
165 } |
|
166 |
|
167 void vgRotate(TReal32 angle) |
|
168 { |
|
169 iImpl->vgRotate(angle); |
|
170 } |
|
171 void vgReadPixels(void * data, TInt dataStride,TInt dataFormat,TInt sx, TInt sy,TInt width, TInt height) |
|
172 { |
|
173 iImpl->vgReadPixels(data,dataStride,dataFormat,sx,sy,width,height); |
|
174 } |
|
175 |
|
176 void vgWritePixels(const void * data, TInt dataStride, TInt dataFormat, |
|
177 TInt dx, TInt dy, TInt width, TInt height) |
|
178 { |
|
179 iImpl->vgWritePixels(data, dataStride, dataFormat, dx, dy, width, height); |
|
180 } |
|
181 |
|
182 void vgTranslate(TReal32 tx, TReal32 ty) |
|
183 { |
|
184 iImpl->vgTranslate(tx, ty); |
|
185 } |
|
186 |
|
187 void vgAppendPathData(TUint path, TInt numSegments, |
|
188 const TUint8 * pathSegments, |
|
189 const void * pathData) |
|
190 { |
|
191 iImpl->vgAppendPathData(path, numSegments, pathSegments, pathData); |
|
192 } |
|
193 |
|
194 void vgDrawPath(TUint path, TUint paintModes) |
|
195 { |
|
196 iImpl->vgDrawPath(path, paintModes); |
|
197 } |
|
198 |
|
199 void vgClearPath(TUint path, TUint capabilities) |
|
200 { |
|
201 iImpl->vgClearPath(path, capabilities); |
|
202 } |
|
203 |
|
204 TInt vguRect(TUint path, TReal32 x, TReal32 y, |
|
205 TReal32 width, TReal32 height) |
|
206 { |
|
207 return iImpl->vguRect(path, x, y, width, height); |
|
208 } |
|
209 |
|
210 TInt vguEllipse(TUint path, TReal32 cx, TReal32 cy, |
|
211 TReal32 width, TReal32 height) |
|
212 { |
|
213 return iImpl->vguEllipse(path, cx, cy, width, height); |
|
214 } |
|
215 |
|
216 TInt vguRoundRect(TUint path, TReal32 x, TReal32 y, |
|
217 TReal32 width, TReal32 height, TReal32 arcWidth, TReal32 arcHeight) |
|
218 { |
|
219 return iImpl->vguRoundRect(path, x, y, width, height, arcWidth, arcHeight); |
|
220 } |
|
221 |
|
222 TInt vguLine(TUint path, TReal32 x0, TReal32 y0, TReal32 x1, TReal32 y1) |
|
223 { |
|
224 return iImpl->vguLine(path, x0, y0, x1, y1); |
|
225 } |
|
226 |
|
227 void DumpToLogFile() |
|
228 { |
|
229 return iImpl->DumpToLogFile(); |
|
230 } |
|
231 void CloseLogFile() |
|
232 { |
|
233 return iImpl->CloseLogFile(); |
|
234 } |
|
235 TUint vgCreateImage(TInt format, TInt width, TInt height, TInt allowedQuality) |
|
236 { |
|
237 return iImpl->vgCreateImage(format, width, height, allowedQuality); |
|
238 } |
|
239 |
|
240 void vgClearImage(TUint image, TInt x, TInt y, TInt width, TInt height) |
|
241 { |
|
242 return iImpl->vgClearImage(image, x, y, width, height); |
|
243 } |
|
244 |
|
245 void vgImageSubData(TUint image, const void * data, TInt dataStride, |
|
246 TInt dataFormat, TInt x, TInt y, TInt width, TInt height) |
|
247 { |
|
248 return iImpl->vgImageSubData(image, data, dataStride, dataFormat, x, y, width, height); |
|
249 } |
|
250 |
|
251 void vgGetPixels(TUint dst, TInt dx, TInt dy, TInt sx, TInt sy, TInt width, TInt height) |
|
252 { |
|
253 iImpl->vgGetPixels(dst, dx, dy, sx, sy, width, height); |
|
254 } |
|
255 |
|
256 void vgDrawImage(TUint image) |
|
257 { |
|
258 iImpl->vgDrawImage(image); |
|
259 } |
|
260 |
|
261 void vgMask(TUint mask, TInt operation, TInt x, TInt y, TInt width, TInt height) |
|
262 { |
|
263 return iImpl->vgMask(mask, operation, x, y, width, height); |
|
264 } |
|
265 |
|
266 void vgDestroyImage(TUint aHandle) |
|
267 { |
|
268 iImpl->vgDestroyImage(aHandle); |
|
269 } |
|
270 |
|
271 void vgDestroyPaint(TUint aHandle) |
|
272 { |
|
273 iImpl->vgDestroyPaint(aHandle); |
|
274 } |
|
275 |
|
276 void vgDestroyPath(TUint aHandle) |
|
277 { |
|
278 iImpl->vgDestroyPath(aHandle); |
|
279 } |
|
280 |
|
281 void ToggleReset() |
|
282 { |
|
283 iImpl->ToggleReset(); |
|
284 } |
|
285 |
|
286 TInt vgGetError() |
|
287 { |
|
288 return iImpl->vgGetError(); |
|
289 } |
|
290 |
|
291 void vgFlush() |
|
292 { |
|
293 iImpl->vgFlush(); |
|
294 } |
|
295 |
|
296 /*! |
|
297 * @fn GetCurrentSurface() |
|
298 * @bief Retrieves the surface associated with the renderer |
|
299 * @return Renderer surface |
|
300 */ |
|
301 CVGSurface * GetCurrentSurface() |
|
302 { |
|
303 return this->iCurrentSurface; |
|
304 } |
|
305 const TPtrC8 TLVEncodedData() const |
|
306 { |
|
307 return (iImpl->TLVEncodedData()); |
|
308 } |
|
309 |
|
310 private: |
|
311 |
|
312 CVGRenderer(); |
|
313 |
|
314 /** |
|
315 * default constructor for performing 2nd stage construction |
|
316 */ |
|
317 void ConstructL(SVGRendererId , TInt ); |
|
318 |
|
319 MVGRendererImpl * iImpl; |
|
320 CVGSurface * iCurrentSurface; |
|
321 RLibrary iLibrary; |
|
322 }; |
|
323 |
|
324 #endif // VGRENDERER_H |