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());
    }
  }
Esempio n. 2
0
  public static void createSplashImage() {
    assert EventQueue.isDispatchThread();

    NewImage.addNewImage(FillType.WHITE, 400, 247, "Splash");

    Composition ic = ImageComponents.getActiveComp().get();
    ic.getActiveLayer().setName("Color Wheel", AddToHistory.YES);
    new ColorWheel().execute(OP_WITHOUT_DIALOG);

    addNewLayer("Value Noise");
    ValueNoise valueNoise = new ValueNoise();
    valueNoise.setDetails(7);
    valueNoise.execute(OP_WITHOUT_DIALOG);
    ImageLayer layer = (ImageLayer) ic.getActiveLayer();
    layer.setOpacity(0.3f, UpdateGUI.YES, AddToHistory.YES, true);
    layer.setBlendingMode(BlendingMode.SCREEN, UpdateGUI.YES, AddToHistory.YES, true);

    addNewLayer("Gradient");
    ToolTests.addRadialBWGradientToActiveLayer(ic, true);
    layer = (ImageLayer) ic.getActiveLayer();
    layer.setOpacity(0.4f, UpdateGUI.YES, AddToHistory.YES, true);
    layer.setBlendingMode(BlendingMode.LUMINOSITY, UpdateGUI.YES, AddToHistory.YES, true);

    FgBgColors.setFG(WHITE);
    Font font = new Font(SPLASH_SCREEN_FONT, Font.BOLD, 48);
    addRasterizedTextLayer(ic, "Pixelitor", WHITE, font, -17, BlendingMode.NORMAL, 0.9f, false);
    addDropShadow();

    font = new Font(SPLASH_SCREEN_FONT, Font.BOLD, 22);
    addRasterizedTextLayer(ic, "Loading...", WHITE, font, -70, BlendingMode.NORMAL, 0.9f, false);
    addDropShadow();

    font = new Font(SPLASH_SCREEN_FONT, Font.PLAIN, 20);
    addRasterizedTextLayer(
        ic, "version " + Build.VERSION_NUMBER, WHITE, font, 50, BlendingMode.NORMAL, 0.9f, false);
    addDropShadow();

    //        font = new Font(Font.SANS_SERIF, Font.PLAIN, 10);
    //        addRasterizedTextLayer(ic, new Date().toString(), font, 0.8f, 100, false);

  }
Esempio n. 3
0
  private static void addRasterizedTextLayer(
      Composition ic,
      String text,
      Color textColor,
      Font font,
      int translationY,
      BlendingMode blendingMode,
      float opacity,
      boolean dropShadow) {
    addNewLayer(text);
    TextFilter textFilter = TextFilter.INSTANCE;

    AreaEffects effects = null;
    if (dropShadow) {
      effects = new AreaEffects();
      effects.setDropShadowEffect(new ShadowPathEffect(1.0f));
    }

    TextSettings settings =
        new TextSettings(
            text,
            font,
            textColor,
            effects,
            AbstractLayoutPainter.HorizontalAlignment.CENTER,
            AbstractLayoutPainter.VerticalAlignment.CENTER,
            false);

    textFilter.setSettings(settings);
    textFilter.execute(OP_WITHOUT_DIALOG);
    ImageLayer layer = (ImageLayer) ic.getActiveLayer();
    layer.setTranslation(0, translationY);

    layer.enlargeImage(layer.getComp().getCanvasBounds());

    layer.setOpacity(opacity, UpdateGUI.YES, AddToHistory.YES, true);
    layer.setBlendingMode(blendingMode, UpdateGUI.YES, AddToHistory.YES, true);
  }