Exemplo n.º 1
0
  public MultiLayerEdit(Composition comp, String name, MultiLayerBackup backup) {
    super(comp, name);
    this.canvasChangeEdit = backup.getCanvasChangeEdit();
    this.translationEdit = backup.getTranslationEdit();

    int nrLayers = comp.getNrImageLayers();
    if (nrLayers == 1) {
      layer = comp.getAnyImageLayer();
      imageEdit = backup.createImageEdit(layer.getImage());
      undoable = true;
    } else {
      imageEdit = null;
      undoable = false;
    }

    if (comp.hasSelection()) {
      assert backup.hasSavedSelection();
      selectionChangeEdit = backup.createSelectionChangeEdit();
    } else {
      if (backup.hasSavedSelection()) {
        // it was a deselect:
        // either a selection crop or a crop tool crop without
        // overlap with the existing selection.
        deselectEdit = backup.createDeselectEdit();
      }
    }
  }