News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Little did I know..

Started by donkey, February 15, 2010, 09:03:23 PM

Previous topic - Next topic

donkey

Kudos to Jeremy for this little known capability of the macro system...

MakeARGB(%a,%r,%g,%b) MACRO
((%b<<BlueShift)|(%g<<GreenShift)|(%r<<RedShift)|(%a<<AlphaShift))
ENDM


You can inline this if you are using constants...

mov eax,MakeARGB(0xFF,15,23,65)
invoke SetPixel,[hdc],10,10,MakeARGB(0xFF,15,23,65)

AlphaOpaque = 0xFF
invoke SetPixel,[hdc],10,10,MakeARGB(AlphaOpaque,15,23,65)


Never knew it could do this but it seems to work fine. There are a lot of macros in the Microsoft headers that could benefit from this ! The only limitation is that it has to be the last parameter on the line but that is something that can be worked around and perhaps Jeremy can remove this restriction.

"Ahhh, what an awful dream. Ones and zeroes everywhere...[shudder] and I thought I saw a two." -- Bender
"It was just a dream, Bender. There's no such thing as two". -- Fry
-- Futurama

Donkey's Stable