public void drawImage ( Image img , Rectangle rect , Rectangle clipRect , float opacity ) { try { template . saveState ( ) ; // opacity PdfGState state = new PdfGState ( ) ; state . setFillOpacity ( opacity ) ; state . setBlendMode ( PdfGState . BM_NORMAL ) ; template . setGState ( state ) ; // clipping code if ( clipRect != null ) { template . rectangle ( clipRect . getLeft ( ) + origX , clipRect . getBottom ( ) + origY , clipRect . getWidth ( ) , clipRect . getHeight ( ) ) ; template . clip ( ) ; template . newPath ( ) ; } template . addImage ( img , rect . getWidth ( ) , 0 , 0 , rect . getHeight ( ) , origX + rect . getLeft ( ) , origY + rect . getBottom ( ) ) ; } catch ( DocumentException e ) { log . warn ( "could not draw image" , e ) ; } finally { template . restoreState ( ) ; } }
Draws the specified image with the first rectangle s bounds clipping with the second one .