Packages

 

com.aspose.cad.imageoptions

Class CadRasterizationOptions

  • All Implemented Interfaces:
    com.aspose.cad_internal.imageoptions.IRasterRenderingOptions


    public class CadRasterizationOptions
    extends VectorRasterizationOptions
    implements com.aspose.cad_internal.imageoptions.IRasterRenderingOptions

    The Cad rasterization options.

    • Field Detail

      • RenderResult

        public CadRasterizationOptions.CadRenderHandler RenderResult

        Rendering result handler.


         Sets up error handler to catch all export errors and prints them to STDOUT
         
         using (var image = Aspose.CAD.Image.Load("fileName.dwg"))
         {
             image.Save("targetFile.bmp", new BmpOptions()
             {
                 VectorRasterizationOptions = new CadRasterizationOptions()
                 {
                     RenderResult = result =>
                     {
                         if (!result.IsRenderComplete)
                         {
                             foreach (var resultFailure in result.Failures)
                             {
                                 Console.WriteLine($"Error: {resultFailure.Message} (error code {resultFailure.RenderCode})");
                             }
                         }
                     }
                 }
             });
         }
         

    • Constructor Detail

      • CadRasterizationOptions

        public CadRasterizationOptions()
    • Method Detail

      • getZoom

        public float getZoom()

        Gets or sets zoom factor. Allows to zoom drawing relatively to canvas size. Value of 1 corresponds to exact fit, value below 1 allows to preserve margins, value above 1 allows to scale drawing up.


         Sets up zoom to keep whole drawing borders visible
         
         using (CadImage cadImage = (CadImage)Image.Load(GetPath(fileName)))
         {
             JpegOptions options = new JpegOptions();
             var rasterizationOptions = new CadRasterizationOptions();
             rasterizationOptions.Zoom = 0.9f;
             options.VectorRasterizationOptions = rasterizationOptions;
             cadImage.Save(outFile, options);
         }
         

      • setZoom

        public void setZoom(float value)

        Gets or sets zoom factor. Allows to zoom drawing relatively to canvas size. Value of 1 corresponds to exact fit, value below 1 allows to preserve margins, value above 1 allows to scale drawing up.


         Sets up zoom to keep whole drawing borders visible
         
         using (CadImage cadImage = (CadImage)Image.Load(GetPath(fileName)))
         {
             JpegOptions options = new JpegOptions();
             var rasterizationOptions = new CadRasterizationOptions();
             rasterizationOptions.Zoom = 0.9f;
             options.VectorRasterizationOptions = rasterizationOptions;
             cadImage.Save(outFile, options);
         }
         

      • getPenOptions

        public PenOptions getPenOptions()

        Gets or sets the pen options.


         Sets up "squared" pen
         
         using (CadImage cadImage = (CadImage)Image.Load(GetPath(fileName)))
         {
             JpegOptions options = new JpegOptions();
             var rasterizationOptions = new CadRasterizationOptions();
             rasterizationOptions.PenOptions = new PenOptions() { StartCap = LineCap.Square, EndCap = LineCap.Square };
             options.VectorRasterizationOptions = rasterizationOptions;
             cadImage.Save(outFile, options);
         }
         

        Returns:
        The pen options.
      • setPenOptions

        public void setPenOptions(PenOptions value)

        Gets or sets the pen options.


         Sets up "squared" pen
         
         using (CadImage cadImage = (CadImage)Image.Load(GetPath(fileName)))
         {
             JpegOptions options = new JpegOptions();
             var rasterizationOptions = new CadRasterizationOptions();
             rasterizationOptions.PenOptions = new PenOptions() { StartCap = LineCap.Square, EndCap = LineCap.Square };
             options.VectorRasterizationOptions = rasterizationOptions;
             cadImage.Save(outFile, options);
         }
         

        Parameters:
        value - The pen options.
      • getObserverPoint

        public ObserverPoint getObserverPoint()

        Gets or sets the observer point.


         Sets up observation point to perform export of custom view of a drawing
         
         using (CadImage cadImage = (CadImage)Image.Load(GetPath(fileName)))
         {
             JpegOptions options = new JpegOptions();
             var rasterizationOptions = new CadRasterizationOptions();
             rasterizationOptions.PageWidth = 1500;
             rasterizationOptions.PageHeight = 1500;
             float xAngle = 10; //Angle of rotation along the X axis
             float yAngle = 20; //Angle of rotation along the Y axis
             float zAngle = 30; //Angle of rotation along the Z axis
             rasterizationOptions.ObserverPoint = new ObserverPoint(xAngle, yAngle, zAngle);
             options.VectorRasterizationOptions = rasterizationOptions;
             cadImage.Save(outFile, options);
         }
         

        Returns:
        The observer point.
      • setObserverPoint

        public void setObserverPoint(ObserverPoint value)

        Gets or sets the observer point.


         Sets up observation point to perform export of custom view of a drawing
         
         using (CadImage cadImage = (CadImage)Image.Load(GetPath(fileName)))
         {
             JpegOptions options = new JpegOptions();
             var rasterizationOptions = new CadRasterizationOptions();
             rasterizationOptions.PageWidth = 1500;
             rasterizationOptions.PageHeight = 1500;
             float xAngle = 10; //Angle of rotation along the X axis
             float yAngle = 20; //Angle of rotation along the Y axis
             float zAngle = 30; //Angle of rotation along the Z axis
             rasterizationOptions.ObserverPoint = new ObserverPoint(xAngle, yAngle, zAngle);
             options.VectorRasterizationOptions = rasterizationOptions;
             cadImage.Save(outFile, options);
         }
         

        Parameters:
        value - The observer point.
      • getAutomaticLayoutsScaling

        public boolean getAutomaticLayoutsScaling()

        Gets or sets a value indicating whether layouts should be automatically scaled.

      • setAutomaticLayoutsScaling

        public void setAutomaticLayoutsScaling(boolean value)

        Gets or sets a value indicating whether layouts should be automatically scaled.

      • getLayers

        public List<String> getLayers()

        Gets or sets layers of DXF file to export.

      • setLayers

        public void setLayers(List<String> value)

        Gets or sets layers of DXF file to export.

      • getLayouts

        public String[] getLayouts()

        Gets or sets the layoutName.

        Specified by:
        getLayouts in interface com.aspose.cad_internal.imageoptions.IRasterRenderingOptions
        Returns:
        The specific layout name or null for use Model. Model is also a layout.
      • setLayouts

        public void setLayouts(String[] value)

        Gets or sets the layoutName.

        Specified by:
        setLayouts in interface com.aspose.cad_internal.imageoptions.IRasterRenderingOptions
        Parameters:
        value - The specific layout name or null for use Model. Model is also a layout.
      • getDrawType

        public int getDrawType()

        Gets or sets type of drawing.

      • setDrawType

        public void setDrawType(int value)

        Gets or sets type of drawing.

      • isNoScaling

        public boolean isNoScaling()

        Gets or sets no scaling during export.

      • setNoScaling

        public void setNoScaling(boolean value)

        Gets or sets no scaling during export.

      • getPdfProductLocation

        public String getPdfProductLocation()

        The PDF product location

      • setPdfProductLocation

        public void setPdfProductLocation(String value)

        The PDF product location

      • getQuality

        public final RasterizationQuality getQuality()

        Gets or sets the quality.

        Returns:
        The quality.
      • setQuality

        public final void setQuality(RasterizationQuality value)

        Gets or sets the quality.

        Parameters:
        value - The quality.