| View previous topic :: View next topic |
| Author |
Message |
ElectroFusion Grandmaster Cheater
Reputation: 0
Joined: 17 Dec 2006 Posts: 786
|
Posted: Tue Dec 30, 2008 10:02 pm Post subject: using GetPixel? |
|
|
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 |
|
 |
hcavolsdsadgadsg I'm a spammer
Reputation: 26
Joined: 11 Jun 2007 Posts: 5801
|
Posted: Tue Dec 30, 2008 10:15 pm Post subject: |
|
|
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 |
|
 |
ElectroFusion Grandmaster Cheater
Reputation: 0
Joined: 17 Dec 2006 Posts: 786
|
Posted: Tue Dec 30, 2008 10:20 pm Post subject: |
|
|
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 |
|
 |
Snootae Grandmaster Cheater
Reputation: 0
Joined: 16 Dec 2006 Posts: 969 Location: --->
|
Posted: Tue Dec 30, 2008 10:20 pm Post subject: |
|
|
it returns COLORREF
so
Here
it says how to get the RGB values individually
_________________
|
|
| Back to top |
|
 |
ElectroFusion Grandmaster Cheater
Reputation: 0
Joined: 17 Dec 2006 Posts: 786
|
Posted: Tue Dec 30, 2008 10:26 pm Post subject: |
|
|
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 |
|
 |
Overload Master Cheater
Reputation: 0
Joined: 08 Feb 2008 Posts: 293
|
Posted: Wed Dec 31, 2008 12:21 am Post subject: |
|
|
| 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 |
|
 |
Heartless I post too much
Reputation: 0
Joined: 03 Dec 2006 Posts: 2436
|
Posted: Wed Dec 31, 2008 10:56 am Post subject: |
|
|
| 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 |
|
 |
samuri25404 Grandmaster Cheater
Reputation: 7
Joined: 04 May 2007 Posts: 955 Location: Why do you care?
|
Posted: Thu Jan 01, 2009 4:17 pm Post subject: |
|
|
| 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?
_________________
|
|
| Back to top |
|
 |
lurc Grandmaster Cheater Supreme
Reputation: 2
Joined: 13 Nov 2006 Posts: 1900
|
Posted: Thu Jan 01, 2009 4:18 pm Post subject: |
|
|
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 |
|
 |
|