use of org.jwildfire.create.tina.base.XYZPoint in project JWildfire by thargor6.
the class CannabisCurveDOFBlurShape method prepare.
@Override
public void prepare(FlameTransformationContext pFlameTransformationContext, AbstractRandomGenerator pRandGen, double pCamDOF_10) {
super.prepare(pFlameTransformationContext, pRandGen, pCamDOF_10);
s = new XYZPoint();
d = new XYZPoint();
xform = new XForm();
fnc = new CannabisCurveWFFunc();
fnc.setParameter(CannabisCurveWFFunc.PARAM_FILLED, 1.0);
fnc.init(pFlameTransformationContext, new Layer(), xform, 1.0);
}
use of org.jwildfire.create.tina.base.XYZPoint in project JWildfire by thargor6.
the class CloverleafDOFBlurShape method prepare.
@Override
public void prepare(FlameTransformationContext pFlameTransformationContext, AbstractRandomGenerator pRandGen, double pCamDOF_10) {
super.prepare(pFlameTransformationContext, pRandGen, pCamDOF_10);
s = new XYZPoint();
d = new XYZPoint();
xform = new XForm();
fnc = new CloverLeafWFFunc();
fnc.setParameter(CloverLeafWFFunc.PARAM_FILLED, 1.0);
fnc.init(pFlameTransformationContext, new Layer(), xform, 1.0);
}
use of org.jwildfire.create.tina.base.XYZPoint in project JWildfire by thargor6.
the class FlowerDOFBlurShape method prepare.
@Override
public void prepare(FlameTransformationContext pFlameTransformationContext, AbstractRandomGenerator pRandGen, double pCamDOF_10) {
super.prepare(pFlameTransformationContext, pRandGen, pCamDOF_10);
s = new XYZPoint();
d = new XYZPoint();
xform = new XForm();
fnc = new FlowerFunc();
for (String paramName : getParamNames()) {
fnc.setParameter(paramName, params.get(paramName));
}
fnc.init(pFlameTransformationContext, new Layer(), xform, 1.0);
}
use of org.jwildfire.create.tina.base.XYZPoint in project JWildfire by thargor6.
the class NBlurDOFBlurShape method prepare.
@Override
public void prepare(FlameTransformationContext pFlameTransformationContext, AbstractRandomGenerator pRandGen, double pCamDOF_10) {
super.prepare(pFlameTransformationContext, pRandGen, pCamDOF_10);
s = new XYZPoint();
d = new XYZPoint();
xform = new XForm();
fnc = new NBlurFunc();
for (String paramName : getParamNames()) {
fnc.setParameter(paramName, params.get(paramName));
}
fnc.init(pFlameTransformationContext, new Layer(), xform, 1.0);
}
use of org.jwildfire.create.tina.base.XYZPoint in project JWildfire by thargor6.
the class AbstractColorMapWFFunc method transform.
public void transform(FlameTransformationContext pContext, XForm pXForm, XYZPoint pAffineTP, XYZPoint pVarTP, double pAmount, double pInputX, double pInputY) {
double x = (pInputX - (offsetX + 0.5) + 1.0) / scaleX * (double) (imgWidth - 2);
double y = (pInputY - (offsetY + 0.5) + 1.0) / scaleY * (double) (imgHeight - 2);
int ix, iy;
if (blend_colormap > 0) {
ix = (int) MathLib.trunc(x);
iy = (int) MathLib.trunc(y);
} else {
ix = Tools.FTOI(x);
iy = Tools.FTOI(y);
}
if (this.tileX == 1) {
if (ix < 0) {
int nx = ix / imgWidth - 1;
ix -= nx * imgWidth;
} else if (ix >= imgWidth) {
int nx = ix / imgWidth;
ix -= nx * imgWidth;
}
}
if (this.tileY == 1) {
if (iy < 0) {
int ny = iy / imgHeight - 1;
iy -= ny * imgHeight;
} else if (iy >= imgHeight) {
int ny = iy / imgHeight;
iy -= ny * imgHeight;
}
}
double r, g, b;
if (ix >= 0 && ix < imgWidth && iy >= 0 && iy < imgHeight) {
if (colorMap instanceof SimpleImage) {
if (blend_colormap > 0) {
double iufrac = MathLib.frac(x);
double ivfrac = MathLib.frac(y);
toolPixel.setARGBValue(((SimpleImage) colorMap).getARGBValue(ix, iy));
int lur = toolPixel.r;
int lug = toolPixel.g;
int lub = toolPixel.b;
toolPixel.setARGBValue(((SimpleImage) colorMap).getARGBValue(ix + 1, iy));
int rur = toolPixel.r;
int rug = toolPixel.g;
int rub = toolPixel.b;
toolPixel.setARGBValue(((SimpleImage) colorMap).getARGBValue(ix, iy + 1));
int lbr = toolPixel.r;
int lbg = toolPixel.g;
int lbb = toolPixel.b;
toolPixel.setARGBValue(((SimpleImage) colorMap).getARGBValue(ix + 1, iy + 1));
int rbr = toolPixel.r;
int rbg = toolPixel.g;
int rbb = toolPixel.b;
r = GfxMathLib.blerp(lur, rur, lbr, rbr, iufrac, ivfrac);
g = GfxMathLib.blerp(lug, rug, lbg, rbg, iufrac, ivfrac);
b = GfxMathLib.blerp(lub, rub, lbb, rbb, iufrac, ivfrac);
} else {
toolPixel.setARGBValue(((SimpleImage) colorMap).getARGBValue(ix, iy));
r = toolPixel.r;
g = toolPixel.g;
b = toolPixel.b;
}
if (dc_color > 0) {
pVarTP.rgbColor = true;
pVarTP.redColor = r;
pVarTP.greenColor = g;
pVarTP.blueColor = b;
}
} else {
if (blend_colormap > 0) {
double iufrac = MathLib.frac(x);
double ivfrac = MathLib.frac(y);
((SimpleHDRImage) colorMap).getRGBValues(rgbArray, ix, iy);
double lur = rgbArray[0];
double lug = rgbArray[1];
double lub = rgbArray[2];
((SimpleHDRImage) colorMap).getRGBValues(rgbArray, ix + 1, iy);
double rur = rgbArray[0];
double rug = rgbArray[1];
double rub = rgbArray[2];
((SimpleHDRImage) colorMap).getRGBValues(rgbArray, ix, iy + 1);
double lbr = rgbArray[0];
double lbg = rgbArray[1];
double lbb = rgbArray[2];
((SimpleHDRImage) colorMap).getRGBValues(rgbArray, ix + 1, iy + 1);
double rbr = rgbArray[0];
double rbg = rgbArray[1];
double rbb = rgbArray[2];
r = GfxMathLib.blerp(lur, rur, lbr, rbr, iufrac, ivfrac);
g = GfxMathLib.blerp(lug, rug, lbg, rbg, iufrac, ivfrac);
b = GfxMathLib.blerp(lub, rub, lbb, rbb, iufrac, ivfrac);
} else {
((SimpleHDRImage) colorMap).getRGBValues(rgbArray, ix, iy);
r = rgbArray[0];
g = rgbArray[1];
b = rgbArray[2];
}
if (dc_color > 0) {
pVarTP.rgbColor = true;
pVarTP.redColor = r;
pVarTP.greenColor = g;
pVarTP.blueColor = b;
}
}
} else {
r = g = b = 0.0;
if (dc_color > 0) {
pVarTP.rgbColor = true;
pVarTP.redColor = r;
pVarTP.greenColor = g;
pVarTP.blueColor = b;
}
}
double dz = this.offsetZ;
if (fabs(scaleZ) > EPSILON) {
double intensity = (0.299 * r + 0.588 * g + 0.113 * b) / 255.0;
dz += scaleZ * intensity;
}
if (resetZ != 0) {
pVarTP.z = dz;
} else {
pVarTP.z += dz;
}
if (dc_color > 0) {
pVarTP.color = getColorIdx(Tools.FTOI(r), Tools.FTOI(g), Tools.FTOI(b));
}
}
Aggregations