/** * Expand the 708 window's rectangle to include the new rectangle */ private void addTo708WindowRect(int windowID, float x, float y, float w, float h) { if(windowID < 0 || windowID > 7) return; java.awt.geom.Rectangle2D.Float rect = cached708WindowRects.get(windowID); java.awt.geom.Rectangle2D.Float newRect = new java.awt.geom.Rectangle2D.Float(x, y, w, h); if(rect == null) { cached708WindowRects.add(windowID, newRect); } else { rect.add(newRect); } }
protected void addText(GlyphText sprite) { // the sprite glyphs.add(sprite); currentGlyph = sprite; // append the bounds calculation if (bounds == null) { Rectangle2D.Float rect = sprite.getBounds(); bounds = new Rectangle2D.Float(rect.x, rect.y, rect.width, rect.height); } else { bounds.add(sprite.getBounds()); } if (textExtractionBounds == null) { Rectangle2D.Float rect = sprite.getTextExtractionBounds(); textExtractionBounds = new Rectangle2D.Float(rect.x, rect.y, rect.width, rect.height); } else { textExtractionBounds.add(sprite.getTextExtractionBounds()); } // append the text that maps up the sprite String unicode = sprite.getUnicode(); previousGlyphText = unicode != null && unicode.length() > 0 ? unicode.charAt(0) : 0; text.append(unicode); }
public Rectangle2D.Float getBounds() { // lazy load the bounds as the calculation is very expensive if (bounds == null) { // word bounds build from child word bounds. for (WordText word : words) { if (bounds == null) { bounds = new Rectangle2D.Float(); bounds.setRect(word.getBounds()); } else { bounds.add(word.getBounds()); } } // empty line text check, return empty bound. if (bounds == null) { bounds = new Rectangle2D.Float(); } } return bounds; }
clipRect = op.getDestination(); } else { clipRect.add(op.getDestination());
bounds.add(glyphBounds);
public Rectangle2D.Float getBounds() { if (bounds == null) { // increase bounds as glyphs are detected. for (GlyphText glyph : glyphs) { if (bounds == null) { bounds = new Rectangle2D.Float(); bounds.setRect(glyph.getBounds()); } else { bounds.add(glyph.getBounds()); } if (textExtractionBounds == null) { Rectangle2D.Float rect = glyph.getTextExtractionBounds(); textExtractionBounds = new Rectangle2D.Float(rect.x, rect.y, rect.width, rect.height); } else { textExtractionBounds.add(glyph.getTextExtractionBounds()); } } } return bounds; }