<< Click to Display Table of Contents >> Navigation: 3. Script Language > Image/Pixel-Color Operations > Undercover and Graphics > Undercover Operations |
MiniRobotLanguage (MRL)
UCV.plot
UCV.set pixel
UCV.spi
Paint a single pixel onto the cover
Intention
This command will paint a single pixel at a pixel-coordinate, onto the cover. The pixel is been drawn in the foreground color. As this is a very general graphics command, it will enable you to draw all sorts of shapes from pixels.
General usage is simple:
' Set foreground color
UCV.fgr|&HFF00FF
UCV.plot|600,1
Points that have been set using the "set point" command can be used as starting points for the "Line" command. In that case you can omit the second coordinate pair.
' We set a single Pixel at 1,1 which will then
' be the starting point for the line.
UCV.set pixel|1,1
' you can use mathematical inline calculations
' for all coordinates
UCV.line|($$XCO*2.5),600
You can draw more complex examples, like this:
' compile before running
'#SPI:Forcewrite
UCV.nb
UCV.grd|&H00FF00
' Set red foreground color
UCV.fgr|&HFF0000
FOR.$$F00|0|16|0.01
CAX.$$X00=2*$$F00
CAX.$$Y00=EXP(-$$X00/4)*SIN($$X00)
CAL.$$Y00=$$Y00*500+500
CAL.$$X00=10*$$X00
IVV.$$Y00>0
UCV.drawto|$$X00,$$Y00
UCV.plot|$$X00,$$Y00
EIF.
NEX.
PAU.1
UCV.
ENR.
' The following script will also
' paint a mathematical figure
'#SPI:Forcewrite
UCV.nb
UCV.grd|&H0000FF
' Set red foreground color
UCV.fgr|&HFFFF00
FOR.$$F00|0|45|0.007
$$C00=0.7
CAX.$$X00=COS($$F00)+$$C00*COS(-3*$$F00)
CAX.$$Y00=SIN($$F00)+$$C00*SIN(-3*$$F00)
CAL.$$Y00=$$Y00*50+200
CAL.$$X00=60*$$X00+200
IVV.$$Y00>0
'UCV.drawto|$$X00,$$Y00
UCV.plot|$$X00,$$Y00
EIF.
NEX.
PAU.1
ENR.
'#SPI:Forcewrite
UCV.nb
UCV.grd|&HFF4545
' Set red foreground color
UCV.fgr|&HFFFF00
FOR.$$F00|0|45|0.002
$$C00=0.7
CAX.$$X00=COS(6*$$F00)+$$C00*COS(-4*$$F00)
CAX.$$Y00=SIN(6*$$F00)+$$C00*SIN(-4*$$F00)
CAL.$$Y00=$$Y00*260+700
CAL.$$X00=260*$$X00+700
IVV.$$Y00>0
UCV.plot|$$X00,$$Y00
UCV.drawto|($$X00+2),($$Y00+2)
UCV.plot|$$X00,$$Y00
UCV.drawto|($$X00),($$Y00+2)
UCV.plot|$$X00,$$Y00
UCV.drawto|($$X00+2),($$Y00
EIF.
NEX.
PAU.1
ENR.
Syntax
UCV.plot|P1,P2
UCV.set pixel|P1,P2
UCV.spi|P1,P2
Parameter Explanation
P1,P2 - Screen-Pixel-Coordinates for the starting Point of the line to be drawn.
Example
'***********************************
' UCV.-Sample
'
'***********************************
UCV.nbi
UCV.dbw
FOR.$$XCO|1|1200|4
UCV.fgr|&HFF00FF
UCV.line|1200,$$XCO|($$XCO*2.5),1
NEX.
PAU.4
UCV.
ENR.
'***********************************
' UCV.-Sample 2
' use Lines in random colors
'***********************************
'
UCV.nbi
UCV.dbw
FOR.$$XCO|1|1200|4
UCV.fgr|&HFF00FF
UCV.line|1200,$$XCO|($$XCO*2.5),1
UCV.fgr|&HFFFF00
' Generate random colors
RND.120|255|$$RED
RND.120|255|$$GRN
RND.120|255|$$BLU
CAL.$$COL=$$RED+256*$$GRN+(256*256)*$$BLU
UCV.fgr|$$COL
'-------------------------
UCV.line|1200,($$XCO*2.5)
UCV.line|($$XCO*2.5),1200
UCV.line|($$XCO*2.5),1|($$XCO*2.5),1200
NEX.
PAU.4
UCV.
ENR.
'***********************************
' UCV.-Sample 2
' Mathematical figure in random colors
'***********************************
'
$$XCE=800
$$YCE=500
UCV.nb
UCV.cov
UCV.bgr|&HFFFFFF
UCV.fgr|&H0000FF
UCV.plot|$$XCE,$$YCE
FOR.$$VAA|0|($$XCE*2)
GSB.rndcol
CAX.$$XCO=$$XCE+300*SIN($$VAA*3.14/180)
CAX.$$YCO=$$YCE+300*COS($$VAA*3.15/180)
UCV.drawto|$$XCO,$$YCO
NEX.
PAU.5
ENR.
:rndcol
RND.120|255|$$RED
RND.120|255|$$GRN
RND.120|255|$$BLU
CAL.$$COL=$$RED+256*$$GRN+(256*256)*$$BLU
UCV.fgr|$$COL
RET.
'***********************************
' UCV.-Sample 2
' Mathematical figure
'***********************************
$$XMA=800
$$STP=15
UCV.nbi
UCV.dbw
UCV.fgr|&HFF00FF
FOR.$$XCO|1|($$XMA+$$STP)|$$STP
UCV.drawto|0,$$XCO|$$XCO,$$XMA
UCV.drawto|$$XCO,0|$$XMA,$$XCO
NEX.
PAU.5
ENR.
Remarks
-
Limitations:
PopUp-Menus and other TopMost Forms may be able to get temporarily in front of the Cover-form. This is due to windows-technical reasons and not a bug.
See also:
• ! Smart Package Robot 's Undercover Operations
• ! UCV. - Undercover Graphics