当前位置: 首页>>代码示例>>C#>>正文


C# MagickImage类代码示例

本文整理汇总了C#中MagickImage的典型用法代码示例。如果您正苦于以下问题:C# MagickImage类的具体用法?C# MagickImage怎么用?C# MagickImage使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


MagickImage类属于命名空间,在下文中一共展示了MagickImage类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ClipPath

 public ClipPath(string name, int width, int height)
 {
     //        ImageInfo info = new ImageInfo();
     //        info.setBackgroundColor(new PixelPacket(255,255,255,0));
     this.name = name;
     this.image = new MagickImage(width, height/*, info*/);
 }
开发者ID:jondot,项目名称:nmagick,代码行数:7,代码来源:ClipPath.cs

示例2: Pattern

 public Pattern(string name, int x, int y, int width, int height)
 {
     this.name = name;
     this.x = x;
     this.y = y;
     this.image = new MagickImage(width, height);
 }
开发者ID:jondot,项目名称:nmagick,代码行数:7,代码来源:Pattern.cs

示例3: Test_Log

		public void Test_Log()
		{
			using (MagickImage image = new MagickImage(Files.SnakewarePNG))
			{
				int count = 0;
				EventHandler<LogEventArgs> logDelegate = delegate(object sender, LogEventArgs arguments)
				{
					Assert.IsNull(sender);
					Assert.IsNotNull(arguments);
					Assert.AreNotEqual(ExceptionTypes.Undefined, arguments.EventType);
					Assert.IsNotNull(arguments.Message);
					Assert.AreNotEqual(0, arguments.Message.Length);

					count++;
				};

				GraphicsMagickNET.Log += logDelegate;

				image.Flip();
				Assert.AreEqual(0, count);

				GraphicsMagickNET.SetLogEvents(ExceptionTypes.All);

				image.Flip();
				Assert.AreNotEqual(0, count);

				GraphicsMagickNET.Log -= logDelegate;
				count = 0;

				image.Flip();
				Assert.AreEqual(0, count);
			}
		}
开发者ID:dlemstra,项目名称:GraphicsMagick.NET,代码行数:33,代码来源:GraphicsMagickNETTests.cs

示例4: Test_ToBitmap

		//===========================================================================================
		private static void Test_ToBitmap(MagickImage image, ImageFormat format)
		{
			using (Bitmap bmp = image.ToBitmap(format))
			{
				Assert.AreEqual(format, bmp.RawFormat);
			}
		}
开发者ID:dlemstra,项目名称:GraphicsMagick.NET,代码行数:8,代码来源:MagickImageTests.cs

示例5: Test_Pixel

		//===========================================================================================
		private static void Test_Pixel(MagickImage image, int x, int y, MagickColor color)
		{
			using (PixelCollection collection = image.GetReadOnlyPixels())
			{
				ColorAssert.AreEqual(color, collection.GetPixel(x, y));
			}
		}
开发者ID:dlemstra,项目名称:GraphicsMagick.NET,代码行数:8,代码来源:MagickImageTests.cs

示例6: Test_FromIXPathNavigable

		public void Test_FromIXPathNavigable()
		{
			using (MagickImage image = new MagickImage(Files.InvitationTif))
			{
				XmpProfile profile = image.GetXmpProfile();
				Assert.IsNotNull(profile);

				IXPathNavigable doc = profile.ToIXPathNavigable();

				ExceptionAssert.Throws<ArgumentNullException>(delegate()
				{
					XmpProfile.FromIXPathNavigable(null);
				});

				XmpProfile newProfile = XmpProfile.FromIXPathNavigable(doc);
				image.AddProfile(newProfile);

				doc = profile.ToIXPathNavigable();
				TestIXPathNavigable(doc);

				profile = image.GetXmpProfile();
				Assert.IsNotNull(profile);

				doc = profile.ToIXPathNavigable();
				TestIXPathNavigable(doc);

				Assert.AreEqual(profile, newProfile);
			}
		}
开发者ID:dlemstra,项目名称:GraphicsMagick.NET,代码行数:29,代码来源:XmpProfileTests.cs

示例7: Test_Constructor

		public void Test_Constructor()
		{
			using (MemoryStream memStream = new MemoryStream())
			{
				using (MagickImage image = new MagickImage(Files.ImageMagickJPG))
				{
					ExifProfile profile = image.GetExifProfile();
					Assert.IsNull(profile);

					profile = new ExifProfile();
					profile.SetValue(ExifTag.Copyright, "Dirk Lemstra");

					image.AddProfile(profile);

					profile = image.GetExifProfile();
					Assert.IsNotNull(profile);

					image.Write(memStream);
				}

				memStream.Position = 0;
				using (MagickImage image = new MagickImage(memStream))
				{
					ExifProfile profile = image.GetExifProfile();

					Assert.IsNotNull(profile);
					Assert.AreEqual(1, profile.Values.Count());

					ExifValue value = profile.Values.FirstOrDefault(val => val.Tag == ExifTag.Copyright);
					TestValue(value, "Dirk Lemstra");
				}
			}
		}
开发者ID:dlemstra,项目名称:GraphicsMagick.NET,代码行数:33,代码来源:ExifProfileTests.cs

示例8: CheckTransparency

    private static void CheckTransparency(MagickImage image)
    {
      if (!image.HasAlpha)
        return;

      if (image.IsOpaque)
        image.HasAlpha = false;
    }
