public class SvgRasterizationOptions extends VectorRasterizationOptions
The SVG rasterization options.
| Constructor and Description |
|---|
SvgRasterizationOptions()
Initializes a new instance of the
SvgRasterizationOptions class. |
| Modifier and Type | Method and Description |
|---|---|
float |
getScaleX()
Gets or sets the scale x.
|
float |
getScaleY()
Gets or sets the scale y.
|
void |
setScaleX(float value)
Gets or sets the scale x.
|
void |
setScaleY(float value)
Gets or sets the scale y.
|
copyTo, getBackgroundColor, getBorderX, getBorderY, getCenterDrawing, getDrawColor, getPageHeight, getPageSize, getPageWidth, getPositioning, getSmoothingMode, getTextRenderingHint, setBackgroundColor, setBorderX, setBorderY, setCenterDrawing, setDrawColor, setPageHeight, setPageSize, setPageWidth, setPositioning, setSmoothingMode, setTextRenderingHintdeepClone, getBufferSizeHint, getFullFrame, getMultiPageOptions, getPalette, getProgressEventHandler, getResolutionSettings, getSource, getVectorRasterizationOptions, getXmpData, setBufferSizeHint, setFullFrame, setMultiPageOptions, setPalette, setProgressEventHandler, setResolutionSettings, setSource, setVectorRasterizationOptions, setXmpDataclose, dispose, getDisposedpublic SvgRasterizationOptions()
Initializes a new instance of the SvgRasterizationOptions class.
public float getScaleX()
Gets or sets the scale x.
public void setScaleX(float value)
Gets or sets the scale x.
value - The scale x.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.Image.Load is a unified way to load image.
com.aspose.imaging.fileformats.svg.SvgImage svgImage = (com.aspose.imaging.fileformats.svg.SvgImage) com.aspose.imaging.Image.load(dir + "test.svg");
try {
// In order to rasterize SVG we need to specify rasterization options.
com.aspose.imaging.imageoptions.SvgRasterizationOptions rasterizationOptions = new com.aspose.imaging.imageoptions.SvgRasterizationOptions();
// Set default color of a background for an image. Default value is white.
rasterizationOptions.setBackgroundColor(com.aspose.imaging.Color.getGray());
// Set the page size
rasterizationOptions.setPageSize(new com.aspose.imaging.SizeF(svgImage.getWidth(), svgImage.getHeight()));
// Antialiasing is applied to lines and curves and the edges of filled areas.
rasterizationOptions.setSmoothingMode(com.aspose.imaging.SmoothingMode.AntiAlias);
// Each character is drawn using its antialiased glyph bitmap without hinting.
rasterizationOptions.setTextRenderingHint(com.aspose.imaging.TextRenderingHint.AntiAlias);
// Reduce the image size 10 times, i.e. the output size will be 10% of the original size.
rasterizationOptions.setScaleX(0.1f);
rasterizationOptions.setScaleY(0.1f);
com.aspose.imaging.imageoptions.PngOptions saveOptions = new com.aspose.imaging.imageoptions.PngOptions();
saveOptions.setVectorRasterizationOptions(rasterizationOptions);
// Save to a PNG file
svgImage.save(dir + "test.output.png", saveOptions);
} finally {
svgImage.dispose();
}
public float getScaleY()
Gets or sets the scale y.
public void setScaleY(float value)
Gets or sets the scale y.
value - The scale y.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.Image.Load is a unified way to load image.
com.aspose.imaging.fileformats.svg.SvgImage svgImage = (com.aspose.imaging.fileformats.svg.SvgImage) com.aspose.imaging.Image.load(dir + "test.svg");
try {
// In order to rasterize SVG we need to specify rasterization options.
com.aspose.imaging.imageoptions.SvgRasterizationOptions rasterizationOptions = new com.aspose.imaging.imageoptions.SvgRasterizationOptions();
// Set default color of a background for an image. Default value is white.
rasterizationOptions.setBackgroundColor(com.aspose.imaging.Color.getGray());
// Set the page size
rasterizationOptions.setPageSize(new com.aspose.imaging.SizeF(svgImage.getWidth(), svgImage.getHeight()));
// Antialiasing is applied to lines and curves and the edges of filled areas.
rasterizationOptions.setSmoothingMode(com.aspose.imaging.SmoothingMode.AntiAlias);
// Each character is drawn using its antialiased glyph bitmap without hinting.
rasterizationOptions.setTextRenderingHint(com.aspose.imaging.TextRenderingHint.AntiAlias);
// Reduce the image size 10 times, i.e. the output size will be 10% of the original size.
rasterizationOptions.setScaleX(0.1f);
rasterizationOptions.setScaleY(0.1f);
com.aspose.imaging.imageoptions.PngOptions saveOptions = new com.aspose.imaging.imageoptions.PngOptions();
saveOptions.setVectorRasterizationOptions(rasterizationOptions);
// Save to a PNG file
svgImage.save(dir + "test.output.png", saveOptions);
} finally {
svgImage.dispose();
}
Copyright (c) 2008-2022 Aspose Pty Ltd. All Rights Reserved.