Giter Site home page Giter Site logo

elinamllc / sharpvectors Goto Github PK

View Code? Open in Web Editor NEW
677.0 19.0 131.0 167 MB

SharpVectors - SVG# Reloaded: SVG DOM and Rendering in C# for the .Net.

Home Page: https://elinamllc.github.io/SharpVectors/

License: BSD 3-Clause "New" or "Revised" License

C# 97.08% Visual Basic .NET 2.92%
svg wpf xaml svg-to-xaml svg-to-wpf sharpvectors svg-files svg-dom wpf-applications scalable-vector-graphics

sharpvectors's Introduction

Project Description

The Scalable Vector Graphics (SVG) is an XML-based standard file format for creating graphics on the web, and is supported by most modern browsers. This project provides a C# library for parsing, converting and viewing the SVG files in WPF applications.

The Scalable Vector Graphics (SVG) is now natively supported in most internet browsers, including the IE 9. With the HTML5, the use of the SVG as graphics format on the web is increasing.

For .NET application developers, there is currently no library complete enough to handle SVG files. Even the commercial tools are either not available or not complete enough to handle most uses of the SVG in Windows Presentation Foundation (WPF) applications. The project does not aim to provide a complete implementation of the SVG file format, but will support the features required in an average graphics application.

The SVG specification is available in HTML format or the PDF format.

Features and Uses

In general, the following features are implemented:

  • Parsing of the SVG files to create the SVG DOM
  • SVG to XAML conversion
  • A small runtime library to handle font URI, embedded images and others when using the XAML files directly from disk.
  • An optimized XAML output.
  • A simple and basic SVG viewer (an advanced viewer is planned).
  • Interaction with the conversion process (by a visitor pattern) to allow for custom hyper-link implementations, font substitutions etc.

NOTE: Only Geometry/Drawing level elements are exported, which will not work with Silverlight. See the Documentation section for more information on the features.

Installation

The SharpVectors library targets the following frameworks

  • .NET Framework, Version 4.0
  • .NET Framework, Version 4.5
  • .NET Framework, Version 4.6
  • .NET Framework, Version 4.7
  • .NET Framework, Version 4.8
  • .NET Standard, Version 2.1
  • .NET Core, Version 3.1
  • .NET 6.0 ~ .NET 8.0

The library can be used in WPF and Windows Forms applications.

For the Library

The library can be downloaded from the following sources

  • The SharpVectors.Reloaded package is the same as the SharpVectors, which is the recommended package if you need the full package.
  • The SharpVectors.Reloaded name was used for the Nuget package at the time the SharpVectors package name was not available.
  • The SharpVectors.Reloaded package name will be retired in Version 2.0.
  • The SharpVectors.Wpf is the recommended package, for WPF only application.
  • As outlined in the roadmap, other packages such as the SharpVectors.Gdi for the GDI+, will be available as the renderers mature.

Documentation

An introduction and a tutorial with sample are available. See the Documentation section for more information.

Sample Applications

The library includes a number of sample application for both WPF and GDI+. Here are some of them:

WPF Test Application

This is an application for browsing directory (recursively) of SVG files.

WPF W3C Test Suite

This is an application for viewing the W3C Test Suite compliant results. It has two panes: top and bottom. The top pane is the generated WPF output, the bottom pane is the W3C expected output image. By the test results, this is the most complete SVG reader for WPF!

GDI+ W3C Test Suite

This is an application for viewing the W3C Test Suite compliant results. It has two panes: top and bottom. The top pane is the generated GDI+ output, the bottom pane is the W3C expected output image.

Tutorial Samples

A number of tutorial samples are available in the TutorialSamples folder.

Credits

SharpVectors uses source codes from articles and other open source projects. We wish to acknowledge and thank the authors of these great articles and projects

Related Projects

The following are related SVG viewer projects for the .NET platforms

Related Repositories

The following are related SharpVectors repositories

  • SvgTestSuites : The W3C Test Suite files used by the SharpVectors for testing.
  • SvgXaml : SharpVectors based SVG to XAML converter application.
  • SvgViewer : SharpVectors based SVG viewer application.

sharpvectors's People

Contributors

