com.aspose.html.rendering

Class Device<TGraphicContext extends GraphicContext,TRenderingOptions extends RenderingOptions>

  • java.lang.Object
    • com.aspose.html.rendering.Device<TGraphicContext,TRenderingOptions>
  • All Implemented Interfaces:
    IDevice, com.aspose.ms.System.IDisposable
    Direct Known Subclasses:
    ImageDevice, PdfDevice, XpsDevice


    public abstract class Device<TGraphicContext extends GraphicContext,TRenderingOptions extends RenderingOptions>
    extends Object
    implements IDevice

    Represents base class for implementation particular rendering devices.

    TGraphicContext: Graphic context that holds current graphics control parameters

    TRenderingOptions: Rendering options

    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method and Description
      abstract void addRect(com.aspose.ms.System.Drawing.RectangleF rect)
      Appends a rectangle to the current path as a complete subpath.
      void beginDocument(Document document, Class<? extends GraphicContext> clazz)
      Begins rendering of the document.
      abstract boolean beginElement(Element element, com.aspose.ms.System.Drawing.RectangleF rect)
      Begins rendering of the html element.
      void beginPage(com.aspose.ms.System.Drawing.SizeF size)
      Begins rendering of the new page.
      abstract void clip(int mode)
      Modifies the current clipping path by intersecting it with the current path, using the FillMode rule to determine the region to fill.
      abstract void closePath()
      Closes the current subpath by appending a straight line segment from the current point to the starting point of the subpath.
      abstract void cubicBezierTo(com.aspose.ms.System.Drawing.PointF cubP1, com.aspose.ms.System.Drawing.PointF cubP2, com.aspose.ms.System.Drawing.PointF cubP3)
      Appends a cubic Bézier curve to the current path.
      void dispose()
      Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
      abstract void drawImage(byte[] data, int type, com.aspose.ms.System.Drawing.RectangleF rectangle)
      Draws the specified image.
      void endDocument()
      Ends rendering of the document.
      abstract void endElement(Element element)
      Ends rendering of the html element.
      void endPage()
      Ends rendering of the current page.
      abstract void fill(int mode)
      Fills the entire region enclosed by the current path.
      abstract void fillText(String text, com.aspose.ms.System.Drawing.PointF position)
      Fills the specified text string at the specified location.
      TGraphicContext getGraphicContext_Rename_Namesake()
      Gets the graphic context
      GraphicContext getGraphicContext()
      Gets the graphic context
      TRenderingOptions getOptions_Rename_Namesake()
      Gets rendering options.
      RenderingOptions getOptions()
      Gets rendering options.
      abstract void lineTo(com.aspose.ms.System.Drawing.PointF pos)
      Appends a straight line segment from the current point to the point (pt).
      abstract void moveTo(com.aspose.ms.System.Drawing.PointF pos)
      Begins a new subpath by moving the current point to coordinates of the parameter pt, omitting any connecting line segment.
      void restoreGraphicContext()
      Restores the entire graphics context to its former value by popping it from the stack.
      void saveGraphicContext()
      Pushes a copy of the entire graphics context onto the stack.
      abstract void stroke()
      Strokes a line along the current path.
      abstract void strokeAndFill(int mode)
      Strokes and fill current path.
      abstract void strokeText(String text, com.aspose.ms.System.Drawing.PointF position)
      Strokes the specified text string at the specified location.
    • Method Detail

      • getOptions_Rename_Namesake

        public TRenderingOptions getOptions_Rename_Namesake()

        Gets rendering options.

      • getGraphicContext_Rename_Namesake

        public TGraphicContext getGraphicContext_Rename_Namesake()

        Gets the graphic context

      • saveGraphicContext

        public void saveGraphicContext()

        Pushes a copy of the entire graphics context onto the stack.

        Specified by:
        saveGraphicContext in interface IDevice
      • restoreGraphicContext

        public void restoreGraphicContext()

        Restores the entire graphics context to its former value by popping it from the stack.

        Specified by:
        restoreGraphicContext in interface IDevice
      • endDocument

        public void endDocument()

        Ends rendering of the document.

        Specified by:
        endDocument in interface IDevice
      • beginPage

        public void beginPage(com.aspose.ms.System.Drawing.SizeF size)

        Begins rendering of the new page.

        Specified by:
        beginPage in interface IDevice
        Parameters:
        size - Size of the page.
      • endPage

        public void endPage()

        Ends rendering of the current page.

        Specified by:
        endPage in interface IDevice
      • beginElement

        public abstract boolean beginElement(Element element,
                                             com.aspose.ms.System.Drawing.RectangleF rect)

        Begins rendering of the html element.

        Specified by:
        beginElement in interface IDevice
        Parameters:
        element - The html element.
        rect - Bounding box of the node.
        Returns:
        Returns [true] if element should be processed.
      • endElement

        public abstract void endElement(Element element)

        Ends rendering of the html element.

        Specified by:
        endElement in interface IDevice
        Parameters:
        element - The html element.
      • closePath

        public abstract void closePath()

        Closes the current subpath by appending a straight line segment from the current point to the starting point of the subpath. If the current subpath is already closed, "ClosePath" does nothing. This operator terminates the current subpath. Appending another segment to the current path begins a new subpath, even if the new segment begins at the endpoint reached by the "ClosePath" method.

        Specified by:
        closePath in interface IDevice
      • moveTo

        public abstract void moveTo(com.aspose.ms.System.Drawing.PointF pos)

        Begins a new subpath by moving the current point to coordinates of the parameter pt, omitting any connecting line segment. If the previous path construction method in the current path was also "MoveTo", the new "MoveTo" overrides it; no vestige of the previous "MoveTo" operation remains in the path.

        Specified by:
        moveTo in interface IDevice
        Parameters:
        pt - Point of where to move the path to.
      • lineTo

        public abstract void lineTo(com.aspose.ms.System.Drawing.PointF pos)

        Appends a straight line segment from the current point to the point (pt). The new current point is pt.

        Specified by:
        lineTo in interface IDevice
        Parameters:
        pt - Point of where to create the line to.
      • addRect

        public abstract void addRect(com.aspose.ms.System.Drawing.RectangleF rect)

        Appends a rectangle to the current path as a complete subpath.

        Specified by:
        addRect in interface IDevice
        Parameters:
        rect - A rectangle to draw.
      • cubicBezierTo

        public abstract void cubicBezierTo(com.aspose.ms.System.Drawing.PointF cubP1,
                                           com.aspose.ms.System.Drawing.PointF cubP2,
                                           com.aspose.ms.System.Drawing.PointF cubP3)

        Appends a cubic Bézier curve to the current path. The curve extends from the current point to the point pt2, using pt1 and pt2 as the Bézier control points. The new current point is pt3.

        Specified by:
        cubicBezierTo in interface IDevice
        Parameters:
        pt1 - Coordinates of first point
        pt2 - Coordinates of second point
        pt3 - Coordinates of third point
      • stroke

        public abstract void stroke()

        Strokes a line along the current path. The stroked line follows each straight or curved segment in the path, centered on the segment with sides parallel to it. Each of the path’s subpaths is treated separately. This method terminates current path.

        Specified by:
        stroke in interface IDevice
      • fill

        public abstract void fill(int mode)

        Fills the entire region enclosed by the current path. If the path consists of several disconnected subpaths, it fills the insides of all subpaths, considered together. This method terminates current path.

        Specified by:
        fill in interface IDevice
        Parameters:
        mode - Filling mode specifies how the interior of a closed path is filled
      • clip

        public abstract void clip(int mode)

        Modifies the current clipping path by intersecting it with the current path, using the FillMode rule to determine the region to fill. This method terminates current path.

        Specified by:
        clip in interface IDevice
        Parameters:
        mode - Filling mode specifies how the interior of a closed path is clipped
      • strokeAndFill

        public abstract void strokeAndFill(int mode)

        Strokes and fill current path. This method terminates current path.

        Specified by:
        strokeAndFill in interface IDevice
        Parameters:
        mode - Filling mode specifies how the interior of a closed path is filled.
      • fillText

        public abstract void fillText(String text,
                                      com.aspose.ms.System.Drawing.PointF position)

        Fills the specified text string at the specified location.

        Specified by:
        fillText in interface IDevice
        Parameters:
        text - String to fill.
        pt - Point that specifies the coordinates of the text.
      • strokeText

        public abstract void strokeText(String text,
                                        com.aspose.ms.System.Drawing.PointF position)

        Strokes the specified text string at the specified location.

        Specified by:
        strokeText in interface IDevice
        Parameters:
        text - String to stroke.
        pt - Point that specifies the coordinates where to start the text.
      • drawImage

        public abstract void drawImage(byte[] data,
                                       int type,
                                       com.aspose.ms.System.Drawing.RectangleF rectangle)

        Draws the specified image.

        Specified by:
        drawImage in interface IDevice
        Parameters:
        data - An array of bytes representing the image.
        type - Image type.
        rect - A rectangel which determines position and size to draw.
      • dispose

        public void dispose()

        Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

        Specified by:
        dispose in interface com.aspose.ms.System.IDisposable