diffrp.utils.composite#
- diffrp.utils.composite.additive(bgc: Tensor, bga: Tensor, fgc: Tensor, fga: Tensor)#
- diffrp.utils.composite.alpha_additive(bgc: Tensor, bga: Tensor, fgc: Tensor, fga: Tensor)#
- diffrp.utils.composite.alpha_blend(bgc: Tensor, bga: Tensor, fgc: Tensor, fga: Tensor)#
- diffrp.utils.composite.background_alpha_compose(bg: Tensor | List[float | int] | float | int, fgca: Tensor)#
Compose a background color to a foreground via alpha blending.
It not only applies to RGB color and RGBA foregrounds, but also general linear data.
The background should be one element shorter than the foreground elements.
- Parameters:
bg – Tensor or List[float] or number. A single number is equivalent to the RGB list filled by it. The length should be one less than foreground.
fgca – Tensor with alpha, shape (…, C + 1).
- Returns:
Composed result, shape (…, C).
- Return type:
torch.Tensor
- diffrp.utils.composite.ssaa_downscale(rgb, factor: int)#