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;
}
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);
}
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;
}
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;
}
}
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;
}
Aggregations