change width and color of Voronoi pattern strokes?

Post questions on how to use or achieve an effect in Inkscape.
User avatar
brynn
Posts: 10309
Joined: Wed Sep 26, 2007 4:34 pm
Location: western USA
Contact:

change width and color of Voronoi pattern strokes?

Postby brynn » Tue Oct 18, 2011 5:58 pm

Hi Friends,
I've been playing with the Voronoi extension. I'm hoping to use it to help simulate a wrinkly leaf. But for it to work, I would need to make the strokes of the pattern much thinner, and possibly a different color than black. In the XML editor, I thought I found a way to change the color. I thought changing the style attribute color:

Code: Select all

[u]color:#000000[/u];fill:url(#pattern48050);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.05;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate

my emphasis

would work. But changing #000000 to anything else does not change the color of the pattern's stroke. Unless I did something wrong. I haven't used the XML Editor much. I simply replaced '000000' to '00ccff', then clicked the Set button. The value changed, but the color on the canvas did not. (I also tried Ctrl + Enter, per instructions in status area, with same result.)

I don't see anything there that might help me thin the stroke. The stroke value appears to change the stroke of the object, not the pattern. And I suspect that color value affects the fill, in the absence of the pattern.

In the extension dialog, there are 2 options, but they seem to only affect the size of the cells and the pattern. I read the instructions there, but can't find any combination that thins the stroke of the pattern.

So is there any way to change these things, with or without XML Editor? Short of using a Voronoi pattern and tracing over it to create a compound path, and then doing object to pattern, I can't find any way to do it.

Much later....
Well, whenever I'm about to post the phrase 'I can't find any way to do it', I always go back and try everything I can possibly think of, before I actually post it, lol. So I may have found somewhat of a workaround to the thinning stroke issue. If I make the Voronoi pattern much larger than what I need -- larger cells, like approx. 5 to 10 times larger and I need to use a much larger object as well. Then I can scale down the pattern using the pattern handles, and it does thin the stroke. Then I can use the object that's going to be filled with the pattern, and do path intersection on the larger object. The final result is a thinner stroke in the pattern. But not much thinner. I'd say it's no more than a third narrower. I need at least 2 thirds smaller.

I think tracing the Voronoi pattern to make a custom pattern would be easier. (Because there will be many leaves to cut/intersection out.) Plus I could change the color of the stroke.

Does anyone know how to change the color or thin the stroke of the Voronoi pattern (not the object)?

Thanks for your help :D

PS - perhaps some sort of extra XML code, that's not there yet, needs to be added in the XML Editor?
PPS - actually I thought pattern colors could be changed in the XML Editor. This wouldn't be a bug would it? I'm still using 0.48.1 on Win7, 64-bit.

~suv
Posts: 2272
Joined: Sun May 10, 2009 2:07 am

Re: change width and color of Voronoi pattern strokes?

Postby ~suv » Tue Oct 18, 2011 6:49 pm

brynn wrote: In the XML editor, I thought I found a way to change the color. I thought changing the style attribute color:

Code: Select all

color:#000000;fill:url(#pattern48050);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.05;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate

would work. But changing #000000 to anything else does not change the color of the pattern's stroke. Unless I did something wrong. I haven't used the XML Editor much. I simply replaced '000000' to '00ccff', then clicked the Set button. The value changed, but the color on the canvas did not. (I also tried Ctrl + Enter, per instructions in status area, with same result.)
brynn wrote:I don't see anything there that might help me thin the stroke. The stroke value appears to change the stroke of the object, not the pattern. And I suspect that color value affects the fill, in the absence of the pattern.

You have to edit the pattern definition for 'pattern48050' itself if you want to change colors of paths in the pattern, and not try to edit the path which has the pattern fill - the pattern definition is in the <defs> section. And you have to edit the actual stroke properties, not the fallback 'color:' property.
Be aware that pattern definitions can be nested: depending on your current drawing, it might save you some time if you to look up the name of the pattern in the 'Fill & Stroke' dialog.

brynn wrote:So is there any way to change these things, with or without XML Editor? Short of using a Voronoi pattern and tracing over it to create a compound path, and then doing object to pattern, I can't find any way to do it.
If you don't want to dive into the SVG/XML code, you can always convert a pattern to objects, change the style attributes of the resulting selection of paths like with regular paths and shapes, and then convert the same selection back to a pattern (menu 'Object > Pattern'). I would recommend this anyway for the Voronoi pattern (because due the way the extension was written, in the Voronoi pattern definition, each line is a separate object, and you'd have to edit each of them in the XML Editor to change the stroke color - the stroke-width can be changed by setting it as style attribute of the pattern definition itself (i.e. only once, and it will be inherited by all paths inside the pattern definition)).

brynn wrote:PS - perhaps some sort of extra XML code, that's not there yet, needs to be added in the XML Editor?
No. The pattern definition exists, you did edit the wrong "node" (object) in the XML Editor.

brynn wrote:PPS - actually I thought pattern colors could be changed in the XML Editor. This wouldn't be a bug would it?
Sigh ;) . Patterns can be edited in the XML Editor. And no, your problem is not a bug. Just keep in mind that if you dive to editing the SVG source, it is recommended to have minimal knowledge about SVG itself (you might have initial success based on trail-and-error methods, but with pattern definitions, you'll then probably hit this little issue at some point: #708269 “Changing a pattern color with XML Editor doesn't always update canvas” (Note: that bug is not related to your original question)).

    a little later…
    Sorry brynn if I hit the wrong note in my reply - maybe it's not my day to write helpful comments? :oops:

User avatar
brynn
Posts: 10309
Joined: Wed Sep 26, 2007 4:34 pm
Location: western USA
Contact:

Re: change width and color of Voronoi pattern strokes?

Postby brynn » Wed Oct 19, 2011 1:56 am

You know I never really set out to annoy you, ~suv :lol: I try to remind myself to be flattered that you seem to expect so much of me. And of course I understand that everyone has bad days, now and then. I always learn from your replies, and I always appreciate your help! Image

Sigh . Patterns can be edited in the XML Editor. And no, your problem is not a bug. Just keep in mind that if you dive to editing the SVG source,....

No, it was not my intent to dive into XML. I was just trying everything I could think of to change the pattern, as I described. Of course I had no idea I should be looking in the defs section. I had selected the pattern and opened the editor, which is my understanding of how to locate associated code.

I hadn't thought of converting the pattern to an object! Since it was made with an extension....well, I guess I didn't think any non-custom drawn pattern could be converted to an object. I thought you could only do Pattern to Object, if Object to Pattern had been done first. This might be interesting to explore, once I get back on my usual computer.....but it sounds like the best solution :D

Thanks again Image


Return to “Help with using Inkscape”