Skip to main content

ImageEffectAbstract

ClassDataClassSource

ImageEffectAbstract()

The abstract image effect.

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​

effect​

v_1: Image | None = self.effect(image_fg: Image)

Generate the effect image from the given image.

Requires​

NameTypeRequired
Description
image_fgImageThe image used for genereating this effect.

Returns​

NameType
Description
v_1Image | None

The generated effect image. This image should be RGBA, and the size can be different from the input image.

This image should be center-aligned with the input image_fg.

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 RGB or RGBA.
image_fgImageThe image used for genereating this effect.

Returns​

NameType
Description
v_1ImageThe composed image.

render​

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

Render this effect.

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 RGB or RGBA.
image_fgImageThe image used for genereating this effect.
postuple[int, int]The (x, y) position where the image_fg is placed on the image_bg. This position is the top-left corner of image_fg.

Returns​

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