gtkmm 4.17.0
|
#include <gdkmm/pixbuf.h>
Public Types | |
enum class | Rotation { Rotation::NONE = 0 , Rotation::COUNTERCLOCKWISE = 90 , Rotation::UPSIDEDOWN = 180 , Rotation::CLOCKWISE = 270 } |
The possible rotations which can be passed to Gdk::Pixbuf::rotate_simple(). More... | |
using | SlotDestroyData = sigc::slot< void(const guint8 *)> |
![]() | |
typedef void(*)(gpointer data | DestroyNotify) |
![]() | |
typedef internal::func_destroy_notify | func_destroy_notify |
![]() | |
typedef internal::func_destroy_notify | func_destroy_notify |
Public Member Functions | |
Pixbuf (Pixbuf &&src) noexcept | |
Pixbuf & | operator= (Pixbuf &&src) noexcept |
~Pixbuf () noexcept override | |
GdkPixbuf * | gobj () |
Provides access to the underlying C GObject. | |
const GdkPixbuf * | gobj () const |
Provides access to the underlying C GObject. | |
GdkPixbuf * | gobj_copy () |
Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs. | |
Glib::RefPtr< Pixbuf > | copy () const |
Creates a new Gdk::Pixbuf with a copy of the information in the specified pixbuf . | |
Colorspace | get_colorspace () const |
Queries the color space of a pixbuf. | |
int | get_n_channels () const |
Queries the number of channels of a pixbuf. | |
bool | get_has_alpha () const |
Queries whether a pixbuf has an alpha channel (opacity information). | |
int | get_bits_per_sample () const |
Queries the number of bits per color sample in a pixbuf. | |
guint8 * | get_pixels () |
Queries a pointer to the pixel data of a pixbuf. | |
const guint8 * | get_pixels () const |
Provides a read-only pointer to the raw pixel data. | |
guint8 * | get_pixels (guint & length) |
Queries a pointer to the pixel data of a pixbuf. | |
const guint8 * | get_pixels (guint & length) const |
int | get_width () const |
Queries the width of a pixbuf. | |
int | get_height () const |
Queries the height of a pixbuf. | |
int | get_rowstride () const |
Queries the rowstride of a pixbuf, which is the number of bytes between the start of a row and the start of the next row. | |
gsize | get_byte_length () const |
Returns the length of the pixel data, in bytes. | |
void | fill (guint32 pixel) |
Clears a pixbuf to the given RGBA value, converting the RGBA value into the pixbuf's pixel format. | |
void | save (const std::string &filename, const Glib::ustring & type) const |
Saves pixbuf to a file in format type. | |
void | save (const std::string &filename, const Glib::ustring & type, const std::vector< Glib::ustring > &option_keys, const std::vector< Glib::ustring > &option_values) const |
Saves pixbuf to a file in format type. | |
void | save_to_buffer (gchar *&buffer, gsize &buffer_size, const Glib::ustring & type="png") const |
Saves the pixbuf to a new buffer in format type. | |
void | save_to_buffer (gchar *&buffer, gsize &buffer_size, const Glib::ustring & type, const std::vector< Glib::ustring > &option_keys, const std::vector< Glib::ustring > &option_values) const |
Saves the pixbuf to a new buffer in format type. | |
Glib::RefPtr< Gdk::Pixbuf > | add_alpha (bool substitute_color, guint8 r, guint8 g, guint8 b) const |
Takes an existing pixbuf and adds an alpha channel to it. | |
void | copy_area (int src_x, int src_y, int width, int height, const Glib::RefPtr< Gdk::Pixbuf > &dest_pixbuf, int dest_x, int dest_y) const |
Copies a rectangular area from src_pixbuf to dest_pixbuf . | |
void | saturate_and_pixelate (const Glib::RefPtr< Gdk::Pixbuf > &dest, float saturation, bool pixelate) const |
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. | |
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 alpha blends the rectangle ( dest_x , dest_y, dest_width, dest_height) of the resulting image with a checkboard of the colors color1 and color2 and renders it onto the destination image. | |
Glib::RefPtr< Gdk::Pixbuf > | scale_simple (int dest_width, int dest_height, InterpType interp_type) const |
Create a new pixbuf containing a copy of src scaled to dest_width x dest_height . | |
Glib::RefPtr< Gdk::Pixbuf > | composite_color_simple (int dest_width, int dest_height, InterpType interp_type, int overall_alpha, int check_size, guint32 color1, guint32 color2) const |
Creates a new pixbuf by scaling src to dest_width x dest_height and alpha blending the result with a checkboard of colors color1 and color2 . | |
Glib::RefPtr< Gdk::Pixbuf > | rotate_simple (Rotation angle) const |
Rotates a pixbuf by a multiple of 90 degrees, and returns the result in a new pixbuf. | |
Glib::RefPtr< Gdk::Pixbuf > | flip (bool horizontal=true) const |
Flips a pixbuf horizontally or vertically and returns the result in a new pixbuf. | |
Glib::ustring | get_option (const Glib::ustring & key) const |
Looks up key in the list of options that may have been attached to the pixbuf when it was loaded, or that may have been attached by another function using set_option(). | |
bool | set_option (const Glib::ustring & key, const Glib::ustring & value) |
Attaches a key/value pair as an option to a Gdk::Pixbuf . | |
bool | remove_option (const Glib::ustring & key) |
Removes the key/value pair option attached to a Gdk::Pixbuf . | |
bool | copy_options (const Glib::RefPtr< Pixbuf > &dest_pixbuf) const |
Copies the key/value pair options attached to a Gdk::Pixbuf to another Gdk::Pixbuf . | |
Glib::RefPtr< Pixbuf > | apply_embedded_orientation () |
Takes an existing pixbuf and checks for the presence of an associated "orientation" option. | |
Glib::PropertyProxy_ReadOnly< Colorspace > | property_colorspace () const |
The color space of the pixbuf. | |
Glib::PropertyProxy_ReadOnly< int > | property_n_channels () const |
The number of samples per pixel. | |
Glib::PropertyProxy_ReadOnly< bool > | property_has_alpha () const |
Whether the pixbuf has an alpha channel. | |
Glib::PropertyProxy_ReadOnly< int > | property_bits_per_sample () const |
The number of bits per sample. | |
Glib::PropertyProxy_ReadOnly< int > | property_width () const |
The number of columns of the pixbuf. | |
Glib::PropertyProxy_ReadOnly< int > | property_height () const |
The number of rows of the pixbuf. | |
Glib::PropertyProxy_ReadOnly< int > | property_rowstride () const |
The number of bytes between the start of a row and the start of the next row. | |
Glib::PropertyProxy_ReadOnly< void * > | property_pixels () const |
A pointer to the pixel data of the pixbuf. | |
![]() | |
Object (const Object &)=delete | |
Object & | operator= (const Object &)=delete |
Object (Object &&src) noexcept | |
Object & | operator= (Object &&src) noexcept |
void * | get_data (const QueryQuark &key) |
void | set_data (const Quark &key, void *data) |
void | set_data_with_c_callback (const Quark &key, void *data, GDestroyNotify notify) |
void | set_data (const Quark &key, void *data, DestroyNotify notify) |
void | remove_data (const QueryQuark &quark) |
void * | steal_data (const QueryQuark &quark) |
Glib::RefPtr< Glib::Object > | wrap (GObject *object, bool take_copy=false) |
![]() | |
ObjectBase (const ObjectBase &)=delete | |
ObjectBase & | operator= (const ObjectBase &)=delete |
void | set_property_value (const Glib::ustring &property_name, const Glib::ValueBase &value) |
void | get_property_value (const Glib::ustring &property_name, Glib::ValueBase &value) const |
void | set_property (const Glib::ustring &property_name, const PropertyType &value) |
void | get_property (const Glib::ustring &property_name, PropertyType &value) const |
PropertyType | get_property (const Glib::ustring &property_name) const |
sigc::connection | connect_property_changed (const Glib::ustring &property_name, const sigc::slot< void()> &slot) |
sigc::connection | connect_property_changed (const Glib::ustring &property_name, sigc::slot< void()> &&slot) |
void | freeze_notify () |
void | thaw_notify () |
virtual void | reference () const |
virtual void | unreference () const |
GObject * | gobj () |
const GObject * | gobj () const |
GObject * | gobj_copy () const |
![]() | |
trackable () noexcept | |
trackable (const trackable &src) noexcept | |
trackable (trackable &&src) noexcept | |
~trackable () | |
void | add_destroy_notify_callback (notifiable *data, func_destroy_notify func) const |
void | notify_callbacks () |
trackable & | operator= (const trackable &src) |
trackable & | operator= (trackable &&src) noexcept |
void | remove_destroy_notify_callback (notifiable *data) const |
![]() | |
Icon (Icon &&src) noexcept | |
Icon & | operator= (Icon &&src) noexcept |
~Icon () noexcept override | |
GIcon * | gobj () |
const GIcon * | gobj () const |
guint | hash () const |
std::string | to_string () const |
bool | equal (const Glib::RefPtr< Icon > &other) const |
Glib::VariantBase | serialize () const |
![]() | |
Interface () | |
Interface (Interface &&src) noexcept | |
Interface & | operator= (Interface &&src) noexcept |
Interface (const Glib::Interface_Class &interface_class) | |
Interface (GObject *castitem) | |
~Interface () noexcept override | |
Interface (const Interface &)=delete | |
Interface & | operator= (const Interface &)=delete |
GObject * | gobj () |
const GObject * | gobj () const |
![]() | |
LoadableIcon (LoadableIcon &&src) noexcept | |
LoadableIcon & | operator= (LoadableIcon &&src) noexcept |
~LoadableIcon () noexcept override | |
GLoadableIcon * | gobj () |
const GLoadableIcon * | gobj () const |
Glib::RefPtr< InputStream > | load (int size, Glib::ustring &type, const Glib::RefPtr< Cancellable > &cancellable) |
Glib::RefPtr< InputStream > | load (int size, Glib::ustring &type) |
void | load_async (int size, const SlotAsyncReady &slot, const Glib::RefPtr< Cancellable > &cancellable) |
void | load_async (int size, const SlotAsyncReady &slot) |
Related Symbols | |
(Note that these are not member symbols.) | |
Glib::RefPtr< Gdk::Pixbuf > | wrap (GdkPixbuf *object, bool take_copy=false) |
A Glib::wrap() method for this object. | |
using Gdk::Pixbuf::SlotDestroyData = sigc::slot<void(const guint8*)> |
|
noexcept |
|
overridenoexcept |
|
protected |
Transfers image data from a Cairo::Surface and converts it to an RGB(A) representation inside a Gdk::Pixbuf.
This allows you to efficiently read individual pixels from cairo surfaces.
This will create an RGB pixbuf with 8 bits per channel. The pixbuf will contain an alpha channel if the surface contains one.
src | Surface to copy from. |
src_x | Source X coordinate within the surface. |
src_y | Source Y coordinate within the surface. |
width | Width in pixels of region to get. |
height | Height in pixels of region to get. |
Gdk::PixbufError |
Glib::RefPtr< Gdk::Pixbuf > Gdk::Pixbuf::add_alpha | ( | bool | substitute_color, |
guint8 | r, | ||
guint8 | g, | ||
guint8 | b | ||
) | const |
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 the (r
, g
, b
) arguments will be assigned zero opacity. That is, if you pass (255, 255, 255)
for the substitute color, all white pixels will become fully transparent.
If substitute_color
is false
, then the (r
, g
, b
) arguments will be ignored.
substitute_color | Whether to set a color to zero opacity. |
r | Red value to substitute. |
g | Green value to substitute. |
b | Blue value to substitute. |
Glib::RefPtr< Pixbuf > Gdk::Pixbuf::apply_embedded_orientation | ( | ) |
Takes an existing pixbuf and checks for the presence of an associated "orientation" option.
The orientation option may be provided by the JPEG loader (which reads the exif orientation tag) or the TIFF loader (which reads the TIFF orientation tag, and compensates it for the partial transforms performed by libtiff).
If an orientation option/tag is present, the appropriate transform will be performed so that the pixbuf is oriented correctly.
Return: (transfer full) (nullable): A newly-created pixbuf
void Gdk::Pixbuf::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.
This gives an image in the coordinates of the destination pixbuf. The rectangle ( dest_x, dest_y, dest_width, dest_height) is then alpha blended onto the corresponding rectangle of the original destination image.
When the destination rectangle contains parts not in the source image, the data at the edges of the source image is replicated to infinity.
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). |
scale_x | The scale factor in the X direction. |
scale_y | The scale factor in the Y direction. |
interp_type | The interpolation type for the transformation. |
overall_alpha | Overall alpha for source image (0..255). |
void Gdk::Pixbuf::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 alpha blends the rectangle ( dest_x , dest_y, dest_width, dest_height) of the resulting image with a checkboard of the colors color1 and color2 and renders it onto the destination image.
If the source image has no alpha channel, and overall_alpha is 255, a fast path is used which omits the alpha blending and just performs the scaling.
See composite_color_simple() for a simpler variant of this function suitable for many tasks.
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). |
scale_x | The scale factor in the X direction. |
scale_y | The scale factor in the Y direction. |
interp_type | The interpolation type for the transformation. |
overall_alpha | Overall alpha for source image (0..255). |
check_x | The X offset for the checkboard (origin of checkboard is at - check_x, - check_y). |
check_y | The Y offset for the checkboard. |
check_size | The size of checks in the checkboard (must be a power of two). |
color1 | The color of check at upper left. |
color2 | The color of the other check. |
Glib::RefPtr< Gdk::Pixbuf > Gdk::Pixbuf::composite_color_simple | ( | int | dest_width, |
int | dest_height, | ||
InterpType | interp_type, | ||
int | overall_alpha, | ||
int | check_size, | ||
guint32 | color1, | ||
guint32 | color2 | ||
) | const |
Creates a new pixbuf by scaling src
to dest_width
x dest_height
and alpha blending the result with a checkboard of colors color1
and color2
.
dest_width | The width of destination image. |
dest_height | The height of destination image. |
interp_type | The interpolation type for the transformation. |
overall_alpha | Overall alpha for source image (0..255). |
check_size | The size of checks in the checkboard (must be a power of two). |
color1 | The color of check at upper left. |
color2 | The color of the other check. |
Glib::RefPtr< Pixbuf > Gdk::Pixbuf::copy | ( | ) | const |
Creates a new Gdk::Pixbuf
with a copy of the information in the specified pixbuf
.
Note that this does not copy the options set on the original Gdk::Pixbuf
, use copy_options() for this.
void Gdk::Pixbuf::copy_area | ( | int | src_x, |
int | src_y, | ||
int | width, | ||
int | height, | ||
const Glib::RefPtr< Gdk::Pixbuf > & | dest_pixbuf, | ||
int | dest_x, | ||
int | dest_y | ||
) | const |
Copies a rectangular area from src_pixbuf
to dest_pixbuf
.
Conversion of pixbuf formats is done automatically.
If the source rectangle overlaps the destination rectangle on the same pixbuf, it will be overwritten during the copy operation. Therefore, you can not use this function to scroll a pixbuf.
src_x | Source X coordinate within src_pixbuf. |
src_y | Source Y coordinate within src_pixbuf. |
width | Width of the area to copy. |
height | Height of the area to copy. |
dest_pixbuf | Destination pixbuf. |
dest_x | X coordinate within dest_pixbuf. |
dest_y | Y coordinate within dest_pixbuf. |
bool Gdk::Pixbuf::copy_options | ( | const Glib::RefPtr< Pixbuf > & | dest_pixbuf | ) | const |
Copies the key/value pair options attached to a Gdk::Pixbuf
to another Gdk::Pixbuf
.
This is useful to keep original metadata after having manipulated a file. However be careful to remove metadata which you've already applied, such as the "orientation" option after rotating the image.
dest_pixbuf | The destination pixbuf. |
true
on success.
|
static |
Creates a new Gdk::Pixbuf
structure and allocates a buffer for it.
If the allocation of the buffer failed, this function will return nullptr
.
The buffer has an optimal rowstride. Note that the buffer is not cleared; you will have to fill it completely yourself.
colorspace | Color space for image. |
has_alpha | Whether the image should have transparency information. |
bits_per_sample | Number of bits per color sample. |
width | Width of image in pixels, must be > 0. |
height | Height of image in pixels, must be > 0. |
|
static |
Transfers image data from a Cairo::Surface and converts it to an RGB(A) representation inside a Gdk::Pixbuf.
This allows you to efficiently read individual pixels from cairo surfaces.
This will create an RGB pixbuf with 8 bits per channel. The pixbuf will contain an alpha channel if the surface contains one.
src | Surface to copy from. |
src_x | Source X coordinate within the surface. |
src_y | Source Y coordinate within the surface. |
width | Width in pixels of region to get. |
height | Height in pixels of region to get. |
Gdk::PixbufError |
|
static |
Creates a new Gdk::Pixbuf out of in-memory image data.
Currently only RGB images with 8 bits per sample are supported.
data | Image data in 8-bit/sample packed format. |
colorspace | Colorspace for the image data. |
has_alpha | Whether the data has an opacity channel. |
bits_per_sample | Number of bits per sample. |
width | Width of the image in pixels. |
height | Height of the image in pixels. |
rowstride | Distance in bytes between rows. |
|
static |
Creates a new Gdk::Pixbuf out of in-memory image data.
Currently only RGB images with 8 bits per sample are supported.
data | Image data in 8-bit/sample packed format. |
colorspace | Colorspace for the image data. |
has_alpha | Whether the data has an opacity channel. |
bits_per_sample | Number of bits per sample. |
width | Width of the image in pixels. |
height | Height of the image in pixels. |
rowstride | Distance in bytes between rows. |
destroy_slot | Slot used to free the data when the pixbuf's reference count drops to zero. |
|
static |
Creates a new pixbuf by loading an image from a file.
The file format is detected automatically.
filename | The path to the pixbuf file. |
Glib::FileError | |
Gdk::PixbufError |
|
static |
Creates a new pixbuf by loading an image from a file.
The file format is detected automatically. The image will be scaled to fit in the requested size.
filename | The path to the pixbuf file. |
width | The desired width |
height | The desired height |
preserve_aspect_ratio | Whether the image's aspect ratio will be preserved when scaling. |
Glib::FileError | |
Gdk::PixbufError |
|
static |
Creates a new pixbuf by loading an image from a resource.
The file format is detected automatically.
resource_path | The path of the resource file. |
Gio::ResourceError | |
Gdk::PixbufError |
|
static |
Creates a new pixbuf by loading an image from a resource.
The file format is detected automatically. The image will be scaled to fit in the requested size, optionally preserving the image's aspect ratio. When preserving the aspect ratio, a width of -1 will cause the image to be scaled to the exact given height, and a height of -1 will cause the image to be scaled to the exact given width. When not preserving aspect ratio, a width or height of -1 means to not scale the image at all in that dimension.
resource_path | The path of the resource file. |
width | The desired width |
height | The desired height |
preserve_aspect_ratio | Whether the image's aspect ratio will be preserved when scaling. |
Gio::ResourceError | |
Gdk::PixbufError |
|
static |
|
static |
Creates a new pixbuf by loading an image from an input stream.
The file format is detected automatically.
If nullptr
is returned, then error
will be set.
The cancellable
can be used to abort the operation from another thread. If the operation was cancelled, the error Gio::Error::CANCELLED
will be returned. Other possible errors are in the GDK_PIXBUF_ERROR
and G_IO_ERROR
domains.
The stream is not closed.
stream | A Gio::InputStream to load the pixbuf from. |
cancellable | Optional Gio::Cancellable object, nullptr to ignore. |
Glib::Error |
|
static |
|
static |
Creates a new pixbuf by loading an image from an input stream.
The file format is detected automatically. If nullptr
is returned, then error will be set. The cancellable can be used to abort the operation from another thread. If the operation was cancelled, the error Gio::Error::CANCELLED
will be returned. Other possible errors are in the GDK_PIXBUF_ERROR
and G_IO_ERROR
domains.
The image will be scaled to fit in the requested size, optionally preserving the image's aspect ratio.
When preserving the aspect ratio, a width
of -1 will cause the image to be scaled to the exact given height, and a height
of -1 will cause the image to be scaled to the exact given width. If both width
and height
are given, this function will behave as if the smaller of the two values is passed as -1.
When not preserving aspect ratio, a width
or height
of -1 means to not scale the image at all in that dimension.
The stream is not closed.
stream | A Gio::InputStream to load the pixbuf from. |
width | The width the image should have or -1 to not constrain the width. |
height | The height the image should have or -1 to not constrain the height. |
preserve_aspect_ratio | true to preserve the image's aspect ratio. |
cancellable | Optional Gio::Cancellable object, nullptr to ignore. |
Glib::Error |
Creates a new pixbuf by parsing XPM data in memory.
This data is commonly the result of including an XPM file into a program's C source.
data | Pointer to inline XPM data. |
|
static |
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.
Note that if src_pixbuf
is read-only, this function will force it to be mutable.
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. |
Glib::RefPtr< Gdk::Pixbuf > Gdk::Pixbuf::flip | ( | bool | horizontal = true | ) | const |
Flips a pixbuf horizontally or vertically and returns the result in a new pixbuf.
horizontal | true to flip horizontally, false to flip vertically. |
int Gdk::Pixbuf::get_bits_per_sample | ( | ) | const |
Queries the number of bits per color sample in a pixbuf.
gsize Gdk::Pixbuf::get_byte_length | ( | ) | const |
Returns the length of the pixel data, in bytes.
Colorspace Gdk::Pixbuf::get_colorspace | ( | ) | const |
Queries the color space of a pixbuf.
|
static |
Obtains the available information about the image formats supported by GdkPixbuf.
bool Gdk::Pixbuf::get_has_alpha | ( | ) | const |
Queries whether a pixbuf has an alpha channel (opacity information).
true
if it has an alpha channel, false
otherwise. int Gdk::Pixbuf::get_height | ( | ) | const |
Queries the height of a pixbuf.
int Gdk::Pixbuf::get_n_channels | ( | ) | const |
Queries the number of channels of a pixbuf.
Glib::ustring Gdk::Pixbuf::get_option | ( | const Glib::ustring & | key | ) | const |
Looks up key in the list of options that may have been attached to the pixbuf when it was loaded, or that may have been attached by another function using set_option().
For instance, the ANI loader provides "Title" and "Artist" options. The ICO, XBM, and XPM loaders provide "x_hot" and "y_hot" hot-spot options for cursor definitions. The PNG loader provides the tEXt ancillary chunk key/value pairs as options. Since 2.12, the TIFF and JPEG loaders return an "orientation" option string that corresponds to the embedded TIFF/Exif orientation tag (if present). Since 2.32, the TIFF loader sets the "multipage" option string to "yes" when a multi-page TIFF is loaded. Since 2.32 the JPEG and PNG loaders set "x-dpi" and "y-dpi" if the file contains image density information in dots per inch. Since 2.36.6, the JPEG loader sets the "comment" option with the comment EXIF tag.
key | A nul-terminated string. |
key
. guint8 * Gdk::Pixbuf::get_pixels | ( | ) |
Queries a pointer to the pixel data of a pixbuf.
This function will cause an implicit copy of the pixbuf data if the pixbuf was created from read-only data.
Please see the section on image data for information about how the pixel data is stored in memory.
Provides a read-only pointer to the raw pixel data.
This function allows skipping the implicit copy that must be made if get_pixels() is called on a read-only pixbuf.
guint8 * Gdk::Pixbuf::get_pixels | ( | guint & | length | ) |
Queries a pointer to the pixel data of a pixbuf.
This function will cause an implicit copy of the pixbuf data if the pixbuf was created from read-only data.
Please see the section on image data for information about how the pixel data is stored in memory.
length | The length of the binary data. |
int Gdk::Pixbuf::get_rowstride | ( | ) | const |
Queries the rowstride of a pixbuf, which is the number of bytes between the start of a row and the start of the next row.
|
static |
Get the GType for this class, for use with the underlying GObject type system.
int Gdk::Pixbuf::get_width | ( | ) | const |
Queries the width of a pixbuf.
|
inline |
Provides access to the underlying C GObject.
GdkPixbuf * Gdk::Pixbuf::gobj_copy | ( | ) |
Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.
Glib::PropertyProxy_ReadOnly< int > Gdk::Pixbuf::property_bits_per_sample | ( | ) | const |
The number of bits per sample.
Currently only 8 bit per sample are supported.
Default value: 8
Glib::PropertyProxy_ReadOnly< Colorspace > Gdk::Pixbuf::property_colorspace | ( | ) | const |
The color space of the pixbuf.
Currently, only Gdk::Colorspace::RGB
is supported.
Default value: Gdk::Colorspace::RGB
Glib::PropertyProxy_ReadOnly< bool > Gdk::Pixbuf::property_has_alpha | ( | ) | const |
Whether the pixbuf has an alpha channel.
Default value: false
Glib::PropertyProxy_ReadOnly< int > Gdk::Pixbuf::property_height | ( | ) | const |
The number of rows of the pixbuf.
Default value: 1
Glib::PropertyProxy_ReadOnly< int > Gdk::Pixbuf::property_n_channels | ( | ) | const |
The number of samples per pixel.
Currently, only 3 or 4 samples per pixel are supported.
Default value: 3
Glib::PropertyProxy_ReadOnly< void * > Gdk::Pixbuf::property_pixels | ( | ) | const |
A pointer to the pixel data of the pixbuf.
Glib::PropertyProxy_ReadOnly< int > Gdk::Pixbuf::property_rowstride | ( | ) | const |
The number of bytes between the start of a row and the start of the next row.
This number must (obviously) be at least as large as the width of the pixbuf.
Default value: 1
Glib::PropertyProxy_ReadOnly< int > Gdk::Pixbuf::property_width | ( | ) | const |
The number of columns of the pixbuf.
Default value: 1
bool Gdk::Pixbuf::remove_option | ( | const Glib::ustring & | key | ) |
Removes the key/value pair option attached to a Gdk::Pixbuf
.
key | A nul-terminated string representing the key to remove. |
true
if an option was removed, false
if not. Glib::RefPtr< Gdk::Pixbuf > Gdk::Pixbuf::rotate_simple | ( | Rotation | angle | ) | const |
Rotates a pixbuf by a multiple of 90 degrees, and returns the result in a new pixbuf.
If angle
is 0, this function will return a copy of src
.
angle | The angle to rotate by. |
void Gdk::Pixbuf::saturate_and_pixelate | ( | const Glib::RefPtr< Gdk::Pixbuf > & | dest, |
float | saturation, | ||
bool | pixelate | ||
) | const |
Modifies saturation and optionally pixelates src
, placing the result in dest
.
The src
and dest
pixbufs must have the same image format, size, and rowstride.
The src
and dest
arguments 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 turns toward grayscale); if greater than 1.0, saturation is increased (the image gets more vivid colors).
If pixelate
is true
, then pixels are faded in a checkerboard pattern to create a pixelated image.
dest | Place to write modified version of src. |
saturation | Saturation factor. |
pixelate | Whether to pixelate. |
void Gdk::Pixbuf::save | ( | const std::string & | filename, |
const Glib::ustring & | type | ||
) | const |
Saves pixbuf to a file in format type.
By default, "jpeg", "png", "ico" and "bmp" are possible file formats to save in, but more formats may be installed. The list of all writable formats can be determined by using get_formats() with is_writable().
filename | The path of the file to be created. |
type | The file type. |
Glib::FileError | |
Gdk::PixbufError |
void Gdk::Pixbuf::save | ( | const std::string & | filename, |
const Glib::ustring & | type, | ||
const std::vector< Glib::ustring > & | option_keys, | ||
const std::vector< Glib::ustring > & | option_values | ||
) | const |
Saves pixbuf to a file in format type.
By default, "jpeg", "png", "ico" and "bmp" are possible file formats to save in, but more formats may be installed. TThe list of all writable formats can be determined by using get_formats() with Gdk::PixbufFormat::is_writable().
The option_keys and option_values, if not empty, should contain pairs of strings that modify the save parameters. For example, "quality", "100".
Currently only a few parameters exist. JPEG images can be saved with a "quality" parameter; its value should be in the range [0,100]. Text chunks can be attached to PNG images by specifying parameters of the form "tEXt::key", where key is an ASCII string of length 1-79. The values are UTF-8 encoded strings. ICO images can be saved in depth 16, 24, or 32, by using the "depth" parameter. When the ICO saver is given "x_hot" and "y_hot" parameters, it produces a CUR instead of an ICO.
filename | The path of the file to be created. |
type | The file type. |
option_keys | |
option_values |
Glib::FileError | |
Gdk::PixbufError |
void Gdk::Pixbuf::save_to_buffer | ( | gchar *& | buffer, |
gsize & | buffer_size, | ||
const Glib::ustring & | type, | ||
const std::vector< Glib::ustring > & | option_keys, | ||
const std::vector< Glib::ustring > & | option_values | ||
) | const |
Saves the pixbuf to a new buffer in format type.
Note that the buffer is not nul-terminated and may contain embedded nulls.
buffer | This will be set to the address of a new buffer. |
buffer_size | This will be set to the size of the buffer. |
type | Currently "jpeg", "png", "ico" or "bmp". |
option_keys | Names of options to set. |
option_values | Values for named options. |
Glib::FileError | |
Gdk::PixbufError |
void Gdk::Pixbuf::save_to_buffer | ( | gchar *& | buffer, |
gsize & | buffer_size, | ||
const Glib::ustring & | type = "png" |
||
) | const |
Saves the pixbuf to a new buffer in format type.
Note that the buffer is not nul-terminated and may contain embedded nulls.
buffer | This will be set to the address of a new buffer. |
buffer_size | This will be set to the size of the buffer. |
type | Currently "jpeg", "png", "ico" or "bmp". |
Glib::FileError | |
Gdk::PixbufError |
void Gdk::Pixbuf::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.
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.
If the source rectangle overlaps the destination rectangle on the same pixbuf, it will be overwritten during the scaling which results in rendering artifacts.
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). |
scale_x | The scale factor in the X direction. |
scale_y | The scale factor in the Y direction. |
interp_type | The interpolation type for the transformation. |
Glib::RefPtr< Gdk::Pixbuf > Gdk::Pixbuf::scale_simple | ( | int | dest_width, |
int | dest_height, | ||
InterpType | interp_type | ||
) | const |
Create a new pixbuf containing a copy of src
scaled to dest_width
x dest_height
.
This function leaves src
unaffected.
The interp_type
should be Gdk::InterpType::NEAREST
if you want maximum speed (but when scaling down Gdk::InterpType::NEAREST
is usually unusably ugly). The default interp_type
should be Gdk::InterpType::BILINEAR
which offers reasonable quality and speed.
You can scale a sub-portion of src
by creating a sub-pixbuf pointing into src
; see GdkPixbuf::Pixbuf::new_subpixbuf().
If dest_width
and dest_height
are equal to the width and height of src
, this function will return an unscaled copy of src
.
For more complicated scaling/alpha blending see GdkPixbuf::Pixbuf::scale() and GdkPixbuf::Pixbuf::composite().
dest_width | The width of destination image. |
dest_height | The height of destination image. |
interp_type | The interpolation type for the transformation. |
bool Gdk::Pixbuf::set_option | ( | const Glib::ustring & | key, |
const Glib::ustring & | value | ||
) |
Attaches a key/value pair as an option to a Gdk::Pixbuf
.
If key
already exists in the list of options attached to the pixbuf
, the new value is ignored and false
is returned.
key | A nul-terminated string. |
value | A nul-terminated string. |
true
on success.
|
related |
A Glib::wrap() method for this object.
object | The C instance. |
take_copy | False if the result should take ownership of the C instance. True if it should take a new copy or ref. |