[libchamplainmm] Renderer: Wrap ChamplainRenderer
- From: Juan R. Garcia Blanco <juanrgar src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libchamplainmm] Renderer: Wrap ChamplainRenderer
- Date: Sun, 9 Mar 2014 08:56:04 +0000 (UTC)
commit 332d77be92264fbc047df49e92781a6878678788
Author: Juan R. García Blanco <juanrgar gmail com>
Date: Sat Mar 8 12:01:45 2014 +0100
Renderer: Wrap ChamplainRenderer
champlain/champlainmm/.gitignore | 1 +
champlain/src/champlain_vfuncs.defs | 10 ++++
champlain/src/filelist.am | 1 +
champlain/src/renderer.ccg | 23 +++++++++
champlain/src/renderer.hg | 53 ++++++++++++++++++++
.../extradefs/generate_extra_defs_libchamplain.cc | 1 +
tools/m4/convert_libchamplain.m4 | 4 ++
7 files changed, 93 insertions(+), 0 deletions(-)
---
diff --git a/champlain/champlainmm/.gitignore b/champlain/champlainmm/.gitignore
index c27cf5c..b199571 100644
--- a/champlain/champlainmm/.gitignore
+++ b/champlain/champlainmm/.gitignore
@@ -10,6 +10,7 @@ marker-layer.*
marker.*
path-layer.*
point.*
+renderer.*
tile.*
view.*
wrap_init.cc
diff --git a/champlain/src/champlain_vfuncs.defs b/champlain/src/champlain_vfuncs.defs
index 4369f3e..7cf5a52 100644
--- a/champlain/src/champlain_vfuncs.defs
+++ b/champlain/src/champlain_vfuncs.defs
@@ -37,3 +37,13 @@
(of-object "ChamplainLayer")
(return-type "ChamplainBoundingBox*")
)
+
+; ChamplainRenderer
+
+(define-vfunc render
+ (of-object "ChamplainRenderer")
+ (return-type "void")
+ (parameters
+ '("ChamplainTile*" "tile")
+ )
+)
diff --git a/champlain/src/filelist.am b/champlain/src/filelist.am
index affc4cc..647873d 100644
--- a/champlain/src/filelist.am
+++ b/champlain/src/filelist.am
@@ -21,6 +21,7 @@ files_hg = \
label.hg \
point.hg \
path-layer.hg \
+ renderer.hg \
marker-layer.hg \
tile.hg \
view.hg
diff --git a/champlain/src/renderer.ccg b/champlain/src/renderer.ccg
new file mode 100644
index 0000000..98e7f82
--- /dev/null
+++ b/champlain/src/renderer.ccg
@@ -0,0 +1,23 @@
+/* Copyright (c) 2014 Juan R. García Blanco <juanrgar gmail com>
+ *
+ * This file is part of libchamplainmm.
+ *
+ * libchamplainmm 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.
+ *
+ * libchamplainmm 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 program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <champlain/champlain.h>
+
+namespace Champlain
+{
+} // namespace Champlain
diff --git a/champlain/src/renderer.hg b/champlain/src/renderer.hg
new file mode 100644
index 0000000..8c31a69
--- /dev/null
+++ b/champlain/src/renderer.hg
@@ -0,0 +1,53 @@
+/* Copyright (c) 2014 Juan R. García Blanco <juanrgar gmail com>
+ *
+ * This file is part of libchamplainmm.
+ *
+ * libchamplainmm 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.
+ *
+ * libchamplainmm 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 program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <glibmm/object.h>
+#include <champlainmm/tile.h>
+
+_DEFS(champlainmm,champlain)
+_PINCLUDE(glibmm/private/object_p.h)
+
+namespace Champlain
+{
+
+class Renderer : public Glib::Object
+{
+
+/** A base class for renderers.
+ *
+ * A renderer is used to render tiles textures. A tile is rendered based on
+ * the provided data - this can be arbitrary data the given renderer understands
+ * (e.g. raw bitmap data, vector xml map representation and so on).
+ *
+ * @newin{0,8}
+ */
+ _CLASS_GOBJECT(Renderer, ChamplainRenderer, CHAMPLAIN_RENDERER, Glib::Object, GObject)
+ _DERIVES_INITIALLY_UNOWNED()
+
+protected:
+// _WRAP_VFUNC(void set_data(std::string data, guint size), set_data)
+
+ _WRAP_VFUNC(void render(const Glib::RefPtr<Tile>& tile), render)
+
+public:
+// _WRAP_METHOD(void set_data(std::string data, guint size), champlain_renderer_set_data)
+
+ _WRAP_METHOD(void render(const Glib::RefPtr<Tile>& tile), champlain_renderer_render)
+};
+
+} // namespace Champlain
diff --git a/tools/extradefs/generate_extra_defs_libchamplain.cc
b/tools/extradefs/generate_extra_defs_libchamplain.cc
index ae83ae1..3165b77 100644
--- a/tools/extradefs/generate_extra_defs_libchamplain.cc
+++ b/tools/extradefs/generate_extra_defs_libchamplain.cc
@@ -34,6 +34,7 @@ main(int argc, char *argv[])
<< get_defs(CHAMPLAIN_TYPE_MARKER_LAYER)
<< get_defs(CHAMPLAIN_TYPE_MARKER)
<< get_defs(CHAMPLAIN_TYPE_PATH_LAYER)
+ << get_defs(CHAMPLAIN_TYPE_RENDERER)
<< get_defs(CHAMPLAIN_TYPE_TILE)
<< get_defs(CHAMPLAIN_TYPE_VIEW)
;
diff --git a/tools/m4/convert_libchamplain.m4 b/tools/m4/convert_libchamplain.m4
index f09cfed..486ea03 100644
--- a/tools/m4/convert_libchamplain.m4
+++ b/tools/m4/convert_libchamplain.m4
@@ -55,6 +55,10 @@ _CONVERSION(`const Point&',`ChamplainPoint*',__FCR2P)
# Polygon
_CONVERSION(`const Glib::RefPtr<Polygon>&',`ChamplainPolygon*',__CONVERT_REFPTR_TO_P)
+# Renderer
+_CONVERSION(`ChamplainRenderer*',`Glib::RefPtr<Renderer>',`Glib::wrap($3)')
+_CONVERSION(`const Glib::RefPtr<Renderer>&',`ChamplainRenderer*',__CONVERT_REFPTR_TO_P)
+
# Tile
_CONVERSION(`ChamplainTile*',`const Glib::RefPtr<Tile>&',`Glib::wrap($3)')
_CONVERSION(`ChamplainTile*',`Glib::RefPtr<Tile>',`Glib::wrap($3)')
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]