PocketMatrix forums

A read-only archive of the PocketMatrix forums (2001–2014). Posting and accounts are closed.

GetPixel()

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.
BurningSheep · 08 Sep 2003, 08:49 UTC
You don't need to get the DC of a surface to use GetPixel().

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