akindle avatar bjn-a avatar ciplogic avatar grayed avatar guillaumesmartliberty avatar lucapassarella avatar marvinpogoda avatar mb-jp avatar mihailskuzmins avatar mihailskuzminsdg avatar mmatriccino avatar mp-arx avatar myd7349 avatar paulushub avatar polar-slon avatar ravenpride avatar ruslanfedoseenko avatar yavor87 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

sharpvectors's Issues

Feature 1: Converter Application

Create an end-user converter application to handle conversion from SVG to XAML and images.

This work item was migrated from CodePlex

CodePlex work item ID: '430'
Vote count: '0'

scale image

static void Main(string[] args)
{
// 1. Create conversion options
WpfDrawingSettings settings = new WpfDrawingSettings();
settings.IncludeRuntime = false;
settings.TextAsGeometry = true;

        // 2. Select a file to be converted
        string svgTestFile = "Test.svg";

        // 3. Create a file converter
            StreamSvgConverter converter = new StreamSvgConverter(wpfSettings);

        // 4. Perform the conversion to XAML
         converter.EncoderType = ImageEncoderType.PngBitmap;
        
        if (converter.Convert(svgStream, memStream))
{
      memStream.Position = 0;
      File.Write(File(memStream, "image/png", "C:\\Temp\\myfile.png")
}

    }

is it possible to scale the image before i write the file using File.Write ?

This work item was migrated from CodePlex

CodePlex work item ID: '1720'
Vote count: '1'

Feature 2: SVG Control

Provide a more complete SVG control.

This work item was migrated from CodePlex

CodePlex work item ID: '431'
Vote count: '0'

Transparent colors

It looks like FileSvgReader does not process transparent colors. Setting "style='fill:transparent'" makes it white, and #AARRGGBB format is not supported.
Is there anything I'm missing?

Attachments

Map_of_USA_MD.svg

This work item was migrated from CodePlex

CodePlex work item ID: '1863'
Assigned to: 'SelormeyPaul'
Vote count: '1'

Task 3: Improve Coordinate Units Support

Implement the support for bounding box relative coordinates; percentage and fraction bounding box.
 
Test Unit Samples:
coords-units-01-b.svg

This work item was migrated from CodePlex

CodePlex work item ID: '409'
Vote count: '0'

Get rid of System.Web assembly

Currently there are 2 references to system.web assembly :

in SharpVectors.Css (not used, I have removed it without errors)
in SharpVectors.Rendering.Wpf (in WpfRenderingBase, lines 88 and 133)
 
It's a drawback because if we want to use this library in .NET 4 project, we can't use NET 4 Client Profile (or 3.5 Client Profile) which targets end-user systems because of this dependency.
 
There are 2 solutions :
Migrate to .NET 4 and use WebUtility.HtmlDecode : http://msdn.microsoft.com/en-us/library/ee388355.aspx (not easy in short-term)
Stay in 3.5 and replace uses of HttpUtility.HtmlDecode by a home-made function.
 
FYI, I've got a sample Strings utility class which exposes Html & Url related methods against .NET 2 : http://pastebin.com/i6maWnUn
Feel free to copy it or create a simpler code based on it.

This work item was migrated from CodePlex

CodePlex work item ID: '510'
Vote count: '2'

WF - Hosting SharpVectors WPF

HeyHo Paul,

it is nice that you tried to help me, but it aint saying me anything right now.
It would be very nice if you could show me what you are meaning.

My situation is that we have complete Software in VB.NET 2010 in Windows Forms and we need to add some SVG we created for another branch.

With friendly Regards
Jan aka. Sonorpearl

Attachments

TestSample.zip
SVG_Scale.PNG
TestSample-Viewbox.zip
Click.PNG

This work item was migrated from CodePlex

CodePlex work item ID: '1899'
Assigned to: 'SelormeyPaul'
Vote count: '2'

Converter App -s doesn't work

(sourceArgs is assigned before the CLI args are parsed)
 
Please see the attached fix.

Attachments

cli-bugfix.diff

This work item was migrated from CodePlex

CodePlex work item ID: '570'
Vote count: '2'

Task 16: Silverlight Support

This is a separate project to create a new rendering component to render higher level WPF drawing object; shapes, texblock and canvas, and Silverlight.
 
This project will largely port the low-level rendering impmentations in SharpVectors.Rendering.Wpf to higher-level objects and then ensure Silverlight support.
 
Project Name: SharpVectors.Rendering.Silverlight

This work item was migrated from CodePlex

CodePlex work item ID: '422'
Vote count: '1'

Process with an Id of -1 is not running.

Sometimes I run into this System.ArgumentException:
HResult=-2147024809
Message=Process with an Id of -1 is not running.
Source=System
StackTrace:
at System.Diagnostics.Process.GetProcessById(Int32 processId)
at SharpVectors.Converters.MainStartup.Main(String[] args) in \Main\Samples\WpfConverters\MainStartup.cs:line 30
InnerException:

Line 30:
Process process = Process.GetProcessById(processId);

should be replaced with:
Process process;
try
{
process = Process.GetProcessById(processId);
}
catch
{
process = null;
}

This work item was migrated from CodePlex

CodePlex work item ID: '1721'
Vote count: '2'

Creating image in code

How would you create a new image for the WPF Image Control in C#?

In xaml it would be , but how would you write it in code-behind?

This work item was migrated from CodePlex

CodePlex work item ID: '1650'
Vote count: '1'

Memory leak

I think, there is a memory leak when I use FileSvgReader.Read method.

I have downloaded the SharpVectors converter application, and I have used the normal file converter.
The application takes ~30Mb-es after start. My svg file is about 300kb and when I click the "convert" button, the memory usage starts to increase.
When it is ready the application memory usage is ~60Mb (!!!) and do not decrease.

I have tried it with a 11Mb svg file, and the memory usage is ~700Mb after the successful convert.

It is the same situation in my applicaion which uses only the FileSvgReader.Read method.

Please check this situation!

Thank you!
Best Reagards,
Gergely

Attachments

Csongrad_megye.svg

This work item was migrated from CodePlex

CodePlex work item ID: '1889'
Vote count: '1'

Another locale issue: SvgAnimatedNumber Number Parsing

e.g. gradient stops get the wrong number, because SvgAnimatedNumber doesn't use the correct number format.
 
Here's a patch:
 
--- a/tools/SharpVectors-5704/src/Main/Source/SharpVectorModel/BasicTypes/SvgAnimatedNumber.cs
+++ b/tools/SharpVectors-5704/src/Main/Source/SharpVectorModel/BasicTypes/SvgAnimatedNumber.cs
@@ -20,7 +20,7 @@ namespace SharpVectors.Dom.Svg
public SvgAnimatedNumber(string str)
{

baseVal = Double.Parse(str);

baseVal = Double.Parse(str, SvgNumber.Format);
animVal = baseVal;
}

This work item was migrated from CodePlex

CodePlex work item ID: '511'
Vote count: '2'

Issue with embedded bitmap unsing SharpVectors.Runtime in the VS designer

Embedded bitmap images via SharpVectors.Runtime work fine at runtime, but in the VS2010 designer I get:
 
System.InvalidOperationException
BitmapImage has not been initialized. Call the BeginInit method, set the appropriate properties, and then call the EndInit method.
 
I couldn't figure out, where this is going wrong. I've attached a sample project.

Attachments

Test.zip
EmbeddedBitmapSource.cs

This work item was migrated from CodePlex

CodePlex work item ID: '543'
Vote count: '3'

Task 8: Linking Support

Implement for linking or hyper-links and related events.

This work item was migrated from CodePlex

CodePlex work item ID: '414'
Assigned to: 'SelormeyPaul'
Vote count: '1'

ImageSvgConverter : write output to stream

Hi,
 
I'm using ImageSvgConverter to convert svg files (inside a MemoryStream).
It seems that we can convert a stream to an image file, but not to an other stream.
 
Can you add an overload for the Convert function to allow converters to work from/to streams ?
 
Thanks.

This work item was migrated from CodePlex

CodePlex work item ID: '364'
Vote count: '2'

Task 2: ICC Profile Support

The current ICC profile support in the WPF is not working. Investigate the problem and provide a working solution.

This work item was migrated from CodePlex

CodePlex work item ID: '408'
Vote count: '0'

GDI broken?

Been looking at the GDI renderer and hit a problem so tried with the samples and they give the same error.

Inheritance security rules violated while overriding member: 'SharpVectors.Renderers.Gdi.GdiGraphicsRenderer.get_Window()'. Security accessibility of the overriding method must match the security accessibility of the method being overriden.

In GdiTextSVGViewer sample the error is when creating the SvgPictureBox control.

This work item was migrated from CodePlex

CodePlex work item ID: '1749'
Vote count: '1'

Limitation of conversion to 640x480

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'

SvgAnimatedNumber Bug

There is a bug in SvgAnimatedNumbers.cs:
public SvgAnimatedNumber(string str)
{
baseVal = SvgNumber.ParseNumber(str);
animVal = baseVal;
}

This is a problem on systems with other decimal separator then ".". I think this is the fix:
public SvgAnimatedNumber(string str)
{
baseVal = Double.Parse(str, SvgNumber.Format);
animVal = baseVal;
}

I checked all double.Parse() code lines. They look to be correct.

This work item was migrated from CodePlex

CodePlex work item ID: '1858'
Vote count: '1'

SVG Rastering Problem

Hello to everyone, when I try to rasterize the attached SVG I ottains an image smaller than I expected, with white borders around. If you open SVG file with a browser the result is correct.
For test use file "test_96dpi.svg".

Anyone knows the solution?

Thank you in advance.

Attachments

Group-000001-Page-000000.svg
test_96dpi.svg
foto_96dpi.jpg

This work item was migrated from CodePlex

CodePlex work item ID: '1840'
Vote count: '2'

How to load svg fonts?

I want to write text using the fonts in svg font files. How can I do this ? Someone can give me an example. Grateful for any help.

This work item was migrated from CodePlex

CodePlex work item ID: '1576'
Vote count: '1'

Task 12: Implement Stroke Miter Limits

The stroke miter limits is partly hacked since the SVG and WPF definitions of the miter limits are not the same.
The WPF team for reasons unknown, introduced a new way of computing the miter limits, which is not even compatible with that in GDI and GDI+.

This work item was migrated from CodePlex

CodePlex work item ID: '418'
Vote count: '0'

XmlXamlWriter is locale-dependent

When XmlXamlWriter writes Figures, it uses the users locale settings, causing in my case to use "," and ";" as decimal point and list separater.
This produces invalid XAML code.
 
Please use InvariantCulture:
 

writer.WriteAttributeString("Figures", markupObj.Instance.ToString());
writer.WriteAttributeString("Figures", System.Convert.ToString(markupObj.Instance, CultureInfo.InvariantCulture));
 
Tobias

Attachments

CultureInfo.patch

This work item was migrated from CodePlex

CodePlex work item ID: '501'
Vote count: '3'

Task 6: SVG Fonts

Implement the path-based SVG Fonts support.

This work item was migrated from CodePlex

CodePlex work item ID: '412'
Vote count: '1'

Problem rendering gradient fills

I have a problem with SharpVectors rendering gradient fills.
 
Here are three files that reproduce the problem:
 
http://www.codefurnace.com/pipe1.svg
http://www.codefurnace.com/pipe3.svg
http://www.codefurnace.com/pipe4.svg
 
You may be able to see, on pipe1.svg the gradient fill is rendered 90 degrees sideways. On pipe4.svg the radius gradient isn't even rendered. I'm using the GDI renderer in a WinForms application.
 
Any suggestions on how to fix it would be very helpful, or if I'm doing something wrong in the WinForms app, I'm keeping the SVG files in a resource file compiled in the application, and loading them from a stream.
 
Thanks...
 
-Ron

Attachments

testNewSQ104.svg
Ta15.svg

This work item was migrated from CodePlex

CodePlex work item ID: '434'
Assigned to: 'SelormeyPaul'
Vote count: '6'

Task 9: Masking

Masking support is currently not complete due to limitations in the WPF masking implementations.
 
Test Unit Samples:
masking-mask-04-f.svg
masking-mask-01-b.svg

This work item was migrated from CodePlex

CodePlex work item ID: '415'
Vote count: '1'

Task 5: Filters

Implement filter support. The filter support in WPF 3.0 and 3.5 are software implemented and very slow and not usable in large documents.
WPF 4.0 introduced hardware accelerated filter support.

This work item was migrated from CodePlex

CodePlex work item ID: '411'
Vote count: '1'

Task 1: Animation Support

Implement the animate, animateMotion, animateColor and animateTransform SVG tags.
The native SVG animation support does not require scripting and could be implemented even without the script support.

This work item was migrated from CodePlex

CodePlex work item ID: '407'
Vote count: '0'

Task 7: Interactivity Support

Implement basic interactivity, cursor, event etc., support.

This work item was migrated from CodePlex

CodePlex work item ID: '413'
Vote count: '1'

having trouble rendering some files

See attached file and how it renders black blobs and takes forever to load

Attachments

COMET.svg

This work item was migrated from CodePlex

CodePlex work item ID: '1226'
Vote count: '1'

Task 4: Complete Viewbox Attributes Support

Viewbox attribute "meet" is supported, but "slice" is not yet supported.
 
Test Unit Samples:
coords-viewattr-01-b
coords-viewattr-02-b

This work item was migrated from CodePlex

CodePlex work item ID: '410'
Vote count: '0'

Impossible to Scale and Print after render of GdiGraphicsRenderer. Raster is NULL or Empty

Hello,

We try to print the result of render action but the printing flow that is just created seems to be more larger than the paper size. So we want to adjust the printing area by a pretty common solution that is used with System.Drawing.Graphics component by DrawImage.
Rectangle printableFinal = new Rectangle(0, 0, 500, 500);
g.DrawImage(imgageToPrint, printableFinal);

Here is the end of our source code that provide a flow to be print :
[...]
// Définit l'évènement d'impression
printDocument.PrintPage += (sender, e) => PrintDOC(sender, e, wpfWindow);

       // Démarre l’impression
        printDocument.Print();
  }

    protected void PrintDOC(object sender, PrintPageEventArgs printEvtArgs, WpfSvgWindow wpfWindow)
    {
        Graphics g = printEvtArgs.Graphics;
        GdiGraphicsRenderer gdiRenderer = (GdiGraphicsRenderer)wpfWindow.Renderer;
        
        gdiRenderer.GraphicsWrapper = GdiGraphicsWrapper.FromGraphics(g, false);
        gdiRenderer.Render(wpfWindow.Document as SvgDocument);

// NOT WORKING CODE - Because "gdiRender.RasterImage" is NULL !!!
// Rectangle printableFinal = new Rectangle(0, 0, 500, 500);
// Bitmap imgageToPrint = gdiRenderer.RasterImage;
// imgageToPrintAP = gdiRenderer.GraphicsWrapper.IdMapRaster;
// g.DrawImage(imgageToPrintAP, printableFinal);
}

