Low-level graphical functions:

From Wiki pLua

Jump to: navigation, search

pmode(): returns 4 numbers: screen width, screen height, screen depth and 1 or 0 indicating if the screen supports color.


pclear([c]): erases the screen with the background color or with the optional c color, and moves the cursor to 0,0. Returns nothing.


pcolor(fg [,bg]): sets the foreground color (fg) and optionally the background color (bg). Returns nothing.


prgb(r, g, b): returns the color equivalent to the (Red,Green,Blue) components.


ppos(): returns 2 numbers with the current x,y cursor position.


pmoveto(x, y): moves the screen cursor to the x,y position.


pline(x1, y1, x2, y2 [,c]): draws a line from x1,y1 to x2,y2 using the fg color or the optional c color.


plineto(x, y [,c]): draws a line from current position to x,y using the fg color or the optional c color.


pset(x, y [,c]): draws a pixel at position x,y using the fg color or the optional c color.


pget(x, y): return a number with the color of pixel at position x,y.


prect(x, y, dx, dy [,c]): draws a rectangle at x,y, extending dx,dy pixels, using the fg color or the optional c color.


pbox(x, y, dx, dy [,c]): draws a filled rectangle at x,y, extending dx,dy pixels, using the fg color or the optional c color.


pcircle(x, y, rx, ry [,c]): draws an ellipse centered at x,y, with rx,ry as x,y radius, using the fg color or the optional c color. Use rx=ry for a circle.


pdisc(x, y, rx, ry [,c]): draws a filled ellipse centered at x,y, with rx,ry as x,y radius, using the fg color or the optional c color. Use rx=ry for a filled circle.


pfont(f): sets the text font to number f. Returns two numbers with the "average" width of a character and the height of a character, both in pixels. Note that PalmOS fonts are not fixed-width fonts, so if the returned width is used in calculations, you get just an approximation.


pheading(g): turns the graphical "turtle" to the specified heading g (in degrees). 0 points to the right, 90 points up, and so on. Returns nothing.


pturn(g): turns the graphical "turtle" g degrees. g can be positive or negative and it is added to the current heading. Returns nothing.


pwalk(d): draws a line from the current cursor position, with extent d and following the current "turtle" heading. The cursor is positioned at the end of the line. Returns nothing.


Personal tools