|
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 "CM2GEventSource.h" |
|
20 #include "com_nokia_microedition_m2g_M2GSVGPath.h" |
|
21 #include "MM2GSVGProxy.h" |
|
22 #include <methodwrappers.h> |
|
23 |
|
24 M2G_NS_START |
|
25 |
|
26 // EXTERNAL DATA STRUCTURES |
|
27 |
|
28 // EXTERNAL FUNCTION PROTOTYPES |
|
29 |
|
30 // CONSTANTS |
|
31 |
|
32 // MACROS |
|
33 |
|
34 // LOCAL CONSTANTS AND MACROS |
|
35 |
|
36 // MODULE DATA STRUCTURES |
|
37 |
|
38 // LOCAL FUNCTION PROTOTYPES |
|
39 |
|
40 // FORWARD DECLARATIONS |
|
41 |
|
42 // CLASS DECLARATION |
|
43 |
|
44 // ================================ FUNCTIONS ================================== |
|
45 |
|
46 // ----------------------------------------------------------------------------- |
|
47 // Java_com_nokia_microedition_m2g_M2GSVGPath::_addClose |
|
48 // ----------------------------------------------------------------------------- |
|
49 /** |
|
50 * Calls MM2GSVGProxy::AddCloseL method. |
|
51 * @since Series S60 3.0 |
|
52 * @param aProxy Proxy instance. |
|
53 * @param aPathHandle Svg path handle |
|
54 */ |
|
55 LOCAL_C void DoAddCloseL( |
|
56 MM2GSVGProxy* aProxy, |
|
57 TInt aPathHandle) |
|
58 { |
|
59 aProxy->AddCloseL(STATIC_CAST(TM2GSvgPathHandle, aPathHandle)); |
|
60 } |
|
61 |
|
62 /** |
|
63 * JNI method |
|
64 */ |
|
65 JNIEXPORT void JNICALL |
|
66 Java_com_nokia_microedition_m2g_M2GSVGPath__1addClose( |
|
67 JNIEnv* aJni, |
|
68 jclass, |
|
69 jint aEventSourceHandle, |
|
70 jint aSvgProxyHandle, |
|
71 jint aPathHandle, |
|
72 jboolean aUiToolKit) |
|
73 { |
|
74 M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGPath ) _addClose - begin"); |
|
75 TInt err = KM2GNotOk; |
|
76 if (aUiToolKit) // If eSWT is the current toolkit |
|
77 { |
|
78 MSwtClient* client = reinterpret_cast< MSwtClient* >(aEventSourceHandle); |
|
79 if (client && aSvgProxyHandle) |
|
80 { |
|
81 typedef void (MM2GSVGProxy::*pAddCloseL)(const TM2GSvgPathHandle&); |
|
82 pAddCloseL AddCloseL = &MM2GSVGProxy::AddCloseL; |
|
83 MM2GSVGProxy* aProxy = JavaUnhand< MM2GSVGProxy >(aSvgProxyHandle); |
|
84 TM2GSvgPathHandle lPathHandle = STATIC_CAST(TM2GSvgPathHandle, aPathHandle); |
|
85 TMethodWrapper1<MM2GSVGProxy, const TM2GSvgPathHandle& > AddClose( |
|
86 *aProxy, |
|
87 AddCloseL, |
|
88 lPathHandle); |
|
89 err = client->Execute(AddClose); |
|
90 } |
|
91 } |
|
92 else |
|
93 { |
|
94 CM2GEventSource* eventSource = JavaUnhand< CM2GEventSource >(aEventSourceHandle); |
|
95 if (eventSource && aSvgProxyHandle) |
|
96 { |
|
97 err = eventSource->ExecuteTrap( |
|
98 &DoAddCloseL, |
|
99 JavaUnhand< MM2GSVGProxy >(aSvgProxyHandle), |
|
100 aPathHandle); |
|
101 } |
|
102 } |
|
103 M2GGeneral::CheckErrorCode(aJni, err); |
|
104 |
|
105 M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGPath ) _addClose - end"); |
|
106 } |
|
107 |
|
108 // ----------------------------------------------------------------------------- |
|
109 // Java_com_nokia_microedition_m2g_M2GSVGPath::_addCurve |
|
110 // ----------------------------------------------------------------------------- |
|
111 /** |
|
112 * Calls MM2GSVGProxy::AddCurveTo method. |
|
113 * @since Series S60 3.0 |
|
114 * @param aProxy Proxy instance. |
|
115 * @param aPathHandle Svg path handle |
|
116 * @param aPathCurveData Curve parameters |
|
117 */ |
|
118 LOCAL_C void DoAddCurveToL( |
|
119 MM2GSVGProxy* aProxy, |
|
120 TInt aPathHandle, |
|
121 TM2GPathCurveData* aPathCurveData) |
|
122 { |
|
123 aProxy->AddCurveToL( |
|
124 STATIC_CAST(TM2GSvgPathHandle, aPathHandle), |
|
125 *aPathCurveData); |
|
126 } |
|
127 |
|
128 /** |
|
129 * JNI method |
|
130 */ |
|
131 JNIEXPORT void JNICALL |
|
132 Java_com_nokia_microedition_m2g_M2GSVGPath__1addCurveTo( |
|
133 JNIEnv* aJni, |
|
134 jclass, |
|
135 jint aEventSourceHandle, |
|
136 jint aSvgProxyHandle, |
|
137 jint aPathHandle, |
|
138 jfloat aX1, jfloat aY1, jfloat aX2, jfloat aY2, jfloat aX3, jfloat aY3 , |
|
139 jboolean aUiToolKit) |
|
140 { |
|
141 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); |
|
142 TInt err = KM2GNotOk; |
|
143 if (aUiToolKit) // If eSWT is the current toolkit |
|
144 { |
|
145 MSwtClient* client = reinterpret_cast< MSwtClient* >(aEventSourceHandle); |
|
146 if (client && aSvgProxyHandle) |
|
147 { |
|
148 typedef void (MM2GSVGProxy::*pAddCurveToL)(const TM2GSvgPathHandle& ,const TM2GPathCurveData&); |
|
149 pAddCurveToL AddCurveToL = &MM2GSVGProxy::AddCurveToL; |
|
150 MM2GSVGProxy* aProxy = JavaUnhand< MM2GSVGProxy >(aSvgProxyHandle); |
|
151 TM2GSvgPathHandle lPathHandle = STATIC_CAST(TM2GSvgPathHandle, aPathHandle); |
|
152 TM2GPathCurveData curve; |
|
153 curve[ 0 ] = STATIC_CAST(TReal32, aX1); |
|
154 curve[ 1 ] = STATIC_CAST(TReal32, aY1); |
|
155 curve[ 2 ] = STATIC_CAST(TReal32, aX2); |
|
156 curve[ 3 ] = STATIC_CAST(TReal32, aY2); |
|
157 curve[ 4 ] = STATIC_CAST(TReal32, aX3); |
|
158 curve[ 5 ] = STATIC_CAST(TReal32, aY3); |
|
159 TMethodWrapper2<MM2GSVGProxy, const TM2GSvgPathHandle& ,const TM2GPathCurveData& > AddCurveTo( |
|
160 *aProxy, |
|
161 AddCurveToL, |
|
162 lPathHandle, |
|
163 curve); |
|
164 err = client->Execute(AddCurveTo); |
|
165 } |
|
166 } |
|
167 else |
|
168 { |
|
169 CM2GEventSource* eventSource = JavaUnhand< CM2GEventSource >(aEventSourceHandle); |
|
170 if (eventSource && aSvgProxyHandle) |
|
171 { |
|
172 TM2GPathCurveData curve; |
|
173 curve[ 0 ] = STATIC_CAST(TReal32, aX1); |
|
174 curve[ 1 ] = STATIC_CAST(TReal32, aY1); |
|
175 curve[ 2 ] = STATIC_CAST(TReal32, aX2); |
|
176 curve[ 3 ] = STATIC_CAST(TReal32, aY2); |
|
177 curve[ 4 ] = STATIC_CAST(TReal32, aX3); |
|
178 curve[ 5 ] = STATIC_CAST(TReal32, aY3); |
|
179 |
|
180 err = eventSource->ExecuteTrap( |
|
181 &DoAddCurveToL, |
|
182 JavaUnhand< MM2GSVGProxy >(aSvgProxyHandle), |
|
183 aPathHandle, |
|
184 &curve); |
|
185 |
|
186 } |
|
187 } |
|
188 M2GGeneral::CheckErrorCode(aJni, err); |
|
189 M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGPath ) _addCurveTo - end"); |
|
190 } |
|
191 |
|
192 // ----------------------------------------------------------------------------- |
|
193 // Java_com_nokia_microedition_m2g_M2GSVGPath::_addLineTo |
|
194 // ----------------------------------------------------------------------------- |
|
195 /** |
|
196 * Calls MM2GSVGProxy::AddLineToL method. |
|
197 * @since Series S60 3.0 |
|
198 * @param aProxy Proxy instance. |
|
199 * @param aPathHandle Svg path handle |
|
200 * @param aX - |
|
201 * @param aY - |
|
202 */ |
|
203 LOCAL_C void DoAddLineToL( |
|
204 MM2GSVGProxy* aProxy, |
|
205 TInt aPathHandle, |
|
206 TReal32* aX, TReal32* aY) |
|
207 { |
|
208 aProxy->AddLineToL(STATIC_CAST(TM2GSvgPathHandle, aPathHandle), *aX, *aY); |
|
209 } |
|
210 |
|
211 /** |
|
212 * JNI method |
|
213 */ |
|
214 JNIEXPORT void JNICALL |
|
215 Java_com_nokia_microedition_m2g_M2GSVGPath__1addLineTo( |
|
216 JNIEnv* aJni, |
|
217 jclass, |
|
218 jint aEventSourceHandle, |
|
219 jint aSvgProxyHandle, |
|
220 jint aPathHandle, |
|
221 jfloat aX, jfloat aY ,jboolean aUiToolKit) |
|
222 { |
|
223 M2G_DEBUG_2("M2G_DEBUG: JNI ( M2GSVGPath ) _addLineTo: X=%f, Y=%f - begin", aX, aY); |
|
224 TInt err = KM2GNotOk; |
|
225 if (aUiToolKit) // If eSWT is the current toolkit |
|
226 { |
|
227 MSwtClient* client = reinterpret_cast< MSwtClient* >(aEventSourceHandle); |
|
228 if (client && aSvgProxyHandle) |
|
229 { |
|
230 typedef void (MM2GSVGProxy::*pAddLineToL)(const TM2GSvgPathHandle& ,const TReal32& , const TReal32&); |
|
231 pAddLineToL AddLineToL = &MM2GSVGProxy::AddLineToL; |
|
232 MM2GSVGProxy* aProxy = JavaUnhand< MM2GSVGProxy >(aSvgProxyHandle); |
|
233 TM2GSvgPathHandle lPathHandle = STATIC_CAST(TM2GSvgPathHandle, aPathHandle); |
|
234 TMethodWrapper3<MM2GSVGProxy, const TM2GSvgPathHandle& ,const TReal32& , const TReal32& > AddLineTo( |
|
235 *aProxy, |
|
236 AddLineToL, |
|
237 lPathHandle, |
|
238 *(REINTERPRET_CAST(TReal32*, &aX)), |
|
239 *(REINTERPRET_CAST(TReal32*, &aY))); |
|
240 err = client->Execute(AddLineTo); |
|
241 } |
|
242 } |
|
243 else |
|
244 { |
|
245 CM2GEventSource* eventSource = JavaUnhand< CM2GEventSource >(aEventSourceHandle); |
|
246 if (eventSource && aSvgProxyHandle) |
|
247 { |
|
248 err = eventSource->ExecuteTrap( |
|
249 &DoAddLineToL, |
|
250 JavaUnhand< MM2GSVGProxy >(aSvgProxyHandle), |
|
251 aPathHandle, |
|
252 REINTERPRET_CAST(TReal32*, &aX), |
|
253 REINTERPRET_CAST(TReal32*, &aY)); |
|
254 } |
|
255 } |
|
256 M2GGeneral::CheckErrorCode(aJni, err); |
|
257 |
|
258 M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGPath ) _addLineTo - end"); |
|
259 } |
|
260 |
|
261 // ----------------------------------------------------------------------------- |
|
262 // Java_com_nokia_microedition_m2g_M2GSVGPath::_addMoveTo |
|
263 // ----------------------------------------------------------------------------- |
|
264 /** |
|
265 * Calls MM2GSVGProxy::AddMoveToL method. |
|
266 * @since Series S60 3.0 |
|
267 * @param aProxy Proxy instance. |
|
268 * @param aPathHandle Svg path handle |
|
269 * @param aX - |
|
270 * @param aY - |
|
271 */ |
|
272 LOCAL_C void DoAddMoveToL( |
|
273 MM2GSVGProxy* aProxy, |
|
274 TInt aPathHandle, |
|
275 TReal32* aX, TReal32* aY) |
|
276 { |
|
277 aProxy->AddMoveToL(STATIC_CAST(TM2GSvgPathHandle, aPathHandle), *aX, *aY); |
|
278 } |
|
279 |
|
280 /** |
|
281 * JNI method |
|
282 */ |
|
283 JNIEXPORT void JNICALL |
|
284 Java_com_nokia_microedition_m2g_M2GSVGPath__1addMoveTo( |
|
285 JNIEnv* aJni, |
|
286 jclass, |
|
287 jint aEventSourceHandle, |
|
288 jint aSvgProxyHandle, |
|
289 jint aPathHandle, |
|
290 jfloat aX, |
|
291 jfloat aY, |
|
292 jboolean aUiToolkit) |
|
293 { |
|
294 M2G_DEBUG_2("M2G_DEBUG: JNI ( M2GSVGPath ) _addMoveTo: X=%f, Y=%f - begin", aX, aY); |
|
295 TInt err = KM2GNotOk; |
|
296 if (aUiToolkit) |
|
297 { |
|
298 MSwtClient* client = reinterpret_cast< MSwtClient* >(aEventSourceHandle); |
|
299 if (client && aSvgProxyHandle) |
|
300 { |
|
301 typedef void (MM2GSVGProxy::*pAddMoveToL)( |
|
302 const TM2GSvgPathHandle&, |
|
303 const TReal32&, |
|
304 const TReal32&); |
|
305 pAddMoveToL AddMoveToL = &MM2GSVGProxy::AddMoveToL; |
|
306 MM2GSVGProxy * aProxy = JavaUnhand< MM2GSVGProxy >(aSvgProxyHandle); |
|
307 TM2GSvgDocumentHandle lPathHandle = STATIC_CAST(TM2GSvgPathHandle, aPathHandle); |
|
308 TMethodWrapper3<MM2GSVGProxy, |
|
309 const TM2GSvgPathHandle&, |
|
310 const TReal32&, |
|
311 const TReal32& |
|
312 > AddMoveTo( |
|
313 *aProxy, |
|
314 AddMoveToL, |
|
315 lPathHandle, |
|
316 aX, |
|
317 aY |
|
318 ); |
|
319 err = client->Execute(AddMoveTo); |
|
320 } |
|
321 } |
|
322 else |
|
323 { |
|
324 CM2GEventSource* eventSource = JavaUnhand< CM2GEventSource >(aEventSourceHandle); |
|
325 if (eventSource && aSvgProxyHandle) |
|
326 { |
|
327 err = eventSource->ExecuteTrap( |
|
328 &DoAddMoveToL, |
|
329 JavaUnhand< MM2GSVGProxy >(aSvgProxyHandle), |
|
330 aPathHandle, |
|
331 REINTERPRET_CAST(TReal32*, &aX), |
|
332 REINTERPRET_CAST(TReal32*, &aY)); |
|
333 |
|
334 } |
|
335 } |
|
336 M2GGeneral::CheckErrorCode(aJni, err); |
|
337 M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGPath ) _addMoveTo - end"); |
|
338 } |
|
339 |
|
340 // ----------------------------------------------------------------------------- |
|
341 // Java_com_nokia_microedition_m2g_M2GSVGPath::_addQuadTo |
|
342 // ----------------------------------------------------------------------------- |
|
343 /** |
|
344 * Calls MM2GSVGProxy::AddQuadToL method. |
|
345 * @since Series S60 3.0 |
|
346 * @param aProxy Proxy instance. |
|
347 * @param aPathHandle Svg path handle |
|
348 * @param aX1 - |
|
349 * @param aY1 - |
|
350 * @param aX2 - |
|
351 * @param aY2 - |
|
352 */ |
|
353 LOCAL_C void DoAddQuadToL( |
|
354 MM2GSVGProxy* aProxy, |
|
355 TInt aPathHandle, |
|
356 TReal32* aX1, TReal32* aY1, TReal32* aX2, TReal32* aY2) |
|
357 { |
|
358 aProxy->AddQuadToL( |
|
359 STATIC_CAST(TM2GSvgPathHandle, aPathHandle), |
|
360 *aX1, *aY1, *aX2, *aY2); |
|
361 } |
|
362 |
|
363 /** |
|
364 * JNI method |
|
365 */ |
|
366 JNIEXPORT void JNICALL |
|
367 Java_com_nokia_microedition_m2g_M2GSVGPath__1addQuadTo( |
|
368 JNIEnv* aJni, |
|
369 jclass, |
|
370 jint aEventSourceHandle, |
|
371 jint aSvgProxyHandle, |
|
372 jint aPathHandle, |
|
373 jfloat aX1, jfloat aY1, jfloat aX2, jfloat aY2,jboolean aUiToolkit) |
|
374 { |
|
375 M2G_DEBUG_4("M2G_DEBUG: JNI ( M2GSVGPath ) _addQuadTo: X1=%f, Y1=%f, X2=%f, Y2=%f - begin", aX1, aY1, aX2, aY2); |
|
376 // TInt elementHandle = M2G_INVALID_HANDLE; |
|
377 TInt err = KM2GNotOk; |
|
378 if (aUiToolkit) |
|
379 { |
|
380 MSwtClient* client = reinterpret_cast< MSwtClient* >(aEventSourceHandle); |
|
381 if (client && aSvgProxyHandle) |
|
382 { |
|
383 typedef void (MM2GSVGProxy::*pAddQuadToL)( |
|
384 const TM2GSvgPathHandle&, |
|
385 const TReal32&, |
|
386 const TReal32&, |
|
387 const TReal32&, |
|
388 const TReal32&); |
|
389 pAddQuadToL AddQuadToL = &MM2GSVGProxy::AddQuadToL; |
|
390 MM2GSVGProxy * aProxy = JavaUnhand< MM2GSVGProxy >(aSvgProxyHandle); |
|
391 TM2GSvgDocumentHandle lPathHandle = STATIC_CAST(TM2GSvgPathHandle, aPathHandle); |
|
392 TMethodWrapper5<MM2GSVGProxy, |
|
393 const TM2GSvgPathHandle&, |
|
394 const TReal32&, |
|
395 const TReal32&, |
|
396 const TReal32&, |
|
397 const TReal32& |
|
398 > AddQuadTo( |
|
399 *aProxy, |
|
400 AddQuadToL, |
|
401 lPathHandle, |
|
402 aX1, |
|
403 aY1, |
|
404 aX2, |
|
405 aY2 |
|
406 ); |
|
407 err = client->Execute(AddQuadTo); |
|
408 } |
|
409 } |
|
410 else |
|
411 { |
|
412 CM2GEventSource* eventSource = JavaUnhand< CM2GEventSource >(aEventSourceHandle); |
|
413 if (eventSource && aSvgProxyHandle) |
|
414 { |
|
415 err = eventSource->ExecuteTrap( |
|
416 &DoAddQuadToL, |
|
417 JavaUnhand< MM2GSVGProxy >(aSvgProxyHandle), |
|
418 aPathHandle, |
|
419 REINTERPRET_CAST(TReal32*, &aX1), |
|
420 REINTERPRET_CAST(TReal32*, &aY1), |
|
421 REINTERPRET_CAST(TReal32*, &aX2), |
|
422 REINTERPRET_CAST(TReal32*, &aY2)); |
|
423 |
|
424 } |
|
425 } |
|
426 M2GGeneral::CheckErrorCode(aJni, err); |
|
427 M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGPath ) _addQuadTo - end"); |
|
428 } |
|
429 |
|
430 // ----------------------------------------------------------------------------- |
|
431 // Java_com_nokia_microedition_m2g_M2GSVGPath::_createPath |
|
432 // ----------------------------------------------------------------------------- |
|
433 /** |
|
434 * Calls MM2GSVGProxy::CreatePathL method. |
|
435 * @since Series S60 3.0 |
|
436 * @param aProxy Proxy instance. |
|
437 * @param aPathHandle Path handle |
|
438 */ |
|
439 LOCAL_C void DoCreatePathL( |
|
440 MM2GSVGProxy* aProxy, TInt* aPathHandle) |
|
441 { |
|
442 aProxy->CreatePathL(*aPathHandle); |
|
443 } |
|
444 |
|
445 /** |
|
446 * JNI method |
|
447 */ |
|
448 JNIEXPORT jint JNICALL |
|
449 Java_com_nokia_microedition_m2g_M2GSVGPath__1createPath( |
|
450 JNIEnv* aJni, |
|
451 jclass, |
|
452 jint aEventSourceHandle, |
|
453 jint aSvgProxyHandle, |
|
454 jboolean aUiToolkit) |
|
455 { |
|
456 M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGPath ) _createPath - begin"); |
|
457 |
|
458 TInt err = KM2GNotOk; |
|
459 TInt pathHandle = M2G_INVALID_HANDLE; |
|
460 if (aUiToolkit) |
|
461 { |
|
462 MSwtClient* client = reinterpret_cast< MSwtClient* >(aEventSourceHandle); |
|
463 if (client && aSvgProxyHandle) |
|
464 { |
|
465 typedef void (MM2GSVGProxy::*pCreatePathL)(TM2GSvgPathHandle&); |
|
466 pCreatePathL CreatePathL = &MM2GSVGProxy::CreatePathL; |
|
467 MM2GSVGProxy * aProxy = JavaUnhand< MM2GSVGProxy >(aSvgProxyHandle); |
|
468 TMethodWrapper1<MM2GSVGProxy,TM2GSvgPathHandle&> CreatePath( |
|
469 *aProxy, |
|
470 CreatePathL, |
|
471 pathHandle |
|
472 ); |
|
473 err = client->Execute(CreatePath); |
|
474 } |
|
475 } |
|
476 else |
|
477 { |
|
478 CM2GEventSource* eventSource = JavaUnhand< CM2GEventSource >(aEventSourceHandle); |
|
479 if (eventSource && aSvgProxyHandle) |
|
480 { |
|
481 err = eventSource->ExecuteTrap( |
|
482 &DoCreatePathL, |
|
483 JavaUnhand< MM2GSVGProxy >(aSvgProxyHandle), |
|
484 &pathHandle); |
|
485 |
|
486 } |
|
487 } |
|
488 M2GGeneral::CheckErrorCode(aJni, err); |
|
489 |
|
490 M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GSVGPath ) _createPath: %d - end", pathHandle); |
|
491 return STATIC_CAST(jint, pathHandle); |
|
492 } |
|
493 |
|
494 // ----------------------------------------------------------------------------- |
|
495 // Java_com_nokia_microedition_m2g_M2GSVGPath::_destroyPath |
|
496 // ----------------------------------------------------------------------------- |
|
497 /** |
|
498 * Calls MM2GSVGProxy::DestroyPathL method. |
|
499 * @since Series S60 3.0 |
|
500 * @param aProxy Proxy instance. |
|
501 * @param aPathHandle Svg path handle |
|
502 */ |
|
503 LOCAL_C void DoDestroyPathL( |
|
504 MM2GSVGProxy* aProxy, |
|
505 TInt aPathHandle) |
|
506 { |
|
507 aProxy->DestroyPathL( |
|
508 STATIC_CAST(TM2GSvgPathHandle, aPathHandle)); |
|
509 } |
|
510 |
|
511 /** |
|
512 * JNI method |
|
513 */ |
|
514 JNIEXPORT void JNICALL |
|
515 Java_com_nokia_microedition_m2g_M2GSVGPath__1destroyPath( |
|
516 JNIEnv* aJni, |
|
517 jclass, |
|
518 jint aEventSourceHandle, |
|
519 jint aSvgProxyHandle, |
|
520 jint aPathHandle, |
|
521 jboolean aUiToolkit) |
|
522 { |
|
523 M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GSVGPath ) _destroyPath: %d - begin", aPathHandle); |
|
524 TInt err = KM2GNotOk; |
|
525 if (aUiToolkit) |
|
526 { |
|
527 MSwtClient* client = reinterpret_cast< MSwtClient* >(aEventSourceHandle); |
|
528 if (client && aSvgProxyHandle) |
|
529 { |
|
530 typedef void (MM2GSVGProxy::*pDestroyPathL)(const TM2GSvgPathHandle&); |
|
531 pDestroyPathL DestroyPathL = &MM2GSVGProxy::DestroyPathL; |
|
532 MM2GSVGProxy * aProxy = JavaUnhand< MM2GSVGProxy >(aSvgProxyHandle); |
|
533 TM2GSvgDocumentHandle lPathHandle = STATIC_CAST(TM2GSvgPathHandle, aPathHandle); |
|
534 TMethodWrapper1<MM2GSVGProxy,const TM2GSvgPathHandle& > DestroyPath( |
|
535 *aProxy, |
|
536 DestroyPathL, |
|
537 lPathHandle |
|
538 ); |
|
539 err = client->Execute(DestroyPath); |
|
540 } |
|
541 } |
|
542 else |
|
543 { |
|
544 CM2GEventSource* eventSource = JavaUnhand< CM2GEventSource >(aEventSourceHandle); |
|
545 if (eventSource && aSvgProxyHandle) |
|
546 { |
|
547 err = eventSource->ExecuteTrap( |
|
548 &DoDestroyPathL, |
|
549 JavaUnhand< MM2GSVGProxy >(aSvgProxyHandle), |
|
550 aPathHandle); |
|
551 } |
|
552 } |
|
553 M2GGeneral::CheckErrorCode(aJni, err); |
|
554 M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGPath ) _destroyPath - end"); |
|
555 } |
|
556 |
|
557 // ----------------------------------------------------------------------------- |
|
558 // Java_com_nokia_microedition_m2g_M2GSVGPath::_getNumberOfSegments |
|
559 // ----------------------------------------------------------------------------- |
|
560 /** |
|
561 * Calls MM2GSVGProxy::GetNumberOfSegments method. |
|
562 * @since Series S60 3.0 |
|
563 * @param aProxy Proxy instance. |
|
564 * @param aPathHandle Svg path handle |
|
565 * @return Number of segments |
|
566 */ |
|
567 LOCAL_C void DoGetNumberOfSegmentsL( |
|
568 MM2GSVGProxy* aProxy, |
|
569 TInt aPathHandle, |
|
570 TInt* aNumberOfSegments) |
|
571 { |
|
572 aProxy->GetNumberOfSegmentsL( |
|
573 STATIC_CAST(TM2GSvgPathHandle, aPathHandle), |
|
574 *aNumberOfSegments); |
|
575 } |
|
576 |
|
577 /** |
|
578 * JNI method |
|
579 */ |
|
580 JNIEXPORT jint JNICALL |
|
581 Java_com_nokia_microedition_m2g_M2GSVGPath__1getNumberOfSegments( |
|
582 JNIEnv* aJni, |
|
583 jclass, |
|
584 jint aEventSourceHandle, |
|
585 jint aSvgProxyHandle, |
|
586 jint aPathHandle, |
|
587 jboolean aUiToolkit) |
|
588 { |
|
589 M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGPath ) _getNumberOfSegments - begin"); |
|
590 TInt err = KM2GNotOk; |
|
591 TInt numberOfSegments = 0; |
|
592 if (aUiToolkit) |
|
593 { |
|
594 MSwtClient* client = reinterpret_cast< MSwtClient* >(aEventSourceHandle); |
|
595 if (client && aSvgProxyHandle) |
|
596 { |
|
597 typedef void (MM2GSVGProxy::*pGetNumberOfSegmentsL)(const TM2GSvgPathHandle&, TInt&); |
|
598 pGetNumberOfSegmentsL GetNumberOfSegmentsL = &MM2GSVGProxy::GetNumberOfSegmentsL; |
|
599 MM2GSVGProxy * aProxy = JavaUnhand< MM2GSVGProxy >(aSvgProxyHandle); |
|
600 TM2GSvgDocumentHandle lPathHandle = STATIC_CAST(TM2GSvgPathHandle, aPathHandle); |
|
601 TMethodWrapper2<MM2GSVGProxy,const TM2GSvgPathHandle&, TInt& > GetNumberOfSegments( |
|
602 *aProxy, |
|
603 GetNumberOfSegmentsL, |
|
604 lPathHandle, |
|
605 numberOfSegments |
|
606 ); |
|
607 err = client->Execute(GetNumberOfSegments); |
|
608 } |
|
609 } |
|
610 else |
|
611 { |
|
612 CM2GEventSource* eventSource = JavaUnhand< CM2GEventSource >(aEventSourceHandle); |
|
613 |
|
614 if (eventSource && aSvgProxyHandle) |
|
615 { |
|
616 err = eventSource->ExecuteTrap( |
|
617 &DoGetNumberOfSegmentsL, |
|
618 JavaUnhand< MM2GSVGProxy >(aSvgProxyHandle), |
|
619 aPathHandle, &numberOfSegments); |
|
620 |
|
621 } |
|
622 } |
|
623 M2GGeneral::CheckErrorCode(aJni, err); |
|
624 M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GSVGPath ) _getNumberOfSegments: %d - end", numberOfSegments); |
|
625 return STATIC_CAST(jint, numberOfSegments); |
|
626 } |
|
627 |
|
628 // ----------------------------------------------------------------------------- |
|
629 // Java_com_nokia_microedition_m2g_M2GSVGPath::_getSegmentParameter |
|
630 // ----------------------------------------------------------------------------- |
|
631 /** |
|
632 * Calls MM2GSVGProxy::GetSegmentParameterL method. |
|
633 * @since Series S60 3.0 |
|
634 * @param aProxy Proxy instance. |
|
635 * @param aPathHandle Svg path handle |
|
636 * @param aSegmentIndex - |
|
637 * @param aParamIndex - |
|
638 * @param aSegmentParam Segment parameter |
|
639 */ |
|
640 LOCAL_C void DoGetSegmentParameterL( |
|
641 MM2GSVGProxy* aProxy, |
|
642 TInt aPathHandle, TInt aSegmentIndex, TInt aParamIndex, |
|
643 TReal32* aSegmentParam) |
|
644 { |
|
645 aProxy->GetSegmentParameterL( |
|
646 STATIC_CAST(TM2GSvgPathHandle, aPathHandle), aSegmentIndex, |
|
647 aParamIndex, *aSegmentParam); |
|
648 } |
|
649 |
|
650 /** |
|
651 * JNI method |
|
652 */ |
|
653 JNIEXPORT jfloat JNICALL |
|
654 Java_com_nokia_microedition_m2g_M2GSVGPath__1getSegmentParameter( |
|
655 JNIEnv* aJni, |
|
656 jclass, |
|
657 jint aEventSourceHandle, |
|
658 jint aSvgProxyHandle, |
|
659 jint aPathHandle, jint aSegmentIndex, jint aParamIndex, jboolean aUiToolkit) |
|
660 { |
|
661 M2G_DEBUG_2("M2G_DEBUG: JNI ( M2GSVGPath ) _getSegmentParameter: seg index=%d, param index=%d - begin", aSegmentIndex, aParamIndex); |
|
662 TInt err = KM2GNotOk; |
|
663 TReal32 segmentParam = 0; |
|
664 if (aUiToolkit) |
|
665 { |
|
666 MSwtClient* client = reinterpret_cast< MSwtClient* >(aEventSourceHandle); |
|
667 if (client && aSvgProxyHandle) |
|
668 { |
|
669 typedef void (MM2GSVGProxy::*pGetSegmentParameterL)( |
|
670 const TM2GSvgPathHandle&, |
|
671 TInt, |
|
672 TInt, |
|
673 TReal32&); |
|
674 pGetSegmentParameterL GetSegmentParameterL = &MM2GSVGProxy::GetSegmentParameterL; |
|
675 MM2GSVGProxy * aProxy = JavaUnhand< MM2GSVGProxy >(aSvgProxyHandle); |
|
676 TM2GSvgDocumentHandle lPathHandle = STATIC_CAST(TM2GSvgPathHandle, aPathHandle); |
|
677 TMethodWrapper4<MM2GSVGProxy,const TM2GSvgPathHandle&, TInt, TInt, TReal32& > GetSegmentParameter |
|
678 ( |
|
679 *aProxy, |
|
680 GetSegmentParameterL, |
|
681 lPathHandle, |
|
682 aSegmentIndex, |
|
683 aParamIndex, |
|
684 segmentParam |
|
685 ); |
|
686 err = client->Execute(GetSegmentParameter); |
|
687 } |
|
688 } |
|
689 else |
|
690 { |
|
691 CM2GEventSource* eventSource = JavaUnhand< CM2GEventSource >(aEventSourceHandle); |
|
692 |
|
693 if (eventSource && aSvgProxyHandle) |
|
694 { |
|
695 err = eventSource->ExecuteTrap( |
|
696 &DoGetSegmentParameterL, |
|
697 JavaUnhand< MM2GSVGProxy >(aSvgProxyHandle), |
|
698 aPathHandle, aSegmentIndex, aParamIndex, &segmentParam); |
|
699 } |
|
700 } |
|
701 M2GGeneral::CheckErrorCode(aJni, err); |
|
702 |
|
703 M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GSVGPath ) _getSegmentParameter: %f - end", segmentParam); |
|
704 return STATIC_CAST(jfloat, segmentParam); |
|
705 } |
|
706 |
|
707 |
|
708 // ----------------------------------------------------------------------------- |
|
709 // Java_com_nokia_microedition_m2g_M2GSVGPath::_getSegmentType |
|
710 // ----------------------------------------------------------------------------- |
|
711 /** |
|
712 * Calls MM2GSVGProxy::GetSegmentTypeL method. |
|
713 * @since Series S60 3.0 |
|
714 * @param aProxy Proxy instance. |
|
715 * @param aPathHandle Svg path handle |
|
716 * @param aSegmentIndex - |
|
717 * @param aSegmentType Segment type to be returned |
|
718 */ |
|
719 LOCAL_C void DoGetSegmentTypeL( |
|
720 MM2GSVGProxy* aProxy, |
|
721 TInt aPathHandle, TInt aSegmentIndex, TInt16* aSegmentType) |
|
722 { |
|
723 return aProxy->GetSegmentTypeL( |
|
724 STATIC_CAST(TM2GSvgPathHandle, aPathHandle), aSegmentIndex, |
|
725 *aSegmentType); |
|
726 } |
|
727 |
|
728 /** |
|
729 * JNI method |
|
730 */ |
|
731 JNIEXPORT jshort JNICALL |
|
732 Java_com_nokia_microedition_m2g_M2GSVGPath__1getSegmentType( |
|
733 JNIEnv* aJni, |
|
734 jclass, |
|
735 jint aEventSourceHandle, |
|
736 jint aSvgProxyHandle, |
|
737 TInt aPathHandle, |
|
738 jint aIndex, |
|
739 jboolean aUiToolkit) |
|
740 { |
|
741 M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GSVGPath ) _getSegmentType: index=%d - begin", aIndex); |
|
742 TInt err = KM2GNotOk; |
|
743 TInt16 aSegmentType = 0; |
|
744 if (aUiToolkit) |
|
745 { |
|
746 MSwtClient* client = reinterpret_cast< MSwtClient* >(aEventSourceHandle); |
|
747 if (client && aSvgProxyHandle) |
|
748 { |
|
749 typedef void (MM2GSVGProxy::*pGetSegmentTypeL)( |
|
750 const TM2GSvgPathHandle&, |
|
751 TInt, |
|
752 TInt16&); |
|
753 pGetSegmentTypeL GetSegmentTypeL = &MM2GSVGProxy::GetSegmentTypeL; |
|
754 MM2GSVGProxy * aProxy = JavaUnhand< MM2GSVGProxy >(aSvgProxyHandle); |
|
755 TM2GSvgDocumentHandle lPathHandle = STATIC_CAST(TM2GSvgPathHandle, aPathHandle); |
|
756 TMethodWrapper3<MM2GSVGProxy,const TM2GSvgPathHandle&, TInt, TInt16& > GetSegmentType |
|
757 ( |
|
758 *aProxy, |
|
759 GetSegmentTypeL, |
|
760 lPathHandle, |
|
761 aIndex, |
|
762 aSegmentType |
|
763 ); |
|
764 err = client->Execute(GetSegmentType); |
|
765 } |
|
766 } |
|
767 else |
|
768 { |
|
769 CM2GEventSource* eventSource = JavaUnhand< CM2GEventSource >(aEventSourceHandle); |
|
770 |
|
771 if (eventSource && aSvgProxyHandle) |
|
772 { |
|
773 err = eventSource->ExecuteTrap( |
|
774 &DoGetSegmentTypeL, |
|
775 JavaUnhand< MM2GSVGProxy >(aSvgProxyHandle), |
|
776 aPathHandle, aIndex, &aSegmentType); |
|
777 |
|
778 } |
|
779 } |
|
780 M2GGeneral::CheckErrorCode(aJni, err); |
|
781 M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GSVGPath ) _getSegmentType: %d - end", aSegmentType); |
|
782 return STATIC_CAST(jshort, aSegmentType); |
|
783 } |
|
784 |
|
785 M2G_NS_END |