WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Samples from Users
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

ARGB Function


Question:

What's the best way to construct a ARGB value?, something like this but with the extra alpha

#definefunction RGB(red, green, blue)
return ((red mod 256)+(green mod 256)*256+(blue mod 256)*256*256)
#endfunction

ARGB(alpha, red, green, blue)
msdn states: The color value contains four, 8-bit components: alpha, red, green, and blue. The first 8 bits (the most significant) contain the alpha component, the next 8 bits contain the red component, the next 8 bits contain the green component, and the next 8 bits (the least significant) contain the blue component. The 32-bit value is stored in a variable of type ARGB.

Answer:

The alpha value is the most significant byte of a 32 bit integer. Something like this:
#definefunction ARGB(Alpha, red, green, blue)
return (blue << 0) |(green << 8) |(red << 16) | (Alpha << 24)
#endfunction

Article ID:   W16682
File Created: 2005:02:18:12:21:52
Last Updated: 2005:02:18:12:21:52