A question in DirectDraw
Posted on 1998-12-12
I'm building a WINDOWED DirectDraw program to show some 256 gray level images. I create two surfaces: a primary surface and a offscreenplane surface with size of 512*512. Now, I use Lock(...) method to get a pointer (lpSurface) to the offscreenplane surface and render to this surface directly. That is, I write the color index data directly to the surface using the pointer. After rendering, I Unlock it and use Blt(...) method to transfer data in offscreenplane surface to primary surface to show the image in screen.
I also create a 256 gray level pallete and set it to both these two surface. But when I run this program, the 20 static system colors are shown in my images replacing the gray level of 0-9 and 246-255. What shall I do to correct this error?