xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From André Ávila <asan...@nextech.com.br>
Subject Re: Printing visible area after transform
Date Fri, 30 Dec 2005 13:45:02 GMT
Hello, Thomas.

>    But I'm really not sure I understand what the problem
> is (most people wouldn't complain if it filled the page as
> long as the page includes the proper content).

The problem is precisely that it doesn't include the proper content. I mean,
it does, but it also includes some undue surrounding area.

Let's say I have a 100x100 mage taking up the whole JSVGCanvas. I zoom to a
certain portion of the image, let's say a 20x20 rectangle on the middle of
the image  (I'm making up the numbers, so don't worry if they don't make
sense). My problem is, when I try to print the visible area (supposedly the
20x20 rectangle, now scaled), I end-up with the correct area printed, plus
some of the surrounding area not visible on the screen. This means I cannot
know exactly which area of the image I want to print.

I'm trying to isolate the AOI by using getViewBoxTransform(), like I said.
My code looks like this:

//---------------

// Get the current transformation matrix from viewBox to screen coords
AffineTransform vbTransform = jsvgCanvas.getViewBoxTransform();

//... Bunch of code to find the new (scaled) width and height and the
transformed origin point (tx, ty)

// Create the AOI rectangle using the transformed origin and scaling
Rectangle aoiRect = new Rectangle();
aoiRect.setRect(tx, ty, scaledWidth, scaledHeight);

// Add the needed hints
printTranscoder.addTranscodingHint(PrintTranscoder.KEY_HEIGHT, new
Float(aoiRect.getHeight()));
printTranscoder.addTranscodingHint(PrintTranscoder.KEY_WIDTH, new
Float(aoiRect.getWidth()));
printTranscoder.addTranscodingHint(PrintTranscoder.KEY_AOI, aoiRect);

printTranscoder.transcode(transcoderInput, null);

//---------------

Any ideas will be most welcome.

Best regards,

André


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


Mime
View raw message