sclass IIImageSurface extends ImageSurface { IBWIntegralImage ii; *() {} *(IBWIntegralImage *ii) {} *(IBWIntegralImage *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(scaled, r.x, r.y, null); } void setImage(BWIntegralImage ii, BufferedImage img) { this.ii = ii; super.setImage(img); } int w() { ret ii.getWidth(); } int h() { ret ii.getHeight(); } }