Partial implementation of GetPixel.

svn path=/trunk/; revision=7153
This commit is contained in:
Filip Navara 2003-12-21 10:27:10 +00:00
parent 3ee841df37
commit 22e7c1f6cb
6 changed files with 57 additions and 33 deletions

View file

@ -146,7 +146,7 @@ NtGdiGetObjectType 1
NtGdiGetOutlineTextMetrics 3
NtGdiGetPaletteEntries 4
NtGdiGetPath 4
NtGdiGetPixel 1
NtGdiGetPixel 3
NtGdiGetPixelFormat 1
NtGdiGetPolyFillMode 1
NtGdiGetROP2 1

View file

@ -1,4 +1,4 @@
/* $Id: stubs.c,v 1.42 2003/12/15 20:47:57 navaraf Exp $
/* $Id: stubs.c,v 1.43 2003/12/21 10:27:10 navaraf Exp $
*
* reactos/lib/gdi32/misc/stubs.c
*
@ -363,21 +363,6 @@ GetMetaFileBitsEx(
return 0;
}
/*
* @unimplemented
*/
COLORREF
STDCALL
GetPixel(
HDC a0,
int a1,
int a2
)
{
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return 0;
}
/*
* @unimplemented

View file

@ -336,6 +336,21 @@ SetPixel(HDC hDC,
}
/*
* @unimplemented
*/
COLORREF
STDCALL
GetPixel(
HDC a0,
int a1,
int a2
)
{
return NtGdiGetPixel(a0, a1, a2);
}
/*
* @implemented
*/

View file

@ -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: objects.h,v 1.23 2003/12/20 14:51:41 navaraf Exp $
/* $Id: objects.h,v 1.24 2003/12/21 10:27:10 navaraf Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -188,6 +188,7 @@ typedef struct _SURFGDI {
/* DIB functions */
PFN_DIB_PutPixel DIB_PutPixel;
PFN_DIB_GetPixel DIB_GetPixel;
PFN_DIB_HLine DIB_HLine;
PFN_DIB_VLine DIB_VLine;
PFN_DIB_BitBlt DIB_BitBlt;

View file

@ -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: surface.c,v 1.28 2003/12/08 18:07:56 fireball Exp $
/* $Id: surface.c,v 1.29 2003/12/21 10:27:10 navaraf Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -93,6 +93,11 @@ static VOID Dummy_PutPixel(SURFOBJ* SurfObj, LONG x, LONG y, ULONG c)
return;
}
static ULONG Dummy_GetPixel(SURFOBJ* SurfObj, LONG x, LONG y)
{
return 0;
}
static VOID Dummy_HLine(SURFOBJ* SurfObj, LONG x1, LONG x2, LONG y, ULONG c)
{
return;
@ -125,6 +130,7 @@ static BOOLEAN Dummy_StretchBlt(SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
#define SURF_METHOD(c,n) DIB_##c##_##n
#define SET_SURFGDI(c)\
SurfGDI->DIB_PutPixel=SURF_METHOD(c,PutPixel);\
SurfGDI->DIB_GetPixel=SURF_METHOD(c,GetPixel);\
SurfGDI->DIB_HLine=SURF_METHOD(c,HLine);\
SurfGDI->DIB_VLine=SURF_METHOD(c,VLine);\
SurfGDI->DIB_BitBlt=SURF_METHOD(c,BitBlt);\
@ -155,6 +161,7 @@ VOID FASTCALL InitializeFuncs(SURFGDI *SurfGDI, ULONG BitmapFormat)
BitmapFormat);
SurfGDI->DIB_PutPixel = Dummy_PutPixel;
SurfGDI->DIB_GetPixel = Dummy_GetPixel;
SurfGDI->DIB_HLine = Dummy_HLine;
SurfGDI->DIB_VLine = Dummy_VLine;
SurfGDI->DIB_BitBlt = Dummy_BitBlt;

View file

@ -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.49 2003/12/19 22:58:47 navaraf Exp $ */
/* $Id: bitmaps.c,v 1.50 2003/12/21 10:27:10 navaraf Exp $ */
#undef WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <stdlib.h>
@ -24,6 +24,7 @@
#include <win32k/gdiobj.h>
#include <win32k/bitmaps.h>
#include <win32k/brush.h>
#include <win32k/region.h>
//#include <win32k/debug.h>
#include "../eng/handle.h"
#include <include/inteng.h>
@ -418,21 +419,36 @@ BOOL STDCALL NtGdiGetBitmapDimensionEx(HBITMAP hBitmap,
return TRUE;
}
COLORREF STDCALL NtGdiGetPixel(HDC hDC,
INT XPos,
INT YPos)
COLORREF STDCALL NtGdiGetPixel(HDC hDC, INT XPos, INT YPos)
{
PDC dc = NULL;
COLORREF cr = (COLORREF) 0;
PDC dc = NULL;
COLORREF Result = (COLORREF) 0;
PSURFGDI Surface;
PSURFOBJ SurfaceObject;
dc = DC_LockDc (hDC);
if (NULL == dc)
{
return (COLORREF) CLR_INVALID;
}
//FIXME: get actual pixel RGB value
DC_UnlockDc (hDC);
return cr;
dc = DC_LockDc (hDC);
if (dc == NULL)
{
return (COLORREF)CLR_INVALID;
}
if (XPos < dc->CombinedClip->rclBounds.left ||
XPos > dc->CombinedClip->rclBounds.right ||
YPos < dc->CombinedClip->rclBounds.top ||
YPos > dc->CombinedClip->rclBounds.top)
{
DC_UnlockDc(hDC);
return (COLORREF)CLR_INVALID;
}
SurfaceObject = (PSURFOBJ)AccessUserObject((ULONG)dc->Surface);
Surface = (PSURFGDI)AccessInternalObjectFromUserObject(SurfaceObject);
if (Surface == NULL || Surface->DIB_GetPixel == NULL)
{
DC_UnlockDc(hDC);
return (COLORREF)CLR_INVALID;
}
Result = Surface->DIB_GetPixel(SurfaceObject, XPos, YPos);
DC_UnlockDc(hDC);
return Result;
}
/***********************************************************************