beautypg.com

Drawing – HP Prime Graphing Wireless Calculator User Manual

Page 281

background image

Programming in HP PPL

277

Drawing

There are 10 built-in graphics variables in the HP Prime,
called G0G9. G0 is always the current screen graphic.
G1 to G9 can be used to store temporary graphic objects
(called GROBs for short) when programming applications
that use graphics. They are temporary and thus cleared
when the calculator turns off.
Twenty-six functions can be used to modify graphics
variables. Thirteen of them work with Cartesian
coordinates using the Cartesian plane defined in the
current app by the variables Xmin, Xmax, Ymin, and
Ymax.
The remaining thirteen work with pixel coordinates where
the pixel 0,0 is the top left pixel of the GROB, and 320,
240 is the bottom right. Functions in this second set have

a _P suffix to the function name.

C→PX

Converts from Cartesian coordinates to screen coordinates.
Syntax: C→PX(x,y) or C→PX({x,y})

DRAWMENU

Syntax: DRAWMENU(string1, string2,…
string6)
Draws a six-button menu at the bottom of the display, with
labels string1, string2, …, string6.
Example:

DRAWMENU("ABC", "", "DEF") creates a menu with

the first and third buttons labelled ABC and DEF,
respectively. The other four menu keys are blank.

FREEZE

Syntax: FREEZE
Pauses program execution until a key is pressed. This
prevents the screen from being redrawn after the end of
the program execution, leaving the modified display on
the screen for the user to see.

PX→C

Converts from screen coordinates to Cartesian

coordinates.

RGB

Syntax: RGB(R, G, B, [A])