Printing action is working, our wpfWindow is perfectly print on the paper but element is to huge to fit on page. So we are trying to redure this element during the rendering process or just after to make the element be scale juste before the printing process.

We notice some problems on the component but we don't know if it is a bug or a bad use of it :

"gdiRenderer.RasterImage" provide a NULL value just after "gdiRenderer.Render(..." instruction
"gdiRenderer.IdMapRaster" provide a 180x180 empty image !

We need to catch the result flow of "gdiRenderer.Render" action.
How can we do that ?

Thanks for helping us.

Regards,

Jean-Pascal

This work item was migrated from CodePlex

CodePlex work item ID: '1583'
Vote count: '1'

ExtendedHttpWebRequest Issue

Hi there,
 
I have seen that you are using your ExtendedHttpWebRequest class to handle some features. I have a problem with this class, because it has broken my code. I have written the small example to explain my problem:
 
class Program
{
static void Main(string[] args)
{
// Everything works ok, here
{
WebRequest request = WebRequest.Create("http://google.com");
var httpRequest = (HttpWebRequest)request;
}

 
// Css document object is created
CssXmlDocument doc = new CssXmlDocument();

 
// InvalidCastException appears here
{
WebRequest request = WebRequest.Create("http://google.com");
var httpRequest = (HttpWebRequest)request;
}
}
}

 
This problem occurs because in CssXmlDocument there is following code:
SharpVectors.Net.ExtendedHttpWebRequest.Register();
SharpVectors.Net.DataWebRequest.Register();

 
I believe it is a bug, because HTTP and HTTPS schemes handling is implemented in .NET and in MSDN it is written: "The HttpWebRequest class is registered to service requests for HTTP and HTTPS schemes by default. Attempts to register a different WebRequest descendant for these schemes will fail.". This is certainly false, nevertheless these two schemes should not be overriden.

