📄 swfnative.cc
字号:
//// Description:// SWFNative Implementation//// Authors:// Jonathan Shore <jshore@e-shuppan.com>//// Copyright:// Copyright 2001 E-Publishing Group Inc. Permission is granted to use or// modify this code provided that the original copyright notice is included.//// This software is distributed with no warrantee of liability, merchantability,// or fitness for a specific purpose.//#include <SWFNative.h>#include <SWFUtilities.h>#include <SWFFill.h>#include <SWFShape.h>#include <SWFDisplayItem.h>#include <SWFMovie.h>#include <SWFMovieClip.h>#include <SWFMorph.h>#include <SWFFont.h>#include <SWFBitmap.h>#include <SWFText.h>#include <SWFTextField.h>#include <SWFSound.h>#include <SWFGradient.h>#include <SWFButton.h>#include <SWFAction.h>//// SWFFill Methods//JNIEXPORT void JNICALL Java_SWFFill_nDestroy (JNIEnv *, jobject, jint handle){ destroySWFFill ((SWFFill)handle);}JNIEXPORT void JNICALL Java_SWFFill_nSkewX (JNIEnv *, jobject, jint handle, jfloat v){ SWFFill_skewX ((SWFFill)handle, v);}JNIEXPORT void JNICALL Java_SWFFill_nSkewXTo (JNIEnv *, jobject, jint handle, jfloat v){ SWFFill_skewXTo ((SWFFill)handle, v);}JNIEXPORT void JNICALL Java_SWFFill_nSkewY (JNIEnv *, jobject, jint handle, jfloat v){ SWFFill_skewY ((SWFFill)handle, v);}JNIEXPORT void JNICALL Java_SWFFill_nSkewYTo (JNIEnv *, jobject, jint handle, jfloat v){ SWFFill_skewYTo ((SWFFill)handle, v);}JNIEXPORT void JNICALL Java_SWFFill_nScaleX (JNIEnv *, jobject, jint handle, jfloat v){ SWFFill_scaleX ((SWFFill)handle, v);}JNIEXPORT void JNICALL Java_SWFFill_nScaleXTo (JNIEnv *, jobject, jint handle, jfloat v){ SWFFill_scaleXTo ((SWFFill)handle, v);}JNIEXPORT void JNICALL Java_SWFFill_nScaleY (JNIEnv *, jobject, jint handle, jfloat v){ SWFFill_scaleY ((SWFFill)handle, v);}JNIEXPORT void JNICALL Java_SWFFill_nScaleYTo (JNIEnv *, jobject, jint handle, jfloat v){ SWFFill_scaleYTo ((SWFFill)handle, v);}JNIEXPORT void JNICALL Java_SWFFill_nScale (JNIEnv *, jobject, jint handle, jfloat xv, jfloat yv){ SWFFill_scaleXY ((SWFFill)handle, xv, yv);}JNIEXPORT void JNICALL Java_SWFFill_nRotate (JNIEnv *, jobject, jint handle, jfloat v){ SWFFill_rotate ((SWFFill)handle, v);}JNIEXPORT void JNICALL Java_SWFFill_nRotateTo (JNIEnv *, jobject, jint handle, jfloat v){ SWFFill_rotateTo((SWFFill)handle, v);}JNIEXPORT void JNICALL Java_SWFFill_nMove (JNIEnv *, jobject, jint handle, jfloat x, jfloat y){ SWFFill_move ((SWFFill)handle, x,y);}JNIEXPORT void JNICALL Java_SWFFill_nMoveTo (JNIEnv *, jobject, jint handle, jfloat x, jfloat y){ SWFFill_moveTo ((SWFFill)handle, x,y);}//// SWFShape Methods//JNIEXPORT jint JNICALL Java_SWFShape_nNew (JNIEnv *, jobject){ return (jint)newSWFShape();}JNIEXPORT void JNICALL Java_SWFShape_nDestroy (JNIEnv *, jobject, jint handle){ destroySWFShape ((SWFShape)handle);}JNIEXPORT void JNICALL Java_SWFShape_nMovePen (JNIEnv *, jobject, jint handle, jfloat x, jfloat y){ SWFShape_movePen ((SWFShape)handle, x, y);}JNIEXPORT void JNICALL Java_SWFShape_nMovePenTo (JNIEnv *, jobject, jint handle, jfloat x, jfloat y){ SWFShape_movePenTo ((SWFShape)handle, x, y);}JNIEXPORT void JNICALL Java_SWFShape_nDrawLine (JNIEnv *, jobject, jint handle, jfloat x, jfloat y){ SWFShape_drawLine ((SWFShape)handle, x, y);}JNIEXPORT void JNICALL Java_SWFShape_nDrawLineTo (JNIEnv *, jobject, jint handle, jfloat x, jfloat y){ SWFShape_drawLineTo ((SWFShape)handle, x, y);}JNIEXPORT void JNICALL Java_SWFShape_nDrawLineToRelative (JNIEnv *, jobject, jint handle, jfloat dx, jfloat dy){ // might be wrong (no equiv call) SWFShape_drawLineTo ((SWFShape)handle, dx, dy);}JNIEXPORT void JNICALL Java_SWFShape_nDrawCurve (JNIEnv *, jobject, jint handle, jfloat bx, jfloat by, jfloat cx, jfloat cy){ SWFShape_drawCurve ((SWFShape)handle, bx, by, cx, cy);}JNIEXPORT void JNICALL Java_SWFShape_nDrawCurveTo (JNIEnv *, jobject, jint handle, jfloat bx, jfloat by, jfloat cx, jfloat cy){ SWFShape_drawCurveTo ((SWFShape)handle, bx, by, cx, cy);}JNIEXPORT void JNICALL Java_SWFShape_nDrawCubic (JNIEnv *, jobject, jint handle, jfloat bx, jfloat by, jfloat cx, jfloat cy, jfloat dx, jfloat dy){ SWFShape_drawCubic ((SWFShape)handle, bx, by, cx, cy, dx, dy);}JNIEXPORT void JNICALL Java_SWFShape_nDrawCubicTo (JNIEnv *, jobject, jint handle, jfloat bx, jfloat by, jfloat cx, jfloat cy, jfloat dx, jfloat dy){ SWFShape_drawCubicTo ((SWFShape)handle, bx, by, cx, cy, dx, dy);}JNIEXPORT void JNICALL Java_SWFShape_nDrawArc (JNIEnv *, jobject, jint handle, jfloat r, jfloat from, jfloat to){ SWFShape_drawArc ((SWFShape)handle, (int)r, from, to);}JNIEXPORT void JNICALL Java_SWFShape_nDrawCircle (JNIEnv *, jobject, jint handle, jfloat r){ SWFShape_drawCircle ((SWFShape)handle, (int)r);}JNIEXPORT void JNICALL Java_SWFShape_nDrawGlyph (JNIEnv *, jobject, jint handle, jint Hfont, jint c){ SWFShape_drawGlyph ((SWFShape)handle, (SWFFont)Hfont, c);}JNIEXPORT void JNICALL Java_SWFShape_nEnd (JNIEnv *, jobject, jint handle){ SWFShape_end ((SWFShape)handle);}JNIEXPORT void JNICALL Java_SWFShape_nSetLine (JNIEnv *, jobject, jint handle, jshort width, jint r, jint g, jint b, jint alpha){ SWFShape_setLine ((SWFShape)handle, width, r, g, b, alpha);}JNIEXPORT jint JNICALL Java_SWFShape_nAddBitmapFill (JNIEnv *, jobject, jint handle, jint Hbitmap, jshort flags){ return (jint)SWFShape_addBitmapFill ((SWFShape)handle, (SWFBitmap)Hbitmap, flags);}JNIEXPORT jint JNICALL Java_SWFShape_nAddGradientFill (JNIEnv *, jobject, jint handle, jint Hgradient, jshort flags){ return (jint)SWFShape_addGradientFill ((SWFShape)handle, (SWFGradient)Hgradient, flags);}JNIEXPORT jint JNICALL Java_SWFShape_nAddSolidFill (JNIEnv *, jobject, jint handle, jint r, jint g, jint b, jint alpha){ return (jint)SWFShape_addSolidFill ((SWFShape)handle, r,g,b, alpha);}JNIEXPORT void JNICALL Java_SWFShape_nSetLeftFill (JNIEnv *, jobject, jint handle, jint Hfill){ SWFShape_setLeftFill ((SWFShape)handle, (SWFFill)Hfill);}JNIEXPORT void JNICALL Java_SWFShape_nSetRightFill (JNIEnv *, jobject, jint handle, jint Hfill){ SWFShape_setRightFill ((SWFShape)handle, (SWFFill)Hfill);}//// SWFDisplayItem Methods//JNIEXPORT void JNICALL Java_SWFDisplayItem_nDestroy (JNIEnv *, jobject, jint handle){ // do nothing}JNIEXPORT void JNICALL Java_SWFDisplayItem_nRotate (JNIEnv *, jobject, jint handle, jfloat r){ SWFDisplayItem_rotate ((SWFDisplayItem)handle, r);}JNIEXPORT void JNICALL Java_SWFDisplayItem_nRotateTo (JNIEnv *, jobject, jint handle, jfloat r){ SWFDisplayItem_rotateTo ((SWFDisplayItem)handle, r);}JNIEXPORT void JNICALL Java_SWFDisplayItem_nMove (JNIEnv *, jobject, jint handle, jfloat x, jfloat y){ SWFDisplayItem_move ((SWFDisplayItem)handle, x, y);}JNIEXPORT void JNICALL Java_SWFDisplayItem_nMoveTo (JNIEnv *, jobject, jint handle, jfloat x, jfloat y){ SWFDisplayItem_moveTo ((SWFDisplayItem)handle, x, y);}JNIEXPORT void JNICALL Java_SWFDisplayItem_nScale (JNIEnv *, jobject, jint handle, jfloat xs, jfloat ys){ SWFDisplayItem_scale ((SWFDisplayItem)handle, xs, ys);}JNIEXPORT void JNICALL Java_SWFDisplayItem_nScaleTo (JNIEnv *, jobject, jint handle, jfloat xs, jfloat ys){ SWFDisplayItem_scaleTo ((SWFDisplayItem)handle, xs, ys);}JNIEXPORT void JNICALL Java_SWFDisplayItem_nSkewX (JNIEnv *, jobject, jint handle, jfloat s){ SWFDisplayItem_skewX ((SWFDisplayItem)handle, s);}JNIEXPORT void JNICALL Java_SWFDisplayItem_nSkewXTo (JNIEnv *, jobject, jint handle, jfloat s){ SWFDisplayItem_skewXTo ((SWFDisplayItem)handle, s);}JNIEXPORT void JNICALL Java_SWFDisplayItem_nSkewY (JNIEnv *, jobject, jint handle, jfloat s){ SWFDisplayItem_skewY ((SWFDisplayItem)handle, s);}JNIEXPORT void JNICALL Java_SWFDisplayItem_nSkewYTo (JNIEnv *, jobject, jint handle, jfloat s){ SWFDisplayItem_skewYTo ((SWFDisplayItem)handle, s);}JNIEXPORT jint JNICALL Java_SWFDisplayItem_nGetDepth (JNIEnv *, jobject, jint handle){ return (jint)SWFDisplayItem_getDepth ((SWFDisplayItem)handle);}JNIEXPORT void JNICALL Java_SWFDisplayItem_nSetDepth (JNIEnv *, jobject, jint handle, jint depth){ SWFDisplayItem_setDepth ((SWFDisplayItem)handle, depth);}JNIEXPORT void JNICALL Java_SWFDisplayItem_nRemove (JNIEnv *, jobject, jint handle){ SWFDisplayItem_remove ((SWFDisplayItem)handle);}JNIEXPORT void JNICALL Java_SWFDisplayItem_nSetName (JNIEnv* env, jobject, jint handle, jstring name){ const char* sname = env->GetStringUTFChars(name, NULL); SWFDisplayItem_setName ((SWFDisplayItem)handle, sname); env->ReleaseStringUTFChars (name, sname);}JNIEXPORT void JNICALL Java_SWFDisplayItem_nSetRatio (JNIEnv *, jobject, jint handle, jfloat r){ SWFDisplayItem_setRatio ((SWFDisplayItem)handle, r);}JNIEXPORT void JNICALL Java_SWFDisplayItem_nAddColor (JNIEnv *, jobject, jint handle, jint r, jint g, jint b, jint alpha){ SWFDisplayItem_addColor ((SWFDisplayItem)handle, r,g,b, alpha);}JNIEXPORT void JNICALL Java_SWFDisplayItem_nMultColor (JNIEnv *, jobject, jint handle, jfloat r, jfloat g, jfloat b, jfloat alpha){ SWFDisplayItem_multColor ((SWFDisplayItem)handle, r,g,b, alpha);}//// SWFMovie Methods//JNIEXPORT jint JNICALL Java_SWFMovie_nNew (JNIEnv *, jobject){ return (jint)newSWFMovie();}JNIEXPORT void JNICALL Java_SWFMovie_nDestroy (JNIEnv *, jobject, jint handle){ destroySWFMovie ((SWFMovie)handle);}JNIEXPORT void JNICALL Java_SWFMovie_nSetScale (JNIEnv *, jobject, jfloat scale){ Ming_setScale (scale);}JNIEXPORT void JNICALL Java_SWFMovie_nSetCubicThreshold (JNIEnv *, jobject, jint v){ Ming_setCubicThreshold (v);}JNIEXPORT void JNICALL Java_SWFMovie_nSetRate (JNIEnv *, jobject, jint handle, jfloat v){ SWFMovie_setRate ((SWFMovie)handle, v);}JNIEXPORT void JNICALL Java_SWFMovie_nSetDimension (JNIEnv *, jobject, jint handle, jint width, jint height){ SWFMovie_setDimension ((SWFMovie)handle, width, height);}JNIEXPORT void JNICALL Java_SWFMovie_nSetFrames (JNIEnv *, jobject, jint handle, jint n){ SWFMovie_setFrames ((SWFMovie)handle, n);}JNIEXPORT void JNICALL Java_SWFMovie_nSetBackground (JNIEnv *, jobject, jint handle, jint r, jint g, jint b){ SWFMovie_setBackground ((SWFMovie)handle, r,g,b);}JNIEXPORT void JNICALL Java_SWFMovie_nSetSoundStream (JNIEnv *, jobject, jint handle, jint Hsound){ SWFMovie_setSoundStream ((SWFMovie)handle, (SWFSound)Hsound);}JNIEXPORT jint JNICALL Java_SWFMovie_nAdd (JNIEnv *, jobject, jint handle, jint Hobject){ return (jint)SWFMovie_add ((SWFMovie)handle, (SWFBlock)Hobject);}JNIEXPORT void JNICALL Java_SWFMovie_nRemove (JNIEnv *, jobject, jint handle, jint Hobject){ SWFMovie_remove ((SWFMovie)handle, (SWFDisplayItem)Hobject);}JNIEXPORT void JNICALL Java_SWFMovie_nNextFrame (JNIEnv *, jobject, jint handle){ SWFMovie_nextFrame ((SWFMovie)handle);}JNIEXPORT void JNICALL Java_SWFMovie_nLabelFrame (JNIEnv* env, jobject, jint handle, jstring label){ const char* slabel = env->GetStringUTFChars (label, NULL); SWFMovie_labelFrame ((SWFMovie)handle, (char*)slabel); env->ReleaseStringUTFChars (label, slabel);}JNIEXPORT void JNICALL Java_SWFMovie_nSave (JNIEnv* env, jobject, jint handle, jstring filename){ // should add error checking const char* sfilename = env->GetStringUTFChars (filename, NULL); SWFMovie_save ((SWFMovie)handle, (char*)sfilename); env->ReleaseStringUTFChars (filename, sfilename);}JNIEXPORT jbyteArray JNICALL Java_SWFMovie_nOutput (JNIEnv* env, jobject, jint handle){ // get output into stream StringStream mystream; SWFMovie_output ((SWFMovie)handle, StringStream::hook, (void*)&mystream); jbyteArray narray = env->NewByteArray (mystream.length()); env->SetByteArrayRegion (narray, 0, mystream.length(), (jbyte*)mystream.getBytes()); return narray;}//// SWFMovieClip Methods//
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -