예제 #1
0
파일: canvas.py 프로젝트: slyfrs/sk1-wx
    def _draw_object(self, obj, trafo, fill_anyway=False):
        if obj.childs:
            for child in obj.childs:
                self._draw_object(child, trafo)
        else:
            path = obj.cache_cpath

            if obj.is_text():
                path = libcairo.convert_bbox_to_cpath(obj.cache_bbox)
                fill_anyway = True
            if obj.is_curve() and len(obj.paths) > 100:
                path = libcairo.convert_bbox_to_cpath(obj.cache_bbox)
                fill_anyway = True
            if obj.is_pixmap():
                fill_anyway = True

            self.ctx.set_matrix(libcairo.get_matrix_from_trafo(trafo))
            self.ctx.new_path()
            self.ctx.append_path(path)
            stroke_width = config.stroke_sensitive_size
            if not self.canvas.stroke_view and obj.style[0]:
                self.ctx.fill_preserve()
            if fill_anyway:
                self.ctx.fill_preserve()
            if obj.style[1]:
                stroke = obj.style[1]
                width = stroke[1] * trafo[0]
                stroke_width /= trafo[0]
                if width < stroke_width: width = stroke_width
                self.ctx.set_line_width(width)
                self.ctx.stroke()
예제 #2
0
파일: canvas.py 프로젝트: sk1project/sk1-wx
    def _draw_object(self, obj, trafo):
        if obj.childs:
            for child in obj.childs:
                self._draw_object(child, trafo)
        else:
            fill_anyway = False
            path = obj.cache_cpath

            if obj.is_text():
                path = libcairo.convert_bbox_to_cpath(obj.cache_bbox)
                fill_anyway = True
            if obj.is_curve() and len(obj.paths) > 100:
                path = libcairo.convert_bbox_to_cpath(obj.cache_bbox)
                fill_anyway = True
            if obj.is_pixmap():
                fill_anyway = True

            self.ctx.set_matrix(libcairo.get_matrix_from_trafo(trafo))
            self.ctx.new_path()
            self.ctx.append_path(path)
            stroke_width = config.stroke_sensitive_size
            if not self.canvas.stroke_view and obj.style[0]:
                self.ctx.fill_preserve()
            if fill_anyway:
                self.ctx.fill_preserve()
            if obj.style[1]:
                stroke = obj.style[1]
                width = stroke[1] * trafo[0]
                stroke_width /= trafo[0]
                if width < stroke_width:
                    width = stroke_width
                self.ctx.set_line_width(width)
                self.ctx.stroke()
예제 #3
0
파일: renderer.py 프로젝트: THS-on/sk1-wx
 def cdc_draw_frame(self, start, end, temp_surfase=False):
     if start and end:
         if self.frame:
             if start == self.frame[0] and end == self.frame[1]:
                 return
         cpath = libcairo.convert_bbox_to_cpath(start + end)
         bbox = self.cdc_to_int(*libcairo.get_cpath_bbox(cpath))
         frame = self.cdc_bbox_to_frame(bbox)
         if not self.frame:
             self.frame = frame
         bbox2 = self.cdc_frame_to_bbox(self.frame)
         frame_sum = self.cdc_bbox_to_frame(libgeom.sum_bbox(bbox, bbox2))
         x, y, w, h = self.cdc_normalize_rect(*frame_sum)
         self.frame = frame
         surface = cairo.ImageSurface(cairo.FORMAT_RGB24, w + 2, h + 2)
         ctx = cairo.Context(surface)
         if temp_surfase:
             ctx.set_source_surface(self.temp_surface, -x + 1, -y + 1)
         else:
             ctx.set_source_surface(self.surface, -x + 1, -y + 1)
         ctx.paint()
         ctx.set_matrix(cairo.Matrix(1.0, 0.0, 0.0, 1.0, -x + 1, -y + 1))
         self._cdc_draw_cpath(ctx, cpath)
         self.canvas.dc.put_surface(surface, x - 1, y - 1)
         self.cdc_reflect_snapping()
