mirror of
https://github.com/quantum5/win2xcur.git
synced 2025-04-24 02:01:57 -04:00
Support copy_opacity rename in ImageMagick 7
This commit is contained in:
parent
b5308cbb1e
commit
ffb9c5e24a
|
@ -1,10 +1,15 @@
|
|||
from typing import List
|
||||
|
||||
from wand.color import Color
|
||||
from wand.image import BaseImage, Image
|
||||
from wand.image import BaseImage, COMPOSITE_OPERATORS, Image
|
||||
|
||||
from win2xcur.cursor import CursorFrame
|
||||
|
||||
if 'copy_opacity' in COMPOSITE_OPERATORS:
|
||||
COPY_ALPHA = 'copy_opacity' # ImageMagick 6 name
|
||||
else:
|
||||
COPY_ALPHA = 'copy_alpha' # ImageMagick 7 name
|
||||
|
||||
|
||||
def apply_to_image(image: BaseImage, *, color: str, radius: float, sigma: float, xoffset: float,
|
||||
yoffset: float) -> Image:
|
||||
|
@ -20,7 +25,7 @@ def apply_to_image(image: BaseImage, *, color: str, radius: float, sigma: float,
|
|||
opacity.modulate(50)
|
||||
|
||||
shadow = Image(width=new_width, height=new_height, pseudo='xc:' + color)
|
||||
shadow.composite(opacity, operator='copy_opacity')
|
||||
shadow.composite(opacity, operator=COPY_ALPHA)
|
||||
|
||||
result = Image(width=new_width, height=new_height, pseudo='xc:transparent')
|
||||
result.composite(image)
|
||||
|
|
Loading…
Reference in a new issue