开发者ID:dlemstra,项目名称:Magick.NET,代码行数:8,代码来源:PngOptimizer.cs

示例9: GetIptcValue

		//===========================================================================================
		private static IptcValue GetIptcValue()
		{
			using (MagickImage image = new MagickImage(Files.FujiFilmFinePixS1ProJPG))
			{
				IptcProfile profile = image.GetIptcProfile();
				return profile.Values.ElementAt(1);
			}
		}
开发者ID:dlemstra,项目名称:GraphicsMagick.NET,代码行数:9,代码来源:IptcValueTests.cs

示例10: Test_IEnumerable

		public void Test_IEnumerable()
		{
			using (MagickImage image = new MagickImage(Color.Red, 5, 10))
			{
				PixelCollection pixels = image.GetReadOnlyPixels();
				Assert.AreEqual(50, pixels.Count());
			}
		}
开发者ID:dlemstra,项目名称:GraphicsMagick.NET,代码行数:8,代码来源:PixelCollectionTests.cs

示例11: Get8BimValue

		//===========================================================================================
		private static EightBimValue Get8BimValue()
		{
			using (MagickImage image = new MagickImage(Files.FujiFilmFinePixS1ProJPG))
			{
				EightBimProfile profile = image.Get8BimProfile();
				return profile.Values.First();
			}
		}
开发者ID:dlemstra,项目名称:GraphicsMagick.NET,代码行数:9,代码来源:EightBimValueTests.cs

示例12: Test_Set

		public void Test_Set()
		{
			using (MagickImage image = new MagickImage(Color.Red, 5, 10))
			{
				using (WritablePixelCollection pixels = image.GetWritablePixels())
				{
					ExceptionAssert.Throws<ArgumentNullException>(delegate()
					{
						pixels.Set((QuantumType[])null);
					});

					ExceptionAssert.Throws<ArgumentNullException>(delegate()
					{
						pixels.Set((Pixel)null);
					});

					ExceptionAssert.Throws<ArgumentNullException>(delegate()
					{
						pixels.Set((Pixel[])null);
					});

					Test_Set(pixels, new QuantumType[] { });
					Test_Set(pixels, new QuantumType[] { 0 });
					Test_Set(pixels, new QuantumType[] { 0, 0 });
					Test_Set(pixels, new QuantumType[] { 0, 0, 0 });

					pixels.Set(new QuantumType[] { 0, 0, 0, 0, 0 });
					Test_PixelColor(pixels, Color.Black);
					pixels.Write();
				}

				using (PixelCollection pixels = image.GetReadOnlyPixels())
				{
					Test_PixelColor(pixels, Color.Black);
				}

				using (WritablePixelCollection pixels = image.GetWritablePixels())
				{
					pixels.Set(new uint[] { 4294967295, 0, 0, 0, 0 });
					Test_PixelColor(pixels, Color.Red);
					pixels.Set(new ushort[] { 0, 0, 65535, 0, 0 });
					Test_PixelColor(pixels, Color.Blue);
					pixels.Set(new byte[] { 0, 255, 0, 0, 0 });
					Test_PixelColor(pixels, Color.Lime);
				}

				using (WritablePixelCollection pixels = image.GetWritablePixels())
				{
					for (int x = 0; x < pixels.Width; x++)
					{
						for (int y = 0; y < pixels.Height; y++)
						{
							pixels.Set(x, y, new QuantumType[] { 0, 0, 0, 0, 0 });
						}
					}
				}
			}
		}
开发者ID:dlemstra,项目名称:GraphicsMagick.NET,代码行数:58,代码来源:WritablePixelCollectionTests.cs

示例13: DrawableComposite

 /// <summary>
 /// Initializes a new instance of the <see cref="DrawableComposite"/> class.
 /// </summary>
 /// <param name="x">The X coordinate.</param>
 /// <param name="y">The Y coordinate.</param>
 /// <param name="image">The image to draw.</param>
 public DrawableComposite(double x, double y, MagickImage image)
   : this(image)
 {
   X = x;
   Y = y;
   Width = _Image.Width;
   Height = _Image.Height;
   Compose = CompositeOperator.CopyAlpha;
 }
开发者ID:dlemstra,项目名称:Magick.NET,代码行数:15,代码来源:DrawableComposite.cs

示例14: Test_Clone

		//===========================================================================================
		private static void Test_Clone(MagickImage first, MagickImage second)
		{
			Assert.AreEqual(first, second);
			second.Format = MagickFormat.Jp2;
			Assert.AreEqual(first.Format, MagickFormat.Png);
			Assert.AreEqual(second.Format, MagickFormat.Jp2);
			second.Dispose();
			Assert.AreEqual(first.Format, MagickFormat.Png);
		}
开发者ID:dlemstra,项目名称:GraphicsMagick.NET,代码行数:10,代码来源:MagickImageTests.cs

示例15: GetExifValue

		//===========================================================================================
		private static ExifValue GetExifValue()
		{
			using (MagickImage image = new MagickImage(Files.FujiFilmFinePixS1ProJPG))
			{
				ExifProfile profile = image.GetExifProfile();
				Assert.IsNotNull(profile);

				return profile.Values.First();
			}
		}
开发者ID:dlemstra,项目名称:GraphicsMagick.NET,代码行数:11,代码来源:ExifValueTests.cs


注:本文中的MagickImage类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。