[gtkmm/gtkmm-3-10] Gdk::Pixbuf: Add create_from_resource() methods.



commit d337e152d165d749add4a8a4b0cb61a957d271cc
Author: Murray Cumming <murrayc murrayc com>
Date:   Tue Oct 22 10:50:48 2013 +0200

    Gdk::Pixbuf: Add create_from_resource() methods.
    
    * gdk/src/pixbuf.hg: Wrap gdk_pixbuf_new_from_resource() and
      gdk_pixbuf_new_from_resource_at_scale().
    * configure.ac: Require the gdk-pixbuf version that has these
      new functions.

 configure.ac      |    2 +-
 gdk/src/pixbuf.hg |   35 +++++++++++++++++++++++++++++++++--
 2 files changed, 34 insertions(+), 3 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 1f31f30..0bd7a52 100644
--- a/configure.ac
+++ b/configure.ac
@@ -91,7 +91,7 @@ AS_IF([test "x$enable_static" = xyes],
 # gdkmm really does need GTK+, because part of Gdk::DragContext is in GTK+.
 # The extra cairomm-1.0 check is because gdkmm requires a newer cairomm than pangomm requires.
 # The extra gdk-pixbuf-2.0 check is because gdkmm requires a newer gdk-pixbuf than gtk+-3.0 requires.
-AC_SUBST([GDKMM_MODULES], ['giomm-2.4 >= 2.38.0 pangomm-1.4 >= 2.27.1 gtk+-3.0 >= 3.10.0 cairomm-1.0 >= 
1.9.2 gdk-pixbuf-2.0 >= 2.22.1'])
+AC_SUBST([GDKMM_MODULES], ['giomm-2.4 >= 2.38.0 pangomm-1.4 >= 2.27.1 gtk+-3.0 >= 3.10.0 cairomm-1.0 >= 
1.9.2 gdk-pixbuf-2.0 >= 2.26.0'])
 
 AS_IF([test "x$gtkmm_host_windows" = xyes],
       [GTKMM_MODULES=$GDKMM_MODULES],
diff --git a/gdk/src/pixbuf.hg b/gdk/src/pixbuf.hg
index 4c63a69..7637906 100644
--- a/gdk/src/pixbuf.hg
+++ b/gdk/src/pixbuf.hg
@@ -195,13 +195,44 @@ public:
    * @param filename The path to the pixbuf file.
    * @param width The desired width
    * @param height The desired height
-   * @param preserve_aspect_ratio: Whether the image's aspect ratio will be preserved when scaling.
+   * @param preserve_aspect_ratio Whether the image's aspect ratio will be preserved when scaling.
    *
    * @throw Glib::FileError
    * @throw Gdk::PixbufError
    */
   _WRAP_METHOD(static Glib::RefPtr<Pixbuf> create_from_file(const std::string& filename, int width, int 
height, bool preserve_aspect_ratio = true), gdk_pixbuf_new_from_file_at_scale, errthrow)
-  _IGNORE(gdk_pixbuf_new_from_file_at_scale, gdk_pixbuf_new_from_file_at_size) 
//gdk_pixbuf_new_from_file_at_size() just calls gdk_pixbuf_new_from_file_at_scale().
+  _IGNORE(gdk_pixbuf_new_from_file_at_size) //gdk_pixbuf_new_from_file_at_size() just calls 
gdk_pixbuf_new_from_file_at_scale().
+
+
+  /** 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.
+   *
+   * @throw Glib::ResourceError
+   * @throw Gdk::PixbufError
+   *
+   * @newin{3,12}
+   */
+  _WRAP_METHOD(static Glib::RefPtr<Pixbuf> create_from_resource(const std::string& resource_path), 
gdk_pixbuf_new_from_resource, errthrow)
+
+  /** 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 @a width of -1 will cause the image to be scaled to the exact given
+   * height, and a @a height of -1 will cause the image to be scaled to the
+   * exact given width. When not preserving aspect ratio, a @a width or
+   * @a height of -1 means to not scale the image at all in that dimension.
+   * @resource_path The path of the resource file.
+   * @param width The desired width
+   * @param height The desired height
+   * @param preserve_aspect_ratio Whether the image's aspect ratio will be preserved when scaling.
+   *
+   * @throw Glib::ResourceError
+   * @throw Gdk::PixbufError
+   *
+   * @newin{3,12}
+   */
+  _WRAP_METHOD(static Glib::RefPtr<Pixbuf> create_from_resource(const std::string& resource_path, int width, 
int height, bool preserve_aspect_ratio = true), gdk_pixbuf_new_from_resource_at_scale, errthrow)
+
 
   /** Creates a new Gdk::Pixbuf out of in-memory image data.
    * Currently only RGB images with 8 bits per sample are supported.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]