Examples of RGBColor


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

  public void fadeAll(RGBPalette pGradient) {
    int startIdx = 0;//getFrom();
    int endIdx = GRADIENT_SIZE - 1; // getTo();
    for (int i = startIdx; i <= endIdx; i++) {
      RGBColor color = pGradient.getRawColor(i);
      if (color.getRed() > 0 || color.getGreen() > 0 || color.getBlue() > 0 || i == endIdx) {
        if (startIdx < i) {
          pGradient.fadeRange(startIdx, i);
          startIdx = i;
        }
      }
View Full Code Here

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

    if (img.getImageWidth() > 0 && img.getImageHeight() > 0) {
      Map<Integer, RGBColor> colors = new HashMap<Integer, RGBColor>();
      Pixel rgbPixel = new Pixel();
      for (int i = 0; i < img.getImageWidth(); i++) {
        rgbPixel.setARGBValue(img.getARGBValue(i, 0));
        RGBColor color = new RGBColor(rgbPixel.r, rgbPixel.g, rgbPixel.b);
        colors.put(i, color);
      }
      gradient.setColors(colors, false, false);
    }
    return res;
View Full Code Here

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

  }

  public String getGradientAsMap(RGBPalette pGradient) {
    StringBuilder sb = new StringBuilder();
    for (int i = 0; i < RGBPalette.PALETTE_SIZE; i++) {
      RGBColor color = pGradient.getRawColor(i);
      sb.append(alignColValue(color.getRed()));
      sb.append(" ");
      sb.append(alignColValue(color.getGreen()));
      sb.append(" ");
      sb.append(alignColValue(color.getBlue()));
      if (i == 0) {
        sb.append(" \"");
        sb.append(pGradient.getFlam3Name());
        sb.append("\", created with " + Tools.APP_TITLE + " " + Tools.APP_VERSION);
      }
View Full Code Here

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

      }
      catch (Exception ex) {
        break;
      }
      if (r >= 0 && r <= 255 && g >= 0 && g <= 255 && b >= 0 && b <= 255) {
        RGBColor color = new RGBColor(r, g, b);
        colors.put(idx++, color);
      }
      else {
        break;
      }
View Full Code Here

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

        }
        // 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

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

    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

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

    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

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

  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

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

        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

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

    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
TOP
Copyright © 2018 www.massapi.com. 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.