Class VectorRasterizationOptions

Class VectorRasterizationOptions

Namespace: Aspose.Imaging.ImageOptions
Assembly: Aspose.Imaging.dll (25.7.0)

The vector rasterization options.Please note that Aspose.Imaging.ImageOptions.VectorRasterizationOptions will no longer derive from Aspose.Imaging.ImageOptionsBasesince Aspose.Imaging 24.12 version.

[JsonObject(MemberSerialization.OptIn)]
   public class VectorRasterizationOptions : ICloneable
   {
   }

Inheritance

object VectorRasterizationOptions

Derived

CdrRasterizationOptions , CmxRasterizationOptions , EpsRasterizationOptions , MetafileRasterizationOptions , OdRasterizationOptions , SvgRasterizationOptions

Implements

ICloneable

Inherited Members

object.GetType() , object.MemberwiseClone() , object.ToString() , object.Equals(object?) , object.Equals(object?, object?) , object.ReferenceEquals(object?, object?) , object.GetHashCode()

Constructors

VectorRasterizationOptions()

public VectorRasterizationOptions()
   {
      RasterizePolygons = true;
      PolygonFillMode = PolygonFillMode.SolidColor;
      PolygonOutlineColor = Colors.Black;
      PolygonLineWidth = 1f;
      PolygonOpacity = 1f;
      TextRasterizerOptions = new TextRasterizerOptions();
   }

Properties

BackgroundColor

Gets or sets a background color.

public class MyClass
    {
        [JsonProperty]
        public Color BackgroundColor { get; set; }
    }

Property Value

Color

Examples

This example shows how to load a WMF image from a file and convert it to SVG using WmfRasterizationOptions.

string dir = "c:\\temp\\";
   using (Aspose.Imaging.FileFormats.Wmf.WmfImage wmfImage = (Aspose.Imaging.FileFormats.Wmf.WmfImage)Aspose.Imaging.Image.Load(dir + "test.wmf"))
   {
       Aspose.Imaging.ImageOptions.SvgOptions saveOptions = new Aspose.Imaging.ImageOptions.SvgOptions();
       saveOptions.TextAsShapes = true;
       Aspose.Imaging.ImageOptions.WmfRasterizationOptions rasterizationOptions = new Aspose.Imaging.ImageOptions.WmfRasterizationOptions();
       rasterizationOptions.BackgroundColor = Aspose.Imaging.Color.WhiteSmoke;
       rasterizationOptions.PageSize = wmfImage.Size;
       rasterizationOptions.RenderMode = Aspose.Imaging.FileFormats.Wmf.WmfRenderMode.Auto;
       saveOptions.VectorRasterizationOptions = rasterizationOptions;
       wmfImage.Save(dir + "test.output.svg", saveOptions);
   }

This example shows how to load a EMF image from a file and convert it to SVG using EmfRasterizationOptions.

string dir = "c:\\temp\\";
   using (Aspose.Imaging.FileFormats.Emf.EmfImage emfImage = (Aspose.Imaging.FileFormats.Emf.EmfImage)Aspose.Imaging.Image.Load(dir + "test.emf"))
   {
       Aspose.Imaging.ImageOptions.SvgOptions saveOptions = new Aspose.Imaging.ImageOptions.SvgOptions();
       saveOptions.TextAsShapes = true;
       Aspose.Imaging.ImageOptions.EmfRasterizationOptions rasterizationOptions = new Aspose.Imaging.ImageOptions.EmfRasterizationOptions();
       rasterizationOptions.BackgroundColor = Aspose.Imaging.Color.WhiteSmoke;
       rasterizationOptions.PageSize = emfImage.Size;
       rasterizationOptions.RenderMode = Aspose.Imaging.FileFormats.Emf.EmfRenderMode.Auto;
       rasterizationOptions.BorderX = 50;
       rasterizationOptions.BorderY = 50;
       saveOptions.VectorRasterizationOptions = rasterizationOptions;
       emfImage.Save(dir + "test.output.svg", saveOptions);
   }

