egw

Syntax

int egw (int bottom, int top, int value)

Arguments

bottom
Bottom edge value
top
Top edge value
value
Value that will be edge wrapped.

Return

The edge-wrapped value will be returned.

Description

This function returns the value untouched if it lies between bottom and top. If it lies outside bottom and top, the value will be edge wrapped to lie between bottom and top. For example, a value of 21 would be returned as 11 if bottom=10 and top=20 or returned as 12 if bottom=10 and top=19.

Example

%ffp

ctl(0): "Butt",range=(0,255),val=20
ctl(1): "Top",range=(0,255),val=100

ForEveryTile:
{
	setCtlRange(0,0,min(X,Y));
	setCtlRange(1,0,min(X,Y));

	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, src( egw(ctl(0),ctl(1),x) , egw(ctl(0),ctl(1),y) , z) );

	}}}

	return true;
}