Simplify some transforms

This commit is contained in:
Gouvernathor 2023-11-11 20:49:53 +01:00
parent 247433b573
commit f179095287

View File

@ -67,22 +67,19 @@ init python early:
def clamp(n, smallest, largest): def clamp(n, smallest, largest):
return max(smallest, min(n, largest)) return max(smallest, min(n, largest))
def white_tint(image): white_tint = Transform(image, matrixcolor=TintMatrix((1.1, 1.1, 1.1)))
return Transform( image, matrixcolor=TintMatrix((1.1, 1.1, 1.1)) )
def gray_tint(image): gray_tint = Transform(image, matrixcolor=SaturationMatrix(0.0))
return Transform( image, matrixcolor=SaturationMatrix(0.0) )
def yellow_tint(image): yellow_tint = Transform(image, matrixcolor=TintMatrix((1.2, 1.1, 0.7)))
return Transform( image, matrixcolor=TintMatrix((1.2, 1.1, 0.7)) )
def image_hover(image, brightness=0.12): def image_hover(image, brightness=0.12):
"""Returns slightly brighter image used during hover events""" """Returns slightly brighter image used during hover events"""
return Transform( image, matrixcolor=BrightnessMatrix(brightness) ) return Transform(image, matrixcolor=BrightnessMatrix(brightness))
def image_alpha(image, alpha=0.5): def image_alpha(image, alpha=0.5):
"""Returns an image with changed alpha 0 - fully transparent 1 - fully visible""" """Returns an image with changed alpha 0 - fully transparent 1 - fully visible"""
return Transform( image, matrixcolor=OpacityMatrix(alpha) ) return Transform(image, matrixcolor=OpacityMatrix(alpha))
def set_clipboard(txt): def set_clipboard(txt):
txt = str(txt) txt = str(txt)