This example shows how to load an SVG image from a file and rasterize it to PNG using various options.

string dir = "c:\\temp\\";
   using (Aspose.Imaging.FileFormats.Svg.SvgImage svgImage = Aspose.Imaging.Image.Load(dir + "test.svg"))
   {
       var rasterizationOptions = new Aspose.Imaging.ImageOptions.SvgRasterizationOptions();
       rasterizationOptions.BackgroundColor = Aspose.Imaging.Color.Gray;
       rasterizationOptions.PageSize = svgImage.Size;
       rasterizationOptions.SmoothingMode = Aspose.Imaging.SmoothingMode.AntiAlias;
       rasterizationOptions.TextRenderingHint = Aspose.Imaging.TextRenderingHint.AntiAlias;
       rasterizationOptions.ScaleX = 0.1f;
       rasterizationOptions.ScaleY = 0.1f;
       var saveOptions = new Aspose.Imaging.ImageOptions.PngOptions();
       saveOptions.VectorRasterizationOptions = rasterizationOptions;
       svgImage.Save(dir + "test.output.png", saveOptions);
   }

BorderX

Gets or sets the border X.

[JsonProperty]
    public float BorderX
    {
        get;
        set;
    }

Property Value

float

BorderY

Gets or sets the border Y.

[JsonProperty]
    public float BorderY
    {
        get;
        set;
    }

Property Value

float

CenterDrawing

Gets or sets a value indicating whether center drawing.

public class MyClass
{
    [JsonProperty]
    public bool CenterDrawing { get; set; }
}

Property Value

bool

DrawColor

Gets or sets a foreground color.

using Newtonsoft.Json;
[JsonProperty]
public Color DrawColor
{
    get;
    set;
}

Property Value

Color

PageHeight

Gets or sets the page height.If the value is 0, the source image aspect ratio will be preserved.

public float PageHeight
   {
      get;
      set;
   }

Property Value

float

PageSize

Gets or sets the page size.If one of Aspose.Imaging.SizeF dimensions is 0, the source image aspect ratio will be preserved.

public SizeF PageSize
    {
        get;
        set;
    }

Property Value

SizeF

Examples

This example shows how to load a WMF image from a file and convert it to SVG using WmfRasterizationOptions.

string dir = "c:\\temp\\";
   using (Aspose.Imaging.FileFormats.Wmf.WmfImage wmfImage = (Aspose.Imaging.FileFormats.Wmf.WmfImage)Aspose.Imaging.Image.Load(dir + "test.wmf"))
   {
       Aspose.Imaging.ImageOptions.SvgOptions saveOptions = new Aspose.Imaging.ImageOptions.SvgOptions();
       saveOptions.TextAsShapes = true;
       Aspose.Imaging.ImageOptions.WmfRasterizationOptions rasterizationOptions = new Aspose.Imaging.ImageOptions.WmfRasterizationOptions();
       rasterizationOptions.BackgroundColor = Aspose.Imaging.Color.WhiteSmoke;
       rasterizationOptions.PageSize = wmfImage.Size;
       rasterizationOptions.RenderMode = Aspose.Imaging.FileFormats.Wmf.WmfRenderMode.Auto;
       saveOptions.VectorRasterizationOptions = rasterizationOptions;
       wmfImage.Save(dir + "test.output.svg", saveOptions);
   }

This example shows how to load a EMF image from a file and convert it to SVG using EmfRasterizationOptions.

