The graphic routines use screen coordinates in the range (0,0) to (160,160). (0,0) corresponds to the upper left corner of the screen.
Starting with version 3.5, many new graphic functions and color support was introduced in to PalmOS, which was enough reason to clean up LispMe's graphic functions, too.
The earlier global variables *font*, *pat* and *point are gone. They are replaced by the single global variable *gstate* containing the entire graphics state as a list. However, this shouldn't affect your old programs too much when you used the access functions defined in the memo ; Graphic utilities as recommended.
|6||LED font (calculator font)|
|7||Large Bold font (OS 3.0 or later only)|
PalmOS 3.5 supports color depths upto 8 bits, resulting in 256 colors, which are indexes into a color palette containing RGB triples. All drawing functions use this color indexin the range 0-255, not the actual RGB value. The graphics state *gstate* contains separate entries for foreground, background and text color numbers.
text uses the text and the background color to render, all other drawing functions use foreground and background colors.
To determine the best-matching palette color from given RGB values, you should use the rgb->index function instead of hard-coding color indexes. The new color model works with 2- and 4-bit grayscale modes (and even black/white), too, see here for an example.
McColors is a nice little tool to show all available colors.
|Value||Effect prior to OS3.5||Effect OS3.5 and later|
|#t||draw black on white||Use foreground and background colors normally and pay attention to the drawing mode|
|#f||draw white on black||Always use drawing mode dm-paint and swap foreground and background colors.|
|#n||draw inverted (XOR mode)||Use foreground and background colors normally but always use drawing mode dm-invert .|
|a string of exactly 8 bytes specifying a 8×8 fill pattern||draw black where pattern bits are set, white where not||Use foreground and background colors normally and pay attention to the drawing mode. Where pattern bits are set, the foreground color is used, otherwise the background color is used.|
You should only use pattern #t or string patterns with OS3.5 and specify the right drawing mode. Support for #f and #n in 3.5 is only for backwards compatibility.
|Value||Symbol in the 3.5 SDK||LispMe symbol||Description (from 3.5 SDK)|
|0||winPaint||dm-paint||Destination replaced with source pixels (copy mode)|
|1||winErase||dm-erase||Destination cleared where source pixels are off (AND mode)|
|2||winMask||dm-mask||Destination cleared where source pixels are on (AND NOT mode)|
|3||winInvert||dm-invert||Destination inverted where source pixels are on (XOR mode)|
|4||winOverlay||dm-overlay||Destination set only where source pixels are on (OR mode)|
|5||winPaintInverse||dm-paint-inverse||Destination replaced with inverted source (copy NOT mode)|
|6||winSwap||dm-swap||Destination foreground and background colors are swapped, leaving any other colors unchanged (color invert operation)|
The following screenshots (source code) show the effects of draw modes 0-6 from left to right, please note that the dm-swap with a custom pattern crashes the Palm, so the right-most rectangle is drawn using a solid pattern.
|Pre OS 3.5||Black/white||4 grays||16 grays||256 colors|
The pattern in modes 2 and 5 looks strange, can this be a bug in ROM 3.5?