This work item was migrated from CodePlex

CodePlex work item ID: '390'
Vote count: '2'

Considering the viewbox in the SVG

Hello,

I'm trying to show an SVG within certain bounds. But depending on the SVG the icon should sometimes appear smaller than other icons - only the SVG itself knows how large it actually is. My goal is to render SVGs onto the face of buttons, so the button defines the maximum size of the SVG only. I would expect that the SVG would size according to the viewbox specified in the SVG.

An example:
The viewbox attribute in the SVG is a rectangle (x=-10, y=-10, width=40, height=40).
Graphical elements are placed inside a region (x=0, y=0, width=20, height=20).
I would expect that the finally rendered image contains a margin around the actual drawing that is 50% of the width of the drawing on the left and right side and 50% of the height of the drawing on the top and buttom side.

Is there a way to accomplish that? Your library is really nice and I've been using it for some time know, but this detail is a real showstopper (for me) at the moment :-/

It would be great, if you could give me a hint how I can get it working correctly.

Thank you very much!

Best Regards,
Ravenpride

This work item was migrated from CodePlex

CodePlex work item ID: '1957'
Vote count: '1'

Task 10: Improve Gradient Support

The gradient support still requires some improvements and fixing.

This work item was migrated from CodePlex

CodePlex work item ID: '416'
Vote count: '1'

