blend

Syntax

int blend (int a, int b, int z, int m, int r)

Arguments

a
Bottom Color Value from 0 to 255
b
Top Color Value from 0 to 255
z
Color Channel Value z. Only needed for the Dissolve, Threshold and Threshold 2 blend modes.
m
Blend Mode (0 = Normal, 1 =Dissolve, 2 =Threshold, 3 = Threshold 2, 4 = Multiply, 5 = Screen, 6 = Overlay, 7= Soft Light, 8 =Hard Light, 9 = Dodge, 10 = Burn, 11 = Darken, 12 = Lighten, 13 = Exclusion, 14 = Difference, 15 = NegDif 1, 16 = NegDif 2, 17 = Subtract, 18 = Add, 19 = Expose)
r
blending ratio from 0 (bottom) to 255 (top)

Return

The blended color value is returned.

Description

Blends two color values according to 20 different blending modes. There's also a parameter for the blending ratio. Currently works only with 8-bit color values.

Example

%ffp
//This example blends the image with a mirrored version of itself

ctl(0): "Ratio",range=(0,255),val=128
ctl(1): combobox(vscroll),action=preview, color=#FFFFFF,fontcolor=#0000ff, size=(50,200), 
	text="Normal\nDissolve\nThreshold\nThreshold 2\nMultiply\nScreen\nOverlay\nSoft Light\nHard Light\nDodge\nBurn\nDarken\nLighten\nExclusion\nDifference\nNegDif 1\nNegDif 2\nSubtract\nAdd\nExpose",
	val=0

ForEveryTile:
{
	for (y=y_start; y<y_end; y++){
		updateProgress(y,y_end);
	for (x=x_start; x<x_end; x++){ 
	for (z=0; z<Z; z++){ 
		pset(x, y, z, blend (src(x,y,z), src(X-x,Y-y,z) , z, ctl(1),ctl(0)) );

	}}}
	return true;
}