Determing x, y positions with g2d.drawRenderedImage

E

Elliot

Hi all,

I'm using the following code to scale a jpg that I've loaded off disk
in a Java application:
int x0 = 0, y0 = 0;

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);

How can I precisely determine the x, y position as was done with
g.drawImage() from the Graphics package with the above code that I'm
using for scaling? I would think that the translate method needs to
default value but this is the only time I'm displaying the image.

Thanks

Elliot
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,575
Members
45,052
Latest member
KetoBeez

Latest Threads

Top