|
1 /* |
|
2 * Copyright (c) 2009 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: |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef HGVGDRAWBUFFER_H_ |
|
19 #define HGVGDRAWBUFFER_H_ |
|
20 |
|
21 // INCLUDES |
|
22 #include <e32base.h> |
|
23 #include <VG/openvg.h> |
|
24 #include <gulcolor.h> |
|
25 |
|
26 /** |
|
27 * Helper class for rendering graphics to offscreen buffer |
|
28 * using avkon and then copying that buffer to OpenVG images. |
|
29 */ |
|
30 NONSHARABLE_CLASS(CHgVgDrawBuffer) : public CBase |
|
31 { |
|
32 public: |
|
33 |
|
34 /** |
|
35 * Creates new CHgVgDrawBuffer |
|
36 * |
|
37 * @param aDrawBufferSize |
|
38 * @param aDisplayMode |
|
39 * @return HgVgDrawBuffer-object |
|
40 */ |
|
41 static CHgVgDrawBuffer* NewL (const TSize& aDrawBufferSize, const TDisplayMode& aMode); |
|
42 |
|
43 // Destructor. |
|
44 virtual ~CHgVgDrawBuffer(); |
|
45 |
|
46 public: // METHODS |
|
47 |
|
48 /** |
|
49 * Getter for buffer size in pixels. |
|
50 * |
|
51 * @return buffer size in pixels. |
|
52 */ |
|
53 const TSize& BufferSize() const; |
|
54 |
|
55 /** |
|
56 * Getter for draw context. |
|
57 * |
|
58 * @return reference to CFbsBitGc-object. |
|
59 */ |
|
60 CFbsBitGc& Gc(); |
|
61 |
|
62 /** |
|
63 * |
|
64 */ |
|
65 CFbsBitmap& DrawBuffer(); |
|
66 |
|
67 /** |
|
68 * Clears draw buffer |
|
69 * |
|
70 * @param aColor color to clear. |
|
71 */ |
|
72 void Clear(const TRect& aRect, const TRgb& aColor); |
|
73 |
|
74 /** |
|
75 * Draws text to draw buffer. |
|
76 * |
|
77 * @param aText text. |
|
78 * @param aFont font to use for text rendering. |
|
79 * @param aColor color to use for text rendering. |
|
80 * @param aPosition position to render. |
|
81 */ |
|
82 void DrawText(const TDesC& aText, const CFont* aFont, |
|
83 const TRgb& aColor, const TPoint& aPosition); |
|
84 |
|
85 /** |
|
86 * Gets drawbuffer to VGImage. |
|
87 * |
|
88 * @param aSrcRect rectangle in draw buffer to copy to the image. |
|
89 * @param aDestRect rectangle in image. |
|
90 * @param aDestImage destination image. |
|
91 */ |
|
92 void GetDrawBufferToVgImage(const TRect& aSrcRect, |
|
93 const TPoint& aDest, VGImage destImage, VGImageFormat destFormat); |
|
94 |
|
95 protected: // Constructors |
|
96 CHgVgDrawBuffer( ); |
|
97 |
|
98 void ConstructL (const TSize& aBufferSize, const TDisplayMode& aMode ); |
|
99 |
|
100 private: // Data |
|
101 |
|
102 CFbsBitmapDevice* iDevice; // owns |
|
103 CFbsBitmap* iDrawBuffer; // owns |
|
104 CFbsBitGc* iGc; // owns |
|
105 TSize iBufferSize; |
|
106 |
|
107 }; |
|
108 |
|
109 #endif /* HGVGDRAWBUFFER_H_ */ |