本文整理汇总了C#中ImageMagick.MagickImage.Flip方法的典型用法代码示例。如果您正苦于以下问题:C# MagickImage.Flip方法的具体用法?C# MagickImage.Flip怎么用?C# MagickImage.Flip使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ImageMagick.MagickImage
的用法示例。
在下文中一共展示了MagickImage.Flip方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Execute
public string Execute(FileItem item, string infile, string dest, ValuePairEnumerator configData)
{
var conf = new RotateTransformViewModel(configData);
// Read from file
using (MagickImage image = new MagickImage(infile))
{
image.BackgroundColor = new MagickColor(Color.Black);
if (conf.AutoRotate)
{
ExifProfile profile = image.GetExifProfile();
image.AutoOrient();
profile.SetValue(ExifTag.Orientation, (UInt16)0);
}
if (conf.Angle > 0)
image.Rotate(conf.Angle);
if(conf.FlipHorizontal)
image.Flop();
if (conf.FlipVertical)
image.Flip();
image.Format = MagickFormat.Jpeg;
// Save the result
image.Write(dest);
}
return dest;
}
示例2: ExecuteFlip
private static void ExecuteFlip(MagickImage image)
{
image.Flip();
}
示例3: Test_Dispose
public void Test_Dispose()
{
MagickImage image = new MagickImage(MagickColors.Red, 10, 10);
MagickImageCollection collection = new MagickImageCollection();
collection.Add(image);
collection.Dispose();
Assert.AreEqual(0, collection.Count);
ExceptionAssert.Throws<ObjectDisposedException>(delegate ()
{
image.Flip();
});
}
示例4: 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(LogEvents.None, arguments.EventType);
Assert.IsNotNull(arguments.Message);
Assert.AreNotEqual(0, arguments.Message.Length);
count++;
};
MagickNET.Log += logDelegate;
image.Flip();
Assert.AreEqual(0, count);
MagickNET.SetLogEvents(LogEvents.All);
image.Flip();
Assert.AreNotEqual(0, count);
MagickNET.Log -= logDelegate;
count = 0;
image.Flip();
Assert.AreEqual(0, count);
}
}
示例5: Draw
public MagickImage Draw()
{
MainForm.ProgressStart("Rendering background ...");
// Check which terrain file is used
string texMpk = string.Format("{0}\\tex{1}.mpk", this.textureZoneDataDirectory, this.textureZoneId);
string lodMpk = string.Format("{0}\\lod{1}.mpk", this.textureZoneDataDirectory, this.textureZoneId);
// Get the tile dimension
double tileWidth = 512.0;
string tileTemplate = "";
MPAK mpak = new MPAK();
if (File.Exists(texMpk))
{
mpak.Load(texMpk);
if (mpak.Files.Where(f => f.Name.ToLower() == "tex00-00.dds").Count() > 0)
{
tileTemplate += "tex0{0}-0{1}.dds";
tileWidth = 512.0;
}
}
if (string.IsNullOrEmpty(tileTemplate))
{
mpak.Load(lodMpk);
if (mpak.Files.Where(f => f.Name.ToLower() == "lod00-00.dds").Count() > 0)
{
tileTemplate += "lod0{0}-0{1}.dds";
tileWidth = 256.0;
}
}
if (string.IsNullOrEmpty(tileTemplate))
{
MainForm.Log(string.Format("Zone {0}: No background textures found!", zoneConfiguration.ZoneId), MainForm.LogLevel.error);
return null;
}
// original size
double orginalWidth = tileWidth * 8;
double resizeFactor = (double)zoneConfiguration.TargetMapSize / (double)orginalWidth; // 0 - 1
MagickImage map = new MagickImage(Color.Transparent, zoneConfiguration.TargetMapSize, zoneConfiguration.TargetMapSize);
int lastWidth = 0;
int x = 0;
for (int col = 0; col <= 7; col++)
{
int y = 0;
for (int row = 0; row <= 7; row++)
{
string filename = string.Format(tileTemplate, col, row);
using (MagickImage mapTile = new MagickImage(mpak.GetFile(filename).Data))
{
int newSize = Convert.ToInt32(mapTile.Width * resizeFactor);
mapTile.Resize(newSize, newSize);
map.Composite(mapTile, x, y, CompositeOperator.SrcOver);
// Calculate new y
y += mapTile.Height;
lastWidth = mapTile.Height;
}
}
x += lastWidth;
int percent = 100 * col / 8;
MainForm.ProgressUpdate(percent);
}
MainForm.ProgressStartMarquee("Merging ...");
// Remove rounding fails
map.Trim();
// Flip if set
if (this.flipX) map.Flop();
if (this.flipY) map.Flip();
// Sharpen (tested a lot, seems to be the best values)
map.Sharpen(4, 3);
MainForm.ProgressReset();
return map;
}
示例6: Test_Progress
public void Test_Progress()
{
Percentage progress = new Percentage(0);
bool cancel = false;
EventHandler<ProgressEventArgs> progressEvent = delegate (object sender, ProgressEventArgs arguments)
{
Assert.IsNotNull(sender);
Assert.IsNotNull(arguments);
Assert.IsNotNull(arguments.Origin);
Assert.AreEqual(false, arguments.Cancel);
progress = arguments.Progress;
if (cancel)
arguments.Cancel = true;
};
using (MagickImage image = new MagickImage(Files.Builtin.Logo))
{
image.Progress += progressEvent;
image.Flip();
Assert.AreEqual(100, (int)progress);
}
cancel = true;
using (MagickImage image = new MagickImage(Files.Builtin.Logo))
{
image.Progress += progressEvent;
image.Flip();
Assert.IsTrue(progress <= (Percentage)1);
}
}