|
-
Jul 7th, 2004, 11:38 AM
#1
Thread Starter
G&G Moderator
Pixel Values [Resolved]
Howdy all,
I know this is the C/C++ forum, but the Assembly forum is pretty much dead. I'm wanting to know what the following code would be in ASM (MASM really):
Code:
#define GetRValue(rgb) ((BYTE)(rgb))
#define GetGValue(rgb) ((BYTE)(((WORD)(rgb)) >> 8))
#define GetBValue(rgb) ((BYTE)((rgb)>>16))
I'm wanting to retrieve the Red Green and Blue values of a picture on a DC.
Any help would be great.
Phreak
Last edited by «°°phReAk°°»; Jul 8th, 2004 at 06:28 PM.
Visual Studio 6, Visual Studio.NET 2005, MASM
-
Jul 8th, 2004, 06:27 PM
#2
Thread Starter
G&G Moderator
Well, as it turns out, ALOT of experimenting helps. I figured it out myself, and in case anyone wondered, heres what I have.
Code:
invoke GetPixel,hDC,0,0
; RED
and eax,00FF0000h
shr eax,16
; BLUE
and eax,00FF0000h
; GREEN
and eax,0000FF00h
If you look at it, its nearly the opposite to the C code (but it gets results!). I'm shifting the red value, instead of the blue value, and the green value isn't shifted at all.
Anyway, it's working now.
Phreak
Visual Studio 6, Visual Studio.NET 2005, MASM
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|