Image objects

Hi to All!!

I've created an image within a BufferedImage object, but now I want to scale it and send it to printer. I've tried to do this by the GetScaledInstance method and it works, but the problem comes because the method returns an Image object, and I can't send the Image object to the printer. Do you know some method to send an Image object directly to the printer?. any alternative suggestion?.

Regards.

[433 byte] By [@rmingjsda] at [2007-9-30 2:21:21]
# 1

I'm sure there's some better ImageIO stuff then this, but....

public static BufferedImage getScaledInstance(Image img, float scale, ImageObserver obs) {

int w = (int)scale * img.getWidth(obs);

int h = (int)scale * img.getHeight(obs);

BufferedImage bi = new BufferedImage(w, h, BufferedImage.TYPE_INT_RGB);

Graphics g = bi.getGraphics();

g.drawImage(img, 0, 0, w, h, obs);

return bi;

}

bsampieria at 2007-7-16 13:30:35 > top of Java-index,Archived Forums,Swing...