Esempio n. 1
0
        public IndexedImage(ColorList colorList, Bitmap bitmap, ColorSpace colorSpace, Dither dither)
        {
            ColorList = colorList;
            Width     = bitmap.Width;
            Height    = bitmap.Height;

            Pixels = new int[Width * Height];

            for (int y = 0; y < Height; y++)
            {
                if (y % 10 == 0)
                {
                    Console.WriteLine("Indexing... {0}/{1}", y, Height);
                }

                for (int x = 0; x < Width; x++)
                {
                    Color color = bitmap.GetPixel(x, y);
                    SetIndex(x, y, ColorList.GetNearestColorIndexDither(color, x, y, colorSpace, dither));
                    //SetIndex( x, y, ColorList.GetNearestColorIndex(color) );
                }
            }
        }