1 // -*- c++ -*-
2 // Generated by gmmproc 2.45.3 -- DO NOT MODIFY!
3 #ifndef _GDKMM_PIXBUF_H
4 #define _GDKMM_PIXBUF_H
5 
6 #include <gdkmmconfig.h>
7 
8 
9 #include <glibmm/ustring.h>
10 #include <sigc++/sigc++.h>
11 
12 /* Copyright (C) 1998-2002 The gtkmm Development Team
13  *
14  * This library is free software; you can redistribute it and/or
15  * modify it under the terms of the GNU Lesser General Public
16  * License as published by the Free Software Foundation; either
17  * version 2.1 of the License, or (at your option) any later version.
18  *
19  * This library is distributed in the hope that it will be useful,
20  * but WITHOUT ANY WARRANTY; without even the implied warranty of
21  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
22  * Lesser General Public License for more details.
23  *
24  * You should have received a copy of the GNU Lesser General Public
25  * License along with this library; if not, write to the Free
26  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
27  */
28 
29  // This is for including the config header before any code (such as
30 // the #ifndef GDKMM_DISABLE_DEPRECATED in deprecated classes) is generated:
31 
32 
33 #include <gdkmm/drawable.h>
34 #include <gdkmm/image.h>
35 #include <gdkmm/pixmap.h>
36 #include <gdkmm/bitmap.h>
37 #include <gdkmm/pixbufformat.h>
38 #include <gdkmm/types.h>
39 #include <giomm/inputstream.h>
40 
41 
42 #ifndef DOXYGEN_SHOULD_SKIP_THIS
43 typedef struct _GdkPixbuf GdkPixbuf;
44 typedef struct _GdkPixbufClass GdkPixbufClass;
45 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
46 
47 
48 #ifndef DOXYGEN_SHOULD_SKIP_THIS
49 namespace Gdk
50 { class Pixbuf_Class; } // namespace Gdk
51 #endif //DOXYGEN_SHOULD_SKIP_THIS
52 
53 namespace Gdk
54 {
55 
56 
57 /** @addtogroup gdkmmEnums gdkmm Enums and Flags */
58 
59 /**
60  *
61  * @ingroup gdkmmEnums
62  */
63 enum Colorspace
64 {
65   COLORSPACE_RGB
66 };
67 
68 } // namespace Gdk
69 
70 
71 #ifndef DOXYGEN_SHOULD_SKIP_THIS
72 namespace Glib
73 {
74 
75 template <>
76 class Value<Gdk::Colorspace> : public Glib::Value_Enum<Gdk::Colorspace>
77 {
78 public:
79   static GType value_type() G_GNUC_CONST;
80 };
81 
82 } // namespace Glib
83 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
84 
85 
86 namespace Gdk
87 {
88 
89 /**
90  *
91  * @ingroup gdkmmEnums
92  */
93 enum InterpType
94 {
95   INTERP_NEAREST,
96   INTERP_TILES,
97   INTERP_BILINEAR,
98   INTERP_HYPER
99 };
100 
101 } // namespace Gdk
102 
103 
104 #ifndef DOXYGEN_SHOULD_SKIP_THIS
105 namespace Glib
106 {
107 
108 template <>
109 class Value<Gdk::InterpType> : public Glib::Value_Enum<Gdk::InterpType>
110 {
111 public:
112   static GType value_type() G_GNUC_CONST;
113 };
114 
115 } // namespace Glib
116 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
117 
118 
119 namespace Gdk
120 {
121 
122 /**
123  *
124  * @ingroup gdkmmEnums
125  */
126 enum PixbufAlphaMode
127 {
128   PIXBUF_ALPHA_BILEVEL,
129   PIXBUF_ALPHA_FULL
130 };
131 
132 } // namespace Gdk
133 
134 
135 #ifndef DOXYGEN_SHOULD_SKIP_THIS
136 namespace Glib
137 {
138 
139 template <>
140 class Value<Gdk::PixbufAlphaMode> : public Glib::Value_Enum<Gdk::PixbufAlphaMode>
141 {
142 public:
143   static GType value_type() G_GNUC_CONST;
144 };
145 
146 } // namespace Glib
147 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
148 
149 
150 namespace Gdk
151 {
152 
153 /**
154  *
155  * @ingroup gdkmmEnums
156  */
157 enum PixbufRotation
158 {
159   PIXBUF_ROTATE_NONE = 0,
160   PIXBUF_ROTATE_COUNTERCLOCKWISE = 90,
161   PIXBUF_ROTATE_UPSIDEDOWN = 180,
162   PIXBUF_ROTATE_CLOCKWISE = 270
163 };
164 
165 } // namespace Gdk
166 
167 
168 #ifndef DOXYGEN_SHOULD_SKIP_THIS
169 namespace Glib
170 {
171 
172 template <>
173 class Value<Gdk::PixbufRotation> : public Glib::Value_Enum<Gdk::PixbufRotation>
174 {
175 public:
176   static GType value_type() G_GNUC_CONST;
177 };
178 
179 } // namespace Glib
180 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
181 
182 
183 namespace Gdk
184 {
185 
186 
187 /** Exception class for Gdk::Pixbuf errors.
188  */
189 class PixbufError : public Glib::Error
190 {
191 public:
192   /**
193    */
194   enum Code
195   {
196     CORRUPT_IMAGE,
197     INSUFFICIENT_MEMORY,
198     BAD_OPTION,
199     UNKNOWN_TYPE,
200     UNSUPPORTED_OPERATION,
201     FAILED
202   };
203 
204   PixbufError(Code error_code, const Glib::ustring& error_message);
205   explicit PixbufError(GError* gobject);
206   Code code() const;
207 
208 #ifndef DOXYGEN_SHOULD_SKIP_THIS
209 private:
210 
211   static void throw_func(GError* gobject);
212 
213   friend void wrap_init(); // uses throw_func()
214 
215   #endif //DOXYGEN_SHOULD_SKIP_THIS
216 };
217 
218 } // namespace Gdk
219 
220 #ifndef DOXYGEN_SHOULD_SKIP_THIS
221 namespace Glib
222 {
223 
224 template <>
225 class Value<Gdk::PixbufError::Code> : public Glib::Value_Enum<Gdk::PixbufError::Code>
226 {
227 public:
228   static GType value_type() G_GNUC_CONST;
229 };
230 
231 } // namespace Glib
232 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
233 
234 
235 namespace Gdk
236 {
237 
238 
239 #ifndef DOXYGEN_SHOULD_SKIP_THIS
240 struct PixbufFormatTraits
241 {
242   typedef PixbufFormat  CppType;
243   typedef const GdkPixbufFormat*      CType;
244   typedef GdkPixbufFormat*            CTypeNonConst;
245 
to_c_typePixbufFormatTraits246   static CType   to_c_type      (const CppType& obj) { return obj.gobj();     }
to_c_typePixbufFormatTraits247   static CType   to_c_type      (CType          ptr) { return ptr;                   }
to_cpp_typePixbufFormatTraits248   static CppType to_cpp_type    (CType          ptr) { return PixbufFormat(ptr); /* Does not take ownership */ }
release_c_typePixbufFormatTraits249   static void    release_c_type (CType          /* ptr */) { /* Doesn't happen */ }
250 };
251 #endif //DOXYGEN_SHOULD_SKIP_THIS
252 
253 
254 class Pixbuf : public Glib::Object
255 {
256 
257 #ifndef DOXYGEN_SHOULD_SKIP_THIS
258 
259 public:
260   typedef Pixbuf CppObjectType;
261   typedef Pixbuf_Class CppClassType;
262   typedef GdkPixbuf BaseObjectType;
263   typedef GdkPixbufClass BaseClassType;
264 
265 private:  friend class Pixbuf_Class;
266   static CppClassType pixbuf_class_;
267 
268 private:
269   // noncopyable
270   Pixbuf(const Pixbuf&);
271   Pixbuf& operator=(const Pixbuf&);
272 
273 protected:
274   explicit Pixbuf(const Glib::ConstructParams& construct_params);
275   explicit Pixbuf(GdkPixbuf* castitem);
276 
277 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
278 
279 public:
280   virtual ~Pixbuf();
281 
282   /** Get the GType for this class, for use with the underlying GObject type system.
283    */
284   static GType get_type()      G_GNUC_CONST;
285 
286 #ifndef DOXYGEN_SHOULD_SKIP_THIS
287 
288 
289   static GType get_base_type() G_GNUC_CONST;
290 #endif
291 
292   ///Provides access to the underlying C GObject.
gobj()293   GdkPixbuf*       gobj()       { return reinterpret_cast<GdkPixbuf*>(gobject_); }
294 
295   ///Provides access to the underlying C GObject.
gobj()296   const GdkPixbuf* gobj() const { return reinterpret_cast<GdkPixbuf*>(gobject_); }
297 
298   ///Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.
299   GdkPixbuf* gobj_copy();
300 
301 private:
302 
303   //gtkmmproc error: gdk_pixbuf_ref : ignored method defs lookup failed//gtkmmproc error: gdk_pixbuf_unref : ignored method defs lookup failed
304 
305 protected:
306 
307   /** Creates a pixbuf object from a drawable.
308    *
309    * Transfers image data from a Drawable and converts it to an RGB(A)
310    * representation inside a Pixbuf. In other words, copies
311    * image data from a server-side drawable to a client-side RGB(A) buffer.
312    * This allows you to efficiently read individual pixels on the client side.
313    *
314    * If the drawable @src has no colormap (See Gdk::Drawable::get_colormap()),
315    * then a suitable colormap must be specified. Otherwise, you may use the
316    * constructor that takes no colormap argument.
317    * Typically a Gdk::Window or a pixmap created by passing a Gdk:Window
318    * to the Gdk::Pixbuf constructor will already have a colormap associated with
319    * it.  If the drawable is a bitmap (1 bit per pixel pixmap),
320    * then a colormap is not required; pixels with a value of 1 are
321    * assumed to be white, and pixels with a value of 0 are assumed to be
322    * black. For taking screenshots, Gdk::Colormap::get_system() returns
323    * the correct colormap to use.
324    *
325    * This will create an RGB pixbuf with 8 bits per channel and no
326    * alpha, with the same size specified by the @a width and @a height
327    * arguments.
328    *
329    * If the specified drawable is a pixmap, then the requested source
330    * rectangle must be completely contained within the pixmap, otherwise
331    * the constructor will fail. For pixmaps only (not for windows)
332    * passing -1 for width or height is allowed to mean the full width
333    * or height of the pixmap.
334    *
335    * If the specified drawable is a window, and the window is off the
336    * screen, then there is no image data in the obscured/offscreen
337    * regions to be placed in the pixbuf. The contents of portions of the
338    * pixbuf corresponding to the offscreen region are undefined.
339    *
340    * If the window you're obtaining data from is partially obscured by
341    * other windows, then the contents of the pixbuf areas corresponding
342    * to the obscured regions are undefined.
343    *
344    * See alo Gdk::Drawable::get_image().
345    *
346    * @param src Source drawable.
347    * @param cmap: A colormap.
348    * @param src_x Source X coordinate within drawable.
349    * @param src_y Source Y coordinate within drawable.
350    * @param width Width in pixels of region to get.
351    * @param height Height in pixels of region to get.
352    *
353    * @newin{2,12}
354    */
355    Pixbuf(const Glib::RefPtr<Drawable>& src, const Glib::RefPtr<Colormap>& cmap,
356          int src_x, int src_y, int width, int height);
357 
358   /** Creates a pixbuf object from a drawable, using the colormap from the drawable.
359    *
360    * @param src Source drawable.
361    * @param src_x Source X coordinate within drawable.
362    * @param src_y Source Y coordinate within drawable.
363    * @param width Width in pixels of region to get.
364    * @param height Height in pixels of region to get.
365    *
366    * @newin{2,12}
367    */
368    Pixbuf(const Glib::RefPtr<Drawable>& src,
369          int src_x, int src_y, int width, int height);
370 
371   #ifndef GDKMM_DISABLE_DEPRECATED
372 
373    /// @deprecated Use the constructor without dest_x and dest_y parameters.
374    Pixbuf(const Glib::RefPtr<Drawable>& src, const Glib::RefPtr<Colormap>& cmap,
375          int src_x, int src_y, int dest_x, int dest_y, int width, int height);
376   #endif // GDKMM_DISABLE_DEPRECATED
377 
378 
379   /** Creates a pixbuf object from an image.
380    *
381    * @param src Source Image.
382    * @param cmap A colormap.
383    * @param src_x Source X coordinate within the image.
384    * @param src_y Source Y coordinate within the image.
385    * @param width Width in pixels of region to get.
386    * @param height Height in pixels of region to get.
387    *
388    * @newin{2,12}
389    */
390   Pixbuf(const Glib::RefPtr<Image>& src, const Glib::RefPtr<Colormap>& cmap,
391          int src_x, int src_y, int width, int height);
392 
393   /** Creates a pixbuf object from an image, using the colormap from the image.
394    *
395    * @param src Source Image.
396    * @param src_x Source X coordinate within the image.
397    * @param src_y Source Y coordinate within the image.
398    * @param width Width in pixels of region to get.
399    * @param height Height in pixels of region to get.
400    *
401    * @newinp212
402    */
403   Pixbuf(const Glib::RefPtr<Image>& src,
404          int src_x, int src_y, int width, int height);
405 
406   #ifndef GDKMM_DISABLE_DEPRECATED
407 
408   /// @deprecated Use the constructors without dest_x and dest_y parameters.
409   Pixbuf(const Glib::RefPtr<Image>& src, const Glib::RefPtr<Colormap>& cmap,
410          int src_x, int src_y, int dest_x, int dest_y, int width, int height);
411   #endif // GDKMM_DISABLE_DEPRECATED
412 
413 
414 public:
415   typedef sigc::slot<void, const guint8*> SlotDestroyData;
416 
417   // Hand-coded so the implementation in the .ccg is also only
418   // built when GDKMM_DISABLE_DEPRECATED is defined.
419   #ifndef GDKMM_DISABLE_DEPRECATED
420 
421   /** @deprecated Use the create() methods that don't have the unused dest_x and dest_y parameters. */
422   static Glib::RefPtr<Gdk::Pixbuf> create(const Glib::RefPtr<Drawable>& src,
423                                           const Glib::RefPtr<Colormap>& cmap,
424                                           int src_x, int src_y,
425                                           int dest_x, int dest_y,
426                                           int width, int height);
427 
428   /** @deprecated Use the create() methods that that don't have the unused dest_x and dest_y parameters. */
429   static Glib::RefPtr<Gdk::Pixbuf> create(const Glib::RefPtr<Image>& src,
430                                           const Glib::RefPtr<Colormap>& cmap,
431                                           int src_x, int src_y,
432                                           int dest_x, int dest_y,
433                                           int width, int height);
434   #endif // GDKMM_DISABLE_DEPRECATED
435 
436 
437   /** Creates a pixbuf object from a drawable.
438    *
439    * Transfers image data from a Drawable and converts it to an RGB(A)
440    * representation inside a Pixbuf. In other words, copies
441    * image data from a server-side drawable to a client-side RGB(A) buffer.
442    * This allows you to efficiently read individual pixels on the client side.
443    *
444    * If the drawable @src has no colormap (See Gdk::Drawable::get_colormap()),
445    * then a suitable colormap must be specified. Otherwise, you may use the
446    * constructor that takes no colormap argument.
447    * Typically a Gdk::Window or a pixmap created by passing a Gdk:Window
448    * to the Gdk::Pixbuf constructor will already have a colormap associated with
449    * it.  If the drawable is a bitmap (1 bit per pixel pixmap),
450    * then a colormap is not required; pixels with a value of 1 are
451    * assumed to be white, and pixels with a value of 0 are assumed to be
452    * black. For taking screenshots, Gdk::Colormap::get_system() returns
453    * the correct colormap to use.
454    *
455    * This will create an RGB pixbuf with 8 bits per channel and no
456    * alpha, with the same size specified by the @a width and @a height
457    * arguments.
458    *
459    * If the specified drawable is a pixmap, then the requested source
460    * rectangle must be completely contained within the pixmap, otherwise
461    * the constructor will fail. For pixmaps only (not for windows)
462    * passing -1 for width or height is allowed to mean the full width
463    * or height of the pixmap.
464    *
465    * If the specified drawable is a window, and the window is off the
466    * screen, then there is no image data in the obscured/offscreen
467    * regions to be placed in the pixbuf. The contents of portions of the
468    * pixbuf corresponding to the offscreen region are undefined.
469    *
470    * If the window you're obtaining data from is partially obscured by
471    * other windows, then the contents of the pixbuf areas corresponding
472    * to the obscured regions are undefined.
473    *
474    * See alo Gdk::Drawable::get_image().
475    *
476    * @param src Source drawable.
477    * @param cmap: A colormap.
478    * @param src_x Source X coordinate within drawable.
479    * @param src_y Source Y coordinate within drawable.
480    * @param width Width in pixels of region to get.
481    * @param height Height in pixels of region to get.
482    *
483    * @newin{2,12}
484    */
485 
486   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);
487 
488 
489   /** Creates a pixbuf object from a drawable, using the colormap from the drawable.
490    *
491    * @param src Source drawable.
492    * @param src_x Source X coordinate within drawable.
493    * @param src_y Source Y coordinate within drawable.
494    * @param width Width in pixels of region to get.
495    * @param height Height in pixels of region to get.
496    *
497    * @newin{2,12}
498    */
499 
500   static Glib::RefPtr<Pixbuf> create(const Glib::RefPtr<Drawable>& src, int src_x, int src_y, int width, int height);
501 
502 
503   /** Creates a pixbuf object from an image.
504    *
505    * @param src Source Image.
506    * @param cmap A colormap.
507    * @param src_x Source X coordinate within the image.
508    * @param src_y Source Y coordinate within the image.
509    * @param width Width in pixels of region to get.
510    * @param height Height in pixels of region to get.
511    *
512    * @newin{2,12}
513    */
514 
515   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);
516 
517 
518   /** Creates a pixbuf object from an image, using the colormap from the image.
519    *
520    * @param src Source Image.
521    * @param src_x Source X coordinate within the image.
522    * @param src_y Source Y coordinate within the image.
523    * @param width Width in pixels of region to get.
524    * @param height Height in pixels of region to get.
525    *
526    * @newinp212
527    */
528 
529   static Glib::RefPtr<Pixbuf> create(const Glib::RefPtr<Image>& src, int src_x, int src_y, int width, int height);
530 
531 
532   Glib::RefPtr<Pixbuf> copy() const;
533 
534 
535   static Glib::RefPtr<Pixbuf> create(Colorspace colorspace, bool has_alpha, int bits_per_sample, int width, int height);
536 
537 
538   /** @param src_pixbuf A Gdk::Pixbuf.
539    * @param src_x X coord in @a src_pixbuf.
540    * @param src_y Y coord in @a src_pixbuf.
541    * @param width Width of region in @a src_pixbuf.
542    * @param height Height of region in @a src_pixbuf.
543    */
544   static Glib::RefPtr<Pixbuf> create_subpixbuf(const Glib::RefPtr<Pixbuf>& src_pixbuf, int src_x, int src_y, int width, int height);
545 
546 
547   /** Creates a new pixbuf by loading an image from a file. The file format is detected automatically.
548    * @param filename The path to the pixbuf file.
549    *
550    * @throw Glib::FileError
551    * @throw Gdk::PixbufError
552    */
553   static Glib::RefPtr<Pixbuf> create_from_file(const std::string& filename);
554 
555 
556   /** Creates a new pixbuf by loading an image from a file. The file format is detected automatically.
557    * The image will be scaled to fit in the requested size.
558    * @param filename The path to the pixbuf file.
559    * @param width The desired width
560    * @param height The desired height
561    * @param preserve_aspect_ratio: Whether the image's aspect ratio will be preserved when scaling.
562    *
563    * @throw Glib::FileError
564    * @throw Gdk::PixbufError
565    */
566   static Glib::RefPtr<Pixbuf> create_from_file(const std::string& filename, int width, int height, bool preserve_aspect_ratio =  true);
567    //gdk_pixbuf_new_from_file_at_size() just calls gdk_pixbuf_new_from_file_at_scale().
568 
569   /** Creates a new Gdk::Pixbuf out of in-memory image data.
570    * Currently only RGB images with 8 bits per sample are supported.
571    *
572    * @param data %Image data in 8-bit/sample packed format.
573    * @param colorspace Colorspace for the image data.
574    * @param has_alpha Whether the data has an opacity channel.
575    * @param bits_per_sample Number of bits per sample.
576    * @param width Width of the image in pixels.
577    * @param height Height of the image in pixels.
578    * @param rowstride Distance in bytes between rows.
579    * @return A newly-created Gdk::Pixbuf object.
580    */
581   static Glib::RefPtr<Pixbuf> create_from_data(const guint8* data, Colorspace colorspace,
582                                                bool has_alpha, int bits_per_sample,
583                                                int width, int height, int rowstride);
584 
585   /** Creates a new Gdk::Pixbuf out of in-memory image data.
586    * Currently only RGB images with 8 bits per sample are supported.
587    *
588    * @param data %Image data in 8-bit/sample packed format.
589    * @param colorspace Colorspace for the image data.
590    * @param has_alpha Whether the data has an opacity channel.
591    * @param bits_per_sample Number of bits per sample.
592    * @param width Width of the image in pixels.
593    * @param height Height of the image in pixels.
594    * @param rowstride Distance in bytes between rows.
595    * @param destroy_slot Slot used to free the data when the pixbuf's
596    * reference count drops to zero.
597    * @return A newly-created Gdk::Pixbuf object.
598    */
599   static Glib::RefPtr<Pixbuf> create_from_data(const guint8* data, Colorspace colorspace,
600                                                bool has_alpha, int bits_per_sample,
601                                                int width, int height, int rowstride,
602                                                const SlotDestroyData& destroy_slot);
603 
604 
605   static Glib::RefPtr<Pixbuf> create_from_xpm_data(const char *const * data);
606 
607 
608   /** Create a Gdk::Pixbuf from a flat representation that is suitable for
609    * storing as inline data in a program.  This is useful if you want to ship a
610    * program with images, but don't want to depend on any external files.
611    *
612    * GTK+ ships with a program called <tt>gdk-pixbuf-csource</tt> which allows
613    * for conversion of GdkPixbufs into such a inline representation. In almost
614    * all cases, you should pass the <tt>--raw</tt> flag to
615    * <tt>gdk-pixbuf-csource</tt>. A sample invocation would be:
616    *
617    * <tt>gdk-pixbuf-csource --raw --name=myimage_inline myimage.png</tt>
618    *
619    * For the typical case where the inline pixbuf is read-only static data, you
620    * don't need to copy the pixel data unless you intend to write to it, so you
621    * can pass <tt>false</tt> for @a copy_pixels. (If you pass <tt>--rle</tt> to
622    * <tt>gdk-pixbuf-csource</tt>, a copy will be made even if @a copy_pixels is
623    * <tt>false</tt>, so using this option is generally a bad idea.)
624    *
625    * If you create a pixbuf from const inline data compiled into your program,
626    * it's probably safe to ignore errors, since things will always succeed. For
627    * non-const inline data, you could get out of memory. For untrusted inline
628    * data located at runtime, you could have corrupt inline data in addition.
629    *
630    * @param data_length Length in bytes of the @a data argument.
631    * @param data Byte data containing a serialized GdkPixdata structure.
632    * @param copy_pixels Whether to copy the pixel data, or use direct pointers
633    * to @a data for the resulting pixbuf.
634    * @throw Gdk::PixbufError
635    */
636   static Glib::RefPtr<Pixbuf> create_from_inline(int data_length, const guint8* data, bool copy_pixels =  false);
637 
638 
639   static Glib::RefPtr<Pixbuf> create_from_stream(const Glib::RefPtr<Gio::InputStream>& stream, const Glib::RefPtr<Gio::Cancellable>& cancelable);
640   static Glib::RefPtr<Pixbuf> create_from_stream(const Glib::RefPtr<Gio::InputStream>& stream);
641 
642 
643   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);
644   static Glib::RefPtr<Pixbuf> create_from_stream_at_scale(const Glib::RefPtr<Gio::InputStream>& stream, int width, int height, bool preserve_aspect_ratio);
645 
646 
647   Colorspace get_colorspace() const;
648 
649 
650   int get_n_channels() const;
651 
652   bool get_has_alpha() const;
653 
654   int get_bits_per_sample() const;
655 
656   guint8* get_pixels() const;
657 
658   int get_width() const;
659 
660   int get_height() const;
661 
662   int get_rowstride() const;
663 
664 
665   void fill(guint32 pixel);
666 
667   /** Saves pixbuf to a file in format @a type.
668    * By default, "jpeg", "png", "ico" and "bmp" are possible file formats to save in, but more formats may be installed.
669    * The list of all writable formats can be determined by using get_formats() with
670    * is_writable().
671    *
672    * @param filename The path of the file to be created.
673    * @param type The file type.
674    *
675    * @throw Glib::FileError
676    * @throw Gdk::PixbufError
677    */
678   void save(const std::string& filename, const Glib::ustring& type);
679 
680 
681   /** Saves pixbuf to a file in format @a type.
682    * By default, "jpeg", "png", "ico" and "bmp" are possible file formats to save in, but more formats may be installed.
683    * TThe list of all writable formats can be determined by using get_formats() with
684    * Gdk::PixbufFormat::is_writable().
685    *
686    * The @a option_keys and @option_values, if not empty, should contain pairs of strings that modify the save parameters.
687    * For example,  "quality", "100".
688    *
689    * Currently only a few parameters exist. JPEG images can be saved with a "quality" parameter;
690    * its value should be in the range [0,100]. Text chunks can be attached to PNG images by specifying parameters of the
691    * form "tEXt::key", where key is an ASCII string of length 1-79. The values are UTF-8 encoded strings. ICO images can be
692    * saved in depth 16, 24, or 32, by using the "depth" parameter. When the ICO saver is given "x_hot" and "y_hot"
693    * parameters, it produces a CUR instead of an ICO.
694    *
695    * @param filename The path of the file to be created.
696    * @param type The file type.
697    * @param option_keys
698    * @param option_values
699    *
700    * @throw Glib::FileError
701    * @throw Gdk::PixbufError
702    */
703   void save(const std::string& filename, const Glib::ustring& type,
704             const Glib::StringArrayHandle& option_keys,
705             const Glib::StringArrayHandle& option_values);
706 
707 
708 /* TODO:
709 typedef gboolean (*GdkPixbufSaveFunc)   (const gchar *buf,
710 					 gsize count,
711 					 GError **error,
712 					 gpointer data);
713 
714 gboolean gdk_pixbuf_save_to_callback    (GdkPixbuf  *pixbuf,
715 					 GdkPixbufSaveFunc save_func,
716 					 gpointer user_data,
717 					 const char *type,
718 					 GError    **error,
719 					 ...);
720 
721 gboolean gdk_pixbuf_save_to_callbackv   (GdkPixbuf  *pixbuf,
722 					 GdkPixbufSaveFunc save_func,
723 					 gpointer user_data,
724 					 const char *type,
725 					 char      **option_keys,
726 					 char      **option_values,
727 					 GError    **error);
728 
729 */
730 
731   /* Saves the pixbuf to a new buffer in format @a type.
732    * Note that the buffer is not nul-terminated and may contain embedded nulls.
733    * @see save().
734    *
735    * @param buffer This will be set to the address of a new buffer.
736    * @param size This will be set to the size of the @a buffer.
737    * @param type Currently "jpeg", "png", "ico" or "bmp".
738    *
739    * @throw Glib::FileError
740    * @throw Gdk::PixbufError
741    */
742   void save_to_buffer(gchar*& buffer, gsize& buffer_size,
743                       const Glib::ustring& type = "png");
744 
745   /* Saves the pixbuf to a new buffer in format @a type.
746    * Note that the buffer is not nul-terminated and may contain embedded nulls.
747    * @see save().
748    *
749    * @param buffer This will be set to the address of a new buffer.
750    * @param size This will be set to the size of the @a buffer.
751    * @param type Currently "jpeg", "png", "ico" or "bmp".
752    *
753    * @throw Glib::FileError
754    * @throw Gdk::PixbufError
755    */
756   void save_to_buffer(gchar*& buffer, gsize& buffer_size,
757                       const Glib::ustring& type,
758                       const Glib::StringArrayHandle& option_keys,
759                       const Glib::StringArrayHandle& option_values);
760 
761 
762   Glib::RefPtr<Gdk::Pixbuf> add_alpha(bool substitute_color, guint8 r, guint8 g, guint8 b) const;
763 
764 
765   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;
766 
767 
768   void saturate_and_pixelate(const Glib::RefPtr<Gdk::Pixbuf>& dest, float saturation, bool pixelate) const;
769 
770 
771   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;
772 
773 
774   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;
775 
776 
777   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;
778 
779 
780   Glib::RefPtr<Gdk::Pixbuf> scale_simple(int dest_width, int dest_height, InterpType interp_type) const;
781 
782 
783   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;
784 
785 
786   Glib::RefPtr<Gdk::Pixbuf> rotate_simple(PixbufRotation angle) const;
787 
788   Glib::RefPtr<Gdk::Pixbuf> flip(bool horizontal =  true) const;
789 
790 
791   /** Takes the opacity values in a rectangular portion of a pixbuf and thresholds
792    * them to produce a bi-level alpha mask that can be used as a clipping mask for
793    * a drawable.
794    *
795    * @param bitmap Bitmap where the bilevel mask will be painted to.
796    * @param src_x Source X coordinate.
797    * @param src_y Source Y coordinate.
798    * @param dest_x Destination X coordinate.
799    * @param dest_y Destination Y coordinate.
800    * @param width Width of region to threshold, or -1 to use pixbuf width.
801    * @param height Height of region to threshold, or -1 to use pixbuf height.
802    * @param alpha_threshold Opacity values below this will be painted as zero; all
803    * other values will be painted as one.
804    */
805   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);
806 
807 
808 #ifndef GDKMM_DISABLE_DEPRECATED
809 
810   /** Renders a rectangular portion of a pixbuf to a drawable while using the
811    * specified GC.  This is done using GdkRGB, so the specified drawable must have
812    * the GdkRGB visual and colormap.  Note that this function will ignore the
813    * opacity information for images with an alpha channel; the GC must already
814    * have the clipping mask set if you want transparent regions to show through.
815    *
816    * For an explanation of dither offsets, see the GdkRGB documentation.  In
817    * brief, the dither offset is important when re-rendering partial regions of an
818    * image to a rendered version of the full image, or for when the offsets to a
819    * base position change, as in scrolling.  The dither matrix has to be shifted
820    * for consistent visual results.  If you do not have any of these cases, the
821    * dither offsets can be both zero.
822    *
823    * Deprecated: 2.4: This function is obsolete. Use gdk_draw_pixbuf() instead.
824    *
825    * @deprecated Use Gdk::Drawable::draw_pixbuf() instead.
826    *
827    * @param drawable Destination drawable.
828    * @param gc GC used for rendering.
829    * @param src_x Source X coordinate within pixbuf.
830    * @param src_y Source Y coordinate within pixbuf.
831    * @param dest_x Destination X coordinate within drawable.
832    * @param dest_y Destination Y coordinate within drawable.
833    * @param width Width of region to render, in pixels, or -1 to use pixbuf width.
834    * @param height Height of region to render, in pixels, or -1 to use pixbuf height.
835    * @param dither Dithering mode for GdkRGB.
836    * @param x_dither X offset for dither.
837    * @param y_dither Y offset for dither.
838    */
839   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);
840 #endif // GDKMM_DISABLE_DEPRECATED
841 
842 
843 #ifndef GDKMM_DISABLE_DEPRECATED
844 
845   /** Renders a rectangular portion of a pixbuf to a drawable.  The destination
846    * drawable must have a colormap. All windows have a colormap, however, pixmaps
847    * only have colormap by default if they were created with a non-<tt>0</tt> window argument.
848    * Otherwise a colormap must be set on them with gdk_drawable_set_colormap.
849    *
850    * On older X servers, rendering pixbufs with an alpha channel involves round trips
851    * to the X server, and may be somewhat slow.
852    *
853    * Deprecated: 2.4: This function is obsolete. Use gdk_draw_pixbuf() instead.
854    *
855    * @deprecated Use Gdk::Drawable::draw_pixbuf() instead.
856    *
857    * @param drawable Destination drawable.
858    * @param src_x Source X coordinate within pixbuf.
859    * @param src_y Source Y coordinates within pixbuf.
860    * @param dest_x Destination X coordinate within drawable.
861    * @param dest_y Destination Y coordinate within drawable.
862    * @param width Width of region to render, in pixels, or -1 to use pixbuf width.
863    * @param height Height of region to render, in pixels, or -1 to use pixbuf height.
864    * @param alpha_mode Ignored. Present for backwards compatibility.
865    * @param alpha_threshold Ignored. Present for backwards compatibility.
866    * @param dither Dithering mode for GdkRGB.
867    * @param x_dither X offset for dither.
868    * @param y_dither Y offset for dither.
869    */
870   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);
871 #endif // GDKMM_DISABLE_DEPRECATED
872 
873 
874   void render_pixmap_and_mask_for_colormap(const Glib::RefPtr<Colormap>& colormap,
875                                            Glib::RefPtr<Pixmap>& pixmap_return,
876                                            Glib::RefPtr<Bitmap>& mask_return,
877                                            int alpha_threshold);
878 
879   void render_pixmap_and_mask(Glib::RefPtr<Pixmap>& pixmap_return,
880                               Glib::RefPtr<Bitmap>& mask_return, int alpha_threshold);
881 
882 
883   Glib::ustring get_option(const Glib::ustring& key) const;
884 
885 
886   typedef Glib::SListHandle< Glib::RefPtr<PixbufFormat>, PixbufFormatTraits > SListHandle_PixbufFormat;
887 
888   /** Obtains the available information about the image formats supported by GdkPixbuf.
889    * @result A list of PixbufFormats describing the supported image formats.
890    */
891   static SListHandle_PixbufFormat get_formats();
892 
893 
894 public:
895 
896 public:
897   //C++ methods used to invoke GTK+ virtual functions:
898 
899 protected:
900   //GTK+ Virtual Functions (override these to change behaviour):
901 
902   //Default Signal Handlers::
903 
904 
905 };
906 
907 } // namespace Gdk
908 
909 
910 namespace Glib
911 {
912   /** A Glib::wrap() method for this object.
913    *
914    * @param object The C instance.
915    * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref.
916    * @result A C++ instance that wraps this C instance.
917    *
918    * @relates Gdk::Pixbuf
919    */
920   Glib::RefPtr<Gdk::Pixbuf> wrap(GdkPixbuf* object, bool take_copy = false);
921 }
922 
923 
924 #endif /* _GDKMM_PIXBUF_H */
925 
926