summaryrefslogtreecommitdiffstats
path: root/src/object/sp-image.cpp
diff options
context:
space:
mode:
authorTavmjong Bah <tavmjong@free.fr>2018-11-07 15:51:08 +0000
committerTavmjong Bah <tavmjong@free.fr>2018-11-07 15:51:08 +0000
commit9c18fdd9187e7e190939d68a5d684214a8491624 (patch)
tree2aefe703d31703bbd64addd5162d23e3741178b5 /src/object/sp-image.cpp
parentAllow symbolic icons in default icon theme (diff)
downloadinkscape-9c18fdd9187e7e190939d68a5d684214a8491624.tar.gz
inkscape-9c18fdd9187e7e190939d68a5d684214a8491624.zip
Replace Broken Image xpm by SVG.
Diffstat (limited to 'src/object/sp-image.cpp')
-rw-r--r--src/object/sp-image.cpp23
1 files changed, 19 insertions, 4 deletions
diff --git a/src/object/sp-image.cpp b/src/object/sp-image.cpp
index ee0efc720..13298dad7 100644
--- a/src/object/sp-image.cpp
+++ b/src/object/sp-image.cpp
@@ -574,6 +574,20 @@ Inkscape::DrawingItem* SPImage::show(Inkscape::Drawing &drawing, unsigned int /*
return ai;
}
+static std::string broken_image_svg = R"A(
+<svg xmlns="http://www.w3.org/2000/svg" width="640" height="640">
+ <rect width="100%" height="100%" style="fill:white;stroke:red;stroke-width:20px"/>
+ <rect x="35%" y="10%" width="30%" height="30%" style="fill:red"/>
+ <path d="m 280,120 80,80" style="fill:none;stroke:white;stroke-width:20px"/>
+ <path d="m 360,120 -80,80" style="fill:none;stroke:white;stroke-width:20px"/>
+ <g style="font-family:sans-serif;font-size:100px;font-weight:bold;text-anchor:middle">
+ <text x="50%" y="380">Linked</text>
+ <text x="50%" y="490">Image</text>
+ <text x="50%" y="600">Not Found</text>
+ </g>
+</svg>
+)A";
+
Inkscape::Pixbuf *sp_image_repr_read_image(gchar const *href, gchar const *absref, gchar const *base, double svgdpi)
{
Inkscape::Pixbuf *inkpb = nullptr;
@@ -621,12 +635,13 @@ Inkscape::Pixbuf *sp_image_repr_read_image(gchar const *href, gchar const *absre
return inkpb;
}
}
+
/* Nope: We do not find any valid pixmap file :-( */
- GdkPixbuf *pixbuf = gdk_pixbuf_new_from_xpm_data((const gchar **) brokenimage_xpm);
- inkpb = new Inkscape::Pixbuf(pixbuf);
+ // Need a "fake" filename to trigger svg mode.
+ inkpb = Inkscape::Pixbuf::create_from_buffer(broken_image_svg, 0, "brokenimage.svg");
- /* It should be included xpm, so if it still does not does load, */
- /* our libraries are broken */
+ /* It's included here so if it still does not does load, */
+ /* our libraries are broken! */
g_assert (inkpb != nullptr);
return inkpb;