当前位置:编程学习 > C#/ASP.NET >>

求助:有没有高效点的关于从指定的调色板中提取已知RGB的INDEX的方法

有没有高效点的关于从指定的调色板中提取已知RGB的INDEX的方法,我先在就是用的最傻的方法,就是遍历调色板中的所有RGB,提取一个pix就要遍历一遍调色板,方法如下:
        public byte getPixIndex(Color color, Bitmap bmp)
        {
            ColorPalette palette = bmp.Palette;
            ///search the RGB's index from palette
            for (byte i = 0; i < palette.Entries.Length; i++)
            {
                if (palette.Entries[i].Equals(color))
                {
                    return i;
                }
            }
            ///if the value of RGB could not found from the palette
            ///return a default index
            return RESCONST.CONST_BYTE_DEFAULTPIXINDEX;
        }
最好在C#中就有这个函数,我就是找不到!
补充:.NET技术 ,  C#
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,