|
1 /* |
|
2 * Copyright (c) 2009 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: |
|
15 * |
|
16 */ |
|
17 #include "javax_microedition_m3g_Node.h" |
|
18 |
|
19 JNIEXPORT jboolean JNICALL Java_javax_microedition_m3g_Node__1isEnabled |
|
20 (JNIEnv* aEnv, jclass, jint aHandle, jint aWhich) |
|
21 { |
|
22 M3G_DO_LOCK |
|
23 jboolean enabled = (jboolean)m3gIsEnabled((M3GNode)aHandle, aWhich); |
|
24 M3G_DO_UNLOCK(aEnv) |
|
25 return enabled; |
|
26 } |
|
27 |
|
28 JNIEXPORT jfloat JNICALL Java_javax_microedition_m3g_Node__1getAlphaFactor |
|
29 (JNIEnv* aEnv, jclass, jint aHandle) |
|
30 { |
|
31 M3G_DO_LOCK |
|
32 jfloat alpha = (jfloat)m3gGetAlphaFactor((M3GNode)aHandle); |
|
33 M3G_DO_UNLOCK(aEnv) |
|
34 return alpha; |
|
35 } |
|
36 |
|
37 JNIEXPORT jint JNICALL Java_javax_microedition_m3g_Node__1getParent |
|
38 (JNIEnv* aEnv, jclass, jint aHandle) |
|
39 { |
|
40 M3G_DO_LOCK |
|
41 jint parent = (M3Guint)m3gGetParent((M3GNode)aHandle); |
|
42 M3G_DO_UNLOCK(aEnv) |
|
43 return parent; |
|
44 } |
|
45 |
|
46 JNIEXPORT void JNICALL Java_javax_microedition_m3g_Node__1setScope |
|
47 (JNIEnv* aEnv, jclass, jint aHandle, jint aId) |
|
48 { |
|
49 M3G_DO_LOCK |
|
50 m3gSetScope((M3GNode)aHandle, aId); |
|
51 M3G_DO_UNLOCK(aEnv) |
|
52 } |
|
53 |
|
54 JNIEXPORT jint JNICALL Java_javax_microedition_m3g_Node__1getScope |
|
55 (JNIEnv* aEnv, jclass, jint aHandle) |
|
56 { |
|
57 M3G_DO_LOCK |
|
58 jint scope = (jint)m3gGetScope((M3GNode)aHandle); |
|
59 M3G_DO_UNLOCK(aEnv) |
|
60 return scope; |
|
61 } |
|
62 |
|
63 JNIEXPORT jboolean JNICALL Java_javax_microedition_m3g_Node__1getTransformTo |
|
64 (JNIEnv* aEnv, jclass, jint aHandle, jint aHTarget, jbyteArray aDstArray) |
|
65 { |
|
66 jboolean ret = 0; |
|
67 if (aDstArray != NULL && aHTarget != 0) |
|
68 { |
|
69 jbyte* dstArray = aEnv->GetByteArrayElements(aDstArray, NULL); |
|
70 if (dstArray == NULL) |
|
71 { |
|
72 M3G_RAISE_EXCEPTION(aEnv, "java/lang/OutOfMemoryError"); |
|
73 return 0; |
|
74 } |
|
75 |
|
76 M3G_DO_LOCK |
|
77 ret = m3gGetTransformTo((M3GNode)aHandle, (M3GNode)aHTarget, (M3GMatrix *)dstArray); |
|
78 M3G_DO_UNLOCK(aEnv) |
|
79 |
|
80 aEnv->ReleaseByteArrayElements(aDstArray, dstArray, 0); |
|
81 } |
|
82 else |
|
83 { |
|
84 M3G_RAISE_EXCEPTION(aEnv, "java/lang/NullPointerException"); |
|
85 } |
|
86 |
|
87 return ret; |
|
88 } |
|
89 |
|
90 JNIEXPORT void JNICALL Java_javax_microedition_m3g_Node__1align |
|
91 (JNIEnv* aEnv, jclass, jint aHNode, jint aHRef) |
|
92 { |
|
93 M3G_BEGIN_PROFILE(M3G_PROFILE_ALIGN); |
|
94 M3G_DO_LOCK |
|
95 m3gAlignNode((M3GNode)aHNode, (M3GNode)aHRef); |
|
96 M3G_DO_UNLOCK(aEnv) |
|
97 M3G_END_PROFILE(M3G_PROFILE_ALIGN); |
|
98 } |
|
99 |
|
100 JNIEXPORT void JNICALL Java_javax_microedition_m3g_Node__1setAlphaFactor |
|
101 (JNIEnv* aEnv, jclass, jint aHandle, jfloat aAlphaFactor) |
|
102 { |
|
103 M3G_DO_LOCK |
|
104 m3gSetAlphaFactor((M3GNode)aHandle, aAlphaFactor); |
|
105 M3G_DO_UNLOCK(aEnv) |
|
106 } |
|
107 |
|
108 JNIEXPORT void JNICALL Java_javax_microedition_m3g_Node__1enable |
|
109 (JNIEnv* aEnv, jclass, jint aHandle, jint aWhich, jboolean aEnabled) |
|
110 { |
|
111 M3G_DO_LOCK |
|
112 m3gEnable((M3GNode)aHandle, aWhich, (jint)aEnabled); |
|
113 M3G_DO_UNLOCK(aEnv) |
|
114 } |
|
115 |
|
116 JNIEXPORT void JNICALL Java_javax_microedition_m3g_Node__1setAlignment |
|
117 (JNIEnv* aEnv, jclass, jint aHandle, jint aHZReference, jint aZTarget, jint aHYReference, jint aYTarget) |
|
118 { |
|
119 M3G_DO_LOCK |
|
120 m3gSetAlignment((M3GNode)aHandle, (M3GNode)aHZReference, aZTarget, (M3GNode)aHYReference, aYTarget); |
|
121 M3G_DO_UNLOCK(aEnv) |
|
122 } |
|
123 |
|
124 JNIEXPORT jint JNICALL Java_javax_microedition_m3g_Node__1getZRef |
|
125 (JNIEnv* aEnv, jclass, jint aHandle) |
|
126 { |
|
127 M3G_DO_LOCK |
|
128 jint zRef = (M3Guint)m3gGetZRef((M3GNode)aHandle); |
|
129 M3G_DO_UNLOCK(aEnv) |
|
130 return zRef; |
|
131 } |
|
132 |
|
133 JNIEXPORT jint JNICALL Java_javax_microedition_m3g_Node__1getYRef |
|
134 (JNIEnv* aEnv, jclass, jint aHandle) |
|
135 { |
|
136 M3G_DO_LOCK |
|
137 jint yRef = (M3Guint)m3gGetYRef((M3GNode)aHandle); |
|
138 M3G_DO_UNLOCK(aEnv) |
|
139 return yRef; |
|
140 } |
|
141 |
|
142 JNIEXPORT jint JNICALL Java_javax_microedition_m3g_Node__1getSubtreeSize |
|
143 (JNIEnv* aEnv, jclass, jint aHandle) |
|
144 { |
|
145 M3G_DO_LOCK |
|
146 jint size = (M3Guint)m3gGetSubtreeSize((M3GNode)aHandle); |
|
147 M3G_DO_UNLOCK(aEnv) |
|
148 return size; |
|
149 } |
|
150 |
|
151 /* M3G 1.1 JNI Calls */ |
|
152 |
|
153 JNIEXPORT jint JNICALL Java_javax_microedition_m3g_Node__1getAlignmentTarget |
|
154 (JNIEnv* aEnv, jclass, jint aHandle, jint aAxis) |
|
155 { |
|
156 M3G_DO_LOCK |
|
157 jint target = (jint)m3gGetAlignmentTarget((M3GNode)aHandle, aAxis); |
|
158 M3G_DO_UNLOCK(aEnv) |
|
159 return target; |
|
160 } |