本文整理汇总了Java中com.badlogic.gdx.graphics.Color.set方法的典型用法代码示例。如果您正苦于以下问题:Java Color.set方法的具体用法?Java Color.set怎么用?Java Color.set使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.badlogic.gdx.graphics.Color
的用法示例。
在下文中一共展示了Color.set方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: fillFormWithConstantColor
import com.badlogic.gdx.graphics.Color; //导入方法依赖的package包/类
public static Pixmap fillFormWithConstantColor(Pixmap pixmap, Color fillColor) {
// set fill color
pixmap.setColor(fillColor);
Color color = new Color();
for (int x = 0; x < pixmap.getWidth(); x++) {
for (int y = 0; y < pixmap.getHeight(); y++) {
int colorInt = pixmap.getPixel(x, y);
color.set(colorInt);
// get color alpha value
float alpha = color.a;
if (alpha > 0) {
pixmap.setColor(fillColor);
pixmap.fillRectangle(x, y, 1, 1);
} else {
pixmap.setColor(new Color(0, 0, 0, 0));
pixmap.fillRectangle(x, y, 1, 1);
}
}
}
return pixmap;
}
示例2: gaussianPixmap
import com.badlogic.gdx.graphics.Color; //导入方法依赖的package包/类
private static void gaussianPixmap(Pixmap in, Pixmap out, double[][] gwm, int gaussianRadius) {
Color inColor = new Color();
Color outColor = new Color();
int offsetX = (in.getWidth() - out.getWidth()) / 2;
int offsetY = (in.getHeight() - out.getHeight()) / 2;
int width = out.getWidth();
int height = out.height();
for (int x = 0; x < width; x++, width = out.getWidth()) {
for (int y = 0; y < height; y++, height = out.height()) {
outColor.set(0, 0, 0, 0);
for (int ox = -gaussianRadius; ox <= gaussianRadius; ox++) {
for (int oy = -gaussianRadius; oy <= gaussianRadius; oy++) {
int pixel = in.getPixel(x + ox + offsetX, y + oy + offsetY);
inColor.set(pixel);
double d = gwm[ox + gaussianRadius][oy + gaussianRadius];
outColor.r += inColor.r * d;
outColor.g += inColor.g * d;
outColor.b += inColor.b * d;
outColor.a += inColor.a * d;
}
}
out.drawPixel(x, y, Color.rgba8888(outColor.clamp()));
}
}
}
示例3: gaussianPixmap
import com.badlogic.gdx.graphics.Color; //导入方法依赖的package包/类
private static void gaussianPixmap(Pixmap in, Pixmap out, double[][] gwm, int gaussianRadius) {
Color inColor = new Color();
Color outColor = new Color();
int offsetX = (in.getWidth() - out.getWidth()) / 2;
int offsetY = (in.getHeight() - out.getHeight()) / 2;
for (int x = 0; x < out.getWidth(); x++) {
for (int y = 0; y < out.getHeight(); y++) {
outColor.set(0, 0, 0, 0);
for (int ox = -gaussianRadius; ox <= gaussianRadius; ox++) {
for (int oy = -gaussianRadius; oy <= gaussianRadius; oy++) {
int pixel = in.getPixel(x + ox + offsetX, y + oy + offsetY);
inColor.set(pixel);
double d = gwm[ox + gaussianRadius][oy + gaussianRadius];
outColor.r += inColor.r * d;
outColor.g += inColor.g * d;
outColor.b += inColor.b * d;
outColor.a += inColor.a * d;
}
}
out.drawPixel(x, y, Color.rgba8888(outColor.clamp()));
}
}
}