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.GetXYFromBytePos - Get X,Y Pos from BP

Previous Top Next


MiniRobotLanguage (MRL)

 

ANA.GetXYFromBytePos

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

 

 

Intention

 

This command will get the X- and the Y- Position from a Byte-Position 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.GetXYFromBytePos|0|409|$$XPO|$$YPO

DMP.6

MBX.Result is: $$XPO,$$YPO

ENR.

 

GetXY2GetXY01

 

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

 

 

 

1. Use ANA.GetXYFromBytePos with the Stack

 

This will use ANA.GetXYFromBytePos with the Stack.

 

ANA.New|0|100|400

ANA.GetXYFromBytePos|0|801

DMP.6

MBX.Result is on Stack.

ENR.

 

   The Stack will look like this:

GetXY4GetXY3

 

 

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

 

 

 

Syntax

 

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

 

Parameter Explanation

 

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

P2 - Byte-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 Pixel-Position on the TOS.

 

 

Example

 

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

' ANA.GetXYFromBytePos-Sample

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

ANA.New|0|100|400

ANA.GetXYFromBytePos|0|801

DMP.6

MBX.Result is on Stack.

ENR.

 

 

 

 

 

Remarks

 

-

 

 

 

Limitations:

 

-

 

See also: