|
1 // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 |
|
17 #ifndef DIRECTGDIENGINE_H |
|
18 #define DIRECTGDIENGINE_H |
|
19 |
|
20 /** |
|
21 @file |
|
22 @publishedPartner |
|
23 @prototype |
|
24 */ |
|
25 |
|
26 #include <graphics/directgditypes.h> |
|
27 #include <e32std.h> |
|
28 |
|
29 // Forward declarations. |
|
30 // |
|
31 class CFbsBitmap; |
|
32 class RDirectGdiImageSource; |
|
33 class RDirectGdiImageTarget; |
|
34 class RDirectGdiDrawableSource; |
|
35 |
|
36 /** |
|
37 Pure virtual interface for licensee adaptation of GDI platform implementation. |
|
38 |
|
39 @publishedPartner |
|
40 @prototype |
|
41 @deprecated |
|
42 */ |
|
43 class MDirectGdiEngine |
|
44 { |
|
45 public: |
|
46 |
|
47 /** |
|
48 @see CDirectGdiContext::Activate() |
|
49 @see Deactivate() |
|
50 */ |
|
51 virtual TInt Activate(RDirectGdiImageTarget& aTarget) = 0; |
|
52 |
|
53 /** |
|
54 Unbinds the current rendering target (if any) from drawing engine. Drawing engine states or settings which |
|
55 are not dependent or non-target-specific remain unchanged. |
|
56 |
|
57 The DirectGDI generic layer will call this method prior to activating the drawing engine for another |
|
58 rendering target. |
|
59 |
|
60 @see Activate() |
|
61 |
|
62 @pre None. |
|
63 @post Drawing engine is no longer associated with any rendering target. |
|
64 */ |
|
65 virtual void Deactivate() = 0; |
|
66 |
|
67 /** |
|
68 @see CDirectGdiContext::SetOrigin() |
|
69 */ |
|
70 virtual void SetOrigin(const TPoint& aOrigin) = 0; |
|
71 |
|
72 /** |
|
73 @see CDirectGdiContext::ResetClippingRegion() |
|
74 @see SetClippingRegion() |
|
75 */ |
|
76 virtual void SetClippingRegion(const TRegion& aRegion) = 0; |
|
77 |
|
78 /** |
|
79 @see CDirectGdiContext::ReetClippingRegion() |
|
80 @see SetClippingRegion() |
|
81 */ |
|
82 virtual void ResetClippingRegion() = 0; |
|
83 |
|
84 /** |
|
85 @see CDirectGdiContext::SetDrawMode() |
|
86 */ |
|
87 virtual void SetDrawMode(DirectGdi::TDrawMode aMode) = 0; |
|
88 |
|
89 /** |
|
90 @see CDirectGdiContext::SetPenColor() |
|
91 @see DrawLine() |
|
92 @see DrawLineTo() |
|
93 @see DrawLineBy() |
|
94 @see DrawPolyLine() |
|
95 @see DrawPolygon() |
|
96 @see DrawRect() |
|
97 @see DrawRoundRect() |
|
98 */ |
|
99 virtual void SetPenColor(const TRgb& aColor) = 0; |
|
100 |
|
101 /** |
|
102 @see CDirectGdiContext::SetPenStyle() |
|
103 @see DrawLine() |
|
104 @see DrawLineTo() |
|
105 @see DrawLineBy() |
|
106 @see DrawPolyLine() |
|
107 @see DrawPolygon() |
|
108 @see DrawRect() |
|
109 @see DrawRoundRect() |
|
110 */ |
|
111 virtual void SetPenStyle(DirectGdi::TPenStyle aStyle) = 0; |
|
112 |
|
113 /** |
|
114 @see CDirectGdiContext::SetPenSize() |
|
115 @see DrawLine() |
|
116 @see DrawLineTo() |
|
117 @see DrawLineBy() |
|
118 @see DrawPolyLine() |
|
119 @see DrawPolygon() |
|
120 @see DrawRect() |
|
121 @see DrawRoundRect() |
|
122 @see Plot() |
|
123 */ |
|
124 virtual void SetPenSize(const TSize& aSize) = 0; |
|
125 |
|
126 /** |
|
127 @see CDirectGdiContext::SetTextShadowColor() |
|
128 */ |
|
129 virtual void SetTextShadowColor(const TRgb& aColor) = 0; |
|
130 |
|
131 /** |
|
132 @see CDirectGdiContext::SetBrushColor() |
|
133 */ |
|
134 virtual void SetBrushColor(const TRgb& aColor) = 0; |
|
135 |
|
136 /** |
|
137 @see CDirectGdiContext::SetBrushStyle() |
|
138 @see SetBrushPattern() |
|
139 */ |
|
140 virtual void SetBrushStyle(DirectGdi::TBrushStyle aStyle) = 0; |
|
141 |
|
142 /** |
|
143 @see CDirectGdiContext::SetBrushOrigin() |
|
144 @see SetBrushPattern() |
|
145 */ |
|
146 virtual void SetBrushOrigin(const TPoint& aOrigin) = 0; |
|
147 |
|
148 /** |
|
149 @see CDirectGdiContext::SetBrushPattern() |
|
150 @see ResetBrushPattern() |
|
151 |
|
152 @return KErrNone if successful, otherwise one of the system-wide error codes. |
|
153 */ |
|
154 virtual TInt SetBrushPattern(const CFbsBitmap& aPattern) = 0; |
|
155 |
|
156 /** |
|
157 @see CDirectGdiContext::ResetBrushPattern() |
|
158 @see SetBrushPattern() |
|
159 */ |
|
160 virtual void ResetBrushPattern() = 0; |
|
161 |
|
162 /** |
|
163 @see CDirectGdiContext::SetFont() |
|
164 |
|
165 @param aFontId The Font identifier. |
|
166 */ |
|
167 virtual void SetFont(TUint32 aFontId) = 0; |
|
168 |
|
169 /** |
|
170 @see CDirectGdiContext::ResetFont() |
|
171 */ |
|
172 virtual void ResetFont() = 0; |
|
173 |
|
174 /** |
|
175 Resets the engine state to default values. |
|
176 |
|
177 @see CDirectGdiContext::Reset() |
|
178 */ |
|
179 virtual void Reset() = 0; |
|
180 |
|
181 /** |
|
182 @see CDirectGdiContext::Clear(const TRect&) |
|
183 @see Clear() |
|
184 @see SetBrushColor() |
|
185 */ |
|
186 virtual void Clear(const TRect& aRect) = 0; |
|
187 |
|
188 /** |
|
189 @see CDirectGdiContext::Clear() |
|
190 @see Clear(const TRect&) |
|
191 @see SetBrushColor() |
|
192 */ |
|
193 virtual void Clear() = 0; |
|
194 |
|
195 /** |
|
196 @see CDirectGdiContext::MoveTo() |
|
197 @see MoveBy() |
|
198 */ |
|
199 virtual void MoveTo(const TPoint& aPoint) = 0; |
|
200 |
|
201 /** |
|
202 @see CDirectGdiContext::MoveBy() |
|
203 @see MoveTo() |
|
204 */ |
|
205 virtual void MoveBy(const TPoint& aVector) = 0; |
|
206 |
|
207 /** |
|
208 @see CDirectGdiContext::Plot() |
|
209 @see SetPenSize() |
|
210 @see SetPenColor() |
|
211 @see SetDrawMode() |
|
212 */ |
|
213 virtual void Plot(const TPoint& aPoint) = 0; |
|
214 |
|
215 /** |
|
216 @see CDirectGdiContext::DrawLine() |
|
217 @see DrawLineTo() |
|
218 @see DrawLineBy() |
|
219 @see SetPenSize() |
|
220 @see SetPenStyle() |
|
221 @see SetPenColor() |
|
222 @see SetDrawMode() |
|
223 */ |
|
224 virtual void DrawLine(const TPoint& aStart, const TPoint& aEnd) = 0; |
|
225 |
|
226 /** |
|
227 @see CDirectGdiContext::DrawLineTo() |
|
228 @see DrawLine() |
|
229 @see DrawLineBy() |
|
230 @see SetPenSize() |
|
231 @see SetPenStyle() |
|
232 @see SetPenColor() |
|
233 @see SetDrawMode() |
|
234 @see MoveTo() |
|
235 @see MoveBy() |
|
236 */ |
|
237 virtual void DrawLineTo(const TPoint& aPoint) = 0; |
|
238 |
|
239 /** |
|
240 @see CDirectGdiContext::DrawLineBy() |
|
241 @see DrawLine() |
|
242 @see DrawLineTo() |
|
243 @see SetPenSize() |
|
244 @see SetPenStyle() |
|
245 @see SetPenColor() |
|
246 @see DrawMode() |
|
247 @see MoveTo() |
|
248 @see MoveBy() |
|
249 */ |
|
250 virtual void DrawLineBy(const TPoint& aVector) = 0; |
|
251 |
|
252 /** |
|
253 @see CDirectGdiContext::DrawRect() |
|
254 */ |
|
255 virtual void DrawRect(const TRect& aRect) = 0; |
|
256 |
|
257 /** |
|
258 @see CDirectGdiContext::DrawRoundRect() |
|
259 */ |
|
260 virtual void DrawRoundRect(const TRect& aRect, const TSize& aCornerSize) = 0; |
|
261 |
|
262 /** |
|
263 @see CDirectGdiContext::DrawPolyLine() |
|
264 @see SetPenColor() |
|
265 @see SetPenSize() |
|
266 @see SetPenStyle() |
|
267 @see SetDrawMode() |
|
268 */ |
|
269 virtual void DrawPolyLine(const TArray<TPoint>& aPointList) = 0; |
|
270 |
|
271 /** |
|
272 @see CDirectGdiContext::DrawPolyLineNoEndPoint() |
|
273 @see SetPenColor() |
|
274 @see SetPenSize() |
|
275 @see SetPenStyle() |
|
276 @see SetDrawMode() |
|
277 */ |
|
278 virtual void DrawPolyLineNoEndPoint(const TArray<TPoint>& aPointList) = 0; |
|
279 |
|
280 /** |
|
281 @see CDirectGdiContext::DrawPolygon() |
|
282 */ |
|
283 virtual void DrawPolygon(const TArray<TPoint>& aPoints, DirectGdi::TFillRule aRule) = 0; |
|
284 |
|
285 /** |
|
286 @see CDirectGdiContext::DrawArc() |
|
287 @see DrawPie() |
|
288 */ |
|
289 virtual void DrawArc(const TRect& aRect, const TPoint& aStart, const TPoint& aEnd) = 0; |
|
290 |
|
291 /** |
|
292 @see CDirectGdiContext::DrawPie() |
|
293 */ |
|
294 virtual void DrawPie(const TRect& aRect, const TPoint& aStart, const TPoint& aEnd) = 0; |
|
295 |
|
296 /** |
|
297 @see CDirectGdiContext::DrawEllipse() |
|
298 */ |
|
299 virtual void DrawEllipse(const TRect& aRect) = 0; |
|
300 |
|
301 /** |
|
302 @see CDirectGdiContext::BitBlt(const TPoint&, const CFbsBitmap&, const TRect&) |
|
303 */ |
|
304 virtual void BitBlt(const TPoint& aDestPos, const CFbsBitmap& aBitmap, const TRect& aSourceRect) = 0; |
|
305 |
|
306 /** |
|
307 @see CDirectGdiContext::BitBltMasked(const TPoint&, const CFbsBitmap&, const TRect&, const CFbsBitmap&, TBool) |
|
308 */ |
|
309 virtual void BitBltMasked(const TPoint& aDestPos, |
|
310 const CFbsBitmap& aBitmap, |
|
311 const TRect& aSourceRect, |
|
312 const CFbsBitmap& aMask, |
|
313 TBool aInvertMask) = 0; |
|
314 |
|
315 /** |
|
316 @see CDirectGdiContext::BitBltMasked(const TPoint&, const CFbsBitmap&, const TRect&, const CFbsBitmap&, const TPoint&) |
|
317 */ |
|
318 virtual void BitBltMasked(const TPoint& aDestPos, |
|
319 const CFbsBitmap& aBitmap, |
|
320 const TRect& aSourceRect, |
|
321 const CFbsBitmap& aMask, |
|
322 const TPoint& aMaskPos) = 0; |
|
323 |
|
324 /** |
|
325 @see CDirectGdiContext::DrawBitmap(const TRect&, const CFbsBitmap&, const TRect&) |
|
326 */ |
|
327 virtual void DrawBitmap(const TRect& aDestRect, |
|
328 const CFbsBitmap& aBitmap, |
|
329 const TRect& aSourceRect) = 0; |
|
330 |
|
331 /** |
|
332 @see CDirectGdiContext::DrawBitmapMasked(const TRect&, const CFbsBitmap&, const TRect&, const CFbsBitmap&, TBool) |
|
333 */ |
|
334 virtual void DrawBitmapMasked(const TRect& aDestRect, |
|
335 const CFbsBitmap& aBitmap, |
|
336 const TRect& aSourceRect, |
|
337 const CFbsBitmap& aMask, |
|
338 TBool aInvertMask) = 0; |
|
339 |
|
340 /** |
|
341 @see CDirectGdiContext::DrawResource(const TPoint&, const RDirectGdiImageSource&, DirectGdi::TGraphicsRotation) |
|
342 */ |
|
343 virtual void DrawResource(const TPoint& aPos, |
|
344 const RDirectGdiDrawableSource& aSource, |
|
345 DirectGdi::TGraphicsRotation aRotation) = 0; |
|
346 |
|
347 /** |
|
348 @see CDirectGdiContext::DrawResource(const TRect&, const RDirectGdiImageSource&, DirectGdi::TGraphicsRotation) |
|
349 */ |
|
350 virtual void DrawResource(const TRect& aDestRect, |
|
351 const RDirectGdiDrawableSource& aSource, |
|
352 DirectGdi::TGraphicsRotation aRotation) = 0; |
|
353 |
|
354 /** |
|
355 @see CDirectGdiContext::DrawResource(const TRect&, const RDirectGdiImageSource&, const TRect&, DirectGdi::TGraphicsRotation) |
|
356 */ |
|
357 virtual void DrawResource(const TRect& aDestRect, |
|
358 const RDirectGdiDrawableSource& aSource, |
|
359 const TRect& aSourceRect, |
|
360 DirectGdi::TGraphicsRotation aRotation) = 0; |
|
361 |
|
362 /** |
|
363 @see CDirectGdiContext::DrawResource(const TRect&, const RDirectGdiDrawableSource&, const TDesC8&) |
|
364 */ |
|
365 virtual void DrawResource(const TRect& aDestRect, const RDirectGdiDrawableSource& aSource, const TDesC8& aParam) = 0; |
|
366 |
|
367 /** |
|
368 Draws a glyph. |
|
369 |
|
370 @param aPos Position to start drawing the glyph after rotation has been applied (if necessary). |
|
371 @param aChar Character being drawn. |
|
372 @param aGlyphImage Pointer to the glyph image data. |
|
373 @param aBitmapType Type of bitmap format. |
|
374 @param aGlyphImageSize Glyph image size. |
|
375 @param aClipRect Clipping rect. |
|
376 @param aRotation Rotation specifying how the glyph will be drawn. |
|
377 |
|
378 @pre The rendering target has been activated. |
|
379 @post Request to draw the glyph has been accepted. |
|
380 */ |
|
381 virtual void DrawGlyph(const TPoint& aPos, |
|
382 const TChar aChar, |
|
383 const TUint8* aGlyphImage, |
|
384 const TGlyphBitmapType aBitmapType, |
|
385 const TSize& aGlyphImageSize, |
|
386 const TRect& aClipRect, |
|
387 const DirectGdi::TGraphicsRotation aRotation = DirectGdi::EGraphicsRotationNone) = 0; |
|
388 |
|
389 /** |
|
390 Copies the contents of a rectangular area on the target to another location. |
|
391 The source rectangle will be intersected with the full extent of the target. |
|
392 |
|
393 @param aOffset Offset from the top left corner of the rectangle to be copied to the top left corner of the copy. |
|
394 @param aRect Area to be copied. |
|
395 |
|
396 @pre The rendering target has been activated. |
|
397 @post Request to copy an area has been accepted. There is no guarantee that the |
|
398 request has been processed when this method returns. |
|
399 */ |
|
400 virtual void CopyRect(const TPoint& aOffset, const TRect& aRect) = 0; |
|
401 |
|
402 /** |
|
403 Writes the drawing engine object state to the passed write stream. |
|
404 |
|
405 @see CDirectGdiContext::ExternalizeL() |
|
406 @see InternalizeL() |
|
407 |
|
408 @param aWriteStream Write stream. |
|
409 |
|
410 @pre None. |
|
411 @post The drawing engine object state has been written to the write stream. |
|
412 */ |
|
413 virtual void ExternalizeL(RWriteStream& aWriteStream) = 0; |
|
414 |
|
415 /** |
|
416 Sets the drawing engine object state from the read stream. |
|
417 |
|
418 @see CDirectGdiContext::InternalizeL() |
|
419 @see ExternalizeL() |
|
420 |
|
421 @param aReadStream Read stream. |
|
422 |
|
423 @pre None. |
|
424 @post The drawing engine object state has been updated with the values from the read stream. |
|
425 */ |
|
426 virtual void InternalizeL(RReadStream& aReadStream) = 0; |
|
427 |
|
428 /** |
|
429 @see CDirectGdiContext::GetInterface() |
|
430 */ |
|
431 virtual TInt GetInterface(TUid aInterfaceId, TAny*& aInterface) = 0; |
|
432 |
|
433 /** |
|
434 Prepares the drawing engine for drawing text as multiple DrawGlyph() commands. |
|
435 This function must always have a corresponding call to EndDrawGlyph() after the multiple |
|
436 DrawGlyph() commands have been made. |
|
437 Other than DrawGlyph(), no other rendering should be issued to the engine until EndDrawGlyph() has been called. |
|
438 |
|
439 @see EndDrawGlyph() |
|
440 @see DrawGlyph() |
|
441 |
|
442 @pre None. |
|
443 @post None. |
|
444 */ |
|
445 virtual void BeginDrawGlyph() = 0; |
|
446 |
|
447 /** |
|
448 Notifies the drawing engine that the last call to DrawGlyph() has been made for the |
|
449 text string. This function must always be matched to a corresponding BeginDrawGlyph() call. |
|
450 Other than DrawGlyph(), no other rendering should be issued to the engine until EndDrawGlyph() has |
|
451 been called. |
|
452 |
|
453 @see BeginDrawGlyph() |
|
454 @see DrawGlyph() |
|
455 |
|
456 @pre BeginDrawGlyph() has been called. |
|
457 @post None. |
|
458 */ |
|
459 virtual void EndDrawGlyph() = 0; |
|
460 |
|
461 }; |
|
462 |
|
463 const TUid KDirectGdiEngineUid = {0x10285A72}; |
|
464 |
|
465 |
|
466 #endif |