Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong rect displaying #95

Closed
Kozinaka opened this issue Mar 13, 2019 · 12 comments
Closed

Wrong rect displaying #95

Kozinaka opened this issue Mar 13, 2019 · 12 comments
Assignees

Comments

@Kozinaka
Copy link

Kozinaka commented Mar 13, 2019

There are sample of two similar files with single rect 32x32 px size. Both of them editable by Inkscape and don't change it's behaviour after resaving in it. Right.svg displaying right, Wrong.svg displaying with error (rendered rect is smaller than expected).

Files to test: Samples.zip

RightPreview

WrongPreview

@paulushub paulushub self-assigned this Mar 14, 2019
@paulushub
Copy link
Contributor

@Kozinaka I have found the source of the issue, but there is no fix needed.

In both conversion (see the Xaml Output), a root clipping region is added due to the defined size of 32 by 32.

    <DrawingGroup.ClipGeometry>
      <RectangleGeometry Rect="0,0,32,32" />
    </DrawingGroup.ClipGeometry>

The clipping region in the output is affecting the "wrong" output file. There is no need for a fix because the conversion settings allow you to turn on or off the root clipping region through a property named IgnoreRootViewbox, which is false by default and is used as such in the WpfSvgTestBox application.
Setting this property to true in the SvgPage.xaml.cs constructor will give the same output for both files.
_wpfSettings.IgnoreRootViewbox = true;

I will update the WpfSvgTestBox application to make the conversion settings available to turn on or off the options and observe the effects on the outputs.

@Kozinaka
Copy link
Author

But both files contains one single green rect [0,0,32,32] inside of it in Inkscape and both of it have clip region [0, 0, 32, 32]! Why "wrong" file have something outside [0,0,32,32] when output in SharpVectors?

@paulushub
Copy link
Contributor

Nice observation, thank you. It is a bug in the current SvgNumber.ScientificToDec method.

paulushub added a commit that referenced this issue Mar 17, 2019
Fixed a bug in the SvgNumber.ScientificToDec method.
This fixes the issue #95
@paulushub
Copy link
Contributor

Thanks for submitting this issue, I think it have now fixed it in the committed code 5bc4324.
Please verify the fix.

@Kozinaka
Copy link
Author

Build is broken :)
..\Source\SharpVectorModel\BasicTypes\SvgTransform.cs:
'SvgNumber.DoubleRegex' is inaccessible due to its protection level

@paulushub
Copy link
Contributor

Sorry, but my local repository is not broken!!!
I will have to commit all changes (many are unfinished work!) to fix this issue, let me review my local sources first, sorry for the inconvenience.

paulushub added a commit that referenced this issue Mar 19, 2019
The SvgTransform class was updated. #95
@paulushub
Copy link
Contributor

The review will take time, I think committing the SvgTransform class will fix the problem build.

@paulushub
Copy link
Contributor

Finally committed all the local changes: ad7b893

@Kozinaka
Copy link
Author

Kozinaka commented Apr 3, 2019

But now it explodes in runtime when loading some icons. :)
F.e. WpfSvgTestBox crashes when try to load this icon: Front32.zip

@paulushub
Copy link
Contributor

@Kozinaka Sorry, I could not reproduce this latest issue. The attached icon is rendered normally as shown below:

Front32

@Kozinaka
Copy link
Author

Kozinaka commented Apr 4, 2019

There are needed to add independent number format to decimal.Parse. In Russian format dot is decimal delimiter, not comma.

Fix

@paulushub paulushub reopened this Apr 5, 2019
paulushub added a commit that referenced this issue Apr 5, 2019
This will fix issues with parsing number on more localized Windows such as the Russian Windows.
Should fix the updated issue #95
@paulushub
Copy link
Contributor

@Kozinaka Not having access to Russian Windows (only English and Japanese) but was able to reproduce the parsing error with var culture = CultureInfo.GetCultureInfo("ru-RU");.
Hope the latest commit will now fix the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants