AlgoSim
Homepage | Screenshots | Gallery of Visualisation | User's Guide | Function Reference | Download | FAQ | Support | Bugs and Solutions | Donate

Reference: pmHSVAdjustment

pmHSVAdjustment(pm, Hmode, Hval, Smode, Sval, Vmode, Vval) returns the pixmap pm whith the hue, saturation, and value components of each pixel transformed separately according to the component's Xmode and Xval (X = H, S, or V) parameters.

Each Xmode can be either "fixed", "add", or "mul".

 * If Xmode is "fixed", each pixel's X component will be set to Xval.
 * If Xmode is "add", each pixel's X component will be increased by Xval, that is, its new value will be the sum of its old value and Xval.
 * If Xmode is "mul", each pixel's X component will be multiplied by Xval, that is, its new value will be the product of its old value and Xval.

Notice that the component identity operation is achieved either by setting Xmode = "add" and Xval = 0 or by setting Xmode = "mul" and Xval = 1.

Notice! The resulting saturation and value components are finally truncated to [0, 1].

Examples: Let pm be a pixmap variable. Then

  pmHSVAdjustment(pm, "fixed", 0, "add", 0, "add", 0)

will return the pixmap pm where the hue of each pixel has been set to 0 (red).

  pmHSVAdjustment(pm, "add", 180, "add", 0, "add", 0)

will return the pixmap pm where the hue of each pixel has been shifted by 180 degrees.

  pmHSVAdjustment(pm, "add", 0, "mul", 0.5, "add", 0)

will return the pixmap pm where the saturation of each pixel has been halved.