Image/Pixel-Color Operations

<< Click to Display Table of Contents >>

Navigation:  3. Script Language > Image/Pixel-Color Operations > ANA. - Imageworks > Change Resolution >

Image/Pixel-Color Operations

ANA.GetXYFromPixelPos - Get X,Y Pos from PP

Previous Top Next


MiniRobotLanguage (MRL)

 

ANA.GetXYFromPixelPos

Get X- and Y- Position from the sequential Pixel-Position-Number

 

 

Intention

 

This command will get the X- and the Y- Position from a sequential-Pixel-Position Number of a specified IR.

The result is 0-based, means that the upper left coordinate is 0,0.

You also need to know that each Pixel has 4 Bytes (24-Bit Color+1 Byte Alpha).

 

For example, if IR-0 has a resolution of 100x400

 

ANA.New|0|100|400

ANA.GetXYFromPixelPos|0|212|$$XPO|$$YPO

DMP.6

MBX.Result is $$XPO,$$YPO

ENR.

 

 

GetXY6GetXY5

This is the result from the above Script. On the Stack you can also see the "Byteposition" that is 848.

The last number, 4 is from the ANA.New-Command.

 

 

1. Use ANA.GetXYFromPixelPos with the Stack

 

This will use ANA.GetXYFromPixelPos with the Stack.

 

ANA.New|0|100|400

ANA.GetXYFromPixelPos|0|212

DMP.6

MBX.Result is on the Stack.

ENR.

 

   The Stack will look like this:

GetXY8GetXY7

 

On TOS is the the "Byteposition", followed by the X-Position, followed by the Y-Position.

The last number, 4 is from the ANA.New-Command.

 

 

 

Syntax

 

ANA.GetXYFromPixelPos|[|P1][|P2][|P3][|P4]

 

Parameter Explanation

 

P1 - Image-Register number, if omitted, IR 0 will be used.

P2 - Pixel-Position to convert.

P3 - opt. Variable that will receive the X-Position, if omitted, TOS will be used.

P4 - opt. Variable that will receive the Y-Position, if omitted TOS will be used.

 

The Command will leave the Byteposition on the TOS.

 

 

Example

 

'***********************************

' ANA.GetXYFromPixelPos-Sample

'***********************************

ANA.New|0|100|400

ANA.GetXYFromPixelPos|0|212

DMP.6

MBX.Result is on the Stack.

ENR.

 

 

 

 

 

 

Remarks

 

-

 

 

 

Limitations:

 

-

 

See also: