Comments (10)
Looking closer, I see this:
Exception thrown: 'System.InvalidCastException' in Svg.Custom.dll
testhost Warning: 0 : Attribute 'stroke' cannot be set - type 'Svg.SvgPath' cannot convert from string '#FF0000FF'.
Exception thrown: 'System.InvalidCastException' in Svg.Custom.dll
testhost Warning: 0 : Attribute 'fill' cannot be set - type 'Svg.SvgPath' cannot convert from string '#FF0000FF'.
from svg.skia.
The inner exception that triggers this is:
Unable to cast object of type 'Svg.SvgColourServer' to type 'System.Drawing.Color'.
from svg.skia.
Seems it is because the colors have transparency and then the SvgColourConverter
only checks for color lengths of 4 or 7, so basically #RGB
or #RRGGBB
... I am pretty sure alpha is supposed to be working in there?
from svg.skia.
Seems it was this commit:
wieslawsoltes/SVG@8c9b1f2#diff-2d8975b837b07567b22b03dbddeb4d6d8dc96107c7dbbcd3baf921f1c0e2ed19
Not sure why this was changed in the commit that was adding ExCSS.
from svg.skia.
Another scary thing with the converters from System.Drawing is that it expects ARGB:
// We support 1, 3, or 4 arguments:
// 1 -- full ARGB encoded
// 3 -- RGB
// 4 -- ARGB
However, the SVG spec uses CSS colors which is RGBA:
https://developer.mozilla.org/en-US/docs/Web/CSS/hex-color
#RGB // The three-value syntax
#RGBA // The four-value syntax
#RRGGBB // The six-value syntax
#RRGGBBAA // The eight-value syntax
EDIT: Actually, the SVG spec says only 3 or 6 digits: https://developer.mozilla.org/en-US/docs/Web/SVG/Content_type#color but I see my edge is using the full alpha as well making it all a lie if you ask me.
from svg.skia.
I am trying this:
else if (colour.StartsWith("#", StringComparison.InvariantCulture))
{
// There are 4 types of #-based colors:
// 4 chars: #RGB
// 5 chars: #RGBA
// 7 chars: #RRGGBB
// 9 chars: #RRGGBBAA
if (colour.Length == 4)
colour = string.Format(culture, "#{0}{0}{1}{1}{2}{2}", colour[1], colour[2], colour[3]);
else if (colour.Length == 5)
colour = string.Format(culture, "#{0}{0}{1}{1}{2}{2}{3}{3}", colour[1], colour[2], colour[3], colour[4]);
else if (colour.Length != 7 && colour.Length != 9)
throw new SvgException("Colour is in an invalid format: '" + colour + "'");
return base.ConvertFrom(context, culture, colour);
}
from svg.skia.
You are referring to css color but it's different specification from svg. Alpha is not supported you have to use stroke-opacity.
from svg.skia.
https://www.w3.org/TR/2008/REC-CSS2-20080411/syndata.html#color-units
The format of an RGB value in hexadecimal notation is a '#' immediately followed by either three or six hexadecimal characters. The three-digit RGB notation (#rgb) is converted into six-digit form (#rrggbb) by replicating digits, not by adding zeros. For example, #fb0 expands to #ffbb00. This ensures that white (#ffffff) can be specified with the short notation (#fff) and removes any dependencies on the color depth of the display.
from svg.skia.
https://www.w3.org/TR/2008/REC-CSS2-20080411/colors.html#propdef-color
from svg.skia.
OK, that is sort of where I eventually got to :)
We can close this as a design goal. BUT, Edge supports alpha. So yeah, it is all a lie anyway
from svg.skia.
Related Issues (20)
- The Fifth Element isn't shown in sliding menu (Avalonia.Skia.Svg) HOT 1
- SvgImage creation outside uithread HOT 2
- EXEC conversion error on UWP build HOT 4
- Version 11.0.0.13 and Android HOT 4
- The AccessViolationException occurs in the SvgCustomDrawOperation.Render method HOT 3
- ToolTip.Tip not working when using SvgImage as Source for Image HOT 1
- Question: Is-it possible to load SVG by symbol ? HOT 1
- Nuget package V1.0.0.14 is no more compatible with .Net Std 2.0 HOT 3
- Can't SvgSource.LoadFromStream anymore HOT 4
- Avalonia: <Svg IsVisible="False"/> doesn't work with Effect. HOT 1
- Translation on a path not working HOT 1
- Question (performance) - does this library use internal off-device caching? HOT 1
- SvgImage not re-rendering on binding update HOT 2
- Update ImageSharp dependency HOT 1
- DrawingContext.DrawImage() method not draws an SvgImage in some cases
- Regression with SVG attribute (fill specified, style empty)
- SVG to PNG renders inline images incorrectly (#99)
- Avalonia control misrenders nested groups with non-trivial transforms HOT 1
- Add support for var() CSS function HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from svg.skia.