Examples of RGBPalette


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

          break;
        pPalettes = pe + 1;
        paletteUgr = pUgr.substring(ps, pPalettes);
      }
      if (paletteUgr.contains("title=\"") && paletteUgr.contains("color=") && paletteUgr.contains("index=")) {
        RGBPalette palette = new RGBPalette();
        res.add(palette);
        parsePalette(palette, paletteUgr);
      }
    }
    return res;
View Full Code Here

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

        }
      }
      List<String> blackList = Collections.emptyList();
      writeMotionCurves(layer, xb, layerAttrList, null, blackList);

      RGBPalette palette = layer.getPalette();
      writeMotionCurves(palette, xb, layerAttrList, "palette_", Collections.<String> emptyList());
      xb.beginElement("layer", layerAttrList);

      // XForm
      for (XForm xForm : layer.getXForms()) {
        xb.emptyElement("xform", createXFormAttrList(xb, layer, xForm));
      }
      // FinalXForms
      for (XForm xForm : layer.getFinalXForms()) {
        xb.emptyElement("finalxform", createXFormAttrList(xb, layer, xForm));
      }
      // Palette
      {
        xb.beginElement("palette",
            xb.createAttr("count", palette.getSize()),
            xb.createAttr("format", "RGB"));
        StringBuilder rgb = new StringBuilder();
        for (int i = 0; i < palette.getSize(); i++) {
          String hs;
          hs = Integer.toHexString(palette.getColor(i).getRed()).toUpperCase();
          rgb.append(hs.length() > 1 ? hs : "0" + hs);
          hs = Integer.toHexString(palette.getColor(i).getGreen()).toUpperCase();
          rgb.append(hs.length() > 1 ? hs : "0" + hs);
          hs = Integer.toHexString(palette.getColor(i).getBlue()).toUpperCase();
          rgb.append(hs.length() > 1 ? hs : "0" + hs);
          if ((i + 1) % 12 == 0) {
            rgb.append("\n");
          }
        }
View Full Code Here

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

          break;
        pPalettes = pe + 2;
        paletteXML = pXML.substring(ps, pPalettes);
      }

      RGBPalette palette = new RGBPalette();
      res.add(palette);
      {
        int ps = paletteXML.indexOf("<flame ");
        int pe = -1;
        boolean qt = false;
View Full Code Here

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

    }
  }

  public List<RGBPalette> readPaletteFromMapData(String pMapData, String pFilename) throws Exception {
    List<RGBPalette> res = new ArrayList<RGBPalette>();
    RGBPalette gradient = new RGBPalette();
    res.add(gradient);
    gradient.setFlam3Name(new File(pFilename).getName());
    SimpleImage img = new ImageReader().loadImage(pFilename);
    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.RGBPalette

    }
  }

  public List<RGBPalette> readPaletteFromMapData(String pMapData, String pFilename) {
    List<RGBPalette> res = new ArrayList<RGBPalette>();
    RGBPalette gradient = new RGBPalette();
    res.add(gradient);
    gradient.setFlam3Name(new File(pFilename).getName());
    StringTokenizer tokenizer = new StringTokenizer(pMapData, "\n\r");
    int idx = 0;
    Map<Integer, RGBColor> colors = new HashMap<Integer, RGBColor>();
    while (tokenizer.hasMoreElements()) {
      String line = tokenizer.nextToken();
      StringTokenizer lineTokenizer = new StringTokenizer(line, "\t ");
      int r, g, b;
      try {
        r = Integer.parseInt(((String) lineTokenizer.nextElement()).trim());
        g = Integer.parseInt(((String) lineTokenizer.nextElement()).trim());
        b = Integer.parseInt(((String) lineTokenizer.nextElement()).trim());
      }
      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;
      }
    }
    gradient.setColors(colors, false, false);
    return res;
  }
View Full Code Here

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

        for (Object child : childs) {
          _evalMotionCurves(child, pFrame);
        }
      }
      else if (field.getType().isAssignableFrom(RGBPalette.class)) {
        RGBPalette gradient = (RGBPalette) field.get(pObject);
        _evalMotionCurves(gradient, pFrame);
      }
    }
    if (pObject instanceof Variation) {
      Variation var = (Variation) pObject;
View Full Code Here

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

        for (Object child : childs) {
          _disableMotionCurves(child);
        }
      }
      else if (field.getType().isAssignableFrom(RGBPalette.class)) {
        RGBPalette gradient = (RGBPalette) field.get(pObject);
        _disableMotionCurves(gradient);
      }
    }
    if (pObject instanceof Variation) {
      Variation var = (Variation) pObject;
View Full Code Here

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

  }

  protected void addPalette(SimpleXMLBuilder xb, Layer layer) {
    // Palette
    {
      RGBPalette palette = layer.getPalette();
      xb.beginElement("palette",
          xb.createAttr("count", palette.getSize()),
          xb.createAttr("format", "RGB"));
      StringBuilder rgb = new StringBuilder();
      for (int i = 0; i < palette.getSize(); i++) {
        String hs;
        hs = Integer.toHexString(palette.getColor(i).getRed()).toUpperCase();
        rgb.append(hs.length() > 1 ? hs : "0" + hs);
        hs = Integer.toHexString(palette.getColor(i).getGreen()).toUpperCase();
        rgb.append(hs.length() > 1 ? hs : "0" + hs);
        hs = Integer.toHexString(palette.getColor(i).getBlue()).toUpperCase();
        rgb.append(hs.length() > 1 ? hs : "0" + hs);
        if ((i + 1) % 12 == 0) {
          rgb.append("\n");
        }
      }
View Full Code Here

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

            XForm morphedXForm = morphXForms(pPrefs, xForm1, xForm2, fScl, pFrame, pFrames);
            layer.getFinalXForms().add(morphedXForm);
          }
        }
        // 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);
        }
View Full Code Here

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

  @Override
  public void execute(Layer pLayer) {
    int keyFrames = 3 + (int) (Math.random() * 56);
    boolean fadePaletteColors = Math.random() > 0.33;
    RGBPalette palette = new AllRandomGradientGenerator().generatePalette(keyFrames, fadePaletteColors);
    pLayer.setPalette(palette);
  }
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.