[trunk] embedded SVG rendered as raster images
Setup: rev. 5255; compiled with latest Qt SDK (Qt lib 4.7.4) under Ubuntu 11.10 AND under Win7
Steps:
1) open the attached score: it contains a single stave and a vert. frame with an SVG image inserted using the VBox contextual menu;
2) zoom to 200%: the image is clearly rendered as raster.
The original SVG image is attached also as a separate file for reference.
The same happens in exported PDF.
Analysis: the SvgImage class uses the buffer
member of the Image base class to render the image contents (see function void SvgImage::draw(QPainter* painter)
in file libmscore/image.cpp).
buffer
is of type QPixmap
: this is why the image is rendered as raster.
Note: I tired to get rid of buffer
in SvgImage and directly use doc->render(painter)
in SvgImage::draw(): the image is then correctly rendered as vector, but I could not find the correct scaling factors between the doc size, the image size, the bbox size and so on; for this reason I cannot supply a patch.
Thanks,
M.
Attachment | Size |
---|---|
trunk_test_svg.mscz | 4.09 KB |
ornament_002.svg | 2.37 KB |
Comments
fixed in r5259.
The pixmap is used always as a cache for the rendered svg. Problem was that the cache was not set dirty on resize.
For print now direct rendering is used. However i did not checked how qt actually does pdf rendering of svg's.
Thanks Werner!
SVG graphics are indeed displayed 'as vector' on screen. A quick test with a simple PDF export confirmed that PDF also is behaving 'vectorially' (probably because PDF files are created via QPrinter, see function
MuseScore::savePsPdf()
in file libmscore/file.cpp).So, the issue can be happily closed.
Thanks again,
M.
Automatically closed -- issue fixed for 2 weeks with no activity.