Calculations than are to be used as paint mode transformation can be made based on combining color indexes or by doing calculations in RGB or HSB spaces. You may define settings for any of these calculation types. The current selected one (tab) is then actually used.
When applying the formula paint mode Pro Motion passes pixel data of the underlying image and the used brush shape to the corresponding formula.
The formula engine that is used provides the following set of mathematical operators:
|<=||less or equal||2|
|>=||greater or equal||2|
|^||raise x to the power of y||5|
The smaller the priority the later the operator is applied to it's operands. For example x * 3 - 2 will calculate "x * 3" before substracting 2. To have other priorities you must use braces, like x * (3-2).
Additionaly the follwing functions are supported:
|Name||# of Arguments||Explanation|
|asin||1||arcus sine function|
|acos||1||arcus cosine function|
|atan||1||arcus tangens function|
|sinh||1||hyperbolic sine function|
|tanh||1||hyperbolic tangens function|
|asinh||1||hyperbolic arcus sine function|
|acosh||1||hyperbolic arcus tangens function|
|atanh||1||hyperbolic arcur tangens function|
|log2||1||logarithm to the base 2|
|log10||1||logarithm to the base 10|
|log||1||logarithm to the base 10|
|ln||1||logarithm to base e (2.71828...)|
|exp||1||e raised to the power of x|
|sqrt||1||square root of a value|
|sign||1||sign function -1 if x0|
|rint||1||round to nearest integer|
|if||3||if ... then ... else ...|
|min||variable||min of all arguments|
|max||variable||max of all arguments|
|sum||variable||sum of all arguments|
|avg||variable||mean value of all arguments|
The arguments must be passed in braces, e.g. sin(x) or if( x > 2, 7, 6 ). The number of arguments may be variable, for example when using the sum function.
Predefined variables to create calculations with are always listed at the respective color space section.
IndexedCalculations working on color indexes will get color indexes as input data. You can not access any RGB values of the colors. That means you formula must have knowledge about color orders in your palette.
RGBCalculations working on RGB color space get RGB values as input data. For the RGB result the best matching color in the color table is used. The result can be very poor, if the colors in palette differ too much from the results. To improve this you can Limit the Color Matching to current Gradient or use a Dither Mode. Dithering works best if you use an uniform palette, like the one that is saved as "uniform.pal" in the palettes folder.
HSBCalculations working on HB color space get HSB values as input data. For the HSB result the best matching color in the color table is used. The definitions for color matching are the same as with RGB mode.
The formula parser that is included is the open source "muparser" created by Ingo Berg which can be found at http://muparser.beltoforion.de/
Related topicsPaint Mode Settings
Last modified: 27 December 2016