Commit f412908f9efaedb93bd35b33755faca3b88fa1a2

Merge a patch from Lorenzo Masini to add a ChamplainMarker constructor
champlain/champlainmarker.c
(61 / 0)
  
276276
277277 return CLUTTER_ACTOR (champlainMarker);
278278}
279
280/**
281 * champlain_marker_new_with_image:
282 * @filename: The filename of the image.
283 * @error: Return location for an error.
284 *
285 * Returns a new #ChamplainMarker with a drawn marker containing the given image.
286 *
287 */
288ClutterActor *
289champlain_marker_new_with_image(const gchar *filename, GError **error)
290{
291 if (filename == NULL)
292 return NULL;
293
294 ChamplainMarker *champlainMarker = CHAMPLAIN_MARKER(champlain_marker_new ());
295 ClutterActor *actor = clutter_texture_new_from_file(filename, error);
296
297 if (actor == NULL){
298 g_object_unref(G_OBJECT(champlainMarker));
299 return NULL;
300 }
301
302 clutter_container_add_actor (CLUTTER_CONTAINER(champlainMarker), actor);
303
304 return CLUTTER_ACTOR (champlainMarker);
305}
306
307/**
308 * champlain_marker_new_with_image_full:
309 * @filename: The name of an image file to load.
310 * @width: Width of the image in pixel or -1.
311 * @height: Height of the image in pixel or -1.
312 * @anchor_x: X coordinate of the anchor point.
313 * @anchor_y: Y coordinate of the anchor point.
314 * @error: Return location for an error.
315 *
316 * Returns a new #ChamplainMarker with a drawn marker containing the given image.
317 *
318 */
319ClutterActor *
320champlain_marker_new_with_image_full(const gchar *filename, gint width, gint height, gint anchor_x, gint anchor_y, GError **error)
321{
322 if(filename == NULL)
323 return NULL;
324
325 ChamplainMarker *champlainMarker = CHAMPLAIN_MARKER(champlain_marker_new());
326 ClutterActor *actor = clutter_texture_new_from_file(filename, error);
327
328 if(actor == NULL){
329 g_object_unref(G_OBJECT(champlainMarker));
330 return NULL;
331 }
332
333 clutter_actor_set_size(actor, width, height);
334
335 clutter_container_add_actor(CLUTTER_CONTAINER(champlainMarker), actor);
336 clutter_actor_set_anchor_point(CLUTTER_ACTOR(champlainMarker), anchor_x, anchor_y);
337
338 return CLUTTER_ACTOR(champlainMarker);
339}
champlain/champlainmarker.h
(10 / 0)
  
5959 const gchar *font,
6060 ClutterColor *text_color,
6161 ClutterColor *marker_color);
62
63ClutterActor *champlain_marker_new_with_image(const gchar *filename,
64 GError **error);
65
66ClutterActor *champlain_marker_new_with_image_full(const gchar *filename,
67 gint width,
68 gint height,
69 gint anchor_x,
70 gint anchor_y,
71 GError **error);
6272#endif
configure.ac
(1 / 1)
  
22# Process this file with autoconf to produce a configure script.
33
44AC_PREREQ(2.61)
5AC_INIT(libchamplain, 0.2.7, pierre-luc@pierlux.com)
5AC_INIT(libchamplain, 0.2.8, pierre-luc@pierlux.com)
66AC_CONFIG_SRCDIR([champlain/champlainview.h])
77AC_CONFIG_HEADER([config.h])
88
docs/reference/libchamplain-sections.txt
(2 / 0)
  
2323ChamplainMarker
2424champlain_marker_new
2525champlain_marker_new_with_label
26champlain_marker_new_with_image
27champlain_marker_new_with_image_full
2628champlain_marker_set_anchor
2729champlain_marker_set_position
2830<SUBSECTION Standard>
docs/reference/tmpl/champlainmarker.sgml
(24 / 0)
  
4747@Returns:
4848
4949
50<!-- ##### FUNCTION champlain_marker_new_with_image ##### -->
51<para>
52
53</para>
54
55@filename:
56@error:
57@Returns:
58
59
60<!-- ##### FUNCTION champlain_marker_new_with_image_full ##### -->
61<para>
62
63</para>
64
65@filename:
66@width:
67@height:
68@anchor_x:
69@anchor_y:
70@error:
71@Returns:
72
73
5074<!-- ##### FUNCTION champlain_marker_set_position ##### -->
5175<para>
5276

Comments

Add a new comment:

Login or create an account to post a comment

Add your comment