I am having trouble applying an AffineTransform scaling operation to a buffered image on my canvas. I suspect Michelle's hint is on the right track, in that AffineTransforms have difficulty with bufferedImages that arent recognised. However my bufferedImage is derived from the JAI PlanarImage's getAS BufferedImage() method and therefore should be TYPE_INT_RGB by default?
Yet still the first time paint is called it works fine but on subsequent calls it continues to throw this exception:
"java.awt.image.ImagingOpException: Unable to transform src image"
Here is the sample code of the canvas class:
class BigCanvas extends Canvas {
private AffineTransform at; private PlanarImage pic; private BufferedImage viewer; ColorModel cm;
// Constructor
public BigCanvas(PlanarImage orig) {
super();
this.pic = orig;cm = orig.getColorModel();
at = new AffineTransform().getScaleInstance(10,10);
}
public void paint(Graphics g) {
Graphics2D gg = (Graphics2D) g;viewer = pic.getAsBufferedImage(Manual_AdjustorFrame.viewBox, cm);
gg.drawImage(viewer,at, this);
}
}
_________________________________________________________________ Express yourself with cool emoticons - download MSN Messenger today! http://www.msn.co.uk/messenger
=========================================================================== To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff JAVA2D-INTEREST". For general help, send email to [EMAIL PROTECTED] and include in the body of the message "help".
