MOON
Server: Apache
System: Linux server30c.hostingraja.org 3.10.0-962.3.2.lve1.5.63.el7.x86_64 #1 SMP Fri Oct 8 12:03:35 UTC 2021 x86_64
User: jibhires (1887)
PHP: 8.1.30
Disabled: show_source, system, shell_exec, passthru, exec, popen, proc_open, allow_url_fopen, symlink, escapeshellcmd, pcntl_exec
Upload Files
File: //opt/alt/python27/share/doc/alt-python27-pycairo-1.8.6/examples/cairo_snippets/snippets/ellipse.py
snippet_normalize(cr, width, height)

def path_ellipse(cr, x, y, width, height, angle=0):
    """
    x      - center x
    y      - center y
    width  - width of ellipse  (in x direction when angle=0)
    height - height of ellipse (in y direction when angle=0)
    angle  - angle in radians to rotate, clockwise
    """
    cr.save()
    cr.translate(x, y)
    cr.rotate(angle)
    cr.scale(width / 2.0, height / 2.0)
    cr.arc(0.0, 0.0, 1.0, 0.0, 2.0 * M_PI)
    cr.restore()


path_ellipse(cr, 0.5, 0.5, 1.0, 0.3, M_PI/4.0)

# fill
cr.set_source_rgba(1,0,0,1)
cr.fill_preserve()

# stroke
# reset identity matrix so line_width is a constant
# width in device-space, not user-space
cr.save()
cr.identity_matrix()
cr.set_source_rgba(0,0,0,1)
cr.set_line_width(3)
cr.stroke()
cr.restore()