canvasmath.py 文件源码

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

项目:dxf2gcode 作者: cnc-club 项目源码 文件源码
def cairo_image_surface_from_image(image):
    if image.mode != 'RGBA':
        image = image.convert('RGBA')

    width, height = image.size
    stride = cairo.ImageSurface.format_stride_for_width(
        cairo.FORMAT_ARGB32, width)

    image_buffer = array.array('c')
    image_buffer.fromstring(
        image_rgba_to_bgra(
            image.tostring()))

    cairo_image = cairo.ImageSurface.create_for_data(
        image_buffer, cairo.FORMAT_ARGB32, width, height, stride)

    return cairo_image
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号