public void finishPainting(boolean useCache){
  DataBufferInt dataBuffer=new DataBufferInt(w0 * h0);
  int transparency=nativeFinishPainting(SunWritableRaster.stealData(dataBuffer,0),w0,h0);
  SunWritableRaster.markDirty(dataBuffer);
  int[] bands=BAND_OFFSETS[transparency - 1];
  WritableRaster raster=Raster.createPackedRaster(dataBuffer,w0,h0,w0,bands,null);
  ColorModel cm=COLOR_MODELS[transparency - 1];
  Image img=new BufferedImage(cm,raster,false,null);
  if (useCache) {
    cache.setImage(getClass(),null,w0,h0,cacheArgs,img);
  }
  graphics.drawImage(img,x0,y0,null);
}

public void finishPainting ( boolean useCache ) { DataBufferInt dataBuffer = new DataBufferInt ( w0 * h0 ) ; int transparency = nativeFinishPainting ( SunWritableRaster . stealData ( dataBuffer , 0 ) , w0 , h0 ) ; SunWritableRaster . markDirty ( dataBuffer ) ; int [ ] bands = BAND_OFFSETS [ transparency - 1 ] ; WritableRaster raster = Raster . createPackedRaster ( dataBuffer , w0 , h0 , w0 , bands , null ) ; ColorModel cm = COLOR_MODELS [ transparency - 1 ] ; Image img = new BufferedImage ( cm , raster , false , null ) ; if ( useCache ) { cache . setImage ( getClass ( ) , null , w0 , h0 , cacheArgs , img ) ; } graphics . drawImage ( img , x0 , y0 , null ) ; }
called to indicate that painting is finished . we create a new bufferedimage from the offscreen buffer , ( optionally ) cache it , and paint it .
