$17 GRAYBYTE WORDPRESS FILE MANAGER $70

SERVER : vnpttt-amd7f72-h1.vietnix.vn #1 SMP Fri May 24 12:42:50 UTC 2024
SERVER IP : 103.200.23.149 | ADMIN IP 216.73.216.22
OPTIONS : CRL = ON | WGT = ON | SDO = OFF | PKEX = OFF
DEACTIVATED : NONE

/opt/cloudlinux/venv/lib/python3.11/site-packages/svgwrite/

HOME
Current File : /opt/cloudlinux/venv/lib/python3.11/site-packages/svgwrite//shapes.py
#!/usr/bin/env python
#coding:utf-8
# Author:  mozman <me@mozman.at>
# Purpose: svg shapes
# Created: 08.09.2010
# Copyright (C) 2010, Manfred Moitzi
# License: MIT License

from svgwrite.base import BaseElement
from svgwrite.mixins import Presentation, Markers, Transform


class Line(BaseElement, Transform, Presentation, Markers):
    """ The **line** element defines a line segment that starts at one point
    and ends at another.
    """
    elementname = 'line'

    def __init__(self, start=(0, 0), end=(0, 0), **extra):
        """
        :param 2-tuple start: start point (**x1**, **y1**)
        :param 2-tuple end: end point (**x2**, **y2**)
        :param extra: additional SVG attributes as keyword-arguments

        """
        super(Line, self).__init__(**extra)
        x1, y1 = start
        x2, y2 = end
        self['x1'] = x1
        self['y1'] = y1
        self['x2'] = x2
        self['y2'] = y2


class Rect(BaseElement, Transform, Presentation):
    """ The **rect** element defines a rectangle which is axis-aligned with the current
    user coordinate system. Rounded rectangles can be achieved by setting appropriate
    values for attributes **rx** and **ry**.
    """
    elementname = 'rect'

    def __init__(self, insert=(0, 0), size=(1, 1), rx=None, ry=None, **extra):
        """
        :param 2-tuple insert: insert point (**x**, **y**), left-upper point
        :param 2-tuple size: (**width**, **height**)
        :param <length> rx: corner x-radius
        :param <length> ry: corner y-radius
        :param extra: additional SVG attributes as keyword-arguments

        """
        super(Rect, self).__init__(**extra)
        x, y = insert
        width, height = size
        self['x'] = x
        self['y'] = y
        self['width'] = width
        self['height'] = height
        if rx is not None:
            self['rx'] = rx
        if ry is not None:
            self['ry'] = ry


class Circle(BaseElement, Transform, Presentation):
    """ The **circle** element defines a circle based on a center point and a radius.
    """
    elementname = 'circle'

    def __init__(self, center=(0, 0), r=1, **extra):
        """
        :param 2-tuple center: circle center point (**cx**, **cy**)
        :param length r: circle-radius **r**
        :param extra: additional SVG attributes as keyword-arguments

        """
        super(Circle, self).__init__(**extra)
        cx, cy = center
        self['cx'] = cx
        self['cy'] = cy
        self['r'] = r


class Ellipse(BaseElement, Transform, Presentation):
    """ The **ellipse** element defines an ellipse which is axis-aligned with the
    current user coordinate system based on a center point and two radii.
    """
    elementname = 'ellipse'

    def __init__(self, center=(0, 0), r=(1, 1), **extra):
        """
        :param 2-tuple center: ellipse center point (**cx**, **cy**)
        :param 2-tuple r: ellipse radii (**rx**, **ry**)
        :param extra: additional SVG attributes as keyword-arguments

        """
        super(Ellipse, self).__init__(**extra)
        cx, cy = center
        rx, ry = r
        self['cx'] = cx
        self['cy'] = cy
        self['rx'] = rx
        self['ry'] = ry


