|
1 // Copyright (c) 2008-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 NVGRENDERSTAGE_H |
|
17 #define NVGRENDERSTAGE_H |
|
18 |
|
19 /** |
|
20 @file |
|
21 @test |
|
22 @internalComponent - Internal Symbian test code |
|
23 */ |
|
24 |
|
25 #include <graphics/wsrenderstage.h> |
|
26 #include <graphics/wsgraphicdrawer.h> |
|
27 #include <graphics/wsgraphicscontext.h> |
|
28 #include <nvg.h> |
|
29 #include "vgigraphicsinterface.h" |
|
30 |
|
31 |
|
32 /** This is a test render stage used for integration testing extended bitmaps of |
|
33 type 0x10285A78. This particular type of extended bitmap was created to test the |
|
34 extended bitmap APIs added to CFbsBitGc (CreateExtendedBitmap(), ExtendedBitmapType() |
|
35 and DataSize()) and also to test the extended bitmap rasterizer interface, CFbsRasterizer. |
|
36 The proprietary data contained in an extended bitmap of type 0x10285A78 defines |
|
37 the colours and stripe direction of a tricolour flag. |
|
38 |
|
39 This render stage implements the MWsGraphicsContext interface so that it can intercept |
|
40 any drawing commands that draw an extended bitmap, any commands that draw a normal |
|
41 bitmap are just passed through to the next renderstage (along with any commands that |
|
42 do not involve bitmaps at all). |
|
43 |
|
44 A CNvgRenderStage object is created by a CNvgRenderStageFactory. |
|
45 */ |
|
46 class CNvgRenderStage : public CWsRenderStage, public MWsGraphicsContext |
|
47 { |
|
48 public: |
|
49 static CNvgRenderStage* NewL(MWsGraphicDrawerEnvironment* aEnv, MWsScreen* aScreen, MWsScreenRedraw* aScreenRedraw, CWsRenderStage* aNextStage); |
|
50 virtual ~CNvgRenderStage(); |
|
51 |
|
52 public: |
|
53 // Implementation of CWsRenderStage |
|
54 TAny* ResolveObjectInterface(TUint aTypeId); |
|
55 virtual void Begin(const TRegion* aRegion); |
|
56 virtual void End(TRequestStatus* aCompositorReady); |
|
57 |
|
58 public: |
|
59 // Implementation of MWsGraphicsContext |
|
60 void BitBlt(const TPoint& aDestPos, const CFbsBitmap& aSourceBitmap); |
|
61 void BitBlt(const TPoint& aDestPos, const CFbsBitmap& aSourceBitmap, const TRect& aSourceRect); |
|
62 void BitBltMasked(const TPoint& aDestPos, const CFbsBitmap& aSourceBitmap, const TRect& aSourceRect, const CFbsBitmap& aMaskBitmap, TBool aInvertMask); |
|
63 void BitBltMasked(const TPoint& aDestPos, const CFbsBitmap& aSourceBitmap, const TRect& aSourceRect, const CFbsBitmap& aMaskBitmap, const TPoint& aMaskPos); |
|
64 void ResetClippingRegion(); |
|
65 void Clear(); |
|
66 void Clear(const TRect& aRect); |
|
67 void ResetBrushPattern(); |
|
68 void ResetFont(); |
|
69 void DrawArc(const TRect& aRect, const TPoint& aStart, const TPoint& aEnd); |
|
70 void DrawPie(const TRect& aRect, const TPoint& aStart, const TPoint& aEnd); |
|
71 void DrawBitmap(const TRect& aDestRect, const CFbsBitmap& aSourceBitmap); |
|
72 void DrawBitmap(const TRect& aDestRect, const CFbsBitmap& aSourceBitmap, const TRect& aSourceRect); |
|
73 void DrawBitmapMasked(const TRect& aDestRect, const CFbsBitmap& aSourceBitmap,const TRect& aSourceRect, const CFbsBitmap& aMaskBitmap, TBool aInvertMask); |
|
74 void DrawRoundRect(const TRect& aRect, const TSize& aEllipse); |
|
75 void DrawPolyLine(const TArray<TPoint>& aPointList); |
|
76 void DrawPolyLineNoEndPoint(const TArray<TPoint>& aPointList); |
|
77 void DrawPolygon(const TArray<TPoint>& aPointList, TFillRule aFillRule=EAlternate); |
|
78 void DrawEllipse(const TRect& aRect); |
|
79 void DrawLine(const TPoint& aStart, const TPoint& aEnd); |
|
80 void DrawLineTo(const TPoint& aPoint); |
|
81 void DrawLineBy(const TPoint& aVector); |
|
82 void DrawRect(const TRect& aRect); |
|
83 void DrawText(const TDesC& aText,const TTextParameters* aParam); |
|
84 void DrawText(const TDesC& aText,const TTextParameters* aParam,const TPoint& aPosition); |
|
85 void DrawText(const TDesC& aText,const TTextParameters* aParam,const TRect& aClipRect); |
|
86 void DrawText(const TDesC& aText,const TTextParameters* aParam,const TRect& aClipFillRect,TInt aBaselineOffset,TTextAlign aHrz=ELeft,TInt aMargin=0); |
|
87 void DrawTextVertical(const TDesC& aText,const TTextParameters* aParam,TBool aUp); |
|
88 void DrawTextVertical(const TDesC& aText,const TTextParameters* aParam,const TPoint& aPosition,TBool aUp); |
|
89 void DrawTextVertical(const TDesC& aText,const TTextParameters* aParam,const TRect& aClipRect,TBool aUp); |
|
90 void DrawTextVertical(const TDesC& aText,const TTextParameters* aParam,const TRect& aClipRect,TInt aBaselineOffset,TBool aUp,TTextAlign aVert=ELeft,TInt aMargin=0); |
|
91 void DrawTextVertical(const TDesC& aText,const TTextParameters* aParam,const TRect& aClipRect,TInt aBaselineOffset,TInt aTextWidth,TBool aUp,TTextAlign aVert=ELeft,TInt aMargin=0); |
|
92 void MoveTo(const TPoint& aPoint); |
|
93 void MoveBy(const TPoint& aVector); |
|
94 void Plot(const TPoint& aPoint); |
|
95 void Reset(); |
|
96 void SetBrushColor(const TRgb& aColor); |
|
97 void SetBrushOrigin(const TPoint& aOrigin); |
|
98 void SetBrushStyle(TBrushStyle aBrushStyle); |
|
99 void SetClippingRegion(const TRegion& aRegion); |
|
100 void SetDrawMode(TDrawMode aDrawMode); |
|
101 void SetOrigin(const TPoint& aPoint = TPoint(0, 0)); |
|
102 void SetPenColor(const TRgb& aColor); |
|
103 void SetPenStyle(TPenStyle aPenStyle); |
|
104 void SetPenSize(const TSize& aSize); |
|
105 void SetTextShadowColor(const TRgb& aColor); |
|
106 void SetCharJustification(TInt aExcessWidth, TInt aNumChars); |
|
107 void SetWordJustification(TInt aExcessWidth, TInt aNumGaps); |
|
108 void SetUnderlineStyle(TFontUnderline aUnderlineStyle); |
|
109 void SetStrikethroughStyle(TFontStrikethrough aStrikethroughStyle); |
|
110 void SetBrushPattern(const CFbsBitmap& aBitmap); |
|
111 void SetBrushPattern(TInt aFbsBitmapHandle); |
|
112 void SetFont(const CFont* aFont); |
|
113 void CopyRect(const TPoint& aOffset, const TRect& aRect); |
|
114 void UpdateJustification(const TDesC& aText,const TTextParameters* aParam); |
|
115 void UpdateJustificationVertical(const TDesC& aText,const TTextParameters* aParam,TBool aUp); |
|
116 void SetFontNoDuplicate(const CFont* aFont); |
|
117 TBool HasBrushPattern() const; |
|
118 TBool HasFont() const; |
|
119 TRgb BrushColor() const; |
|
120 TRgb PenColor() const; |
|
121 TRgb TextShadowColor() const; |
|
122 TInt GetError(); |
|
123 TPoint Origin() const; |
|
124 const TRegion& ClippingRegion(); |
|
125 TInt Push(); |
|
126 void Pop(); |
|
127 |
|
128 private: |
|
129 CNvgRenderStage(); |
|
130 void ConstructL(CWsRenderStage* aNextStage); |
|
131 |
|
132 private: |
|
133 // Helper methods that support the implementation of MWsGraphicsContext |
|
134 void DrawExtendedBitmap(MWsGraphicsContext& aGc, const TRect& aDestRect, const CFbsBitmap& aSourceBitmap); |
|
135 void DrawExtendedBitmap(CFbsBitGc& aGc, const TRect& aDestRect, const CFbsBitmap& aSourceBitmap); |
|
136 void CopyExtendedBitmapToNormalBitmap(const CFbsBitmap& aExtendedBitmapSrc, CFbsBitmap& aBitmapDst); |
|
137 |
|
138 private: |
|
139 MWsGraphicsContext* iGc; |
|
140 TInt iExtendedBitmapError; |
|
141 TPoint iOrigin; |
|
142 RRegion iEmptyRegion; |
|
143 CFbsBitmap* iBmp; |
|
144 CFbsBitmap* iMaskBmp; |
|
145 CFbsBitmap* iBrushPattern; |
|
146 CFbsBitmap* iInternalBrushPattern; |
|
147 MWsGraphicsContext::TBrushStyle iBrushStyle; |
|
148 CVGIGraphicsInterface* iGraphicsInterface; |
|
149 CNvgEngine* iNvgEngine; |
|
150 }; |
|
151 |
|
152 #endif // NVGRENDERSTAGE_H |