예제 #1
0
        public static Image <TColor> CreateTestImage <TColor>(GenericFactory <TColor> factory)
            where TColor : struct, IPackedPixel, IEquatable <TColor>
        {
            Image <TColor> image = factory.CreateImage(10, 10);

            using (PixelAccessor <TColor> pixels = image.Lock())
            {
                for (int i = 0; i < 10; i++)
                {
                    for (int j = 0; j < 10; j++)
                    {
                        Vector4 v = new Vector4(i / 10f, j / 10f, 0, 1);

                        TColor color = default(TColor);
                        color.PackFromVector4(v);

                        pixels[i, j] = color;
                    }
                }
            }
            return(image);
        }
예제 #2
0
        public static Image <TPixel> CreateTestImage <TPixel>(GenericFactory <TPixel> factory)
            where TPixel : struct, IPixel <TPixel>
        {
            Image <TPixel> image = factory.CreateImage(10, 10);

            using (PixelAccessor <TPixel> pixels = image.Lock())
            {
                for (int i = 0; i < 10; i++)
                {
                    for (int j = 0; j < 10; j++)
                    {
                        Vector4 v = new Vector4(i, j, 0, 1);
                        v /= 10;

                        TPixel color = default(TPixel);
                        color.PackFromVector4(v);

                        pixels[i, j] = color;
                    }
                }
            }
            return(image);
        }
 /// <summary>
 /// Need to us <see cref="GenericFactory{TColor}"/> to create instance of <see cref="Image"/> when pixelType is StandardImageClass
 /// </summary>
 /// <typeparam name="TColor"></typeparam>
 /// <param name="factory"></param>
 /// <returns></returns>
 public static Image <TColor> CreateTestImage <TColor>(GenericFactory <TColor> factory)
     where TColor : struct, IPixel <TColor>
 {
     return(factory.CreateImage(3, 3));
 }
예제 #4
0
 /// <summary>
 /// Need to us <see cref="GenericFactory{TPixel}"/> to create instance of <see cref="Image"/> when pixelType is StandardImageClass
 /// </summary>
 /// <typeparam name="TPixel"></typeparam>
 /// <param name="factory"></param>
 /// <returns></returns>
 public static Image <TPixel> CreateTestImage <TPixel>(GenericFactory <TPixel> factory)
     where TPixel : struct, IPixel <TPixel>
 {
     return(factory.CreateImage(3, 3));
 }