author | qifeima <> |
Thu, 03 Jun 2010 18:57:10 +0800 | |
changeset 12 | 18b321db4884 |
parent 1 | edfc90759b9f |
permissions | -rw-r--r-- |
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1 |
/* |
12 | 2 |
* Copyright (c) 2010 Ixonos Plc. |
3 |
* All rights reserved. |
|
4 |
* This component and the accompanying materials are made available |
|
5 |
* under the terms of the "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 |
* Ixonos Plc |
|
14 |
* |
|
15 |
* Description: |
|
16 |
* Draw filter for Draw UI plugin. |
|
17 |
* |
|
18 |
*/ |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
19 |
|
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
20 |
#include <fbs.h> |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
21 |
#include <bitdev.h> |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
22 |
#include <e32math.h> |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
23 |
#include "cfilterdraw.h" |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
24 |
|
12 | 25 |
const TInt KDrawBitmapWidth(480); |
26 |
const TInt KDrawBitmapHeight(640); |
|
27 |
TUint32* CFilterDraw::iData = NULL; |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
28 |
// --------------------------------------------------------------------------- |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
29 |
// Create |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
30 |
// --------------------------------------------------------------------------- |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
31 |
// |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
32 |
EXPORT_C TInt CFilterDraw::Create() |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
33 |
{ |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
34 |
CFilterDraw* ptr = NULL; |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
35 |
TRAP_IGNORE( ptr = NewL() ); |
12 | 36 |
return (TInt) ((MImageFilter*) ptr); |
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
37 |
} |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
38 |
|
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
39 |
// --------------------------------------------------------------------------- |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
40 |
// NewL |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
41 |
// --------------------------------------------------------------------------- |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
42 |
// |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
43 |
CFilterDraw* CFilterDraw::NewL() |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
44 |
{ |
12 | 45 |
return new (ELeave) CFilterDraw(); |
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
46 |
} |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
47 |
|
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
48 |
// --------------------------------------------------------------------------- |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
49 |
// ~CFilterDraw |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
50 |
// --------------------------------------------------------------------------- |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
51 |
// |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
52 |
CFilterDraw::~CFilterDraw() |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
53 |
{ |
12 | 54 |
if(iData) |
55 |
{ |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
56 |
delete[] iData; |
12 | 57 |
iData = NULL; |
58 |
} |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
59 |
iReadyToRender = EFalse; |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
60 |
// Close all paths |
12 | 61 |
for (TInt i(0); i < iPaths.Count(); i++) |
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
62 |
{ |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
63 |
iPaths[i].Close(); |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
64 |
} |
12 | 65 |
iPaths.Close(); |
66 |
||
67 |
for (TInt j(0); j < iUndoPaths.Count(); j++) |
|
68 |
{ |
|
69 |
iUndoPaths[j].Close(); |
|
70 |
} |
|
71 |
iUndoPaths.Close(); |
|
72 |
||
73 |
if(iMask) |
|
74 |
{ |
|
75 |
delete iMask; |
|
76 |
iMask =NULL; |
|
77 |
} |
|
78 |
if(iBitmap) |
|
79 |
{ |
|
80 |
delete iBitmap; |
|
81 |
iBitmap =NULL; |
|
82 |
} |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
83 |
} |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
84 |
|
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
85 |
// --------------------------------------------------------------------------- |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
86 |
// CFilterDraw |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
87 |
// --------------------------------------------------------------------------- |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
88 |
// |
12 | 89 |
CFilterDraw::CFilterDraw() : |
90 |
iBitmapSize(KDrawBitmapWidth, KDrawBitmapHeight), iCanRedo( |
|
91 |
EFalse) |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
92 |
{ |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
93 |
} |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
94 |
|
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
95 |
// --------------------------------------------------------------------------- |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
96 |
// Rect |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
97 |
// --------------------------------------------------------------------------- |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
98 |
// |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
99 |
TRect CFilterDraw::Rect() |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
100 |
{ |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
101 |
ASSERT(iChild); |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
102 |
return iChild->Rect(); |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
103 |
} |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
104 |
|
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
105 |
// --------------------------------------------------------------------------- |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
106 |
// Scale |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
107 |
// --------------------------------------------------------------------------- |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
108 |
// |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
109 |
TReal CFilterDraw::Scale() |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
110 |
{ |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
111 |
ASSERT(iChild); |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
112 |
return iChild->Scale(); |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
113 |
} |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
114 |
|
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
115 |
// --------------------------------------------------------------------------- |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
116 |
// ViewPortSize |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
117 |
// --------------------------------------------------------------------------- |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
118 |
// |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
119 |
TSize CFilterDraw::ViewPortSize() |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
120 |
{ |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
121 |
ASSERT(iChild); |
12 | 122 |
return iChild->ViewPortSize(); |
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
123 |
} |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
124 |
|
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
125 |
// --------------------------------------------------------------------------- |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
126 |
// GetBlockL |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
127 |
// --------------------------------------------------------------------------- |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
128 |
// |
12 | 129 |
TBlock* CFilterDraw::GetBlockL(const TRect& aRect) |
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
130 |
{ |
12 | 131 |
ASSERT(iChild); |
132 |
TBlock* pB = iChild->GetBlockL(aRect); |
|
133 |
if (!pB) |
|
134 |
return NULL; |
|
135 |
TUint32* pD = pB->iData; |
|
136 |
||
137 |
if (iData && iReadyToRender) |
|
138 |
{ |
|
139 |
// Factor between real and viewed image |
|
140 |
TReal realToViewedFactorWidth; |
|
141 |
TReal realToViewedFactorHeight; |
|
142 |
RealToViewedFactories(realToViewedFactorWidth, realToViewedFactorHeight); |
|
143 |
const TInt width(iBitmapSize.iWidth); // Data bitmap width |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
144 |
|
12 | 145 |
for (TInt y(pB->iRect.iTl.iY); y < pB->iRect.iBr.iY; ++y) |
146 |
{ |
|
147 |
TInt realY(y / Scale() + 0.5); |
|
148 |
TInt viewY(realY / realToViewedFactorHeight + 0.5); |
|
149 |
for (TInt x(pB->iRect.iTl.iX); x < pB->iRect.iBr.iX; ++x) |
|
150 |
{ |
|
151 |
TInt realX(x / Scale() + 0.5); |
|
152 |
TInt viewX(realX / realToViewedFactorWidth + 0.5); |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
153 |
|
12 | 154 |
if( viewY >= KDrawBitmapHeight) |
155 |
{ |
|
156 |
viewY--; |
|
157 |
} |
|
158 |
if(iData[width * viewY + viewX]) |
|
159 |
{ |
|
160 |
TUint32 color = iData[width * viewY + viewX]; |
|
161 |
if ((color & 0xff000000)) |
|
162 |
{ |
|
163 |
*pD = color; |
|
164 |
} |
|
165 |
} |
|
166 |
*pD++; |
|
167 |
} |
|
168 |
} |
|
169 |
} |
|
170 |
||
171 |
return pB; |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
172 |
} |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
173 |
|
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
174 |
// --------------------------------------------------------------------------- |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
175 |
// SetParent |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
176 |
// --------------------------------------------------------------------------- |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
177 |
// |
12 | 178 |
void CFilterDraw::SetParent(MImageFilter* aParent) |
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
179 |
{ |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
180 |
ASSERT(aParent); |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
181 |
iParent = aParent; |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
182 |
} |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
183 |
|
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
184 |
// --------------------------------------------------------------------------- |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
185 |
// SetChild |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
186 |
// --------------------------------------------------------------------------- |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
187 |
// |
12 | 188 |
void CFilterDraw::SetChild(MImageFilter* aChild) |
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
189 |
{ |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
190 |
ASSERT(aChild); |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
191 |
iChild = aChild; |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
192 |
} |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
193 |
|
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
194 |
// --------------------------------------------------------------------------- |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
195 |
// CmdL |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
196 |
// --------------------------------------------------------------------------- |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
197 |
// |
12 | 198 |
TInt CFilterDraw::CmdL(const TDesC16& aCmd) |
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
199 |
{ |
12 | 200 |
TInt bbb(0); |
201 |
bbb = iPaths.Count(); |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
202 |
ASSERT(iChild); |
12 | 203 |
TLex lex(aCmd); |
204 |
TPoint position(0, 0); |
|
205 |
// Factor between real and viewed image |
|
206 |
TReal realToViewedFactorWidth; |
|
207 |
TReal realToViewedFactorHeight; |
|
208 |
RealToViewedFactories(realToViewedFactorWidth, realToViewedFactorHeight); |
|
209 |
||
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
210 |
// Handle parameters |
12 | 211 |
while (!lex.Eos()) |
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
212 |
{ |
12 | 213 |
RDebug::RawPrint(aCmd); |
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
214 |
TPtrC token = lex.NextToken(); |
12 | 215 |
TInt pathCount(0); |
216 |
pathCount = iPaths.Count(); |
|
217 |
||
218 |
if (token.Compare(_L("x")) == 0) |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
219 |
{ |
12 | 220 |
iCanRedo = EFalse; |
221 |
for (TInt j(0); j < iUndoPaths.Count(); j++) |
|
222 |
{ |
|
223 |
iUndoPaths[j].Close(); |
|
224 |
} |
|
225 |
iUndoPaths.Close(); |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
226 |
iReadyToRender = EFalse; |
12 | 227 |
TReal relscale = Scale(); |
228 |
TInt param = 0; |
|
229 |
lex.Inc(); |
|
230 |
lex.Val(param); |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
231 |
// Coordinates on data bitmap |
12 | 232 |
position.iX = (TReal(param) / relscale) / realToViewedFactorWidth + 0.5; |
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
233 |
} |
12 | 234 |
else if (token.Compare(_L("y")) == 0) |
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
235 |
{ |
12 | 236 |
TReal relscale = Scale(); |
237 |
TInt param = 0; |
|
238 |
lex.Inc(); |
|
239 |
lex.Val(param); |
|
240 |
position.iY = (TReal(param) / relscale) / realToViewedFactorHeight + 0.5; |
|
241 |
RDebug::Print( |
|
242 |
_L("CFilterDraw::CmdL x:%d y:%d Scale:%g Rw:%d Rh:%d Vpw:%d Vph:%d Rtvw:%g Rtvh:%g"), |
|
243 |
position.iX, position.iY, relscale, Rect().Size().iWidth, |
|
244 |
Rect().Size().iHeight, ViewPortSize().iWidth, |
|
245 |
ViewPortSize().iHeight, realToViewedFactorWidth, |
|
246 |
realToViewedFactorHeight); |
|
247 |
||
248 |
if (!iPaths.Count()) |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
249 |
{ |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
250 |
RDrawPath newPath; |
12 | 251 |
User::LeaveIfError(newPath.Append(position)); |
252 |
User::LeaveIfError(iPaths.Append(newPath)); |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
253 |
} |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
254 |
else |
12 | 255 |
{ |
256 |
ASSERT(iPaths.Count()); |
|
257 |
RDrawPath& lastPath = iPaths[iPaths.Count() - 1]; |
|
258 |
User::LeaveIfError(lastPath.Append(position)); |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
259 |
} |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
260 |
} |
12 | 261 |
else if (token.Compare(_L("color")) == 0) |
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
262 |
{ |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
263 |
TUint32 color(0); |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
264 |
lex.Inc(); |
12 | 265 |
lex.Val(color, EDecimal); |
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
266 |
TRgb rgb(color); |
12 | 267 |
TUint32 colorValue = (rgb.Red() << 16) + (rgb.Green() << 8) + rgb.Blue(); |
268 |
ASSERT( iPaths.Count() ); |
|
269 |
RDrawPath& lastPath = iPaths[iPaths.Count() - 1]; |
|
270 |
lastPath.SetColor(TRgb(colorValue)); |
|
271 |
} |
|
272 |
else if (token.Compare(_L("size")) == 0) |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
273 |
{ |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
274 |
TInt size(0); |
12 | 275 |
lex.Inc(); |
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
276 |
lex.Val(size); |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
277 |
// Scale line size to match bitmap scale |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
278 |
TInt sizew( (TReal(size) / realToViewedFactorWidth) + 0.5 ); |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
279 |
TInt sizeh( (TReal(size) / realToViewedFactorHeight) + 0.5 ); |
12 | 280 |
|
281 |
if (!sizew) |
|
282 |
{ |
|
283 |
sizew++; |
|
284 |
} |
|
285 |
if (!sizeh) |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
286 |
{ |
12 | 287 |
sizeh++; |
288 |
} |
|
289 |
||
290 |
if (iPaths.Count()) |
|
291 |
{ |
|
292 |
RDrawPath& lastPath = iPaths[iPaths.Count() - 1]; |
|
293 |
lastPath.SetSize(TSize(sizew, sizeh)); |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
294 |
} |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
295 |
} |
12 | 296 |
else if (token.Compare(_L("lastItem")) == 0) |
297 |
{ |
|
298 |
ASSERT(iPaths.Count()); |
|
299 |
||
300 |
RDrawPath& lastPath = iPaths[iPaths.Count() - 1]; |
|
301 |
RDebug::Print( |
|
302 |
_L("CFilterDraw::CmdL lastItem count:%d size:%d r:%d g:%d b:%d"), |
|
303 |
iPaths.Count(), lastPath.Size().iHeight, |
|
304 |
lastPath.Color().Red(), lastPath.Color().Green(), |
|
305 |
lastPath.Color().Blue()); |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
306 |
|
12 | 307 |
RDrawPath newPath; |
308 |
User::LeaveIfError(iPaths.Append(newPath)); |
|
309 |
} |
|
310 |
else if (token.Compare(_L("done")) == 0) |
|
311 |
{ |
|
312 |
LoadFrameL(); |
|
313 |
iReadyToRender = ETrue; |
|
314 |
} |
|
315 |
//Undo functionality |
|
316 |
else if (token.Compare(_L("Undo")) == 0) |
|
317 |
{ |
|
318 |
TInt count(0); |
|
319 |
count = iPaths.Count(); |
|
320 |
count = iUndoPaths.Count(); |
|
321 |
||
322 |
if (iPaths.Count() > 1) |
|
323 |
{ |
|
324 |
TInt count = iPaths.Count(); |
|
325 |
iUndoPaths.Append(iPaths[iPaths.Count() - 2]); |
|
326 |
iPaths.Remove(iPaths.Count() - 2); |
|
327 |
iCanRedo = ETrue; |
|
328 |
} |
|
329 |
count = iPaths.Count(); |
|
330 |
count = iUndoPaths.Count(); |
|
331 |
} |
|
332 |
//Redo functionality |
|
333 |
else if (token.Compare(_L("redone")) == 0) |
|
334 |
{ |
|
335 |
TInt count(0); |
|
336 |
count = iPaths.Count(); |
|
337 |
count = iUndoPaths.Count(); |
|
338 |
||
339 |
if (iCanRedo) |
|
340 |
{ |
|
341 |
if (iUndoPaths.Count()) |
|
342 |
{ |
|
343 |
if (iPaths.Count() >= 1) |
|
344 |
{ |
|
345 |
iPaths.Insert(iUndoPaths[iUndoPaths.Count() - 1],iPaths.Count() - 1); |
|
346 |
iUndoPaths.Remove(iUndoPaths.Count() - 1); |
|
347 |
} |
|
348 |
} |
|
349 |
} |
|
350 |
count = iPaths.Count(); |
|
351 |
count = iUndoPaths.Count(); |
|
352 |
} |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
353 |
} |
12 | 354 |
return KErrNone; |
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
355 |
} |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
356 |
|
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
357 |
// --------------------------------------------------------------------------- |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
358 |
// Type |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
359 |
// --------------------------------------------------------------------------- |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
360 |
// |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
361 |
const char* CFilterDraw::Type() |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
362 |
{ |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
363 |
return "frame"; |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
364 |
} |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
365 |
|
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
366 |
// --------------------------------------------------------------------------- |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
367 |
// LoadFrameL |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
368 |
// --------------------------------------------------------------------------- |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
369 |
// |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
370 |
void CFilterDraw::LoadFrameL() |
12 | 371 |
{ |
372 |
RDebug::Print(_L("CFilterDraw::LoadFrameL w:%d h:%d"), iBitmapSize.iWidth, |
|
373 |
iBitmapSize.iHeight); |
|
374 |
||
375 |
TInt xxx(0); |
|
376 |
xxx = iPaths.Count(); |
|
377 |
// Create a bitmap big enough to hold the drawed lines |
|
378 |
CFbsBitmap* bitmap = new (ELeave) CFbsBitmap(); |
|
379 |
CleanupStack::PushL(bitmap); |
|
380 |
User::LeaveIfError(bitmap->Create(iBitmapSize, EColor16MA)); |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
381 |
|
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
382 |
// create mask |
12 | 383 |
CFbsBitmap* mask = new (ELeave) CFbsBitmap(); |
384 |
CleanupStack::PushL(mask); |
|
385 |
User::LeaveIfError(mask->Create(iBitmapSize, EColor16MA)); |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
386 |
|
12 | 387 |
CFbsBitmapDevice* maskDevice = CFbsBitmapDevice::NewL(mask); |
388 |
CleanupStack::PushL(maskDevice); |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
389 |
|
12 | 390 |
CFbsBitGc * maskContext(NULL); |
391 |
User::LeaveIfError(maskDevice->CreateContext(maskContext)); |
|
392 |
CleanupStack::PushL(maskContext); |
|
393 |
maskContext->SetPenStyle(CGraphicsContext::ESolidPen); |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
394 |
maskContext->SetBrushStyle(CGraphicsContext::ESolidBrush); |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
395 |
maskContext->SetBrushColor(KRgbBlack); |
12 | 396 |
|
397 |
// Create bitmap device and context |
|
398 |
CFbsBitmapDevice * bitmapDevice = CFbsBitmapDevice::NewL(bitmap); |
|
399 |
CleanupStack::PushL(bitmapDevice); |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
400 |
|
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
401 |
// Create bitmap graphics context |
12 | 402 |
CFbsBitGc * bitmapContext(NULL); |
403 |
User::LeaveIfError(bitmapDevice->CreateContext(bitmapContext)); |
|
404 |
CleanupStack::PushL(bitmapContext); |
|
405 |
||
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
406 |
TDisplayMode dmode = bitmap->DisplayMode(); |
12 | 407 |
|
408 |
for (TInt pathNumber(0); pathNumber < iPaths.Count(); pathNumber++) |
|
409 |
{ |
|
410 |
RDrawPath path = iPaths[pathNumber]; |
|
411 |
bitmapContext->SetPenStyle(CGraphicsContext::ESolidPen); |
|
412 |
bitmapContext->SetBrushStyle(CGraphicsContext::ESolidBrush); |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
413 |
bitmapContext->SetPenColor(path.Color()); |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
414 |
bitmapContext->SetPenSize(path.Size()); |
12 | 415 |
maskContext->SetPenSize(path.Size()); |
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
416 |
|
12 | 417 |
RDebug::Print(_L("CFilterDraw::LoadFrameL ps:%dx%d S:%g"), |
418 |
path.Size().iWidth, path.Size().iHeight, Scale()); |
|
419 |
||
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
420 |
CArrayFix<TPoint>* pointArray = NULL; |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
421 |
RDrawPath2PointArray(path, pointArray); |
12 | 422 |
bitmapContext->DrawPolyLine(pointArray); |
423 |
maskContext->DrawPolyLine(pointArray); |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
424 |
|
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
425 |
delete pointArray; |
12 | 426 |
} |
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
427 |
|
12 | 428 |
// Create memory buffer to hold rendered image data |
429 |
||
430 |
if (!iData) |
|
431 |
{ |
|
432 |
iData = new (ELeave) TUint32[iBitmapSize.iWidth * iBitmapSize.iHeight]; |
|
433 |
Mem::FillZ(iData, iBitmapSize.iWidth * iBitmapSize.iHeight |
|
434 |
* sizeof(TUint32)); |
|
435 |
} |
|
436 |
||
437 |
TBitmapUtil bm(bitmap); |
|
438 |
bm.Begin(TPoint(0, 0)); |
|
439 |
TBitmapUtil maskbm(mask); |
|
440 |
maskbm.Begin(TPoint(0, 0)); |
|
441 |
TRgb rgb(0); |
|
442 |
||
443 |
// Find drawed lines from bitmap |
|
444 |
for (TInt y(0); y < iBitmapSize.iHeight - 1; y++) |
|
445 |
{ |
|
446 |
for (TInt x(0); x < iBitmapSize.iWidth - 1; x++) |
|
447 |
{ |
|
448 |
// Check mask first |
|
449 |
maskbm.SetPos(TPoint(x, y)); |
|
450 |
if (maskbm.GetPixel() == KRgbBlack.Internal()) |
|
451 |
{ |
|
452 |
bm.SetPos(TPoint(x, y)); |
|
453 |
rgb = bm.GetPixel(); |
|
454 |
iData[(iBitmapSize.iWidth * y) + x] = (rgb.Red() << 16) |
|
455 |
+ (rgb.Green() << 8) + rgb.Blue() | 0xff000000; |
|
456 |
} |
|
457 |
} |
|
458 |
} |
|
459 |
||
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
460 |
bm.End(); |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
461 |
maskbm.End(); |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
462 |
// bitmapContext, bitmapDevice, maskContext, maskDevice, mask, bitmap |
12 | 463 |
CleanupStack::PopAndDestroy(6, bitmap); |
464 |
RDebug::Print(_L("CFilterDraw::LoadFrameL - end")); |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
465 |
} |
12 | 466 |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
467 |
// --------------------------------------------------------------------------- |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
468 |
// RDrawPath2PointArray |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
469 |
// --------------------------------------------------------------------------- |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
470 |
// |
12 | 471 |
void CFilterDraw::RDrawPath2PointArray(const RDrawPath& aPath, |
472 |
CArrayFix<TPoint>*& aArrayPtr) const |
|
473 |
{ |
|
474 |
// if allocation fails just do nothing. +1 if count is zero |
|
475 |
aArrayPtr = new CArrayFixFlat<TPoint> (aPath.Count() + 1); |
|
476 |
if (aArrayPtr) |
|
477 |
{ |
|
478 |
for (TInt i(0); i < aPath.Count(); i++) |
|
479 |
{ |
|
480 |
TPoint item = aPath[i]; |
|
481 |
TRAP_IGNORE( aArrayPtr->AppendL( item ) ); |
|
482 |
} |
|
483 |
} |
|
484 |
} |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
485 |
|
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
486 |
// --------------------------------------------------------------------------- |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
487 |
// RealToViewedFactories |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
488 |
// --------------------------------------------------------------------------- |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
489 |
// |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
490 |
void CFilterDraw::RealToViewedFactories(TReal& aWidth, TReal& aHeight) |
12 | 491 |
{ |
492 |
// Factor between real and viewed image |
|
493 |
aWidth = TReal(ViewPortSize().iWidth) / TReal(iBitmapSize.iWidth); |
|
494 |
aHeight = TReal(ViewPortSize().iHeight) / TReal(iBitmapSize.iHeight); |
|
495 |
} |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
496 |