Actually the problem could be that PlanarImage.getAsBufferedImage() creates a custom BufferedImage. I suppose this might not be handled by AffineTransformOp. As you are already copying the data, you might as well create a BufferedImage of a known type that is compatible and copy the data for example using setRect() on the BufferedImage's raster.
If you are starting from JAI however, why not just use the "AffineTransform" operation in JAI? Brian On Wed, 31 Mar 2004, colt brunton wrote: > Hi all > > 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". > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ This email message is for the sole use of the intended recipient(s) and may contain confidential and privileged information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ =========================================================================== 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".