Exemplo n.º 1
0
 public void TestColorMap()
 {
     var tmpFile = GdiImageLayerTest.CreateImage(new Size(300, 300), new Point(10, 10));
     using (var l = new GdiImageLayer(tmpFile))
     using (var pl = new GdiImageLayerProxy<GdiImageLayer>(l, new ColorMap{OldColor = Color.Red, NewColor = Color.MistyRose}))
     using (var m = new Map(new Size(450, 450)))
     {
         m.Layers.Add(pl);
         m.ZoomToExtents();
         using (var img = (Bitmap)m.GetMap())
         {
             var color = img.GetPixel(225, 225);
             Assert.AreEqual(Color.MistyRose.ToArgb(), color.ToArgb());
         }
     }
     GdiImageLayerTest.DeleteTmpFiles(tmpFile);
 }
Exemplo n.º 2
0
 public void TestColorMatrix()
 {
     var tmpFile = GdiImageLayerTest.CreateImage(new Size(300, 300), new Point(10, 10));
     using (var l = new GdiImageLayer(tmpFile))
     using (var pl = new GdiImageLayerProxy<GdiImageLayer>(l, 0.3f))
     using (var m = new Map(new Size(450, 450)))
     {
         m.Layers.Add(pl);
         m.ZoomToExtents();
         using (var img = (Bitmap)m.GetMap())
         {
             var color = img.GetPixel(225, 225);
             Assert.AreEqual((byte)Math.Round(0.3f * 255, MidpointRounding.AwayFromZero), color.A);
         }
     }
     GdiImageLayerTest.DeleteTmpFiles(tmpFile);
 }