> I give this as introductory question to everybody who applies to work as
> "software developer with C/C++" with us. That's the only reason I won't post
> it here, but I'll send it privately if you promise not to give it
> irresponsibly ;-))))
but you post how to mess with hardware registers? :)
well.. to save him the email.. (heck, you might have to write another
"introductory question" now) :P this is the basic concept.
PREREQUISITES:
--------------
scrPtr = the address of the top-left pixel (0,0)
- you can get it from a register directly (but, check CPU)
- you can also get it using APIs, but it is different on
each version of the Palm OS to do it right (and not kill
gremlins on POSE)
. see Cube3D sources, given any window, you can get this
x, y = the co-ordinate you want to get to
width = the width in pixels
depth = the bits per pixel required
- 1 = monochrome
- 2 = 4 grayscale
- 4 = 16 grayscale
- 8 = 256 colors
FINDING MEMORY LOCATION
-----------------------
scrPixel = 8 / depth; // how many pixels per byte
scrWidth = width / scrWidth; // how many bytes take up one screen line
ptr = scrPtr + (y * scrWidth) + (x / scrPixel);
now, the data you need is at the memory location "ptr". you need to also
do some further decoding, as, the byte here may contain more than one
pixel. this normally involves doing some masking and shifting.
ie: in 4bpp, the byte will be 0xXY = where, X = one pixel, Y = second
if x is even, it will be "X", else, it will be "Y". similar logic
for others.. when in 8bpp, pixel = whole byte
there is heaps of "code" out there to do this type of stuff.. these
graphics systems have been around since early PC/"nerd computer" days
and have been well documented..
also, note, with 16bit color - different rules apply :)) and, dont
expect it to always be 1, 2, 4 or 8 bpp :P
cheers
// az
[EMAIL PROTECTED]
http://www.ardiri.com/ <--- free games!
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/tech/support/forums/