Results 1 to 4 of 4

Thread: Pixel Values [Resolved]

Threaded View

  1. #1

    Thread Starter
    G&G Moderator chemicalNova's Avatar
    Join Date
    Jun 2002
    Location
    Victoria, Australia
    Posts
    4,246

    Pixel Values [Resolved]

    Howdy all,

    Ok, I might aswell try asking here. I've posted in the C/C++ forum because I don't believe many people come to this Assembly forum, but here goes.

    I'm wanting to get the Red Green and Blue values of a pixel. I'm wanting something like these in Assembly (MASM, but any other is fine aswell).
    Code:
    //C++ Version
    #define GetRValue(rgb)      ((BYTE)(rgb))
    #define GetGValue(rgb)      ((BYTE)(((WORD)(rgb)) >> 8))
    #define GetBValue(rgb)      ((BYTE)((rgb)>>16))
    VB Code:
    1. 'VB Version
    2. Function GetRedVal(val As Long) As Long
    3. GetRedVal = val& Mod 256
    4. End Function
    5.  
    6. Function GetGreenVal(val As Long) As Long
    7. GetGreenVal = ((val And &HFF00) / 256&) Mod 256&
    8. End Function
    9.  
    10. Function GetBlueVal(val As Long) As Long
    11. GetBlueVal = (val And &HFF0000) / 65536
    12. End Function

    Any help is greatly appreciated.

    Thanks in advance,

    Phreak
    Last edited by «°°phReAk°°»; Jul 8th, 2004 at 06:29 PM.

    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
  •  



Click Here to Expand Forum to Full Width