com.aspose.html.rendering

Interface IDevice

  • All Superinterfaces:
    com.aspose.ms.System.IDisposable
    All Known Implementing Classes:
    Device, ImageDevice, PdfDevice, XpsDevice


    public interface IDevice
    extends com.aspose.ms.System.IDisposable

    Defines methods and properties that support custom rendering of the graphic elements like paths, text and images.

    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method and Description
      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.
      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.
      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.
      void closePath()
      Closes the current subpath by appending a straight line segment from the current point to the starting point of the subpath.
      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 drawImage(byte[] data, int type, com.aspose.ms.System.Drawing.RectangleF rectangle)
      Draws the specified image.
      void endDocument()
      Ends rendering of the document.
      void endElement(Element element)
      Ends rendering of the html element.
      void endPage()
      Ends rendering of the current page.
      void fill(int mode)
      Fills the entire region enclosed by the current path.
      void fillText(String text, com.aspose.ms.System.Drawing.PointF position)
      Fills the specified text string at the specified location.
      GraphicContext getGraphicContext()
      Gets the graphic context
      Class<? extends GraphicContext> getGraphicContextClass()
      Pushes a copy of the entire graphics context onto the stack.
      RenderingOptions getOptions()
      Gets rendering options.
      void lineTo(com.aspose.ms.System.Drawing.PointF pos)
      Appends a straight line segment from the current point to the point (pt).
      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.
      void stroke()
      Strokes a line along the current path.
      void strokeAndFill(int mode)
      Strokes and fill current path.
      void strokeText(String text, com.aspose.ms.System.Drawing.PointF position)
      Strokes the specified text string at the specified location.
      • Methods inherited from interface com.aspose.ms.System.IDisposable

        dispose
    • Method Detail

      • getGraphicContext

        GraphicContext getGraphicContext()

        Gets the graphic context

      • getGraphicContextClass

        Class<? extends GraphicContext> getGraphicContextClass()

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

      • saveGraphicContext

        void saveGraphicContext()

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

      • restoreGraphicContext

        void restoreGraphicContext()

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

      • beginDocument

        void beginDocument(Document document,
                           Class<? extends GraphicContext> clazz)

        Begins rendering of the document.

        Parameters:
        document - The document.
      • endDocument

        void endDocument()

        Ends rendering of the document.

      • beginPage

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

        Begins rendering of the new page.

        Parameters:
        size - Size of the page.
      • endPage

        void endPage()

        Ends rendering of the current page.

      • beginElement

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

        Begins rendering of the html element.

        Parameters:
        element - The html element.
        rect - Bounding box of the node.
        Returns:
        Returns [true] if element should be processed.
      • endElement

        void endElement(Element element)

        Ends rendering of the html element.

        Parameters:
        element - The html element.
      • closePath

        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.

      • moveTo

        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.

        Parameters:
        pt - Point of where to move the path to.
      • lineTo

        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.

        Parameters:
        pt - Point of where to create the line to.
      • addRect

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

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

        Parameters:
        rect - A rectangle to draw.
      • cubicBezierTo

        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.

        Parameters:
        pt1 - Coordinates of first point
        pt2 - Coordinates of second point
        pt3 - Coordinates of third point
      • stroke

        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.

      • fill

        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.

        Parameters:
        mode - Filling mode specifies how the interior of a closed path is filled
      • clip

        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.

        Parameters:
        mode - Filling mode specifies how the interior of a closed path is clipped
      • strokeAndFill

        void strokeAndFill(int mode)

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

        Parameters:
        mode - Filling mode specifies how the interior of a closed path is filled.
      • fillText

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

        Fills the specified text string at the specified location.

        Parameters:
        text - String to fill.
        pt - Point that specifies the coordinates of the text.
      • strokeText

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

        Strokes the specified text string at the specified location.

        Parameters:
        text - String to stroke.
        pt - Point that specifies the coordinates where to start the text.
      • drawImage

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

        Draws the specified image.

        Parameters:
        data - An array of bytes representing the image.
        type - Image type.
        rect - A rectangel which determines position and size to draw.