Exemplo n.º 1
0
        PixelArray<BGRb> CreateSteppedTestImage(int width, int height)
        {
            PixelArray<BGRb> picture = new PixelArray<BGRb>(width, height);
            ColorRGBA black = new ColorRGBA(0, 0, 0);
            ColorRGBA white = new ColorRGBA(1, 1, 1);
            ColorRGBA red = new ColorRGBA(1, 0, 0);
            ColorRGBA blue = new ColorRGBA(0, 1, 0);
            ColorRGBA generic = new ColorRGBA(0, 0, 0);

            for (int y = 0; y < picture.Height; y++)
            {
                generic.Red = (float)y / picture.Height - 1.0f;
                generic.Green = 1.0f - (float)y / picture.Height;
                //generic.Blue = (float)y / picture.Height - 1.0f;

                for (int x = 0; x < picture.Width; x++)
                {
                    //if (x < width / 2)
                    //    picture.SetColor(x, y, red);
                    //else
                    //    picture.SetColor(x, y, white);

                    generic.Blue = (float)x / picture.Width - 1.0f;
                    picture.SetColor(x, y, generic);
                }
            }

            return picture;
        }
Exemplo n.º 2
0
        public static PixelArray<Lumb> Copy(PixelArray<Lumb> dst, GDIDIBSection src)
        {
            if (dst.Orientation != src.Orientation)
                return null;


            int imageSize = src.Width * src.Height;

            //Lumb* dstPointer = (Lumb*)dst.Pixels.ToPointer();
            //BGRb* srcPointer = (BGRb*)src.Pixels.ToPointer();

            for (int row = 0; row < src.Height; row++)
                for (int column =0; column < src.Width; column++)
            {

                dst.SetColor(column, row, src.GetColor(column, row));
                //*dstPointer = new Lumb(NTSCGray.ToLuminance(*srcPointer));

                //dstPointer++;
                //srcPointer++;
            }

            //for (int row = 0; row < src.Height; row++)
            //    for (int column = 0; column < src.Width; column++)
            //    {
            //        BGRb srcPixel = srcPointer[src.CalculateOffset(column, row)];
            //        byte lum = NTSCGray.ToLuminance(srcPointer[src.CalculateOffset(column, row)]);

            //        dstPointer[dst.CalculateOffset(column, row)] = new Lumb(lum);
            //    }

            return dst;
        }
Exemplo n.º 3
0
        PixelArray<BGRb> CreateBarsTestImage(int maxBar)
        {
            int width = 128;
            int height = 128;

            PixelArray<BGRb> picture = new PixelArray<BGRb>(width, height);
            ColorRGBA black = new ColorRGBA(0, 0, 0);
            ColorRGBA white = new ColorRGBA(1, 1, 1);
            ColorRGBA red = new ColorRGBA(1, 0, 0);
            ColorRGBA green = new ColorRGBA(0, 1, 0);
            ColorRGBA blue = new ColorRGBA(0, 0, 1);
            ColorRGBA generic = new ColorRGBA(0, 0, 0);

            for (int y = 0; y < picture.Height; y++)
            {
                int x = 0;
                for (int bars = 1; bars <= maxBar; bars++)
                {
                    for (int column =0; column< bars; column++)
                    {
                        picture.SetColor(x + column, y, red);
                    }
                    x += bars + 4;


                    //picture.ColorAccessor.SetColor(x, y, generic);
                    //generic.Blue = (float)x / picture.Width - 1.0f;
                }
                //generic.Red = (float)y / picture.Height - 1.0f;
                //generic.Green = 1.0f - (float)y / picture.Height;
                //generic.Blue = (float)y / picture.Height - 1.0f;
            }

            return picture;
        }