Package org.jwildfire.create.tina.palette

Examples of org.jwildfire.create.tina.palette.RGBColor$HSV


        }
        // morph colors
        RGBPalette palette1 = layer1.getPalette();
        RGBPalette palette2 = layer2.getPalette();
        for (int i = 0; i < RGBPalette.PALETTE_SIZE; i++) {
          RGBColor color1 = palette1.getColor(i);
          RGBColor color2 = palette2.getColor(i);
          int red = Tools.roundColor(color1.getRed() + (color2.getRed() - color1.getRed()) * fScl);
          int green = Tools.roundColor(color1.getGreen() + (color2.getGreen() - color1.getGreen()) * fScl);
          int blue = Tools.roundColor(color1.getBlue() + (color2.getBlue() - color1.getBlue()) * fScl);
          layer.getPalette().setColor(i, red, green, blue);
        }
      }
      // fade out layer1 to black
      else if (lIdx < layerSize1) {
View Full Code Here


    return "Stripes";
  }

  @Override
  public List<RGBColor> generateKeyFrames(int pKeyFrameCount) {
    RGBColor stripeColor = createStripeColor();
    List<RGBColor> baseColors = new StrongHueRandomGradientGenerator().generateKeyFrames(pKeyFrameCount);
    List<RGBColor> res = new ArrayList<RGBColor>();
    int stripeWidth = 1 + (int) (Math.random() * 2);
    int colorWidth = 3 + (int) (Math.random() * 5);
    int colorIdx = 0;
    while (res.size() < RGBPalette.PALETTE_SIZE) {
      for (int i = 0; i < stripeWidth; i++) {
        res.add(stripeColor);
      }

      RGBColor colorLeft = baseColors.get(colorIdx++);
      if (colorIdx >= baseColors.size()) {
        colorIdx = 0;
      }
      RGBColor colorRight = baseColors.get(colorIdx++);
      if (colorIdx >= baseColors.size()) {
        colorIdx = 0;
      }

      res.add(colorLeft);
      for (int i = 1; i < colorWidth; i++) {
        double scl = (double) i / (double) (colorWidth - 1);
        double r = colorLeft.getRed() + (colorRight.getRed() - colorLeft.getRed()) * scl;
        double g = colorLeft.getGreen() + (colorRight.getGreen() - colorLeft.getGreen()) * scl;
        double b = colorLeft.getBlue() + (colorRight.getBlue() - colorLeft.getBlue()) * scl;
        RGBColor color = new RGBColor(Tools.roundColor(r), Tools.roundColor(g), Tools.roundColor(b));
        res.add(color);
      }

    }
    while (res.size() >= RGBPalette.PALETTE_SIZE) {
View Full Code Here

    else
      hslPixel.hue = 0.4 + rnd / 7.0;
    hslPixel.luminosity = Math.random() * 0.1 + 0.8999;
    Pixel rgbPixel = new Pixel();
    HSLTransformer.hsl2rgb(hslPixel, rgbPixel);
    return new RGBColor(rgbPixel.r, rgbPixel.g, rgbPixel.b);
  }
View Full Code Here

  public abstract List<RGBColor> generateKeyFrames(int pKeyFrameCount);

  public static final RGBPalette generatePalette(List<RGBColor> pKeyFrames, boolean pFadeColors) {
    RGBPalette res = new RGBPalette();
    if (pKeyFrames.size() == 1) {
      RGBColor c = pKeyFrames.get(0);
      for (int i = 0; i < RGBPalette.PALETTE_SIZE; i++) {
        res.addColor(c.getRed(), c.getGreen(), c.getBlue());
      }
    }
    else {
      double idxScl = (double) (RGBPalette.PALETTE_SIZE) / (double) (pKeyFrames.size() - 1);
      for (int i = 0; i < RGBPalette.PALETTE_SIZE; i++) {
        double x = (double) i / idxScl;
        int lIdx = (int) x;
        double relX = x - (double) lIdx;
        RGBColor lColor = pKeyFrames.get(lIdx);
        int r, g, b;
        if (pFadeColors) {
          RGBColor rColor = pKeyFrames.get(lIdx + 1);
          r = Tools.roundColor((double) lColor.getRed() + ((double) (rColor.getRed() - lColor.getRed())) * relX);
          g = Tools.roundColor((double) lColor.getGreen() + ((double) (rColor.getGreen() - lColor.getGreen())) * relX);
          b = Tools.roundColor((double) lColor.getBlue() + ((double) (rColor.getBlue() - lColor.getBlue())) * relX);
        }
        else {
          r = lColor.getRed();
          g = lColor.getGreen();
          b = lColor.getBlue();
View Full Code Here

        b = Tools.roundColor(256.0 * Math.random());
        double diff = Math.abs(r - lastR) * 0.299 + Math.abs(g - lastG) * 0.588 + Math.abs(b - lastB) * 0.1130;
        if (diff > 66)
          break;
      }
      RGBColor col = new RGBColor(r, g, b);
      lastR = r;
      lastG = g;
      lastB = b;
      keyFrames.add(col);
    }
View Full Code Here

    hslPixel.saturation = Math.random() * 0.3 + 0.6999;
    hslPixel.hue = Math.random() * Math.random();
    for (int i = 0; i < pKeyFrameCount; i++) {
      hslPixel.luminosity = Math.random() * 0.99;
      HSLTransformer.hsl2rgb(hslPixel, rgbPixel);
      RGBColor col = new RGBColor(rgbPixel.r, rgbPixel.g, rgbPixel.b);
      keyFrames.add(col);
    }
    return keyFrames;
  }
View Full Code Here

        hslPixel.hue = 0.6 + (rnd - 1.0) / 7.0;
      else
        hslPixel.hue = 0.4 + rnd / 7.0;

      HSLTransformer.hsl2rgb(hslPixel, rgbPixel);
      RGBColor col = new RGBColor(rgbPixel.r, rgbPixel.g, rgbPixel.b);
      keyFrames.add(col);
    }
    return keyFrames;
  }
View Full Code Here

    if (Math.random() < 0.42) {
      pFlame.setBGColorRed(0);
      pFlame.setBGColorGreen(0);
      pFlame.setBGColorBlue(0);
      List<RGBColor> colors = new ArrayList<RGBColor>();
      colors.add(new RGBColor(255, 255, 255));
      RGBPalette gradient = RandomGradientGenerator.generatePalette(colors, true);
      for (Layer layer : pFlame.getLayers()) {
        layer.setPalette(gradient);
      }
    }
    else {
      pFlame.setBGColorRed(255);
      pFlame.setBGColorGreen(255);
      pFlame.setBGColorBlue(255);
      List<RGBColor> colors = new ArrayList<RGBColor>();
      colors.add(new RGBColor(0, 0, 0));
      RGBPalette gradient = RandomGradientGenerator.generatePalette(colors, true);
      for (Layer layer : pFlame.getLayers()) {
        layer.setPalette(gradient);
      }
    }
View Full Code Here

TOP

Related Classes of org.jwildfire.create.tina.palette.RGBColor$HSV

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.