Search in sources :

Example 1 with Pixel

use of org.jwildfire.image.Pixel in project JWildfire by thargor6.

the class MonochromeRandomGradientGenerator method generateKeyFrames.

@Override
public List<RGBColor> generateKeyFrames(int pKeyFrameCount) {
    HSLPixel hslPixel = new HSLPixel();
    Pixel rgbPixel = new Pixel();
    List<RGBColor> keyFrames = new ArrayList<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;
}
Also used : HSLPixel(org.jwildfire.transform.HSLTransformer.HSLPixel) RGBColor(org.jwildfire.create.tina.palette.RGBColor) ArrayList(java.util.ArrayList) Pixel(org.jwildfire.image.Pixel) HSLPixel(org.jwildfire.transform.HSLTransformer.HSLPixel)

Example 2 with Pixel

use of org.jwildfire.image.Pixel in project JWildfire by thargor6.

the class StripesRandomGradientGenerator method createStripeColor.

private RGBColor createStripeColor() {
    HSLPixel hslPixel = new HSLPixel();
    hslPixel.saturation = Math.random() * 0.1 + 0.8999;
    double rnd = Math.random() + Math.random() + Math.random() + Math.random() + Math.random();
    if (rnd > 4.0)
        hslPixel.hue = 0.8 + (rnd - 4.0) / 7.0;
    else if (rnd > 3.0)
        hslPixel.hue = 0.2 + (rnd - 3.0) / 7.0;
    else if (rnd > 2.0)
        hslPixel.hue = 0.0 + (rnd - 2.0) / 7.0;
    else if (rnd > 1.0)
        hslPixel.hue = 0.6 + (rnd - 1.0) / 7.0;
    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);
}
Also used : HSLPixel(org.jwildfire.transform.HSLTransformer.HSLPixel) RGBColor(org.jwildfire.create.tina.palette.RGBColor) Pixel(org.jwildfire.image.Pixel) HSLPixel(org.jwildfire.transform.HSLTransformer.HSLPixel)

Example 3 with Pixel

use of org.jwildfire.image.Pixel in project JWildfire by thargor6.

the class StrongHueRandomGradientGenerator method generateKeyFrames.

@Override
public List<RGBColor> generateKeyFrames(int pKeyFrameCount) {
    HSLPixel hslPixel = new HSLPixel();
    Pixel rgbPixel = new Pixel();
    List<RGBColor> keyFrames = new ArrayList<RGBColor>();
    hslPixel.saturation = Math.random() * 0.1 + 0.8999;
    for (int i = 0; i < pKeyFrameCount; i++) {
        hslPixel.luminosity = Math.random() * 0.90;
        double rnd = Math.random() + Math.random() + Math.random() + Math.random() + Math.random();
        if (rnd > 4.0)
            hslPixel.hue = 0.8 + (rnd - 4.0) / 7.0;
        else if (rnd > 3.0)
            hslPixel.hue = 0.2 + (rnd - 3.0) / 7.0;
        else if (rnd > 2.0)
            hslPixel.hue = 0.0 + (rnd - 2.0) / 7.0;
        else if (rnd > 1.0)
            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;
}
Also used : HSLPixel(org.jwildfire.transform.HSLTransformer.HSLPixel) RGBColor(org.jwildfire.create.tina.palette.RGBColor) ArrayList(java.util.ArrayList) Pixel(org.jwildfire.image.Pixel) HSLPixel(org.jwildfire.transform.HSLTransformer.HSLPixel)

Example 4 with Pixel

use of org.jwildfire.image.Pixel in project JWildfire by thargor6.

the class RGBPalette method monochrome.

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);
            color.setBlue(rgbPixel.b);
            rawColors.put(i, color);
        }
        modified = true;
    }
}
Also used : HSLTransformer(org.jwildfire.transform.HSLTransformer) Pixel(org.jwildfire.image.Pixel)

Example 5 with Pixel

use of org.jwildfire.image.Pixel in project JWildfire by thargor6.

the class FlameRenderer method renderStereo3dAnaglyph.

