📄 m3gkeyframesequence.c
字号:
/*******************************************************************************
* Modification Notice:
* --------------------------
* This software is modified by MediaTek Inc. and the information contained
* herein is confidential. The software may not be copied and the information
* contained herein may not be used or disclosed except with the written
* permission of MediaTek Inc. (C) 2001
*
*******************************************************************************/
/*****************************************************************************
*
* Filename:
* ---------
* KeyframeSequence.c
*
* Project:
* --------
* Maui_Software
*
* Description:
* ------------
*
*
* Author:
* -------
* -------
*
*============================================================================
* HISTORY
* Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
*------------------------------------------------------------------------------
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*------------------------------------------------------------------------------
* Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
*============================================================================
****************************************************************************/
/*************************************************************************
* Include Header Files
*************************************************************************/
#include "m3g.h"
#ifdef SUPPORT_JSR_184
/*************************************************************************
* Function Definition
*************************************************************************/
KNIEXPORT KNI_RETURNTYPE_INT
Java_javax_microedition_m3g_KeyframeSequence_create()
{
jint keyframes = KNI_GetParameterAsInt(1);
jint components = KNI_GetParameterAsInt(2);
jint interpolation = KNI_GetParameterAsInt(3);
st_m3g_keyframesequence* handle = NULL;
if(keyframes<1 || components<1 || interpolation < M3G_KEYFRAMESEQUENCE_LINEAR ||
interpolation > M3G_KEYFRAMESEQUENCE_STEP) {
KNI_ThrowNew("java/lang/IllegalArgumentException", "invalid keyframe");
} else {
if(components>M3G_KEYFRAMESEQUENCE_MAXCOMP||
(interpolation == M3G_KEYFRAMESEQUENCE_SLERP || interpolation == M3G_KEYFRAMESEQUENCE_SQUAD) && components!=4) {
KNI_ThrowNew("java/lang/IllegalArgumentException", "invalid frame components");
} else {
ENTER_M3D_CS;
handle = M3G_KeyFrameSequence_new(keyframes, components, interpolation);
LEAVE_M3D_CS;
if (handle == NULL) KNI_ThrowNew("java/lang/NullPointerException", "null keyframe");
}
}
KNI_ReturnInt((jint)handle);
}
KNIEXPORT KNI_RETURNTYPE_INT
Java_javax_microedition_m3g_KeyframeSequence_getDurationImpl()
{
st_m3g_keyframesequence* handle = (st_m3g_keyframesequence*)KNI_GetParameterAsInt(1);
//KNI_ReturnInt((jint)handle->duration);
KNI_ReturnInt((jint)M3G_KeyFrameSequence_getDuration(handle));
}
KNIEXPORT KNI_RETURNTYPE_INT
Java_javax_microedition_m3g_KeyframeSequence_getRepeatModeImpl()
{
st_m3g_keyframesequence* handle = (st_m3g_keyframesequence*)KNI_GetParameterAsInt(1);
//KNI_ReturnInt((jint)handle->repeat_mode);
KNI_ReturnInt((jint)M3G_KeyFrameSequence_getRepeatMode(handle));
}
KNIEXPORT KNI_RETURNTYPE_VOID
Java_javax_microedition_m3g_KeyframeSequence_setDurationImpl()
{
st_m3g_keyframesequence* handle = (st_m3g_keyframesequence*)KNI_GetParameterAsInt(1);
jint duration = KNI_GetParameterAsInt(2);
kal_trace(TRACE_GROUP_6, FUNC_J2ME_M3G_SETDURATION, handle, duration);
if (duration <=0 ) KNI_ThrowNew("java/lang/IllegalArgumentException", "invalid duraton");
handle->duration = duration;
KNI_ReturnVoid();
}
KNIEXPORT KNI_RETURNTYPE_VOID
Java_javax_microedition_m3g_KeyframeSequence_setKeyframeImpl()
{
st_m3g_keyframesequence* handle = (st_m3g_keyframesequence*)KNI_GetParameterAsInt(1);
jint index = KNI_GetParameterAsInt(2);
jint time = KNI_GetParameterAsInt(3);
int len = 0;
KNI_StartHandles(1);
KNI_DeclareHandle(object_handle);
KNI_GetParameterAsObject(4, object_handle);
if (*object_handle == NULL) {
KNI_ThrowNew("java/lang/NullPointerException", "null keyframevalue");
} else {
len = KNI_GetArrayLength(object_handle);
if (index < 0 || index >= handle->keyframe_count) {
KNI_ThrowNew("java/lang/IndexOutOfBoundsException", "invalid keyframe index");
} else if (len < handle->component_count || time < 0) {
KNI_ThrowNew("java/lang/IllegalArgumentException", "invalid comps or time");
} else {
#if FAST_KNI && defined(CLDCHI)
jfloat_array* array = (jfloat_array*)*object_handle;
if (M3G_KeyFrameSequence_setKeyFrame(handle, index, time, array->elements) != M3G_SUCCESS) {
KNI_ThrowNew("java/lang/IllegalArgumentException", "invalid keyframes");
}
#else
ASSERT(0);
#endif /* FAST_KNI */
}
}
KNI_EndHandles();
KNI_ReturnVoid();
}
KNIEXPORT KNI_RETURNTYPE_VOID
Java_javax_microedition_m3g_KeyframeSequence_setRepeatModeImpl()
{
st_m3g_keyframesequence* handle = (st_m3g_keyframesequence*)KNI_GetParameterAsInt(1);
jint repeat_mode = KNI_GetParameterAsInt(2);
kal_trace(TRACE_GROUP_6, FUNC_J2ME_M3G_SETPREPEATMODE, handle, repeat_mode);
if (repeat_mode != M3G_KEYFRAMESEQUENCE_CONSTANT && repeat_mode != M3G_KEYFRAMESEQUENCE_LOOP) {
KNI_ThrowNew("java/lang/IllegalArgumentException", "invalid repeatmode");
} else {
if (M3G_KeyFrameSequence_setRepeatMode(handle, (kal_uint8)repeat_mode) != M3G_SUCCESS) {
KNI_ThrowNew("java/lang/IllegalArgumentException", "invalid repeatmode");
}
}
KNI_ReturnVoid();
}
KNIEXPORT KNI_RETURNTYPE_VOID
Java_javax_microedition_m3g_KeyframeSequence_setValidRangeImpl()
{
st_m3g_keyframesequence* handle = (st_m3g_keyframesequence*)KNI_GetParameterAsInt(1);
jint first = KNI_GetParameterAsInt(2);
jint last = KNI_GetParameterAsInt(3);
kal_trace(TRACE_GROUP_6, FUNC_J2ME_M3G_SETVALIDRANGE, handle, first, last);
if (first<0 || first >= handle->keyframe_count || last<0 || last>=handle->keyframe_count) {
KNI_ThrowNew("java/lang/IndexOutOfBoundsException", "invalid validrange");
} else {
if (M3G_KeyFrameSequence_setValidRange(handle, first, last) != M3G_SUCCESS) {
KNI_ThrowNew("java/lang/IndexOutOfBoundsException", "invalid validrange");
}
}
KNI_ReturnVoid();
}
KNIEXPORT KNI_RETURNTYPE_INT
Java_javax_microedition_m3g_KeyframeSequence_getComponentCountImpl()
{
st_m3g_keyframesequence* handle = (st_m3g_keyframesequence*)KNI_GetParameterAsInt(1);
//KNI_ReturnInt(handle->component_count);
KNI_ReturnInt(M3G_KeyFrameSequence_getComponentCount(handle));
}
KNIEXPORT KNI_RETURNTYPE_INT
Java_javax_microedition_m3g_KeyframeSequence_getKeyframeCountImpl()
{
st_m3g_keyframesequence* handle = (st_m3g_keyframesequence*)KNI_GetParameterAsInt(1);
//KNI_ReturnInt(handle->keyframe_count);
KNI_ReturnInt(M3G_KeyFrameSequence_getKeyframeCount(handle));
}
KNIEXPORT KNI_RETURNTYPE_INT
Java_javax_microedition_m3g_KeyframeSequence_getInterpolationTypeImpl()
{
st_m3g_keyframesequence* handle = (st_m3g_keyframesequence*)KNI_GetParameterAsInt(1);
//KNI_ReturnInt(handle->interpolation);
KNI_ReturnInt(M3G_KeyFrameSequence_getInterpolationType(handle));
}
KNIEXPORT KNI_RETURNTYPE_INT
Java_javax_microedition_m3g_KeyframeSequence_getKeyframeImpl()
{
st_m3g_keyframesequence* handle = (st_m3g_keyframesequence*)KNI_GetParameterAsInt(1);
jint index = KNI_GetParameterAsInt(2);
jint time = 0;
KNI_StartHandles(1);
KNI_DeclareHandle(value_handle);
KNI_GetParameterAsObject(3, value_handle);
if(*value_handle) {
kal_int32 len = KNI_GetArrayLength(value_handle);
if(len < handle->component_count) {
KNI_ThrowNew("java/lang/IllegalArgumentException", "invalid comps or time");
goto _return;
}
}
if(index < 0 || index >= handle->keyframe_count) {
KNI_ThrowNew("java/lang/IndexOutOfBoundsException", "invalid keyframe index");
} else {
#if FAST_KNI & defined(CLDCHI)
if(*value_handle) {
jfloat_array* value = (jfloat_array*)*value_handle;
ENTER_M3D_CS;
time = M3D_KeyFrameSequence_getKeyframe(handle,index,value->elements);
LEAVE_M3D_CS;
}
else
{
time = M3D_KeyFrameSequence_getKeyframe(handle,index,NULL);
}
#else
ASSERT(0);
#endif /* FAST_KNI */
}
_return:
KNI_EndHandles();
KNI_ReturnInt(time);
}
KNIEXPORT KNI_RETURNTYPE_INT
Java_javax_microedition_m3g_KeyframeSequence_getValidRangeFirstImpl()
{
st_m3g_keyframesequence* handle = (st_m3g_keyframesequence*)KNI_GetParameterAsInt(1);
//KNI_ReturnInt((jint)handle->validrange_first);
KNI_ReturnInt((jint)M3G_KeyFrameSequence_getValidRangeFirst(handle));
}
KNIEXPORT KNI_RETURNTYPE_INT
Java_javax_microedition_m3g_KeyframeSequence_getValidRangeLastImpl()
{
st_m3g_keyframesequence* handle = (st_m3g_keyframesequence*)KNI_GetParameterAsInt(1);
//KNI_ReturnInt((jint)handle->validrange_last);
KNI_ReturnInt((jint)M3G_KeyFrameSequence_getValidRangeLast(handle));
}
#endif /* #ifdef SUPPORT_JSR_184 */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -