public static void clear ( Image img ) { Graphics g = img . getGraphics ( ) ; try { if ( g instanceof Graphics2D ) { ( ( Graphics2D ) g ) . setComposite ( AlphaComposite . Clear ) ; } else { g . setColor ( new Color ( 0 , 0 , 0 , 0 ) ) ; } g . fillRect ( 0 , 0 , img . getWidth ( null ) , img . getHeight ( null ) ) ; } finally { g . dispose ( ) ; } }
Clears the data from the image .