`prev Menu next`

Pixel Coordinates (original enhancement)☆
Pixel Coordinates are the coordinates whose origin is left-bottom end.
Supplied Functions (Original Enhancement)

Let x, y be numeric expressions below.

PIXELX(x) Pixel coordinate for problem coordinate x
PIXELY(y) Pixel coordinate for problem coordinate y
PROBLEMX(x) Problem coordinate for pixel coordinate x
PROBLEMY(y) Problem coordinate for pixel coordinate y

Example
To manipulate all pixels

    SET WINDOW left, right, bottom, top
    FOR i=0 TO PIXELX(right)
       FOR j=0 TO PIXELY(top)
           LET x=PROBLEMX(i)
           LET y=PROBLEMY(j)
           …………
       NEXT j
    NEXT i

[supplement]
The above functions can be defined in Full BASIC as follows.

    EXTERNAL FUNCTION PIXELX(x)
    ASK WINDOW left, right, bottom, top
    ASK PIXEL SIZE (left, bottom; right, top) px, py
    LET PIXELX=ROUND((px-1)*(x-left)/(right-left),0)
    END FUNCTION

    EXTERNAL FUNCTION PIXELY(y)
    ASK WINDOW left, right, bottom, top
    ASK PIXEL SIZE (left, bottom; right, top) px, py
    LET PIXELY=ROUND((py-1)*(y-bottom)/(top-bottom),0)
    END FUNCTION

    EXTERNAL FUNCTION WORLDX(x)
    ASK WINDOW left, right, bottom, top
    ASK PIXEL SIZE (left, bottom; right, top) px, py
    LET WORLDX=(right-left)*x/(px-1)+left
    END FUNCTION

    EXTERNAL FUNCTION WORLDY(y)
    ASK WINDOW left, right, bottom, top
    ASK PIXEL SIZE (left, bottom; right, top) px, py
    LET WORLDY=(top-bottom)*y/(py-1)+bottom
    END FUNCTION