|
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_M2GSVGElement.h" |
|
21 #include "MM2GSVGProxy.h" |
|
22 |
|
23 M2G_NS_START |
|
24 |
|
25 // EXTERNAL DATA STRUCTURES |
|
26 |
|
27 // EXTERNAL FUNCTION PROTOTYPES |
|
28 |
|
29 // CONSTANTS |
|
30 |
|
31 // MACROS |
|
32 |
|
33 // LOCAL CONSTANTS AND MACROS |
|
34 |
|
35 // MODULE DATA STRUCTURES |
|
36 |
|
37 // LOCAL FUNCTION PROTOTYPES |
|
38 |
|
39 // FORWARD DECLARATIONS |
|
40 |
|
41 // CLASS DECLARATION |
|
42 |
|
43 // ================================ FUNCTIONS ================================== |
|
44 |
|
45 // ----------------------------------------------------------------------------- |
|
46 // Java_com_nokia_microedition_m2g_M2GSVGElement::_appendChild |
|
47 // ----------------------------------------------------------------------------- |
|
48 /** |
|
49 * Calls MM2GSVGProxy::AppendChildL method. |
|
50 * @since Series S60 3.0 |
|
51 * @param aProxy Proxy instance. |
|
52 * @param aElementHandle Element handle |
|
53 * @param aChildElementHandle Child handle |
|
54 */ |
|
55 JNIEXPORT void JNICALL |
|
56 Java_com_nokia_microedition_m2g_M2GSVGElement__1appendChild( |
|
57 JNIEnv* aJni, |
|
58 jclass, |
|
59 jint aSvgProxyHandle, |
|
60 jint aElementHandle, |
|
61 jint aChildElementHandle) |
|
62 { |
|
63 M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGElement ) _appendChild - begin"); |
|
64 TInt err = KM2GNotOk; |
|
65 |
|
66 M2G_DO_LOCK |
|
67 if (aSvgProxyHandle) |
|
68 { |
|
69 MM2GSVGProxy* aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle); |
|
70 TRAP(err, aProxy->AppendChildL( |
|
71 STATIC_CAST(TM2GSvgElementHandle, aElementHandle), |
|
72 STATIC_CAST(TM2GSvgElementHandle, aChildElementHandle)); ); |
|
73 } |
|
74 M2G_DO_UNLOCK(aJni) |
|
75 |
|
76 M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGElement ) _appendChild - end"); |
|
77 M2GGeneral::CheckErrorCode(aJni, err); |
|
78 } |
|
79 |
|
80 |
|
81 // ----------------------------------------------------------------------------- |
|
82 // Java_com_nokia_microedition_m2g_M2GSVGElement::_checkRemoveable |
|
83 // ----------------------------------------------------------------------------- |
|
84 /** |
|
85 * Calls MM2GSVGProxy::CheckRemoveableL method. |
|
86 * @since Series S60 3.0 |
|
87 * @param aProxy Proxy instance. |
|
88 * @param aElementHandle Element handle |
|
89 * @param aRemoveable Result |
|
90 */ |
|
91 JNIEXPORT jint JNICALL Java_com_nokia_microedition_m2g_M2GSVGElement__1checkRemoveable( |
|
92 JNIEnv* aJni, |
|
93 jclass, |
|
94 jint aSvgProxyHandle, |
|
95 jint aElementHandle) |
|
96 { |
|
97 TInt removeable = -1; |
|
98 M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGElement ) _checkRemoveable - begin"); |
|
99 TInt err = KM2GNotOk; |
|
100 |
|
101 |
|
102 M2G_DO_LOCK |
|
103 if (aSvgProxyHandle) |
|
104 { |
|
105 MM2GSVGProxy* aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle); |
|
106 |
|
107 TRAP(err, aProxy->CheckRemoveableL(aElementHandle, removeable);); |
|
108 } |
|
109 M2G_DO_UNLOCK(aJni) |
|
110 |
|
111 M2GGeneral::CheckErrorCode(aJni, err); |
|
112 M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GSVGElement ) _checkRemoveable: %d - end", removeable); |
|
113 return removeable; |
|
114 } |
|
115 |
|
116 // ----------------------------------------------------------------------------- |
|
117 // Java_com_nokia_microedition_m2g_M2GSVGElement::_getBBox |
|
118 // ----------------------------------------------------------------------------- |
|
119 /** |
|
120 * Calls MM2GSVGProxy::GetBBoxL method. |
|
121 * @since Series S60 3.0 |
|
122 * @param aProxy Proxy instance. |
|
123 * @param aElementHandle Element handle |
|
124 * @param aAttributeTypeId Attribute type id |
|
125 * @param aRectData Returns rect components |
|
126 * @param aResult Result "0" ok |
|
127 */ |
|
128 JNIEXPORT jint JNICALL |
|
129 Java_com_nokia_microedition_m2g_M2GSVGElement__1getBBox( |
|
130 JNIEnv* aJni, |
|
131 jclass, |
|
132 jint aSvgProxyHandle, |
|
133 jint aElementHandle, |
|
134 jshort aAttributeTypeId, |
|
135 jfloatArray aRectComponents) |
|
136 { |
|
137 M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGElement ) _getBBox - begin"); |
|
138 |
|
139 TM2GRectData rect; |
|
140 TInt result = 0; |
|
141 TInt err = KM2GNotOk; |
|
142 |
|
143 M2G_DO_LOCK |
|
144 if (aSvgProxyHandle) |
|
145 { |
|
146 MM2GSVGProxy* aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle); |
|
147 |
|
148 TRAP(err, aProxy->GetBBoxL( |
|
149 STATIC_CAST(TM2GSvgElementHandle, aElementHandle), |
|
150 STATIC_CAST(TM2GSvgAttrType, aAttributeTypeId), |
|
151 rect, result); ); |
|
152 } |
|
153 M2G_DO_UNLOCK(aJni) |
|
154 |
|
155 M2GGeneral::CheckErrorCode(aJni, err); |
|
156 |
|
157 aJni->SetFloatArrayRegion( |
|
158 REINTERPRET_CAST(jfloatArray, aRectComponents), |
|
159 0, |
|
160 rect.Count(), REINTERPRET_CAST(jfloat*, rect.Begin())); |
|
161 |
|
162 M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GSVGElement ) _getBBox: %d - end", result); |
|
163 return result; |
|
164 } |
|
165 |
|
166 // ----------------------------------------------------------------------------- |
|
167 // Java_com_nokia_microedition_m2g_M2GSVGElement::_getColorTrait |
|
168 // ----------------------------------------------------------------------------- |
|
169 /** |
|
170 * Calls MM2GSVGProxy::GetColorTraitL method. |
|
171 * @since Series S60 3.0 |
|
172 * @param aProxy Proxy instance. |
|
173 * @param aElementHandle Element handle |
|
174 * @param aAttributeTypeId Attribute type id |
|
175 * @param aColors Color elements ( RGB ) |
|
176 * @param aTrait Result |
|
177 */ |
|
178 JNIEXPORT jint JNICALL |
|
179 Java_com_nokia_microedition_m2g_M2GSVGElement__1getColorTrait( |
|
180 JNIEnv* aJni, |
|
181 jclass, |
|
182 jint aSvgProxyHandle, |
|
183 jint aElementHandle, |
|
184 jshort aAttributeTypeId, |
|
185 jintArray aColorComponents) |
|
186 { |
|
187 M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGElement ) _getColorTrait - begin"); |
|
188 TM2GColorData color; |
|
189 TInt result = -1; |
|
190 TInt err = KM2GNotOk; |
|
191 |
|
192 M2G_DO_LOCK |
|
193 if (aSvgProxyHandle) |
|
194 { |
|
195 MM2GSVGProxy* aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle); |
|
196 TRAP(err, aProxy->GetColorTraitL( |
|
197 aElementHandle, |
|
198 aAttributeTypeId, |
|
199 color, |
|
200 result); ); |
|
201 } |
|
202 M2G_DO_UNLOCK(aJni) |
|
203 |
|
204 M2GGeneral::CheckErrorCode(aJni, err); |
|
205 if (color[ 0 ] == -1 && color[ 1 ] == -1 && color[ 2 ] == -1) |
|
206 { |
|
207 result = 0; |
|
208 aJni->SetIntArrayRegion(aColorComponents, 0, color.Count(), &(color[ 0 ])); |
|
209 } |
|
210 else if (result != -1) |
|
211 { |
|
212 result = 1; |
|
213 aJni->SetIntArrayRegion(aColorComponents, 0, color.Count(), color.Begin()); |
|
214 } |
|
215 |
|
216 M2G_DEBUG_4("M2G_DEBUG: JNI ( M2GSVGElement ) _getColorTrait: %d, R=%d, G=%d, B=%d - end", result, color[ 0 ], color[ 1 ], color[ 2 ]); |
|
217 return result; |
|
218 } |
|
219 |
|
220 |
|
221 // ----------------------------------------------------------------------------- |
|
222 // Java_com_nokia_microedition_m2g_M2GSVGElement::_getElementTypeId |
|
223 // ----------------------------------------------------------------------------- |
|
224 /** |
|
225 * Calls MM2GSVGProxy::GetElementTypeIdL method. |
|
226 * @since Series S60 3.0 |
|
227 * @param aProxy Proxy instance. |
|
228 * @param aElementHandle Element handle |
|
229 * @param aId |
|
230 */ |
|
231 JNIEXPORT jshort JNICALL |
|
232 Java_com_nokia_microedition_m2g_M2GSVGElement__1getElementTypeId( |
|
233 JNIEnv* aJni, |
|
234 jclass, |
|
235 jint aSvgProxyHandle, |
|
236 jint aElementHandle) |
|
237 { |
|
238 M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGElement ) _getElementTypeId - begin"); |
|
239 TInt16 id = 0; |
|
240 TInt err = KM2GNotOk; |
|
241 |
|
242 M2G_DO_LOCK |
|
243 if (aSvgProxyHandle) |
|
244 { |
|
245 MM2GSVGProxy* aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle); |
|
246 TRAP(err, aProxy->GetElementTypeIdL(aElementHandle, id); ); |
|
247 } |
|
248 M2G_DO_UNLOCK(aJni) |
|
249 |
|
250 M2GGeneral::CheckErrorCode(aJni, err); |
|
251 M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GSVGElement ) _getElementTypeId: %d - end", id); |
|
252 return id; |
|
253 } |
|
254 |
|
255 // ----------------------------------------------------------------------------- |
|
256 // Java_com_nokia_microedition_m2g_M2GSVGElement::_getEnumTrait |
|
257 // ----------------------------------------------------------------------------- |
|
258 /** |
|
259 * Calls MM2GSVGProxy::GetEnumTraitL method. |
|
260 * @since Series S60 3.0 |
|
261 * @param aProxy Proxy instance. |
|
262 * @param aElementHandle Element handle |
|
263 * @param aAttributeTypeId Attribute type id |
|
264 * @param aEnumTrait The enumeration value of the specified attribute |
|
265 */ |
|
266 JNIEXPORT jshort JNICALL |
|
267 Java_com_nokia_microedition_m2g_M2GSVGElement__1getEnumTrait( |
|
268 JNIEnv* aJni, |
|
269 jclass, |
|
270 jint aSvgProxyHandle, |
|
271 jint aElementHandle, |
|
272 jshort aAttributeTypeId) |
|
273 { |
|
274 M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGElement ) _getEnumTrait - begin"); |
|
275 TInt16 enumTrait = 0; |
|
276 TInt err = KM2GNotOk; |
|
277 |
|
278 M2G_DO_LOCK |
|
279 if (aSvgProxyHandle) |
|
280 { |
|
281 MM2GSVGProxy* aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle); |
|
282 |
|
283 TRAP(err, aProxy->GetEnumTraitL( |
|
284 STATIC_CAST(TM2GSvgElementHandle, aElementHandle), |
|
285 STATIC_CAST(TM2GSvgAttrType, aAttributeTypeId), |
|
286 enumTrait); ); |
|
287 } |
|
288 M2G_DO_UNLOCK(aJni) |
|
289 |
|
290 M2GGeneral::CheckErrorCode(aJni, err); |
|
291 M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GSVGElement ) _getEnumTrait: %d - end", enumTrait); |
|
292 return enumTrait; |
|
293 } |
|
294 // ----------------------------------------------------------------------------- |
|
295 // Java_com_nokia_microedition_m2g_M2GSVGElement::_getFirstElementChild |
|
296 // ----------------------------------------------------------------------------- |
|
297 /** |
|
298 * Calls MM2GSVGProxy::GetFirstElementChildL method. |
|
299 * @since Series S60 3.0 |
|
300 * @param aProxy Proxy instance. |
|
301 * @param aElementHandle Element handle |
|
302 * @param aHandle Element handle to be returned. |
|
303 */ |
|
304 JNIEXPORT jint JNICALL |
|
305 Java_com_nokia_microedition_m2g_M2GSVGElement__1getFirstElementChild( |
|
306 JNIEnv* aJni, |
|
307 jclass, |
|
308 jint aSvgProxyHandle, |
|
309 jint aElementHandle) |
|
310 { |
|
311 M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGElement ) _getFirstElementChild - begin"); |
|
312 |
|
313 TInt childHandle = M2G_INVALID_HANDLE; |
|
314 TInt err = KM2GNotOk; |
|
315 |
|
316 M2G_DO_LOCK |
|
317 if (aSvgProxyHandle) |
|
318 { |
|
319 MM2GSVGProxy* aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle); |
|
320 TRAP(err, aProxy->GetFirstElementChildL(aElementHandle, childHandle); ); |
|
321 } |
|
322 M2G_DO_UNLOCK(aJni) |
|
323 |
|
324 M2GGeneral::CheckErrorCode(aJni, err); |
|
325 M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GSVGElement ) _getFirstElementChild: %d - end", childHandle); |
|
326 return childHandle; |
|
327 } |
|
328 // ----------------------------------------------------------------------------- |
|
329 // Java_com_nokia_microedition_m2g_M2GSVGElement::_getFloatTrait |
|
330 // ----------------------------------------------------------------------------- |
|
331 /** |
|
332 * Calls MM2GSVGProxy::GetFloatTraitL method. |
|
333 * @since Series S60 3.0 |
|
334 * @param aProxy Proxy instance. |
|
335 * @param aElementHandle Element handle |
|
336 * @param aAttributeTypeId Attribute type id |
|
337 * @param aFloatTrait Float attribute to be returned |
|
338 */ |
|
339 JNIEXPORT jfloat JNICALL |
|
340 Java_com_nokia_microedition_m2g_M2GSVGElement__1getFloatTrait( |
|
341 JNIEnv* aJni, |
|
342 jclass, |
|
343 jint aSvgProxyHandle, |
|
344 jint aElementHandle, |
|
345 jshort aAttributeTypeId) |
|
346 { |
|
347 M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGElement ) _getFloatTrait - begin"); |
|
348 TInt err = KM2GNotOk; |
|
349 TReal32 floatTrait = 0; |
|
350 |
|
351 M2G_DO_LOCK |
|
352 if (aSvgProxyHandle) |
|
353 { |
|
354 MM2GSVGProxy* aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle); |
|
355 |
|
356 TRAP(err ,aProxy->GetFloatTraitL( |
|
357 STATIC_CAST(TM2GSvgElementHandle, aElementHandle), |
|
358 STATIC_CAST(TM2GSvgAttrType, aAttributeTypeId), |
|
359 floatTrait);); |
|
360 } |
|
361 M2G_DO_UNLOCK(aJni) |
|
362 |
|
363 M2GGeneral::CheckErrorCode(aJni, err); |
|
364 M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GSVGElement ) _getFloatTrait: %f - end", floatTrait); |
|
365 return STATIC_CAST(jfloat, floatTrait); |
|
366 } |
|
367 |
|
368 // ----------------------------------------------------------------------------- |
|
369 // Java_com_nokia_microedition_m2g_M2GSVGElement::_getMatrixTrait |
|
370 // ----------------------------------------------------------------------------- |
|
371 /** |
|
372 * Calls MM2GSVGProxy::GetMatrixTraitL method. |
|
373 * @since Series S60 3.0 |
|
374 * @param aProxy Proxy instance. |
|
375 * @param aElementHandle Element handle |
|
376 * @param aAttributeTypeId Attribute type id |
|
377 * @param aResult Result: "0" if ok and "-1" if nok |
|
378 s*/ |
|
379 JNIEXPORT jint JNICALL |
|
380 Java_com_nokia_microedition_m2g_M2GSVGElement__1getMatrixTrait( |
|
381 JNIEnv* aJni, |
|
382 jclass, |
|
383 jint aSvgProxyHandle, |
|
384 jint aElementHandle, |
|
385 jshort aAttributeTypeId, |
|
386 jfloatArray aMatrixComponents) |
|
387 { |
|
388 M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGElement ) _getMatrixTrait - begin"); |
|
389 TM2GMatrixData matrix; |
|
390 TInt result = -1; |
|
391 TInt err = KM2GNotOk; |
|
392 |
|
393 M2G_DO_LOCK |
|
394 if (aSvgProxyHandle) |
|
395 { |
|
396 MM2GSVGProxy* aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle); |
|
397 |
|
398 TRAP(err, aProxy->GetMatrixTraitL( |
|
399 STATIC_CAST(TM2GSvgElementHandle, aElementHandle), |
|
400 STATIC_CAST(TM2GSvgAttrType, aAttributeTypeId), |
|
401 matrix, result); ); |
|
402 } |
|
403 M2G_DO_UNLOCK(aJni) |
|
404 |
|
405 if (M2GGeneral::CheckErrorCode(aJni, err) == KM2GOk) |
|
406 { |
|
407 // Init matrix object |
|
408 jfloat* components = aJni->GetFloatArrayElements(aMatrixComponents, 0); |
|
409 TInt count = |
|
410 M2GGeneral::Min(aJni->GetArrayLength(aMatrixComponents), matrix.Count()); |
|
411 for (TInt index = 0; index < count; index++) |
|
412 { |
|
413 components[ index ] = matrix[ index ]; |
|
414 } |
|
415 // Release data source |
|
416 aJni->ReleaseFloatArrayElements(aMatrixComponents, components, 0); |
|
417 } |
|
418 |
|
419 M2G_DEBUG_6("M2G_DEBUG: JNI ( M2GSVGElement ) _getMatrixTrait: %f, %f, %f, %f, %f, %f - end", matrix[ 0 ], matrix[ 1 ], matrix[ 2 ], matrix[ 3 ], matrix[ 4 ], matrix[ 5 ]); |
|
420 return result; |
|
421 } |
|
422 |
|
423 // ----------------------------------------------------------------------------- |
|
424 // Java_com_nokia_microedition_m2g_M2GSVGElement::_getNextElementSibling |
|
425 // ----------------------------------------------------------------------------- |
|
426 /** |
|
427 * Calls MM2GSVGProxy::GetNextElementSiblingL method. |
|
428 * @since Series S60 3.0 |
|
429 * @param aProxy Proxy instance. |
|
430 * @param aElementHandle Element pointer. |
|
431 * @param aSiblingHandle Sibling handle |
|
432 */ |
|
433 JNIEXPORT jint JNICALL |
|
434 Java_com_nokia_microedition_m2g_M2GSVGElement__1getNextElementSibling( |
|
435 JNIEnv* aJni, |
|
436 jclass, |
|
437 jint aSvgProxyHandle, |
|
438 jint aElementHandle) |
|
439 { |
|
440 M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGElement ) _getNextElementSibling - begin"); |
|
441 TInt siblingHandle = M2G_INVALID_HANDLE; |
|
442 TInt err = KM2GNotOk; |
|
443 |
|
444 M2G_DO_LOCK |
|
445 if (aSvgProxyHandle) |
|
446 { |
|
447 MM2GSVGProxy* aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle); |
|
448 TRAP(err, aProxy->GetNextElementSiblingL(aElementHandle, siblingHandle); ); |
|
449 } |
|
450 M2G_DO_UNLOCK(aJni) |
|
451 |
|
452 M2GGeneral::CheckErrorCode(aJni, err); |
|
453 M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GSVGElement ) _getNextElementSibling: %d - end", siblingHandle); |
|
454 return siblingHandle; |
|
455 } |
|
456 // ----------------------------------------------------------------------------- |
|
457 // Java_com_nokia_microedition_m2g_M2GSVGElement::_getParent |
|
458 // ----------------------------------------------------------------------------- |
|
459 /** |
|
460 * Calls MM2GSVGProxy::GetParentL method. |
|
461 * @since Series S60 3.0 |
|
462 * @param aProxy Proxy instance. |
|
463 * @param aElementHandle Element pointer. |
|
464 * @param aParentHandle Parent handle to be returned. |
|
465 */ |
|
466 JNIEXPORT jint JNICALL |
|
467 Java_com_nokia_microedition_m2g_M2GSVGElement__1getParent( |
|
468 JNIEnv* aJni, |
|
469 jclass, |
|
470 jint aSvgProxyHandle, |
|
471 jint aElementHandle) |
|
472 { |
|
473 M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGElement ) _getParent - begin"); |
|
474 TInt parentHandle = M2G_INVALID_HANDLE; |
|
475 TInt err = KM2GNotOk; |
|
476 |
|
477 M2G_DO_LOCK |
|
478 |
|
479 if (aSvgProxyHandle) |
|
480 { |
|
481 MM2GSVGProxy* aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle); |
|
482 TRAP(err, aProxy->GetParentL(aElementHandle, parentHandle);); |
|
483 } |
|
484 M2G_DO_UNLOCK(aJni) |
|
485 |
|
486 M2GGeneral::CheckErrorCode(aJni, err); |
|
487 M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GSVGElement ) _getParent: %d - end", parentHandle); |
|
488 return parentHandle; |
|
489 } |
|
490 |
|
491 // ----------------------------------------------------------------------------- |
|
492 // Java_com_nokia_microedition_m2g_M2GSVGElement::_getPathTrait |
|
493 // ----------------------------------------------------------------------------- |
|
494 /** |
|
495 * Calls MM2GSVGProxy::GetPathTraitL method. |
|
496 * @since Series S60 3.0 |
|
497 * @param aProxy Proxy instance. |
|
498 * @param aElementHandle Element pointer. |
|
499 * @param aAttributeTypeId Attribute type. |
|
500 */ |
|
501 JNIEXPORT jint JNICALL |
|
502 Java_com_nokia_microedition_m2g_M2GSVGElement__1getPathTrait( |
|
503 JNIEnv* aJni, |
|
504 jclass, |
|
505 jint aSvgProxyHandle, |
|
506 jint aElementHandle, |
|
507 jshort aAttributeTypeId) |
|
508 { |
|
509 M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGElement ) _getPathTrait - begin"); |
|
510 TInt aPathTrait = 0; |
|
511 TInt err = KM2GNotOk; |
|
512 |
|
513 M2G_DO_LOCK |
|
514 if (aSvgProxyHandle) |
|
515 { |
|
516 MM2GSVGProxy* aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle); |
|
517 |
|
518 TRAP(err, aProxy->GetPathTraitL( |
|
519 STATIC_CAST(TM2GSvgElementHandle, aElementHandle), |
|
520 STATIC_CAST(TM2GSvgAttrType, aAttributeTypeId), |
|
521 aPathTrait); ); |
|
522 } |
|
523 M2G_DO_UNLOCK(aJni) |
|
524 |
|
525 M2GGeneral::CheckErrorCode(aJni, err); |
|
526 M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GSVGElement ) _getPathTrait: %d - end", aPathTrait); |
|
527 return aPathTrait; |
|
528 } |
|
529 |
|
530 // ----------------------------------------------------------------------------- |
|
531 // Java_com_nokia_microedition_m2g_M2GSVGElement::_getRectTrait |
|
532 // ----------------------------------------------------------------------------- |
|
533 /** |
|
534 * Calls MM2GSVGProxy::GetRectTraitL method. |
|
535 * @since Series S60 3.0 |
|
536 * @param aProxy Proxy instance. |
|
537 * @param aElementHandle Element handle |
|
538 * @param aAttributeTypeId Attribute type id |
|
539 * @param aRectData Returns rect components |
|
540 * @param aResult Result "0" if ok and "-1" if nok |
|
541 */ |
|
542 JNIEXPORT jint JNICALL |
|
543 Java_com_nokia_microedition_m2g_M2GSVGElement__1getRectTrait( |
|
544 JNIEnv* aJni, |
|
545 jclass, |
|
546 jint aSvgProxyHandle, |
|
547 jint aElementHandle, |
|
548 jshort aAttributeTypeId, |
|
549 jfloatArray aRectComponents) |
|
550 { |
|
551 M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGElement ) _getRectTrait - begin"); |
|
552 TM2GRectData rect; |
|
553 TInt result = 0; |
|
554 TInt err = KM2GNotOk; |
|
555 |
|
556 M2G_DO_LOCK |
|
557 if (aSvgProxyHandle) |
|
558 { |
|
559 MM2GSVGProxy* aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle); |
|
560 |
|
561 TRAP(err , aProxy->GetRectTraitL( |
|
562 STATIC_CAST(TM2GSvgElementHandle, aElementHandle), |
|
563 STATIC_CAST(TM2GSvgAttrType, aAttributeTypeId), |
|
564 rect, result); ); |
|
565 } |
|
566 M2G_DO_UNLOCK(aJni) |
|
567 |
|
568 M2GGeneral::CheckErrorCode(aJni, err); |
|
569 aJni->SetFloatArrayRegion( |
|
570 REINTERPRET_CAST(jfloatArray, aRectComponents), |
|
571 0, |
|
572 rect.Count(), REINTERPRET_CAST(jfloat*, rect.Begin())); |
|
573 |
|
574 M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GSVGElement ) _getRectTrait: %d - end", result); |
|
575 return result; |
|
576 } |
|
577 // ----------------------------------------------------------------------------- |
|
578 // Java_com_nokia_microedition_m2g_M2GSVGElement::_getRootElement |
|
579 // ----------------------------------------------------------------------------- |
|
580 /** |
|
581 * Calls MM2GSVGProxy::GetRootElementL method. |
|
582 * @since Series S60 3.0 |
|
583 * @param aProxy Proxy instance. |
|
584 * @param aDocumentHandle Document pointer. |
|
585 * @param aRootElementHandle Root element handle |
|
586 */ |
|
587 JNIEXPORT jint JNICALL |
|
588 Java_com_nokia_microedition_m2g_M2GSVGElement__1getRootElement( |
|
589 JNIEnv* aJni, |
|
590 jclass, |
|
591 jint aSvgProxyHandle, |
|
592 jint aDocumentHandle) |
|
593 { |
|
594 M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGElement ) _getRootElement - begin"); |
|
595 TInt rootElementHandle = M2G_INVALID_HANDLE; |
|
596 TInt err = KM2GNotOk; |
|
597 M2G_DO_LOCK |
|
598 if (aSvgProxyHandle) |
|
599 { |
|
600 MM2GSVGProxy* aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle); |
|
601 |
|
602 TRAP(err, aProxy->GetRootElementL( |
|
603 STATIC_CAST(TM2GSvgDocumentHandle, aDocumentHandle), |
|
604 rootElementHandle); ); |
|
605 } |
|
606 M2G_DO_UNLOCK(aJni) |
|
607 |
|
608 M2GGeneral::CheckErrorCode(aJni, err); |
|
609 |
|
610 M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GSVGElement ) _getRootElement: %d - end", rootElementHandle); |
|
611 return rootElementHandle; |
|
612 } |
|
613 |
|
614 // ----------------------------------------------------------------------------- |
|
615 // Java_com_nokia_microedition_m2g_M2GSVGElement::_getScreenBBox |
|
616 // ----------------------------------------------------------------------------- |
|
617 /** |
|
618 * Calls MM2GSVGProxy::GetScreenBBoxL method. |
|
619 * @since Series S60 3.0 |
|
620 * @param aProxy Proxy instance. |
|
621 * @param aElementHandle Element handle |
|
622 * @param aRectData Returns rect components |
|
623 */ |
|
624 JNIEXPORT void JNICALL |
|
625 Java_com_nokia_microedition_m2g_M2GSVGElement__1getScreenBBox( |
|
626 JNIEnv* aJni, |
|
627 jclass, |
|
628 jint aSvgProxyHandle, |
|
629 jint aElementHandle, |
|
630 jfloatArray aScreenBBoxComponents) |
|
631 { |
|
632 M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGElement ) _getScreenBBox - begin"); |
|
633 TM2GScreenBBoxData screenBBox; |
|
634 TInt err = KM2GNotOk; |
|
635 |
|
636 M2G_DO_LOCK |
|
637 if (aSvgProxyHandle) |
|
638 { |
|
639 MM2GSVGProxy* aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle); |
|
640 |
|
641 TRAP(err, aProxy->GetScreenBBoxL( |
|
642 STATIC_CAST(TM2GSvgElementHandle, aElementHandle), |
|
643 screenBBox); ); |
|
644 } |
|
645 M2G_DO_UNLOCK(aJni) |
|
646 |
|
647 M2GGeneral::CheckErrorCode(aJni, err); |
|
648 |
|
649 aJni->SetFloatArrayRegion( |
|
650 REINTERPRET_CAST(jfloatArray, aScreenBBoxComponents), |
|
651 0, |
|
652 screenBBox.Count(), REINTERPRET_CAST(jfloat*, screenBBox.Begin())); |
|
653 |
|
654 M2G_DEBUG_4("M2G_DEBUG: JNI ( M2GSVGElement ) _getScreenBBox: %f, %f, %f, %f - end", screenBBox[ 0 ], screenBBox[ 1 ], screenBBox[ 2 ], screenBBox[ 3 ]); |
|
655 } |
|
656 |
|
657 // ----------------------------------------------------------------------------- |
|
658 // Java_com_nokia_microedition_m2g_M2GSVGElement::_getStringTrait |
|
659 // ----------------------------------------------------------------------------- |
|
660 /** |
|
661 * Calls MM2GSVGProxy::GetStringTraitL method. |
|
662 * @since Series S60 3.0 |
|
663 * @param aProxy Proxy instance. |
|
664 * @param aElementHandle Element pointer. |
|
665 * @param aAttributeTypeId Attribute type. |
|
666 * @param aAttribute Returns a string attribute |
|
667 */ |
|
668 JNIEXPORT jstring JNICALL |
|
669 Java_com_nokia_microedition_m2g_M2GSVGElement__1getStringTrait( |
|
670 JNIEnv* aJni, |
|
671 jclass, |
|
672 jint aSvgProxyHandle, |
|
673 jint aElementHandle, |
|
674 jshort aAttributeTypeId) |
|
675 { |
|
676 M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGElement ) _getStringTrait - begin"); |
|
677 |
|
678 TPtrC16 attribute; |
|
679 TInt err = KM2GNotOk; |
|
680 |
|
681 M2G_DO_LOCK |
|
682 if (aSvgProxyHandle) |
|
683 { |
|
684 MM2GSVGProxy* aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle); |
|
685 |
|
686 TRAP(err, aProxy->GetStringTraitL( |
|
687 STATIC_CAST(TM2GSvgElementHandle, aElementHandle), |
|
688 STATIC_CAST(TM2GSvgAttrType, aAttributeTypeId), |
|
689 attribute); ); |
|
690 } |
|
691 M2G_DO_UNLOCK(aJni) |
|
692 |
|
693 if ((M2GGeneral::CheckErrorCode(aJni, err) == KM2GOk) && |
|
694 (attribute.Length() > 0)) |
|
695 { |
|
696 return CreateJavaString(*aJni, attribute); |
|
697 } |
|
698 |
|
699 return NULL; |
|
700 M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GSVGElement ) _getStringTrait: %d - end", err); |
|
701 } |
|
702 // ----------------------------------------------------------------------------- |
|
703 // Java_com_nokia_microedition_m2g_M2GSVGElement::_getUsedFromElement |
|
704 // ----------------------------------------------------------------------------- |
|
705 /** |
|
706 * Calls MM2GSVGProxy::GetUsedFromElementL method. |
|
707 * @since Series S60 3.0 |
|
708 * @param aProxy Proxy instance. |
|
709 * @param aElementHandle Element pointer. |
|
710 * @param aHandle Return element handle |
|
711 */ |
|
712 JNIEXPORT jint JNICALL |
|
713 Java_com_nokia_microedition_m2g_M2GSVGElement__1getUsedFromElement( |
|
714 JNIEnv* aJni, |
|
715 jclass, |
|
716 jint aSvgProxyHandle, |
|
717 jint aElementHandle) |
|
718 { |
|
719 M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGElement ) _getUsedFromElement - begin"); |
|
720 TInt handle = M2G_INVALID_HANDLE; |
|
721 TInt err = KM2GNotOk; |
|
722 |
|
723 M2G_DO_LOCK |
|
724 if (aSvgProxyHandle) |
|
725 { |
|
726 MM2GSVGProxy* aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle); |
|
727 |
|
728 TRAP(err, aProxy->GetUsedFromElementL( |
|
729 STATIC_CAST(TM2GSvgElementHandle, aElementHandle), |
|
730 handle); ); |
|
731 } |
|
732 M2G_DO_UNLOCK(aJni) |
|
733 |
|
734 M2GGeneral::CheckErrorCode(aJni, err); |
|
735 M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GSVGElement ) _getUsedFromElement: %d - end", handle); |
|
736 return handle; |
|
737 } |
|
738 |
|
739 |
|
740 // ----------------------------------------------------------------------------- |
|
741 // Java_com_nokia_microedition_m2g_M2GSVGElement::_insertBefore |
|
742 // ----------------------------------------------------------------------------- |
|
743 /** |
|
744 * Class: com_nokia_microedition_m2g_M2GSVGElement |
|
745 * Method: insertBefore |
|
746 * Signature: |
|
747 */ |
|
748 JNIEXPORT void JNICALL |
|
749 Java_com_nokia_microedition_m2g_M2GSVGElement__1insertBefore( |
|
750 JNIEnv* aJni, |
|
751 jclass, |
|
752 jint aSvgProxyHandle, |
|
753 jint aElementHandle, |
|
754 jint aNewChildElementHandle, |
|
755 jint aReferenceElementHandle) |
|
756 { |
|
757 M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGElement ) _insertBefore - begin"); |
|
758 TInt err = KM2GNotOk; |
|
759 |
|
760 M2G_DO_LOCK |
|
761 |
|
762 if (aSvgProxyHandle) |
|
763 { |
|
764 MM2GSVGProxy* aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle); |
|
765 |
|
766 TRAP(err, aProxy->InsertBeforeL( |
|
767 STATIC_CAST(TM2GSvgElementHandle, aElementHandle), |
|
768 STATIC_CAST(TM2GSvgElementHandle, aNewChildElementHandle), |
|
769 STATIC_CAST(TM2GSvgElementHandle, aReferenceElementHandle)); ); |
|
770 } |
|
771 M2G_DO_UNLOCK(aJni) |
|
772 |
|
773 M2GGeneral::CheckErrorCode(aJni, err); |
|
774 M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGElement ) _insertBefore - end"); |
|
775 } |
|
776 // ----------------------------------------------------------------------------- |
|
777 // Java_com_nokia_microedition_m2g_M2GSVGElement::_isUsed |
|
778 // ----------------------------------------------------------------------------- |
|
779 /** |
|
780 * Calls MM2GSVGProxy::IsUsedL method. |
|
781 * @since Series S60 3.0 |
|
782 * @param aProxy Proxy instance. |
|
783 * @param aElementHandle Element pointer. |
|
784 * @param aResult Return "1" if used otherwise returns "0" |
|
785 */ |
|
786 JNIEXPORT jint JNICALL |
|
787 Java_com_nokia_microedition_m2g_M2GSVGElement__1isUsed( |
|
788 JNIEnv* aJni, |
|
789 jclass, |
|
790 jint aSvgProxyHandle, |
|
791 jint aElementHandle ) |
|
792 { |
|
793 M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGElement ) _isUsed - begin"); |
|
794 TInt result = KM2GNotOk; |
|
795 TInt err = KM2GNotOk; |
|
796 |
|
797 M2G_DO_LOCK |
|
798 if (aSvgProxyHandle) |
|
799 { |
|
800 MM2GSVGProxy* aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle); |
|
801 TRAP(err, aProxy->IsUsedL(STATIC_CAST(TM2GSvgElementHandle, aElementHandle), result); ); |
|
802 } |
|
803 M2G_DO_UNLOCK(aJni) |
|
804 |
|
805 |
|
806 M2GGeneral::CheckErrorCode(aJni, err); |
|
807 M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GSVGElement ) _isUsed: %d - end", result); |
|
808 return result; |
|
809 } |
|
810 |
|
811 // ----------------------------------------------------------------------------- |
|
812 // Java_com_nokia_microedition_m2g_M2GSVGElement::_removeChild |
|
813 // ----------------------------------------------------------------------------- |
|
814 /** |
|
815 * Calls MM2GSVGProxy::RemoveChild method. |
|
816 * @since Series S60 3.0 |
|
817 * @param aProxy Proxy instance. |
|
818 * @param aElementHandle Element pointer. |
|
819 * @param aChildElementHandle child element pointer |
|
820 * @param aHandle Handle to removed element. |
|
821 */ |
|
822 JNIEXPORT jint JNICALL |
|
823 Java_com_nokia_microedition_m2g_M2GSVGElement__1removeChild( |
|
824 JNIEnv* aJni, |
|
825 jclass, |
|
826 jint aSvgProxyHandle, |
|
827 jint aElementHandle, |
|
828 jint aChildElementHandle) |
|
829 { |
|
830 M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGElement ) _removeChild - begin"); |
|
831 TInt handle = M2G_INVALID_HANDLE; |
|
832 TInt err = KM2GNotOk; |
|
833 |
|
834 M2G_DO_LOCK |
|
835 if (aSvgProxyHandle) |
|
836 { |
|
837 MM2GSVGProxy* aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle); |
|
838 |
|
839 TRAP(err ,aProxy->RemoveChildL( |
|
840 STATIC_CAST(TM2GSvgElementHandle, aElementHandle), |
|
841 STATIC_CAST(TM2GSvgElementHandle, aChildElementHandle), handle); ); |
|
842 } |
|
843 M2G_DO_UNLOCK(aJni) |
|
844 |
|
845 M2GGeneral::CheckErrorCode(aJni, err); |
|
846 |
|
847 M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GSVGElement ) _removeChild: %d - end", handle); |
|
848 return handle; |
|
849 } |
|
850 |
|
851 // ----------------------------------------------------------------------------- |
|
852 // Java_com_nokia_microedition_m2g_M2GSVGElement::_setColorTrait |
|
853 // ----------------------------------------------------------------------------- |
|
854 /** |
|
855 * Calls MM2GSVGProxy::SetColorTraitL method. |
|
856 * @since Series S60 3.0 |
|
857 * @param aProxy Proxy instance. |
|
858 * @param aElementHandle Element pointer. |
|
859 * @param aAttributeTypeId - |
|
860 * @param aColorData - |
|
861 */ |
|
862 JNIEXPORT void JNICALL |
|
863 Java_com_nokia_microedition_m2g_M2GSVGElement__1setColorTrait( |
|
864 JNIEnv* aJni, |
|
865 jclass, |
|
866 jint aSvgProxyHandle, |
|
867 jint aElementHandle, |
|
868 jshort aAttributeTypeId, |
|
869 jint aRed, jint aGreen, jint aBlue) |
|
870 { |
|
871 M2G_DEBUG_3("M2G_DEBUG: JNI ( M2GSVGElement ) _setColorTrait: R=%d, G=%d, B=%d - begin", aRed, aGreen, aBlue); |
|
872 TM2GColorData color; |
|
873 color[ 0 ] = aRed; |
|
874 color[ 1 ] = aGreen; |
|
875 color[ 2 ] = aBlue; |
|
876 TInt err = KM2GNotOk; |
|
877 |
|
878 M2G_DO_LOCK |
|
879 if (aSvgProxyHandle) |
|
880 { |
|
881 MM2GSVGProxy* aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle); |
|
882 |
|
883 TRAP(err, aProxy->SetColorTraitL( |
|
884 STATIC_CAST(TM2GSvgElementHandle, aElementHandle), |
|
885 STATIC_CAST(TM2GSvgAttrType, aAttributeTypeId), |
|
886 color); ); |
|
887 } |
|
888 M2G_DO_UNLOCK(aJni) |
|
889 |
|
890 M2GGeneral::CheckErrorCode(aJni, err); |
|
891 M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GSVGElement ) _setColorTrait: %d - end", err); |
|
892 } |
|
893 |
|
894 // ----------------------------------------------------------------------------- |
|
895 // Java_com_nokia_microedition_m2g_M2GSVGElement::_setEnumTrait |
|
896 // ----------------------------------------------------------------------------- |
|
897 /** |
|
898 * Calls MM2GSVGProxy::SetEnumTraitL method. |
|
899 * @since Series S60 3.0 |
|
900 * @param aProxy Proxy instance. |
|
901 * @param aElementHandle Element pointer. |
|
902 * @param aAttributeTypeId - |
|
903 * @param aValue |
|
904 */ |
|
905 JNIEXPORT void JNICALL |
|
906 Java_com_nokia_microedition_m2g_M2GSVGElement__1setEnumTrait( |
|
907 JNIEnv* aJni, |
|
908 jclass, |
|
909 jint aSvgProxyHandle, |
|
910 jint aElementHandle, |
|
911 jshort aAttributeTypeId, |
|
912 jshort aValue) |
|
913 { |
|
914 M2G_DEBUG_2("M2G_DEBUG: JNI ( M2GSVGElement ) _setEnumTrait: type=%d, value=%d - begin", aAttributeTypeId, aValue); |
|
915 TInt err = KM2GNotOk; |
|
916 |
|
917 M2G_DO_LOCK |
|
918 if (aSvgProxyHandle) |
|
919 { |
|
920 MM2GSVGProxy* aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle); |
|
921 |
|
922 TRAP(err, aProxy->SetEnumTraitL( |
|
923 STATIC_CAST(TM2GSvgElementHandle, aElementHandle), |
|
924 STATIC_CAST(TM2GSvgAttrType, aAttributeTypeId), |
|
925 aValue); ); |
|
926 } |
|
927 M2G_DO_UNLOCK(aJni) |
|
928 |
|
929 M2GGeneral::CheckErrorCode(aJni, err); |
|
930 M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGElement ) _setEnumTrait - end"); |
|
931 } |
|
932 // ----------------------------------------------------------------------------- |
|
933 // Java_com_nokia_microedition_m2g_M2GSVGElement::_setFloatTrait |
|
934 // ----------------------------------------------------------------------------- |
|
935 /** |
|
936 * Calls MM2GSVGProxy::SetFloatTraitL method. |
|
937 * @since Series S60 3.0 |
|
938 * @param aProxy Proxy instance. |
|
939 * @param aElementHandle Element pointer. |
|
940 * @param aAttributeTypeId - |
|
941 * @param aValue - |
|
942 */ |
|
943 JNIEXPORT void JNICALL |
|
944 Java_com_nokia_microedition_m2g_M2GSVGElement__1setFloatTrait( |
|
945 JNIEnv* aJni, |
|
946 jclass, |
|
947 jint aSvgProxyHandle, |
|
948 jint aElementHandle, |
|
949 jshort aAttributeTypeId, |
|
950 jfloat aValue) |
|
951 { |
|
952 M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GSVGElement ) _setFloatTrait: %f - begin", aValue); |
|
953 TInt err = KM2GNotOk; |
|
954 |
|
955 M2G_DO_LOCK |
|
956 if (aSvgProxyHandle) |
|
957 { |
|
958 MM2GSVGProxy* aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle); |
|
959 |
|
960 TRAP(err, aProxy->SetFloatTraitL( |
|
961 STATIC_CAST(TM2GSvgElementHandle, aElementHandle), |
|
962 STATIC_CAST(TM2GSvgAttrType, aAttributeTypeId), |
|
963 aValue); ); |
|
964 } |
|
965 M2G_DO_UNLOCK(aJni) |
|
966 |
|
967 M2GGeneral::CheckErrorCode(aJni, err); |
|
968 M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGElement ) _setFloatTrait: - end"); |
|
969 } |
|
970 |
|
971 // ----------------------------------------------------------------------------- |
|
972 // Java_com_nokia_microedition_m2g_M2GSVGElement::_setMatrixTrait |
|
973 // ----------------------------------------------------------------------------- |
|
974 /** |
|
975 * Calls MM2GSVGProxy::SetMatrixTraitL method. |
|
976 * @since Series S60 3.0 |
|
977 * @param aProxy Proxy instance. |
|
978 * @param aElementHandle Element handle |
|
979 * @param aAttributeTypeId Attribute type id |
|
980 * @param aMatrixData - |
|
981 */ |
|
982 JNIEXPORT void JNICALL |
|
983 Java_com_nokia_microedition_m2g_M2GSVGElement__1setMatrixTrait( |
|
984 JNIEnv* aJni, |
|
985 jclass, |
|
986 jint aSvgProxyHandle, |
|
987 jint aElementHandle, |
|
988 jshort aAttributeTypeId, |
|
989 jfloatArray aMatrixComponents) |
|
990 { |
|
991 M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGElement ) _setMatrixTrait - begin"); |
|
992 TInt err = KM2GNotOk; |
|
993 TM2GMatrixData matrix; |
|
994 // Init matrix object |
|
995 jfloat* components = aJni->GetFloatArrayElements(aMatrixComponents,0); |
|
996 TInt count = aJni->GetArrayLength(aMatrixComponents); |
|
997 for (TInt index = 0; index < count; index++) |
|
998 { |
|
999 matrix[ index ] = components[ index ]; |
|
1000 } |
|
1001 // Release data source |
|
1002 aJni->ReleaseFloatArrayElements(aMatrixComponents, components, JNI_ABORT); |
|
1003 |
|
1004 M2G_DO_LOCK |
|
1005 if (aSvgProxyHandle) |
|
1006 { |
|
1007 MM2GSVGProxy* aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle); |
|
1008 |
|
1009 TRAP(err, aProxy->SetMatrixTraitL( |
|
1010 STATIC_CAST(TM2GSvgElementHandle, aElementHandle), |
|
1011 STATIC_CAST(TM2GSvgAttrType, aAttributeTypeId), |
|
1012 matrix); ); |
|
1013 } |
|
1014 M2G_DO_UNLOCK(aJni) |
|
1015 |
|
1016 M2GGeneral::CheckErrorCode(aJni, err); |
|
1017 M2G_DEBUG_6("JNI ( M2GSVGElement ) _setMatrixTrait: %f, %f, %f, %f, %f, %f - end", matrix[ 0 ], matrix[ 1 ], matrix[ 2 ], matrix[ 3 ], matrix[ 4 ], matrix[ 5 ]); |
|
1018 } |
|
1019 // ----------------------------------------------------------------------------- |
|
1020 // Java_com_nokia_microedition_m2g_M2GSVGElement::_setPathTrait |
|
1021 // ----------------------------------------------------------------------------- |
|
1022 /** |
|
1023 * Calls MM2GSVGProxy::SetPathTraitL method. |
|
1024 * @since Series S60 3.0 |
|
1025 * @param aProxy Proxy instance. |
|
1026 * @param aElementHandle Element handle |
|
1027 * @param aAttributeTypeId Attribute type id |
|
1028 * @param aMatrixData - |
|
1029 */ |
|
1030 JNIEXPORT void JNICALL |
|
1031 Java_com_nokia_microedition_m2g_M2GSVGElement__1setPathTrait( |
|
1032 JNIEnv* aJni, |
|
1033 jclass, |
|
1034 jint aSvgProxyHandle, |
|
1035 jint aElementHandle, |
|
1036 jshort aAttributeTypeId, |
|
1037 jint aPathHandle) |
|
1038 { |
|
1039 M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGElement ) _setPathTrait - begin"); |
|
1040 TInt err = KM2GNotOk; |
|
1041 |
|
1042 M2G_DO_LOCK |
|
1043 if (aSvgProxyHandle) |
|
1044 { |
|
1045 MM2GSVGProxy* aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle); |
|
1046 |
|
1047 TRAP(err,aProxy->SetPathTraitL( |
|
1048 STATIC_CAST(TM2GSvgElementHandle, aElementHandle), |
|
1049 STATIC_CAST(TM2GSvgAttrType, aAttributeTypeId), |
|
1050 STATIC_CAST(TM2GSvgPathHandle, aPathHandle)); ); |
|
1051 } |
|
1052 M2G_DO_UNLOCK(aJni) |
|
1053 |
|
1054 M2GGeneral::CheckErrorCode(aJni, err); |
|
1055 M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGElement ) _setPathTrait - end"); |
|
1056 } |
|
1057 // ----------------------------------------------------------------------------- |
|
1058 // Java_com_nokia_microedition_m2g_M2GSVGElement::_setRectTrait |
|
1059 // ----------------------------------------------------------------------------- |
|
1060 /** |
|
1061 * Calls MM2GSVGProxy::SetRectTraitL method. |
|
1062 * @since Series S60 3.0 |
|
1063 * @param aProxy Proxy instance. |
|
1064 * @param aElementHandle Element handle |
|
1065 * @param aAttributeTypeId Attribute type id |
|
1066 * @param aMatrixData - |
|
1067 */ |
|
1068 JNIEXPORT void JNICALL |
|
1069 Java_com_nokia_microedition_m2g_M2GSVGElement__1setRectTrait( |
|
1070 JNIEnv* aJni, |
|
1071 jclass, |
|
1072 jint aSvgProxyHandle, |
|
1073 jint aElementHandle, |
|
1074 jshort aAttributeTypeId, |
|
1075 jfloat aX, jfloat aY, jfloat aWidth, jfloat aHeight) |
|
1076 { |
|
1077 M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGElement ) _setRectTrait - begin"); |
|
1078 TM2GRectData rect; |
|
1079 rect[ 0 ] = aX; |
|
1080 rect[ 1 ] = aY; |
|
1081 rect[ 2 ] = aWidth; |
|
1082 rect[ 3 ] = aHeight; |
|
1083 TInt err = KM2GNotOk; |
|
1084 |
|
1085 M2G_DO_LOCK |
|
1086 if (aSvgProxyHandle) |
|
1087 { |
|
1088 MM2GSVGProxy* aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle); |
|
1089 |
|
1090 TRAP(err, aProxy->SetRectTraitL( |
|
1091 STATIC_CAST(TM2GSvgElementHandle, aElementHandle), |
|
1092 STATIC_CAST(TM2GSvgAttrType, aAttributeTypeId), |
|
1093 rect); ); |
|
1094 } |
|
1095 M2G_DO_UNLOCK(aJni) |
|
1096 |
|
1097 M2GGeneral::CheckErrorCode(aJni, err); |
|
1098 M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGElement ) _getRectTrait - end"); |
|
1099 } |
|
1100 |
|
1101 // ----------------------------------------------------------------------------- |
|
1102 // Java_com_nokia_microedition_m2g_M2GSVGElement::_setStringTrait |
|
1103 // ----------------------------------------------------------------------------- |
|
1104 /** |
|
1105 * Calls MM2GSVGProxy::SetStringTraitL method. |
|
1106 * @since Series S60 3.0 |
|
1107 * @param aElementHandle Element handle |
|
1108 * @param aAttributeTypeId Attribute type id |
|
1109 * @param aString - |
|
1110 */ |
|
1111 JNIEXPORT void JNICALL |
|
1112 Java_com_nokia_microedition_m2g_M2GSVGElement__1setStringTrait( |
|
1113 JNIEnv* aJni, |
|
1114 jclass, |
|
1115 jint aSvgProxyHandle, |
|
1116 jint aElementHandle, |
|
1117 jshort aAttributeTypeId, |
|
1118 jstring aValue) |
|
1119 { |
|
1120 M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGElement ) _setStringTrait - begin"); |
|
1121 RJString str(*aJni, aValue); |
|
1122 TInt err = KM2GNotOk; |
|
1123 |
|
1124 M2G_DO_LOCK |
|
1125 if (aSvgProxyHandle) |
|
1126 { |
|
1127 MM2GSVGProxy* aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle); |
|
1128 TPtrC16 lValue=STATIC_CAST(TPtrC16, str); |
|
1129 |
|
1130 TRAP(err, aProxy->SetStringTraitL( |
|
1131 STATIC_CAST(TM2GSvgElementHandle, aElementHandle), |
|
1132 STATIC_CAST(TM2GSvgAttrType, aAttributeTypeId), |
|
1133 lValue); ); |
|
1134 } |
|
1135 M2G_DO_UNLOCK(aJni) |
|
1136 |
|
1137 M2GGeneral::CheckErrorCode(aJni, err); |
|
1138 M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGElement ) _setStringTrait - end"); |
|
1139 } |
|
1140 |
|
1141 M2G_NS_END |