Exemplo n.º 1
0
        private void initBColorbar()
        {
            int  len = BpicBox.Width * BpicBox.Height;
            int  index;
            byte r = 0;
            byte g = 0;
            byte b = 0;

            byte[] dataForColor  = new byte[len * 3];
            Bitmap imageForColor = new Bitmap(BpicBox.Width, BpicBox.Height);

            for (int i = 0; i < BpicBox.Height; i++)
            {
                if (RGBImage.getRGB(((double)i) / BpicBox.Height, ref r, ref g, ref b))
                {
                    for (int j = 0; j < BpicBox.Width; j++)
                    {
                        index = 3 * (i * BpicBox.Width + j);
                        dataForColor[index]     = b;
                        dataForColor[index + 1] = g;
                        dataForColor[index + 2] = r;
                    }
                }
            }
            BpicBox.Image = RGBImage.CreateBitmap(dataForColor, imageForColor);
        }