Packages

 

com.aspose.imaging.fileformats.svg.graphics

Class SvgGraphics2D



  • public class SvgGraphics2D
    extends Object

    Provides drawing commmands to compose an Svg image.

    • Constructor Detail

      • SvgGraphics2D

        public SvgGraphics2D(int width,
                             int height,
                             int dpi)

        Initializes a new instance of the SvgGraphics2D class.

        Parameters:
        width - The width of the output Svg image.
        height - The width of the output Svg image.
        dpi - The device resolution, e.g. 96 dots per inch.
      • SvgGraphics2D

        public SvgGraphics2D(SvgImage image)

        Initializes a new instance of the SvgGraphics2D class.

        Parameters:
        image - The image to perform drawing operations on.
    • Method Detail

      • drawImage

        public final void drawImage(RasterImage image,
                                    Point origin)

        Draws the specified image at the specified location.

        Parameters:
        image - The drawn image.
        origin - The location of the drawn image.
      • drawImage

        public final void drawImage(RasterImage image,
                                    Point origin,
                                    Size size)

        Draws the specified image of the specified size at the specified location.

        Parameters:
        image - The drawn image.
        origin - The location of the drawn image.
        size - The desired size of the drawn image.
      • drawImage

        public final void drawImage(Rectangle srcRect,
                                    Rectangle destRect,
                                    RasterImage image)

        Draws the specified portion of the specified image at the specified location and with the specified size.

        Parameters:
        srcRect - The portion of the image object to draw.
        destRect - The location and size of the drawn image. The image is scaled to fit the rectangle.
        image - The image to draw.
      • drawArc

        public final void drawArc(Pen pen,
                                  Rectangle rect,
                                  float startAngle,
                                  float arcAngle)

        Draws an arc representing a portion of an ellipse specified by a Rectangle structure.

        Parameters:
        pen - The pen to draw the outline of the figure.
        rect - The boundaries of the ellipse.
        startAngle - The angle in degrees measured clockwise from the x-axis to the starting point of the arc.
        arcAngle - The angle in degrees measured clockwise from the startAngle parameter to ending point of the arc.
      • fillArc

        public final void fillArc(Pen pen,
                                  Brush brush,
                                  Rectangle rect,
                                  float startAngle,
                                  float arcAngle)

        Fills an arc representing a portion of an ellipse specified by a Rectangle structure.

        Parameters:
        pen - The pen to draw the outline of the figure.
        brush - The brush to fill the interior of the figure.
        rect - The boundaries of the ellipse.
        startAngle - The angle in degrees measured clockwise from the x-axis to the starting point of the arc.
        arcAngle - The angle in degrees measured clockwise from the startAngle parameter to ending point of the arc.
      • drawCubicBezier

        public final void drawCubicBezier(Pen pen,
                                          PointF pt1,
                                          PointF pt2,
                                          PointF pt3,
                                          PointF pt4)

        Draws the cubic bezier.

        Parameters:
        pen - The pen that determines the color, width, and style of the figure.
        pt1 - The starting point of the curve.
        pt2 - The first control point for the curve.
        pt3 - The second control point for the curve.
        pt4 - The ending point of the curve.
      • drawString

        public final void drawString(Font font,
                                     String text,
                                     Point origin,
                                     Color textColor)

        Draws the text string.

        Parameters:
        font - The font used to render text.
        text - The unicode text string.
        origin - The top-left corner of the text run.
        textColor - The text color.
      • drawLine

        public final void drawLine(Pen pen,
                                   int x1,
                                   int y1,
                                   int x2,
                                   int y2)

        Draws the line.

        Parameters:
        pen - The pen that determines the color, width, and style of the figure.
        x1 - The x-coordinate of the first point.
        y1 - The y-coordinate of the first point.
        x2 - The x-coordinate of the second point.
        y2 - The y-coordinate of the second point.
      • drawPath

        public final void drawPath(Pen pen,
                                   GraphicsPath path)

        Draws the path.

        Parameters:
        pen - The pen to draw the outline of the figure.
        path - The path to draw.
      • fillPath

        public final void fillPath(Pen pen,
                                   Brush brush,
                                   GraphicsPath path)

        Fills the path.

        Parameters:
        pen - The pen to draw the outline of the figure.
        brush - The brush to fill the interior of the figure.
        path - The path to draw.
      • drawRectangle

        public final void drawRectangle(Pen pen,
                                        int x,
                                        int y,
                                        int width,
                                        int height)

        Draws the rectangle.

        Parameters:
        pen - The pen to draw the outline of the figure.
        x - The x-coordinate of the upper-left corner of the rectangle to draw.
        y - The y-coordinate of the upper-left corner of the rectangle to draw.
        width - The width of the rectangle to draw.
        height - The height of the rectangle to draw.
      • fillRectangle

        public final void fillRectangle(Pen pen,
                                        Brush brush,
                                        int x,
                                        int y,
                                        int width,
                                        int height)

        Fills the rectangle.

        Parameters:
        pen - The pen to draw the outline of the figure.
        brush - The brush to fill the interior of the figure.
        x - The x-coordinate of the upper-left corner of the rectangle to draw.
        y - The y-coordinate of the upper-left corner of the rectangle to draw.
        width - The width of the rectangle to draw.
        height - The height of the rectangle to draw.
      • endRecording

        public final SvgImage endRecording()

        Gets the final Svg image which includes all drawing commands performed via SvgGraphics2D object.

        Returns:
        The final Svg image.