WmfOptions

WmfOptions class

wmf 选项。

public class WmfOptions : MetafileOptions

构造函数

姓名描述
WmfOptions()默认构造函数。

特性

姓名描述
BufferSizeHint { get; set; }获取或设置缓冲区大小提示,该提示定义了所有内部缓冲区的最大允许大小。
Compress { get; set; }获取或设置一个值,该值指示是否ICompressedOptions被压缩。
Disposed { get; }获取一个值,该值指示此实例是否被释放。
FullFrame { get; set; }获取或设置一个值,指示是否[全帧].
MultiPageOptions { get; set; }多页选项
virtual Palette { get; set; }获取或设置调色板。
ProgressEventHandler { get; set; }获取或设置进度事件处理程序。
virtual ResolutionSettings { get; set; }获取或设置分辨率设置。
Source { get; set; }获取或设置要在其中创建图像的源。
VectorRasterizationOptions { get; set; }获取或设置矢量光栅化选项。
virtual XmpData { get; set; }获取或设置 XMP 元数据容器。

方法

姓名描述
virtual Clone()克隆此实例。
Dispose()处理当前实例。

例子

以下示例显示如何将 wmz 图像转换为 wmf fromat

[C#]

string file = "example.wmz";
string baseFolder = System.IO.Path.Combine("D:", "Compressed");
string inputFile = System.IO.Path.Combine(baseFolder, file);
string outFile = inputFile + ".wmf";
using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(inputFile))
{
    Aspose.Imaging.ImageOptions.VectorRasterizationOptions vectorRasterizationOptions = new Aspose.Imaging.ImageOptions.WmfRasterizationOptions() { PageSize = image.Size};
    image.Save(outFile, new Aspose.Imaging.ImageOptions.WmfOptions() {VectorRasterizationOptions = vectorRasterizationOptions});
}

以下示例显示如何将 wmf 图像转换为 wmz fromat

[C#]

string file = "castle.wmf";
string baseFolder = System.IO.Path.Combine("D:", "Compressed");
string inputFile = System.IO.Path.Combine(baseFolder, file);
string outFile = inputFile + ".wmz";
using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(inputFile))
{
    Aspose.Imaging.ImageOptions.VectorRasterizationOptions vectorRasterizationOptions = new Aspose.Imaging.ImageOptions.WmfRasterizationOptions() { PageSize = image.Size};
    image.Save(outFile, new Aspose.Imaging.ImageOptions.WmfOptions() {VectorRasterizationOptions = vectorRasterizationOptions, Compress = true});
}

以下示例显示了如何在不引用特定图像类型的情况下以一般方式将多页矢量图像转换为 WMF 格式。

[C#]

string dir = "C:\\aspose.imaging\\net\\misc\\ImagingReleaseQATester\\Tests\\testdata\\2548";
string inputFilePath = System.IO.Path.Combine(dir, "Multipage.cdr");
string outputFilePath = System.IO.Path.Combine(dir, "Multipage.cdr.wmf");

Aspose.Imaging.ImageOptionsBase exportOptions = new Aspose.Imaging.ImageOptions.WmfOptions();

using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(inputFilePath))
{
    exportOptions.MultiPageOptions = null;

    // 只导出前两页。实际上,只会转换一页,因为 WMF 不是多页格式。
    Aspose.Imaging.IMultipageImage multipageImage = image as Aspose.Imaging.IMultipageImage;
    if (multipageImage != null && (multipageImage.Pages != null && multipageImage.PageCount > 2))
    {
        exportOptions.MultiPageOptions = new Aspose.Imaging.ImageOptions.MultiPageOptions(new Aspose.Imaging.IntRange(0, 2));
    }

    if (image is Aspose.Imaging.VectorImage)
    {
        exportOptions.VectorRasterizationOptions = (Aspose.Imaging.ImageOptions.VectorRasterizationOptions)image.GetDefaultOptions(new object[] { Aspose.Imaging.Color.White, image.Width, image.Height });
        exportOptions.VectorRasterizationOptions.TextRenderingHint = Aspose.Imaging.TextRenderingHint.SingleBitPerPixel;
        exportOptions.VectorRasterizationOptions.SmoothingMode = Aspose.Imaging.SmoothingMode.None;
    }

    image.Save(outputFilePath, exportOptions);
}

也可以看看