本文整理匯總了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();
}