Class for defines that are used when a tiff image is written.
Inheritance: DefineCreator, IWriteDefines
示例#1
0
        private IDefines CreateTiffWriteDefines(XmlElement element)
        {
            if (element == null)
            {
                return(null);
            }
            TiffWriteDefines result = new TiffWriteDefines();

            result.Alpha        = Variables.GetValue <Nullable <ImageMagick.Defines.TiffAlpha> >(element, "alpha");
            result.Endian       = Variables.GetValue <Nullable <Endian> >(element, "endian");
            result.FillOrder    = Variables.GetValue <Nullable <Endian> >(element, "fillOrder");
            result.RowsPerStrip = Variables.GetValue <Nullable <Int32> >(element, "rowsPerStrip");
            result.TileGeometry = Variables.GetValue <MagickGeometry>(element, "tileGeometry");
            return(result);
        }
    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.Settings.SetDefines(defines);

        Assert.AreEqual("LSB", image.Settings.GetDefine(MagickFormat.Tiff, "fill-order"));
        Assert.AreEqual("42", image.Settings.GetDefine(MagickFormat.Tiff, "rows-per-strip"));
        Assert.AreEqual("100x100", image.Settings.GetDefine(MagickFormat.Tiff, "tile-geometry"));
      }
    }
    public void Test_Alpha_Endian()
    {
      TiffWriteDefines defines = new TiffWriteDefines()
      {
        Alpha = TiffAlpha.Associated,
        Endian = Endian.MSB,
      };

      using (MagickImage input = new MagickImage(Files.Builtin.Logo))
      {
        input.Settings.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"));
        }
      }
    }
示例#4
0
 private IDefines CreateTiffWriteDefines(XmlElement element)
 {
   if (element == null)
     return null;
   TiffWriteDefines result = new TiffWriteDefines();
   result.Alpha = Variables.GetValue<Nullable<ImageMagick.Defines.TiffAlpha>>(element, "alpha");
   result.Endian = Variables.GetValue<Nullable<Endian>>(element, "endian");
   result.FillOrder = Variables.GetValue<Nullable<Endian>>(element, "fillOrder");
   result.RowsPerStrip = Variables.GetValue<Nullable<Int32>>(element, "rowsPerStrip");
   result.TileGeometry = Variables.GetValue<MagickGeometry>(element, "tileGeometry");
   return result;
 }