PolygonShape

Inheritance: java.lang.Object, com.aspose.imaging.ObjectWithBounds, com.aspose.imaging.Shape

All Implemented Interfaces: com.aspose.imaging.IOrderedShape

public class PolygonShape extends Shape implements IOrderedShape

يمثل شكل مضلع.

المنشئات

المنشئالوصف
PolygonShape()يقوم بإنشاء مثيل جديد لفئة PolygonShape.
PolygonShape(PointF[] points)يقوم بإنشاء مثيل جديد لفئة PolygonShape.
PolygonShape(PointF[] points, boolean isClosed)يقوم بإنشاء مثيل جديد لفئة PolygonShape.

الطرق

طريقةالوصف
getPoints()يحصل أو يعيّن نقاط المنحنى.
setPoints(PointF[] value)يحصل أو يعيّن نقاط المنحنى.
isClosed()يحصل أو يعيّن قيمة تشير إلى ما إذا كان الشكل مغلقًا.
setClosed(boolean value)يحصل أو يعيّن قيمة تشير إلى ما إذا كان الشكل مغلقًا.
getBounds()يحصل على حدود الكائن.
getCenter()يحصل على مركز الشكل.
getSegments()يحصل على مقاطع الشكل.
hasSegments()يحصل على قيمة تشير إلى ما إذا كان الشكل يحتوي على مقاطع.
getStartPoint()يحصل على نقطة بدء الشكل.
getEndPoint()يحصل على نقطة نهاية الشكل.
reverse()يعكس ترتيب النقاط لهذا الشكل.
getBounds(Matrix matrix)يحصل على حدود الكائن.
getBounds(Matrix matrix, Pen pen)يحصل على حدود الكائن.
transform(Matrix transform)يطبق التحويل المحدد على الشكل.
equals(Object obj)يحدد ما إذا كان الكائن المحدد مساويًا للكائن الحالي.
hashCode()يعمل كدالة التجزئة الافتراضية.

Example: This example creates a new Image and draws a variety of shapes using Figures and GraphicsPath o…

هذا المثال ينشئ صورة جديدة ويرسم مجموعة متنوعة من الأشكال باستخدام Figures و GraphicsPath على سطح الصورة.

//ينشئ مثيلاً من BmpOptions ويضبط خصائصه المتنوعة.
com.aspose.imaging.imageoptions.BmpOptions bmpOptions = new com.aspose.imaging.imageoptions.BmpOptions();
bmpOptions.setBitsPerPixel(24);

//إنشاء مثيل من FileCreateSource وتعيينه كقيمة Source لمثيل BmpOptions.
//المعامل البولياني الثاني يحدد ما إذا كان الملف الذي سيتم إنشاؤه مؤقتًا أم لا.
bmpOptions.setSource(new com.aspose.imaging.sources.FileCreateSource("c:\\temp\\output.bmp", false));

//إنشاء نسخة من Image
com.aspose.imaging.Image image = com.aspose.imaging.Image.create(bmpOptions, 500, 500);
try {
    //إنشاء وتهيئة نسخة من فئة Graphics
    com.aspose.imaging.Graphics graphics = new com.aspose.imaging.Graphics(image);

    //مسح سطح Graphics
    graphics.clear(com.aspose.imaging.Color.getWheat());

    //إنشاء نسخة من فئة GraphicsPath
    com.aspose.imaging.GraphicsPath graphicspath = new com.aspose.imaging.GraphicsPath();

    //إنشاء نسخة من فئة Figure
    com.aspose.imaging.Figure figure1 = new com.aspose.imaging.Figure();

    //إضافة شكل إلى كائن Figure.
    figure1.addShape(new com.aspose.imaging.shapes.EllipseShape(new com.aspose.imaging.RectangleF(50, 50, 300, 300)));
    figure1.addShape(new com.aspose.imaging.shapes.PieShape(
            new com.aspose.imaging.RectangleF(
                    new com.aspose.imaging.PointF(110, 110),
                    new com.aspose.imaging.SizeF(200, 200)), 0, 90));

    //إنشاء نسخة من فئة Figure
    com.aspose.imaging.Figure figure2 = new com.aspose.imaging.Figure();

    //إضافة شكل إلى كائن Figure.
    figure2.addShape(new com.aspose.imaging.shapes.ArcShape(new com.aspose.imaging.RectangleF(10, 10, 300, 300), 0, 45));
    figure2.addShape(new com.aspose.imaging.shapes.PolygonShape(
            new com.aspose.imaging.PointF[]
                    {
                            new com.aspose.imaging.PointF(150, 10),
                            new com.aspose.imaging.PointF(150, 200),
                            new com.aspose.imaging.PointF(250, 300),
                            new com.aspose.imaging.PointF(350, 400)}, true));
    figure2.addShape(new com.aspose.imaging.shapes.RectangleShape(
            new com.aspose.imaging.RectangleF(
                    new com.aspose.imaging.PointF(250, 250),
                    new com.aspose.imaging.SizeF(200, 200))));

    //إضافة كائن Figure إلى GraphicsPath
    graphicspath.addFigures(new com.aspose.imaging.Figure[]{figure1, figure2});

    //رسم مسار باستخدام كائن Pen باللون الأسود
    graphics.drawPath(new com.aspose.imaging.Pen(com.aspose.imaging.Color.getBlack(), 2), graphicspath);

    // احفظ جميع التغييرات.
    image.save();
} finally {
    image.dispose();
}

