|
Filling an svg shape using fill() |
Posted by Claudio Weber Abramo on Jul-25-2013 05:16 |
|
Dear Peter:
I am aware that ChartDirector's fill() operator doesn't work with SVG bounded areas. I've read somewhere here in the forum that this is because the SVG standard doesn't allow for it. How come? Since a shape in SVG is perforce exhaustively described, it would seem that the CD fill() tool would need to determine which shape includes the pointer coordinates and then append the SVG fill property to it.
Or am I being naive?
Cheers. |
Re: Filling an svg shape using fill() |
Posted by Peter Kwan on Jul-25-2013 17:03 |
|
Hi Claudio,
The "fill" refers to "flood fill". The fill starts from a point, and the fill spread out in all directions in which the pixels are of the same color as the initial point. For example, if the initial point is white, it will fill all white regions connect to that white point.
Flood fill does not fill a "shape" in the SVG sense. For example, suppose your image background is white, and in it there are some color shapes, and also a picture of a man wearing a completely white shirt. If you flood fill on a background point (white point), it may fill the background as well as the white shirt (assume they are all connected), and not fill the color shapes and the other part of the man. The boundary of the fill region is not a shape in vector graphics.
Hope this can help.
Regards
Peter Kwan |
Re: Filling an svg shape using fill() |
Posted by Claudio Weber Abramo on Jul-25-2013 20:26 |
|
Dear Peter:
Perhaps my observation wasn't complete.
I am aware of how a flood fill works, and also that CD's fill operation is a flood fill.
However, from the point of view of the user of a tool, what matters is the result it achieves. So, "filling an area" in the present context means colouring a bounded area with some colour -- whether the area is defined by sameness of neighbouring pixels in a bitmat or by a closed curve in vector graphic.
For the user, filling an area in Photoshop (say) means the exact same thing as filling an area in CorelDraw (say). Regardless of the mechanism behind the operation -- "following" pixels in a raster graphic in one case and applying the attribute to an object in the other --, what the user does is to press the "bucket" button.
In CD, "pressing the bucket button" would be applying the fill() operator.
Since CD is such a wonderful tool, I was just asking why is it that it can't fill a vector shape. Perhaps because CD doesn't load SVGs, and so the need didn't arise?
Anyway, CD is quite a good package, and my obs were meant as a collaboration.
Best regards. |
Re: Filling an svg shape using fill() |
Posted by Peter Kwan on Jul-25-2013 23:13 |
|
Hi Claudio,
Note that SVG is not just above shapes of closed curves. You can have raster images in SVG too. (I think you are aware you can insert images taken from a digital camera in SVG.) So a "flood fill" in SVG is not equal to filling a region bounded by curves - the region can be partly or totally bounded by a raster image too.
Filling a region bounded by curves is another kind of fill, not "flood fill". This involves computing a shape equal to the the intersertion of other shapes and fill the intesection shape. Unluckily, ChartDirector is designed as a charting package, not a computer graphics package, and it cannot compute the intersection of shapes.
Regards
Peter Kwan |
|