|
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_M2GSVGAnimationElement.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_M2GSVGAnimationElement::_beginElementAt |
|
46 // ----------------------------------------------------------------------------- |
|
47 /** |
|
48 * Calls MM2GSVGProxy::BeginElementAtL method. |
|
49 * @since Series S60 3.0 |
|
50 * @param aProxy Proxy instance. |
|
51 * @param aDocumentHandle Document handle |
|
52 * @param aElementHandle Element handle |
|
53 * @param aOffset Offset time |
|
54 * @throws Exception if not ok. |
|
55 */ |
|
56 JNIEXPORT void JNICALL |
|
57 Java_com_nokia_microedition_m2g_M2GSVGAnimationElement__1beginElementAt( |
|
58 JNIEnv* aJni, |
|
59 jobject, |
|
60 jint aSvgProxyHandle, |
|
61 jint aDocumentHandle, |
|
62 jint aElementHandle, |
|
63 jfloat aOffset, |
|
64 jfloat aCurrentTime) |
|
65 { |
|
66 M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGAnimationElement ) _beginElementAt - begin"); |
|
67 TInt err = KM2GNotOk; |
|
68 |
|
69 if (aSvgProxyHandle && aDocumentHandle) |
|
70 { |
|
71 MM2GSVGProxy* aProxy = JavaUnhand< MM2GSVGProxy >(aSvgProxyHandle); |
|
72 TInt16 restartAttribute; |
|
73 |
|
74 TRAP(err, aProxy->GetEnumTraitL( |
|
75 STATIC_CAST(TM2GSvgElementHandle, aElementHandle), |
|
76 STATIC_CAST(TM2GSvgAttrType, KM2GRestartAttribute), |
|
77 restartAttribute); |
|
78 ) |
|
79 |
|
80 TInt isActive; |
|
81 TRAP(err, aProxy->IsActiveL(STATIC_CAST(TM2GSvgElementHandle, aElementHandle), isActive); ) |
|
82 |
|
83 if (isActive && (restartAttribute == KM2GRestartWhenNotActive)) |
|
84 { |
|
85 M2G_DEBUG_1("M2G_DEBUG: M2GSVGAnimationElement::DoBeginElementAtL() - active & restart att:%d", restartAttribute); |
|
86 } |
|
87 else if ((aCurrentTime != 0) && (restartAttribute == KM2GRestartNever)) |
|
88 { |
|
89 // Cannot restart even if animation hasn't ended? |
|
90 M2G_DEBUG_1("M2G_DEBUG: M2GSVGAnimationElement::DoBeginElementAtL() - not active & restart att:%d", restartAttribute); |
|
91 } |
|
92 else |
|
93 { |
|
94 M2G_DEBUG_2("M2G_DEBUG: M2GSVGAnimationElement::DoBeginElementAtL() - offset:%f & current:%f", aOffset, aCurrentTime); |
|
95 TRAP(err, aProxy->BeginElementAtL( |
|
96 STATIC_CAST(TM2GSvgDocumentHandle, aDocumentHandle), |
|
97 STATIC_CAST(TM2GSvgElementHandle, aElementHandle), |
|
98 (aOffset+aCurrentTime) ); |
|
99 ) |
|
100 } |
|
101 } |
|
102 M2GGeneral::CheckErrorCode(aJni, err); |
|
103 M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGAnimationElement ) _beginElementAt - end"); |
|
104 |
|
105 } |
|
106 // ----------------------------------------------------------------------------- |
|
107 // Java_com_nokia_microedition_m2g_M2GSVGAnimationElement::_endElementAt |
|
108 // ----------------------------------------------------------------------------- |
|
109 /** |
|
110 * Calls MM2GSVGProxy::EndElementAt method. |
|
111 * @since Series S60 3.0 |
|
112 * @param aProxy Proxy instance. |
|
113 * @param aDocumentHandle Document handle |
|
114 * @param aElementHandle Element handle |
|
115 * @param aOffset Offset time |
|
116 */ |
|
117 JNIEXPORT void JNICALL |
|
118 Java_com_nokia_microedition_m2g_M2GSVGAnimationElement__1endElementAt( |
|
119 JNIEnv* aJni, |
|
120 jobject, |
|
121 jint aSvgProxyHandle, |
|
122 jint aDocumentHandle, |
|
123 jint aElementHandle, |
|
124 jfloat aOffset) |
|
125 { |
|
126 M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGAnimationElement ) _endElementAt - begin"); |
|
127 TInt err = KM2GNotOk; |
|
128 |
|
129 MM2GSVGProxy* aProxy = JavaUnhand< MM2GSVGProxy >(aSvgProxyHandle); |
|
130 |
|
131 TRAP(err, aProxy->EndElementAtL(STATIC_CAST(TM2GSvgDocumentHandle, aDocumentHandle), |
|
132 STATIC_CAST(TM2GSvgElementHandle, aElementHandle), |
|
133 aOffset); |
|
134 ) |
|
135 |
|
136 M2GGeneral::CheckErrorCode(aJni, err); |
|
137 |
|
138 M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGAnimationElement ) _endElementAt - end"); |
|
139 } |
|
140 |
|
141 |
|
142 // ----------------------------------------------------------------------------- |
|
143 // Java_com_nokia_microedition_m2g_M2GSVGAnimationElement::_isActive |
|
144 // ----------------------------------------------------------------------------- |
|
145 /** |
|
146 * Calls MM2GSVGProxy::EndElementAt method. |
|
147 * @since Series S60 3.0 |
|
148 * @param aProxy Proxy instance. |
|
149 * @param aElementHandle Element handle |
|
150 */ |
|
151 JNIEXPORT jboolean JNICALL |
|
152 Java_com_nokia_microedition_m2g_M2GSVGAnimationElement__1isActive( |
|
153 JNIEnv* aJni, |
|
154 jobject, |
|
155 jint aSvgProxyHandle, |
|
156 jint aElementHandle) |
|
157 { |
|
158 M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGAnimationElement ) _isActive - begin"); |
|
159 TInt err = KM2GNotOk; |
|
160 TInt active = 0; |
|
161 MM2GSVGProxy* aProxy = JavaUnhand< MM2GSVGProxy >(aSvgProxyHandle); |
|
162 |
|
163 TRAP(err, aProxy->IsActiveL( |
|
164 STATIC_CAST(TM2GSvgElementHandle, aElementHandle), |
|
165 active); |
|
166 ) |
|
167 |
|
168 M2GGeneral::CheckErrorCode(aJni, err); |
|
169 M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GSVGAnimationElement ) _isActive: %d - end", active); |
|
170 return STATIC_CAST(jboolean, (active == 1 ? ETrue : EFalse)); |
|
171 } |
|
172 |
|
173 M2G_NS_END |
|
174 |
|
175 |