]> err.no Git - libchamplain/commitdiff
Merge a patch from Lorenzo Masini to add a ChamplainMarker constructor
authorPierre-Luc Beaudoin <pierre-luc@pierlux.com>
Sat, 10 Jan 2009 20:48:40 +0000 (22:48 +0200)
committerPierre-Luc Beaudoin <pierre-luc@pierlux.com>
Sat, 10 Jan 2009 20:48:40 +0000 (22:48 +0200)
champlain/champlainmarker.c
champlain/champlainmarker.h
configure.ac
docs/reference/libchamplain-sections.txt
docs/reference/tmpl/champlainmarker.sgml

index 8170b7fd4e6032d728db9963c65205a4f84bf01c..d9bdf76c62013e4f6f1d3a889ff894367b474fcd 100644 (file)
@@ -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);
+}
+
index 8853caf90e18eb85d0173ff4bc0ed58092590ed9..770854785497e13b6edc6a61eaf9887e19a895a3 100644 (file)
@@ -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
index f5d4a6790d51a7d2a5507836f2c480a0d663c17b..87b455cf62cbbd12a70912ea0fe985293c700851 100644 (file)
@@ -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])
 
index 3178c0b3c81f7b59beeb957e9f50671cde10c4b5..99ba8126fd8cc4197b58ddb36fea2bac52d107ac 100644 (file)
@@ -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>
index d03dcea2a6f21167786ba201a16b92be93c317ad..844509813ea836b2c09bea63b86a4fb03f3c7855 100644 (file)
@@ -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>