Comments (5)
Hello,
svg has an extra attribute for the opacity value, or to be precise a few:
http://www.w3.org/TR/SVG/masking.html#ObjectAndGroupOpacityProperties
Its a float in the range 0..1 where 0 is fully transparent and 1 fully opaque.
So instead of o.Fill, you should write a value to o.FillOpacity. There is also o.Opacity (overall opacity) and o.StrokeOpacity (opacity for strokes).
from svg.
I've set the FIllOpacity and Opacity on all SvgVisualElements to 1 already (did not include that part in my sample code, sorry).
I looked through the source and it appears that the SvgColourServer attempts to extract and re-calculate the alpha channel to use for the brush (https://github.com/vvvv/SVG/blob/master/Source/Painting/SvgColourServer.cs line 27).
I'm going to run some tests and see what's happening here. But it seems like a Color instance with an alpha channel is meant to be supported.
from svg.
Hm... Yes, there seems to be some work in that direction. But its as far as i know not in the official svg spec. To control the transparency you have to set the opacity attributes. In your case the FillOpacity to 0.25f.
But anyways the code looks somehow correct. But there could be a problem with the division. Since both values are Integer, i think its always 0 because Colour.A is smaller than 255. it should be:
int alpha = (int)((opacity * (this.Colour.A/255.0f) ) * 255);
I fixed that by 457a82f. If you can compile the code you can check that right away. Otherwise you have to wait for the next Nuget package.
from svg.
Nuget 1.0.1 is now also available.
from svg.
I think what I was trying to do would result in deeper-nested elements becoming more and more transparent, so it's not right anyway. I appreciate the attempted fix, though.
What I'm doing is programatically recoloring SVGs. So what I'll do when I need to make one translucent is move all of the SVG's child elements into a new group element with the opacity/fill set appropriately.
from svg.
Related Issues (20)
- PNG Conversion issue - complex images not rendered correctly HOT 2
- PNG Conversion issue - image not rendered correctly HOT 2
- Help with rendering and scaling. HOT 2
- Problem writing a document with changed paths in it HOT 2
- System.Drawing.Common has error in .net 7 HOT 1
- System.Drawing.Common has error in .net 7 HOT 2
- Exporting as a pure black image HOT 2
- "Parameter is not valid" exception when document misses width and/or height HOT 2
- Request for release to NuGet HOT 2
- England Flag HOT 2
- Pattern colors missing
- Извините но я утюг, обработка нажатия на элементы SVG HOT 3
- Latest Nuget version can not load images - BUG HOT 7
- Is it possible to vectorize text paths?
- SVG rendered to PNG is all black instead of a gradient
- Draw Svg in Svg with different ViewBox
- Looking for new maintainer(s) HOT 41
- Contributors: Planned Cleanup - please comment HOT 7
- Contributors: TargetFrameworks - please comment HOT 1
- Contributors: Code Generators 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.