فئة PolygonShape
محتويات
[
يخفي
]Summary: Represents a polygon shape.
Module: aspose.imaging.shapes
Full Name: aspose.imaging.shapes.PolygonShape
Inheritance: IOrderedShape, Shape
Constructors
| Name | الوصف |
|---|---|
| PolygonShape() | ينشئ نسخة جديدة من الفئة PolygonShape. |
| PolygonShape(points) | ينشئ نسخة جديدة من الفئة PolygonShape. |
| PolygonShape(points, is_closed) | ينشئ نسخة جديدة من الفئة PolygonShape. |
Properties
| Name | Type | Access | الوصف |
|---|---|---|---|
| bounds | RectangleF | r | يحصل على حدود الكائن. |
| center | PointF | r | يحصل على مركز الشكل. |
| end_point | PointF | r | يحصل على نقطة النهاية للشكل. |
| has_segments | bool | r | يحصل على قيمة تشير إلى ما إذا كان الشكل يحتوي على مقاطع. |
| is_closed | bool | r/w | يحصل أو يعيّن قيمة تشير إلى ما إذا كان الشكل مغلقًا. |
| points | PointF[] | r/w | يحصل أو يعيّن نقاط المنحنى. |
| segments | ShapeSegment[] | r | يحصل على مقاطع الشكل. |
| start_point | PointF | r | يحصل على نقطة بداية الشكل. |
Methods
| Name | الوصف |
|---|---|
| get_bounds(matrix) | يحصل على حدود الكائن. |
| get_bounds(matrix, pen) | يحصل على حدود الكائن. |
| reverse() | يعكس ترتيب النقاط لهذا الشكل. |
| transform(transform) | يطبق التحويل المحدد على الشكل. |
Constructor: PolygonShape()
PolygonShape()
ينشئ نسخة جديدة من الفئة PolygonShape.
Constructor: PolygonShape(points)
PolygonShape(points)
ينشئ نسخة جديدة من الفئة PolygonShape.
Parameters:
| معامل | نوع | الوصف |
|---|---|---|
| points | PointF[] | مصفوفة النقاط. |
Constructor: PolygonShape(points, is_closed)
PolygonShape(points, is_closed)
ينشئ نسخة جديدة من الفئة PolygonShape.
Parameters:
| معامل | نوع | الوصف |
|---|---|---|
| points | PointF[] | مصفوفة النقاط. |
| is_closed | bool | إذا تم تعيينه إلى |
Method: get_bounds(matrix)
get_bounds(matrix)
يحصل على حدود الكائن.
Parameters:
| معامل | نوع | الوصف |
|---|---|---|
| matrix | Matrix | المصفوفة التي سيتم تطبيقها قبل حساب الحدود. |
Returns
| نوع | الوصف |
|---|---|
| RectangleF | حدود الكائن المقدرة. |
Method: get_bounds(matrix, pen)
get_bounds(matrix, pen)
يحصل على حدود الكائن.
Parameters:
| معامل | نوع | الوصف |
|---|---|---|
| matrix | Matrix | المصفوفة التي سيتم تطبيقها قبل حساب الحدود. |
| pen | Pen | القلم المستخدم للكائن. يمكن أن يؤثر ذلك على حجم حدود الكائن. |
Returns
| نوع | الوصف |
|---|---|
| RectangleF | حدود الكائن المقدرة. |
Method: transform(transform)
transform(transform)
يطبق التحويل المحدد على الشكل.
Parameters:
| معامل | نوع | الوصف |
|---|---|---|
| transform | Matrix | التحويل المراد تطبيقه. |
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
#المعامل البولياني الثاني يحدد ما إذا كان الملف الذي سيتم إنشاؤه IsTemporal أم لا
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])
# رسم المسار باستخدام كائن Pen باللون الأسود
graphics.draw_path(Pen(Color.black, 2.0), graphicspath)
# احفظ جميع التغييرات.
image.save()