Screen transparency types

Updated: October 26, 2022

Types of window transparencies

Synopsis:

#include <screen/screen.h>
enum {
    SCREEN_TRANSPARENCY_SOURCE = 0,
    SCREEN_TRANSPARENCY_TEST = 1,
    SCREEN_TRANSPARENCY_SOURCE_COLOR = 2,
    SCREEN_TRANSPARENCY_SOURCE_OVER = 3,
    SCREEN_TRANSPARENCY_NONE = 4,
    SCREEN_TRANSPARENCY_DISCARD = 5,
    SCREEN_TRANSPARENCY_REVERSED_TEST = 6
};

Data:

SCREEN_TRANSPARENCY_SOURCE
Destination pixels are replaced by source pixels, including the alpha channel.
SCREEN_TRANSPARENCY_TEST
Destination pixels are replaced by source pixels.

The replacement is based on a comparison between the source pixel's alpha value and the reference alpha value. The reference alpha value is dependent on the blitter.

SCREEN_TRANSPARENCY_SOURCE_COLOR
Destination pixels are replaced by source pixels when the source color does not match the reference color value (0xffff00ff).

When the source color does match the reference color value, the pixels are treated as transparent.

SCREEN_TRANSPARENCY_SOURCE_OVER
Typical alpha blending; the source pixels are blended over the destination pixels.
SCREEN_TRANSPARENCY_NONE
Destination pixels are replaced by fully-visible source pixels.
SCREEN_TRANSPARENCY_DISCARD
Source is considered completely transparent; the destination is not modified.
SCREEN_TRANSPARENCY_REVERSED_TEST
Destination pixels are replaced by source pixels.

The replacement is based on a comparison between the source pixel's alpha value and the reference alpha value. The reference alpha value is dependent on the blitter.

Library:

libscreen