question: public void drawRenderedImage ( RenderedImage img , AffineTransform xform ) { if ( img == null ) { return ; } if ( img instanceof BufferedImage ) { BufferedImage bufImg = ( BufferedImage ) img ; drawImage ( bufImg , xform , null ) ; return ; } boolean isIntegerTranslate = ( transformState <= TRANSFORM_INT_TRANSLATE ) && isIntegerTranslation ( xform ) ; int pad = isIntegerTranslate ? 0 : 3 ; Region clip ; try { clip = getCompClip ( ) ; } catch ( InvalidPipeException e ) { return ; } Rectangle region = getImageRegion ( img , clip , transform , xform , pad , pad ) ; if ( region . width <= 0 || region . height <= 0 ) { return ; } if ( isIntegerTranslate ) { drawTranslatedRenderedImage ( img , region , ( int ) xform . getTranslateX ( ) , ( int ) xform . getTranslateY ( ) ) ; return ; } Raster raster = img . getData ( region ) ; WritableRaster wRaster = Raster . createWritableRaster ( raster . getSampleModel ( ) , raster . getDataBuffer ( ) , null ) ; int minX = raster . getMinX ( ) ; int minY = raster . getMinY ( ) ; int width = raster . getWidth ( ) ; int height = raster . getHeight ( ) ; int px = minX - raster . getSampleModelTranslateX ( ) ; int py = minY - raster . getSampleModelTranslateY ( ) ; if ( px != 0 || py != 0 || width != wRaster . getWidth ( ) || height != wRaster . getHeight ( ) ) { wRaster = wRaster . createWritableChild ( px , py , width , height , 0 , 0 , null ) ; } AffineTransform transXform = ( AffineTransform ) xform . clone ( ) ; transXform . translate ( minX , minY ) ; ColorModel cm = img . getColorModel ( ) ; BufferedImage bufImg = new BufferedImage ( cm , wRaster , cm . isAlphaPremultiplied ( ) , null ) ; drawImage ( bufImg , transXform , null ) ; }
target:  Draws an image, applying a transform from image space into user space before drawing. The transformation from user space into device space is done with the current transform in the Graphics2D. The given transformation is applied to the image before the transform attribute in the Graphics2D state is applied. The rendering attributes applied include the clip, transform, and composite attributes. Note that the result is undefined, if the given transform is noninvertible.