Class for defines that are used when a dds image is written.
Inheritance: DefineCreator, IWriteDefines
Beispiel #1
0
        private IDefines CreateDdsWriteDefines(XmlElement element)
        {
            if (element == null)
            {
                return(null);
            }
            DdsWriteDefines result = new DdsWriteDefines();

            result.ClusterFit    = Variables.GetValue <Nullable <Boolean> >(element, "clusterFit");
            result.Compression   = Variables.GetValue <Nullable <ImageMagick.Defines.DdsCompression> >(element, "compression");
            result.Mipmaps       = Variables.GetValue <Nullable <Int32> >(element, "mipmaps");
            result.WeightByAlpha = Variables.GetValue <Nullable <Boolean> >(element, "weightByAlpha");
            return(result);
        }
Beispiel #2
0
        private IDefines CreateDdsWriteDefines(XmlElement element)
        {
            if (element == null)
            {
                return(null);
            }
            DdsWriteDefines result = new DdsWriteDefines();

            result.ClusterFit            = GetValue <Nullable <Boolean> >(element, "clusterFit");
            result.Compression           = GetValue <Nullable <DdsCompression> >(element, "compression");
            result.FastMipmaps           = GetValue <Nullable <Boolean> >(element, "fastMipmaps");
            result.Mipmaps               = GetValue <Nullable <Int32> >(element, "mipmaps");
            result.MipmapsFromCollection = GetValue <Nullable <Boolean> >(element, "mipmapsFromCollection");
            result.Raw           = GetValue <Nullable <Boolean> >(element, "raw");
            result.WeightByAlpha = GetValue <Nullable <Boolean> >(element, "weightByAlpha");
            return(result);
        }
    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"));
      }
    }
    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);
        }
      }
    }
Beispiel #5
0
 private IDefines CreateDdsWriteDefines(XmlElement element)
 {
   if (element == null)
     return null;
   DdsWriteDefines result = new DdsWriteDefines();
   result.ClusterFit = Variables.GetValue<Nullable<Boolean>>(element, "clusterFit");
   result.Compression = Variables.GetValue<Nullable<ImageMagick.Defines.DdsCompression>>(element, "compression");
   result.Mipmaps = Variables.GetValue<Nullable<Int32>>(element, "mipmaps");
   result.WeightByAlpha = Variables.GetValue<Nullable<Boolean>>(element, "weightByAlpha");
   return result;
 }