public boolean drawImage(Image img,int dx1,int dy1,int dx2,int dy2,int sx1,int sy1,int sx2,int sy2,Color bgcolor,ImageObserver observer){
  if (img == null) {
    return true;
  }
  if (dx1 == dx2 || dy1 == dy2 || sx1 == sx2 || sy1 == sy2) {
    return true;
  }
  if (isHiDPIImage(img)) {
    return drawHiDPIImage(img,dx1,dy1,dx2,dy2,sx1,sy1,sx2,sy2,bgcolor,observer);
  }
  if (((sx2 - sx1) == (dx2 - dx1)) && ((sy2 - sy1) == (dy2 - dy1))) {
    int srcX, srcY, dstX, dstY, width, height;
    if (sx2 > sx1) {
      width=sx2 - sx1;
      srcX=sx1;
      dstX=dx1;
    }
 else {
      width=sx1 - sx2;
      srcX=sx2;
      dstX=dx2;
    }
    if (sy2 > sy1) {
      height=sy2 - sy1;
      srcY=sy1;
      dstY=dy1;
    }
 else {
      height=sy1 - sy2;
      srcY=sy2;
      dstY=dy2;
    }
    return copyImage(img,dstX,dstY,srcX,srcY,width,height,bgcolor,observer);
  }
  try {
    return imagepipe.scaleImage(this,img,dx1,dy1,dx2,dy2,sx1,sy1,sx2,sy2,bgcolor,observer);
  }
 catch (  InvalidPipeException e) {
    try {
      revalidateAll();
      return imagepipe.scaleImage(this,img,dx1,dy1,dx2,dy2,sx1,sy1,sx2,sy2,bgcolor,observer);
    }
 catch (    InvalidPipeException e2) {
      return false;
    }
  }
 finally {
    surfaceData.markDirty();
  }
}

public boolean drawImage ( Image img , int dx1 , int dy1 , int dx2 , int dy2 , int sx1 , int sy1 , int sx2 , int sy2 , Color bgcolor , ImageObserver observer ) { if ( img == null ) { return true ; } if ( dx1 == dx2 || dy1 == dy2 || sx1 == sx2 || sy1 == sy2 ) { return true ; } if ( isHiDPIImage ( img ) ) { return drawHiDPIImage ( img , dx1 , dy1 , dx2 , dy2 , sx1 , sy1 , sx2 , sy2 , bgcolor , observer ) ; } if ( ( ( sx2 - sx1 ) == ( dx2 - dx1 ) ) && ( ( sy2 - sy1 ) == ( dy2 - dy1 ) ) ) { int srcX , srcY , dstX , dstY , width , height ; if ( sx2 > sx1 ) { width = sx2 - sx1 ; srcX = sx1 ; dstX = dx1 ; } else { width = sx1 - sx2 ; srcX = sx2 ; dstX = dx2 ; } if ( sy2 > sy1 ) { height = sy2 - sy1 ; srcY = sy1 ; dstY = dy1 ; } else { height = sy1 - sy2 ; srcY = sy2 ; dstY = dy2 ; } return copyImage ( img , dstX , dstY , srcX , srcY , width , height , bgcolor , observer ) ; } try { return imagepipe . scaleImage ( this , img , dx1 , dy1 , dx2 , dy2 , sx1 , sy1 , sx2 , sy2 , bgcolor , observer ) ; } catch ( InvalidPipeException e ) { try { revalidateAll ( ) ; return imagepipe . scaleImage ( this , img , dx1 , dy1 , dx2 , dy2 , sx1 , sy1 , sx2 , sy2 , bgcolor , observer ) ; } catch ( InvalidPipeException e2 ) { return false ; } } finally { surfaceData . markDirty ( ) ; } }
draws a subrectangle of an image scaled to a destination rectangle in nonblocking mode with a solid background color and a callback object .
