debug_pixbuf-cairo-gtk3.py 文件源码

python
阅读 24 收藏 0 点赞 0 评论 0

项目:plotcommander 作者: FilipDominec 项目源码 文件源码
def do_render(self, cr, widget, bg_area, cell_area, flags):
        pixbuf = GdkPixbuf.Pixbuf.new(Colorspace.RGB, True, 8, cell_area.width, cell_area.height)
        Gdk.cairo_set_source_pixbuf(cr, pixbuf, cell_area.x, cell_area.y)

        ## Draw a filled square
        cr.set_source_rgb(*self.rgb_triplet)
        cr.rectangle(cell_area.x+1, cell_area.y+1, cell_area.width-2, cell_area.height-2)
        cr.fill() 

        ## Outline it black 
        cr.set_source_rgb(0, .8, 0)
        cr.rectangle(cell_area.x+1, cell_area.y+1, cell_area.width-2, cell_area.height-2)
        cr.stroke() 

        ## Draw a blue line
        #cr.set_source_rgb(0, 0, .8)
        #cr.move_to(cell_area.x+5, cell_area.y+5)
        #cr.line_to(cell_area.x+15, cell_area.y+15)
        #cr.stroke()

        ## Semitransparent overwrite of whole image
        #cr.set_source_rgb(0,0,0)
        #cr.paint_with_alpha(self.alpha)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号