string dir = "c:\\temp\\";
   using (Aspose.Imaging.FileFormats.Emf.EmfImage emfImage = (Aspose.Imaging.FileFormats.Emf.EmfImage)Aspose.Imaging.Image.Load(dir + "test.emf"))
   {
       Aspose.Imaging.ImageOptions.SvgOptions saveOptions = new Aspose.Imaging.ImageOptions.SvgOptions();
       saveOptions.TextAsShapes = true;
       Aspose.Imaging.ImageOptions.EmfRasterizationOptions rasterizationOptions = new Aspose.Imaging.ImageOptions.EmfRasterizationOptions();
       rasterizationOptions.BackgroundColor = Aspose.Imaging.Color.WhiteSmoke;
       rasterizationOptions.PageSize = emfImage.Size;
       rasterizationOptions.RenderMode = Aspose.Imaging.FileFormats.Emf.EmfRenderMode.Auto;
       rasterizationOptions.BorderX = 50;
       rasterizationOptions.BorderY = 50;
       saveOptions.VectorRasterizationOptions = rasterizationOptions;
       emfImage.Save(dir + "test.output.svg", saveOptions);
   }

This example shows how to load an SVG image from a file and rasterize it to PNG using various options.

string dir = "c:\\temp\\";
   using (Aspose.Imaging.FileFormats.Svg.SvgImage svgImage = (Aspose.Imaging.FileFormats.Svg.SvgImage)Aspose.Imaging.Image.Load(dir + "test.svg"))
   {
       var rasterizationOptions = new Aspose.Imaging.ImageOptions.SvgRasterizationOptions();
       rasterizationOptions.BackgroundColor = Aspose.Imaging.Color.Gray;
       rasterizationOptions.PageSize = svgImage.Size;
       rasterizationOptions.SmoothingMode = Aspose.Imaging.SmoothingMode.AntiAlias;
       rasterizationOptions.TextRenderingHint = Aspose.Imaging.TextRenderingHint.AntiAlias;
       rasterizationOptions.ScaleX = 0.1f;
       rasterizationOptions.ScaleY = 0.1f;
       var saveOptions = new Aspose.Imaging.ImageOptions.PngOptions();
       saveOptions.VectorRasterizationOptions = rasterizationOptions;
       svgImage.Save(dir + "test.output.png", saveOptions);
   }

PageWidth

Gets or sets the page width.If the value is 0, the source image aspect ratio will be preserved.

public float PageWidth
   {
      get;
      set;
   }

Property Value

float

Positioning

Gets or sets the positioning.

public enum PositioningTypes
   {
   }
   [JsonProperty]
   public PositioningTypes Positioning { get; set; }

Property Value

PositioningTypes

Examples

The following example shows how to set a memory limit when loading a CMX image. The memory limit is the maximum allowed size (in megabytes) for all internal buffers.

string dir = "c:\\aspose.imaging\\issues\\net\\3419\\";
   using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "example.cmx", new Aspose.Imaging.LoadOptions() { BufferSizeHint = 10 }))
   {
       image.Save(dir + "output.png",
           new Aspose.Imaging.ImageOptions.PngOptions()
           {
               VectorRasterizationOptions =
                   new Aspose.Imaging.ImageOptions.CmxRasterizationOptions
                   {
                       TextRenderingHint = Aspose.Imaging.TextRenderingHint.SingleBitPerPixel,
                       SmoothingMode = Aspose.Imaging.SmoothingMode.AntiAlias,
                       Positioning = Aspose.Imaging.ImageOptions.PositioningTypes.DefinedByDocument
                   }
           });
   }

The following example shows how to export all pages of CDR document to PDF.

string dir = "c:\\aspose.imaging\\issues\\net\\3635\\testdata\\3570";
   string inputCdrFileName = System.IO.Path.Combine(dir, "tiger.cdr");
   string outputPdfFileName = System.IO.Path.Combine(dir, "tiger.cdr.pdf");
   using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(inputCdrFileName))
   {
       Aspose.Imaging.ImageOptions.PdfOptions pdfOptions = new Aspose.Imaging.ImageOptions.PdfOptions();
       Aspose.Imaging.ImageOptions.CdrRasterizationOptions rasterizationOptions = new Aspose.Imaging.ImageOptions.CdrRasterizationOptions
       {
           TextRenderingHint = Aspose.Imaging.TextRenderingHint.SingleBitPerPixel,
           SmoothingMode = Aspose.Imaging.SmoothingMode.None,
           Positioning = Aspose.Imaging.ImageOptions.PositioningTypes.DefinedByDocument
       };
       pdfOptions.VectorRasterizationOptions = rasterizationOptions;
       image.Save(outputPdfFileName, pdfOptions);
   }

