Пример #1
0
        public void Clone2()
        {
            Image im1 = (Image)t.Bitmap.Clone(new Rectangle(0, 0, t.Bitmap.Width, t.Bitmap.Height), t.Bitmap.PixelFormat);

            t.Graphics.FillRectangle(Brushes.Beige, 0, 0, 100, 100);
            Assert.IsFalse(DrawingTest.CalculateNorm((Bitmap)im1) ==
                           DrawingTest.CalculateNorm(t.Bitmap));
        }
Пример #2
0
 public void Save_string_ImageFormat()
 {
     t.Bitmap.Save("test.png", ImageFormat.Png);
     using (FileStream r = new FileStream("test.png", FileMode.Open)) {
         Bitmap b1 = new Bitmap(r);
         Assert.AreEqual(DrawingTest.CalculateNorm(t.Bitmap),
                         DrawingTest.CalculateNorm(b1));
     }
     File.Delete("test.png");
 }
Пример #3
0
        public void Clone()
        {
            Image im1 = (Image)t.Bitmap.Clone();

            Assert.IsFalse(Object.ReferenceEquals(im1, t.Bitmap));
            Assert.AreEqual(DrawingTest.CalculateNorm((Bitmap)im1),
                            DrawingTest.CalculateNorm(t.Bitmap));
            t.Graphics.FillRectangle(Brushes.Beige, 0, 0, 100, 100);
            Assert.IsFalse(DrawingTest.CalculateNorm((Bitmap)im1) ==
                           DrawingTest.CalculateNorm(t.Bitmap));
        }
Пример #4
0
        public void CloneTest()
        {
            Bitmap b1 = (Bitmap)t.Bitmap.Clone();

            Assert.IsFalse(Object.ReferenceEquals(t.Bitmap, b1));
            Assert.AreEqual(DrawingTest.CalculateNorm(t.Bitmap),
                            DrawingTest.CalculateNorm(b1));
            t.Graphics.FillRectangle(Brushes.Black, 0, 0, 64, 64);
            Assert.IsFalse(DrawingTest.CalculateNorm(t.Bitmap) ==
                           DrawingTest.CalculateNorm(b1));
        }
Пример #5
0
 public void Save_string_ImageCodecInfo_EncoderParameters()
 {
     foreach (ImageCodecInfo i in ImageCodecInfo.GetImageEncoders())
     {
         if (i.FilenameExtension.ToLower().IndexOf("png") != -1)
         {
             t.Bitmap.Save("test.png", i, new EncoderParameters());
             break;
         }
     }
     using (FileStream r = new FileStream("test.png", FileMode.Open)) {
         Bitmap b1 = new Bitmap(r);
         Assert.AreEqual(DrawingTest.CalculateNorm(t.Bitmap),
                         DrawingTest.CalculateNorm(b1));
     }
     File.Delete("test.png");
 }