Ejemplo n.º 1
0
 def bezier_curve_to(self, cp1x, cp1y, cp2x, cp2y, x, y, draw_context,
                     *args, **kwargs):
     point1, point2, point3, point4 = (PointF(*draw_context.last_point),
                                       PointF(cp1x,
                                              cp1y), PointF(cp2x, cp2y),
                                       PointF(x, y))
     draw_context.current_path.AddBezier(point1, point2, point3, point4)
     draw_context.last_point = (x, y)
Ejemplo n.º 2
0
 def write_text(self, text, x, y, font, draw_context, *args, **kwargs):
     width, height = font.measure(text)
     origin = PointF(x, y - height)
     font_family = win_font_family(font.family)
     font_style = win_font_style(font.weight, font.style, font_family)
     draw_context.current_path.AddString(text, font_family, font_style,
                                         float(height), origin,
                                         StringFormat())
Ejemplo n.º 3
0
 def write_text(self, text, x, y, font, draw_context, *args, **kwargs):
     full_height = 0
     font_family = win_font_family(font.family)
     font_style = win_font_style(font.weight, font.style, font_family)
     for line in text.splitlines():
         _, height = self.measure_text(line, font)
         origin = PointF(x, y + full_height - height)
         draw_context.current_path.AddString(line, font_family, font_style,
                                             float(height), origin,
                                             StringFormat())
         full_height += height
Ejemplo n.º 4
0
 def write_text(self, text, x, y, font, draw_context, *args, **kwargs):
     width, height = font.measure(text)
     origin = PointF(x, y - height)
     if draw_context.current_path is not None:
         font_family = win_font_family(font.family)
         font_style = win_font_style(font.weight, font.style, font_family)
         draw_context.current_path.AddString(
             text, font_family, font_style, float(height), origin, StringFormat()
         )
     else:
         brush = self.create_brush(
             color=kwargs.get("stroke_color", None),
         )
         draw_context.graphics.DrawString(
             text, font._impl.native, brush, origin
         )
Ejemplo n.º 5
0
 def quadratic_curve_to(self, cpx, cpy, x, y, draw_context, *args,
                        **kwargs):
     point1, point2, point3 = PointF(*draw_context.last_point), PointF(
         cpx, cpy), PointF(x, y)
     draw_context.current_path.AddCurve([point1, point2, point3])
     draw_context.last_point = (x, y)