Modifies saturation and optionally pixelates src , placing the result in dest .
void
scale (const Glib::RefPtr<Gdk::Pixbuf>& dest, int dest_x, int dest_y, int dest_width, int dest_height, double offset_x, double offset_y, double scale_x, double scale_y, InterpType interp_type) const
Creates a transformation of the source image src by scaling by scale_x and scale_y then translating by offset_x and offset_y , then renders the rectangle ( dest_x , dest_y , dest_width , dest_height ) of the resulting image onto the destination image replacing the previous contents.
void
composite (const Glib::RefPtr<Gdk::Pixbuf>& dest, int dest_x, int dest_y, int dest_width, int dest_height, double offset_x, double offset_y, double scale_x, double scale_y, InterpType interp_type, int overall_alpha) const
Creates a transformation of the source image src by scaling by scale_x and scale_y then translating by offset_x and offset_y , then composites the rectangle ( dest_x , dest_y , dest_width , dest_height ) of the resulting image onto the destination image.
void
composite_color (const Glib::RefPtr<Gdk::Pixbuf>& dest, int dest_x, int dest_y, int dest_width, int dest_height, double offset_x, double offset_y, double scale_x, double scale_y, InterpType interp_type, int overall_alpha, int check_x, int check_y, int check_size, guint32 color1, guint32 color2) const
Creates a transformation of the source image src by scaling by scale_x and scale_y then translating by offset_x and offset_y , then composites the rectangle ( dest_x , dest_y , dest_width , dest_height ) of the resulting image with a checkboard of the colors and and renders it onto the destination image.
Takes the opacity values in a rectangular portion of a pixbuf and thresholds them to produce a bi-level alpha mask that can be used as a clipping mask for a drawable.
create_from_data (const guint8* data, Colorspace colorspace, bool has_alpha, int bits_per_sample, int width, int height, int rowstride, const SlotDestroyData& destroy_slot)
Creates a new Gdk::Pixbuf out of in-memory image data.
Takes an existing pixbuf and adds an alpha channel to it.
If the existing pixbuf already had an alpha channel, the channel values are copied from the original; otherwise, the alpha channel is initialized to 255 (full opacity).
If substitute_color is true, then the color specified by ( r , g , b ) 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:
substitute_color
Whether to set a color to zero opacity. If this is false, then the ( r , g , b ) arguments will be ignored.
r
Red value to substitute.
g
Green value to substitute.
b
Blue value to substitute.
Returns:
A newly-created pixbuf with a reference count of 1.
Creates a transformation of the source image src by scaling by scale_x and scale_y then translating by offset_x and offset_y , then composites the rectangle ( dest_x , dest_y , dest_width , dest_height ) of the resulting image onto the destination image.
Parameters:
dest
The Gdk::Pixbuf into which to render the results.
dest_x
The left coordinate for region to render.
dest_y
The top coordinate for region to render.
dest_width
The width of the region to render.
dest_height
The height of the region to render.
offset_x
The offset in the X direction (currently rounded to an integer).
offset_y
The offset in the Y direction (currently rounded to an integer).
Creates a transformation of the source image src by scaling by scale_x and scale_y then translating by offset_x and offset_y , then composites the rectangle ( dest_x , dest_y , dest_width , dest_height ) of the resulting image with a checkboard of the colors and and renders it onto the destination image.
Create a Gdk::Pixbuf from a flat representation that is suitable for storing as inline data in a program.
This is useful if you want to ship a program with images, but don't want to depend on any external files.
GTK+ ships with a program called gdk-pixbuf-csource which allows for conversion of GdkPixbufs into such a inline representation. In almost all cases, you should pass the --raw flag to gdk-pixbuf-csource. A sample invocation would be:
For the typical case where the inline pixbuf is read-only static data, you don't need to copy the pixel data unless you intend to write to it, so you can pass false for copy_pixels. (If you pass --rle to gdk-pixbuf-csource, a copy will be made even if copy_pixels is false, so using this option is generally a bad idea.)
If you create a pixbuf from const inline data compiled into your program, it's probably safe to ignore errors, since things will always succeed. For non-const inline data, you could get out of memory. For untrusted inline data located at runtime, you could have corrupt inline data in addition.
Parameters:
data_length
Length in bytes of the data argument.
data
Byte data containing a serialized GdkPixdata structure.
copy_pixels
Whether to copy the pixel data, or use direct pointers to data for the resulting pixbuf.
Creates a new pixbuf which represents a sub-region of src_pixbuf .
The new pixbuf shares its pixels with the original pixbuf, so writing to one affects both. The new pixbuf holds a reference to src_pixbuf , so src_pixbuf will not be finalized until the new pixbuf is finalized.
Parameters:
src_pixbuf
A Gdk::Pixbuf.
src_x
X coord in src_pixbuf .
src_y
Y coord in src_pixbuf .
width
Width of region in src_pixbuf .
height
Height of region in src_pixbuf .
Returns:
A new pixbuf.
void Gdk::Pixbuf::fill
(
guint32
pixel
)
Clears a pixbuf to the 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.
Parameters:
pixel
RGBA pixel to clear to (0xffffffff is opaque white, 0x00000000 transparent black).
int Gdk::Pixbuf::get_bits_per_sample
(
)
const
Queries the number of bits per color sample in a pixbuf.
Takes the opacity values in a rectangular portion of a pixbuf and thresholds them to produce a bi-level alpha mask that can be used as a clipping mask for a drawable.
Renders a rectangular portion of a pixbuf to a drawable while using the specified GC.
This is done using GdkRGB, so the specified drawable must have the GdkRGB visual and colormap. Note that this function will ignore the opacity information for images with an alpha channel; the GC must already have the clipping mask set if you want transparent regions to show through.
For an explanation of dither offsets, see the GdkRGB documentation. In brief, the dither offset is important when re-rendering partial regions of an image to a rendered version of the full image, or for when the offsets to a base position change, as in scrolling. The dither matrix has to be shifted for consistent visual results. If you do not have any of these cases, the dither offsets can be both zero.
This function is obsolete. Use gdk_draw_pixbuf() instead.
Renders a rectangular portion of a pixbuf to a drawable.
The destination drawable must have a colormap. All windows have a colormap, however, pixmaps only have colormap by default if they were created with a non-0 window argument. Otherwise a colormap must be set on them with gdk_drawable_set_colormap.
On older X servers, rendering pixbufs with an alpha channel involves round trips to the X server, and may be somewhat slow.
This function is obsolete. Use gdk_draw_pixbuf() instead.
Parameters:
drawable
Destination drawable.
src_x
Source X coordinate within pixbuf.
src_y
Source Y coordinates within pixbuf.
dest_x
Destination X coordinate within drawable.
dest_y
Destination Y coordinate within drawable.
width
Width of region to render, in pixels, or -1 to use pixbuf width.
height
Height of region to render, in pixels, or -1 to use pixbuf height.
Modifies saturation and optionally pixelates src , placing the result in dest .
src and dest 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. src and dest must have the same image format, size, and rowstride.
Creates a transformation of the source image src by scaling by scale_x and scale_y then translating by offset_x and offset_y , then renders the rectangle ( dest_x , dest_y , dest_width , dest_height ) of the resulting image onto the destination image replacing the previous contents.
Try to use scale_simple() first, this function is the industrial-strength power tool you can fall back to if scale_simple() isn't powerful enough.
Parameters:
dest
The Gdk::Pixbuf into which to render the results.
dest_x
The left coordinate for region to render.
dest_y
The top coordinate for region to render.
dest_width
The width of the region to render.
dest_height
The height of the region to render.
offset_x
The offset in the X direction (currently rounded to an integer).
offset_y
The offset in the Y direction (currently rounded to an integer).
Create a new Gdk::Pixbuf containing a copy of src scaled to dest_width x dest_height .
Leaves src unaffected. interp_type should be Gdk::INTERP_NEAREST if you want maximum speed (but when scaling down Gdk::INTERP_NEAREST is usually unusably ugly). The default interp_type should be Gdk::INTERP_BILINEAR which offers reasonable quality and speed.
You can scale a sub-portion of src by creating a sub-pixbuf pointing into src ; see new_subpixbuf().