Skip to main content

ImageOverlayAbstract

ClassDataClassSource

ImageOverlayAbstract()

The abstract image overlay.

Most properties are not implemented here.

It is only used for providing the common logics of different effects.

Fields​

No field is defined.

Abstract methods​

overlay​

v_1: Image | None = self.overlay(shape: Image)

Generate the overlay image from the given image.

Requires​

NameTypeRequired
Description
shapeImageAn L type image defining the shape of the overlay. This value is provided when rendering the overlaying effect.

Returns​

NameType
Description
v_1Image | None

The generated overlay image. This image can be not RGBA, but will be automatically converted to RGBA by applying the self.shape as the alpha channel. The size can be different from the input image. However, in most cases, this size should be the same as self.shape.

This image should be center-aligned with the input self.shape.

Will return None if the effect should be skipped.

Methods​

compose​

v_1: Image = self.compose(comp: ImageComposer, image_bg: Image, image_fg: Image)

Compose the background and foreground images.

This method do not need to be overriden unless the subclass needs to change the behavior of image blending.

Requires​

NameTypeRequired
Description
compImageComposerThe composer that is used for merging images.
image_bgImageThe background image where the effect will be rendered. This image should be in RGB or RGBA.
image_fgImageThe foreground image that will be used as the overlaid layer. This image should be in RGBA.

Returns​

NameType
Description
v_1ImageThe composed image.

render​

v_1: Image = self.render(
comp: ImageComposer, image_bg: Image, shape: Image, pos: tuple[int, int]
)

Render this overlay effect.

Requires​

NameTypeRequired
Description
compImageComposerThe composer that is used for merging images.
image_bgImageThe background image where the overlay image will be rendered. This image should be in RGB or RGBA.
shapeImageAn L type image defining the shape of the overlay. This value can be provided by the alpha channel of an image.
postuple[int, int]

The position shift of the shape. This position means the top left corner of the given shape.

This value should be (0, 0) if the given shape has the same size of the background.

Returns​

NameType
Description
v_1ImageThe image_bg with this effect image rendered on it.

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.