addAlpha
public Pixbuf addAlpha(boolean substituteColor,
int red,
int green,
int blue)
Adds alpha channel to this Pixbuf and returns the results. If this
Pixbuf already has an alpha channel, the channel values are copied
into the newly created Pixbuf; otherwise the alpha channel is
initialized to 255 (full opacity).
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.
substituteColor
- red
- green
- blue
-
composite
public 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.
width
- height
- type
- overallAlpha
- checkSize
- color1
- color2
-
composite
public 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. This gives an image in the coordinates
of the destination pixbuf. The rectangle (destX, destY, destWidth, destHeight)
is then composited onto the corresponding rectangle of the original destination
image.
dest
- destX
- destY
- destWidth
- destHeight
- offsetX
- offsetY
- scaleX
- scaleY
- type
- overallAlpha
-
composite
public 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.
dest
- destX
- destY
- destWidth
- destHeight
- offsetX
- offsetY
- scaleX
- scaleY
- type
- overallAlpha
- checkX
- checkY
- checkSize
- color1
- color2
-
copy
public Pixbuf copy()
Return a copy of this Pixbuf.
copyArea
public 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.
Conversion of Pixbuf formats is done automatically.
x
- y
- width
- height
- dest
- destX
- destY
-
fill
public void fill(int pixel)
Clears the Pixbuf to a given RGBA value, converting the RGBA value into
the Pixbuf's pixel format. The alpha will be ignored if the Pixbuf doesn't
have an alpha channel.
pixel
-
flip
public Pixbuf flip(boolean horizontal)
Flips a Pixbuf horizontally or vertically and returns the result
in a new Pixbuf.
horizontal
-
gdk_pixbuf_add_alpha
protected static final Handle gdk_pixbuf_add_alpha(Handle pixbuf,
boolean substituteColor,
int r,
int g,
int b)
gdk_pixbuf_composite
protected static final void gdk_pixbuf_composite(Handle src,
Handle dest,
int destX,
int destY,
int destWidth,
int destHeight,
double offsetX,
double offsetY,
double scaleX,
double scaleY,
int interpType,
int overallAlpha)
gdk_pixbuf_composite_color
protected static final void gdk_pixbuf_composite_color(Handle src,
Handle dest,
int destX,
int destY,
int destWidth,
int destHeight,
double offsetX,
double offsetY,
double scaleX,
double scaleY,
int interpType,
int overallAlpha,
int checkX,
int checkY,
int checkSize,
int color1,
int color2)
gdk_pixbuf_composite_color_simple
protected static final Handle gdk_pixbuf_composite_color_simple(Handle src,
int destWidth,
int destHeight,
int interpType,
int overallAlpha,
int checkSize,
int color1,
int color2)
gdk_pixbuf_copy
protected static final Handle gdk_pixbuf_copy(Handle pixbuf)
gdk_pixbuf_copy_area
protected static final void gdk_pixbuf_copy_area(Handle srcPixbuf,
int srcX,
int srcY,
int width,
int height,
Handle destPixbuf,
int destX,
int destY)
gdk_pixbuf_fill
protected static final void gdk_pixbuf_fill(Handle pixbuf,
int pixel)
gdk_pixbuf_flip
protected static final Handle gdk_pixbuf_flip(Handle pixbuf,
boolean horizontal)
gdk_pixbuf_get_bits_per_sample
protected static final int gdk_pixbuf_get_bits_per_sample(Handle pixbuf)
gdk_pixbuf_get_colorspace
protected static final int gdk_pixbuf_get_colorspace(Handle pixbuf)
gdk_pixbuf_get_file_info
protected static final Handle gdk_pixbuf_get_file_info(String filename,
int[] width,
int[] height)
gdk_pixbuf_get_has_alpha
protected static final boolean gdk_pixbuf_get_has_alpha(Handle pixbuf)
gdk_pixbuf_get_height
protected static final int gdk_pixbuf_get_height(Handle pixbuf)
gdk_pixbuf_get_n_channels
protected static final int gdk_pixbuf_get_n_channels(Handle pixbuf)
gdk_pixbuf_get_option
protected static final String gdk_pixbuf_get_option(Handle pixbuf,
String key)
gdk_pixbuf_get_pixels
protected static final byte[] gdk_pixbuf_get_pixels(Handle pixbuf)
gdk_pixbuf_get_rowstride
protected static final int gdk_pixbuf_get_rowstride(Handle pixbuf)
gdk_pixbuf_get_width
protected static final int gdk_pixbuf_get_width(Handle pixbuf)
gdk_pixbuf_new
protected static final Handle gdk_pixbuf_new(int colorspace,
boolean hasAlpha,
int bitsPerSample,
int width,
int height)
gdk_pixbuf_new_from_file
protected static final Handle gdk_pixbuf_new_from_file(String filename,
Handle error)
gdk_pixbuf_new_from_file_at_scale
protected static final Handle gdk_pixbuf_new_from_file_at_scale(String filename,
int width,
int height,
boolean preserveAspect,
Handle error)
gdk_pixbuf_new_from_file_at_size
protected static final Handle gdk_pixbuf_new_from_file_at_size(String filename,
int width,
int height,
Handle error)
gdk_pixbuf_new_from_inline
protected static final Handle gdk_pixbuf_new_from_inline(int dataLength,
byte[] data,
boolean copyPixels,
Handle error)
gdk_pixbuf_new_from_xpm_data
protected static final Handle gdk_pixbuf_new_from_xpm_data(byte[] data)
gdk_pixbuf_new_subpixbuf
protected static final Handle gdk_pixbuf_new_subpixbuf(Handle srcPixbuf,
int srcX,
int srcY,
int width,
int height)
gdk_pixbuf_rotate_simple
protected static final Handle gdk_pixbuf_rotate_simple(Handle pixbuf,
int angle)
gdk_pixbuf_saturate_and_pixelate
protected static final void gdk_pixbuf_saturate_and_pixelate(Handle src,
Handle dest,
double saturation,
boolean pixelate)
gdk_pixbuf_save_to_bufferv
protected static final boolean gdk_pixbuf_save_to_bufferv(Handle pixbuf,
String buffer,
String type,
String[] optionKeys,
String[] optionValues,
Handle error)
gdk_pixbuf_savev
protected static final boolean gdk_pixbuf_savev(Handle pixbuf,
String filename,
String type,
String[] optionKeys,
String[] optionValues,
Handle error)
gdk_pixbuf_scale
protected static final void gdk_pixbuf_scale(Handle src,
Handle dest,
int destX,
int destY,
int destWidth,
int destHeight,
double offsetX,
double offsetY,
double scaleX,
double scaleY,
int interpType)
gdk_pixbuf_scale_simple
protected static final Handle gdk_pixbuf_scale_simple(Handle src,
int destWidth,
int destHeight,
int interpType)
getBitsPerSample
public int getBitsPerSample()
getColorspace
public Colorspace getColorspace()
Returns the Colorspace for the Pixbuf.
getFileInformation
public static PixbufFormat getFileInformation(String filename)
getNumChannels
public int getNumChannels()
Returns the number of channels for the Pixbuf.
getOption
public String getOption(String key)
getPixels
public byte[] getPixels()
Returns the pixel data for the Pixbuf
getRowstride
public int getRowstride()
Returns the rowstride which is the number of bytes between
the start of a row and the start of the next row.
hasAlpha
public boolean hasAlpha()
height
public int height()
Return the height of the pixbuf.
- The height
rotate
public Pixbuf rotate(PixbufRotation direction)
Rotate this pixbuf and return the results as a new Pixbuf.
direction
-
saturateAndPixelate
public Pixbuf saturateAndPixelate(Pixbuf dest,
double saturation,
boolean pixelate)
Modifies saturation and optionally pixelates this Pixbuf placing the
result in the destination Pixbuf. The Pixbufs may be the same Pixbuf
with no ill effects. If saturation is 1.0 then saturation is not
changed. If it's less than 1.0, saturation is reduced (the image
is darkened); if greater than 1.0, saturation is increased (the image
is brightened). If pixelate is true, then pixels are faded in a
checkerboard pattern to create a pixelated image. The Pixbufs must have
the same image format, size, and rowstride.
dest
- saturation
- pixelate
-
save
public void save(String filename,
String type,
String[] optionKeys,
String[] optionValues)
throws JGException
Saves a Pixbuf to a file in the format type provided. By default the only supported
formats are "jpeg", "png", or "ico".
filename
- type
- optionKeys
- optionValues
-
JGException
-
saveToBuffer
public byte[] saveToBuffer(String type,
String[] optionKeys,
String[] optionValues)
throws JGException
Saves a Pixbuf to a buffer in the format type provided. The only supported
formats are "jpeg", "png", or "ico". The possible errors contained in the
JGException are those described in PixbufError.
type
- optionKeys
- optionValues
-
JGException
-
scale
public Pixbuf scale(int width,
int height,
InterpType itype)
Create a new pixbuf from an existing pixbuf scaled to the size provided.
scale
public 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.
dest
- destX
- destY
- destWidth
- destHeight
- offsetX
- offsetY
- scaleX
- scaleY
- type
-
width
public int width()
Return the width of the pixbuf.
- The width