private void paintChild(Graphics2D graphics, Panel child) { if (panelIsInClip(child)) { Graphics2D childGraphics = (Graphics2D) graphics.create(child.getX(), child.getY(), child.getWidth(), child.getHeight()); paint(child, childGraphics); childGraphics.dispose(); } }
public void paint(Panel panel) { Box panelBounds = panel.getAbsoluteBounds(); int x = panelBounds.x - clip.x; int y = panelBounds.y - clip.y; Graphics2D graphics = (Graphics2D) rootGraphics.create(x, y, panel.getWidth(), panel.getHeight()); paint(panel, graphics); graphics.dispose(); rootGraphics.dispose(); }
public BufferedImage buildBufferFor(Panel panel) { Dimension dimension = new Dimension(panel.getWidth(), panel.getHeight()); BufferedImage buffer = bufferedImagePool.acquire(dimension); Graphics2D graphics = buffer.createGraphics(); graphics.setBackground(Colors.TRANSPARENT); graphics.clearRect(0, 0, panel.getWidth(), panel.getHeight()); panel.paintOn(graphics); graphics.dispose(); bufferCache.cache(panel, buffer); return buffer; }
public void paintChildren(ParentPanelBase panel, Graphics2D graphics) { if (panel.hasChildren()) { Box innards = panel instanceof PropPanel ? ((PropPanel) panel).getPaddedBounds() : panel.getChildConsumableBounds(); graphics.clipRect(innards.x, innards.y, innards.width, innards.height); for (Panel child : panel.getChildren()) if (!child.isFloater()) paintChild(graphics, child); for (Panel child : panel.getChildren()) if (child.isFloater()) paintChild(graphics, child); } }
public void paintClipFor(Panel panel, Graphics2D graphics) { if (panel.canBeBuffered()) { BufferedImage panelBuffer = bufferCache.retrieve(panel); if (shouldBuildBufferFor(panel, panelBuffer)) { bufferedImagePool.recycle(panelBuffer); panelBuffer = buildBufferFor(panel); } graphics.drawImage(panelBuffer, 0, 0, null); } else { panel.paintOn(graphics); } }
public void processMousePressed(MousePressedEvent e) { final Panel panel = e.getRecipient(); inWordSelectionMode = false; TextLocation location = model.getLocationAt(e.getLocation()); model.startSelection(location); model.setCaretLocation(location, XOffsetStrategy.FITTING, YOffsetStrategy.FITTING); model.setCaretOn(true); handleMultipleClicks(e); panel.markAsDirty(); panel.getStage().getKeyListener().focusOn(panel); lastClickTime = System.currentTimeMillis(); }
public void applyAlphaCompositeFor(Panel panel, Graphics2D graphics) { Style style = panel.getStyle(); double alphaPercentage = style.getCompiledTransparency().getPercentage(); if (alphaPercentage > 0) { float alpha = (float) (1.0f - (alphaPercentage / 100.0f)); Composite alphaComposite = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, alpha); graphics.setComposite(alphaComposite); } }
public boolean panelIsInClip(Panel panel) { Box panelClip = panel.getAbsoluteBounds(); return panelClip != null && clip.intersects(panelClip); }
public boolean shouldBuildBufferFor(Panel panel, BufferedImage buffer) { return buffer == null || panel.getWidth() != buffer.getWidth() || panel.getHeight() != buffer.getHeight(); }