]> err.no Git - libchamplain/commitdiff
Fix Bug 577666: Replace error.svg with a cairo drawing
authorSimon Wenner <simon@wenner.ch>
Sat, 11 Apr 2009 23:39:20 +0000 (19:39 -0400)
committerPierre-Luc Beaudoin <pierre-luc@pierlux.com>
Sat, 11 Apr 2009 23:45:08 +0000 (19:45 -0400)
champlain/Makefile.am
champlain/champlain-network-map-source.c
champlain/error.svg [deleted file]

index 483e81d41a734f2304684a904e20b54ca7e3aeb3..ac343f4645dd4599b36c931b4655c6483689a5c6 100644 (file)
@@ -84,10 +84,7 @@ AM_CPPFLAGS =                                \
        -DCHAMPLAIN_COMPILATION         \
        $(WARN_CFLAGS)
 
-svgdir = $(datadir)/champlain
-svg_DATA = error.svg
-
-EXTRA_DIST = $(svg_DATA) $(CHAMPLAIN_MARSHAL_LIST)
+EXTRA_DIST = $(CHAMPLAIN_MARSHAL_LIST)
 
 champlain-marshal.h: $(CHAMPLAIN_MARSHAL_LIST)
        @GLIB_GENMARSHAL@ --header --prefix=cpl_marshal $< > $(CHAMPLAIN_MARSHAL).h
index aad8f7dcff834f92ae791218a4fe224d16ed60f0..72ef03a6cf6c815718a4c3d7617b4458c48d26fe 100644 (file)
@@ -40,6 +40,7 @@
 #include <libsoup/soup.h>
 #include <math.h>
 #include <string.h>
