|
1 // Copyright (c) 2006-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 #ifndef __REMOTEGC_H__ |
|
17 #define __REMOTEGC_H__ |
|
18 |
|
19 #include <w32std.h> |
|
20 #include <s32mem.h> |
|
21 |
|
22 class CCommandBuffer; |
|
23 class RWsDrawableSource; |
|
24 |
|
25 /** |
|
26 MCommandBufferObserver should be implemented by classes that want a notification when the commandbuffer has been updated. |
|
27 @publishedPartner |
|
28 @released*/ |
|
29 class MCommandBufferObserver |
|
30 { |
|
31 public: |
|
32 /** |
|
33 CommandBufferUpdated is called when the commandbuffer has been updated. |
|
34 |
|
35 @param aDrawRect The rect that has been updated. |
|
36 @param aBoundingRect The boundingrect of the commands that has been updated. |
|
37 */ |
|
38 virtual void CommandBufferUpdated(const TRect& aDrawRect, const TRect& aBoundingRect) = 0; |
|
39 }; |
|
40 |
|
41 /** |
|
42 Intercepts and logs all draw operations to a window-gc |
|
43 @publishedPartner |
|
44 @released*/ |
|
45 NONSHARABLE_CLASS(CRemoteGc): public CWindowGc |
|
46 { |
|
47 public: |
|
48 IMPORT_C static CRemoteGc* NewL(CWsScreenDevice* aDevice); |
|
49 IMPORT_C ~CRemoteGc(); |
|
50 IMPORT_C void SetCommandBufferObserver(MCommandBufferObserver* aCommandBufferObserver); |
|
51 IMPORT_C void ResetCommandBuffer(); |
|
52 IMPORT_C void ExternalizeL(RWsGraphicMsgBuf& aMsgBuf, TBool aEntireBuffer); |
|
53 IMPORT_C void BeginDraw(const TRect& aRect); |
|
54 IMPORT_C void EndDraw(); |
|
55 |
|
56 public: // inherited methods |
|
57 |
|
58 // CWindowGc |
|
59 void Activate(RDrawableWindow &aDevice); |
|
60 void Deactivate(); |
|
61 void BitBlt(const TPoint &aPoint, const CWsBitmap *aBitmap); |
|
62 void BitBlt(const TPoint &aDestination, const CWsBitmap *aBitmap, const TRect &aSource); |
|
63 void BitBltMasked(const TPoint& aPoint, const CWsBitmap *aBitmap, const TRect& aSourceRect, const CWsBitmap *aMaskBitmap, TBool aInvertMask); |
|
64 |
|
65 // CBitmapContext |
|
66 void Clear(); |
|
67 void Clear(const TRect &aRect); |
|
68 void CopyRect(const TPoint &anOffset, const TRect &aRect); |
|
69 void BitBlt(const TPoint &aPoint, const CFbsBitmap *aBitmap); |
|
70 void BitBlt(const TPoint &aDestination, const CFbsBitmap *aBitmap, const TRect &aSource); |
|
71 void BitBltMasked(const TPoint& aPoint, const CFbsBitmap* aBitmap, const TRect& aSourceRect, const CFbsBitmap* aMaskBitmap, TBool aInvertMask); |
|
72 void SetFaded(TBool aFaded); |
|
73 void SetFadingParameters(TUint8 aBlackMap,TUint8 aWhiteMap); |
|
74 TInt AlphaBlendBitmaps(const TPoint& aDestPt, const CFbsBitmap* aSrcBmp, const TRect& aSrcRect, const CFbsBitmap* aAlphaBmp, const TPoint& aAlphaPt); |
|
75 TInt AlphaBlendBitmaps(const TPoint& aDestPt, const CWsBitmap* aSrcBmp, const TRect& aSrcRect, const CWsBitmap* aAlphaBmp, const TPoint& aAlphaPt); |
|
76 |
|
77 // CGraphicsContext |
|
78 void SetOrigin(const TPoint &aPoint); |
|
79 void SetDrawMode(TDrawMode aDrawingMode); |
|
80 void SetClippingRect(const TRect& aRect); |
|
81 void CancelClippingRect(); |
|
82 void Reset(); |
|
83 void UseFont(const CFont *aFont); |
|
84 void DiscardFont(); |
|
85 void SetUnderlineStyle(TFontUnderline aUnderlineStyle); |
|
86 void SetStrikethroughStyle(TFontStrikethrough aStrikethroughStyle); |
|
87 void SetWordJustification(TInt aExcessWidth,TInt aNumGaps); |
|
88 void SetCharJustification(TInt aExcessWidth,TInt aNumChars); |
|
89 void SetPenColor(const TRgb &aColor); |
|
90 void SetPenStyle(TPenStyle aPenStyle); |
|
91 void SetPenSize(const TSize& aSize); |
|
92 void SetBrushColor(const TRgb &aColor); |
|
93 void SetBrushStyle(TBrushStyle aBrushStyle); |
|
94 void SetBrushOrigin(const TPoint &aOrigin); |
|
95 void UseBrushPattern(const CFbsBitmap *aDevice); |
|
96 void DiscardBrushPattern(); |
|
97 void MoveTo(const TPoint &aPoint); |
|
98 void MoveBy(const TPoint &aPoint); |
|
99 void Plot(const TPoint &aPoint); |
|
100 void DrawArc(const TRect &aRect,const TPoint &aStart,const TPoint &aEnd); |
|
101 void DrawLine(const TPoint &aPoint1,const TPoint &aPoint2); |
|
102 void DrawLineTo(const TPoint &aPoint); |
|
103 void DrawLineBy(const TPoint &aPoint); |
|
104 void DrawPolyLine(const CArrayFix<TPoint> *aPointList); |
|
105 void DrawPolyLine(const TPoint* aPointList, TInt aNumPoints); |
|
106 void DrawPie(const TRect &aRect,const TPoint &aStart,const TPoint &aEnd); |
|
107 void DrawEllipse(const TRect &aRect); |
|
108 void DrawRect(const TRect &aRect); |
|
109 void DrawRoundRect(const TRect &aRect,const TSize &aEllipse); |
|
110 TInt DrawPolygon(const CArrayFix<TPoint> *aPointList, TFillRule aFillRule); |
|
111 TInt DrawPolygon(const TPoint* aPointList,TInt aNumPoints, TFillRule aFillRule); |
|
112 void DrawBitmap(const TPoint &aTopLeft, const CFbsBitmap *aDevice); |
|
113 void DrawBitmap(const TRect &aDestRect, const CFbsBitmap *aDevice); |
|
114 void DrawBitmap(const TRect &aDestRect, const CFbsBitmap *aDevice, const TRect &aSourceRect); |
|
115 void DrawBitmapMasked(const TRect& aDestRect, const CFbsBitmap* aBitmap, const TRect& aSourceRect, const CFbsBitmap* aMaskBitmap, TBool aInvertMask); |
|
116 void DrawBitmapMasked(const TRect& aDestRect, const CWsBitmap* aBitmap, const TRect& aSourceRect, const CWsBitmap* aMaskBitmap, TBool aInvertMask); |
|
117 |
|
118 // Required as not all DrawText and DrawTextVertical functions are implemented in CRemoteGc |
|
119 using CWindowGc::DrawText; |
|
120 using CWindowGc::DrawTextVertical; |
|
121 |
|
122 void DrawText(const TDesC &aBuf,const TPoint &aPos); |
|
123 void DrawText(const TDesC &aBuf,const TRect &aBox,TInt aBaselineOffset, TTextAlign aHoriz, TInt aLeftMrg); |
|
124 void DrawText(const TDesC& aText,const TPoint& aPosition,const TDrawTextParam& aParam); |
|
125 void MapColors(const TRect& aRect,const TRgb* aColors, TInt aNumPairs, TBool aMapForwards); |
|
126 TInt SetClippingRegion(const TRegion &aRegion); |
|
127 void CancelClippingRegion(); |
|
128 void DrawTextVertical(const TDesC& aText,const TPoint& aPos,TBool aUp); |
|
129 void DrawTextVertical(const TDesC& aText,const TRect& aBox,TInt aBaselineOffset,TBool aUp,TTextAlign aVert,TInt aMargin); |
|
130 void DrawWsGraphic(const TWsGraphicId& aId,const TRect& aDestRect); |
|
131 void DrawWsGraphic(const TWsGraphicId& aId,const TRect& aDestRect,const TDesC8& aData); |
|
132 void SetDitherOrigin(const TPoint& aPoint); |
|
133 void SetOpaque(TBool aDrawOpaque=ETrue); |
|
134 protected: |
|
135 TInt APIExtension(TUid aUid, TAny*& aOutput, TAny* aInput); |
|
136 private: |
|
137 CRemoteGc(CWsScreenDevice* aDevice); |
|
138 void ConstructL(); |
|
139 TInt APIExGetUnderlineMetrics(TAny*& aOutput); |
|
140 TInt APIExSetShadowColor(TAny* aShadowColor); |
|
141 TInt APIExGetShadowColor(TAny*& aOutput); |
|
142 // New DrawText API's that take in context |
|
143 TInt APIExDrawText(const TDesC &aBuf,const TTextParameters* aParam,const TPoint &aPos); |
|
144 TInt APIExDrawText(const TDesC &aBuf,const TTextParameters* aParam,const TRect &aBox,TInt aBaselineOffset,TTextAlign aHoriz=ELeft,TInt aLeftMrg=0); |
|
145 |
|
146 TInt APIExDrawTextVertical(const TDesC& aText,const TTextParameters* aParam,const TPoint& aPos,TBool aUp); |
|
147 TInt APIExDrawTextVertical(const TDesC& aText,const TTextParameters* aParam,const TRect& aBox,TInt aBaselineOffset,TBool aUp,TTextAlign aVert=ELeft,TInt aMargin=0); |
|
148 TInt APIExInterface(TAny*& aInterface, TUid aInterfaceId); |
|
149 |
|
150 void DrawResource(const TPoint& aPos, const RWsDrawableSource& aSource, CWindowGc::TGraphicsRotation aRotation=CWindowGc::EGraphicsRotationNone); |
|
151 void DrawResource(const TRect& aDestRect, const RWsDrawableSource& aSource, CWindowGc::TGraphicsRotation aRotation=CWindowGc::EGraphicsRotationNone); |
|
152 void DrawResource(const TRect& aDestRect, const RWsDrawableSource& aSource, const TRect& aSrcRect, CWindowGc::TGraphicsRotation aRotation=CWindowGc::EGraphicsRotationNone); |
|
153 void DrawResource(const TRect& aDestRect, const RWsDrawableSource& aSource, const TDesC8& aParam); |
|
154 |
|
155 private: |
|
156 TRect iDrawRect; |
|
157 TRect iBoundingRect; |
|
158 TBool iHasBitmapCommand; |
|
159 CCommandBuffer* iCommandBuffer; |
|
160 MCommandBufferObserver* iCommandBufferObserver; |
|
161 #ifdef SYMBIAN_GRAPHICS_GCE |
|
162 CFbsFont *iFont; |
|
163 TRgb iShadowColor; |
|
164 class CPimpl; |
|
165 friend class CPimpl; |
|
166 CPimpl* iRemoteGcPimpl; |
|
167 #endif |
|
168 }; |
|
169 |
|
170 #endif // __REMOTEGC_H__ |