Package org.jwildfire.image

Examples of org.jwildfire.image.Pixel


  }

  private void parsePalette(RGBPalette pPalette, String pUgr) {
    Map<Integer, RGBColor> colors = new HashMap<Integer, RGBColor>();
    StringTokenizer tokenizer = new StringTokenizer(pUgr, " \n\r");
    Pixel pixel = new Pixel();
    while (tokenizer.hasMoreElements()) {
      String token = tokenizer.nextToken();
      String nextToken;
      if (token.startsWith("title=")) {
        StringTokenizer lineTokenizer = new StringTokenizer(token, "\"");
        if (lineTokenizer.hasMoreElements()) {
          lineTokenizer.nextElement();
          if (lineTokenizer.hasMoreElements()) {
            pPalette.setFlam3Name((String) lineTokenizer.nextElement());
          }
        }
      }
      else if (token.startsWith("index=") && tokenizer.hasMoreElements() && (nextToken = tokenizer.nextToken()).startsWith("color=")) {
        int index = Integer.parseInt(token.substring(6, token.length()));
        int colorValue = Integer.parseInt(nextToken.substring(6, nextToken.length()));
        pixel.setARGBValue(colorValue);
        RGBColor color = new RGBColor(pixel.b, pixel.g, pixel.r);
        colors.put(index, color);
      }
    }
    boolean doInterpolate = pUgr.contains("numnodes=");
View Full Code Here


        int maxValues = Mode.values().length;
        int idx = (int) ((double) Math.abs(modSwapRGB) / (double) 255.0 * (double) (maxValues - 1));
        sT.setMode(Mode.values()[idx]);
        sT.transformImage(img);
      }
      Pixel pixel = new Pixel();
      for (int i = startIdx; i <= endIdx; i++) {
        RGBColor color = transformedColors[i];
        pixel.setARGBValue(img.getARGBValue(i, 0));
        color.setRed(pixel.r);
        color.setGreen(pixel.g);
        color.setBlue(pixel.b);
      }
      modified = false;
