Example #1
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)
Example #2
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)
Example #3
0
 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()
Example #4
0
 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()
Example #5
0
	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()
Example #6
0
def get_flattened_path(obj, trafo, tolerance=0.5):
	if obj.cache_cpath is None:
		obj.update()
	if obj.cache_cpath is None: return None

	cpath = libcairo.apply_trafo(obj.cache_cpath, trafo, True)
	paths = libcairo._libcairo.get_path_from_cpath(cpath)

	return flat_paths(paths, tolerance)
Example #7
0
def get_flattened_path(obj, trafo, tolerance=0.5):
    if obj.cache_cpath is None:
        obj.update()
    if obj.cache_cpath is None: return None

    cpath = libcairo.apply_trafo(obj.cache_cpath, trafo, True)
    paths = libcairo._libcairo.get_path_from_cpath(cpath)

    return flat_paths(paths, tolerance)
Example #8
0
	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()
Example #9
0
 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)
Example #10
0
def apply_trafo(cache_cpath, trafo):
	return libcairo.apply_trafo(cache_cpath, trafo)
Example #11
0
def apply_trafo(cache_cpath, trafo, copy=False):
    return libcairo.apply_trafo(cache_cpath, trafo, copy)
Example #12
0
def apply_trafo(cache_cpath, trafo):
    return libcairo.apply_trafo(cache_cpath, trafo)
Example #13
0
	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)