private RenderedFlame renderStereo3dAnaglyph(RenderInfo pRenderInfo) {
    RenderInfo localRenderInfo = pRenderInfo.makeCopy();
    localRenderInfo.setRenderHDR(false);
    localRenderInfo.setRenderZBuffer(false);
    eye = Stereo3dEye.LEFT;
    RenderedFlame leftRender = renderImageNormal(localRenderInfo, 2, 0);
    eye = Stereo3dEye.RIGHT;
    RenderedFlame rightRender = renderImageNormal(localRenderInfo, 2, 1);
    if (flame.isStereo3dSwapSides()) {
        RenderedFlame tmp = leftRender;
        leftRender = rightRender;
        rightRender = tmp;
    }
    Pixel lPixel = new Pixel();
    Pixel rPixel = new Pixel();
    Stereo3dColor leftColor = flame.getAnaglyph3dLeftEyeColor();
    Stereo3dColor rightColor = flame.getAnaglyph3dRightEyeColor();
    SimpleImage leftImg = leftRender.getImage();
    SimpleImage rightImg = rightRender.getImage();
    RenderedFlame mergedRender = new RenderedFlame();
    localRenderInfo.setImageWidth(leftRender.getImage().getImageWidth());
    localRenderInfo.setImageHeight(leftRender.getImage().getImageHeight());
    mergedRender.init(localRenderInfo, flame);
    SimpleImage mergedImg = mergedRender.getImage();
    for (int i = 0; i < mergedImg.getImageHeight(); i++) {
        for (int j = 0; j < mergedImg.getImageWidth(); j++) {
            lPixel.setARGBValue(leftImg.getARGBValue(j, i));
            rPixel.setARGBValue(rightImg.getARGBValue(j, i));
            int mr = leftColor.calculateRed(lPixel.r, lPixel.g, lPixel.b) + rightColor.calculateRed(rPixel.r, rPixel.g, rPixel.b);
            if (mr < 0)
                mr = 0;
            else if (mr > 255)
                mr = 255;
            int mg = leftColor.calculateGreen(lPixel.r, lPixel.g, lPixel.b) + rightColor.calculateGreen(rPixel.r, rPixel.g, rPixel.b);
            if (mg < 0)
                mg = 0;
            else if (mg > 255)
                mg = 255;
            int mb = leftColor.calculateBlue(lPixel.r, lPixel.g, lPixel.b) + rightColor.calculateBlue(rPixel.r, rPixel.g, rPixel.b);
            if (mb < 0)
                mb = 0;
            else if (mb > 255)
                mb = 255;
            mergedImg.setRGB(j, i, mr, mg, mb);
        }
    }
    return mergedRender;
}
Also used : SimpleImage(org.jwildfire.image.SimpleImage) Stereo3dColor(org.jwildfire.create.tina.base.Stereo3dColor) Pixel(org.jwildfire.image.Pixel) PCPoint(org.jwildfire.create.tina.base.raster.RasterPointCloud.PCPoint)

Aggregations

Pixel (org.jwildfire.image.Pixel)62 SimpleImage (org.jwildfire.image.SimpleImage)37 RGBColor (org.jwildfire.create.tina.palette.RGBColor)5 ArrayList (java.util.ArrayList)4 HashMap (java.util.HashMap)3 HSLPixel (org.jwildfire.transform.HSLTransformer.HSLPixel)3 Color (java.awt.Color)2 Graphics2D (java.awt.Graphics2D)2 BufferedImage (java.awt.image.BufferedImage)2 JEPWrapper (org.jwildfire.base.mathparser.JEPWrapper)2 HSLTransformer (org.jwildfire.transform.HSLTransformer)2 Node (org.nfunk.jep.Node)2 SVGDiagram (com.kitfox.svg.SVGDiagram)1 SVGUniverse (com.kitfox.svg.SVGUniverse)1 Graphics (java.awt.Graphics)1 File (java.io.File)1 FileOutputStream (java.io.FileOutputStream)1 OutputStreamWriter (java.io.OutputStreamWriter)1 StringReader (java.io.StringReader)1 Writer (java.io.Writer)1