def draw_overlay(self, context, width, height):
if self.scroll_enable and self.message:
context = cairo_context_from_gi(context)
#print str(width) + " x " + str(height)
#context.scale(width, height)
#context.scale(width / 100, height / 100)
#context.scale(100, 100)
#context.set_source_rgb(1, 0, 0)
#context.paint_with_alpha(1)
#context.select_font_face("Helvetica")
#context.set_font_face(None)
#context.set_font_size(0.05)
#context.move_to(0.1, 0.1)
#context.show_text("Hello World")
#context.rectangle(0, height * 0.60, width, 30)
#context.rectangle(0, 0.60, 1, 0.1)
context.set_source_rgb(1, 0, 0)
context.rectangle(0, 0.55 * height, width, 0.15 * height)
context.fill()
#context.scale(1.0 / width, 1.0 / height)
#context.translate(0, height * 0.60)
layout = PangoCairo.create_layout(context)
#font = Pango.FontDescription("Arial " + str(0.090 * height))
#font.set_family("Sans")
#font.set_size(0.090 * height)
#font.set_size(25)
#font.set_stretch(Pango.Stretch.ULTRA_CONDENSED)
font = Pango.font_description_from_string("Sans Condensed " + str(0.090 * height))
layout.set_font_description(font)
layout.set_text(self.message, -1)
(layout_width, layout_height) = layout.get_pixel_size()
self.scroll_wrap = 1.0 + (float(layout_width) / float(width))
pos = (self.scroll_pos * width) - layout_width
context.set_source_rgb(1, 1, 1)
context.translate(pos, 0.55 * height)
PangoCairo.update_layout(context, layout)
PangoCairo.show_layout(context, layout)
#context.set_line_width(0.1)
#context.move_to(0, 0)
#context.line_to(1, 0)
#context.stroke()
#pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_size("/home/trans/Downloads/kitty.jpg", width, height)
#Gdk.cairo_set_source_pixbuf(context, pixbuf, 0, 0)
#context.stroke()
评论列表
文章目录