|
1 /* |
|
2 * Copyright (c) 2005-2006 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: JNI methods |
|
15 * |
|
16 */ |
|
17 |
|
18 // INCLUDE FILES |
|
19 #include "com_nokia_microedition_m2g_M2GSVGPath.h" |
|
20 #include "MM2GSVGProxy.h" |
|
21 |
|
22 M2G_NS_START |
|
23 |
|
24 // EXTERNAL DATA STRUCTURES |
|
25 |
|
26 // EXTERNAL FUNCTION PROTOTYPES |
|
27 |
|
28 // CONSTANTS |
|
29 |
|
30 // MACROS |
|
31 |
|
32 // LOCAL CONSTANTS AND MACROS |
|
33 |
|
34 // MODULE DATA STRUCTURES |
|
35 |
|
36 // LOCAL FUNCTION PROTOTYPES |
|
37 |
|
38 // FORWARD DECLARATIONS |
|
39 |
|
40 // CLASS DECLARATION |
|
41 |
|
42 // ================================ FUNCTIONS ================================== |
|
43 |
|
44 // ----------------------------------------------------------------------------- |
|
45 // Java_com_nokia_microedition_m2g_M2GSVGPath::_addClose |
|
46 // ----------------------------------------------------------------------------- |
|
47 /** |
|
48 * Calls MM2GSVGProxy::AddCloseL method. |
|
49 * @since Series S60 3.0 |
|
50 * @param aProxy Proxy instance. |
|
51 * @param aPathHandle Svg path handle |
|
52 */ |
|
53 JNIEXPORT void JNICALL |
|
54 Java_com_nokia_microedition_m2g_M2GSVGPath__1addClose( |
|
55 JNIEnv* aJni, |
|
56 jclass, |
|
57 jint aSvgProxyHandle, |
|
58 jint aPathHandle) |
|
59 { |
|
60 M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGPath ) _addClose - begin"); |
|
61 TInt err = KM2GNotOk; |
|
62 |
|
63 M2G_DO_LOCK |
|
64 if (aSvgProxyHandle) |
|
65 { |
|
66 MM2GSVGProxy* aProxy = JavaUnhand< MM2GSVGProxy >(aSvgProxyHandle); |
|
67 TRAP(err, aProxy->AddCloseL(STATIC_CAST(TM2GSvgPathHandle, aPathHandle)); ); |
|
68 } |
|
69 M2G_DO_UNLOCK(aJni) |
|
70 |
|
71 M2GGeneral::CheckErrorCode(aJni, err); |
|
72 |
|
73 M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGPath ) _addClose - end"); |
|
74 } |
|
75 |
|
76 // ----------------------------------------------------------------------------- |
|
77 // Java_com_nokia_microedition_m2g_M2GSVGPath::_addCurve |
|
78 // ----------------------------------------------------------------------------- |
|
79 /** |
|
80 * Calls MM2GSVGProxy::AddCurveTo method. |
|
81 * @since Series S60 3.0 |
|
82 * @param aProxy Proxy instance. |
|
83 * @param aPathHandle Svg path handle |
|
84 * @param aPathCurveData Curve parameters |
|
85 */ |
|
86 JNIEXPORT void JNICALL |
|
87 Java_com_nokia_microedition_m2g_M2GSVGPath__1addCurveTo( |
|
88 JNIEnv* aJni, |
|
89 jclass, |
|
90 jint aSvgProxyHandle, |
|
91 jint aPathHandle, |
|
92 jfloat aX1, jfloat aY1, jfloat aX2, jfloat aY2, jfloat aX3, jfloat aY3 ) |
|
93 { |
|
94 M2G_DEBUG_6("M2G_DEBUG: JNI ( M2GSVGPath ) _addCurveTo: X1=%f, Y1=%f, X2=%f, Y2=%f, X3=%f, Y3=%f - begin", aX1, aY1, aX2, aY2, aX3, aY3); |
|
95 TInt err = KM2GNotOk; |
|
96 |
|
97 TM2GPathCurveData curve; |
|
98 curve[ 0 ] = STATIC_CAST(TReal32, aX1); |
|
99 curve[ 1 ] = STATIC_CAST(TReal32, aY1); |
|
100 curve[ 2 ] = STATIC_CAST(TReal32, aX2); |
|
101 curve[ 3 ] = STATIC_CAST(TReal32, aY2); |
|
102 curve[ 4 ] = STATIC_CAST(TReal32, aX3); |
|
103 curve[ 5 ] = STATIC_CAST(TReal32, aY3); |
|
104 |
|
105 M2G_DO_LOCK |
|
106 if (aSvgProxyHandle) |
|
107 { |
|
108 MM2GSVGProxy* aProxy = JavaUnhand< MM2GSVGProxy >(aSvgProxyHandle); |
|
109 TRAP(err, aProxy->AddCurveToL( |
|
110 STATIC_CAST(TM2GSvgPathHandle, aPathHandle), |
|
111 curve); ); |
|
112 } |
|
113 M2G_DO_UNLOCK(aJni) |
|
114 |
|
115 M2GGeneral::CheckErrorCode(aJni, err); |
|
116 M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGPath ) _addCurveTo - end"); |
|
117 } |
|
118 |
|
119 // ----------------------------------------------------------------------------- |
|
120 // Java_com_nokia_microedition_m2g_M2GSVGPath::_addLineTo |
|
121 // ----------------------------------------------------------------------------- |
|
122 /** |
|
123 * Calls MM2GSVGProxy::AddLineToL method. |
|
124 * @since Series S60 3.0 |
|
125 * @param aProxy Proxy instance. |
|
126 * @param aPathHandle Svg path handle |
|
127 * @param aX - |
|
128 * @param aY - |
|
129 */ |
|
130 JNIEXPORT void JNICALL |
|
131 Java_com_nokia_microedition_m2g_M2GSVGPath__1addLineTo( |
|
132 JNIEnv* aJni, |
|
133 jclass, |
|
134 jint aSvgProxyHandle, |
|
135 jint aPathHandle, |
|
136 jfloat aX, jfloat aY ) |
|
137 { |
|
138 M2G_DEBUG_2("M2G_DEBUG: JNI ( M2GSVGPath ) _addLineTo: X=%f, Y=%f - begin", aX, aY); |
|
139 TInt err = KM2GNotOk; |
|
140 |
|
141 M2G_DO_LOCK |
|
142 if (aSvgProxyHandle) |
|
143 { |
|
144 MM2GSVGProxy* aProxy = JavaUnhand< MM2GSVGProxy >(aSvgProxyHandle); |
|
145 TRAP(err, aProxy->AddLineToL(STATIC_CAST(TM2GSvgPathHandle, aPathHandle), *(REINTERPRET_CAST(TReal32*, &aX)), *(REINTERPRET_CAST(TReal32*, &aY))); ); |
|
146 |
|
147 } |
|
148 M2G_DO_UNLOCK(aJni) |
|
149 |
|
150 M2GGeneral::CheckErrorCode(aJni, err); |
|
151 |
|
152 M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGPath ) _addLineTo - end"); |
|
153 } |
|
154 // ----------------------------------------------------------------------------- |
|
155 // Java_com_nokia_microedition_m2g_M2GSVGPath::_addMoveTo |
|
156 // ----------------------------------------------------------------------------- |
|
157 /** |
|
158 * Calls MM2GSVGProxy::AddMoveToL method. |
|
159 * @since Series S60 3.0 |
|
160 * @param aProxy Proxy instance. |
|
161 * @param aPathHandle Svg path handle |
|
162 * @param aX - |
|
163 * @param aY - |
|
164 */ |
|
165 JNIEXPORT void JNICALL |
|
166 Java_com_nokia_microedition_m2g_M2GSVGPath__1addMoveTo( |
|
167 JNIEnv* aJni, |
|
168 jclass, |
|
169 jint aSvgProxyHandle, |
|
170 jint aPathHandle, |
|
171 jfloat aX, |
|
172 jfloat aY) |
|
173 { |
|
174 M2G_DEBUG_2("M2G_DEBUG: JNI ( M2GSVGPath ) _addMoveTo: X=%f, Y=%f - begin", aX, aY); |
|
175 TInt err = KM2GNotOk; |
|
176 |
|
177 M2G_DO_LOCK |
|
178 if (aSvgProxyHandle) |
|
179 { |
|
180 MM2GSVGProxy * aProxy = JavaUnhand< MM2GSVGProxy >(aSvgProxyHandle); |
|
181 TRAP(err, aProxy->AddMoveToL(STATIC_CAST(TM2GSvgPathHandle, aPathHandle), aX, aY) ); |
|
182 } |
|
183 M2G_DO_UNLOCK(aJni) |
|
184 |
|
185 M2GGeneral::CheckErrorCode(aJni, err); |
|
186 M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGPath ) _addMoveTo - end"); |
|
187 } |
|
188 |
|
189 // ----------------------------------------------------------------------------- |
|
190 // Java_com_nokia_microedition_m2g_M2GSVGPath::_addQuadTo |
|
191 // ----------------------------------------------------------------------------- |
|
192 /** |
|
193 * Calls MM2GSVGProxy::AddQuadToL method. |
|
194 * @since Series S60 3.0 |
|
195 * @param aProxy Proxy instance. |
|
196 * @param aPathHandle Svg path handle |
|
197 * @param aX1 - |
|
198 * @param aY1 - |
|
199 * @param aX2 - |
|
200 * @param aY2 - |
|
201 */ |
|
202 JNIEXPORT void JNICALL |
|
203 Java_com_nokia_microedition_m2g_M2GSVGPath__1addQuadTo( |
|
204 JNIEnv* aJni, |
|
205 jclass, |
|
206 jint aSvgProxyHandle, |
|
207 jint aPathHandle, |
|
208 jfloat aX1, jfloat aY1, jfloat aX2, jfloat aY2) |
|
209 { |
|
210 M2G_DEBUG_4("M2G_DEBUG: JNI ( M2GSVGPath ) _addQuadTo: X1=%f, Y1=%f, X2=%f, Y2=%f - begin", aX1, aY1, aX2, aY2); |
|
211 // TInt elementHandle = M2G_INVALID_HANDLE; |
|
212 TInt err = KM2GNotOk; |
|
213 |
|
214 M2G_DO_LOCK |
|
215 if (aSvgProxyHandle) |
|
216 { |
|
217 MM2GSVGProxy * aProxy = JavaUnhand< MM2GSVGProxy >(aSvgProxyHandle); |
|
218 TRAP(err, aProxy->AddQuadToL( |
|
219 STATIC_CAST(TM2GSvgPathHandle, aPathHandle),aX1, aY1, aX2, aY2); ); |
|
220 } |
|
221 M2G_DO_UNLOCK(aJni) |
|
222 |
|
223 M2GGeneral::CheckErrorCode(aJni, err); |
|
224 M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGPath ) _addQuadTo - end"); |
|
225 } |
|
226 |
|
227 // ----------------------------------------------------------------------------- |
|
228 // Java_com_nokia_microedition_m2g_M2GSVGPath::_createPath |
|
229 // ----------------------------------------------------------------------------- |
|
230 /** |
|
231 * Calls MM2GSVGProxy::CreatePathL method. |
|
232 * @since Series S60 3.0 |
|
233 * @param aProxy Proxy instance. |
|
234 * @param aPathHandle Path handle |
|
235 */ |
|
236 JNIEXPORT jint JNICALL |
|
237 Java_com_nokia_microedition_m2g_M2GSVGPath__1createPath( |
|
238 JNIEnv* aJni, |
|
239 jclass, |
|
240 jint aSvgProxyHandle) |
|
241 { |
|
242 M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGPath ) _createPath - begin"); |
|
243 |
|
244 TInt err = KM2GNotOk; |
|
245 TInt pathHandle = M2G_INVALID_HANDLE; |
|
246 |
|
247 M2G_DO_LOCK |
|
248 if (aSvgProxyHandle) |
|
249 { |
|
250 MM2GSVGProxy * aProxy = JavaUnhand< MM2GSVGProxy >(aSvgProxyHandle); |
|
251 TRAP(err, aProxy->CreatePathL(pathHandle); ); |
|
252 } |
|
253 M2G_DO_UNLOCK(aJni) |
|
254 |
|
255 M2GGeneral::CheckErrorCode(aJni, err); |
|
256 |
|
257 M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GSVGPath ) _createPath: %d - end", pathHandle); |
|
258 return STATIC_CAST(jint, pathHandle); |
|
259 } |
|
260 // ----------------------------------------------------------------------------- |
|
261 // Java_com_nokia_microedition_m2g_M2GSVGPath::_destroyPath |
|
262 // ----------------------------------------------------------------------------- |
|
263 /** |
|
264 * Calls MM2GSVGProxy::DestroyPathL method. |
|
265 * @since Series S60 3.0 |
|
266 * @param aProxy Proxy instance. |
|
267 * @param aPathHandle Svg path handle |
|
268 */ |
|
269 JNIEXPORT void JNICALL |
|
270 Java_com_nokia_microedition_m2g_M2GSVGPath__1destroyPath( |
|
271 JNIEnv* aJni, |
|
272 jclass, |
|
273 jint aSvgProxyHandle, |
|
274 jint aPathHandle) |
|
275 { |
|
276 M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GSVGPath ) _destroyPath: %d - begin", aPathHandle); |
|
277 TInt err = KM2GNotOk; |
|
278 |
|
279 M2G_DO_LOCK |
|
280 if (aSvgProxyHandle) |
|
281 { |
|
282 MM2GSVGProxy * aProxy = JavaUnhand< MM2GSVGProxy >(aSvgProxyHandle); |
|
283 TRAP(err, aProxy->DestroyPathL( |
|
284 STATIC_CAST(TM2GSvgPathHandle, STATIC_CAST(TM2GSvgPathHandle, aPathHandle))); ); |
|
285 } |
|
286 M2G_DO_UNLOCK(aJni) |
|
287 |
|
288 M2GGeneral::CheckErrorCode(aJni, err); |
|
289 M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGPath ) _destroyPath - end"); |
|
290 } |
|
291 |
|
292 // ----------------------------------------------------------------------------- |
|
293 // Java_com_nokia_microedition_m2g_M2GSVGPath::_getNumberOfSegments |
|
294 // ----------------------------------------------------------------------------- |
|
295 /** |
|
296 * Calls MM2GSVGProxy::GetNumberOfSegments method. |
|
297 * @since Series S60 3.0 |
|
298 * @param aProxy Proxy instance. |
|
299 * @param aPathHandle Svg path handle |
|
300 * @return Number of segments |
|
301 */ |
|
302 JNIEXPORT jint JNICALL |
|
303 Java_com_nokia_microedition_m2g_M2GSVGPath__1getNumberOfSegments( |
|
304 JNIEnv* aJni, |
|
305 jclass, |
|
306 jint aSvgProxyHandle, |
|
307 jint aPathHandle) |
|
308 { |
|
309 M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGPath ) _getNumberOfSegments - begin"); |
|
310 TInt err = KM2GNotOk; |
|
311 TInt numberOfSegments = 0; |
|
312 |
|
313 M2G_DO_LOCK |
|
314 if (aSvgProxyHandle) |
|
315 { |
|
316 MM2GSVGProxy * aProxy = JavaUnhand< MM2GSVGProxy >(aSvgProxyHandle); |
|
317 TRAP(err, aProxy->GetNumberOfSegmentsL( |
|
318 STATIC_CAST(TM2GSvgPathHandle, aPathHandle), |
|
319 numberOfSegments); ); |
|
320 } |
|
321 M2G_DO_UNLOCK(aJni) |
|
322 |
|
323 M2GGeneral::CheckErrorCode(aJni, err); |
|
324 M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GSVGPath ) _getNumberOfSegments: %d - end", numberOfSegments); |
|
325 return STATIC_CAST(jint, numberOfSegments); |
|
326 } |
|
327 |
|
328 // ----------------------------------------------------------------------------- |
|
329 // Java_com_nokia_microedition_m2g_M2GSVGPath::_getSegmentParameter |
|
330 // ----------------------------------------------------------------------------- |
|
331 /** |
|
332 * Calls MM2GSVGProxy::GetSegmentParameterL method. |
|
333 * @since Series S60 3.0 |
|
334 * @param aProxy Proxy instance. |
|
335 * @param aPathHandle Svg path handle |
|
336 * @param aSegmentIndex - |
|
337 * @param aParamIndex - |
|
338 * @param aSegmentParam Segment parameter |
|
339 */ |
|
340 JNIEXPORT jfloat JNICALL |
|
341 Java_com_nokia_microedition_m2g_M2GSVGPath__1getSegmentParameter( |
|
342 JNIEnv* aJni, |
|
343 jclass, |
|
344 jint aSvgProxyHandle, |
|
345 jint aPathHandle, jint aSegmentIndex, jint aParamIndex) |
|
346 { |
|
347 M2G_DEBUG_2("M2G_DEBUG: JNI ( M2GSVGPath ) _getSegmentParameter: seg index=%d, param index=%d - begin", aSegmentIndex, aParamIndex); |
|
348 TInt err = KM2GNotOk; |
|
349 TReal32 segmentParam = 0; |
|
350 |
|
351 M2G_DO_LOCK |
|
352 if (aSvgProxyHandle) |
|
353 { |
|
354 MM2GSVGProxy * aProxy = JavaUnhand< MM2GSVGProxy >(aSvgProxyHandle); |
|
355 TRAP(err, aProxy->GetSegmentParameterL( |
|
356 STATIC_CAST(TM2GSvgPathHandle, aPathHandle), aSegmentIndex,aParamIndex, segmentParam); ); |
|
357 } |
|
358 M2G_DO_UNLOCK(aJni) |
|
359 |
|
360 M2GGeneral::CheckErrorCode(aJni, err); |
|
361 |
|
362 M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GSVGPath ) _getSegmentParameter: %f - end", segmentParam); |
|
363 return STATIC_CAST(jfloat, segmentParam); |
|
364 } |
|
365 |
|
366 |
|
367 // ----------------------------------------------------------------------------- |
|
368 // Java_com_nokia_microedition_m2g_M2GSVGPath::_getSegmentType |
|
369 // ----------------------------------------------------------------------------- |
|
370 /** |
|
371 * Calls MM2GSVGProxy::GetSegmentTypeL method. |
|
372 * @since Series S60 3.0 |
|
373 * @param aProxy Proxy instance. |
|
374 * @param aPathHandle Svg path handle |
|
375 * @param aSegmentIndex - |
|
376 * @param aSegmentType Segment type to be returned |
|
377 */ |
|
378 JNIEXPORT jshort JNICALL |
|
379 Java_com_nokia_microedition_m2g_M2GSVGPath__1getSegmentType( |
|
380 JNIEnv* aJni, |
|
381 jclass, |
|
382 jint aSvgProxyHandle, |
|
383 TInt aPathHandle, |
|
384 jint aIndex) |
|
385 { |
|
386 M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GSVGPath ) _getSegmentType: index=%d - begin", aIndex); |
|
387 TInt err = KM2GNotOk; |
|
388 TInt16 aSegmentType = 0; |
|
389 |
|
390 M2G_DO_LOCK |
|
391 if (aSvgProxyHandle) |
|
392 { |
|
393 MM2GSVGProxy * aProxy = JavaUnhand< MM2GSVGProxy >(aSvgProxyHandle); |
|
394 TRAP(err, aProxy->GetSegmentTypeL( |
|
395 STATIC_CAST(TM2GSvgPathHandle, aPathHandle), aIndex,aSegmentType); ); |
|
396 } |
|
397 M2G_DO_UNLOCK(aJni) |
|
398 |
|
399 M2GGeneral::CheckErrorCode(aJni, err); |
|
400 M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GSVGPath ) _getSegmentType: %d - end", aSegmentType); |
|
401 return STATIC_CAST(jshort, aSegmentType); |
|
402 } |
|
403 |
|
404 M2G_NS_END |