Esempio n. 1
0
  /** This code is executed with busy cursor */
  public void runit(Composition comp, ChangeReason changeReason) {
    BufferedImage src = comp.getFilterSource();

    //        Utils.debugImage(src, "src");

    BufferedImage dest = null;
    try {
      dest = executeForOneLayer(src);
    } catch (Exception e) {
      Layer activeLayer = comp.getActiveLayer();
      String msg =
          String.format(
              "Error while executing the filter '%s'\n"
                  + "composition = '%s'\n"
                  + "layer = '%s'\n"
                  + "mask editing = '%b'",
              getName(), comp.getName(), activeLayer.getName(), activeLayer.isMaskEditing());
      throw new IllegalStateException(msg, e);
    }

    assert dest != null;

    if (changeReason.isPreview()) {
      comp.changePreviewImage(dest, getName(), changeReason);
    } else {
      comp.filterWithoutDialogFinished(dest, changeReason, getName());
    }
  }
  public static void setEnabled(boolean b, Composition comp) {
    assert SwingUtilities.isEventDispatchThread() : "not EDT thread";

    if (Build.CURRENT.isRobotTest()) {
      if (comp != null) {
        boolean hasSelection = comp.hasSelection();
        if (hasSelection != b) {
          String name = comp.getName();
          throw new IllegalStateException(
              "composition " + name + ": hasSelection = " + hasSelection + ", b = " + b);
        }
      }
    }

    cropAction.setEnabled(b);
    traceWithBrush.setEnabled(b);
    traceWithEraser.setEnabled(b);
    deselectAction.setEnabled(b);
    invertSelectionAction.setEnabled(b);
    modifyAction.setEnabled(b);
  }
Esempio n. 3
0
 public String dump() {
   String compDescr = comp == null ? "null" : comp.getName();
   return name + " (" + compDescr + ')';
 }