예제 #1
0
 def is_point_on_path(self, win_point, path):
     self.clear()
     trafo = self.get_context_trafo(win_point)
     self.ctx.set_matrix(libcairo.get_matrix_from_trafo(trafo))
     stroke_width = config.stroke_sensitive_size
     stroke_width /= trafo[0]
     cpath = libgeom.create_cpath([path, ])
     self.ctx.new_path()
     self.ctx.append_path(cpath)
     self.ctx.set_line_width(stroke_width)
     self.ctx.stroke()
     return not libcairo.check_surface_whiteness(self.surface)
예제 #2
0
파일: canvas.py 프로젝트: sk1project/sk1-wx
 def is_point_on_path(self, win_point, path):
     self.clear()
     trafo = self.get_context_trafo(win_point)
     self.ctx.set_matrix(libcairo.get_matrix_from_trafo(trafo))
     stroke_width = config.stroke_sensitive_size
     stroke_width /= trafo[0]
     cpath = libgeom.create_cpath([path])
     self.ctx.new_path()
     self.ctx.append_path(cpath)
     self.ctx.set_line_width(stroke_width)
     self.ctx.stroke()
     return not libcairo.check_surface_whiteness(self.surface)
예제 #3
0
파일: shaping.py 프로젝트: Scrik/sk1-wx
	def check_point(self, point):
		self.clear()
		self.set_trafo(point)
		if self.cpaths is None: self.cpaths = self.obj.get_cpaths()
		self.ctx.set_fill_rule(self.fill_rule)
		self.ctx.new_path()
		self.ctx.append_path(self.cpaths)
		self.ctx.fill()
		self.ctx.set_line_width(2.0)
		self.ctx.new_path()
		self.ctx.append_path(self.cpaths)
		self.ctx.stroke()
		return not libcairo.check_surface_whiteness(self.surface)
예제 #4
0
파일: shaping.py 프로젝트: slyfrs/sk1-wx
 def check_point(self, point):
     self.clear()
     self.set_trafo(point)
     if self.cpaths is None: self.cpaths = self.obj.get_cpaths()
     self.ctx.set_fill_rule(self.fill_rule)
     self.ctx.new_path()
     self.ctx.append_path(self.cpaths)
     self.ctx.fill()
     self.ctx.set_line_width(2.0)
     self.ctx.new_path()
     self.ctx.append_path(self.cpaths)
     self.ctx.stroke()
     return not libcairo.check_surface_whiteness(self.surface)
예제 #5
0
파일: canvas.py 프로젝트: slyfrs/sk1-wx
 def is_point_on_segment(self, win_point, start_point, end_point):
     self.clear()
     trafo = self.get_context_trafo(win_point)
     self.ctx.set_matrix(libcairo.get_matrix_from_trafo(trafo))
     stroke_width = config.stroke_sensitive_size
     stroke_width /= trafo[0]
     if len(start_point) > 2: start_point = start_point[2]
     self.ctx.move_to(*start_point)
     if len(end_point) == 2:
         self.ctx.line_to(*end_point)
     else:
         p1, p2, p3 = end_point[:-1]
         self.ctx.curve_to(*(p1 + p2 + p3))
     self.ctx.set_line_width(stroke_width)
     self.ctx.stroke()
     return not libcairo.check_surface_whiteness(self.surface)
예제 #6
0
파일: shaping.py 프로젝트: Scrik/sk1-wx
	def check_point(self, point):
		self.clear()
		self.set_trafo(point)
		if self.cpaths is None: self.cpaths = self.obj.get_cpaths()
		line_width = self.stroke_style[1]
		self.ctx.set_line_width(line_width - .04)
		dash = []
		for item in self.stroke_style[3]:
			dash.append(item * line_width)
		self.ctx.set_dash(dash)
		self.ctx.set_line_cap(CAPS[self.stroke_style[4]])
		self.ctx.set_line_join(JOINS[self.stroke_style[5]])
		self.ctx.set_miter_limit(self.stroke_style[6])
		self.ctx.new_path()
		self.ctx.append_path(self.cpaths)
		self.ctx.stroke()
		return not libcairo.check_surface_whiteness(self.surface)
예제 #7
0
파일: shaping.py 프로젝트: slyfrs/sk1-wx
 def check_point(self, point):
     self.clear()
     self.set_trafo(point)
     if self.cpaths is None: self.cpaths = self.obj.get_cpaths()
     line_width = self.stroke_style[1]
     self.ctx.set_line_width(line_width - .04)
     dash = []
     for item in self.stroke_style[3]:
         dash.append(item * line_width)
     self.ctx.set_dash(dash)
     self.ctx.set_line_cap(CAPS[self.stroke_style[4]])
     self.ctx.set_line_join(JOINS[self.stroke_style[5]])
     self.ctx.set_miter_limit(self.stroke_style[6])
     self.ctx.new_path()
     self.ctx.append_path(self.cpaths)
     self.ctx.stroke()
     return not libcairo.check_surface_whiteness(self.surface)
예제 #8
0
파일: canvas.py 프로젝트: sk1project/sk1-wx
 def is_point_on_segment(self, win_point, start_point, end_point):
     self.clear()
     trafo = self.get_context_trafo(win_point)
     self.ctx.set_matrix(libcairo.get_matrix_from_trafo(trafo))
     stroke_width = config.stroke_sensitive_size
     stroke_width /= trafo[0]
     if len(start_point) > 2:
         start_point = start_point[2]
     self.ctx.move_to(*start_point)
     if len(end_point) == 2:
         self.ctx.line_to(*end_point)
     else:
         p1, p2, p3 = end_point[:-1]
         self.ctx.curve_to(*(p1 + p2 + p3))
     self.ctx.set_line_width(stroke_width)
     self.ctx.stroke()
     return not libcairo.check_surface_whiteness(self.surface)
예제 #9
0
파일: canvas.py 프로젝트: slyfrs/sk1-wx
 def is_point_into_object(self, win_point, obj, fill_anyway=False):
     self.clear()
     self._draw_object(obj, self.get_context_trafo(win_point), fill_anyway)
     return not libcairo.check_surface_whiteness(self.surface)
예제 #10
0
파일: canvas.py 프로젝트: sk1project/sk1-wx
 def is_point_into_object(self, win_point, obj):
     self.clear()
     self._draw_object(obj, self.get_context_trafo(win_point))
     return not libcairo.check_surface_whiteness(self.surface)