1 //
2 // Description:
3 //    SWFBitmap 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 import java.io.ByteArrayOutputStream;
20 import java.io.IOException;
21 
22 
23 
24 
25 
26 //
27 //  SWFBitmap Class
28 //	bitmap in jpg or dbl format
29 //
30 //  Notes
31 //    -	should make this work with PNG transparently
32 //
33 public class SWFBitmap extends SWFObject implements SWFBitmapI {
34 
SWFBitmap(String filename)35     public SWFBitmap (String filename)
36 	throws SWFException
37     {
38 	if (filename.endsWith (".dbl") || filename.endsWith (".DBL"))
39 	    setHandle (nNewDblBitmap (filename));
40 	else
41 	    setHandle (nNewJpegBitmap (filename));
42     }
43 
44 
SWFBitmap(String filename, String alphamask)45     public SWFBitmap (String filename, String alphamask)
46 	throws SWFException
47     {
48 	setHandle (nNewJpegWithAlpha (filename, alphamask));
49     }
50 
51 
finalize()52     protected void finalize()
53 	throws Throwable
54     {
55 	// nDestroy (handle);
56 	super.finalize();
57     }
58 
59 
getWidth()60     public int getWidth ()
61 	{ return nGetWidth (handle); }
getHeight()62     public int getHeight ()
63 	{ return nGetHeight (handle); }
64 
65 
66     // native methods
67 
nNewDblBitmap(String filename)68     protected native int	nNewDblBitmap (String filename);
nNewJpegBitmap(String filename)69     protected native int	nNewJpegBitmap (String filename);
nNewDataBitmap(byte[] data)70     protected native int	nNewDataBitmap (byte[] data);
nNewJpegWithAlpha(String filename, String alpha)71     protected native int	nNewJpegWithAlpha (String filename, String alpha);
nDestroy(int handle)72     protected native void	nDestroy (int handle);
73 
nGetWidth(int handle)74     protected native int	nGetWidth (int handle);
nGetHeight(int handle)75     protected native int	nGetHeight (int handle);
76 
77 };
78 
79 
80 
81