# Path: flexlay/math/rect.py
# class Rectf(Rect):
# 
#     def __init__(self, arg1=None, arg2=None, arg3=None, arg4=None):
#         super().__init__()
# 
#         if arg1 is None and arg2 is None and arg3 is None and arg4 is None:
#             self.left = 0.0
#             self.top = 0.0
#             self.right = 0.0
#             self.bottom = 0.0
#         elif arg2 is None and arg3 is None and arg4 is None:
#             self.left = arg1.left
#             self.top = arg1.top
#             self.right = arg1.right
#             self.bottom = arg1.bottom
#         elif arg3 is None and arg4 is None:
#             self.left = arg1.x
#             self.top = arg1.y
#             self.right = arg1.x + arg2.width
#             self.bottom = arg1.y + arg2.height
#         else:
#             self.left = arg1
#             self.top = arg2
#             self.right = arg3
#             self.bottom = arg4


from PyQt5.QtCore import QLineF
from PyQt5.QtGui import QPainterPath
from flexlay.math import Rectf
    def draw_line(self, x1, y1, x2, y2, color):
        self.painter.setPen(color.to_qt())
        self.painter.drawLine(QLineF(x1, y1, x2, y2))

    def push_modelview(self):
        self.painter.save()

    def pop_modelview(self):
        self.painter.restore()

    def translate(self, x, y):
        self.painter.setViewTransformEnabled(True)
        self.painter.translate(x, y)

    def scale(self, x, y):
        self.painter.setViewTransformEnabled(True)
        self.painter.scale(x, y)

    def rotate(self, angle):
        self.painter.setViewTransformEnabled(True)
        self.painter.rotate(angle)

    def get_clip_rect(self):
        """
        If it's not obvious, this is rect containing all
        which is visible
        """
        if self.state:
            return self.state.get_clip_rect()
        else:

# Path: flexlay/math/rect.py
# class Rectf(Rect):
# 
#     def __init__(self, arg1=None, arg2=None, arg3=None, arg4=None):
#         super().__init__()
# 
#         if arg1 is None and arg2 is None and arg3 is None and arg4 is None:
#             self.left = 0.0
#             self.top = 0.0
#             self.right = 0.0
#             self.bottom = 0.0
#         elif arg2 is None and arg3 is None and arg4 is None:
#             self.left = arg1.left
#             self.top = arg1.top
#             self.right = arg1.right
#             self.bottom = arg1.bottom
#         elif arg3 is None and arg4 is None:
#             self.left = arg1.x
#             self.top = arg1.y
#             self.right = arg1.x + arg2.width
#             self.bottom = arg1.y + arg2.height
#         else:
#             self.left = arg1
#             self.top = arg2
#             self.right = arg3
#             self.bottom = arg4


# Path: flexlay/graphic_context.py
from PyQt5.QtCore import QLineF
from PyQt5.QtGui import QPainterPath
from flexlay.math import Rectf

    def draw_line(self, x1, y1, x2, y2, color):
        self.painter.setPen(color.to_qt())
        self.painter.drawLine(QLineF(x1, y1, x2, y2))

    def push_modelview(self):
        self.painter.save()

    def pop_modelview(self):
        self.painter.restore()

    def translate(self, x, y):
        self.painter.setViewTransformEnabled(True)
        self.painter.translate(x, y)

    def scale(self, x, y):
        self.painter.setViewTransformEnabled(True)
        self.painter.scale(x, y)

    def rotate(self, angle):
        self.painter.setViewTransformEnabled(True)
        self.painter.rotate(angle)

    def get_clip_rect(self):
        """
        If it's not obvious, this is rect containing all
        which is visible
        """
        if self.state:
            return self.state.get_clip_rect()
        else:

            return Rectf()