Wand path_elliptic_arc() function in Python

path_elliptic_arc() is a function specially introduced for paths. path_elliptic_arc() draws an elliptical arc from current point to a particular point we want the arc to drawn to. 
Let’s see parameters needed for this function.
 

Syntax : 
 

wand.drawing.path_elliptic_arc(to, radius, rotation, large_arc, clockwise, relative)

Parameters:

 

Parameter Input Type Description
to sequence or (numbers.Real, numbers.Real) pair which represents coordinates to draw to.
radius collections.abc.sequence or (numbers.Real, numbers.Real) pair which represents the radii of the ellipse to draw.
rotate bool degree to rotate ellipse on x-axis.
large_arc bool draw largest available arc.
clockwise bool draw arc path clockwise from start to target.
relative bool treat given coordinates as relative to current point.

 

Example : Draw an elliptical curve. 
 

Python3




from wand.image import Image
from wand.drawing import Drawing
from wand.color import Color
 
with Drawing() as draw:
    draw.stroke_width = 2
    draw.stroke_color = Color('black')
    draw.fill_color = Color('white')
    draw.path_start()
    # Start middle-left
    draw.path_move(to =(10, 100))
    # draw elliptical curve
    draw.path_elliptic_arc(to =(10, 180),
                           radius = (20, 40),
                           rotation = 270,
                           large_arc = True,
                           clockwise = True,
                           relative = True )
    with Image(width = 200, height = 200, background = Color('lightgreen')) as image:
        draw(image)
        image.save(filename ="pathcurve.png")


Output : 
 

 

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button