java-gnome version 4.0.7

org.gnome.gdk
Class Pixbuf

java.lang.Object
  extended by org.freedesktop.bindings.Proxy
      extended by org.gnome.glib.Object
          extended by org.gnome.gdk.Pixbuf

public class Pixbuf
extends Object

An image in memory.

Image data in a Pixbuf is stored in memory in uncompressed, packed format. Rows in the image are stored top to bottom, and in each row pixels are stored from left to right. There may be padding at the end of a row. The "rowstride" value of a pixbuf, as returned by getRowstride(), indicates the number of bytes between rows.

Since:
4.0.0
Author:
Andrew Cowie

Constructor Summary
Pixbuf(java.lang.String filename)
          Construct a new Pixbuf object from the image found in filename.
Pixbuf(java.lang.String filename, int width, int height, boolean preserveAspectRatio)
          Construct a new Pixbuf object by loading an image from a given filename, but scaling it.
 
Method Summary
 void save(java.lang.String filename, PixbufFormat type)
          Write this Pixbuf to a file.
 
Methods inherited from class org.freedesktop.bindings.Proxy
toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Pixbuf

public Pixbuf(java.lang.String filename)
       throws java.io.FileNotFoundException
Construct a new Pixbuf object from the image found in filename.

Throws:
java.io.FileNotFoundException
Since:
4.0.5

Pixbuf

public Pixbuf(java.lang.String filename,
              int width,
              int height,
              boolean preserveAspectRatio)
       throws java.io.FileNotFoundException
Construct a new Pixbuf object by loading an image from a given filename, but scaling it. The image will be scaled to fit the supplied width and height, preserving the aspect ratio or not based on the value of the fourth parameter.

If preserving the aspect ratio,

When not preserving aspect ratio,

Throws:
java.io.FileNotFoundException
Since:
4.0.5
Method Detail

save

public void save(java.lang.String filename,
                 PixbufFormat type)
Write this Pixbuf to a file.

The various file formats that GDK is actually capable of writing to are specified by the constants on PixbufFormat. For example, you can save a screenshot as a PNG using:

 Pixbuf p;
 ...
 
 p.save("Screenshot.png", PixbufFormat.PNG);
 

Since:
4.0.5


java-gnome