예제 #4
0
파일: renderer.py 프로젝트: THS-on/sk1-wx
 def draw_move_frame(self, trafo):
     bbox = self.presenter.selection.bbox
     if bbox:
         path = libcairo.convert_bbox_to_cpath(bbox)
         libcairo.apply_trafo(path, trafo)
         libcairo.apply_trafo(path, self.canvas.trafo)
         self._draw_frame(path)
예제 #5
0
	def draw_move_frame(self, trafo):
		bbox = self.presenter.selection.bbox
		if bbox:
			path = libcairo.convert_bbox_to_cpath(bbox)
			libcairo.apply_trafo(path, trafo)
			libcairo.apply_trafo(path, self.canvas.trafo)
			self._draw_frame(path)
예제 #6
0
파일: renderer.py 프로젝트: raboof/sk1-wx
 def cdc_draw_move_frame(self, trafo):
     bbox = self.presenter.selection.bbox
     if bbox:
         cpath = libcairo.convert_bbox_to_cpath(bbox)
         libcairo.apply_trafo(cpath, trafo)
         libcairo.apply_trafo(cpath, self.canvas.trafo)
         bbox = self.cdc_to_int(*libcairo.get_cpath_bbox(cpath))
         frame = self.cdc_bbox_to_frame(bbox)
         if self.frame and frame == self.frame:
             return
         if not self.frame:
             self.frame = frame
         bbox2 = self.cdc_frame_to_bbox(self.frame)
         frame_sum = self.cdc_bbox_to_frame(libgeom.sum_bbox(bbox, bbox2))
         x, y, w, h = self.cdc_normalize_rect(*frame_sum)
         self.frame = frame
         surface = cairo.ImageSurface(cairo.FORMAT_RGB24, w + 2, h + 2)
         ctx = cairo.Context(surface)
         ctx.set_source_surface(self.surface, -x + 1, -y + 1)
         ctx.paint()
         ctx.set_matrix(cairo.Matrix(1.0, 0.0, 0.0, 1.0, -x + 1, -y + 1))
         self._cdc_draw_cpath(ctx, cpath)
         dc = wx.ClientDC(self.canvas)
         dc.DrawBitmap(copy_surface_to_bitmap(surface), x - 1, y - 1)
         self.cdc_reflect_snapping()
예제 #7
0
파일: renderer.py 프로젝트: THS-on/sk1-wx
 def draw_text_selection(self, bboxs, trafo):
     self.set_direct_matrix()
     self.ctx.set_antialias(cairo.ANTIALIAS_DEFAULT)
     self.ctx.set_source_rgba(*config.text_selection_color)
     for item in bboxs:
         cpath = libcairo.convert_bbox_to_cpath(item)
         libcairo.apply_trafo(cpath, trafo)
         libcairo.apply_trafo(cpath, self.canvas.trafo)
         self.ctx.new_path()
         self.ctx.append_path(cpath)
         self.ctx.fill()
예제 #8
0
파일: renderer.py 프로젝트: Scrik/sk1-wx
	def draw_text_selection(self, bboxs, trafo):
		self.set_direct_matrix()
		self.ctx.set_antialias(cairo.ANTIALIAS_DEFAULT)
		self.ctx.set_source_rgba(*config.text_selection_color)
		for item in bboxs:
			cpath = libcairo.convert_bbox_to_cpath(item)
			libcairo.apply_trafo(cpath, trafo)
			libcairo.apply_trafo(cpath, self.canvas.trafo)
			self.ctx.new_path()
			self.ctx.append_path(cpath)
			self.ctx.fill()
