예제 #1
0
  @Override
  public void revert(Document doc) {
    parent.revertChange();

    parent.addLayer(layer, index);
    doc.reconstructFlatmap();
    doc.setCurrent(layer);
  }
예제 #2
0
  @Override
  public void repeat(Document doc) {
    parent.removeLayer(layer);
    doc.reconstructFlatmap();
    doc.setCurrent(parent);

    parent.repeatChange();
  }
예제 #3
0
  @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));
  }