org.gnu.gdk
public class PixbufLoader extends GObject
To use PixbufLoader to load an image, just create a new one, and call {@link #write(byte[])}, {@link #write(byte[],int)}, or {@link #write(InputStream)} to send the data to it. When done, {@link #close} should be called to end the stream and finalize everything. The created {@link Pixbuf} can be retireved using the {@link #getPixbuf} method.
See Also: Pixbuf PixbufAnimation
Constructor Summary | |
---|---|
PixbufLoader()
Construct a new PixbufLoader that automatically detects the
type of image based on the data. | |
PixbufLoader(String imageType)
Construct a new PixbufLoader that parses the image data as if
it were an image of imageType.
|
Method Summary | |
---|---|
boolean | close()
Informs a loader that no further writes will occur, so that it can free
its internal loading structures. |
Pixbuf | getPixbuf()
Get the {@link Pixbuf} object that is currently being created. |
PixbufAnimation | getPixbufAnimation()
Get the {@link PixbufAnimation} object that is currently being
created. |
boolean | write(byte[] buffer)
Parse the images bytes from the given buffer.
|
boolean | write(byte[] buffer, int len)
Parse len image bytes from buffer.
|
boolean | write(InputStream stream)
Parse the data for the image from the given stream. |
Parameters: imageType Name of the image format to be loaded with the image.
Returns: true if the data was loaded successfully, false if an error occured.
Returns: true if the data was loaded successfully, false if an error occured.
This method does not make any attempt to efficiently read the data from the given stream. Calling applications should wrap their InputStreams in efficient implementations (such as Buffered* implementations) if necessary before calling this method.
Parameters: stream A stream containing the data to load.
Returns: true if the data was loaded successfully, false if an error occured.