Actually, I'm not sure how to use viewPort in this example. Should I specify the viewbox to be (0,0, 612,792)?
How would I use the transcoder code with the viewbox? One reason I don't use the viewbox is because I will be using this program to handle svgdocs with more than one page (more than one <g> tag). I intend to enumerate through each <g> tag and transcode an image for each group specifying a aoi that corresponds to each rect. Can I do this with viewbox? I compared the coords differences at the top and the bottom coord and they are both off by about 8 pixels. The xcoords are not off at all. I am using a borderlayout and I am adding a canvas (that draws the image) to the center. I think if I pad the canvas at the top with 8 pixels, I can workaround the problem. The fact that the xcoords are fine, but the ycoords are off by a fixed amount, makes me think that my problem is the placement of the image in the canvas, even though i place it at 0,0. --- Thomas DeWeese <[EMAIL PROTECTED]> wrote: > Guess Who wrote: > > > 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 > > Hmm is there a reason that using the 'viewBox' > attribute > on the outermost SVG wouldn't do what you want? > (auto > scale to fit viewing conditions). > > The code looks reasonable. > > > 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. > > How certain are you that you are properly > interpreting the > mouse coords? Does the error seem to 'scale' so > it's larger > at the right/bottom compared with left/top? > > > I think you are right and I am probably using the > > transcoding process wrong, but I'm not sure what > to > > do... > > I would try using viewBox rather than mucking > with the > AOI. > > > > > 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] > > > > > > > --------------------------------------------------------------------- > 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]