ArcShape 类

Summary: Represents an arc shape.

Module: aspose.imaging.shapes

Full Name: aspose.imaging.shapes.ArcShape

Inheritance: IOrderedShape, PieShape

Constructors

Name描述
ArcShape()初始化 ArcShape 类的新实例。
ArcShape(rectangle, start_angle, sweep_angle)初始化 ArcShape 类的新实例。
ArcShape(rectangle, start_angle, sweep_angle, is_closed)初始化 ArcShape 类的新实例。

Properties

NameTypeAccess描述
boundsRectangleFr获取对象的边界。
centerPointFr获取形状的中心。
end_pointPointFr获取结束形状点。
has_segmentsboolr获取一个值,指示形状是否具有段。
is_closedboolr/w获取或设置一个值,指示有序形状是否闭合。在处理闭合的有序形状时,起始点和结束点没有意义。
left_bottomPointFr获取左下矩形点。
left_topPointFr获取左上矩形点。
rectangle_heightfloatr获取矩形高度。
rectangle_widthfloatr获取矩形宽度。
right_bottomPointFr获取右下矩形点。
right_topPointFr获取右上矩形点。
segmentsShapeSegment[]r获取形状的段。
start_anglefloatr/w获取或设置起始角度。
start_pointPointFr获取起始形状点。
sweep_anglefloatr/w获取或设置扫掠角度。

Methods

Name描述
get_bounds(matrix)获取对象的边界。
get_bounds(matrix, pen)获取对象的边界。
reverse()反转此形状的点顺序。
transform(transform)对形状应用指定的变换。

Constructor: ArcShape()

 ArcShape() 

初始化 ArcShape 类的新实例。

Constructor: ArcShape(rectangle, start_angle, sweep_angle)

 ArcShape(rectangle, start_angle, sweep_angle) 

初始化 ArcShape 类的新实例。

Parameters:

参数TypeDescription
rectangleRectangleF矩形。
start_anglefloat起始角度。
sweep_anglefloat扫掠角。

See also:

Example # 1: This example creates a new Image and draws a variety of shapes using figures …

Constructor: ArcShape(rectangle, start_angle, sweep_angle, is_closed)

 ArcShape(rectangle, start_angle, sweep_angle, is_closed) 

初始化 ArcShape 类的新实例。

Parameters:

参数TypeDescription
rectangleRectangleF矩形。
start_anglefloat起始角度。
sweep_anglefloat扫掠角。
is_closedbool如果设置为 true,arc 将闭合。闭合的 arc 实际上退化为椭圆。

Method: get_bounds(matrix)

 get_bounds(matrix) 

获取对象的边界。

Parameters:

参数TypeDescription
matrixMatrix在计算边界之前要应用的矩阵。

Returns

TypeDescription
RectangleF估计的对象边界。

Method: get_bounds(matrix, pen)

 get_bounds(matrix, pen) 

获取对象的边界。

Parameters:

参数TypeDescription
matrixMatrix在计算边界之前要应用的矩阵。
penPen用于对象的笔。这可能会影响对象边界的大小。

Returns

TypeDescription
RectangleF估计的对象边界。

Method: transform(transform)

 transform(transform) 

对形状应用指定的变换。

Parameters:

参数TypeDescription
transformMatrix要应用的变换。

Examples

This example creates a new Image and draws a variety of shapes using figures and GraphicsPath on the Image surface


from aspose.imaging import Image, Graphics, Color, GraphicsPath, Figure, RectangleF, Rectangle, Size
from aspose.imaging import Point, PointF, Pen
from aspose.imaging.imageoptions import BmpOptions
from aspose.imaging.sources import FileCreateSource
from aspose.imaging.shapes import EllipseShape, PieShape, ArcShape, PolygonShape, RectangleShape
from os.path import join as path_join

#创建 BmpOptions 的实例并设置其各种属性            
with BmpOptions() as bmpOptions:
	bmpOptions.bits_per_pixel = 24
	#创建 FileCreateSource 的实例并将其分配为 BmpOptions 实例的 Source
	#第二个布尔参数决定要创建的文件是否为临时文件
	bmpOptions.source = FileCreateSource(r"c:\temp\output.bmp", False)
	#创建 Image 实例
	with Image.create(bmpOptions, 500, 500) as image:
		# 创建并初始化 Graphics 类的实例
		graphics = Graphics(image)
		# 清除 Graphics 表面
		graphics.clear(Color.wheat)
		# 创建 GraphicsPath 类的实例
		graphicspath = GraphicsPath()
		#创建 Figure 类的实例
		figure1 = Figure()
		# 向 Figure 对象添加形状
		figure1.add_shape(EllipseShape(RectangleF(50, 50, 300, 300)))
		figure1.add_shape(PieShape(Rectangle(Point(110, 110), Size(200, 200)), 0, 90))
		# 创建 Figure 类的实例
		figure2 = Figure()
		# 向 Figure 对象添加形状
		figure2.add_shape(ArcShape(RectangleF(10, 10, 300, 300), 0, 45))
		figure2.add_shape(
			PolygonShape([PointF(150, 10), PointF(150, 200), PointF(250, 300), PointF(350, 400)], True))
		figure2.add_shape(RectangleShape(RectangleF(Point(250, 250), Size(200, 200))))
		# 将 Figure 对象添加到 GraphicsPath
		graphicspath.add_figures([figure1, figure2])
		# 使用颜色为 Black 的 Pen 对象绘制路径
		graphics.draw_path(Pen(Color.black, 2.0), graphicspath)
		# 保存所有更改。
		image.save()