示例#1
0
  public static void testLayers() {
    FgBgColors.setBG(WHITE);
    FgBgColors.setFG(BLACK);
    NewImage.addNewImage(FillType.TRANSPARENT, 400, 400, "Layer Test");
    Composition comp = ImageComponents.getActiveComp().get();

    addRasterizedTextLayer(comp, "this should be deleted", 0);

    addRasterizedTextLayer(comp, "this should at the bottom", 100);
    comp.moveActiveLayerToBottom();

    comp.moveLayerSelectionUp();
    comp.moveLayerSelectionUp();
    DeleteActiveLayerAction.INSTANCE.actionPerformed(null);

    addRasterizedTextLayer(comp, "this should at the top", -100);
    addRasterizedTextLayer(comp, "this should be selected", 50);
    comp.moveActiveLayerDown();

    //        ic.moveActiveLayerDown();
    //        ic.flattenImage();

    // merge down
    // HueSat
    // ColorBalance
    // Channel mixer

    comp.imageChanged(FULL);
  }
示例#2
0
  // called on the EDT
  private static void testToolAction(
      Composition comp, Random rand, int canvasWidth, int canvasHeight, boolean brushOnly) {
    assert SwingUtilities.isEventDispatchThread();

    FgBgColors.setRandomColors();

    Point start = new Point(rand.nextInt(canvasWidth), rand.nextInt(canvasHeight));
    Point end = new Point(rand.nextInt(canvasWidth), rand.nextInt(canvasHeight));

    boolean doTheBrush;
    if (brushOnly) {
      doTheBrush = true;
    } else {
      doTheBrush = rand.nextBoolean();
    }

    try {
      if (doTheBrush) {
        Tools.BRUSH.randomize();
        Tools.BRUSH.drawBrushStrokeProgrammatically(comp, start, end);
      } else {
        Tools.SHAPES.randomize();
        Tools.SHAPES.paintShapeOnIC(comp, new UserDrag(start.x, start.y, end.x, end.y));
      }
    } catch (Exception e) {
      Messages.showException(e);
    }
  }
示例#3
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);

  }