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