|
Author Topic:   True Color
DarkFrog
Member
posted November 13, 1999 12:32 AM            
Spam damnit, I really need some explanation, or a modification of the BackBufferDemo, just so I can get the details on how to do it, would someone who knows how to change all the details in that cpp just change it and post it???
PLEASE???
thanks

IP:

LDA Seumas
unregistered
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

IP: