[gtkmm] Add Gdk::Texture



commit 08371643bf806ddbd4eafd652a14768f13e360b1
Author: Kjell Ahlstedt <kjellahlstedt gmail com>
Date:   Fri Nov 10 19:22:40 2017 +0100

    Add Gdk::Texture

 .gitignore                                |    2 +
 gdk/gdkmm.h                               |    1 +
 gdk/src/filelist.am                       |    1 +
 gdk/src/texture.ccg                       |   18 +++++++
 gdk/src/texture.hg                        |   72 +++++++++++++++++++++++++++++
 tools/extra_defs_gen/generate_defs_gdk.cc |    2 +
 tools/m4/convert_gdk.m4                   |    9 +++-
 7 files changed, 104 insertions(+), 1 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index 507b6a1..a1dec22 100644
--- a/.gitignore
+++ b/.gitignore
@@ -92,6 +92,8 @@ gdk/gdkmm/rgba.cc
 gdk/gdkmm/rgba.h
 gdk/gdkmm/seat.cc
 gdk/gdkmm/seat.h
+gdk/gdkmm/texture.cc
+gdk/gdkmm/texture.h
 gdk/gdkmm/timecoord.cc
 gdk/gdkmm/timecoord.h
 gdk/gdkmm/types.cc
diff --git a/gdk/gdkmm.h b/gdk/gdkmm.h
index aae54d3..ba0c9bf 100644
--- a/gdk/gdkmm.h
+++ b/gdk/gdkmm.h
@@ -37,6 +37,7 @@
 #include <gdkmm/displaymanager.h>
 #include <gdkmm/devicemanager.h>
 #include <gdkmm/seat.h>
+#include <gdkmm/texture.h>
 #include <gdkmm/monitor.h>
 #include <gdkmm/general.h>
 
diff --git a/gdk/src/filelist.am b/gdk/src/filelist.am
index 1f80fb8..f2ba30f 100644
--- a/gdk/src/filelist.am
+++ b/gdk/src/filelist.am
@@ -35,6 +35,7 @@ gdkmm_files_any_hg =          \
        rectangle.hg            \
        rgba.hg                 \
        seat.hg         \
+       texture.hg              \
        timecoord.hg            \
        types.hg                \
        window.hg
diff --git a/gdk/src/texture.ccg b/gdk/src/texture.ccg
new file mode 100644
index 0000000..96109a8
--- /dev/null
+++ b/gdk/src/texture.ccg
@@ -0,0 +1,18 @@
+/* Copyright (C) 2017 The gtkmm Development Team
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <giomm/file.h>
+#include <gdkmm/pixbuf.h>
diff --git a/gdk/src/texture.hg b/gdk/src/texture.hg
new file mode 100644
index 0000000..8451162
--- /dev/null
+++ b/gdk/src/texture.hg
@@ -0,0 +1,72 @@
+/* Copyright (C) 2017 The gtkmm Development Team
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <glibmm/object.h>
+
+_DEFS(gdkmm,gdk)
+_PINCLUDE(glibmm/private/object_p.h)
+
+namespace Gio
+{
+class File;
+}
+
+namespace Gdk
+{
+class Pixbuf;
+
+/** Pixel data.
+ *
+ * %Gdk::Texture is the basic element used to refer to pixel data.
+ * It is primarily meant for pixel data that will not change over
+ * multiple frames, and will be used for a long time.
+ *
+ * You cannot get your pixel data back once you've uploaded it.
+ *
+ * %Gdk::Texture is an immutable object: That means you cannot change
+ * anything about it.
+ *
+ * @newin{3,94}
+ */
+class Texture : public Glib::Object
+{
+  _CLASS_GOBJECT(Texture, GdkTexture, GDK_TEXTURE, Glib::Object, GObject)
+
+protected:
+  _CTOR_DEFAULT()
+
+public:
+  // All gdk_texture_new_*() functions do more than call g_object_new().
+  _WRAP_METHOD(static Glib::RefPtr<Texture> create_for_data(
+    const guchar* data, int width, int height, int stride), gdk_texture_new_for_data)
+  _WRAP_METHOD(static Glib::RefPtr<Texture> create_for_pixbuf(
+    const Glib::RefPtr<Pixbuf>& pixbuf), gdk_texture_new_for_pixbuf)
+  _WRAP_METHOD(static Glib::RefPtr<Texture> create_from_resource(
+    const std::string& resource_path), gdk_texture_new_from_resource)
+  _WRAP_METHOD(static Glib::RefPtr<Texture> create_from_file(
+    const Glib::RefPtr<Gio::File>& file), gdk_texture_new_from_file, errthrow)
+
+  _WRAP_METHOD(int get_width() const, gdk_texture_get_width)
+  _WRAP_METHOD(int get_height() const, gdk_texture_get_height)
+  _WRAP_METHOD(void download(guchar* data, gsize stride) const, gdk_texture_download)
+
+  _WRAP_PROPERTY("width", int)
+  _WRAP_PROPERTY("height", int)
+
+  // There are no public signals or vfuncs.
+};
+
+} // namespace Gdk
diff --git a/tools/extra_defs_gen/generate_defs_gdk.cc b/tools/extra_defs_gen/generate_defs_gdk.cc
index b21e34c..5a48b7c 100644
--- a/tools/extra_defs_gen/generate_defs_gdk.cc
+++ b/tools/extra_defs_gen/generate_defs_gdk.cc
@@ -37,6 +37,7 @@ int main(int /* argc */, char** /* argv */)
 
   std::cout << get_defs( GDK_TYPE_APP_LAUNCH_CONTEXT )
             << get_defs( GDK_TYPE_DRAG_CONTEXT )
+            << get_defs( GDK_TYPE_CURSOR )
             << get_defs( GDK_TYPE_DEVICE )
             << get_defs( GDK_TYPE_DEVICE_MANAGER )
             << get_defs( GDK_TYPE_DISPLAY )
@@ -51,6 +52,7 @@ int main(int /* argc */, char** /* argv */)
             << get_defs( GDK_TYPE_PIXBUF_LOADER )
             << get_defs( GDK_TYPE_RGBA )
             << get_defs( GDK_TYPE_SEAT )
+            << get_defs( GDK_TYPE_TEXTURE )
             << get_defs( GDK_TYPE_WINDOW )
             << get_defs( GDK_TYPE_GL_CONTEXT )
             ;
diff --git a/tools/m4/convert_gdk.m4 b/tools/m4/convert_gdk.m4
index f9d8c10..c601f98 100644
--- a/tools/m4/convert_gdk.m4
+++ b/tools/m4/convert_gdk.m4
@@ -32,7 +32,6 @@ _CONV_ENUM(Gdk,ByteOrder)
 _CONV_ENUM(Gdk,CapStyle)
 _CONV_ENUM(Gdk,Colorspace)
 _CONV_ENUM(Gdk,CrossingMode)
-_CONV_INCLASS_ENUM(Gdk,Cursor,Type)
 _CONV_INCLASS_ENUM(Gdk,Device,Type)
 _CONV_ENUM(Gdk,DragAction)
 _CONV_ENUM(Gdk,DragProtocol)
@@ -139,6 +138,9 @@ _CONVERSION(`const Glib::RefPtr<Gdk::Device>&',`GdkDevice*',__CONVERT_REFPTR_TO_
 _CONVERSION(`const Glib::RefPtr<Device>&',`GdkDevice*',__CONVERT_REFPTR_TO_P)
 _CONVERSION(`const Glib::RefPtr<const Device>&',`GdkDevice*',__CONVERT_CONST_REFPTR_TO_P_SUN(Gdk::Device))
 _CONVERSION(`const Glib::RefPtr<Gdk::Monitor>&',`GdkMonitor*',__CONVERT_REFPTR_TO_P)
+_CONVERSION(`const Glib::RefPtr<const Texture>&',`GdkTexture*',__CONVERT_CONST_REFPTR_TO_P)
+_CONVERSION(`const Glib::RefPtr<const Gdk::Texture>&',`GdkTexture*',__CONVERT_CONST_REFPTR_TO_P)
+_CONVERSION(`const Glib::RefPtr<Gdk::Texture>&',`GdkTexture*',__CONVERT_REFPTR_TO_P)
 
 define(`__CFR2P',`const_cast<$`'2>($`'3.gobj())')
 _CONVERSION(const Gdk::Rectangle&,GdkRectangle*,__CFR2P)
@@ -206,6 +208,11 @@ _CONVERSION(`GdkSeat*',`Glib::RefPtr<Gdk::Seat>', `Glib::wrap($3)')
 _CONVERSION(`GdkSeat*',`Glib::RefPtr<const Seat>', `Glib::wrap($3)')
 _CONVERSION(`GdkSeat*',`Glib::RefPtr<const Gdk::Seat>', `Glib::wrap($3)')
 
+_CONVERSION(`GdkTexture*',`Glib::RefPtr<Texture>', `Glib::wrap($3)')
+_CONVERSION(`GdkTexture*',`Glib::RefPtr<Gdk::Texture>', `Glib::wrap($3)')
+_CONVERSION(`GdkTexture*',`Glib::RefPtr<const Texture>', `Glib::wrap($3)')
+_CONVERSION(`GdkTexture*',`Glib::RefPtr<const Gdk::Texture>', `Glib::wrap($3)')
+
 _CONVERSION(`GdkMonitor*',`Glib::RefPtr<Monitor>', `Glib::wrap($3)')
 _CONVERSION(`GdkMonitor*',`Glib::RefPtr<const Monitor>', `Glib::wrap($3)')
 


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