本文整理汇总了C#中ImageMagick.MagickImage.SetDefines方法的典型用法代码示例。如果您正苦于以下问题:C# MagickImage.SetDefines方法的具体用法?C# MagickImage.SetDefines怎么用?C# MagickImage.SetDefines使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ImageMagick.MagickImage
的用法示例。
在下文中一共展示了MagickImage.SetDefines方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Test_PreserveiCCP_SwapBytes
public void Test_PreserveiCCP_SwapBytes()
{
PngReadDefines defines = new PngReadDefines()
{
PreserveiCCP = true,
SwapBytes = false
};
using (MagickImage image = new MagickImage())
{
image.SetDefines(defines);
Assert.AreEqual("True", image.GetDefine(MagickFormat.Png, "preserve-iCCP"));
Assert.AreEqual(null, image.GetDefine(MagickFormat.Png, "swap-bytes"));
}
defines = new PngReadDefines()
{
PreserveiCCP = false,
SwapBytes = true
};
using (MagickImage image = new MagickImage())
{
image.SetDefines(defines);
Assert.AreEqual(null, image.GetDefine(MagickFormat.Png, "preserve-iCCP"));
Assert.AreEqual("True", image.GetDefine(MagickFormat.Png, "swap-bytes"));
}
}
示例2: Test_DctMethod_OptimizeCoding_Quality_QuantizationTables_SamplingFactors
public void Test_DctMethod_OptimizeCoding_Quality_QuantizationTables_SamplingFactors()
{
JpegWriteDefines defines = new JpegWriteDefines()
{
DctMethod = DctMethod.Fast,
OptimizeCoding = false,
Quality = new MagickGeometry(80, 80),
QuantizationTables = @"C:\path\to\file.xml",
SamplingFactors = new MagickGeometry[]
{
new MagickGeometry(5, 10),
new MagickGeometry(15, 20)
}
};
using (MagickImage image = new MagickImage(Files.Builtin.Logo))
{
image.SetDefines(defines);
Assert.AreEqual("Fast", image.GetDefine(MagickFormat.Jpeg, "dct-method"));
Assert.AreEqual("False", image.GetDefine(MagickFormat.Jpeg, "optimize-coding"));
Assert.AreEqual("80x80", image.GetDefine(MagickFormat.Jpeg, "quality"));
Assert.AreEqual(@"C:\path\to\file.xml", image.GetDefine(MagickFormat.Jpeg, "q-table"));
Assert.AreEqual("5x10,15x20", image.GetDefine(MagickFormat.Jpeg, "sampling-factor"));
}
}
示例3: Test_UseCropBox_UseTrimBox
public void Test_UseCropBox_UseTrimBox()
{
PdfReadDefines defines = new PdfReadDefines()
{
UseCropBox = true,
UseTrimBox = false
};
using (MagickImage image = new MagickImage())
{
image.SetDefines(defines);
Assert.AreEqual("True", image.GetDefine(MagickFormat.Pdf, "use-cropbox"));
Assert.AreEqual("False", image.GetDefine(MagickFormat.Pdf, "use-trimbox"));
}
}
示例4: Test_ClusterFit_Mipmaps_WeightByAlpha
public void Test_ClusterFit_Mipmaps_WeightByAlpha()
{
DdsWriteDefines defines = new DdsWriteDefines()
{
ClusterFit = true,
Mipmaps = 0,
WeightByAlpha = false,
};
using (MagickImage image = new MagickImage(Files.Builtin.Logo))
{
image.SetDefines(defines);
Assert.AreEqual("True", image.GetDefine(MagickFormat.Dds, "cluster-fit"));
Assert.AreEqual("0", image.GetDefine(MagickFormat.Dds, "mipmaps"));
Assert.AreEqual("False", image.GetDefine(MagickFormat.Dds, "weight-by-alpha"));
}
}
示例5: Test_FillOrder_RowsPerStrip
public void Test_FillOrder_RowsPerStrip()
{
TiffWriteDefines defines = new TiffWriteDefines()
{
FillOrder = Endian.LSB,
RowsPerStrip = 42,
TileGeometry = new MagickGeometry(100, 100)
};
using (MagickImage image = new MagickImage(Files.Builtin.Logo))
{
image.SetDefines(defines);
Assert.AreEqual("LSB", image.GetDefine(MagickFormat.Tiff, "fill-order"));
Assert.AreEqual("42", image.GetDefine(MagickFormat.Tiff, "rows-per-strip"));
Assert.AreEqual("100x100", image.GetDefine(MagickFormat.Tiff, "tile-geometry"));
}
}
示例6: Test_Extent
public void Test_Extent()
{
JpegWriteDefines defines = new JpegWriteDefines()
{
Extent = 10
};
using (MagickImage image = new MagickImage(Files.Builtin.Logo))
{
using (MemoryStream memStream = new MemoryStream())
{
image.SetDefines(defines);
image.Format = MagickFormat.Jpeg;
image.Write(memStream);
Assert.IsTrue(memStream.Length < 10000);
}
}
}
示例7: Test_Alpha_Endian
public void Test_Alpha_Endian()
{
TiffWriteDefines defines = new TiffWriteDefines()
{
Alpha = TiffAlpha.Associated,
Endian = Endian.MSB,
};
using (MagickImage input = new MagickImage(Files.Builtin.Logo))
{
input.SetDefines(defines);
input.Alpha(AlphaOption.Set);
using (MagickImage output = WriteTiff(input))
{
Assert.AreEqual("associated", output.GetAttribute("tiff:alpha"));
Assert.AreEqual("msb", output.GetAttribute("tiff:endian"));
}
}
}
示例8: Test_Compression
public void Test_Compression()
{
DdsWriteDefines defines = new DdsWriteDefines()
{
Compression = DdsCompression.None
};
using (MagickImage input = new MagickImage(Files.Builtin.Logo))
{
using (MagickImage output = WriteDds(input))
{
Assert.AreEqual(CompressionMethod.DXT1, output.CompressionMethod);
}
input.SetDefines(defines);
using (MagickImage output = WriteDds(input))
{
Assert.AreEqual(CompressionMethod.NoCompression, output.CompressionMethod);
}
}
}
示例9: ExecuteSetDefines
private void ExecuteSetDefines(XmlElement element, MagickImage image)
{
IDefines defines_ = CreateIDefines(element["defines"]);
image.SetDefines(defines_);
}