GetPaletteIndex() 개인적인 메소드

private GetPaletteIndex ( Color32 pixel, int level ) : int
pixel Color32
level int
리턴 int
예제 #1
0
        public int GetPaletteIndex(Color32 *pixel, int level)
        {
            int pindex = paletteIndex;

            if (!Leaf)
            {
                int shift = 7 - level;
                int index = ((pixel->Red & mask[level]) >> (shift - 2)) |
                            ((pixel->Green & mask[level]) >> (shift - 1)) |
                            ((pixel->Blue & mask[level]) >> (shift));
                OcTreeNode child = Children[index];
                if (child != null)
                {
                    child.GetPaletteIndex(pixel, level + 1);
                }
                else
                {
                    throw new Exception("不可预料的事情发生了!");
                }
            }
            return(pindex);
        }
예제 #2
0
 internal int GetPaletteIndex(Color32 *pixel)
 {
     return(_rootNode.GetPaletteIndex(pixel, 0));
 }