Undercover Operations

<< Click to Display Table of Contents >>

Navigation:  3. Script Language > Image/Pixel-Color Operations > Undercover and Graphics >

Undercover Operations

UCV.line - draw line

Previous Top Next


MiniRobotLanguage (MRL)

 

UCV.line

UCV.lin

UCV.drawto

Draw a line onto the cover

 

 

Intention

 

This command will draw a line between two pixel-coordinates onto the cover. The line 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.

 

General usage is simple:

 

' Set foreground color

UCV.fgr|&HFF00FF

' Draw thwe line from 600,1 to 200,100

UCV.line|600,1|200,100

 

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

 

 

' Here is a complete example using a gradient as background.

UCV.nb

UCV.gradient

FOR.$$XCO|1|600

 UCV.fgr|&HFF00FF

 UCV.line|600,$$XCO|($$XCO*2.5),1

NEX.

PAU.4

UCV.

ENR.ENR.

 

You can draw more complex example, like this:

 

' compile before running

UCV.nb

UCV.gradient

FOR.$$XCO|1|600

 UCV.fgr|&H0000FF

 UCV.set pixel|$$XCO,1

 UCV.line|($$XCO*2.5),600

 UCV.fgr|&HFF0000

 UCV.line|1,$$XCO|600,($$XCO*2.5)

 UCV.fgr|&H00FFFF

 UCV.line|($$XCO*2.5),600|1,$$XCO

 UCV.fgr|&HFFFF

 UCV.line|600,$$XCO|($$XCO*2.5),1

NEX.

PAU.4

UCV.

ENR.

 

graphic

 

 

 

Syntax

 

 

UCV.line|P1,P2[|P3,P4]

UCV.lin|P1,P2[|P3,P4]

UCV.drawto|P1,P2

 

 

Parameter Explanation

 

P1,P2 - Screen-Pixel-Coordinates for the starting Point of the line to be drawn.

 

P3,P4 - (optional) Screen-Pixel-Coordinates for the ending-Point of the line to be drawn.

    If omitted, the last used Coordinates are used. This way you can easily draw a figure

     of lines.

 

 

 

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

  CCV. - Color Conversion