Page 1 of 1

GetPixel()

PostPosted: Sep 7, 2003 @ 3:14pm
by maoz
Hi all,
I am trying to GetPixel(x,y) of a specific Surface on stylus down event.
Well, following the code i wrote and it doesn't work.


m_surf = LoadImage(display, IDB_WHAT_EVER);

HDC hDC = m_region_table->GetDC ();
if( hDC ) {
COLORREF c = GetPixel(hDC, stylus.x, stylus.y);
int b = GetBValue(c);
int r = GetRValue(c);
int g = GetGValue(c);
m_region_table->ReleaseDC( hDC );
}

Any idea?
Regards Maoz.

PostPosted: Sep 8, 2003 @ 9:49am
by BurningSheep
You don't need to get the DC of a surface to use GetPixel().

color = m_surface.GetPixel(stylus.x, stylus.y);