
#define _RGB16BIT565(r,g,b) ((r%32) + ((g%64)<<6) + ((b%32)<<11)) //This is the macro to smash the bytes together The bitmaps being loaded are actual 16-bit, not 24. The above code makes a wonderful greyscale picture of whatever bitmap I've loaded. If I shift a few bits here or there, I manage to get some rather 'interesting' effects, but I just can't get the actual bitmap with the right colors to display. Oh, and if it matters, the bitmaps were created in Ulead Video Paint and saved as 16-bit bitmaps. Thanks in advance...
///////////////////////////////////////////
lpddsprimary->Lock(NULL,&ddsd, DDLOCK_SURFACEMEMORYPTR | DDLOCK_WAIT, NULL);
USHORT *vidbuffer = (USHORT *)ddsd.lpSurface;
for(int y=0;y
for(int x=0;x
UCHAR blue = bitmap.buffer[(y*IMAGE_HEIGHT*2+x*2)],
green = bitmap.buffer[(y*IMAGE_HEIGHT*2+x*2)],
red = bitmap.buffer[(y*IMAGE_HEIGHT*2+x*2)];
USHORT pixel = _RGB16BIT565(red,green,blue);
vidbuffer[x+y*(ddsd.lPitch/2)] = pixel;
}
}
///////////////////////////////////////////