Ejemplo n.º 1
0
        public void Test_SetResult()
        {
            using (MagickImage image = new MagickImage(MagickColors.Red, 10, 2))
            {
                using (PixelCollection pixels = image.GetPixels())
                {
                    QuantumType[] newPixels = new QuantumType[20 * pixels.Channels];
                    for (int i = 0; i < newPixels.Length; i++)
                    {
                        newPixels[i] = Quantum.Max;
                    }

                    pixels.Set(newPixels);
                }

                TestPixels(image, new MagickColor(Quantum.Max, Quantum.Max, Quantum.Max));
            }

            using (MagickImage image = new MagickImage(MagickColors.Black, 10, 2))
            {
                using (PixelCollection pixels = image.GetPixels())
                {
                    Assert.AreEqual(20, pixels.Count());

                    foreach (Pixel pixel in pixels.Take(10))
                    {
                        pixel.SetChannel(2, Quantum.Max);
                    }

                    foreach (Pixel pixel in pixels.Skip(10))
                    {
                        pixel.SetChannel(0, Quantum.Max);
                    }
                }

                TestPixels(image, MagickColors.Blue, MagickColors.Red);
            }
        }