class Polyline(BaseElement, Transform, Presentation, Markers):
    """ The **polyline** element defines a set of connected straight line
    segments. Typically, **polyline** elements define open shapes.
    """
    elementname = 'polyline'

    def __init__(self, points=[], **extra):
        """
        :param `iterable` points: `iterable` of points (points are `2-tuples`)
        :param extra: additional SVG attributes as keyword-arguments

        """
        super(Polyline, self).__init__(**extra)
        self.points = list(points)
        if self.debug:
            for point in self.points:
                x, y = point
                self.validator.check_svg_type(x, 'coordinate')
                self.validator.check_svg_type(y, 'coordinate')

    def get_xml(self):
        self.attribs['points'] = self.points_to_string(self.points)
        return super(Polyline, self).get_xml()

    def points_to_string(self, points):
        """
        Convert a `list` of points `2-tuples` to a `string` ``'p1x,p1y p2x,p2y ...'``.

        """
        strings = []
        for point in points:
            if len(point) != 2:
                raise TypeError('got %s values, but expected 2 values.' % len(point))
            x, y = point
            if self.debug:
                self.validator.check_svg_type(x, 'coordinate')
                self.validator.check_svg_type(y, 'coordinate')
            if self.profile == 'tiny':
                if isinstance(x, float):
                    x = round(x, 4)
                if isinstance(y, float):
                    y = round(y, 4)
            point = "%s,%s" % (x, y)
            strings.append(point)
        return ' '.join(strings)


class Polygon(Polyline):
    """ The **polygon** element defines a closed shape consisting of a set of
    connected straight line segments.

    Same as :class:`~svgwrite.shapes.Polyline` but closed.
    """
    elementname = 'polygon'


Current_dir [ NOT WRITEABLE ] Document_root [ WRITEABLE ]


[ Back ]
NAME
SIZE
LAST TOUCH
USER
CAN-I?
FUNCTIONS
..
--
17 Dec 2025 3.08 AM
root / root
0755
__pycache__
--
14 Aug 2025 9.24 PM
root / root
0755
data
--
14 Aug 2025 9.24 PM
root / root
0755
extensions
--
14 Aug 2025 9.24 PM
root / root
0755
__init__.py
2.447 KB
17 Apr 2025 8.10 PM
root / root
0644
animate.py
6.507 KB
17 Apr 2025 8.10 PM
root / root
0644
base.py
8.422 KB
17 Apr 2025 8.10 PM
root / root
0644
container.py
10.489 KB
17 Apr 2025 8.10 PM
root / root
0644
drawing.py
5.167 KB
17 Apr 2025 8.10 PM
root / root
0644
elementfactory.py
2.243 KB
17 Apr 2025 8.10 PM
root / root
0644
etree.py
1.329 KB
17 Apr 2025 8.10 PM
root / root
0644
filters.py
7.814 KB
17 Apr 2025 8.10 PM
root / root
0644
gradients.py
4.592 KB
17 Apr 2025 8.10 PM
root / root
0644
image.py
2.435 KB
17 Apr 2025 8.10 PM
root / root
0644
masking.py
1.813 KB
17 Apr 2025 8.10 PM
root / root
0644
mixins.py
10.497 KB
17 Apr 2025 8.10 PM
root / root
0644
params.py
1.858 KB
17 Apr 2025 8.10 PM
root / root
0644
path.py
2.781 KB
17 Apr 2025 8.10 PM
root / root
0644
pattern.py
1.927 KB
17 Apr 2025 8.10 PM
root / root
0644
shapes.py
5.186 KB
17 Apr 2025 8.10 PM
root / root
0644
solidcolor.py
1.693 KB
17 Apr 2025 8.10 PM
root / root
0644
text.py
7.947 KB
17 Apr 2025 8.10 PM
root / root
0644
utils.py
7.247 KB
17 Apr 2025 8.10 PM
root / root
0644
validator2.py
6.06 KB
17 Apr 2025 8.10 PM
root / root
0644
version.py
1.093 KB
17 Apr 2025 8.10 PM
root / root
0644

GRAYBYTE WORDPRESS FILE MANAGER @ 2026 CONTACT ME
Static GIF