GDI Null reference exception when GetBBox called on Text element

In the GdiGraphicsRender this code;
private SvgRectF GetElementBounds(SvgTransformableElement element, float margin)
{
SvgRenderingHint hint = element.RenderingHint;
if (hint == SvgRenderingHint.Shape || hint == SvgRenderingHint.Text)
{
GraphicsPath gp = GdiRendering.CreatePath(element);
ISvgMatrix svgMatrix = element.GetScreenCTM();

            Matrix matrix = new Matrix((float)svgMatrix.A, (float)svgMatrix.B, (float)svgMatrix.C,
                  (float)svgMatrix.D, (float)svgMatrix.E, (float)svgMatrix.F);
            SvgRectF bounds = SvgConverter.ToRect(gp.GetBounds(matrix));
            bounds = SvgRectF.Inflate(bounds, margin, margin);

            return bounds;
        }

is called when GetBBox is called on a Text element. GdiRendering.CreatePath returns null for a text element which then means the gp.GetBounds(matrix) blows up with a null reference exception.

This work item was migrated from CodePlex

CodePlex work item ID: '1751'
Vote count: '1'

two wpf rendering bugs (?) (text & image positioning)

hi there,
i have two sample SVGs which seem not to render properly.
one has misplaced character(s) and the other doesn't stretch/positioning the bitmap properly.
with the GDI+ renderer / internet explorer, they look right.
 
right now im looking to use the GDI+ renderer in our WPF project, because it renders properly :)
 