+#include <clutter-cairo.h>
 
 enum
 {
@@ -357,16 +358,33 @@ static void
 create_error_tile (ChamplainTile* tile)
 {
   ClutterActor *actor;
-  ClutterColor red = { 0xff, 0x00, 0x00, 0xff };
-
-  actor = clutter_texture_new_from_file (DATADIR "/champlain/error.svg", NULL);
-  if (!actor)
-  {
-    /* Just in case the image is not found, put some red.  This should not
-     * happen if libchamplain is installed correctly. */
-    actor = clutter_rectangle_new_with_color (&red);
-    clutter_actor_set_size (actor , 256, 256);
-  }
+  cairo_t *cr;
+  cairo_pattern_t *pat;
+
+  actor = clutter_cairo_new (256, 256);
+  cr = clutter_cairo_create (CLUTTER_CAIRO(actor));
+
+  /* draw a linear gray to white pattern */
+  pat = cairo_pattern_create_linear(128.0, 0.0,  256.0, 128.0);
+  cairo_pattern_add_color_stop_rgb(pat, 0, 0.686, 0.686, 0.686);
+  cairo_pattern_add_color_stop_rgb(pat, 1, 0.925, 0.925, 0.925);
+  cairo_set_source(cr, pat);
+  cairo_rectangle(cr, 0, 0, 256, 256);
+  cairo_fill(cr);
+
+  cairo_pattern_destroy(pat);
+
+  /* draw the red cross */
+  cairo_set_source_rgb(cr, 0.424, 0.078, 0.078);
+  cairo_set_line_width (cr, 14.0);
+  cairo_set_line_cap(cr, CAIRO_LINE_CAP_ROUND);
+  cairo_move_to(cr, 24, 24);
+  cairo_line_to(cr, 50, 50);
+  cairo_move_to(cr, 50, 24);
+  cairo_line_to(cr, 24, 50);
+  cairo_stroke(cr);
+
+  cairo_destroy(cr);
 
   champlain_tile_set_actor (tile, actor);
   clutter_actor_show (actor);
diff --git a/champlain/error.svg b/champlain/error.svg
deleted file mode 100644 (file)
index 3664ca0..0000000
+++ /dev/null
@@ -1,97 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!-- Created with Inkscape (http://www.inkscape.org/) -->
-<svg
-   xmlns:dc="http://purl.org/dc/elements/1.1/"
-   xmlns:cc="http://creativecommons.org/ns#"
-   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
-   xmlns:svg="http://www.w3.org/2000/svg"
-   xmlns="http://www.w3.org/2000/svg"
-   xmlns:xlink="http://www.w3.org/1999/xlink"
-   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
-   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
-   width="256"
-   height="256"
-   id="svg2"
-   sodipodi:version="0.32"
-   inkscape:version="0.46"
-   version="1.0"
-   sodipodi:docname="error.svg"
-   inkscape:output_extension="org.inkscape.output.svg.inkscape">
-  <defs
-     id="defs4">
-    <linearGradient
-       id="linearGradient3200">
-      <stop
-         style="stop-color:#b3b3b3;stop-opacity:1;"
-         offset="0"
-         id="stop3202" />
-      <stop
-         style="stop-color:#ececec;stop-opacity:1;"
-         offset="1"
-         id="stop3204" />
-    </linearGradient>
-    <inkscape:perspective
-       sodipodi:type="inkscape:persp3d"
-       inkscape:vp_x="0 : 526.18109 : 1"
-       inkscape:vp_y="0 : 1000 : 0"
-       inkscape:vp_z="744.09448 : 526.18109 : 1"
-       inkscape:persp3d-origin="372.04724 : 350.78739 : 1"
-       id="perspective10" />
-    <linearGradient
-       inkscape:collect="always"
-       xlink:href="#linearGradient3200"
-       id="linearGradient3206"
-       x1="122.23481"
-       y1="0.032388873"
-       x2="257.81464"
-       y2="135.61221"
-       gradientUnits="userSpaceOnUse"
-       spreadMethod="reflect" />
-  </defs>
-  <sodipodi:namedview
-     id="base"
-     pagecolor="#ffffff"
-     bordercolor="#666666"
-     borderopacity="1.0"
-     inkscape:pageopacity="0.0"
-     inkscape:pageshadow="2"
-     inkscape:zoom="1.235"
-     inkscape:cx="150.26644"
-     inkscape:cy="92.575521"
-     inkscape:document-units="px"
-     inkscape:current-layer="layer1"
-     showgrid="false"
-     inkscape:window-width="1023"
-     inkscape:window-height="719"
-     inkscape:window-x="1"
-     inkscape:window-y="49" />
-  <metadata
-     id="metadata7">
-    <rdf:RDF>
-      <cc:Work
-         rdf:about="">
-        <dc:format>image/svg+xml</dc:format>
-        <dc:type
-           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
-      </cc:Work>
-    </rdf:RDF>
-  </metadata>
-  <g
-     inkscape:label="Calque 1"
-     inkscape:groupmode="layer"
-     id="layer1">
-    <rect
-       style="opacity:1;fill:url(#linearGradient3206);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1.25000000000000000;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
-       id="rect3198"
-       width="256"
-       height="256"
-       x="0"
-       y="0"
-       rx="0"
-       ry="0" />
-    <path
-       style="opacity:1;fill:#6c1414;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1.25;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
-       d="M 17.691061,21.608585 C 15.787881,23.511765 15.809981,26.577605 17.713151,28.480785 L 25.734401,36.502025 L 17.713151,44.523265 C 15.809981,46.426445 15.787881,49.492285 17.691061,51.395465 L 19.989151,53.693555 C 21.892331,55.596735 24.958171,55.574635 26.861351,53.671465 L 34.882591,45.650215 L 42.903831,53.671465 C 44.807011,55.574635 47.872851,55.596735 49.776031,53.693555 L 52.074121,51.395465 C 53.977301,49.492285 53.955201,46.426445 52.052031,44.523265 L 44.030781,36.502025 L 52.052031,28.480785 C 53.955201,26.577605 53.977301,23.511765 52.074121,21.608585 L 49.776031,19.310495 C 47.872851,17.407315 44.807021,17.429405 42.903831,19.332585 L 34.882591,27.353835 L 26.861351,19.332585 C 24.958171,17.429415 21.892331,17.407315 19.989151,19.310495 L 17.691061,21.608585 z"
-       id="rect2383" />
-  </g>
-</svg>