EllipseShape-klass
Innehåll
[
Dölj
]Summary: Represents an ellipse shape.
Module: aspose.imaging.shapes
Full Name: aspose.imaging.shapes.EllipseShape
Inheritance: RectangleShape
Constructors
| Name | Description |
|---|---|
| EllipseShape() | Initierar en ny instans av klassen EllipseShape. |
| EllipseShape(rectangle) | Initierar en ny instans av klassen EllipseShape. |
Properties
| Name | Type | Access | Description |
|---|---|---|---|
| bounds | RectangleF | r | Hämtar objektets gränser. |
| center | PointF | r | Hämtar figurens centrum. |
| has_segments | bool | r | Hämtar ett värde som indikerar om figuren har segment. |
| left_bottom | PointF | r | Hämtar den vänstra nedre rektangelpunkten. |
| left_top | PointF | r | Hämtar den vänstra övre rektangelpunkten. |
| rectangle_height | float | r | Hämtar rektangelns höjd. |
| rectangle_width | float | r | Hämtar rektangelns bredd. |
| right_bottom | PointF | r | Hämtar den högra nedre rektangelpunkten. |
| right_top | PointF | r | Hämtar den högra övre rektangelpunkten. |
| segments | ShapeSegment[] | r | Hämtar figurens segment. |
Methods
| Name | Description |
|---|---|
| get_bounds(matrix) | Hämtar objektets gränser. |
| get_bounds(matrix, pen) | Hämtar objektets gränser. |
| transform(transform) | Tillämpar den angivna transformationen på formen. |
Constructor: EllipseShape()
EllipseShape()
Initierar en ny instans av klassen EllipseShape.
Constructor: EllipseShape(rectangle)
EllipseShape(rectangle)
Initierar en ny instans av klassen EllipseShape.
Parameters:
| Parameter | Typ | Beskrivning |
|---|---|---|
| rectangle | RectangleF | Rektangeln. |
See also:
Example # 1: This examples make use of GraphicsPath and Graphics classes to create and man…
Method: get_bounds(matrix)
get_bounds(matrix)
Hämtar objektets gränser.
Parameters:
| Parameter | Typ | Beskrivning |
|---|---|---|
| matrix | Matrix | Matrisen att tillämpa innan gränserna beräknas. |
Returns
| Typ | Beskrivning |
|---|---|
| RectangleF | Det uppskattade objektets gränser. |
Method: get_bounds(matrix, pen)
get_bounds(matrix, pen)
Hämtar objektets gränser.
Parameters:
| Parameter | Typ | Beskrivning |
|---|---|---|
| matrix | Matrix | Matrisen att tillämpa innan gränserna beräknas. |
| pen | Pen | Pennan att använda för objektet. Detta kan påverka objektets gränsstorlek. |
Returns
| Typ | Beskrivning |
|---|---|
| RectangleF | Det uppskattade objektets gränser. |
Method: transform(transform)
transform(transform)
Tillämpar den angivna transformationen på formen.
Parameters:
| Parameter | Typ | Beskrivning |
|---|---|---|
| transform | Matrix | Transformationen att tillämpa. |
Examples
This examples make use of GraphicsPath and Graphics classes to create and manipulate figures on an Image surface. Example creates a new Image (of type Tiff), clears the surface and draws paths with the help of GraphicsPath class. At the end draw_path method exposed by Graphics class is called to render the paths on surface.
from aspose.imaging import Image, Graphics, Color, GraphicsPath, Figure, RectangleF, PointF, SizeF
from aspose.imaging import Pen
from aspose.imaging.sources import StreamSource
from aspose.imaging.imageoptions import TiffOptions
from aspose.imaging.fileformats.tiff.enums import TiffExpectedFormat
from aspose.imaging.shapes import RectangleShape, EllipseShape, PieShape
# Skapa en instans av en filström
with open(r"C:\temp\output.tiff", "w+b") as stream:
# Skapa en instans av TiffOptions och ställ in dess olika egenskaper
tiffOptions = TiffOptions(TiffExpectedFormat.DEFAULT)
# Ange källan för instansen av ImageOptions
tiffOptions.source = StreamSource(stream)
# Skapa en instans av Image
with Image.create(tiffOptions, 500, 500) as image:
# Skapa och initiera en instans av Graphics-klassen
graphics = Graphics(image)
# Rensa Graphics-ytan
graphics.clear(Color.wheat);
# Skapa en instans av klassen GraphicsPath
graphics_path = GraphicsPath()
# Skapa en instans av klassen Figure
figure = Figure()
# Lägg till former till Figure-objektet
figure.add_shape(RectangleShape(RectangleF(10.0, 10.0, 300.0, 300.0)))
figure.add_shape(EllipseShape(RectangleF(50.0, 50.0, 300.0, 300.0)))
figure.add_shape(PieShape(RectangleF(PointF(250.0, 250.0), SizeF(200.0, 200.0)), 0.0, 45.0))
# Lägg till Figure-objektet till GraphicsPath
graphics_path.add_figure(figure)
# Rita bana med Pen-objektet i färgen svart
graphics.draw_path(Pen(Color.black, 2.0), graphics_path)
# spara alla ändringar.
image.save()
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
#Skapar en instans av BmpOptions och ställer in dess olika egenskaper
with BmpOptions() as bmpOptions:
bmpOptions.bits_per_pixel = 24
#Skapa en instans av FileCreateSource och tilldela den som källa för instansen av BmpOptions
#Den andra booleska parametern bestämmer om filen som ska skapas är temporär eller inte
bmpOptions.source = FileCreateSource(r"c:\temp\output.bmp", False)
#Skapa en instans av Image
with Image.create(bmpOptions, 500, 500) as image:
# Skapa och initiera en instans av Graphics-klassen
graphics = Graphics(image)
# Rensa Graphics-ytan
graphics.clear(Color.wheat)
# Skapa en instans av klassen GraphicsPath
graphicspath = GraphicsPath()
#Skapa en instans av klassen Figure
figure1 = Figure()
# Lägg till form till Figure-objektet
figure1.add_shape(EllipseShape(RectangleF(50, 50, 300, 300)))
figure1.add_shape(PieShape(Rectangle(Point(110, 110), Size(200, 200)), 0, 90))
# Skapa en instans av klassen Figure
figure2 = Figure()
# Lägg till form till Figure-objektet
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))))
# Lägg till Figure-objektet till GraphicsPath
graphicspath.add_figures([figure1, figure2])
# Rita bana med Pen-objektet i färgen svart
graphics.draw_path(Pen(Color.black, 2.0), graphicspath)
# spara alla ändringar.
image.save()