org.gnu.gdk
public class Pixbuf extends GObject
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.
Constructor Summary | |
---|---|
Pixbuf(Handle handle)
Constructs a Pixbuf from a handle to native resources. | |
Pixbuf(String filename)
Construct a new Pixbuf from an image file.
| |
Pixbuf(String filename, int width, int height, boolean preserveAspect)
Creates a new Pixbuf by loading an image from a file. | |
Pixbuf(Colorspace colorSpace, boolean hasAlpha, int bitsPerSample, int width, int height)
Create a new Pixbuf object and allocate a buffer to it.
| |
Pixbuf(byte[] data)
Create a new Pixbuf by parsing XPM data in memory.
| |
Pixbuf(byte[] data, boolean copyPixels)
Create a new Pixbuf from a flat representation that is suitable for
storing as inline data in a program. | |
Pixbuf(Pixbuf srcPixbuf, int srcX, int srcY, int width, int height)
Create a new Pixbuf which represents a sub-region of another Pixbuf. | |
Pixbuf(Drawable drawable, Colormap colormap, int srcX, int srcY, int destX, int destY, int width, int height)
Transfers image data from a Drawable and converts it to an RGB(A)
representation inside this Pixbuf. | |
Pixbuf(Image image, Colormap colormap, int srcX, int srcY, int destX, int destY, int width, int height)
Transfers image data from an Image and converts it to an RGB(A)
representation inside this Pixbuf.
|
Method Summary | |
---|---|
Pixbuf | addAlpha(boolean substituteColor, int red, int green, int blue)
Adds alpha channel to this Pixbuf and returns the results. |
Pixbuf | composite(int width, int height, InterpType type, int overallAlpha, int checkSize, int color1, int color2)
Creates a new Pixbuf by scaling this Pixbuf to the provided width and
height and compositing the results with a checkboard of colors color1 and
color2.
|
Pixbuf | composite(Pixbuf dest, int destX, int destY, int destWidth, int destHeight, double offsetX, double offsetY, double scaleX, double scaleY, InterpType type, int overallAlpha)
Creates a transformation of this image by scaling scaleX and scaleY then
translating by offsetX and offsetY. |
Pixbuf | composite(Pixbuf dest, int destX, int destY, int destWidth, int destHeight, double offsetX, double offsetY, double scaleX, double scaleY, InterpType type, int overallAlpha, int checkX, int checkY, int checkSize, int color1, int color2)
Creates a transformation of this image by scaling scaleX and scaleY then
translating by offsetX and offsetY then composites the rectangle (destX,
destY, destWidth, destHeight) of the resulting image with a checkboard of
the colors color1 and color2 and renders it onto the destination image.
|
Pixbuf | copy()
Return a copy of this Pixbuf. |
void | copyArea(int x, int y, int width, int height, Pixbuf dest, int destX, int destY)
Copies a rectangle area from this Pixbuf to the destination Pixbuf.
|
void | fill(int pixel)
Clears the Pixbuf to a given RGBA value, converting the RGBA value into
the Pixbuf's pixel format. |
Pixbuf | flip(boolean horizontal)
Flips a Pixbuf horizontally or vertically and returns the result in a new
Pixbuf.
|
int | getBitsPerSample() |
Colorspace | getColorspace()
Returns the Colorspace for the Pixbuf. |
static PixbufFormat | getFileInformation(String filename) |
int | getNumChannels()
Returns the number of channels for the Pixbuf. |
String | getOption(String key) |
static Pixbuf | getPixbufFromHandle(Handle hndl)
Constructs a Pixbuf from a handle to native resources. |
byte[] | getPixels()
Returns the pixel data for the Pixbuf |
int | getRowstride()
Returns the rowstride which is the number of bytes between the start of a
row and the start of the next row. |
static Type | getType()
Retrieve the runtime type used by the GLib library. |
boolean | hasAlpha() |
int | height()
Return the height of the pixbuf.
|
Pixbuf | rotate(PixbufRotation direction)
Rotate this pixbuf and return the results as a new Pixbuf.
|
Pixbuf | saturateAndPixelate(Pixbuf dest, double saturation, boolean pixelate)
Modifies saturation and optionally pixelates this Pixbuf placing the
result in the destination Pixbuf. |
void | save(String filename, String type, String[] optionKeys, String[] optionValues)
Saves a Pixbuf to a file in the format type provided. |
byte[] | saveToBuffer(String type, String[] optionKeys, String[] optionValues)
Saves a Pixbuf to a buffer in the format type provided. |
Pixbuf | scale(int width, int height, InterpType itype)
Create a new pixbuf from an existing pixbuf scaled to the size provided. |
Pixbuf | scale(Pixbuf dest, int destX, int destY, int destWidth, int destHeight, double offsetX, double offsetY, double scaleX, double scaleY, InterpType type)
Creates a transformation of this Pixbuf by scaling scaleX and scaleY then
translating by offsetX and offsetY, then renders the rectangle of the
resulting image onto the destination image replacing the previous
contents.
|
int | width()
Return the width of the pixbuf.
|
Parameters: filename The name of the image file.
Throws: FileNotFoundException if filename doesn't exist.
Parameters: filename width height preserveAspect
Throws: FileNotFoundException JGException
Parameters: colorSpace hasAlpha bitsPerSample width height
Parameters: data
Parameters: data copyPixels
Throws: JGException
Parameters: srcPixbuf srcX srcY width height
Parameters: drawable colormap srcX srcY destX destY width height
Parameters: image colormap srcX srcY destX destY width height
If substituteColor is true the color specified by (red, green, blue) will be assigned zero opacity. That is, if you pass (255, 255, 255) for the substitute color all white pixels will become fully transparent.
Parameters: substituteColor red green blue
Parameters: width height type overallAlpha checkSize color1 color2
Parameters: dest destX destY destWidth destHeight offsetX offsetY scaleX scaleY type overallAlpha
Parameters: dest destX destY destWidth destHeight offsetX offsetY scaleX scaleY type overallAlpha checkX checkY checkSize color1 color2
Parameters: x y width height dest destX destY
Parameters: pixel
Parameters: horizontal
Returns: The height
Parameters: direction
Parameters: dest saturation pixelate
Parameters: filename type optionKeys optionValues
Throws: JGException
Parameters: type optionKeys optionValues
Throws: JGException
Parameters: dest destX destY destWidth destHeight offsetX offsetY scaleX scaleY type
Returns: The width