You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-users@xmlgraphics.apache.org by Joshua Nibecker <jo...@gmail.com> on 2007/10/31 17:44:30 UTC

Custom Scaling

I would like to preserve stroke-width when scaling.  In other words
when I give the renderer a scaling transform I would like the output
to have the same stroke-width as before the application of the
transform.  I know this is very un-svg like since the 's' in svg
stands for scalable.  It looks like I could build a bridge that will
always render shapes with a defined line width.  I am just not sure
how to accomplish this.  Any help would be most appreciated.

Regards,

Joshua

---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org


Re: Custom Scaling

Posted by th...@kodak.com.
Hi Joshua,

"Joshua Nibecker" <jo...@gmail.com> wrote on 10/31/2007 12:44:30 
PM:

> I would like to preserve stroke-width when scaling.  In other words
> when I give the renderer a scaling transform I would like the output
> to have the same stroke-width as before the application of the
> transform.

   The easiest way to accomplish this would be to replace the
current StrokeShapePainter with one that transforms the shape
to the screen and then strokes it in screen space.

> I know this is very un-svg like since the 's' in svg
> stands for scalable.  It looks like I could build a bridge that will
> always render shapes with a defined line width.  I am just not sure
> how to accomplish this.  Any help would be most appreciated.

   Actually the tricky bit will be inserting your bridge since
this really isn't well supported by the current PaintServer
class.  Actually without changing the code I don't see a
simple way to do this (the only 'clean' way would be to replace
all the basic shape bridges with your own versions that just
override the 'createShapePainter' method).

RE: Custom Scaling

Posted by "Bishop, Michael W. CONTR J9C880" <Mi...@je.jfcom.mil>.
To preserve the stroke-width, I would do the following:

- Store the original stroke-width value.  (e.g. 4)
- Apply the scaling transform to the renderer.
- Retrieve the scale value of the renderer (could be tricky if rotate,
skew, or shear is involved) (e.g. 2)
- Apply the inverse of the scale value to the stroke-width 4 * (1/2) ==
2

Tricky, but I'm not sure how else you would achieve it.  If you apply a
transform to a rendering, it transforms the entire document without
changing any values.

Michael Bishop

> -----Original Message-----
> From: Joshua Nibecker [mailto:joshuanibecker@gmail.com] 
> Sent: Wednesday, October 31, 2007 12:44 PM
> To: batik-users@xmlgraphics.apache.org
> Subject: Custom Scaling
> 
> I would like to preserve stroke-width when scaling.  In other 
> words when I give the renderer a scaling transform I would 
> like the output to have the same stroke-width as before the 
> application of the transform.  I know this is very un-svg 
> like since the 's' in svg stands for scalable.  It looks like 
> I could build a bridge that will always render shapes with a 
> defined line width.  I am just not sure how to accomplish 
> this.  Any help would be most appreciated.
> 
> Regards,
> 
> Joshua
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: 
> batik-users-help@xmlgraphics.apache.org
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org