예제 #1
0
파일: wxdc.py 프로젝트: Splawik/pytigon-lib
 def __init__(self,
              dc=None,
              calc_only=False,
              width=-1,
              height=-1,
              output_name=None,
              scale=1.0):
     BaseDc.__init__(self, calc_only, width, height, output_name, scale)
     self.dc_info = DcDcinfo(self)
     if self.width >= 0:
         width2 = self.width
     else:
         width2 = self.default_width
     if self.height >= 0:
         height2 = self.height
     else:
         height2 = self.default_height
     self.type = None
     if self.calc_only:
         self.surf = wx.Bitmap(10, 10, 32)
         self.dc = wx.MemoryDC(self.surf)
         self.dc.Clear()
         if width < 0:
             self.width = -1
         if height < 0:
             self.height = 1000000000
     else:
         if dc:
             self.surf = None
             self.dc = dc
         else:
             if output_name:
                 name = output_name.lower()
                 self.surf = wx.EmptyBitmap(width2, height2, 32)
                 self.dc = wx.MemoryDC(self.surf)
                 self.dc.Clear()
                 if ".jpg" in name or ".jpeg" in name:
                     self.type = "jpg"
                 else:
                     self.type = "png"
             else:
                 self.surf = wx.EmptyBitmap(10, 10, 32)
                 self.dc = wx.MemoryDC(self.surf)
     self.last_style_tab = None
     self._color = (0, 0, 0, 255)
     self._line_width = 0
     self._fun_stack = []
     self._fill = False
     self._draw = False
     self._preserve = False
     self.transparent_brush = wx.Brush(wx.Colour(255, 255, 255),
                                       style=wx.TRANSPARENT)
     self.transparent_pen = wx.Pen(wx.Colour(255, 255, 255),
                                   width=0,
                                   style=wx.TRANSPARENT)
     self._last_pen = None
     self._last_brush = wx.Brush(wx.Colour(255, 255, 255), style=wx.SOLID)
     self._last_pen_color = (0, 0, 0, 255)
     self._last_line_width = -1
     self._last_brush_color = (255, 255, 255, 255)
예제 #2
0
    def __init__(self,
                 dc=None,
                 calc_only=False,
                 width=-1,
                 height=-1,
                 output_name=None,
                 scale=1.0):
        BaseDc.__init__(self, calc_only, width, height, output_name, scale)
        if self.width >= 0:
            width2 = self.width
        else:
            width2 = self.default_width
        if self.height >= 0:
            height2 = self.height
        else:
            height2 = self.default_height
        self.dc_info = PdfDcInfo(self)
        self.type = None
        if self.calc_only:
            self.surf = PDFSurface(None, 10, 10)
            if width < 0:
                self.width = -1
            if height < 0:
                self.height = 1000000000
            self.dc = self.surf.get_dc()
        else:
            if dc:
                self.surf = None
                self.dc = dc
            else:
                if output_name:
                    name = output_name.lower()
                    self.surf = PDFSurface(output_name, width2, height2)
                else:
                    self.surf = PDFSurface(None, width2, height2)

                self.dc = self.surf.get_dc()

        self.last_style_tab = None
        self._color = (0, 0, 0, 255)
        self._line_width = 0
        self._fun_stack = []
        self._fill = False
        self._draw = False
        self._preserve = False

        self._last_pen = None
        self._last_brush = None
        self._last_pen_color = (0, 0, 0, 255)
        self._last_line_width = -1
        self._last_brush_color = (255, 255, 255, 255)
        self.start_page()
예제 #3
0
 def __init__(self,
              ctx=None,
              calc_only=False,
              width=-1,
              height=-1,
              output_name=None):
     BaseDc.__init__(self, calc_only, width, height, output_name)
     self.dc_info = GraphicsContextDcinfo(self)
     self.type = None
     if self.calc_only:
         self.surf = wx.EmptyBitmap(10, 10, 32)
         dc = wx.MemoryDC(self.surf)
         dc.Clear()
         self.ctx = self._make_gc(dc)
         if width < 0:
             self.width = -1
         if height < 0:
             self.height = 1000000000
     else:
         if ctx:
             self.surf = None
             self.ctx = ctx
         else:
             if self.width >= 0:
                 width2 = self.width
             else:
                 width2 = self.default_width
             if self.height >= 0:
                 height2 = self.height
             else:
                 height2 = self.default_height
             self.surf = wx.EmptyBitmap(width2, height2, 32)
             if output_name:
                 self.type = "png"
             dc = wx.MemoryDC(self.surf)
             dc.Clear()
             self.ctx = self._make_gc(dc)
     self.path = None
     self.colour = wx.Colour(0, 0, 0)
     self.line_width = 1
     self._move_x = 0
     self._move_y = 0
     self.last_style_tab = None