|
1 /* |
|
2 * Copyright (c) 2006-2007 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: Declares the MHuiTargetBitmap interface. MHuiTargetBitmap is |
|
15 * an interface for a writable bitmap in raw format. |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 |
|
21 #ifndef __HUITARGETBITMAP_H__ |
|
22 #define __HUITARGETBITMAP_H__ |
|
23 |
|
24 |
|
25 #include <e32base.h> |
|
26 |
|
27 |
|
28 /** |
|
29 * Interface for a bitmap that can be drawn on as a raw bitmap. CHuiBitgdiGc |
|
30 * uses this interface for accessing the target bitmap where drawing is |
|
31 * being done. |
|
32 */ |
|
33 class MHuiTargetBitmap |
|
34 { |
|
35 public: |
|
36 |
|
37 virtual ~MHuiTargetBitmap() {} |
|
38 |
|
39 /** |
|
40 * Determines the size of the bitmap. |
|
41 * |
|
42 * @return Size of the bitmap in pixels. |
|
43 */ |
|
44 virtual TSize Size() const = 0; |
|
45 |
|
46 /** |
|
47 * Determines the pixel format of the bitmap. |
|
48 * |
|
49 * @return Format of the bitmap as a TDisplayMode. |
|
50 * |
|
51 * @see TDisplayMode in the platform documentation. |
|
52 */ |
|
53 virtual TDisplayMode DisplayMode() const = 0; |
|
54 |
|
55 /** |
|
56 * Locks the heap so that the memory buffer of the bitmap can be |
|
57 * accessed directly. Prevents heap compression done by other threads. |
|
58 * The heap must be unlocked with UnlockHeap() after the buffer |
|
59 * processing has been completed. |
|
60 * |
|
61 * @see CFbsBitmap::LockHeap() |
|
62 */ |
|
63 virtual void LockHeap() = 0; |
|
64 |
|
65 /** |
|
66 * Unlocks the heap. Must be called after the heap has been locked |
|
67 * and operated on. |
|
68 */ |
|
69 virtual void UnlockHeap() = 0; |
|
70 |
|
71 /** |
|
72 * Provides access to the memory buffer of the bitmap. |
|
73 * |
|
74 * @return Pointer to the beginning of the pixel data. |
|
75 * |
|
76 * @see LockHeap() |
|
77 * @see UnlockHeap() |
|
78 */ |
|
79 virtual TAny* DataAddress() = 0; |
|
80 |
|
81 /** |
|
82 * Sets the clipping rectangle for the bitmap. All drawing operations |
|
83 * (FillRect(), BitBlt(), BitBltMasked()) are confined into this |
|
84 * rectangle when drawn. |
|
85 * |
|
86 * @param aRect Clipping rectangle. |
|
87 */ |
|
88 virtual void SetClippingRect(const TRect& aRect) = 0; |
|
89 |
|
90 /** |
|
91 * Sets the clipping region for the bitmap. All drawing operations |
|
92 * (FillRect(), BitBlt(), BitBltMasked()) are confined into this |
|
93 * region when drawn. |
|
94 * |
|
95 * @param aRegion Region containing clipping rectangles. |
|
96 */ |
|
97 virtual void SetClippingRegion(const TRegion& aRegion) = 0; |
|
98 |
|
99 /** |
|
100 * Draws a solid-colored rectangle. Affected by the clipping rectangle. |
|
101 * |
|
102 * @param aRect Rectangle to fill with a solid color. |
|
103 * @param aColor RGBA color to use for filling. Note that the alpha |
|
104 * component of the TRgb is also valid. |
|
105 */ |
|
106 virtual void FillRect(const TRect& aRect, const TRgb& aColor) = 0; |
|
107 |
|
108 /** |
|
109 * Draws a bitmap. Affected by the clipping rectangle. Analogous to |
|
110 * the corresponding CFbsBitGc::BitBlt() method. |
|
111 * |
|
112 * @param aPoint Position where to draw. |
|
113 * @param aBitmap Bitmap to draw. |
|
114 * @param aSourceRect Rectangle within the source bitmap where to draw from. |
|
115 */ |
|
116 virtual void BitBlt(const TPoint& aPoint, const CFbsBitmap *aBitmap, const TRect &aSourceRect) = 0; |
|
117 |
|
118 /** |
|
119 * Draws a masked bitmap. Affected by the clipping rectangle. |
|
120 * Analogous to the corresponding CFbsBitGc::BitBltMasked() method. |
|
121 * |
|
122 * @param aPoint Position where to draw. |
|
123 * @param aBitmap Bitmap to draw. |
|
124 * @param aSourceRect Rectangle within the source bitmap where to draw from. |
|
125 * @param aMaskBitmap Mask bitmap. |
|
126 * @param aInvertMask ETrue if the mask should be inverted. |
|
127 */ |
|
128 virtual void BitBltMasked(const TPoint &aPoint, const CFbsBitmap *aBitmap, const TRect &aSourceRect, const CFbsBitmap *aMaskBitmap, TBool aInvertMask) = 0; |
|
129 |
|
130 /** |
|
131 * Returns pointer to the bitmap. If the class do not have CFbsBitmap this methdod returns NULL. |
|
132 * |
|
133 * @return Pointer to the bitmap. |
|
134 */ |
|
135 virtual CFbsBitmap* FbsBitmap() = 0; |
|
136 |
|
137 /** |
|
138 * Returns the BITGDI graphics context that is used for drawing in |
|
139 * the back buffer. |
|
140 * |
|
141 * Writing a real implementation for this might not be needed if the renderer |
|
142 * does not support symbian graphics context. |
|
143 * |
|
144 * @return BITGDI graphics context. |
|
145 */ |
|
146 virtual CFbsBitGc* Gc() = 0; |
|
147 }; |
|
148 |
|
149 |
|
150 #endif // __HUITARGETBITMAP_H__ |