public DeferredImageReplacedElement(ImageResource imageResource,RepaintListener repaintListener,int w,int h){
  this._imageResource=imageResource;
  _loaded=false;
  this.repaintListener=repaintListener;
  if (w == -1 && h == -1) {
    _doScaleImage=false;
    _targetHeight=1;
    _targetWidth=1;
  }
 else {
    _doScaleImage=true;
    _targetHeight=Math.max(1,h);
    _targetWidth=Math.max(1,w);
  }
  _image=ImageUtil.createCompatibleBufferedImage(_targetWidth,_targetHeight);
}

public DeferredImageReplacedElement ( ImageResource imageResource , RepaintListener repaintListener , int w , int h ) { this . _imageResource = imageResource ; _loaded = false ; this . repaintListener = repaintListener ; if ( w == - 1 && h == - 1 ) { _doScaleImage = false ; _targetHeight = 1 ; _targetWidth = 1 ; } else { _doScaleImage = true ; _targetHeight = Math . max ( 1 , h ) ; _targetWidth = Math . max ( 1 , w ) ; } _image = ImageUtil . createCompatibleBufferedImage ( _targetWidth , _targetHeight ) ; }
creates a new imagereplacedelement and scales it to the size specified if either width or height has a valid value ( values are > - 1 ) , otherwise original size is preserved . the idea is that the image was loaded at a certain size ( that ' s the image instance here ) and that at the time we create the imagereplacedelement we have a target w / h we want to use .
