本文整理汇总了Java中com.jhlabs.image.ImageMath.lerp方法的典型用法代码示例。如果您正苦于以下问题:Java ImageMath.lerp方法的具体用法?Java ImageMath.lerp怎么用?Java ImageMath.lerp使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.jhlabs.image.ImageMath
的用法示例。
在下文中一共展示了ImageMath.lerp方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: perlinNoise2D
import com.jhlabs.image.ImageMath; //导入方法依赖的package包/类
/**
* A 2D version of the algorithm from http://mrl.nyu.edu/~perlin/noise/
*/
private static float perlinNoise2D(float x, float y) {
// find unit grid cell containing point + wrap the integer cells at 255
int gridX = ((int) x) & 255;
int gridY = ((int) y) & 255;
// get relative coordinates of point within cell
x -= ((int) x);
y -= ((int) y);
// compute the fade curves for x and y
float u = fade(x);
float v = fade(y);
// calculate hashed gradient indices
int a = p[gridX] + gridY;
int aa = p[a];
int ab = p[a + 1];
int b = p[gridX + 1] + gridY;
int ba = p[b];
int bb = p[b + 1];
float noiseSE = grad2D(p[aa], x, y);
float noiseSW = grad2D(p[ba], x - 1, y);
float noiseNE = grad2D(p[ab], x, y - 1);
float noiseNW = grad2D(p[bb], x - 1, y - 1);
float noiseS = ImageMath.lerp(u, noiseSE, noiseSW);
float noiseN = ImageMath.lerp(u, noiseNE, noiseNW);
float noise = ImageMath.lerp(v, noiseS, noiseN);
// noise is in the range [-1..1]
return noise;
}
示例2: getInterpolatedPositions
import com.jhlabs.image.ImageMath; //导入方法依赖的package包/类
private float[] getInterpolatedPositions(float progress, GState grEndState) {
float[] interpolatedPositions = new float[thumbPositions.length];
for (int i = 0; i < thumbPositions.length; i++) {
float initial = thumbPositions[i];
float end = grEndState.thumbPositions[i];
float interpolated = ImageMath.lerp(progress, initial, end);
interpolatedPositions[i] = interpolated;
}
return interpolatedPositions;
}
示例3: interpolate
import com.jhlabs.image.ImageMath; //导入方法依赖的package包/类
@Override
public ParamState interpolate(ParamState endState, double progress) {
IPPState ippEndState = (IPPState) endState;
double interpolatedX = ImageMath.lerp(progress, relativeX, ippEndState.relativeX);
double interpolatedY = ImageMath.lerp(progress, relativeY, ippEndState.relativeY);
return new IPPState(interpolatedX, interpolatedY);
}
示例4: interpolate
import com.jhlabs.image.ImageMath; //导入方法依赖的package包/类
@Override
public ParamState interpolate(ParamState endState, double progress) {
GRState apEndState = (GRState) endState;
double[] interpolatedValues = new double[values.length];
for (int i = 0; i < values.length; i++) {
interpolatedValues[i] = ImageMath.lerp(progress, values[i], apEndState.values[i]);
}
return new GRState(interpolatedValues);
}
示例5: doTransform
import com.jhlabs.image.ImageMath; //导入方法依赖的package包/类
@Override
public BufferedImage doTransform(BufferedImage src, BufferedImage dest) {
ReseedSupport.reInitialize();
Random rand = ReseedSupport.getRand();
int[] srcData = ImageUtils.getPixelsAsArray(src);
int[] destData = ImageUtils.getPixelsAsArray(dest);
float opacityValueAsPercentage = opacity.getValueAsPercentage();
int opacityValue = opacity.getValue();
float saturationValueAsPercentage = saturation.getValueAsPercentage();
int saturationValue = saturation.getValue();
float coverageValue = coverage.getValueAsPercentage();
boolean coverageAnim = method.getValue() == METHOD_COVERAGE_ANIM;
for (int i = 0; i < destData.length; i++) {
int srcRGB = srcData[i];
int randomInt = 0;
if (coverageAnim) {
// generate random numbers for the discarded pixels as well
randomInt = rand.nextInt();
}
float rn = rand.nextFloat();
if (rn > coverageValue) {
destData[i] = srcRGB;
continue;
}
int sourceAlpha = 0xFF000000 & srcRGB;
if (sourceAlpha == 0) { // for premultiplied
destData[i] = 0;
continue;
}
if (!coverageAnim) {
// if coverage animation is not a requirement, then it is faster
// to generate the random values only here, for the covered pixels
randomInt = rand.nextInt();
}
if(saturationValue == 100) {
// make the alpha channel the same as for the source
randomInt |= sourceAlpha;
if (opacityValue == 100) {
destData[i] = randomInt;
} else {
destData[i] = ImageMath.mixColors(opacityValueAsPercentage, srcRGB, randomInt);
}
} else {
int r = (randomInt >>> 16) & 0xFF;
int g = (randomInt >>> 8) & 0xFF;
int b = (randomInt) & 0xFF;
Color.RGBtoHSB(r, g, b, tmpHSV);
float newSaturation = ImageMath.lerp(saturationValueAsPercentage, 0.0f, tmpHSV[1]);
randomInt = Color.HSBtoRGB(tmpHSV[0], newSaturation, tmpHSV[2]);
// make the alpha channel the same as for the source
randomInt |= sourceAlpha;
if (opacityValue == 100) {
destData[i] = randomInt;
} else {
destData[i] = ImageMath.mixColors(opacityValueAsPercentage, srcRGB, randomInt);
}
}
}
return dest;
}
示例6: interpolate
import com.jhlabs.image.ImageMath; //导入方法依赖的package包/类
@Override
public ParamState interpolate(ParamState endState, double progress) {
APState apEndState = (APState) endState;
double interpolatedAngle = ImageMath.lerp(progress, angle, apEndState.angle);
return new APState(interpolatedAngle);
}
示例7: interpolate
import com.jhlabs.image.ImageMath; //导入方法依赖的package包/类
@Override
public RPState interpolate(ParamState endState, double progress) {
RPState rpEndState = (RPState) endState;
double interpolated = ImageMath.lerp(progress, value, rpEndState.value);
return new RPState(interpolated);
}