protected BufferedImage scrubOrGetNewBufferedImage(BufferedImage currentImage,int width,int height){
  int cWidth=-1;
  int cHeight=-1;
  if (currentImage != null) {
    cWidth=currentImage.getWidth();
    cHeight=currentImage.getHeight();
  }
  if (currentImage != null && cWidth == width && cHeight == height) {
    Graphics2D graphics=(Graphics2D)currentImage.getGraphics();
    graphics.setComposite(AlphaComposite.Clear);
    graphics.fillRect(0,0,width,height);
    graphics.setComposite(AlphaComposite.SrcOver);
    return null;
  }
  return new BufferedImage(width,height,BufferedImage.TYPE_INT_ARGB);
}

protected BufferedImage scrubOrGetNewBufferedImage ( BufferedImage currentImage , int width , int height ) { int cWidth = - 1 ; int cHeight = - 1 ; if ( currentImage != null ) { cWidth = currentImage . getWidth ( ) ; cHeight = currentImage . getHeight ( ) ; } if ( currentImage != null && cWidth == width && cHeight == height ) { Graphics2D graphics = ( Graphics2D ) currentImage . getGraphics ( ) ; graphics . setComposite ( AlphaComposite . Clear ) ; graphics . fillRect ( 0 , 0 , width , height ) ; graphics . setComposite ( AlphaComposite . SrcOver ) ; return null ; } return new BufferedImage ( width , height , BufferedImage . TYPE_INT_ARGB ) ; }
given the current image buffer , and the desired width and height of the new projection , return a fresh / refreshed image buffer ready for layer painting . should be clear .
