@Override public void revert(Document doc) { parent.revertChange(); parent.addLayer(layer, index); doc.reconstructFlatmap(); doc.setCurrent(layer); }
@Override public void repeat(Document doc) { parent.removeLayer(layer); doc.reconstructFlatmap(); doc.setCurrent(parent); parent.repeatChange(); }
@Override public void apply(Document doc) { this.parent = layer.getParentLayer(); this.index = parent.removeLayer(layer); doc.reconstructFlatmap(); doc.setCurrent(parent); BufferedImage image = new BufferedImage(doc.getWidth(), doc.getHeight(), BufferedImage.TYPE_INT_ARGB); BlendMode mode = layer.getBlendMode(); { Graphics2D g = image.createGraphics(); g.drawImage(parent.getBufferedImage(), 0, 0, null); g.setComposite(mode); g.drawImage(layer.getBufferedImage(), 0, 0, null); g.dispose(); } int[] buffer = RawImage.fromBufferedImage(image).borrowBuffer(); parent.addChangeSilent(new SetImageChange(buffer)); }