Example #1
0
  public void buildDataModel() {
    setName("TwoTone");

    redLight = new AnimatedValue(255.0f, 0.0f, 255.0f);
    greenLight = new AnimatedValue(120.0f, 0.0f, 255.0f);
    blueLight = new AnimatedValue(255.0f, 0.0f, 255.0f);

    redDark = new AnimatedValue(0.0f, 0.0f, 255.0f);
    greenDark = new AnimatedValue(0.0f, 0.0f, 255.0f);
    blueDark = new AnimatedValue(0.0f, 0.0f, 255.0f);

    redLight.setParamName("Red Light");
    greenLight.setParamName("Green Light");
    blueLight.setParamName("Blue Light");

    redDark.setParamName("Red Dark");
    greenDark.setParamName("Green Dark");
    blueDark.setParamName("Blue Dark");

    registerParameter(redLight);
    registerParameter(greenLight);
    registerParameter(blueLight);
    registerParameter(redDark);
    registerParameter(greenDark);
    registerParameter(blueDark);
  }
  public void buildDataModel() {
    setName("CurveShape");

    red1 = new AnimatedValue(255.0f, 0.0f, 255.0f);
    green1 = new AnimatedValue(255.0f, 0.0f, 255.0f);
    blue1 = new AnimatedValue(255.0f, 0.0f, 255.0f);

    red2 = new AnimatedValue(0.0f, 0.0f, 255.0f);
    green2 = new AnimatedValue(0.0f, 0.0f, 255.0f);
    blue2 = new AnimatedValue(0.0f, 0.0f, 255.0f);

    red1.setParamName("Red Fill");
    green1.setParamName("Green Fill");
    blue1.setParamName("Blue Fill");

    red2.setParamName("Red Stroke");
    green2.setParamName("Green Stroke");
    blue2.setParamName("Blue Stroke");

    registerPathParams();
    registerParameter(red1);
    registerParameter(green1);
    registerParameter(blue1);
    registerParameter(red2);
    registerParameter(green2);
    registerParameter(blue2);
    registerParameter(lineWidth);
    registerParameter(fillOn);
  }
  public void renderFullScreenMovingSource(float frameTime, Graphics2D g, int width, int height) {
    GeneralPath shape = getShape(frameTime);

    Color fill =
        new Color(
            (int) red1.get(frameTime), (int) green1.get(frameTime), (int) blue1.get(frameTime));
    Color stroke =
        new Color(
            (int) red2.get(frameTime), (int) green2.get(frameTime), (int) blue2.get(frameTime));

    g.setColor(fill);
    if (fillOn.get()) g.fill(shape);
    g.setStroke(new BasicStroke(lineWidth.get()));
    g.setColor(stroke);
    g.draw(shape);
  }
Example #4
0
  public void doImageRendering(int frame) {
    // --- Crate lookup for color replacement
    ArrayColormap cmap = new ArrayColormap();
    Color lightColor =
        new Color(
            (int) redLight.get(frame), (int) greenLight.get(frame), (int) blueLight.get(frame));
    Color darkColor =
        new Color((int) redDark.get(frame), (int) greenDark.get(frame), (int) blueDark.get(frame));

    cmap.setColorRange(0, 255, darkColor.getRGB(), lightColor.getRGB());

    for (int j = 0; j < 256; j++) rbgLook[j] = cmap.getColor((float) j / 255.0f) & alpha_mask;

    // --- Do color replacement.
    BufferedImage source = getFlowImage();
    int[] pix = getBank(source);
    int rbg;
    int lumaValue;
    int a;
    int r;
    int g;
    int b;

    for (int i = 0; i < pix.length; i++) {
      a = (pix[i] >> alpha) & 0xff;
      r = (pix[i] >> red) & 0xff;
      g = (pix[i] >> green) & 0xff;
      b = (pix[i] & 0xff);

      lumaValue = ((r + g + b) * 255) / MAX_RGB;
      rbg = rbgLook[lumaValue];

      pix[i] = a << alpha | rbg;
    }

    sendFilteredImage(source, frame);
  } // end filter