Yes actually there is a lot more to the story. I'm not
using the rasterizer, I'm using the transcoder. 

I am getting the rect width from the doc which is 612.

I need to scale the image down to 500 width so I get
the "scale factor" = 500/612 = .817

Then I transcode the image by using something like
this:

rectelementX = rect element's xcoord
rectelementY = rect element's ycoord
rectelementW = rect element's width
rectelementH = rect element's height

JPEGTranscoder trans = new JPEGTranscoder();
Rectangle aoi = new Rectangle(rectelementX,
                            rectelementY,
                            rectelementW,
                            rectelementH);

trans.addTranscodingHint(JPEGTranscoder.KEY_QUALITY,
new Float(.8));
trans.addTranscodingHint(JPEGTranscoder.KEY_WIDTH, new
Float(width*scaleFactor));
trans.addTranscodingHint(JPEGTranscoder.KEY_HEIGHT,
new Float(height*scaleFactor));
trans.addTranscodingHint(JPEGTranscoder.KEY_AOI, aoi);

TranscoderInput input = new TranscoderInput(SVGDoc);
TranscoderOutput out = new TranscoderOutput(fos);

trans.transcode(input, out);

Now when I view the image in an applet using awt, I
capture some elementary mouse events.  When I place
the mouse pointer on the upper-leftmost corner of the
upper-leftmost text letter in the awt image, I get a Y
coord of about 61.  Now when we look at the svg code
the uppermost text is positioned at about 84 and with
the scaleFactor, it translates to about 69.  It is off
by  69-61 = 8 pixels. 

I think you are right and I am probably using the
transcoding process wrong, but I'm not sure what to
do... 

Thanks for your help with this.

--- Thomas DeWeese <[EMAIL PROTECTED]> wrote:
> 
> Guess Who wrote:
> 
> David? :)
> 
> > I'm having a little trouble with images that were
> > transcoded with batik.  In particular, I'm working
> > with svg documents that contain almost all text
> > elements.  When the doc is transcoded into an
> image,
> > coords of the text that appears in the image don't
> > seem to correspond with the coords specified in
> the
> > svg doc. 
> > 
> > I've already taken into account the aspectratio in
> > testing the coords' congruency.  
> > 
> > Aspectratio = imgwidth/svg:aoiwidth
> 
>     Actually the proper name for this is the 'scale
> factor'.
> The Aspect ratio is typically the width/height (or
> vice versa).
> 
> > the aoi that i'm using is the rect element just
> inside
> > the page group.
> 
>    Well that is the same as the default area of the
> SVG
> so the scale factor here should be 1 (as is when I
> tested it).
> 
> > For instance, xcoord:image  = xcoord:svgdoc *
> > aspectratio
> > 
> > Correct me if I am wrong about the above calcs. 
> Here
> > is the svg doc...
> 
>    In the future using an attachment works much
> better as often
> things get munged by line-wrapping.  Also how are
> you generating
> the image?  When I use the svgrasterizer I get text
> exactly where
> I think it should be:
> 
> ./build.sh svgrasterizer -a 0,0,612,792 text.svg
> 
>    But since your image seems to be scaled somehow I
> must assume
> you are not using the default w/h for rendering.
> 
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
> 


__________________________________
Do you Yahoo!?
Exclusive Video Premiere - Britney Spears
http://launch.yahoo.com/promos/britneyspears/

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

Reply via email to