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


C# MagickImage.SetDefines方法代码示例

本文整理汇总了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"));
      }
    }
开发者ID:levesque,项目名称:Magick.NET,代码行数:30,代码来源:PngReadDefinesTests.cs

示例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"));
      }
    }
开发者ID:levesque,项目名称:Magick.NET,代码行数:26,代码来源:JpegWriteDefinesTests.cs

示例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"));
      }
    }
开发者ID:levesque,项目名称:Magick.NET,代码行数:16,代码来源:PdfReadDefinesTests.cs

示例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"));
      }
    }
开发者ID:levesque,项目名称:Magick.NET,代码行数:18,代码来源:DdsWriteDefinesTests.cs

示例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"));
      }
    }
开发者ID:levesque,项目名称:Magick.NET,代码行数:18,代码来源:TiffWriteDefinesTests.cs

示例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);
        }
      }
    }
开发者ID:levesque,项目名称:Magick.NET,代码行数:19,代码来源:JpegWriteDefinesTests.cs

示例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"));
        }
      }
    }
开发者ID:levesque,项目名称:Magick.NET,代码行数:20,代码来源:TiffWriteDefinesTests.cs

示例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);
        }
      }
    }
开发者ID:levesque,项目名称:Magick.NET,代码行数:22,代码来源:DdsWriteDefinesTests.cs

示例9: ExecuteSetDefines

 private void ExecuteSetDefines(XmlElement element, MagickImage image)
 {
   IDefines defines_ = CreateIDefines(element["defines"]);
   image.SetDefines(defines_);
 }
开发者ID:levesque,项目名称:Magick.NET,代码行数:5,代码来源:MagickImage.cs


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