Path: utzoo!news-server.csri.toronto.edu!cs.utexas.edu!usc!zaphod.mps.ohio-state.edu!swrinde!elroy.jpl.nasa.gov!decwrl!fernwood!oracle!news From: dkemper@oracle.com (David J. Kemper) Newsgroups: comp.windows.ms.programmer Subject: RGB() Problems? Message-ID: Date: 13 Mar 91 23:06:47 GMT Sender: news@oracle.com Distribution: comp.windows.ms.programmer Organization: Oracle Corp., Belmont CA Lines: 35 I'm having problems with specifying/reading RGB colors on the display device context. First of all, I have a Compaq 1024 graphics board, which gives me 1024x768 resolution with a 256 color lookup table. I've noticed that writing colored pixels or creating a brush (CreateSolidBrush()) using the RGB macro (which creates direct colorrefs of the form 0x00bbggrr) doesn't work with the enhanced colors. The brush created consists of a dithering of the base 16 Windows colors. I do, however, get the correct results by using the PALETTERGB macro (which creates colorrefs of the form 0x02bbggrr), which becomes a palette index on those devices (like mine) that support them. Fine. I can display my enhanced colors on the screen. The problem arises when I want to read pixels from the display. I create a screen device context (CreateDC("DISPLAY", NULL, NULL, NULL) and try to read from it using GetPixel(). Well, the DWORD colorref I get back ALWAYS has the high byte of 0, meaning it's a direct RGB (?). The problem is that this direct color is WRONG. It's a match when the color happens to be a standard Windows color (as in window title bars, menu backgrounds, etc), but is "garbage" when it is one of my enhanced color palette entries. In other words, I can write beautiful 256 color images to the display, but I can't read them from the display. Doing a PrintScreen to the clipboard also runs into the same problem. Am I going about this wrong? Is this a problem with Windows? With my device driver? Help! -djk -- =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= -djk David Kemper | No, no! You are all individuals. dkemper@oracle.com | We are all individuals. My opinions are just that | I'm not. -M. Python =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=