예제 #9
0
파일: renderer.py 프로젝트: Scrik/sk1-wx
	def cdc_draw_move_frame(self, trafo):
		bbox = self.presenter.selection.bbox
		if bbox:
			cpath = libcairo.convert_bbox_to_cpath(bbox)
			libcairo.apply_trafo(cpath, trafo)
			libcairo.apply_trafo(cpath, self.canvas.trafo)
			bbox = self.cdc_to_int(*libcairo.get_cpath_bbox(cpath))
			frame = self.cdc_bbox_to_frame(bbox)
			if self.frame and frame == self.frame:return
			if not self.frame:self.frame = frame
			bbox2 = self.cdc_frame_to_bbox(self.frame)
			frame_sum = self.cdc_bbox_to_frame(libgeom.sum_bbox(bbox, bbox2))
			x, y, w, h = self.cdc_normalize_rect(*frame_sum)
			self.frame = frame
			surface = cairo.ImageSurface(cairo.FORMAT_RGB24, w + 2, h + 2)
			ctx = cairo.Context(surface)
			ctx.set_source_surface(self.surface, -x + 1, -y + 1)
			ctx.paint()
			ctx.set_matrix(cairo.Matrix(1.0, 0.0, 0.0, 1.0, -x + 1, -y + 1))
			self._cdc_draw_cpath(ctx, cpath)
			dc = wx.ClientDC(self.canvas)
			dc.DrawBitmap(copy_surface_to_bitmap(surface), x - 1, y - 1)
			self.cdc_reflect_snapping()
예제 #10
0
파일: renderer.py 프로젝트: Scrik/sk1-wx
	def cdc_draw_frame(self, start, end, temp_surfase=False):
		if start and end:
			if self.frame:
				if start == self.frame[0] and end == self.frame[1]:return
			cpath = libcairo.convert_bbox_to_cpath(start + end)
			bbox = self.cdc_to_int(*libcairo.get_cpath_bbox(cpath))
			frame = self.cdc_bbox_to_frame(bbox)
			if not self.frame:self.frame = frame
			bbox2 = self.cdc_frame_to_bbox(self.frame)
			frame_sum = self.cdc_bbox_to_frame(libgeom.sum_bbox(bbox, bbox2))
			x, y, w, h = self.cdc_normalize_rect(*frame_sum)
			self.frame = frame
			surface = cairo.ImageSurface(cairo.FORMAT_RGB24, w + 2, h + 2)
			ctx = cairo.Context(surface)
			if temp_surfase:
				ctx.set_source_surface(self.temp_surface, -x + 1, -y + 1)
			else:
				ctx.set_source_surface(self.surface, -x + 1, -y + 1)
			ctx.paint()
			ctx.set_matrix(cairo.Matrix(1.0, 0.0, 0.0, 1.0, -x + 1, -y + 1))
			self._cdc_draw_cpath(ctx, cpath)
			dc = wx.ClientDC(self.canvas)
			dc.DrawBitmap(copy_surface_to_bitmap(surface), x - 1, y - 1)
			self.cdc_reflect_snapping()
예제 #11
0
파일: renderer.py 프로젝트: THS-on/sk1-wx
 def draw_text_frame(self, bbox, trafo):
     cpath = libcairo.convert_bbox_to_cpath(bbox)
     libcairo.apply_trafo(cpath, trafo)
     libcairo.apply_trafo(cpath, self.canvas.trafo)
     self._draw_frame(cpath)
예제 #12
0
파일: renderer.py 프로젝트: THS-on/sk1-wx
 def draw_frame(self, start, end):
     if start and end:
         path = libcairo.convert_bbox_to_cpath(start + end)
         self._draw_frame(path)
예제 #13
0
	def draw_frame(self, start, end):
		if start and end:
			path = libcairo.convert_bbox_to_cpath(start + end)
			self._draw_frame(path)
예제 #14
0
파일: renderer.py 프로젝트: Scrik/sk1-wx
	def draw_text_frame(self, bbox, trafo):
		cpath = libcairo.convert_bbox_to_cpath(bbox)
		libcairo.apply_trafo(cpath, trafo)
		libcairo.apply_trafo(cpath, self.canvas.trafo)
		self._draw_frame(cpath)