SvgGraphics2D Class

Summary: Provides drawing commmands to compose an Svg image.

Module: aspose.imaging.fileformats.svg.graphics

Full Name: aspose.imaging.fileformats.svg.graphics.SvgGraphics2D

Aspose.Imaging Version: 24.7.0

Constructors

NameDescription
SvgGraphics2D(image)Initializes a new instance of the SvgGraphics2D class.
SvgGraphics2D(width, height, dpi)Initializes a new instance of the SvgGraphics2D class.

Methods

NameDescription
draw_arc(pen, rect, start_angle, arc_angle)Draws an arc representing a portion of an ellipse specified by a Rectangle structure.
draw_cubic_bezier(pen, pt1, pt2, pt3, pt4)Draws the cubic bezier.
draw_image(image, origin)Draws the specified image at the specified location.
draw_image(image, origin, size)Draws the specified image of the specified size at the specified location.
draw_image(src_rect, dest_rect, image)Draws the specified portion of the specified image at the specified location and with the specified size.
draw_image_point_size(image, origin, size)Draws the specified image of the specified size at the specified location.
draw_image_src_dst_rects(src_rect, dest_rect, image)Draws the specified portion of the specified image at the specified location and with the specified size.
draw_line(pen, x1, y1, x2, y2)Draws the line.
draw_path(pen, path)Draws the path.
draw_rectangle(pen, x, y, width, height)Draws the rectangle.
draw_string(font, text, origin, text_color)Draws the text string.
end_recording()Gets the final Svg image which includes all drawing commands performed via SvgGraphics2D object.
fill_arc(pen, brush, rect, start_angle, arc_angle)Fills an arc representing a portion of an ellipse specified by a Rectangle structure.
fill_path(pen, brush, path)Fills the path.
fill_rectangle(pen, brush, x, y, width, height)Fills the rectangle.

Constructor: SvgGraphics2D(image)

 SvgGraphics2D(image) 

Initializes a new instance of the SvgGraphics2D class.

Parameters:

ParameterTypeDescription
imageSvgImageThe image to perform drawing operations on.

Constructor: SvgGraphics2D(width, height, dpi)

 SvgGraphics2D(width, height, dpi) 

Initializes a new instance of the SvgGraphics2D class.

Parameters:

ParameterTypeDescription
widthintThe width of the output Svg image.
heightintThe width of the output Svg image.
dpiintThe device resolution, e.g. 96 dots per inch.

Method: draw_arc(pen, rect, start_angle, arc_angle)

 draw_arc(pen, rect, start_angle, arc_angle) 

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

Parameters:

ParameterTypeDescription
penPenThe pen to draw the outline of the figure.
rectRectangleThe boundaries of the ellipse.
start_anglefloatThe angle in degrees measured clockwise from the x-axis to the starting point of the arc.
arc_anglefloatThe angle in degrees measured clockwise from the startAngle parameter to ending point of the arc.

Method: draw_cubic_bezier(pen, pt1, pt2, pt3, pt4)

 draw_cubic_bezier(pen, pt1, pt2, pt3, pt4) 

Draws the cubic bezier.

Parameters:

ParameterTypeDescription
penPenThe pen that determines the color, width, and style of the figure.
pt1PointFThe starting point of the curve.
pt2PointFThe first control point for the curve.
pt3PointFThe second control point for the curve.
pt4PointFThe ending point of the curve.

Method: draw_image(image, origin)

 draw_image(image, origin) 

Draws the specified image at the specified location.

Parameters:

ParameterTypeDescription
imageRasterImageThe drawn image.
originPointThe location of the drawn image.

Method: draw_image(image, origin, size)

 draw_image(image, origin, size) 

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

Parameters:

ParameterTypeDescription
imageRasterImageThe drawn image.
originPointThe location of the drawn image.
sizeSizeThe desired size of the drawn image.

Method: draw_image(src_rect, dest_rect, image)

 draw_image(src_rect, dest_rect, image) 

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

Parameters:

ParameterTypeDescription
src_rectRectangleThe portion of the image object to draw.
dest_rectRectangleThe location and size of the drawn image. The image is scaled to fit the rectangle.
imageRasterImageThe image to draw.

Method: draw_image_point_size(image, origin, size)

 draw_image_point_size(image, origin, size) 

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

Parameters:

ParameterTypeDescription
imageRasterImageThe drawn image.
originPointThe location of the drawn image.
sizeSizeThe desired size of the drawn image.

Method: draw_image_src_dst_rects(src_rect, dest_rect, image)

 draw_image_src_dst_rects(src_rect, dest_rect, image) 

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

Parameters:

ParameterTypeDescription
src_rectRectangleThe portion of the image object to draw.
dest_rectRectangleThe location and size of the drawn image. The image is scaled to fit the rectangle.
imageRasterImageThe image to draw.

Method: draw_line(pen, x1, y1, x2, y2)

 draw_line(pen, x1, y1, x2, y2) 

Draws the line.

Parameters:

ParameterTypeDescription
penPenThe pen that determines the color, width, and style of the figure.
x1intThe x-coordinate of the first point.
y1intThe y-coordinate of the first point.
x2intThe x-coordinate of the second point.
y2intThe y-coordinate of the second point.

Method: draw_path(pen, path)

 draw_path(pen, path) 

Draws the path.

Parameters:

ParameterTypeDescription
penPenThe pen to draw the outline of the figure.
pathGraphicsPathThe path to draw.

Method: draw_rectangle(pen, x, y, width, height)

 draw_rectangle(pen, x, y, width, height) 

Draws the rectangle.

Parameters:

ParameterTypeDescription
penPenThe pen to draw the outline of the figure.
xintThe x-coordinate of the upper-left corner of the rectangle to draw.
yintThe y-coordinate of the upper-left corner of the rectangle to draw.
widthintThe width of the rectangle to draw.
heightintThe height of the rectangle to draw.

Method: draw_string(font, text, origin, text_color)

 draw_string(font, text, origin, text_color) 

Draws the text string.

Parameters:

ParameterTypeDescription
fontFontThe font used to render text.
textstringThe unicode text string.
originPointThe top-left corner of the text run.
text_colorColorThe text color.

Method: end_recording()

 end_recording() 

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

Returns

TypeDescription
SvgImageThe final Svg image.

Method: fill_arc(pen, brush, rect, start_angle, arc_angle)

 fill_arc(pen, brush, rect, start_angle, arc_angle) 

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

Parameters:

ParameterTypeDescription
penPenThe pen to draw the outline of the figure.
brushBrushThe brush to fill the interior of the figure.
rectRectangleThe boundaries of the ellipse.
start_anglefloatThe angle in degrees measured clockwise from the x-axis to the starting point of the arc.
arc_anglefloatThe angle in degrees measured clockwise from the startAngle parameter to ending point of the arc.

Method: fill_path(pen, brush, path)

 fill_path(pen, brush, path) 

Fills the path.

Parameters:

ParameterTypeDescription
penPenThe pen to draw the outline of the figure.
brushBrushThe brush to fill the interior of the figure.
pathGraphicsPathThe path to draw.

Method: fill_rectangle(pen, brush, x, y, width, height)

 fill_rectangle(pen, brush, x, y, width, height) 

Fills the rectangle.

Parameters:

ParameterTypeDescription
penPenThe pen to draw the outline of the figure.
brushBrushThe brush to fill the interior of the figure.
xintThe x-coordinate of the upper-left corner of the rectangle to draw.
yintThe y-coordinate of the upper-left corner of the rectangle to draw.
widthintThe width of the rectangle to draw.
heightintThe height of the rectangle to draw.