anyway, hope it helps you to improve this already great project.
 
thanks a lot,
greetings

Attachments

104-IDC_USESOLID.svg
wmmc_g050.svg
test.svg
test.png

This work item was migrated from CodePlex

CodePlex work item ID: '564'
Vote count: '2'

Feature 3: SVG Viewer - Squiggle.NET

Provide a full SVG viewer, Squiggle.NET, for viewing and browsing SVG files and directories. This should be similar to Batik SVG viewer, named Squiggle.

This work item was migrated from CodePlex

CodePlex work item ID: '432'
Vote count: '0'

LinearGradientBrush Problem

I am trying to open the following SVG file after downloading from: http://upload.wikimedia.org/wikipedia/commons/1/15/Boiling_water_reactor_english.svg

The "GdiTestSvgViewer" reports incorrectly the LinearGradientBrush, if it is 'vertical'. However the 'horizontal' LGB is ok.

Also the 'arrow-head' is incorrectly rendered.

I have downloaded the the change-set 19058.

Attached is the rendered image.

Attachments

boiler.jpg

This work item was migrated from CodePlex

CodePlex work item ID: '1438'
Vote count: '2'

XAML sometimes contains empty BitmapImage elements

After conversion, the XAML sometimes contains <svg:EmbeddedBitmapSource Data="..." /> and at other places , i.e. without data or URL.
In WpfImageRendering.GetBitmap, context.ImageVisitor is sometimes non-null and somtimes null.
Is there a technical necessity for this behaviour or is it a bug?
 
