Predefined Functions – merge<type>

Function name: merge<type>
Synopsis: merge<type>(color1,color2)


Input data type Output data type
color, color color

Description:

These functions perform the layer merging operations: They do just the same as the layer merging operations, so by using these functions you can reproduce how the layers in ChaosPro are merged to form the resulting image:

Suppose you have two colors, the base color col1 and the merge color col2, using opacity opacity. Then use the following statement to reproduce the layer merging:

compose(col1, blend(col2, merge<type>(col1, col2), alpha(col1)), opacity)

The following merge functions exist:

Function Meaning
mergenormal The resulting color is a mix between the base color and the merge color. Factor defines the exact mix: 0 means base color, 100 means merge color. By increasing Factor from 0 to 100 you get a smooth color range from base color to merge color. In other words: It lets you lay over one layer where the underlying layers “shine through”.
mergemultiply Multiplicates base and merge color on rgb basis. This means as soon as one component is 0, the resulting component will be 0, too. This darkens the image.
mergescreen Lightens the image by multiplying the inverse colors: This lightens the image.
mergeoverlay Multiplicates  or screens  the base and merge color on rgb bases: If the base color component is less than 128, it screens, otherwise it multiplies.
mergesoftlight This mode takes the base color as basis and darkens or lightens it according to the blend color. The resulting image looks like the base image with darker and lighter regions according to the blend image.
mergehardlight Multiplicates  or screens  the base and merge color on rgb bases (similar to Overlay): But the logic is invers.
mergedarken Darkens the base image according to the merge image (by taking the smaller rgb color component).
mergelighten Lightens the base image according to the merge image (by taking the bigger rgb color component).
mergedifference Returns the difference between the base color and the merge color (on rgb basis).
mergehue Replaces the hue of the base color with the hue of the merge color.
mergesaturation Replaces the saturation of the base color with the saturation of the merge color.
mergecolor Replaces the hue and saturation of the base color with the hue and saturation of the merge color.
mergeluminance Replaces the luminance of the base color with the luminance of the merge color.
mergeaddition Adds the base and merge color on rgb basis.
mergesubtraction Subtracts the merge color from the base color on rgb basis.
mergehsladdition Adds base and merge color on hsl basis.
mergered Replaces the red component of the base color with the red component of the merge color.
mergegreen Replaces the green component of the base color with the green component of the merge color.
mergeblue Replaces the blue component of the base color with the blue component of the merge color.

merge