<< Click to Display Table of Contents >> Navigation: 3. Script Language > Image/Pixel-Color Operations > ANA. - Imageworks > Color-Calculation > ANA.GetGradientColor |
MiniRobotLanguage (MRL)
ANA.GetGradientColor
Calculate the Color of a SIngle Pixel in a Gradient between two Colors
Intention
Use this command to calculate a Gradient Color between two colors.
$$COA=&HFF0000
$$COB=&H0000FF
VAN.$$XPS=640
VAN.$$YPS=400
ANA.New|1|$$XPS|$$YPS
VAN.$$AXA=0
VAN.$$AYA=0
VAN.$$AXB=64
VAN.$$AYB=200
VAN.$$BXA=($$XPS-$$AXB)
VAN.$$BYA=0
VAN.$$BXB=639
VAN.$$BYB=200
GSB.DrawGradient
$$COB=&HFF0000
$$COA=&H0000FF
VAN.$$AYA=200
VAN.$$AYB=400
VAN.$$BYA=200
VAN.$$BYB=400
GSB.DrawGradient
ANA.show|1!
ENR.
'===========================================================
:DrawGradient
ANA.DrawBox|1|$$AXA|$$AYA|$$AXB|$$AYB|$$COA|1
ANA.DrawBox|1|$$BXA|$$BYA|$$BXB|$$BYB|$$COB|1
CAL.$$DIF=$$BXA-$$AXB
FOR.$$XPO|$$AXB|$$BXA
CAL.$$XPA=$$XPO-$$AXB+1
ANA.GetGradientColor|$$COA|$$COB|$$DIF|$$XPO|$$RES
ANA.DrawLine|1|$$XPO|$$AYA|$$XPO|$$BYB|$$RES
NEX.
RET.
Output:
Syntax
ANA.GetGradientColor|P1|P2|P3[|P4]
Parameter Explanation
P1 - Color Value A (24-Bit, Format in Hexadezimal: &HFFFFFF=RR GG BB)
P2 - Color Value B (24-Bit, Format in Hexadezimal: &HFFFFFF=RR GG BB)
P3 - Number of Steps for the Gradient. 1 ... P3.
P4 - Number of the Step for which the Gradient shall be calculated.
P5 - Variable for the result. If omitted the result is placed on TOS.
Remarks
The ANA.Sub/Add/Mix Commands are optimized for Speed. They will only use about 210 Ticks. Therefore the Robot could work on more then 76000 Values per Second.
Limitations:
-
See also: