sl@0
|
1 |
// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
2 |
// All rights reserved.
|
sl@0
|
3 |
// This component and the accompanying materials are made available
|
sl@0
|
4 |
// under the terms of "Eclipse Public License v1.0"
|
sl@0
|
5 |
// which accompanies this distribution, and is available
|
sl@0
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
7 |
//
|
sl@0
|
8 |
// Initial Contributors:
|
sl@0
|
9 |
// Nokia Corporation - initial contribution.
|
sl@0
|
10 |
//
|
sl@0
|
11 |
// Contributors:
|
sl@0
|
12 |
//
|
sl@0
|
13 |
// Description:
|
sl@0
|
14 |
// Declaration of a Graphics Device Interface (GDI) Context, which hooks
|
sl@0
|
15 |
// directly into a platform specific adaptation (typically hardware accelerated).
|
sl@0
|
16 |
//
|
sl@0
|
17 |
//
|
sl@0
|
18 |
|
sl@0
|
19 |
#ifndef DIRECTGDICONTEXT_H
|
sl@0
|
20 |
#define DIRECTGDICONTEXT_H
|
sl@0
|
21 |
|
sl@0
|
22 |
/**
|
sl@0
|
23 |
@file
|
sl@0
|
24 |
@publishedPartner
|
sl@0
|
25 |
@prototype
|
sl@0
|
26 |
*/
|
sl@0
|
27 |
|
sl@0
|
28 |
#include <graphics/directgdifont.h>
|
sl@0
|
29 |
#include <graphics/directgditypes.h>
|
sl@0
|
30 |
#include <e32std.h>
|
sl@0
|
31 |
#include <e32def.h>
|
sl@0
|
32 |
|
sl@0
|
33 |
// Forward declarations.
|
sl@0
|
34 |
//
|
sl@0
|
35 |
class CFbsBitmap;
|
sl@0
|
36 |
class RDirectGdiImageTarget;
|
sl@0
|
37 |
class MDirectGdiEngine;
|
sl@0
|
38 |
class CDirectGdiDriver;
|
sl@0
|
39 |
class RDirectGdiDrawableSource;
|
sl@0
|
40 |
|
sl@0
|
41 |
|
sl@0
|
42 |
/**
|
sl@0
|
43 |
This class typically delegates to a platform specific rendering engine
|
sl@0
|
44 |
which uses a generic interface and provides a platform specific mechanism.
|
sl@0
|
45 |
The rendering engine may or may not take advantage of hardware acceleration,
|
sl@0
|
46 |
depending on its implementation.
|
sl@0
|
47 |
|
sl@0
|
48 |
@publishedPartner
|
sl@0
|
49 |
@prototype
|
sl@0
|
50 |
@deprecated
|
sl@0
|
51 |
|
sl@0
|
52 |
@see CBitmapContext
|
sl@0
|
53 |
*/
|
sl@0
|
54 |
NONSHARABLE_CLASS(CDirectGdiContext): public CBase
|
sl@0
|
55 |
{
|
sl@0
|
56 |
public:
|
sl@0
|
57 |
IMPORT_C static CDirectGdiContext* NewL(CDirectGdiDriver& aDriver);
|
sl@0
|
58 |
IMPORT_C virtual ~CDirectGdiContext();
|
sl@0
|
59 |
IMPORT_C TInt Activate(RDirectGdiImageTarget& aTarget);
|
sl@0
|
60 |
IMPORT_C void NoJustifyAutoUpdate();
|
sl@0
|
61 |
IMPORT_C void SetJustifyAutoUpdate();
|
sl@0
|
62 |
// The following are equivalent to CFbsBitGc functionality which maps
|
sl@0
|
63 |
// to client’s CWindowGc requests
|
sl@0
|
64 |
IMPORT_C void BitBlt(const TPoint& aDestPos, const CFbsBitmap& aSourceBitmap);
|
sl@0
|
65 |
IMPORT_C void BitBlt(const TPoint& aDestPos, const CFbsBitmap& aSourceBitmap, const TRect& aSourceRect);
|
sl@0
|
66 |
IMPORT_C void BitBltMasked(const TPoint& aDestPos,
|
sl@0
|
67 |
const CFbsBitmap& aSourceBitmap, const TRect& aSourceRect,
|
sl@0
|
68 |
const CFbsBitmap& aMaskBitmap, TBool aInvertMask);
|
sl@0
|
69 |
IMPORT_C void BitBltMasked(const TPoint& aDestPos,
|
sl@0
|
70 |
const CFbsBitmap& aSourceBitmap, const TRect& aSourceRect,
|
sl@0
|
71 |
const CFbsBitmap& aMaskBitmap, const TPoint& aMaskPos);
|
sl@0
|
72 |
IMPORT_C void ResetClippingRegion();
|
sl@0
|
73 |
IMPORT_C void Clear();
|
sl@0
|
74 |
IMPORT_C void Clear(const TRect& aRect);
|
sl@0
|
75 |
IMPORT_C void ResetBrushPattern();
|
sl@0
|
76 |
IMPORT_C void ResetFont();
|
sl@0
|
77 |
IMPORT_C void DrawArc(const TRect& aRect, const TPoint& aStart, const TPoint& aEnd);
|
sl@0
|
78 |
IMPORT_C void DrawPie(const TRect& aRect, const TPoint& aStart, const TPoint& aEnd);
|
sl@0
|
79 |
IMPORT_C void DrawBitmap(const TRect& aDestRect, const CFbsBitmap& aSourceBitmap);
|
sl@0
|
80 |
IMPORT_C void DrawBitmap(const TRect& aDestRect,
|
sl@0
|
81 |
const CFbsBitmap& aSourceBitmap, const TRect& aSourceRect);
|
sl@0
|
82 |
IMPORT_C void DrawBitmapMasked(const TRect& aDestRect,
|
sl@0
|
83 |
const CFbsBitmap& aSourceBitmap,const TRect& aSourceRect,
|
sl@0
|
84 |
const CFbsBitmap& aMaskBitmap, TBool aInvertMask);
|
sl@0
|
85 |
IMPORT_C void DrawRoundRect(const TRect& aRect, const TSize& aCornerSize);
|
sl@0
|
86 |
IMPORT_C void DrawPolyLine(const TArray<TPoint>& aPointList);
|
sl@0
|
87 |
IMPORT_C void DrawPolyLineNoEndPoint(const TArray<TPoint>& aPointList);
|
sl@0
|
88 |
IMPORT_C void DrawPolygon(const TArray<TPoint>& aPointList, DirectGdi::TFillRule aFillRule=DirectGdi::EAlternate);
|
sl@0
|
89 |
IMPORT_C void DrawEllipse(const TRect& aRect);
|
sl@0
|
90 |
IMPORT_C void DrawLine(const TPoint& aStart, const TPoint& aEnd);
|
sl@0
|
91 |
IMPORT_C void DrawLineTo(const TPoint& aPoint);
|
sl@0
|
92 |
IMPORT_C void DrawLineBy(const TPoint& aVector);
|
sl@0
|
93 |
IMPORT_C void DrawRect(const TRect& aRect);
|
sl@0
|
94 |
IMPORT_C void DrawText(const TDesC& aText, const DirectGdi::TTextParameters* aParam);
|
sl@0
|
95 |
IMPORT_C void DrawText(const TDesC& aText, const DirectGdi::TTextParameters* aParam, const TPoint& aPosition);
|
sl@0
|
96 |
IMPORT_C void DrawText(const TDesC& aText, const DirectGdi::TTextParameters* aParam, const TRect& aClipRect);
|
sl@0
|
97 |
IMPORT_C void DrawText(const TDesC& aText, const DirectGdi::TTextParameters* aParam, const TRect& aClipFillRect, TInt aBaselineOffset,
|
sl@0
|
98 |
DirectGdi::TTextAlign aAlignment = DirectGdi::ELeft, TInt aMargin = 0);
|
sl@0
|
99 |
IMPORT_C void DrawTextVertical(const TDesC& aText, const DirectGdi::TTextParameters* aParam, TBool aUp);
|
sl@0
|
100 |
IMPORT_C void DrawTextVertical(const TDesC& aText, const DirectGdi::TTextParameters* aParam, const TPoint& aPosition, TBool aUp);
|
sl@0
|
101 |
IMPORT_C void DrawTextVertical(const TDesC& aText, const DirectGdi::TTextParameters* aParam, const TRect& aClipRect, TBool aUp);
|
sl@0
|
102 |
IMPORT_C void DrawTextVertical(const TDesC& aText, const DirectGdi::TTextParameters* aParam, const TRect& aClipRect, TInt aBaselineOffset,
|
sl@0
|
103 |
TBool aUp, DirectGdi::TTextAlign aVerticalAlignment = DirectGdi::ELeft, TInt aMargin = 0);
|
sl@0
|
104 |
IMPORT_C void DrawTextVertical(const TDesC& aText, const DirectGdi::TTextParameters* aParam, const TRect& aClipRect, TInt aBaselineOffset,
|
sl@0
|
105 |
TInt aTextWidth, TBool aUp, DirectGdi::TTextAlign aVerticalAlignment = DirectGdi::ELeft, TInt aMargin = 0);
|
sl@0
|
106 |
IMPORT_C void MoveTo(const TPoint& aPoint);
|
sl@0
|
107 |
IMPORT_C void MoveBy(const TPoint& aVector);
|
sl@0
|
108 |
IMPORT_C void Plot(const TPoint& aPoint);
|
sl@0
|
109 |
IMPORT_C void Reset();
|
sl@0
|
110 |
IMPORT_C void SetBrushColor(const TRgb& aColor);
|
sl@0
|
111 |
IMPORT_C void SetBrushOrigin(const TPoint& aOrigin);
|
sl@0
|
112 |
IMPORT_C void SetBrushStyle(DirectGdi::TBrushStyle aBrushStyle);
|
sl@0
|
113 |
IMPORT_C void SetClippingRegion(const TRegion& aRegion);
|
sl@0
|
114 |
IMPORT_C void SetDrawMode(DirectGdi::TDrawMode aDrawMode);
|
sl@0
|
115 |
IMPORT_C void SetOrigin(const TPoint& aPoint = TPoint(0, 0));
|
sl@0
|
116 |
IMPORT_C void SetPenColor(const TRgb& aColor);
|
sl@0
|
117 |
IMPORT_C void SetPenStyle(DirectGdi::TPenStyle aPenStyle);
|
sl@0
|
118 |
IMPORT_C void SetPenSize(const TSize& aSize);
|
sl@0
|
119 |
IMPORT_C void SetTextShadowColor(const TRgb& aColor);
|
sl@0
|
120 |
IMPORT_C void SetCharJustification(TInt aExcessWidth, TInt aNumChars);
|
sl@0
|
121 |
IMPORT_C void SetWordJustification(TInt aExcessWidth, TInt aNumGaps);
|
sl@0
|
122 |
IMPORT_C void SetUnderlineStyle(DirectGdi::TFontUnderline aUnderlineStyle);
|
sl@0
|
123 |
IMPORT_C void SetStrikethroughStyle(DirectGdi::TFontStrikethrough aStrikethroughStyle);
|
sl@0
|
124 |
IMPORT_C void SetBrushPattern(const CFbsBitmap& aBitmap);
|
sl@0
|
125 |
IMPORT_C void SetBrushPattern(TInt aFbsBitmapHandle);
|
sl@0
|
126 |
IMPORT_C void SetFont(const CFont* aFont);
|
sl@0
|
127 |
|
sl@0
|
128 |
// CFbsBitGc functionality used by Wserv for its internal operations. Compatibility of these functions is not guaranteed in future releases.
|
sl@0
|
129 |
IMPORT_C void CopyRect(const TPoint& aOffset, const TRect& aRect); /**< WARNING: Function for internal use ONLY. Compatibility is not guaranteed in future releases.*/
|
sl@0
|
130 |
IMPORT_C void CopySettings(const CDirectGdiContext& aGc); /**< WARNING: Function for internal use ONLY. Compatibility is not guaranteed in future releases.*/
|
sl@0
|
131 |
IMPORT_C void UpdateJustification(const TDesC& aText, const DirectGdi::TTextParameters* aParam); /**< WARNING: Function for internal use ONLY. Compatibility is not guaranteed in future releases.*/
|
sl@0
|
132 |
IMPORT_C void UpdateJustificationVertical(const TDesC& aText, const DirectGdi::TTextParameters* aParam, TBool aUp); /**< WARNING: Function for internal use ONLY. Compatibility is not guaranteed in future releases.*/
|
sl@0
|
133 |
IMPORT_C void SetFontNoDuplicate(const CDirectGdiFont* aFont); /**< WARNING: Function for internal use ONLY. Compatibility is not guaranteed in future releases.*/
|
sl@0
|
134 |
IMPORT_C TBool HasBrushPattern() const; /**< WARNING: Function for internal use ONLY. Compatibility is not guaranteed in future releases.*/
|
sl@0
|
135 |
IMPORT_C TBool HasFont() const; /**< WARNING: Function for internal use ONLY. Compatibility is not guaranteed in future releases.*/
|
sl@0
|
136 |
IMPORT_C void ExternalizeL(RWriteStream& aWriteStream); /**< WARNING: Function for internal use ONLY. Compatibility is not guaranteed in future releases.*/
|
sl@0
|
137 |
IMPORT_C void InternalizeL(RReadStream& aReadStream); /**< WARNING: Function for internal use ONLY. Compatibility is not guaranteed in future releases.*/
|
sl@0
|
138 |
IMPORT_C TRgb BrushColor() const; /**< WARNING: Function for internal use ONLY. Compatibility is not guaranteed in future releases.*/
|
sl@0
|
139 |
IMPORT_C TRgb PenColor() const; /**< WARNING: Function for internal use ONLY. Compatibility is not guaranteed in future releases.*/
|
sl@0
|
140 |
IMPORT_C TRgb TextShadowColor() const; /**< WARNING: Function for internal use ONLY. Compatibility is not guaranteed in future releases.*/
|
sl@0
|
141 |
|
sl@0
|
142 |
// New functionality for image based resource
|
sl@0
|
143 |
IMPORT_C void DrawResource(const TPoint& aPos,
|
sl@0
|
144 |
const RDirectGdiDrawableSource& aSource,
|
sl@0
|
145 |
DirectGdi::TGraphicsRotation aRotation=DirectGdi::EGraphicsRotationNone);
|
sl@0
|
146 |
IMPORT_C void DrawResource(const TRect& aDestRect,
|
sl@0
|
147 |
const RDirectGdiDrawableSource& aSource,
|
sl@0
|
148 |
DirectGdi::TGraphicsRotation aRotation=DirectGdi::EGraphicsRotationNone);
|
sl@0
|
149 |
IMPORT_C void DrawResource(const TRect& aDestRect,
|
sl@0
|
150 |
const RDirectGdiDrawableSource& aSource, const TRect& aSrcRect,
|
sl@0
|
151 |
DirectGdi::TGraphicsRotation aRotation=DirectGdi::EGraphicsRotationNone);
|
sl@0
|
152 |
// New functionality for non-image based resource
|
sl@0
|
153 |
IMPORT_C void DrawResource(const TRect& aDestRect,
|
sl@0
|
154 |
const RDirectGdiDrawableSource& aSource, const TDesC8& aParam);
|
sl@0
|
155 |
IMPORT_C TInt GetInterface(TUid aInterfaceId, TAny*& aInterface);
|
sl@0
|
156 |
|
sl@0
|
157 |
private:
|
sl@0
|
158 |
CDirectGdiContext(CDirectGdiDriver& aDirectGdiDriver);
|
sl@0
|
159 |
void ConstructL();
|
sl@0
|
160 |
void CleanUpBrushPattern();
|
sl@0
|
161 |
void DrawText(const TDesC& aText, const DirectGdi::TTextParameters* aParam, const TPoint& aPosition, DirectGdi::TTextAlign aAlignment,
|
sl@0
|
162 |
CFont::TTextDirection aDirection, const TRect* aClipRect = NULL, const TRect* aFillRect = NULL);
|
sl@0
|
163 |
void DoDrawText(CFont::TPositionParam& aParam, const TInt aEnd, const TRect& aClipRect);
|
sl@0
|
164 |
void DoDrawTextEx(CFont::TPositionParam& aParam, const TInt aEnd, const TRect& aClipRect, const TInt aUnderlineStrikethroughOffset);
|
sl@0
|
165 |
void CalculateClipRect2PlusBaselineOffsetAndMargin(const TDesC& aText, const DirectGdi::TTextParameters* aParam, const TPoint& aPosition, TBool aUp,
|
sl@0
|
166 |
TRect& aClipRect2, TInt& aBaselineOffset, TInt& aMargin);
|
sl@0
|
167 |
void DrawTextVertical(const TDesC& aText, const DirectGdi::TTextParameters* aParam, const TRect* aClipRect1, const TRect* aClipRect2, const TRect* aFillRect,
|
sl@0
|
168 |
TInt aBaselineOffset, TInt aTextWidth, TBool aUp, DirectGdi::TTextAlign aVert, TInt aMargin);
|
sl@0
|
169 |
void DoDrawTextVertical(CFont::TPositionParam& aParam, TBool aUp, const TInt aEnd, TRect& aClipRect);
|
sl@0
|
170 |
void DoBitBltMasked(const TPoint& aDestPos, const CFbsBitmap& aSourceBitmap, const TRect& aSourceRect,
|
sl@0
|
171 |
const CFbsBitmap& aMaskBitmap, TBool aInvertMask, const TPoint& aMaskPos);
|
sl@0
|
172 |
TBool ValidateBitmap (const CFbsBitmap& aBitmap);
|
sl@0
|
173 |
TBool ValidateSourceAndMaskBitmaps (const CFbsBitmap& aSourceBitmap, const CFbsBitmap& aMaskBitmap);
|
sl@0
|
174 |
TRect IntersectBitmapWithRect(const CFbsBitmap& aBitmap, const TRect& aRect) const;
|
sl@0
|
175 |
void Rotate(TPoint& aPoint, const TPoint& aOrigin, TBool aUp);
|
sl@0
|
176 |
void GetUnderlineMetrics(TInt& aTop, TInt& aBottom);
|
sl@0
|
177 |
void GetStrikethroughMetrics(TInt& aTop, TInt& aBottom);
|
sl@0
|
178 |
void FillRect(const TRect& aRect, const TRgb& aColor, const TRect& aClipRect);
|
sl@0
|
179 |
TInt BaselineCorrection();
|
sl@0
|
180 |
private:
|
sl@0
|
181 |
/** Engine that will perform the action for most operations.
|
sl@0
|
182 |
The implementation may take advantage of hardware acceleration.
|
sl@0
|
183 |
*/
|
sl@0
|
184 |
MDirectGdiEngine* iEngine;
|
sl@0
|
185 |
|
sl@0
|
186 |
CDirectGdiDriver& iDriver; /**< For constructing and obtaining a reference to a rendering engine instance. */
|
sl@0
|
187 |
TBool iActivated; /**< Flag for whether context has been successfully activated. */
|
sl@0
|
188 |
RRegion iClippingRegion; /**< Local copy of clipping region.*/
|
sl@0
|
189 |
TPoint iOrigin; /**< The origin of the drawing engine coordinate system. */
|
sl@0
|
190 |
CDirectGdiFont iFont; /**< The current font. */
|
sl@0
|
191 |
TInt iCharJustExcess; /**< Amount of space to be used for letterspacing. */
|
sl@0
|
192 |
TInt iCharJustNum; /**< Number of glyph groups to be letterspaced. */
|
sl@0
|
193 |
TInt iWordJustExcess; /**< Amount of space to be used for wordspacing. */
|
sl@0
|
194 |
TInt iWordJustNum; /**< Number of spaces to be used for wordspacing. */
|
sl@0
|
195 |
TPoint iLastPrintPosition; /**< Current text position. */
|
sl@0
|
196 |
DirectGdi::TFontStrikethrough iStrikethrough; /**< Font stike-through flags. */
|
sl@0
|
197 |
DirectGdi::TFontUnderline iUnderline; /**< Font underline flags. */
|
sl@0
|
198 |
TRgb iPenColor; /**< The current pen colour. The default pen colour is black. */
|
sl@0
|
199 |
TSize iPenSize; /**< The current pen size. */
|
sl@0
|
200 |
DirectGdi::TPenStyle iPenStyle; /**< The current pen style. */
|
sl@0
|
201 |
DirectGdi::TDrawMode iDrawMode; /**< The current drawing mode. */
|
sl@0
|
202 |
TRgb iTextShadowColor; /**< Colour for text shadows. */
|
sl@0
|
203 |
TRgb iBrushColor; /**< The current brush colour, the default brush colour is white. */
|
sl@0
|
204 |
DirectGdi::TBrushStyle iBrushStyle; /**< The current brush style. */
|
sl@0
|
205 |
CFbsBitmap iBrushPattern; /**< The currently selected brush pattern. */
|
sl@0
|
206 |
TBool iBrushPatternUsed;
|
sl@0
|
207 |
TPoint iBrushOrigin; /**< The current brush origin. */
|
sl@0
|
208 |
TBool iAutoUpdateJustification;
|
sl@0
|
209 |
};
|
sl@0
|
210 |
|
sl@0
|
211 |
#endif
|