Promotic

ColorOper - method of the Pm object

Description:
Various operations with defined color.
Syntax:
Variant ColorOper(Variant vInput, Long nType, [Variant vPar])
Parameters:
vInput(Variant) Input value over which the conversion of the nType type will be executed.
nType(Long) Conversion type of the vInput parameter input value:
2 - Darken or lighten the color.
The vInput parameter is RGB String in the form #RRGGBB.
The method returns a RGB String in the form #RRGGBB.
The returned color is lighter or darker than the color defined in the vInput parameter.
The vPar parameter is a real number in the range from -1 to 1, that specifies the lighten ratio (from 0 to 1), or darken ratio (from 0 to -1).
11 - Red color compound.
The vInput parameter is RGB String in the form #RRGGBB.
The method returns the numeric value (0-255) of the red component (RR).
The vPar parameter has no meaning here and therefore can be omited.
12 - Green color compound.
The vInput parameter is RGB String in the form #RRGGBB.
The method returns the numeric value (0-255) of the green component (GG).
The vPar parameter has no meaning here and therefore can be omited.
13 - Blue color compound.
The vInput parameter is RGB String in the form #RRGGBB.
The method returns the numeric value (0-255) of the blue component (BB).
The vPar parameter has no meaning here and therefore can be omited.
21 - Color defined by index.
The vInput parameter is the color entered by the numeric index to the PROMOTIC color palette.
The method returns a RGB String in the form #RRGGBB.
The vPar parameter has no meaning here and therefore can be omited.
vPar[optional] (Variant) Transfomation type parameter. The meaning of this parameter is based on the nType parameter.
Note:
This method is functional also in Macro expression $.expr and in the onDraw event of the PmgCanvas object.
This method is also functional in Web panels. The nType=21 is not functional in the Web panel.
Example1:
The example converts RGB String to three numbers: In nR (red) will be the 255 value (=ff hexa), In nG (green) will be the 1 value, In nB (blue) will be the 215 value (=d7 hexa).
JavaScriptVBScriptSelect and copy to clipboard

var nR = Pm.ColorOper("#ff01d7", 11);
var nG = Pm.ColorOper("#ff01d7", 12);
var nB = Pm.ColorOper("#ff01d7", 13);
Example2:
The example transforms the grey color ("#808080") to lighter grey with the lighten ratio of 0.6.
JavaScriptVBScriptSelect and copy to clipboard

var sColor1 = "#808080";
var sColor2 = Pm.ColorOper(sColor1, 2, 0.6);

History:
Pm8.02.07: New transfomation type 2 can darken or lighten defined color.
Pm8.01.01: The for Web panels is now accessible. New values (11,12,13) of the nType parameter.
PROMOTIC 9.0.18 SCADA system documentation - MICROSYS, spol. s r.o.

Send page remarkContact responsible person
Navigation:
 
- Pm
 
- Abs
- ColorOper
 
 
- Cos
- E
- Exp
- LN2
- PI
- Pow
- Sin
- Tan
© MICROSYS, spol. s r. o.