예제 #1
0
 public void Test_IEnumerable()
 {
     using (MagickImage image = new MagickImage(Color.Red, 5, 10))
     {
         PixelCollection pixels = image.GetReadOnlyPixels();
         Assert.AreEqual(50, pixels.Count());
     }
 }
예제 #2
0
 public void Test_IEnumerable()
 {
     using (MagickImage image = new MagickImage(MagickColors.Red, 5, 10))
     {
         using (PixelCollection pixels = image.GetPixels())
         {
             Assert.AreEqual(50, pixels.Count());
         }
     }
 }
예제 #3
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);
            }
        }