本文整理汇总了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*/);
}
示例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);
}
示例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);
}
}
示例4: Test_ToBitmap
//===========================================================================================
private static void Test_ToBitmap(MagickImage image, ImageFormat format)
{
using (Bitmap bmp = image.ToBitmap(format))
{
Assert.AreEqual(format, bmp.RawFormat);
}
}
示例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));
}
}
示例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);
}
}
示例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");
}
}
}
示例8: CheckTransparency
private static void CheckTransparency(MagickImage image)
{
if (!image.HasAlpha)
return;
if (image.IsOpaque)
image.HasAlpha = false;
}
示例9: GetIptcValue
//===========================================================================================
private static IptcValue GetIptcValue()
{
using (MagickImage image = new MagickImage(Files.FujiFilmFinePixS1ProJPG))
{
IptcProfile profile = image.GetIptcProfile();
return profile.Values.ElementAt(1);
}
}
示例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());
}
}
示例11: Get8BimValue
//===========================================================================================
private static EightBimValue Get8BimValue()
{
using (MagickImage image = new MagickImage(Files.FujiFilmFinePixS1ProJPG))
{
EightBimProfile profile = image.Get8BimProfile();
return profile.Values.First();
}
}
示例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 });
}
}
}
}
}
示例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;
}
示例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);
}
示例15: GetExifValue
//===========================================================================================
private static ExifValue GetExifValue()
{
using (MagickImage image = new MagickImage(Files.FujiFilmFinePixS1ProJPG))
{
ExifProfile profile = image.GetExifProfile();
Assert.IsNotNull(profile);
return profile.Values.First();
}
}