generate.py 文件源码

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

项目:neferset 作者: andburn 项目源码 文件源码
def setup_context(width, height, out_width=0):
    scale = 1
    if out_width >= MIN_WIDTH:
        scale = out_width / width
    surface = cairo.ImageSurface(
        cairo.FORMAT_ARGB32, int(round(width * scale)), int(round(height * scale)))
    ctx = cairo.Context(surface)
    ctx.scale(scale, scale)
    ctx.set_source_rgba(0, 0, 0, 0) # transparent bg
    ctx.paint()
    return (ctx, surface)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号