public abstract class VectorRasterizationOptions extends ImageOptionsBase
The vector rasterization options.
Constructor and Description |
---|
VectorRasterizationOptions(VectorRasterizationOptions imageOptions) |
Modifier and Type | Method and Description |
---|---|
void |
copyTo(VectorRasterizationOptions vectorRasterizationOptions)
Copies to.
|
Color |
getBackgroundColor()
Gets a background color.
|
float |
getBorderX()
Gets or sets the border X.
|
float |
getBorderY()
Gets or sets the border Y.
|
boolean |
getCenterDrawing()
Gets a value indicating whether center drawing.
|
Color |
getDrawColor()
Gets a foreground color.
|
float |
getPageHeight()
Gets the page height.
|
SizeF |
getPageSize()
Gets the page size.
|
float |
getPageWidth()
Gets the page width.
|
int |
getSmoothingMode()
Gets the smoothing mode.
|
int |
getTextRenderingHint()
Gets the text rendering hint.
|
void |
setBackgroundColor(Color value)
Sets a background color.
|
void |
setBorderX(float value)
Gets or sets the border X.
|
void |
setBorderY(float value)
Gets or sets the border Y.
|
void |
setCenterDrawing(boolean value)
Sets a value indicating whether center drawing.
|
void |
setDrawColor(Color value)
Sets a foreground color.
|
void |
setPageHeight(float value)
Sets the page height.
|
void |
setPageSize(SizeF value)
Sets the page size.
|
void |
setPageWidth(float value)
Sets the page width.
|
void |
setSmoothingMode(int value)
Sets the smoothing mode.
|
void |
setTextRenderingHint(int value)
Sets the text rendering hint.
|
deepClone, getBufferSizeHint, getMultiPageOptions, getPalette, getProgressEventHandler, getResolutionSettings, getSource, getVectorRasterizationOptions, getXmpData, setBufferSizeHint, setMultiPageOptions, setPalette, setProgressEventHandler, setResolutionSettings, setSource, setVectorRasterizationOptions, setXmpData
close, dispose, getDisposed
public VectorRasterizationOptions(VectorRasterizationOptions imageOptions)
public final int getSmoothingMode()
Gets the smoothing mode.
public final void setSmoothingMode(int value)
Sets the smoothing mode.
value
- the smoothing mode.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 getBorderX()
Gets or sets the border X.
public void setBorderX(float value)
Gets or sets the border X.
value
- The border X.public float getBorderY()
Gets or sets the border Y.
public void setBorderY(float value)
Gets or sets the border Y.
value
- The border Y.public boolean getCenterDrawing()
Gets a value indicating whether center drawing.
public void setCenterDrawing(boolean value)
Sets a value indicating whether center drawing.
value
- a value indicating whether center drawing.public float getPageHeight()
Gets the page height.
public void setPageHeight(float value)
Sets the page height.
value
- the page height.public SizeF getPageSize()
Gets the page size.
public void setPageSize(SizeF value)
Sets the page size.
value
- the page size.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.Image.Load is a unified way to load all types of images including EMF. com.aspose.imaging.fileformats.emf.EmfImage emfImage = (com.aspose.imaging.fileformats.emf.EmfImage) com.aspose.imaging.Image.load(dir + "test.emf"); try { com.aspose.imaging.imageoptions.SvgOptions saveOptions = new com.aspose.imaging.imageoptions.SvgOptions(); // Text will be converted to shapes. saveOptions.setTextAsShapes(true); com.aspose.imaging.imageoptions.EmfRasterizationOptions rasterizationOptions = new com.aspose.imaging.imageoptions.EmfRasterizationOptions(); // The background color of the drawing surface. rasterizationOptions.setBackgroundColor(com.aspose.imaging.Color.getWhiteSmoke()); // The page size. rasterizationOptions.setPageSize(new com.aspose.imaging.SizeF(emfImage.getWidth(), emfImage.getHeight())); // If embedded emf exists, then render emf; otherwise render wmf. rasterizationOptions.setRenderMode(com.aspose.imaging.fileformats.emf.EmfRenderMode.Auto); // Set the horizontal margin rasterizationOptions.setBorderX(50); // Set the vertical margin rasterizationOptions.setBorderY(50); saveOptions.setVectorRasterizationOptions(rasterizationOptions); emfImage.save(dir + "test.output.svg", saveOptions); } finally { emfImage.dispose(); }
public float getPageWidth()
Gets the page width.
public void setPageWidth(float value)
Sets the page width.
value
- the page width.public Color getBackgroundColor()
Gets a background color.
public void setBackgroundColor(Color value)
Sets a background color.
value
- a background color.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.Image.Load is a unified way to load all types of images including EMF. com.aspose.imaging.fileformats.emf.EmfImage emfImage = (com.aspose.imaging.fileformats.emf.EmfImage) com.aspose.imaging.Image.load(dir + "test.emf"); try { com.aspose.imaging.imageoptions.SvgOptions saveOptions = new com.aspose.imaging.imageoptions.SvgOptions(); // Text will be converted to shapes. saveOptions.setTextAsShapes(true); com.aspose.imaging.imageoptions.EmfRasterizationOptions rasterizationOptions = new com.aspose.imaging.imageoptions.EmfRasterizationOptions(); // The background color of the drawing surface. rasterizationOptions.setBackgroundColor(com.aspose.imaging.Color.getWhiteSmoke()); // The page size. rasterizationOptions.setPageSize(new com.aspose.imaging.SizeF(emfImage.getWidth(), emfImage.getHeight())); // If embedded emf exists, then render emf; otherwise render wmf. rasterizationOptions.setRenderMode(com.aspose.imaging.fileformats.emf.EmfRenderMode.Auto); // Set the horizontal margin rasterizationOptions.setBorderX(50); // Set the vertical margin rasterizationOptions.setBorderY(50); saveOptions.setVectorRasterizationOptions(rasterizationOptions); emfImage.save(dir + "test.output.svg", saveOptions); } finally { emfImage.dispose(); }
public Color getDrawColor()
Gets a foreground color.
public void setDrawColor(Color value)
Sets a foreground color.
value
- a foreground color.public final int getTextRenderingHint()
Gets the text rendering hint.
Value: The text rendering hint.public final void setTextRenderingHint(int value)
Sets the text rendering hint.
Value: The text rendering hint.value
- the text rendering hint.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 final void copyTo(VectorRasterizationOptions vectorRasterizationOptions)
Copies to.
vectorRasterizationOptions
- The vector rasterization options.