Attached is an svg where this can be reproduced e.g. in SVG-WPF Converter

Attachments

aktiviert.svg

This work item was migrated from CodePlex

CodePlex work item ID: '581'
Vote count: '2'

Feature 4: Documentations

Improved the XML Documentations in the codes and provide a compiled developer documentations. This should include both reference and conceptual (concepts and how-to) topics.

This work item was migrated from CodePlex

CodePlex work item ID: '433'
Vote count: '0'

Task 17: GDI Renderer Update

Update the GDI rendering to the level of the current WPF.

This work item was migrated from CodePlex

CodePlex work item ID: '423'
Vote count: '0'

bug in handling transform attribute

Hi,
 
i just recently stepped on a bug concerning the whitespace in the value of the transform attribute:
when the file contains for example transform="translate (10, 10), scale (1.1, 1.1), translate (-10, -10)" (yes thats right: with spaces between translate and scale and its adjoining parentheses) then we got an exception. if you eliminate the first space (translate(10, 10) instead of translate (10, 10)) the it no longer throws an exception but just does nothing - transform-wise)
 
If you need examples for that - please let me know
 
Regards,
 
Juergen Key

This work item was migrated from CodePlex

CodePlex work item ID: '589'
Vote count: '2'

Task 15: Text Improvements

Complete the support of vertical texts
Complete the support of text paths
Complete multi-position and multi-angle-rotation of characters.

This work item was migrated from CodePlex

CodePlex work item ID: '421'
Vote count: '1'

Task 13: Scripting Support

Implement the Javacript support to add useful animations and interactivities.

This work item was migrated from CodePlex

CodePlex work item ID: '419'
Vote count: '0'

SvgFontUri in xaml + SvgStopElement

Hi,

Created xaml file contains wrong font path. This code

<GlyphRun.GlyphTypeface>

</GlyphRun.GlyphTypeface>
throws an exception "A Dos path must be rooted, for example, 'c:'", because separator char must be '/' or "\".

source file SharpVectors.Converters.XmlXamlWriter ln 503:

string fontUri = temp.ToLower();
fontUri = fontUri.Replace(_windowsDir, _windowsPath);
my bugfix:

string fontUri = temp.ToLower();
fontUri = fontUri.Replace(_windowsDir, _windowsPath).Replace('\', '/');
But I'm not sure that's good enough.

I'm used this svg sample for testing.

BTW, You can't create xaml from this file, because some stop-element.offset in SVG is not defined, and code in SharpVectorModel\Fills\SvgStopElements.cs

public ISvgAnimatedNumber Offset
{
get
{
string attr = GetAttribute("offset").Trim();
if (attr.EndsWith("%"))
{
attr = attr.TrimEnd(new char[1]{'%'});
}
else
{
double tmp = SvgNumber.ParseNumber(attr) * 100;
attr = tmp.ToString(SvgNumber.Format);
}

    return new SvgAnimatedNumber(attr);
}

}
throws an exception on SvgNumber.ParseNumber(attr), because attr is empty.

In code

public static double ParseNumber(string str)
{
try
{
return Double.Parse(str, SvgNumber.Format);
}
catch (Exception e)
{
throw new DomException(DomExceptionType.SyntaxErr,
"Input string was not in a correct format: " + str, e);
}
}
I change
return Double.Parse(str, SvgNumber.Format);

to
return string.IsNullOrEmpty(str) ? 0 : Double.Parse(str, SvgNumber.Format);

because I think if attribute is not defined, that's means that value equals 0 by default.

This work item was migrated from CodePlex

CodePlex work item ID: '1902'
Vote count: '2'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.