posted November 14, 1999 02:20 AM
Well, for starters, try this:First make a temporary pointer of the size of your pixels that points to the start of the line you want to modify in the buffer.
For a 16-bit buffer:
unsigned short *p = (unsigned short*) ((char*)bd.data + Y * bd.pitch);
Then you can index it like an array to get individual 16-bit pixels across that line, and use Pack and Unpack Color:
p[X] = tcf.PackColor(red, green, blue);
Or to read a pixel:
unsigned char red, green, blue;
tcf.UnpackColor(p[X], &red, &green, &blue);
And for fast blits you can make a lookup table to the current true color format to either table blit from 8-bit bitmaps directly, or convert them to native format bitmaps and then blit them raw.
------------------
-- Seumas McNally, Lead Programmer, Longbow Digital Arts