View Full Code Here

    modified = true;
  }

  public void monochrome(int pStartIdx, int pEndIdx) {
    if (pStartIdx < pEndIdx + 1) {
      Pixel rgbPixel = new Pixel();
      HSLTransformer.HSLPixel hslPixel = new HSLTransformer.HSLPixel();
      double avgHue = 0.0;
      int cnt = 0;
      for (int i = pStartIdx; i <= pEndIdx; i++) {
        RGBColor color = getRawColor(i);
        rgbPixel.setRGB(color.getRed(), color.getGreen(), color.getBlue());
        HSLTransformer.rgb2hsl(rgbPixel, hslPixel);
        avgHue += hslPixel.hue;
        cnt++;
      }
      avgHue /= (double) cnt;
      for (int i = pStartIdx; i <= pEndIdx; i++) {
        RGBColor color = getRawColor(i);
        rgbPixel.setRGB(color.getRed(), color.getGreen(), color.getBlue());
        HSLTransformer.rgb2hsl(rgbPixel, hslPixel);
        hslPixel.hue = avgHue;
        HSLTransformer.hsl2rgb(hslPixel, rgbPixel);
        color.setRed(rgbPixel.r);
        color.setGreen(rgbPixel.g);
View Full Code Here

    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);
    }
View Full Code Here

    double rZoom = 1.0 / this.zoom;
    int width = pImg.getImageWidth();
    int height = pImg.getImageHeight();
    SimpleImage xMap = (displaceXMap != null) ? displaceXMap.getImage() : null;
    SimpleImage yMap = (displaceYMap != null) ? displaceYMap.getImage() : null;
    Pixel pPixel = new Pixel();
    double w1 = (double) width - 1.0;
    double h1 = (double) height - 1.0;
    double cx = (double) width / 2.0;
    double cy = (double) height / 2.0;
    for (int pY = 0; pY < height; pY++) {
View Full Code Here

  @Override
  protected void performPixelTransformation(WFImage pImg) {
    SimpleImage img = (SimpleImage) pImg;
    int width = pImg.getImageWidth();
    int height = pImg.getImageHeight();
    Pixel rgbPixel = new Pixel();
    HSLPixel hslPixel = new HSLPixel();

    double phue = (double) (this.hue) / 255.0;
    if (phue < (-1.0))
      phue = -1;
    else if (phue > 1.0)
      phue = 1.0;
    double psaturation = (double) (this.saturation) / 255.0;
    if (psaturation < (-1.0))
      psaturation = -1.0;
    else if (psaturation > 1.0)
      psaturation = 1.0;
    double pluminosity = (double) (this.luminosity) / 255.0;
    if (pluminosity < (-1.0))
      pluminosity = -1;
    else if (pluminosity > 1.0)
      pluminosity = 1.0;
    for (int i = 0; i < height; i++) {
      for (int j = 0; j < width; j++) {
        rgbPixel.setARGBValue(img.getARGBValue(j, i));
        rgb2hsl(rgbPixel, hslPixel);
        hslPixel.luminosity += pluminosity;
        if (hslPixel.luminosity < 0.0)
          hslPixel.luminosity = 0.0;
        else if (hslPixel.luminosity > 1.0)
View Full Code Here

    double t = this.frames != 0 ? (double) this.frame / (double) this.frames : 0.0;
    shift = 2.0 * shift / (double) (width - 1);
    double w1 = (double) width - 1.0;
    double h1 = (double) height - 1.0;

    Pixel pPixel = new Pixel();
    for (int pY = 0; pY < height; pY++) {
      for (int pX = 0; pX < width; pX++) {
        pPixel.setARGBValue(pImg.getARGBValue(pX, pY));

        double x0 = (double) pX - cx;
        double y0 = (double) pY - cy;
        double sangle = shift * pX;
        double dl = (y0 - sangle) / wavelength;
View Full Code Here

    double t = this.frames != 0 ? (double) this.frame / (double) this.frames : 0.0;
    shift = 2.0 * shift / (double) (height - 1);
    double w1 = (double) width - 1.0;
    double h1 = (double) height - 1.0;

    Pixel pPixel = new Pixel();
    for (int pY = 0; pY < height; pY++) {
      for (int pX = 0; pX < width; pX++) {
        pPixel.setARGBValue(pImg.getARGBValue(pX, pY));
        /* transform the point */
        double x0 = (double) pX - cx;
        double y0 = (double) pY - cy;
        double sangle = shift * pY;
        double dl = (x0 - sangle) / wavelength;
View Full Code Here

    shift = 2.0 * shift / (double) (width - 1);
    double amp = amplitude;
    double t = this.frames != 0 ? (double) this.frame / (double) this.frames : 0.0;
    double w1 = (double) width - 1.0;
    double h1 = (double) height - 1.0;
    Pixel pPixel = new Pixel();
    for (int pY = 0; pY < height; pY++) {
      for (int pX = 0; pX < width; pX++) {
        pPixel.setARGBValue(pImg.getARGBValue(pX, pY));
        /* transform the point */
        double x0 = (double) pX - cx;
        double y0 = (double) pY - cy;
        double dl = (y0 - shift * pX) / wavelength;
        double zz = amp * Math.sin((PI2 * (t - dl)) + phase);
View Full Code Here

    shift = 2.0 * shift / (double) (height - 1);
    double amp = amplitude;
    double t = this.frames != 0 ? (double) this.frame / (double) this.frames : 0.0;
    double w1 = (double) width - 1.0;
    double h1 = (double) height - 1.0;
    Pixel pPixel = new Pixel();
    for (int pY = 0; pY < height; pY++) {
      for (int pX = 0; pX < width; pX++) {
        pPixel.setARGBValue(pImg.getARGBValue(pX, pY));
        /* transform the point */
        double x0 = (double) pX - cx;
        double y0 = (double) pY - cy;
        double dl = (x0 - shift * pY) / wavelength;
        double zz = amp * Math.sin((PI2 * (t - dl)) + phase);
View Full Code Here

TOP

Related Classes of org.jwildfire.image.Pixel

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.