ImageOverlayGradient
ClassDataClassSource
ImageOverlayGradient(
color_a: str | tuple[float, ...],
color_b: str | tuple[float, ...],
size: tuple[int | None, int | None] | None = None,
direction: Literal["left_to_right", "top_to_bottom", "rect_center_to_outside", "radius_center_to_outside"] = "left_to_right",
pos_shift: tuple[int, int] = (0, 0),
mode: Literal["default", "add", "add_modulo", "screen", "lighter", "subtract", "subtract_modulo", "multiply", "darker", "difference", "soft_light", "hard_light"] = "default"
)
An overlay layer with a linear gradient.
Fields
| Name | Type | Required | |
|---|---|---|---|
color_a | str | tuple[float, ...] | The starting RGB/RGBA color of the overlaying layer. | |
color_b | str | tuple[float, ...] | The ending RGB/RGBA color of the overlaying layer. | |
size | tuple[int | None, int | None] | None | The size of the gradient. If not specified, will use the layer size. | |
direction | Literal["left_to_right", "top_to_bottom", "rect_center_to_outside", "radius_center_to_outside"] | The gradient direction. The value means the direction from color_a to color_b. | |
pos_shift | tuple[int, int] | The shift of the overlaying content. By default, the content will be center- aligned with the giving shape. The overlaying content that is outside the shape mask will be cut off. | |
mode | Literal["default", "add", "add_modulo", "screen", "lighter", "subtract", "subtract_modulo", "multiply", "darker", "difference", "soft_light", "hard_light"] | The blender mode of the overlaying effect. |
Methods
overlay
v_1: Image | None = self.overlay(shape: Image)
Generate the overlay image from the given image.
Requires
| Name | Type | Required | |
|---|---|---|---|
shape | Image | An L type image defining the shape of the overlay. This value is provided when rendering the overlaying effect. |
Returns
| Name | Type | |
|---|---|---|
v_1 | Image | None | The generated overlay image. This image can be not This image should be center-aligned with the input Will return |
Properties
intermediate_bg_color
intermediate_bg_color: str | tuple[float, ...] = self.intermediate_bg_color
The intermediate background color. This value may be used when the layer content needs to be rescale.