Older Newer
Tue, 26 Nov 2019 12:23:40 . . . . SyneRyder [Fix Syntax typo]


Changes by last author:

Added:
= saturation =

== Syntax ==

int saturation(int r, int g, int b, int z, int sat)

== Arguments ==

:r

::The Red pixel color value

:g

::The Green pixel color value

:b

::The Blue pixel color value

:z

::The pixel channel that will be returned by the function: 0 for red, 1 for green, 2 for blue.

:sat

::The amount of saturation to apply on a range of -500 to 500, with 0 meaning no saturation adjustment. Negative values desaturate the image.

== Return ==

The new pixel color channel value after the saturation effect is applied.

== Description ==

Applies a simple saturation effect to a given RGB pixel value.

== Example ==

<code>

ctl[0]: "Saturation", Range=(-500,500), Val=0

ForEveryTile: {

int r, g, b;

for (y = y_start; y < y_end; y++) {

for (x = x_start; x < x_end; x++) {

r = src(x,y,0);

g = src(x,y,1);

b = src(x,y,2);

for (z=0; z < 3; z++) {

pset(x,y,z, saturation(r, g, b, z, ctl(0)));

}

}

}

return true;

}

</code>

== See Also ==

blend, contrast, gamma, gray