Imported Classpath 0.18.
* sources.am, Makefile.in: Updated. * Makefile.am (nat_source_files): Removed natProxy.cc. * java/lang/reflect/natProxy.cc: Removed. * gnu/classpath/jdwp/VMFrame.java, gnu/classpath/jdwp/VMIdManager.java, gnu/classpath/jdwp/VMVirtualMachine.java, java/lang/reflect/VMProxy.java: New files. 2005-09-23 Thomas Fitzsimmons <fitzsim@redhat.com> * scripts/makemake.tcl (verbose): Add gnu/java/awt/peer/qt to BC list. 2005-09-23 Thomas Fitzsimmons <fitzsim@redhat.com> * gnu/java/net/DefaultContentHandlerFactory.java (getContent): Remove ClasspathToolkit references. 2005-09-23 Thomas Fitzsimmons <fitzsim@redhat.com> * gnu/awt/xlib/XCanvasPeer.java: Add new peer methods. * gnu/awt/xlib/XFramePeer.java: Likewise. * gnu/awt/xlib/XGraphicsConfiguration.java: Likewise. 2005-09-23 Thomas Fitzsimmons <fitzsim@redhat.com> * Makefile.am (libgcjawt_la_SOURCES): Remove jawt.c. Add classpath/native/jawt/jawt.c. * Makefile.in: Regenerate. * jawt.c: Remove file. * include/Makefile.am (tool_include__HEADERS): Remove jawt.h and jawt_md.h. Add ../classpath/include/jawt.h and ../classpath/include/jawt_md.h. * include/Makefile.in: Regenerate. * include/jawt.h: Regenerate. * include/jawt_md.h: Regenerate. From-SVN: r104586
This commit is contained in:
parent
9b044d1951
commit
1ea63ef8be
544 changed files with 34724 additions and 14512 deletions
|
@ -51,7 +51,10 @@ import java.io.File;
|
|||
import java.io.IOException;
|
||||
import java.util.Hashtable;
|
||||
import java.util.Vector;
|
||||
import gnu.classpath.RawData;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.BufferedInputStream;
|
||||
import java.net.URL;
|
||||
import gnu.classpath.Pointer;
|
||||
|
||||
/**
|
||||
* GtkImage - wraps a GdkPixbuf or GdkPixmap.
|
||||
|
@ -87,7 +90,7 @@ public class GtkImage extends Image
|
|||
/**
|
||||
* Pointer to the GdkPixbuf
|
||||
*/
|
||||
RawData pixmap;
|
||||
Pointer pixmap;
|
||||
|
||||
/**
|
||||
* Observer queue.
|
||||
|
@ -129,10 +132,15 @@ public class GtkImage extends Image
|
|||
private native void setPixels(int[] pixels);
|
||||
|
||||
/**
|
||||
* Loads an image using gdk-pixbuf.
|
||||
* Loads an image using gdk-pixbuf from a file.
|
||||
*/
|
||||
private native boolean loadPixbuf(String name);
|
||||
|
||||
/**
|
||||
* Loads an image using gdk-pixbuf from data.
|
||||
*/
|
||||
private native boolean loadImageFromData(byte[] data);
|
||||
|
||||
/**
|
||||
* Allocates a Gtk Pixbuf or pixmap
|
||||
*/
|
||||
|
@ -186,6 +194,21 @@ public class GtkImage extends Image
|
|||
offScreen = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a blank GtkImage. This is called when
|
||||
* GtkToolkit.createImage (String) is called with an empty string
|
||||
* argument (""). A blank image is loaded immediately upon
|
||||
* construction and has width -1 and height -1.
|
||||
*/
|
||||
public GtkImage ()
|
||||
{
|
||||
isLoaded = true;
|
||||
observers = null;
|
||||
offScreen = false;
|
||||
props = new Hashtable();
|
||||
errorLoading = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a GtkImage by loading a given file.
|
||||
*
|
||||
|
@ -210,6 +233,58 @@ public class GtkImage extends Image
|
|||
props = new Hashtable();
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a GtkImage from a byte array of an image file.
|
||||
*
|
||||
* @throws IllegalArgumentException if the image could not be
|
||||
* loaded.
|
||||
*/
|
||||
public GtkImage (byte[] data)
|
||||
{
|
||||
if (loadImageFromData (data) != true)
|
||||
throw new IllegalArgumentException ("Couldn't load image.");
|
||||
|
||||
isLoaded = true;
|
||||
observers = null;
|
||||
offScreen = false;
|
||||
props = new Hashtable();
|
||||
errorLoading = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a GtkImage from a URL. May result in an error image.
|
||||
*/
|
||||
public GtkImage (URL url)
|
||||
{
|
||||
isLoaded = false;
|
||||
observers = new Vector();
|
||||
errorLoading = false;
|
||||
if( url == null)
|
||||
return;
|
||||
ByteArrayOutputStream baos = new ByteArrayOutputStream (5000);
|
||||
try
|
||||
{
|
||||
BufferedInputStream bis = new BufferedInputStream (url.openStream());
|
||||
|
||||
byte[] buf = new byte[5000];
|
||||
int n = 0;
|
||||
|
||||
while ((n = bis.read(buf)) != -1)
|
||||
baos.write(buf, 0, n);
|
||||
bis.close();
|
||||
}
|
||||
catch(IOException e)
|
||||
{
|
||||
throw new IllegalArgumentException ("Couldn't load image.");
|
||||
}
|
||||
if (loadImageFromData (baos.toByteArray()) != true)
|
||||
throw new IllegalArgumentException ("Couldn't load image.");
|
||||
|
||||
isLoaded = true;
|
||||
observers = null;
|
||||
props = new Hashtable();
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs an empty GtkImage.
|
||||
*/
|
||||
|
@ -240,6 +315,25 @@ public class GtkImage extends Image
|
|||
createScaledPixmap(src, hints);
|
||||
}
|
||||
|
||||
/**
|
||||
* Package private constructor to create a GtkImage from a given
|
||||
* PixBuf pointer.
|
||||
*/
|
||||
GtkImage (Pointer pixbuf)
|
||||
{
|
||||
pixmap = pixbuf;
|
||||
createFromPixbuf();
|
||||
isLoaded = true;
|
||||
observers = null;
|
||||
offScreen = false;
|
||||
props = new Hashtable();
|
||||
}
|
||||
|
||||
/**
|
||||
* Native helper function for constructor that takes a pixbuf Pointer.
|
||||
*/
|
||||
private native void createFromPixbuf();
|
||||
|
||||
/**
|
||||
* Callback from the image consumer.
|
||||
*/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue