3 #ifndef _GDKMM_PIXBUF_H
4 #define _GDKMM_PIXBUF_H
6 #include <gdkmmconfig.h>
9 #include <glibmm/ustring.h>
10 #include <sigc++/sigc++.h>
39 #include <giomm/inputstream.h>
42 #ifndef DOXYGEN_SHOULD_SKIP_THIS
43 typedef struct _GdkPixbuf GdkPixbuf;
44 typedef struct _GdkPixbufClass GdkPixbufClass;
48 #ifndef DOXYGEN_SHOULD_SKIP_THIS
50 {
class Pixbuf_Class; }
71 #ifndef DOXYGEN_SHOULD_SKIP_THIS
79 static GType value_type() G_GNUC_CONST;
104 #ifndef DOXYGEN_SHOULD_SKIP_THIS
112 static GType value_type() G_GNUC_CONST;
135 #ifndef DOXYGEN_SHOULD_SKIP_THIS
143 static GType value_type() G_GNUC_CONST;
168 #ifndef DOXYGEN_SHOULD_SKIP_THIS
176 static GType value_type() G_GNUC_CONST;
208 #ifndef DOXYGEN_SHOULD_SKIP_THIS
211 static void throw_func(GError* gobject);
220 #ifndef DOXYGEN_SHOULD_SKIP_THIS
225 class Value<
Gdk::PixbufError::Code> :
public Glib::Value_Enum<Gdk::PixbufError::Code>
228 static GType value_type() G_GNUC_CONST;
239 #ifndef DOXYGEN_SHOULD_SKIP_THIS
240 struct PixbufFormatTraits
242 typedef PixbufFormat CppType;
243 typedef const GdkPixbufFormat* CType;
244 typedef GdkPixbufFormat* CTypeNonConst;
246 static CType to_c_type (
const CppType& obj) {
return obj.gobj(); }
247 static CType to_c_type (CType ptr) {
return ptr; }
248 static CppType to_cpp_type (CType ptr) {
return PixbufFormat(ptr); }
249 static void release_c_type (CType ) { }
257 #ifndef DOXYGEN_SHOULD_SKIP_THIS
260 typedef Pixbuf CppObjectType;
262 typedef GdkPixbuf BaseObjectType;
263 typedef GdkPixbufClass BaseClassType;
266 static CppClassType pixbuf_class_;
274 explicit Pixbuf(
const Glib::ConstructParams& construct_params);
275 explicit Pixbuf(GdkPixbuf* castitem);
286 #ifndef DOXYGEN_SHOULD_SKIP_THIS
289 static GType get_base_type() G_GNUC_CONST;
293 GdkPixbuf*
gobj() {
return reinterpret_cast<GdkPixbuf*
>(gobject_); }
296 const GdkPixbuf*
gobj()
const {
return reinterpret_cast<GdkPixbuf*
>(gobject_); }
353 Pixbuf(
const Glib::RefPtr<Drawable>& src,
const Glib::RefPtr<Colormap>& cmap,
364 Pixbuf(
const Glib::RefPtr<Drawable>& src,
367 #ifndef GDKMM_DISABLE_DEPRECATED
370 Pixbuf(
const Glib::RefPtr<Drawable>& src,
const Glib::RefPtr<Colormap>& cmap,
371 int src_x,
int src_y,
int dest_x,
int dest_y,
int width,
int height);
384 Pixbuf(
const Glib::RefPtr<Image>& src,
const Glib::RefPtr<Colormap>& cmap,
398 #ifndef GDKMM_DISABLE_DEPRECATED
401 Pixbuf(
const Glib::RefPtr<Image>& src,
const Glib::RefPtr<Colormap>& cmap,
402 int src_x,
int src_y,
int dest_x,
int dest_y,
int width,
int height);
411 #ifndef GDKMM_DISABLE_DEPRECATED
414 static Glib::RefPtr<Gdk::Pixbuf>
create(
const Glib::RefPtr<Drawable>& src,
415 const Glib::RefPtr<Colormap>& cmap,
416 int src_x,
int src_y,
417 int dest_x,
int dest_y,
421 static Glib::RefPtr<Gdk::Pixbuf>
create(
const Glib::RefPtr<Image>& src,
422 const Glib::RefPtr<Colormap>& cmap,
423 int src_x,
int src_y,
424 int dest_x,
int dest_y,
476 static Glib::RefPtr<Pixbuf>
create(
const Glib::RefPtr<Drawable>& src,
const Glib::RefPtr<Colormap>& cmap,
int src_x,
int src_y,
int width,
int height);
488 static Glib::RefPtr<Pixbuf>
create(
const Glib::RefPtr<Drawable>& src,
int src_x,
int src_y,
int width,
int height);
501 static Glib::RefPtr<Pixbuf>
create(
const Glib::RefPtr<Image>& src,
const Glib::RefPtr<Colormap>& cmap,
int src_x,
int src_y,
int width,
int height);
513 static Glib::RefPtr<Pixbuf>
create(
const Glib::RefPtr<Image>& src,
int src_x,
int src_y,
int width,
int height);
516 Glib::RefPtr<Pixbuf>
copy()
const;
566 bool has_alpha,
int bits_per_sample,
584 bool has_alpha,
int bits_per_sample,
620 static Glib::RefPtr<Pixbuf>
create_from_inline(
int data_length,
const guint8* data,
bool copy_pixels =
false);
623 static Glib::RefPtr<Pixbuf>
create_from_stream(
const Glib::RefPtr<Gio::InputStream>& stream,
const Glib::RefPtr<Gio::Cancellable>& cancelable);
627 static Glib::RefPtr<Pixbuf>
create_from_stream_at_scale(
const Glib::RefPtr<Gio::InputStream>& stream,
int width,
int height,
bool preserve_aspect_ratio,
const Glib::RefPtr<Gio::Cancellable>& cancelable);
662 void save(
const std::string& filename,
const Glib::ustring& type);
687 void save(
const std::string& filename,
const Glib::ustring& type,
688 const Glib::StringArrayHandle& option_keys,
689 const Glib::StringArrayHandle& option_values);
727 const Glib::ustring& type =
"png");
741 const Glib::ustring& type,
742 const Glib::StringArrayHandle& option_keys,
743 const Glib::StringArrayHandle& option_values);
746 Glib::RefPtr<Gdk::Pixbuf>
add_alpha(
bool substitute_color, guint8 r, guint8 g, guint8 b)
const;
749 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;
755 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;
758 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;
761 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;
767 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;
772 Glib::RefPtr<Gdk::Pixbuf>
flip(
bool horizontal =
true)
const;
792 #ifndef GDKMM_DISABLE_DEPRECATED
823 void render_to_drawable(
const Glib::RefPtr<Drawable>& drawable,
const Glib::RefPtr<Gdk::GC>& gc,
int src_x,
int src_y,
int dest_x,
int dest_y,
int width,
int height,
RgbDither dither,
int x_dither,
int y_dither);
827 #ifndef GDKMM_DISABLE_DEPRECATED
854 void render_to_drawable_alpha(
const Glib::RefPtr<Drawable>& drawable,
int src_x,
int src_y,
int dest_x,
int dest_y,
int width,
int height,
PixbufAlphaMode alpha_mode,
int alpha_threshold,
RgbDither dither,
int x_dither,
int y_dither);
859 Glib::RefPtr<Pixmap>& pixmap_return,
860 Glib::RefPtr<Bitmap>& mask_return,
861 int alpha_threshold);
864 Glib::RefPtr<Bitmap>& mask_return,
int alpha_threshold);
904 Glib::RefPtr<Gdk::Pixbuf>
wrap(GdkPixbuf*
object,
bool take_copy =
false);
PixbufError(GError *gobject)
PixbufError(Code error_code, const Glib::ustring &error_message)
Glib::RefPtr< Gdk::Pixbuf > wrap(GdkPixbuf *object, bool take_copy=false)
void save_to_buffer(gchar *&buffer, gsize &buffer_size, const Glib::ustring &type, const Glib::StringArrayHandle &option_keys, const Glib::StringArrayHandle &option_values)
sigc::slot< void, const guint8 * > SlotDestroyData
void render_pixmap_and_mask(Glib::RefPtr< Pixmap > &pixmap_return, Glib::RefPtr< Bitmap > &mask_return, int alpha_threshold)
GdkPixbuf * gobj()
Provides access to the underlying C GObject.
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
Glib::RefPtr< Gdk::Pixbuf > rotate_simple(PixbufRotation angle) const
void render_to_drawable_alpha(const Glib::RefPtr< Drawable > &drawable, int src_x, int src_y, int dest_x, int dest_y, int width, int height, PixbufAlphaMode alpha_mode, int alpha_threshold, RgbDither dither, int x_dither, int y_dither)
static Glib::RefPtr< Pixbuf > create_from_file(const std::string &filename)
static GType get_type() G_GNUC_CONST
Pixbuf(const Glib::RefPtr< Drawable > &src, const Glib::RefPtr< Colormap > &cmap, int src_x, int src_y, int dest_x, int dest_y, int width, int height)
static Glib::RefPtr< Pixbuf > create_subpixbuf(const Glib::RefPtr< Pixbuf > &src_pixbuf, int src_x, int src_y, int width, int height)
void saturate_and_pixelate(const Glib::RefPtr< Gdk::Pixbuf > &dest, float saturation, bool pixelate) const
Pixbuf(const Glib::RefPtr< Image > &src, const Glib::RefPtr< Colormap > &cmap, int src_x, int src_y, int dest_x, int dest_y, int width, int height)
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
static Glib::RefPtr< Pixbuf > create(const Glib::RefPtr< Drawable > &src, int src_x, int src_y, int width, int height)
int get_rowstride() const
static Glib::RefPtr< Pixbuf > create_from_file(const std::string &filename, int width, int height, bool preserve_aspect_ratio=true)
static Glib::RefPtr< Gdk::Pixbuf > create(const Glib::RefPtr< Drawable > &src, const Glib::RefPtr< Colormap > &cmap, int src_x, int src_y, int dest_x, int dest_y, int width, int height)
static Glib::RefPtr< Pixbuf > 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)
Pixbuf(const Glib::RefPtr< Image > &src, const Glib::RefPtr< Colormap > &cmap, int src_x, int src_y, int width, int height)
static Glib::RefPtr< Pixbuf > create(const Glib::RefPtr< Drawable > &src, const Glib::RefPtr< Colormap > &cmap, int src_x, int src_y, int width, int height)
static Glib::RefPtr< Pixbuf > create_from_stream(const Glib::RefPtr< Gio::InputStream > &stream, const Glib::RefPtr< Gio::Cancellable > &cancelable)
Glib::RefPtr< Gdk::Pixbuf > scale_simple(int dest_width, int dest_height, InterpType interp_type) const
static Glib::RefPtr< Gdk::Pixbuf > create(const Glib::RefPtr< Image > &src, const Glib::RefPtr< Colormap > &cmap, int src_x, int src_y, int dest_x, int dest_y, int width, int height)
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
static Glib::RefPtr< Pixbuf > create_from_data(const guint8 *data, Colorspace colorspace, bool has_alpha, int bits_per_sample, int width, int height, int rowstride)
static Glib::RefPtr< Pixbuf > create(Colorspace colorspace, bool has_alpha, int bits_per_sample, int width, int height)
const GdkPixbuf * gobj() const
Provides access to the underlying C GObject.
int get_n_channels() const
static Glib::RefPtr< Pixbuf > create(const Glib::RefPtr< Image > &src, const Glib::RefPtr< Colormap > &cmap, int src_x, int src_y, int width, int height)
void save(const std::string &filename, const Glib::ustring &type, const Glib::StringArrayHandle &option_keys, const Glib::StringArrayHandle &option_values)
static Glib::RefPtr< Pixbuf > create_from_stream_at_scale(const Glib::RefPtr< Gio::InputStream > &stream, int width, int height, bool preserve_aspect_ratio)
static SListHandle_PixbufFormat get_formats()
Glib::RefPtr< Pixbuf > copy() const
void render_to_drawable(const Glib::RefPtr< Drawable > &drawable, const Glib::RefPtr< Gdk::GC > &gc, int src_x, int src_y, int dest_x, int dest_y, int width, int height, RgbDither dither, int x_dither, int y_dither)
static Glib::RefPtr< Pixbuf > create_from_inline(int data_length, const guint8 *data, bool copy_pixels=false)
Pixbuf(const Glib::RefPtr< Drawable > &src, int src_x, int src_y, int width, int height)
Pixbuf(const Glib::RefPtr< Drawable > &src, const Glib::RefPtr< Colormap > &cmap, int src_x, int src_y, int width, int height)
GdkPixbuf * gobj_copy()
Provides access to the underlying C instance. The caller is responsible for unrefing it....
int get_bits_per_sample() const
void save_to_buffer(gchar *&buffer, gsize &buffer_size, const Glib::ustring &type="png")
static Glib::RefPtr< Pixbuf > create_from_xpm_data(const char *const *data)
void save(const std::string &filename, const Glib::ustring &type)
Glib::RefPtr< Gdk::Pixbuf > add_alpha(bool substitute_color, guint8 r, guint8 g, guint8 b) const
static Glib::RefPtr< Pixbuf > create_from_stream_at_scale(const Glib::RefPtr< Gio::InputStream > &stream, int width, int height, bool preserve_aspect_ratio, const Glib::RefPtr< Gio::Cancellable > &cancelable)
bool get_has_alpha() const
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
Glib::RefPtr< Gdk::Pixbuf > flip(bool horizontal=true) const
void render_threshold_alpha(const Glib::RefPtr< Gdk::Bitmap > &bitmap, int src_x, int src_y, int dest_x, int dest_y, int width, int height, int alpha_threshold)
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
static Glib::RefPtr< Pixbuf > create(const Glib::RefPtr< Image > &src, int src_x, int src_y, int width, int height)
static Glib::RefPtr< Pixbuf > create_from_stream(const Glib::RefPtr< Gio::InputStream > &stream)
guint8 * get_pixels() const
Glib::ustring get_option(const Glib::ustring &key) const
Pixbuf(const Glib::RefPtr< Image > &src, int src_x, int src_y, int width, int height)
Glib::SListHandle< Glib::RefPtr< PixbufFormat >, PixbufFormatTraits > SListHandle_PixbufFormat
Colorspace get_colorspace() const
void render_pixmap_and_mask_for_colormap(const Glib::RefPtr< Colormap > &colormap, Glib::RefPtr< Pixmap > &pixmap_return, Glib::RefPtr< Bitmap > &mask_return, int alpha_threshold)