>>>>> "KN" == Kenji Nakamura <[EMAIL PROTECTED]> writes:
KN> I'm writing SVG-->Raster images converter servlet and encountered
KN> a problem. What I want to do is to take a snapshot of a Swing
KN> application JInternalFrame, highlight some portion of the diagram
KN> by modifying SVG through DOM, and convert it to raster images such
KN> as PNG or JPEG to show users whose browser doesn't have SVG
KN> plugin.
Ok clear enough...
KN> First I take a screenshot and supposed the size is 800x600
KN> pixels.
I guess I don't understand where the screenshot comes in, above it
sounded like you were using the SVGGraphics2D to convert the contents
of your JInternalFrame to SVG.
KN> The output raster image size is 400x400 and the contents is
KN> clipped to the size. I supposed giving KEY_WIDTH=800 and or
KN> KEY_HEIGHT=600 would change the clipping size as well as the
KN> output image file size, but what happened with these parameters
KN> was getting the image clipped by 400x400 enlarged to 800x600 size.
KN> I know the 400x400 value is defined at getViewportSize() in
KN> ImageTranscoderUserAgent internal class, but it seems no way to
KN> change it from external.
I sounds like the SVG you are feeding to the rasterizer isn't set
up properly. In particular you may want to set the viewBox attribute
on the outermost SVG element (to something like: "0 0 600 800"). You
might also set the width and height on the outermost SVG element. I
believe if you used the SVGGraphics2D it should do this for you (not
100% certain).
KN> What I expect is to get the raster image with the same size of the
KN> JInternalFrame component. Here "the same size" means same as
KN> clipPath info in the SVG. <defs id="defs1"> <clipPath
KN> clipPathUnits="userSpaceOnUse" id="clipPath1"> <path d="M0 0 L675
KN> 0 L675 554 L0 554 L0 0 Z" /> </clipPath>
KN> It would be best if transcoder recognizes clipPath info in SVG,
KN> but it is okay to specify these values explicitly.
The transcoder does understand clipPath info the problem is that
something is telling the transcoder the wrong region of the image to
rasterize.
KN> Do I overlook something?
I suspect you need to add the viewBox attribute on your outermost
SVG element.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]