Combine

Graphics32

Combine

function CombineReg(X, Y, W: TColor32): TColor32;

procedure CombineMem(F: TColor32; var B: TColor32; W: TColor32);

Description

Returns the color with components calculated as linear interpolation between X and Y colors. The W parameter, which sholuld be in [0..255] range, specifies the weight of the first color (X). The alpha channel is interpolated as well.

SRGBA = W * XRGBA + (1 – W) * YRGBA;

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

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

Using CombineMem is more efficient when blending/combining data to a bitmap since it excludes writing operation for transparent pixels and reading operation for opaque ones.

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

See Also

Blend, BlendEx, EMMS, TColor32