Example #1
0
 public void Test_Dimensions()
 {
     using (MagickImage image = new MagickImage(Color.Red, 5, 10))
     {
         using (PixelCollection pixels = image.GetReadOnlyPixels())
         {
             Assert.AreEqual(5, pixels.Width);
             Assert.AreEqual(10, pixels.Height);
             Assert.AreEqual(5 * 10 * pixels.Channels, pixels.GetValues().Length);
         }
     }
 }
        public void Test_GetValues()
        {
            using (MagickImage image = new MagickImage(Color.PowderBlue, 1, 1))
            {
                using (PixelCollection pixels = image.GetReadOnlyPixels())
                {
                    var values = pixels.GetValues();
                    Assert.AreEqual(3, values.Length);

                    MagickColor color = new MagickColor(values[0], values[1], values[2]);
                    ColorAssert.AreEqual(Color.PowderBlue, color);
                }
            }
        }
        public void Test_GetValues()
        {
            using (IMagickImage image = new MagickImage(MagickColors.PowderBlue, 1, 1))
            {
                Assert.AreEqual(3, image.ChannelCount);

                using (PixelCollection pixels = image.GetPixels())
                {
                    var values = pixels.GetValues();
                    Assert.AreEqual(3, values.Length);

                    MagickColor color = new MagickColor(values[0], values[1], values[2]);
                    ColorAssert.AreEqual(MagickColors.PowderBlue, color);
                }
            }
        }