<< Click to Display Table of Contents >> Navigation: 3. Script Language > Image/Pixel-Color Operations > ANA. - Imageworks > Paint Operations > Image/Pixel-Color Operations |
MiniRobotLanguage (MRL)
ANA.DrawLine
Draw a Line into an Image-Register (IR)
Intention
This command will draw a line into an IR.
The line can whether be drawn with a solid color or use inverted background-color.
1. Draw a Line that will invert the underlying Colors
In this Sample we will generate a Backgound and then Paint Lines over it. As Color we use "-1" that is "Invert Background Color".
Due to the use of a Loop with 255 Iterations, it is recommended to start the script in the Editor using "Freerun Mode".
You will not see the Robot Painting unless the Show command is been called.
ANA.New|0|800|400
ANA.vgradient|0|&HFF00FF|&H000000
ANA.New|2|800|400
ANA.hgradient|2|&H0000FF|&H00FFFF
ANA.Mix|0|2|7
' Draw red line
FOR.$$LU3|1|255|1
ANA.DrawLine|2|$$LU3|10|$$LU3|299|&HFF0000
NEX.
' Draw inverted Line
FOR.$$LU3|1|255|1
ANA.DrawLine|2|100|$$LU3|20|$$LU3|-1
NEX.
ANA.Show|2!
FOR.$$LJ7|1|2500
RND.0|740|$$XP1
CAL.$$XP2=$$XP1+120
RND.0|340|$$YP1
CAL.$$YP2=$$YP1+80
ANA.DrawLine|2|$$XP1|$$YP1|$$XP2|$$YP2|-1
NEX.
DMP.1
ANA.Show|2!
ENR.
This box is filled and it is drawn with inverted background color. The second Part of the Script will draw 2500 random Lines.
The Speed-dump shows that the Robot can draw several thousands Lines per second.
2. Line-Patterns
Drawing Lines with a step of 2 or 3 can bring your display to the Limit of its abilities in showing clear colors.
If you draw Lines in a specified color and it looks like they have another color, then its a "Display issue".
.
ANA.New|0|800|400
ANA.vgradient|0|&HFF00FF|&H000000
ANA.New|2|800|400
ANA.hgradient|2|&H0000FF|&H00FFFF
ANA.Mix|0|2|7
' Draw red line
FOR.$$LU3|1|255|3
ANA.DrawLine|2|$$LU3|10|$$LU3|299|&HFF0000
NEX.
' Draw inverted Line
FOR.$$LU3|1|255|2
ANA.DrawLine|2|100|$$LU3|20|$$LU3|-1
NEX.
ANA.Show|2!
ENR.
3. Draw inverted Lines
In the following Script we will draw sort of random lines.
We will draw 2500 Lines. In "Freerun-Mode" this will take less than a second.
Infact the Robot can - in my test - draw up to 10400 inverted Lines per Second.
ANA.New|0|800|400
ANA.vgradient|0|&HFF00FF|&H000000
ANA.New|2|800|400
ANA.hgradient|2|&H0000FF|&H00FFFF
ANA.Mix|0|2|7
FOR.$$LJ7|1|2500
RND.0|740|$$XP1
CAL.$$XP2=$$XP1+120
RND.0|340|$$YP1
CAL.$$YP2=$$YP1+80
ANA.DrawLine|2|$$XP1|$$YP1|$$XP2|$$YP2|-1
NEX.
DMP.1
ANA.Show|2!
ENR.
Here is the Speed-Dump:
Here is the result:
Syntax
ANA.DrawLine[|P1][|P2][|P3][|P4][|P5]
Parameter Explanation
P1 - Source Image-Register number
P2 - X1 - Upper Left Coordinat X-Value
P3 - Y1 - Upper Left Coordinat Y-Value
P4 - X1 - Lower Right Coordinat X-Value
P5 - Y1 - Lower Right Coordinat Y-Value
P6 - opt. Color-Value (like &HFF00FF), if omitted -1 is used. If -1 is given, the Pixel-Color will be inverted.
The Command will leave a 0 on the TOS in case of error, otherwise you get the number of copied patterns.
Example
'***********************************
' ANA.DrawLine-Sample
'***********************************
' This Sample will Draw about 25000 Lines per Second
ANA.New|0|800|400
ANA.vgradient|0|&HFF00FF|&H000000
ANA.New|2|800|400
ANA.hgradient|2|&H0000FF|&H00FFFF
ANA.Mix|0|2|7
' Draw red line
FOR.$$LU3|1|25500
RND.1|799|$$XP1
RND.1|799|$$XP2
RND.1|399|$$YP1
RND.1|399|$$YP2
RND.-1|1|$$COA
IVV.$$COA<1
VAN.$$COL=-1
ELS.
RND.0|&HFFFFFF|$$COL
EIF.
ANA.DrawLine|2|$$XP1|$$YP1|$$XP2|$$YP2|$$COL
NEX.
ANA.Show|2!
ENR.
Remarks
A rather complex DrawLine-Command with several Variables uses on my computer between 400 to 1540 Ticks. This is at most 1/10000 th of a second on my Computer.
Therefore the Robot could draw more then 10000 Lines per Second.
Limitations:
-
See also:
•