public int GetPaletteIndex(Color color) { int a = color.A >> (8 - _indexAlphaBits); int r = color.R >> (8 - _indexBits); int g = color.G >> (8 - _indexBits); int b = color.B >> (8 - _indexBits); int index = WuCommon.GetIndex(r + 1, g + 1, b + 1, a + 1, _indexBits, _indexAlphaBits); return(tag[index]); }
private void Mark(WuColorBox box, byte label) { for (int r = box.R0 + 1; r <= box.R1; r++) { for (int g = box.G0 + 1; g <= box.G1; g++) { for (int b = box.B0 + 1; b <= box.B1; b++) { for (int a = box.A0 + 1; a <= box.A1; a++) { tag[WuCommon.GetIndex(r, g, b, a, _indexBits, _indexAlphaBits)] = label; } } } } }