summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPierre-Luc Beaudoin <pierre-luc@pierlux.com>2009-01-10 22:48:40 +0200
committerPierre-Luc Beaudoin <pierre-luc@pierlux.com>2009-01-10 22:48:40 +0200
commitf412908f9efaedb93bd35b33755faca3b88fa1a2 (patch)
treeb51bcf0feecbd2cc223d03fbd2f9a43d5081f353
parent639a40639a1ceda079959423d20db77586e18b37 (diff)
downloadlibchamplain-0.2.8.tar.gz
Merge a patch from Lorenzo Masini to add a ChamplainMarker constructorv0.2.8
-rw-r--r--champlain/champlainmarker.c61
-rw-r--r--champlain/champlainmarker.h10
-rw-r--r--configure.ac2
-rw-r--r--docs/reference/libchamplain-sections.txt2
-rw-r--r--docs/reference/tmpl/champlainmarker.sgml24
5 files changed, 98 insertions, 1 deletions
diff --git a/champlain/champlainmarker.c b/champlain/champlainmarker.c
index 8170b7f..d9bdf76 100644
--- a/champlain/champlainmarker.c
+++ b/champlain/champlainmarker.c
@@ -277,3 +277,64 @@ champlain_marker_new_with_label (const gchar *label,
return CLUTTER_ACTOR (champlainMarker);
}
+/**
+ * champlain_marker_new_with_image:
+ * @filename: The filename of the image.
+ * @error: Return location for an error.
+ *
+ * Returns a new #ChamplainMarker with a drawn marker containing the given image.
+ *
+ */
+ClutterActor *
+champlain_marker_new_with_image(const gchar *filename, GError **error)
+{
+ if (filename == NULL)
+ return NULL;
+
+ ChamplainMarker *champlainMarker = CHAMPLAIN_MARKER(champlain_marker_new ());
+ ClutterActor *actor = clutter_texture_new_from_file(filename, error);
+
+ if (actor == NULL){
+ g_object_unref(G_OBJECT(champlainMarker));
+ return NULL;
+ }
+
+ clutter_container_add_actor (CLUTTER_CONTAINER(champlainMarker), actor);
+
+ return CLUTTER_ACTOR (champlainMarker);
+}
+
+/**
+ * champlain_marker_new_with_image_full:
+ * @filename: The name of an image file to load.
+ * @width: Width of the image in pixel or -1.
+ * @height: Height of the image in pixel or -1.
+ * @anchor_x: X coordinate of the anchor point.
+ * @anchor_y: Y coordinate of the anchor point.
+ * @error: Return location for an error.
+ *
+ * Returns a new #ChamplainMarker with a drawn marker containing the given image.
+ *
+ */
+ClutterActor *
+champlain_marker_new_with_image_full(const gchar *filename, gint width, gint height, gint anchor_x, gint anchor_y, GError **error)
+{
+ if(filename == NULL)
+ return NULL;
+
+ ChamplainMarker *champlainMarker = CHAMPLAIN_MARKER(champlain_marker_new());
+ ClutterActor *actor = clutter_texture_new_from_file(filename, error);
+
+ if(actor == NULL){
+ g_object_unref(G_OBJECT(champlainMarker));
+ return NULL;
+ }
+
+ clutter_actor_set_size(actor, width, height);
+
+ clutter_container_add_actor(CLUTTER_CONTAINER(champlainMarker), actor);
+ clutter_actor_set_anchor_point(CLUTTER_ACTOR(champlainMarker), anchor_x, anchor_y);
+
+ return CLUTTER_ACTOR(champlainMarker);
+}
+
diff --git a/champlain/champlainmarker.h b/champlain/champlainmarker.h
index 8853caf..7708547 100644
--- a/champlain/champlainmarker.h
+++ b/champlain/champlainmarker.h
@@ -59,4 +59,14 @@ ClutterActor *champlain_marker_new_with_label (const gchar *label,
const gchar *font,
ClutterColor *text_color,
ClutterColor *marker_color);
+
+ClutterActor *champlain_marker_new_with_image(const gchar *filename,
+ GError **error);
+
+ClutterActor *champlain_marker_new_with_image_full(const gchar *filename,
+ gint width,
+ gint height,
+ gint anchor_x,
+ gint anchor_y,
+ GError **error);
#endif
diff --git a/configure.ac b/configure.ac
index f5d4a67..87b455c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2,7 +2,7 @@
# Process this file with autoconf to produce a configure script.
AC_PREREQ(2.61)
-AC_INIT(libchamplain, 0.2.7, pierre-luc@pierlux.com)
+AC_INIT(libchamplain, 0.2.8, pierre-luc@pierlux.com)
AC_CONFIG_SRCDIR([champlain/champlainview.h])
AC_CONFIG_HEADER([config.h])
diff --git a/docs/reference/libchamplain-sections.txt b/docs/reference/libchamplain-sections.txt
index 3178c0b..99ba812 100644
--- a/docs/reference/libchamplain-sections.txt
+++ b/docs/reference/libchamplain-sections.txt
@@ -23,6 +23,8 @@ CHAMPLAIN_IS_VIEW_CLASS
ChamplainMarker
champlain_marker_new
champlain_marker_new_with_label
+champlain_marker_new_with_image
+champlain_marker_new_with_image_full
champlain_marker_set_anchor
champlain_marker_set_position
<SUBSECTION Standard>
diff --git a/docs/reference/tmpl/champlainmarker.sgml b/docs/reference/tmpl/champlainmarker.sgml
index d03dcea..8445098 100644
--- a/docs/reference/tmpl/champlainmarker.sgml
+++ b/docs/reference/tmpl/champlainmarker.sgml
@@ -47,6 +47,30 @@ A marker to identify points of interest on a map
@Returns:
+<!-- ##### FUNCTION champlain_marker_new_with_image ##### -->
+<para>
+
+</para>
+
+@filename:
+@error:
+@Returns:
+
+
+<!-- ##### FUNCTION champlain_marker_new_with_image_full ##### -->
+<para>
+
+</para>
+
+@filename:
+@width:
+@height:
+@anchor_x:
+@anchor_y:
+@error:
+@Returns:
+
+
<!-- ##### FUNCTION champlain_marker_set_position ##### -->
<para>