<img src="http://cellosoft.com/marcello/pocketpc/pocketww05.gif" width="240" height="320" align="right">
Ok, so I'm working on this little game with GapiDraw, Pocket WaterWorks. (
http://cellosoft.com/marcello/pocketpc/)
So I started out using get and setpixel functions in the surface class, it worked, people liked it, etc.
After realizing that Set/get pixel seem to do weird scary stuff with converting color formats behind my back, I decided to access the memory buffer directly by using the GetBuffer routine and my own pixel accessing.
The problem is, although it works fine on my 16bit color PocketPC2002 device, I'm not getting error reports from people with 12bit devices, with apparent alignment problems.
One person complained that pixels move diagonally, and parts being displayed as dotted lines.
My question, then, is how do I handle non 16bit devices. Although these screens are 12bit, am I correct in understanding the display itself can only handle 8bit colors. In which case, how do I use these things with GapiDraw---since it obviously handles it when I use the built in set/get pixel routines.
Also, is there any particular reason GapiDraw isn't open-source? I would much like to look at how the different things work, so my code will be cleaner. The library is somewhat non-descript on the inner workings...which makes it extremely difficult to program with/for. I like GapiDraw, but the lack of source makes it very difficult to use.
So I guess my question is, how can I access pixels with set/get routines, but using native colors instead of COLORREF's. How do I handle screens that aren't 16bit.
Here is my code for get/set:
- Code:
bool CProject::setPixel(DWORD x, DWORD y, WORD color) {
if (x>=dwWidth || y>=dwHeight) return false;
*pBuffer + (x * xPitch + y * yPitch)) = color;
return true;
}
bool CProject::getPixel(DWORD x, DWORD y, WORD *color) {
if (x>=dwWidth || y>=dwHeight) return false;
*color = *(pBuffer + (x * xPitch + y * yPitch));
return true;
}
Right now I'm just using the GapiDrawExtension.h converters to translate from 24bit to 16bit color, but how do I translate to lower depths?
Thanks,
Marcello