@Override public void paint(Graphics2D g2d, int viewWidth, int viewHeight) { if (!visible) { return; } g2d.setClip(x, y, w, h); if (bkgColor != null) { g2d.setColor(bkgColor); g2d.fillRect(x, y, w, h); } standardStroke = g2d.getStroke(); // be sure to call the translate instruction before getting the standard transform // as the latter's matrix is preconcatenated to the translation matrix of glyphs // that use AffineTransforms for translation standardTransform = g2d.getTransform(); drawnGlyphs = cameraSpace.getDrawnGlyphs(camIndex); synchronized (drawnGlyphs) { drawnGlyphs.clear(); uncoef = (camera.focal + camera.altitude) / camera.focal; // compute region seen from this view through camera viewWC = camera.vx - (w / 2) * uncoef; viewNC = camera.vy + (h / 2) * uncoef; viewEC = camera.vx + (w / 2) * uncoef; viewSC = camera.vy - (h / 2) * uncoef; gll = cameraSpace.getDrawingList(); for (int i = 0; i < gll.length; i++) { if (gll[i] != null) { synchronized (gll[i]) { if (gll[i].visibleInViewport(viewWC, viewNC, viewEC, viewSC, camera)) { // if glyph is at least partially visible in the reg. seen from this view, display gll[i].project(camera, size); // an invisible glyph should still be projected if (gll[i].isVisible()) { // as it can be sensitive gll[i].draw(g2d, w, h, camIndex, standardStroke, standardTransform, x, y); } } } } } } // paint region observed through observedRegionCamera observedRegion = observedRegionView.getVisibleRegion(observedRegionCamera, observedRegion); g2d.setColor(observedRegionColor); orcoef = (float) (camera.focal / (camera.focal + camera.altitude)); if (acST != null) { g2d.setComposite(acST); g2d.fillRect( (int) (x + w / 2 + Math.round((observedRegion[0] - camera.vx) * orcoef)), (int) (y + h / 2 - Math.round((observedRegion[1] - camera.vy) * orcoef)), (int) Math.round((observedRegion[2] - observedRegion[0]) * orcoef), (int) Math.round((observedRegion[1] - observedRegion[3]) * orcoef)); g2d.setComposite(Translucent.acO); } g2d.drawRect( (int) (x + w / 2 + Math.round((observedRegion[0] - camera.vx) * orcoef)), (int) (y + h / 2 - Math.round((observedRegion[1] - camera.vy) * orcoef)), (int) Math.round((observedRegion[2] - observedRegion[0]) * orcoef), (int) Math.round((observedRegion[1] - observedRegion[3]) * orcoef)); // reset Graphics2D g2d.setClip(0, 0, viewWidth, viewHeight); if (borderColor != null) { g2d.setColor(borderColor); g2d.drawRect(x, y, w, h); } }