Alan Horkan wrote:
Is Inkscape genrating that preview from scratch or displaying a thumbnail already created by another application?
- Alan
Inkscape is its own renderer! :-)
Actually, I thought that I would have a little bit of fun with SVG. I made a tiny SVG template that is dynamically filled in with the image (scaled to fit with its aspect) , the rectangle around it, and the text that indicates its size. The svg preview displays it as though it is an SVG file. Here is the snippet of code that does the trick, if anyone would like to see it. Just match up the %s's and the %d's with the printf() below it, to make sense of it.
Bob
======== SNIP SNIP SNIPPITY SNIP ======== //Our template. Modify to taste gchar *xformat = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" "<svg\n" "xmlns="http://www.w3.org/2000/svg%5C%22%5Cn" "xmlns:xlink="http://www.w3.org/1999/xlink%5C%22%5Cn" "width="%d" height="%d">\n" "<image x="%d" y="%d" width="%d" height="%d"\n" "xlink:href="%s"/>\n" "<rect\n" "style="fill:none;fill-opacity:0.75000000;fill-rule:evenodd;" "stroke:#000000;stroke-width:4.0;stroke-linecap:butt;" "stroke-linejoin:miter;stroke-opacity:1.0000000;" "stroke-miterlimit:4.0000000;stroke-dasharray:none;"\n" "x="%d" y="%d" width="%d" height="%d"/>\n" "<text\n" "style="font-size:24.000000;font-style:normal;font-weight:normal;"
"fill:#000000;fill-opacity:1.0000000;stroke:none;stroke-width:1.0000000pt;"
"stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000;" "font-family:Bitstream Vera Sans;"\n" "x="10" y="26">%dw x %dh</text>\n" "</svg>\n\n";
//Fill in the template gchar *xmlBuffer = g_strdup_printf(xformat, previewWidth, previewHeight, imgX, imgY, scaledImgWidth, scaledImgHeight, fName, rectX, rectY, rectWidth, rectHeight, imgWidth, imgHeight);