sclass IIImageSurface extends ImageSurface { BWIntegralImage ii; *() {} *(BWIntegralImage *ii, BufferedImage img) { super(img); } void drawImageItself(int w, int h, Graphics2D g) { if (ii == null) ret with super.drawImageItself(w, h, g); int iw = getZoomedWidth(), ih = getZoomedHeight(); Rect r = toRect(getVisibleRect()); //_print(visibleRect := r); // TODO: scale only the visible part //var scaled = scaledGrayImageFromBWIntegralImage(ii, iw, ih); var scaled = scaledGrayImageFromBWIntegralImage_clip(ii, doubleRatio(iw, ii.getWidth()), r); g.drawImage(image, 0, 0, iw, ih, null); } void setImage(BWIntegralImage ii, BufferedImage img) { this.ii = ii; super.setImage(img); } }