def DrawShape(self, device, rect=None, clip=0):
     RectangularPrimitive.DrawShape(self, device)
     base_trafo = self.trafo(self.atrafo)
     base_trafo = base_trafo(Scale(self.properties.font_size))
     paths = self.properties.font.GetPaths(self.text, self.properties)
     obj = PolyBezier(paths, self.properties.Duplicate())
     obj.Transform(base_trafo)
     device.MultiBezier(obj.paths, rect, clip)
 def AsBezier(self):
     if self.text:
         text = split(self.text, '\n')[0]
         base_trafo = self.trafo(self.atrafo)
         base_trafo = base_trafo(Scale(self.properties.font_size))
         paths = self.properties.font.GetPaths(self.text, self.properties)
         obj = PolyBezier(paths, self.properties.Duplicate())
         obj.Transform(base_trafo)
         return obj
示例#3
0
	def Paths(self):
		if self.text:
			base_trafo = self.trafo(self.atrafo)
			if self.curves_cache is None:
				a = self.properties
				paths = a.font.get_paths(self.text, a)
				self.curves_cache = self.convert_paths(paths)
			paths = self.duplicate_paths(self.curves_cache)
			obj = PolyBezier(paths, self.properties.Duplicate())
			obj.Transform(base_trafo)
		return obj.paths
示例#4
0
	def DrawShape(self, device, rect=None, clip=0):
		RectangularPrimitive.DrawShape(self, device)
		base_trafo = self.trafo(self.atrafo)
		if self.curves_cache is None:
			a = self.properties
			paths = a.font.get_paths(self.text, a)
			self.curves_cache = self.convert_paths(paths)
		paths = self.duplicate_paths(self.curves_cache)
		obj = PolyBezier(paths, self.properties.Duplicate())
		obj.Transform(base_trafo)
		device.MultiBezier(obj.paths, rect, clip)
示例#5
0
 def AsBezier(self):
     if self.text:
         objects = []
         base_trafo = self.trafo(self.atrafo)
         base_trafo = base_trafo(Scale(self.properties.font_size))
         pos = self.properties.font.TypesetText(self.text)
         for i in range(len(self.text)):
             paths = self.properties.font.GetOutline(self.text[i])
             if paths:
                 props = self.properties.Duplicate()
                 props.AddStyle(EmptyLineStyle)
                 obj = PolyBezier(paths=paths, properties=props)
                 trafo = base_trafo(Translation(pos[i]))
                 obj.Transform(trafo)
                 objects.append(obj)
         return Group(objects)
示例#6
0
def Blend(obj1, obj2, frac1, frac2 = None):
    if frac2 is None:
        frac2 = 1.0 - frac1
    try:
        return obj1.Blend(obj2, frac1, frac2)
    except MismatchError:
        pass
    try:
        return obj2.Blend(obj1, frac2, frac1)
    except MismatchError:
        pass
    try:
        from bezier import PolyBezier
        if not isinstance(obj1,PolyBezier) and not isinstance(obj2,PolyBezier)\
           and obj1.is_curve and obj2.is_curve:
            paths = BlendPaths(obj1.Paths(), obj2.Paths(), frac1, frac2)
            properties = Blend(obj1.Properties(), obj2.Properties(),
                               frac1, frac2)
            return PolyBezier(paths = paths, properties = properties)
    except AttributeError, value:
        if str(value) != 'is_curve':
            raise
示例#7
0
 def AsBezier(self):
     return PolyBezier(paths=self.Paths(),
                       properties=self.properties.Duplicate())
	def AsBezier(self):
		return PolyBezier(paths = self.rect_path,
							properties = self.properties.Duplicate())