Hi Cameron,

Cameron McCormack <[EMAIL PROTECTED]> wrote on 05/04/2006 08:21:18 PM:

> Thomas DeWeese:
> >    The short answer is that I think that most of the 'old' Graphics 
> > methods that draw 'lines' should probably include the .5 pixel 
> > shift in device space.
> 
> But that depends on the current transform, right (because it's device
> space you're worrying about)?  Since I'm just statically converting to
> SVG, I can't be changing the values every time the transform to device
> space changes because of panning, etc.

   So I don't think you need to worry about it once it is generated,
you just need to shift it in the 'generators' concept of a device pixel.
The simplest (and correct 95% of the time) would be to simply subtract
.5 from the x,y end points.  I think if you map the points to device
space (using the SVGGraphics2D's current transform) shift them -.5 pix 
then map them back to user space you will have the right answer in 
essentially all cases.

> >    Actually I think the proper hint is shape-rendering="crispEdges",
> > geometricPrecision indicates that you want the rendering to be as
> > close to the real geometry as possible (i.e. use anti-aliasing).
> 
> So actually, I want the converted shapes to use whatever rendering mode
> is desired from the parent SVG document the HTML is embedded in.  For
> these simple borders, I want them to look right regardless of the
> rendering mode in use (and ignore whatever rendering hints were set on
> the SVGGraphics2D).

   So getting the geometry aligned properly will help a lot with that...

> I think this HTML renderer uses only the "old" drawing methods, and
> assumes pixel level operations (except for anti-aliased text).  Is there
> some way I can get consistent results regardless of the rendering mode?

   You can if you 'know' the device transform but if that can be arbitrary
then no.  Your lines will look different if crisp edges or geometric 
precision
is set when a 1px line crosses pixels.  But honestly I think setting crisp
edge is exactly what you want in this case.  You don't want/expect 
anti-aliasing of geometry (note that shape-rendering doesn't impact
text-rendering).

> Would it help if I convert all the drawLine calls into a path that
> covers the same space as the line?

   This could (you would have more control) but I think the right 
thing to do in this case is fix the generator so it aligns 'old' 
drawing methods properly on the pixel grid.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to