本文整理汇总了Java中com.badlogic.gdx.tools.texturepacker.ColorBleedEffect.Mask.MaskIterator类的典型用法代码示例。如果您正苦于以下问题:Java MaskIterator类的具体用法?Java MaskIterator怎么用?Java MaskIterator使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
MaskIterator类属于com.badlogic.gdx.tools.texturepacker.ColorBleedEffect.Mask包,在下文中一共展示了MaskIterator类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: executeIteration
import com.badlogic.gdx.tools.texturepacker.ColorBleedEffect.Mask.MaskIterator; //导入依赖的package包/类
private void executeIteration (int[] rgb, Mask mask, int width, int height) {
MaskIterator iterator = mask.new MaskIterator();
while (iterator.hasNext()) {
int pixelIndex = iterator.next();
int x = pixelIndex % width;
int y = pixelIndex / width;
int r = 0, g = 0, b = 0;
int count = 0;
for (int i = 0, n = offsets.length; i < n; i++) {
int[] offset = offsets[i];
int column = x + offset[0];
int row = y + offset[1];
if (column < 0 || column >= width || row < 0 || row >= height) continue;
int currentPixelIndex = getPixelIndex(width, column, row);
if (mask.getMask(currentPixelIndex) == REALDATA) {
color.argb = rgb[currentPixelIndex];
r += color.red();
g += color.green();
b += color.blue();
count++;
}
}
if (count != 0) {
color.setARGBA(0, r / count, g / count, b / count);
rgb[pixelIndex] = color.argb;
iterator.markAsInProgress();
}
}
iterator.reset();
}