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 Bertrand Fontaine <fo...@hotmail.com> on 2002/07/26 14:09:07 UTC

Qu. on UnitProcessor

Hello!

We are using SVGLocatable.getBBox() to determine the bounding box of various 
elements of an SVG file. Our understanding is that the returned SVGRect 
specifies the x, y, width and height information in user space. We would 
like now to convert from user space to SVG space in pixels in order to get 
the actual space that would be taken on screen. UnitProcessor sounds like 
the way to go but we experience problems using it. Could someone 
validate/clarify the process we intend to use, that looks the following so 
far:

a) Get a UnitProcessor.Context instance
All methods of UnitProcessor require a UnitProcessor.Context instance as a 
parameter. The only way to get one is to invoke the static 
UnitProcessor.createContext(BridgeContext, Element) method. But how to get 
the appropriate BridgeContext instance? In the archives, we have found that 
as far as JSVGComponent holds a protected reference to BridgeContext, we 
could subclass it and implement a public getBridgeContext() method returning 
the required BridgeContext. This sounds really tricky... Is this really the 
way to go?

b) Convert from user space to SVG space
UnitProcessor comes with a userSpaceToSVG(float v, short type, short d, 
UnitProcessor.Context ctx) method. Is this the right one to use for our 
problem? If yes, could someone clarify what the "type" parameter is about?

c) Convert from SVG metric system to pixels
The value we would get after having invoked userSpaceToSVG() would still be 
expressed in the metric system of the SVG file (pt, cm, etc.). We would 
convert to pixels by using the provided static UnitProcessor methods.

Thank you very much for clarifying,

Bertrand Fontaine

_________________________________________________________________
Chat with friends online, try MSN Messenger: http://messenger.msn.com


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


Qu. on UnitProcessor

Posted by Thomas E Deweese <th...@kodak.com>.
>>>>> "BF" == Bertrand Fontaine <fo...@hotmail.com> writes:

BF> We are using SVGLocatable.getBBox() to determine the bounding box
BF> of various elements of an SVG file. Our understanding is that the
BF> returned SVGRect specifies the x, y, width and height information
BF> in user space. We would like now to convert from user space to SVG
BF> space in pixels in order to get the actual space that would be
BF> taken on screen. UnitProcessor sounds like the way to go but we
BF> experience problems using it. Could someone validate/clarify the
BF> process we intend to use, that looks the following so far:

    I think you actually want the various matrix methods.  In
particular SVGLocatible.getScreenCTM().  I think these are now
implemented in CVS Batik (but perhaps not for 1.5B3).

BF> a) Get a UnitProcessor.Context instance All methods of
BF> UnitProcessor require a UnitProcessor.Context instance as a
BF> parameter. 

    I don't think this is the way you want to go...


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