Open jascam opened 6 years ago
[fmueller@1/25/2012] I prepared a sample package containing one small SVG image, one large SVG image and corresponding PNG images for reference. See attachment.
You can see the effect directly within the converter application 1.0 available from Downloads.
sample_small.svg is working fine sample_large.svg is cut off
The images were were created by a Java program using Batik library.
If you compute the bounding box of the SVG image, you get the dimensions needed for the conversion if you want to convert the whole image (e.g. http://my.opera.com/MacDev_ed/blog/2009/01/21/getting-boundingbox-of-svg-elements).
[SelormeyPaul@1/25/2012] Thanks for the information. That computation is in a browser, which has a window size defined. The problem is that the value itself can be expressed in any units, including percentage. I will look into possible solutions.
[UnknownUser@2/14/2013]
[dfdiego@2/21/2013] Maybe passing a ScaleFactor parameter to the ImageSvgConverter class would be very simple. In this way the code changes would be only here:
// The BitmapSource that is rendered with a Visual.
RenderTargetBitmap targetBitmap = new RenderTargetBitmap(
pixelWidth * ScaleFactor, pixelHeight * ScaleFactor, dpiX * ScaleFactor, dpiY * ScaleFactor, PixelFormats.Pbgra32);
targetBitmap.Render(drawingVisual);
The resulting rendered images are very fine in my tests.
I have tried out SharpVectors recently because I was in need to display SVG images within a WPF application. The bounding box of my SVG images is quite large around 2048x2048. After using the conversion API (SvgFileReader.Read(stream)) to convert my SVG into a DrawingGroup, I found out that the image is cut off, only part of the original SVG visible. I examined the source code I located a few spots with hard coded dimensions of 640x480 in the converters and runtime assemblies, without the possibility to adjust the rendersize in any way. So here comes my question: What is the reason for that? BTW: I increased the dimensions by modifing the source and everything worked fine afterwards.
Attachments
SVG_Samples.zip
This work item was migrated from CodePlex
CodePlex work item ID: '853' Vote count: '1'