I may have found a problem with pattern filling in Batik. I was working on an example from the O'Reilly "SVG Essentials" book and Batik does not match the description in the book. ASV does match the book.This is very complex, but my (fairly careful) reading of the specification says Batik
I don't fully understand what the spec says about the patternUnits and patternContentUnits attributes, but the behavior of this pattern doesn't match anything I can come up with.
is right on this one. Basiclly you have to keep in mind that 0,0 in Object boundingBoxUnits
is (in this case) really 10,10. So if you do the substitution you can see:
<pattern id="tile" x="10" y="10" [...]>Since x,y on pattern define a new coordinate system that is used for the
<path d="M10,10 [...] />
<path d="M10,10 [...] />
</pattern>
replicated content, you really want M0,0. This is a bit of an odd case
as you are 'mixing' coordinate systems that don't make sense to mix (you end up
applying the objectBoundingBox transform twice). I essentially always use viewBox
to establish the inner coodinate system as this almost always makes a lot more sense
(at least to me).
My understanding is that the example below should tile with the blocks side by side all over the area of the rect. In reality, each tile is offset by the x,y coordinates of the rectangle.I hope I've done so. :)
Otherwise, can somebody tell me what I'm doing wrong?
Thanks, G. Wade
<?xml version="1.0"?> <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="300" height="300"> <defs> <pattern id="tile" x="0" y="0" width="0.2" height="0.2" patternUnits="objectBoundingBox" patternContentUnits="objectBoundingBox"> <!-- Doesn't display together in Batik --> <path d="M0,0 Q.05 .20 .10 .10 T .20 .20" style="stroke: black; fill:none; stroke-width:0.01;"/> <path d="M0,0h0.2v0.2h-0.2z" style="stroke: black; fill:none; stroke-width:0.005;"/> </pattern> </defs>
<rect id="bkg" x="10" y="10" height="280" width="280" fill="url(#tile)" stroke="#888" stroke-width="0.5"/> </svg>
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
