Skip to content

Commit

Permalink
Handle opacity on raster images
Browse files Browse the repository at this point in the history
Fix #235.
  • Loading branch information
liZe committed Dec 10, 2020
1 parent dcfbca4 commit 73349a7
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion cairosvg/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,12 +102,13 @@ def image(surface, node):
surface.context.clip()

# Paint raster image
opacity = float(node.get('opacity', 1))
surface.context.save()
surface.context.translate(x, y)
surface.context.scale(scale_x, scale_y)
surface.context.translate(translate_x, translate_y)
surface.context.set_source(image_surface.pattern)
surface.context.paint()
surface.context.paint_with_alpha(opacity)
surface.context.restore()


Expand Down

0 comments on commit 73349a7

Please sign in to comment.