PolygonShape()

public PolygonShape()

يقوم بإنشاء مثيل جديد لفئة PolygonShape.

PolygonShape(PointF[] points)

public PolygonShape(PointF[] points)

يقوم بإنشاء مثيل جديد لفئة PolygonShape.

Parameters:

معاملنوعالوصف
pointsPointF[]مصفوفة النقاط.

PolygonShape(PointF[] points, boolean isClosed)

public PolygonShape(PointF[] points, boolean isClosed)

يقوم بإنشاء مثيل جديد لفئة PolygonShape.

Parameters:

معاملنوعالوصف
pointsPointF[]مصفوفة النقاط.
isClosedbooleanإذا تم تعيينه إلى true فإن المضلع مغلق.

getPoints()

public PointF[] getPoints()

يحصل أو يعيّن نقاط المنحنى.

القيمة: نقاط المنحنى.

Returns: com.aspose.imaging.PointF[]

setPoints(PointF[] value)

public void setPoints(PointF[] value)

يحصل أو يعيّن نقاط المنحنى.

القيمة: نقاط المنحنى.

Parameters:

معاملنوعالوصف
valuePointF[]

isClosed()

public boolean isClosed()

يحصل أو يعيّن قيمة تشير إلى ما إذا كان الشكل مغلقًا.

القيمة: true إذا كان الشكل مغلقًا؛ وإلا false.

Returns: boolean

setClosed(boolean value)

public void setClosed(boolean value)

يحصل أو يعيّن قيمة تشير إلى ما إذا كان الشكل مغلقًا.

القيمة: true إذا كان الشكل مغلقًا؛ وإلا false.

Parameters:

معاملنوعالوصف
القيمةboolean

getBounds()

public RectangleF getBounds()

يحصل على حدود الكائن.

القيمة: حدود الكائن.

Returns: RectangleF

getCenter()

public PointF getCenter()

يحصل على مركز الشكل.

القيمة: مركز الشكل.

Returns: PointF

getSegments()

public ShapeSegment[] getSegments()

يحصل على مقاطع الشكل.

القيمة: مقاطع الشكل.

Returns: com.aspose.imaging.ShapeSegment[]

hasSegments()

public boolean hasSegments()

يحصل على قيمة تشير إلى ما إذا كان الشكل يحتوي على مقاطع.

القيمة: True إذا كان الشكل يحتوي على مقاطع؛ وإلا false.

Returns: boolean

getStartPoint()

public PointF getStartPoint()

يحصل على نقطة بدء الشكل.

القيمة: نقطة بداية الشكل.

Returns: PointF

getEndPoint()

public PointF getEndPoint()

يحصل على نقطة نهاية الشكل.

القيمة: نقطة نهاية الشكل.

Returns: PointF

reverse()

public void reverse()

يعكس ترتيب النقاط لهذا الشكل.

getBounds(Matrix matrix)

public RectangleF getBounds(Matrix matrix)

يحصل على حدود الكائن.

Parameters:

معاملنوعالوصف
matrixMatrixالمصفوفة التي سيتم تطبيقها قبل حساب الحدود.

Returns: RectangleF - The estimated object’s bounds.

getBounds(Matrix matrix, Pen pen)

public RectangleF getBounds(Matrix matrix, Pen pen)

يحصل على حدود الكائن.

Parameters:

معاملنوعالوصف
matrixMatrixالمصفوفة التي سيتم تطبيقها قبل حساب الحدود.
penPenالقلم المستخدم للكائن. يمكن أن يؤثر ذلك على حجم حدود الكائن.

Returns: RectangleF - The estimated object’s bounds.

transform(Matrix transform)

public void transform(Matrix transform)

يطبق التحويل المحدد على الشكل.

Parameters:

معاملنوعالوصف
transformMatrixالتحويل المراد تطبيقه.

equals(Object obj)

public boolean equals(Object obj)

يحدد ما إذا كان الكائن المحدد مساويًا للكائن الحالي.

Parameters:

معاملنوعالوصف
objjava.lang.Objectالكائن المقارن.

Returns: منطقي - نتيجة equals

hashCode()

public int hashCode()

يعمل كدالة التجزئة الافتراضية.

Returns: عدد صحيح - رمز تجزئة للكائن الحالي.