Hi all,
I'm using the following code to scale a jpg that I've loaded off disk
in a Java application:
Graphics2D g2d = (Graphics2D)g;
g2d.translate(x0,y0 );
g2d.scale( scaleFactor,scaleFactor );
AffineTransform at = AffineTransform.getTranslateInstance(x0,y0);
BufferedImage bufImage = this.toBufferedImage(this.imgSource);
g2d.drawRenderedImage(bufImage, at);
The image scales correctly as determined by "scaleFactor", however I
also have some rectangles on the same page and they are scaling as
well. How do I apply the transformation just to the image and not to
everything else on the page?
Thanks
Elliot
Hunter Gratzner - 15 Nov 2007 21:15 GMT
> I'm using the following code to scale a jpg that I've loaded off disk
> in a Java application:
[quoted text clipped - 10 lines]
> well. How do I apply the transformation just to the image and not to
> everything else on the page?
Do the obvious. Either draw that other stuff before you scale, or
reset g2d to its original transformation after you have drawn the
image.
Elliot - 21 Nov 2007 14:50 GMT
> > I'm using the following code to scale a jpg that I've loaded off disk
> > in a Java application:
[quoted text clipped - 14 lines]
> reset g2d to its original transformation after you have drawn the
> image.
Thanks for the ideas
Elliot