|
1 /* |
|
2 * Copyright (c) 2006-2008 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: ?Description |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef __HUIVG10CURVEPATH_H__ |
|
21 #define __HUIVG10CURVEPATH_H__ |
|
22 |
|
23 |
|
24 #include "uiacceltk/HuiCurvePath.h" |
|
25 #include "HuiVg10RenderPlugin.h" |
|
26 #include <VG/openvg.h> |
|
27 |
|
28 /** |
|
29 * Curve path that can be drawn using OpenVG 1.0. |
|
30 */ |
|
31 NONSHARABLE_CLASS(CHuiVg10CurvePath) : public CHuiCurvePath |
|
32 { |
|
33 public: |
|
34 |
|
35 /* Constructors and destructor. */ |
|
36 |
|
37 /** |
|
38 * Constructor. |
|
39 */ |
|
40 CHuiVg10CurvePath(); |
|
41 |
|
42 /** |
|
43 * Second-phase constructor. |
|
44 */ |
|
45 void ConstructL(); |
|
46 |
|
47 /** |
|
48 * Destructor. |
|
49 */ |
|
50 virtual ~CHuiVg10CurvePath(); |
|
51 |
|
52 |
|
53 /* Methods. */ |
|
54 |
|
55 /** |
|
56 * Resets the path by removing all segments. |
|
57 */ |
|
58 virtual void Reset(); |
|
59 |
|
60 /** |
|
61 * Recalculate the path's vertices and colors. |
|
62 */ |
|
63 void Update(TReal32 aStartPos, TReal32 aEndPos, |
|
64 TReal32 aAlphaFactor, |
|
65 MHuiMappingFunction* aAlphaFunction, |
|
66 MHuiMappingFunction* aWidthFunction) __SOFTFP; |
|
67 |
|
68 /** |
|
69 * Draws the path. |
|
70 * |
|
71 * @param aOrigin Offset of drawing in pixels |
|
72 * @param aGc Graphics context to use. |
|
73 */ |
|
74 void Draw(const TPoint& aOrigin, CHuiGc* aGc) const; |
|
75 |
|
76 protected: |
|
77 |
|
78 /** |
|
79 * @returns the number of tuples required for |
|
80 * a given segment. |
|
81 */ |
|
82 TInt SegmentTuples(const TSegment& aSegment) const; |
|
83 |
|
84 /** |
|
85 * Reserve space for tuples. |
|
86 * |
|
87 * @param aTuplecount Number of tuples required. |
|
88 */ |
|
89 void SetTupleCountL(TInt aTupleCount); |
|
90 |
|
91 /** |
|
92 * Prepare the tuples for a given segment. |
|
93 * |
|
94 * @param aSegment Segment to process. |
|
95 * @param aStart Start position. |
|
96 * @param aEnd End position. |
|
97 * @param aIsFinal ETrue if this is the final |
|
98 * segment of the path. |
|
99 * @param aAlphaFactor Transparency factor. |
|
100 * @param aAlphaFunction Function of path alpha. |
|
101 * @param aWidthFunction Function of path width. |
|
102 */ |
|
103 void MakeSegmentTuples(const TSegment& aSegment, |
|
104 TReal32 aStart, TReal32 aEnd, |
|
105 TBool aIsFinal, |
|
106 TReal32 aAlphaFactor, |
|
107 MHuiMappingFunction* aAlphaFunction, |
|
108 MHuiMappingFunction* aWidthFunction); |
|
109 |
|
110 /** |
|
111 * Add a single tuple to the path. |
|
112 * |
|
113 * @param aPoint Tuple coordinates. |
|
114 * @param aNormal Tuple normal (left side). |
|
115 * @param aWidth Path width. |
|
116 * @param aAlpha Path transparency. |
|
117 */ |
|
118 void AddTuple(const THuiRealPoint& aPoint, |
|
119 const THuiRealPoint& aNormal, |
|
120 TReal32 aWidth, TReal32 aAlpha); |
|
121 |
|
122 /** |
|
123 * Reset the current path. |
|
124 */ |
|
125 void ResetPath(); |
|
126 |
|
127 /** |
|
128 * Reset the accumulated tuples. |
|
129 */ |
|
130 void ResetTuples(); |
|
131 |
|
132 private: |
|
133 /** Path that encloses the whole curve */ |
|
134 VGPath iPath; |
|
135 |
|
136 /** Coordinates for the path */ |
|
137 VGfloat* iPathCoords; |
|
138 |
|
139 /** Commands for the path */ |
|
140 VGubyte* iPathCommands; |
|
141 |
|
142 /** Last opacity factor used to render the path */ |
|
143 TReal32 iLastOpacityFactor; |
|
144 |
|
145 /** Number of vertex tuples along the path (at least 2). */ |
|
146 TUint iMaxTupleCount; |
|
147 |
|
148 /** Number of vertex tuples used. */ |
|
149 TUint iUsedTupleCount; |
|
150 }; |
|
151 |
|
152 |
|
153 #endif // __HUIVG10CURVEPATH_H__ |