Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


using GetPixel?

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
ElectroFusion
Grandmaster Cheater
Reputation: 0

Joined: 17 Dec 2006
Posts: 786

PostPosted: Tue Dec 30, 2008 10:02 pm    Post subject: using GetPixel? Reply with quote

Editted the last question out.. Um, what does it return? I realize it returns RGB but is it like rgb.red rgb.blue rgb.green or what?
_________________
qwerty147 wrote:

ghostonline wrote:

what world are you in?

bera

but i live in NZ
Back to top
View user's profile Send private message
hcavolsdsadgadsg
I'm a spammer
Reputation: 26

Joined: 11 Jun 2007
Posts: 5801

PostPosted: Tue Dec 30, 2008 10:15 pm    Post subject: Reply with quote

look this shit up on MSDN.

Quote:

COLORREF GetPixel(
HDC hdc, // handle to DC
int nXPos, // x-coordinate of pixel
int nYPos // y-coordinate of pixel
);


Return Values

The return value is the RGB value of the pixel. If the pixel is outside of the current clipping region, the return value is CLR_INVALID.


it returns COLORREF, which is just a DWORD.

http://msdn.microsoft.com/en-us/library/ms532645(VS.85).aspx
Back to top
View user's profile Send private message
ElectroFusion
Grandmaster Cheater
Reputation: 0

Joined: 17 Dec 2006
Posts: 786

PostPosted: Tue Dec 30, 2008 10:20 pm    Post subject: Reply with quote

I removed my last question because I realized...
_________________
qwerty147 wrote:

ghostonline wrote:

what world are you in?

bera

but i live in NZ
Back to top
View user's profile Send private message
Snootae
Grandmaster Cheater
Reputation: 0

Joined: 16 Dec 2006
Posts: 969
Location: --->

PostPosted: Tue Dec 30, 2008 10:20 pm    Post subject: Reply with quote

it returns COLORREF
so
Here

it says how to get the RGB values individually

_________________
Back to top
View user's profile Send private message
ElectroFusion
Grandmaster Cheater
Reputation: 0

Joined: 17 Dec 2006
Posts: 786

PostPosted: Tue Dec 30, 2008 10:26 pm    Post subject: Reply with quote

thanks snootae, for not being a slovach.
_________________
qwerty147 wrote:

ghostonline wrote:

what world are you in?

bera

but i live in NZ
Back to top
View user's profile Send private message
Overload
Master Cheater
Reputation: 0

Joined: 08 Feb 2008
Posts: 293

PostPosted: Wed Dec 31, 2008 12:21 am    Post subject: Reply with quote

ElectroFusion wrote:
thanks snootae, for not being a slovach.

You should try not being an ElectroFusion sometime. It's really great. It's like being "stupid-free"

_________________
Blog

Quote:
Rhys says:
you can be my maid
Rhys says:
ill buy you a french maid outfit
Tyler says:
Sounds good
Rhys says:
ill hold you to that
Back to top
View user's profile Send private message MSN Messenger
Heartless
I post too much
Reputation: 0

Joined: 03 Dec 2006
Posts: 2436

PostPosted: Wed Dec 31, 2008 10:56 am    Post subject: Reply with quote

Code:
int Red, Blue, Green;
COLORREF Color;

Color = GetPixel(hdc, 0, 0);

Red = GetRValue(Color);
Blue = GetBValue(Color);
Green = GetGValue(Color);

_________________
What dosen't kill you, usually does the second time.
Back to top
View user's profile Send private message
samuri25404
Grandmaster Cheater
Reputation: 7

Joined: 04 May 2007
Posts: 955
Location: Why do you care?

PostPosted: Thu Jan 01, 2009 4:17 pm    Post subject: Reply with quote

HornyAZNBoy wrote:
Code:
int Red, Blue, Green;
COLORREF Color;

Color = GetPixel(hdc, 0, 0);

Red = GetRValue(Color);
Blue = GetBValue(Color);
Green = GetGValue(Color);


Code:

int R, B, G;
R = ( Color & 0x000000ff );
B = ( ( Color & 0x0000ff00 ) >> 2 );
G = ( ( Color & 0x00ff0000 ) >> 4 );


Correct?

_________________
Wiccaan wrote:

Oh jeez, watchout I'm a bias person! Locked.


Auto Assembly Tuts:
In Depth Tutorial on AA
Extended
Back to top
View user's profile Send private message
lurc
Grandmaster Cheater Supreme
Reputation: 2

Joined: 13 Nov 2006
Posts: 1900

PostPosted: Thu Jan 01, 2009 4:18 pm    Post subject: Reply with quote

I believe its shift right 8 bits and 16 bits not 2 and 4.

Edit:

Here's the definitions right from WinGDI.h

Code:
#define GetRValue(rgb)      (LOBYTE(rgb))
#define GetGValue(rgb)      (LOBYTE(((WORD)(rgb)) >> 8))
#define GetBValue(rgb)      (LOBYTE((rgb)>>16))


LOBYTE is just & 0xFF

_________________
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites