1 // 2 // Description: 3 // SWFDisplayItem Class 4 // 5 // Authors: 6 // Jonathan Shore <jshore@e-shuppan.com> 7 // Based on php wrapper developed by <dave@opaque.net> 8 // 9 // Copyright: 10 // Copyright 2001 E-Publishing Group Inc. Permission is granted to use or 11 // modify this code provided that the original copyright notice is included. 12 // 13 // This software is distributed with no warranty of liability, merchantability, 14 // or fitness for a specific purpose. 15 // 16 17 18 19 20 21 22 23 // 24 // SWFDisplayItem Class 25 // item/symbol in movie which can be manipulated 26 // 27 // Notes 28 // - one manipulates these items to set the scene and then writes 29 // the frame. This is how animation is accomplished 30 // 31 // - the user doesn't instantiate this object, it is rather generated 32 // by other interfaces. Hence the constructor will be private 33 // 34 public class SWFDisplayItem extends SWFObject implements SWFDisplayItemI { 35 SWFDisplayItem(int handle)36 public SWFDisplayItem (int handle) 37 throws SWFException 38 { 39 super (handle); 40 } 41 rotate(float degrees)42 public void rotate (float degrees) 43 { nRotate (handle, degrees); } rotateTo(float degrees)44 public void rotateTo (float degrees) 45 { nRotateTo (handle, degrees); } 46 move(float x, float y)47 public void move (float x, float y) 48 { nMove (handle, x, y); } moveTo(float x, float y)49 public void moveTo (float x, float y) 50 { nMoveTo (handle, x, y); } 51 scale(float scale)52 public void scale (float scale) 53 { nScale (handle, scale, scale); } scale(float xscale, float yscale)54 public void scale (float xscale, float yscale) 55 { nScale (handle, xscale, yscale); } scaleTo(float scale)56 public void scaleTo (float scale) 57 { nScaleTo (handle, scale, scale); } scaleTo(float xscale, float yscale)58 public void scaleTo (float xscale, float yscale) 59 { nScaleTo (handle, xscale, yscale); } 60 skewX(float scew)61 public void skewX (float scew) 62 { nSkewX (handle, scew); } skewXTo(float scew)63 public void skewXTo (float scew) 64 { nSkewXTo (handle, scew); } skewY(float scew)65 public void skewY (float scew) 66 { nSkewY (handle, scew); } skewYTo(float scew)67 public void skewYTo (float scew) 68 { nSkewYTo (handle, scew); } 69 getDepth()70 public int getDepth () 71 { return nGetDepth (handle); } setDepth(int depth)72 public void setDepth (int depth) 73 { nSetDepth (handle, depth); } 74 remove()75 public void remove () 76 { nRemove (handle); } 77 setName(String name)78 public void setName (String name) 79 { nSetName (handle, name); } setRatio(float ratio)80 public void setRatio (float ratio) 81 { nSetRatio (handle, ratio); } 82 addColor(int r, int g, int b, int alpha)83 public void addColor (int r, int g, int b, int alpha) 84 { nAddColor (handle, r,g,b, alpha); } addColor(int r, int g, int b)85 public void addColor (int r, int g, int b) 86 { nAddColor (handle, r,g,b, 0); } multColor(float r, float g, float b, float alpha)87 public void multColor (float r, float g, float b, float alpha) 88 { nMultColor (handle, r,g,b, alpha); } multColor(float r, float g, float b)89 public void multColor (float r, float g, float b) 90 { nMultColor (handle, r,g,b, 1f); } 91 92 setAlpha(int alpha)93 public void setAlpha (int alpha) 94 { multColor (1f,1f,1f,0f); addColor(0,0,0,alpha); } setColor(int r, int g, int b)95 public void setColor (int r, int g, int b) 96 { multColor (0f,0f,0f,1f); addColor(r,g,b); } 97 98 finalize()99 protected void finalize() 100 throws Throwable 101 { 102 nDestroy (handle); 103 super.finalize(); 104 } 105 106 107 // native methods 108 nDestroy(int handle)109 protected native void nDestroy (int handle); nRotate(int handle, float degrees)110 protected native void nRotate (int handle, float degrees); nRotateTo(int handle, float degrees)111 protected native void nRotateTo (int handle, float degrees); 112 nMove(int handle, float x, float y)113 protected native void nMove (int handle, float x, float y); nMoveTo(int handle, float x, float y)114 protected native void nMoveTo (int handle, float x, float y); 115 nScale(int handle, float xscale, float yscale)116 protected native void nScale (int handle, float xscale, float yscale); nScaleTo(int handle, float xscale, float yscale)117 protected native void nScaleTo (int handle, float xscale, float yscale); 118 nSkewX(int handle, float scew)119 protected native void nSkewX (int handle, float scew); nSkewXTo(int handle, float scew)120 protected native void nSkewXTo (int handle, float scew); nSkewY(int handle, float scew)121 protected native void nSkewY (int handle, float scew); nSkewYTo(int handle, float scew)122 protected native void nSkewYTo (int handle, float scew); 123 nGetDepth(int handle)124 protected native int nGetDepth (int handle); nSetDepth(int handle, int depth)125 protected native void nSetDepth (int handle, int depth); 126 nRemove(int handle)127 protected native void nRemove (int handle); 128 nSetName(int handle, String name)129 protected native void nSetName (int handle, String name); nSetRatio(int handle, float ratio)130 protected native void nSetRatio (int handle, float ratio); 131 nAddColor(int handle, int r, int g, int b, int alpha)132 protected native void nAddColor (int handle, int r, int g, int b, int alpha); nMultColor(int handle, float r, float g, float b, float alpha)133 protected native void nMultColor (int handle, float r, float g, float b, float alpha); 134 135 }; 136 137 138 139 140