Exemplo n.º 1
0
    def __init__(self, cx=0.0, cy=0.0, rx=0.0, ry=0.0, fill='black', 
                 stroke_width=1, stroke_opacity=1.0, opacity=1.0, stroke=rgb(255,255,255)):
        """
        :param cx: The ellipse center X-coord.
        :param cy: The ellipse center Y-coord.
        :param rx: The x axis radius of the ellipse.
        :param ry: The y axis radius of the ellipse.
        :param stroke_width: The width of the stroke of the perimeter of a shape.
        :param stroke_opacity: The opacity of the stroke-line.
        :param opacity: The opacity of the element in general.
        :param stroke: The color of the stroke-line.

        :type cx: int or float
        :type cy: int or float
        :param rx: int or float
        :param ry: int or float
        :type stroke_width: int of float
        :type stroke_opacity: float (0 <= num <= 1.0)
        :type opacity: float (0 <= num <= 1.0)
        :type stroke: rgb-tuple or hex-string
        """

        AbstractGeometry.__init__(self, x=cx, y=cy, stroke=stroke, opacity=opacity, 
                                  stroke_opacity=stroke_opacity, stroke_width=stroke_width)
        self.fill = fill
        self.rx = rx
        self.ry = ry
        self.cx = self.x
        self.cy = self.y

        self.attribute_filter = ['rx', 'ry', 'cx', 'cy', 'stroke', 'opacity',
                                 'fill', 'stroke_width', 'stroke_opacity']
Exemplo n.º 2
0
    def __init__(self, x=0, y=0, width=0, height=0, rx=0, ry=0, 
                 fill='red', opacity=1.0, stroke=rgb(0,0,0), stroke_width=1, 
                 stroke_opacity=1.0):
        """
        :param x: The center X-coord.
        :param y: The center Y-coord.
        :param rx: Corner rounding on the x axis.
        :param ry: Corner rounding on the y axis.
        :param stroke_width: The width of the stroke of the 
            perimeter of a shape.
        :param stroke_opacity: The opacity of the stroke-line.
        :param opacity: The opacity of the element in general.
        :param stroke: The color of the stroke-line.
        :type x: int or float
        :type y: int or float
        :type rx: float (0 <= num <= 1.0)
        :type ry: float (0 <= num <= 1.0)
        :type stroke_width: int of float
        :type stroke_opacity: float (0 <= num <= 1.0)
        :type opacity: float (0 <= num <= 1.0)
        :type stroke: rgb or hex-string
        """

        AbstractGeometry.__init__(self, x=x, y=y, 
                                  stroke_width=stroke_width, 
                                  stroke_opacity=stroke_opacity,
                                  stroke=stroke, opacity=opacity)
        self.width = width
        self.height = height
        self.fill = fill 
        self.rx = rx
        self.ry = ry
        self.attribute_filter += ['width', 'height', 'fill', 'rx', 'ry']
Exemplo n.º 3
0
    def __init__(self, points=[], stroke_width=1, stroke_opacity=1.0, opacity=1.0, stroke=rgb(0, 0, 0), fill="white"):

        AbstractGeometry.__init__(
            self, stroke_width=stroke_width, stroke_opacity=stroke_opacity, opacity=opacity, stroke=stroke
        )
        self.fill = fill
        self._points = points
        self.attribute_filter = ["points", "stroke_width", "stroke", "fill"]
Exemplo n.º 4
0
 def __init__(self, text="Text", x=0, y=0, font_size=40, fill='black', rotation=(0,0,0)):
     AbstractGeometry.__init__(self, x=x, y=y) 
     self.text = text
     self.fill = fill
     self.font_size = font_size
     self.rotation = rotation
     self.attribute_filter = [ 'x', 'y', 'text', 'fill', 
                               'font_size', 'rotation'] 
Exemplo n.º 5
0
    def __init__(self, points=[], fill=rgb(0,0,0), stroke_width=1, 
                 stroke_opacity=1.0, opacity=1.0, stroke=rgb(0,0,0)):

        AbstractGeometry.__init__(self, stroke_width=stroke_width, 
                                  stroke_opacity=stroke_opacity, 
                                  opacity=opacity, stroke=stroke)
        self._points = points
        self.fill = fill
        self.attribute_filter = ['d', 'fill', 'stroke_width', 
                                 'stroke_opacity', 
                                 'stroke', 'opacity']
Exemplo n.º 6
0
    def __init__(self, x1=0.0, y1=0.0, x2=0.0, y2=0.0, 
                 stroke=rgb(0,0,0), stroke_width=1, stroke_opacity=1.0):
        """
        :param x: The starting X-coord.
        :param y: The starting Y-coord.
        :param width: The width of the line.
        :param color: The color of the stroke-line.

        :type x: int or float
        :type y: int or float
        :type width: int of float
        :type color: rgb-tuple or hex-string
        """

        AbstractGeometry.__init__(self, x=x1, y=y1, 
                                  stroke_width=stroke_width, 
                                  stroke=stroke, stroke_opacity=stroke_opacity) 

        # Type and Value checking for the basic attributes.
        # x2 Coord value should be a float or an int, as is sensical.
        # If not a float or an int, a type coersion to float is
        # attempted if, for example, x2 is a string.  If type coersion
        # fails a TypeError is raised.
        if not type(x2) in (float, int):
            try: 
                x2 = float(x2)
            except ValueError:
                raise TypeError("x2 must be a int, or float")

        # y2 coord value should be a float or an int, as is
        # sensical. If not a float or an int, a type coersion to float
        # is attempted. A type coersion would happen if, for eyample,
        # y2 is a string.  If type coersion fails a TypeError is
        # raised.
        if not type(y2) in (float, int):
            try: 
                y2 = float(y2)
            except ValueError:
                raise TypeError("y2 must be a int, or float")

        self.x1 = self.x
        self.y1 = self.y
        self.x2 = x2
        self.y2 = y2
        self.stroke = stroke
        self.attribute_filter = [ 'x1', 'y1', 'x2', 'y2', 
                                  'stroke', 'stroke_width',
                                  'stroke_opacity']