public boolean drawImage(Image img,int x,int y,int width,int height,Color bg,ImageObserver observer){
  if (img == null) {
    return true;
  }
  if ((width == 0) || (height == 0)) {
    return true;
  }
  final int imgW=img.getWidth(null);
  final int imgH=img.getHeight(null);
  if (isHiDPIImage(img)) {
    return drawHiDPIImage(img,x,y,x + width,y + height,0,0,imgW,imgH,bg,observer);
  }
  if (width == imgW && height == imgH) {
    return copyImage(img,x,y,0,0,width,height,bg,observer);
  }
  try {
    return imagepipe.scaleImage(this,img,x,y,width,height,bg,observer);
  }
 catch (  InvalidPipeException e) {
    try {
      revalidateAll();
      return imagepipe.scaleImage(this,img,x,y,width,height,bg,observer);
    }
 catch (    InvalidPipeException e2) {
      return false;
    }
  }
 finally {
    surfaceData.markDirty();
  }
}

public boolean drawImage ( Image img , int x , int y , int width , int height , Color bg , ImageObserver observer ) { if ( img == null ) { return true ; } if ( ( width == 0 ) || ( height == 0 ) ) { return true ; } final int imgW = img . getWidth ( null ) ; final int imgH = img . getHeight ( null ) ; if ( isHiDPIImage ( img ) ) { return drawHiDPIImage ( img , x , y , x + width , y + height , 0 , 0 , imgW , imgH , bg , observer ) ; } if ( width == imgW && height == imgH ) { return copyImage ( img , x , y , 0 , 0 , width , height , bg , observer ) ; } try { return imagepipe . scaleImage ( this , img , x , y , width , height , bg , observer ) ; } catch ( InvalidPipeException e ) { try { revalidateAll ( ) ; return imagepipe . scaleImage ( this , img , x , y , width , height , bg , observer ) ; } catch ( InvalidPipeException e2 ) { return false ; } } finally { surfaceData . markDirty ( ) ; } }
draws an image scaled to x , y , w , h in nonblocking mode with a solid background color and a callback object .