ReplaceTextMapping

Gets or sets the text replace mapping.

public Dictionary<string, string> ReplaceTextMapping
    {
        get;
        set;
    }

Property Value

Dictionary < string , string >

SmoothingMode

Gets or sets the smoothing mode.

[JsonProperty]
   public SmoothingMode SmoothingMode
   {
       get;
       set;
   }

Property Value

SmoothingMode

Examples

This example shows how to load an SVG image from a file and rasterize it to PNG using various options.

string dir = "c:\\temp\\";
   using (Aspose.Imaging.FileFormats.Svg.SvgImage svgImage = Aspose.Imaging.Image.Load(dir + "test.svg"))
   {
       var rasterizationOptions = new Aspose.Imaging.ImageOptions.SvgRasterizationOptions();
       rasterizationOptions.BackgroundColor = Aspose.Imaging.Color.Gray;
       rasterizationOptions.PageSize = svgImage.Size;
       rasterizationOptions.SmoothingMode = Aspose.Imaging.SmoothingMode.AntiAlias;
       rasterizationOptions.TextRenderingHint = Aspose.Imaging.TextRenderingHint.AntiAlias;
       rasterizationOptions.ScaleX = 0.1f;
       rasterizationOptions.ScaleY = 0.1f;
       var saveOptions = new Aspose.Imaging.ImageOptions.PngOptions();
       saveOptions.VectorRasterizationOptions = rasterizationOptions;
       svgImage.Save(dir + "test.output.png", saveOptions);
   }

TextRenderingHint

Gets or sets the text rendering hint.

public TextRenderingHint [JsonProperty]
{
    get;
    set;
}

Property Value

TextRenderingHint

Examples

This example shows how to load an SVG image from a file and rasterize it to PNG using various options.

string dir = "c:\\temp\\";
   using (Aspose.Imaging.FileFormats.Svg.SvgImage svgImage = (Aspose.Imaging.FileFormats.Svg.SvgImage)Aspose.Imaging.Image.Load(dir + "test.svg"))
   {
       Aspose.Imaging.ImageOptions.SvgRasterizationOptions rasterizationOptions = new Aspose.Imaging.ImageOptions.SvgRasterizationOptions();
       rasterizationOptions.BackgroundColor = Aspose.Imaging.Color.Gray;
       rasterizationOptions.PageSize = svgImage.Size;
       rasterizationOptions.SmoothingMode = Aspose.Imaging.SmoothingMode.AntiAlias;
       rasterizationOptions.TextRenderingHint = Aspose.Imaging.TextRenderingHint.AntiAlias;
       rasterizationOptions.ScaleX = 0.1f;
       rasterizationOptions.ScaleY = 0.1f;
       Aspose.Imaging.ImageOptions.PngOptions saveOptions = new Aspose.Imaging.ImageOptions.PngOptions();
       saveOptions.VectorRasterizationOptions = rasterizationOptions;
       svgImage.Save(dir + "test.output.png", saveOptions);
   }

Methods

Clone()

Creates a new object that is a shallow copy of the current instance.

public object Clone()
   {
   }

Returns

object

A new object that is a shallow copy of this instance.

CopyTo(VectorRasterizationOptions)

Copies to.

public virtual void CopyTo(VectorRasterizationOptions vectorRasterizationOptions)
   {
   }

Parameters

vectorRasterizationOptions VectorRasterizationOptions

The vector rasterization options.</string,>

 English