## Graphics

Legend:
x is X coordinate and y is Y coordinate, both are v|n

BOX[FILLED] [x1, y1] TO x2, y2

Draws a [filled] box with the set COLOR statement from current top-left (x,y) position if first arguments are omitted or from (x1,y1) if passed, to the bottom right (x2,y2) position.

COLOR v|n

Sets the pen color to the v|n value

Notes:

- in black & white screen mode, v|n is 0 (white) or 1 (black)
- in other screen modes, v|n = Red x 65536 + Green x 256 + Blue, where Red, Green and Blue are [0...255] gradients

GOTOXY x, y

Places the drawing pen at position (x,y)

Notes:

- GOTOXY does not draw a pixel, use PSET for doing so

GPRINT c|t, x, y[, v|n1[, v|n2]]

Displays c|t text at position (x,y), with frontcolor v|n1 and backcolor v|n2. v|n1 and v|n2 are optional parameters, current values for front and back colors are used if these parameters are not defined.

Notes:

- Backcolor can only be set if frontcolor is also set, but frontcolor alone may be defined
- PalmOS 3.5 onwards for v|n1 and v|n2 parameters
- The parameters have changed for GPRINT in version 4.2 as from those valid in versions 4.0 and 4.1 (GPRINT c|t, v|n, x, y), so you will have to upgrade your source code accordingly

$ IMAGE v|n, x, y

Puts image v|n with the top-left corner of the image being at position (x,y)

Notes:

- v|n is the image ID which automatically adapts to the color displaying capabilities of the device: high resolution color, low resolution color, gray scale or black & white. Please refer to IMAGEBUTTON to see the list of available images shipped with iziBasic and to the RESOURCEFILE compiling directive to see how to add your own customized images to your programs.

Warning: there is no check on this image ID number as you can very well add your own customized images to your program. You may also remove or replace this set of images. Please refer to the RESOURCEFILE compiling directive for further information.

LINE [x1, y1] TO x2, y2

Draws a line from current (x,y) position if first arguments are omitted or from (x1,y1) if passed, to the (x2,y2) position

PSET x,y

Draws a pixel at position (x,y)

SCREEN v|n

Sets screen mode:
  0 for black & white
  1 for 4 grays
  2 for 16 grays
  3 for 256 colors
  4 for 65536 colors

Notes:

- PalmOs 3.5 onwards
- for devices equipped with Palm OS versions prior to 3.5, screen mode is set to 0 (black & white)
- be careful to set your screen mode before drawing any graphic or GUI object on the screen

$ SETRES v|n

Attempts to set the screen size to 320x320 pixels (high resolution) if v|n=1 and to 160x160 pixels (standard low resolution) if v|n=0.

Notes:

- Not all Palm OS APIs support the high resolution mode, so you should set on (when needed) and off (when no more needed) the high resolution mode all along your source code. In other words, the high resolution mode cannot be set once for all in a program!
- Since this statement returns no information, you should first check if the device supports high resolution with the HIGHRES function.

COLOR(v|n)

Returns backcolor if v|n=0 and frontcolor if v|n=1

COLORRGB(v|n1, v|n2, v|n3)

Returns a color given the Red (v|n1), Blue (v|n2) and Green (v|n3) gradients. Therefore v|n1, v|n2 and v|n3 have to be in the [0...255] range.

$ HIGHRES(v|n)

Attempts to set the screen size to 320x320 pixels (high resolution) if v|n=1 and to 160x160 pixels (standard low resolution) if v|n=0. Returns 1 if the function succeeded, 0 otherwise.

Notes:

- If HIGHRES(1) returns 1, the device has a high resolution screen.
- See the SETRES statement

PGET(x, y)

Returns current color of pixel at position (x,y)

Notes:

- PalmOS 3.5 onwards

POSX

Returns the current X position of drawing pen

POSY

Returns the current Y position of drawing pen

SCREENMODE

Returns the current screen mode:
  0 for black & white
  1 for 4 grays
  2 for 16 grays
  3 for 256 colors
  4 for 65536 colors

SCREENMODES

Returns the best screen mode available on the device:
  0 for black & white devices
  1 for 4 grays devices
  2 for 16 grays devices
  3 for 256 colors devices
  4 for 65536 colors devices