Please enable JavaScript to view this site.

A-Shell Reference

Navigation: GDI Printing > Introduction to GDI Printing

Relative vs. Absolute Position

Scroll Prev Top Next More

Added September 2018

The x,y coordinates in all //GDI directives are interpreted, by default, as relative to the coordinate space of the current page, with the point 0,0 usually being the upper-left logical corner. The units are determined by the SETMAPMODE directive.

Beginning with A-Shell 6.5.1637 of June 2018, any of the coordinates may also be specified as relative to the current cursor position by prefacing the coordinate value with "+" or "-". For directives with more than one x,y pair (such as RECTANGLE or POLYGON), any relative coordinates are treated as relative to the prior coordinate on the same axis. Some examples:

//;absolute coordinates - from (100,200) to (300,400) ...

//RECTANGLE,100,200,300,400

 

//;relative coordinates - from 50 units above the current x,y cursor,

//;extending 200 to the right and 75 down

//RECTANGLE,+0,-50,+200,+75

 

Notes:

While mathematically N is the same as +N, within the context of GDI directives, they are all strings, allowing the +N to be recognized and treated differently than N—i.e. as relative rather than absolute.
To preserve backwards compatibility with A-Shell prior to version 6.5.1637, those directives that intepreted -1,-1 as the current position continue to do so.
The IMAGE directive supports negative right and bottom coordinates as indicating width and height. Fortunately, there is no particular need for negative widths or heights, so nothing is lost by treating negative and positive relative right and bottom coordinates the same here.

See Also

History

2018 June, A-Shell 6.5.1637:  cursor-relative coordinates added to A-Shell.