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

SVG colors confused in SkiaSharp.Svg 1.60.0 #42

Closed
charlesroddie opened this issue May 30, 2018 · 5 comments
Closed

SVG colors confused in SkiaSharp.Svg 1.60.0 #42

charlesroddie opened this issue May 30, 2018 · 5 comments

Comments

@charlesroddie
Copy link

charlesroddie commented May 30, 2018

SkiaSharp.Svg 1.60.0 gets colors confused, with text color sometimes taken from the colors of other elements. 1.59.1 is OK.

SVGColors.zip

Should look like:

image

But looks like this in 1.60.0, as some text color is taken from other white text:

image

Tested using SkiaSharp / SkiaSharp.Views.Forms 1.60.0 and 1.60.1

@charlesroddie charlesroddie changed the title SVG colors confused in 1.60.0 SVG colors confused in SkiaSharp.Svg 1.60.0 May 30, 2018
@AxelUser
Copy link
Contributor

AxelUser commented Jun 5, 2018

Seems like something is wrong with path's default fill. Temporal measure before cure is to set to all groups their colors:
<g style="clip-path:url(#SVGID_36_);fill:black;">.

@daniel-luberda
Copy link
Contributor

This should be fixed with: 9cf03c4#diff-54eeb522f1f0baf1f0fb5e1d63c39ba4R889

@AxelUser
Copy link
Contributor

@daniel-luberda Hi! Your fixes are quite reasonable, but I checked your fork's demo with image in issue and result is the same.
Seems like problem is caused by preserving (cascading) fill color here: https://github.com/mono/SkiaSharp.Extended/blob/master/SkiaSharp.Extended.Svg/source/SkiaSharp.Extended.Svg.Shared/SKSvg.cs#L871

if (string.IsNullOrEmpty(fill))
{
    // no change
}

It may be reproduced if you in SkiaSharpDemo/images/logos.svg in path with id microsoft-text remove style="fill:#727272". This will result in preserving blue fill color from previous logo (Xamarin) in caption "Microsoft". Example is somewhere below.

If you pass fills to all groups or paths/rects/etc, there is no problem. May be it is some kind of fail in Adobe Illustrator. But somehow web-browsers support cascading correctly.

image

@AxelUser
Copy link
Contributor

Fixed in #44
image

@mattleibow
Copy link
Contributor

Merged #44

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

No branches or pull requests

4 participants