mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 01:55:19 +00:00
Translate pixel value from internal pixel format to RGB. Fixes bug #251.
svn path=/trunk/; revision=8697
This commit is contained in:
parent
e8cf99cda9
commit
cd7fbb8e5c
1 changed files with 32 additions and 1 deletions
|
@ -16,7 +16,7 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
/* $Id: bitmaps.c,v 1.60 2004/03/10 16:55:03 navaraf Exp $ */
|
||||
/* $Id: bitmaps.c,v 1.61 2004/03/14 00:11:28 gvg Exp $ */
|
||||
#undef WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
#include <stdlib.h>
|
||||
|
@ -458,6 +458,10 @@ COLORREF STDCALL NtGdiGetPixel(HDC hDC, INT XPos, INT YPos)
|
|||
COLORREF Result = (COLORREF) 0;
|
||||
PSURFGDI Surface;
|
||||
PSURFOBJ SurfaceObject;
|
||||
HPALETTE Pal;
|
||||
PPALGDI PalGDI;
|
||||
USHORT PalMode;
|
||||
PXLATEOBJ XlateObj = NULL;
|
||||
|
||||
dc = DC_LockDc (hDC);
|
||||
if (dc == NULL)
|
||||
|
@ -480,6 +484,33 @@ COLORREF STDCALL NtGdiGetPixel(HDC hDC, INT XPos, INT YPos)
|
|||
return (COLORREF)CLR_INVALID;
|
||||
}
|
||||
Result = Surface->DIB_GetPixel(SurfaceObject, XPos, YPos);
|
||||
|
||||
if (dc->w.hPalette != 0)
|
||||
{
|
||||
Pal = dc->w.hPalette;
|
||||
}
|
||||
else
|
||||
{
|
||||
Pal = NtGdiGetStockObject(DEFAULT_PALETTE);
|
||||
}
|
||||
PalGDI = PALETTE_LockPalette(Pal);
|
||||
if (NULL == PalGDI)
|
||||
{
|
||||
DC_UnlockDc(hDC);
|
||||
return (COLORREF)CLR_INVALID;
|
||||
}
|
||||
PalMode = PalGDI->Mode;
|
||||
PALETTE_UnlockPalette(Pal);
|
||||
|
||||
XlateObj = (PXLATEOBJ) IntEngCreateXlate(PAL_RGB, PalMode, NULL, Pal);
|
||||
if (NULL == XlateObj)
|
||||
{
|
||||
DC_UnlockDc(hDC);
|
||||
return (COLORREF)CLR_INVALID;
|
||||
}
|
||||
Result = XLATEOBJ_iXlate(XlateObj, Result);
|
||||
EngDeleteXlate(XlateObj);
|
||||
|
||||
DC_UnlockDc(hDC);
|
||||
return Result;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue