com.aspose.words

Class GraphicsQualityOptions

  • java.lang.Object
    • com.aspose.words.GraphicsQualityOptions
public class GraphicsQualityOptions 
extends java.lang.Object

Allows to specify additional java.awt.RenderingHints.

Example:

Shows how to set render quality options while converting documents to image formats.
Document doc = new Document(getMyDir() + "Rendering.docx");

GraphicsQualityOptions qualityOptions = new GraphicsQualityOptions();
qualityOptions.getRenderingHints().put(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); // SmoothingMode
qualityOptions.getRenderingHints().put(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON); // TextRenderingHint
qualityOptions.getRenderingHints().put(RenderingHints.KEY_COLOR_RENDERING, RenderingHints.VALUE_COLOR_RENDER_QUALITY); // CompositingMode
qualityOptions.getRenderingHints().put(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY); // CompositingQuality
qualityOptions.getRenderingHints().put(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR); // InterpolationMode
qualityOptions.getRenderingHints().put(RenderingHints.KEY_FRACTIONALMETRICS, RenderingHints.VALUE_FRACTIONALMETRICS_ON); // StringFormat

ImageSaveOptions saveOptions = new ImageSaveOptions(SaveFormat.JPEG);
saveOptions.setGraphicsQualityOptions(qualityOptions);

doc.save(getArtifactsDir() + "ImageSaveOptions.GraphicsQuality.jpg", saveOptions);

Constructor Summary
 
Property Getters/Setters Summary
booleangetUseTileFlipMode()
void
setUseTileFlipMode(booleanvalue)
           Gets or sets a flag indicating whether WrapMode is TileFlipXY.
 
Method Summary
java.awt.RenderingHintsgetRenderingHints()
Gets current java.awt.RenderingHints to view or to add new hints.
voidsetRenderingHints(java.awt.RenderingHints renderingHints)
Overwrites current java.awt.RenderingHints.
 

    • Constructor Detail

      • GraphicsQualityOptions

        public GraphicsQualityOptions()
    • Property Getters/Setters Detail

      • getUseTileFlipMode/setUseTileFlipMode

        public boolean getUseTileFlipMode() / public void setUseTileFlipMode(boolean value)
        
        Gets or sets a flag indicating whether WrapMode is TileFlipXY.

        The System.Drawing.Drawing2D.WrapMode specifies how a texture or gradient is tiled when it is smaller than the area being filled.

        By default uses Tile (specifies tiling without flipping). This causes inaccurate rendering of the scaled image(with high resolution).

        This property allows to switch WrapMode to TileFlipXY (specifies that tiles are flipped horizontally as you move along a row and flipped vertically as you move along a column).

        Example:

        Shows how to prevent the white line appears when rendering with a high resolution.
        Document doc = new Document(getMyDir() + "Shape high dpi.docx");
        
        Shape shape = (Shape)doc.getChild(NodeType.SHAPE, 0, true);
        ShapeRenderer renderer = shape.getShapeRenderer();
        
        ImageSaveOptions saveOptions = new ImageSaveOptions(SaveFormat.PNG);
        {
            saveOptions.setResolution(500f); saveOptions.setGraphicsQualityOptions(new GraphicsQualityOptions()); { saveOptions.getGraphicsQualityOptions().setUseTileFlipMode(true); }
        }
        renderer.save(getArtifactsDir() + "ImageSaveOptions.UseTileFlipMode.png", saveOptions);
    • Method Detail

      • getRenderingHints

        public java.awt.RenderingHints getRenderingHints()
        Gets current java.awt.RenderingHints to view or to add new hints.
      • setRenderingHints

        public void setRenderingHints(java.awt.RenderingHints renderingHints)
        Overwrites current java.awt.RenderingHints.