MergeEx

Graphics32

MergeEx

function MergeRegEx(F, B, M: TColor32): TColor32;

procedure MergeMemEx(F: TColor32; var B: TColor32; M: TColor32);

Description

Merges the foreground color with the background color using alpha of the foreground color scaled by the master alpha value M. Alpha-Channels are also merged.

SA = 1 - (1 - (M * FA)) (1 - BA)

SRGB = ((M * FA) * FRGB + BA * (1 - FA) * BRGB) / SA

M is defined as TColor32 to avoid unnecessary type conversions, it must store only values in [0..255] range, the function does not perform range checking and the result in case M > 255 is not specified.

MergeRegEx takes parameters and produces the result operating on CPU registers.

MergeMemEx operates with the background color referenced by a memory address.

Note, that after using MergeEx functions, you have to call EMMS. Otherwise CPU will be unable to handle floating point instructions.

See Also

Blend, BlendEx, Combine, EMMS, Merge, TColor32