Merge

Graphics32

Merge

function MergeReg(F, B: TColor32): TColor32;

procedure MergeMem(F: TColor32; var B: TColor32);

Description

Merges a foregrownd (F) color with the background color (B) using the alpha component of the foreground color. It does merge the alpha-channels.

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

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

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

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

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

See Also

Blend, BlendEx, Combine, EMMS, MergeEx, TColor32