Jump to content
Sign in to follow this  

(Solved) BitWise op

Recommended Posts


Is there any bitwise operation for this...

I have a colour 0x112233 and want to get to 332211?

basically rgb to bgr, and need it to be a number rather than a string via bitwise


I found something in c++

#define RGB2BGR(a_ulColor) (a_ulColor & 0xFF000000) | ((a_ulColor & 0xFF0000) >> 16) | (a_ulColor & 0x00FF00) | ((a_ulColor & 0x0000FF) << 16)

I just don't know anything about bitwise.

Edited by JohnOne

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Share this post

Link to post
Share on other sites


Func _ColorSwitch($color)
    Return BitOr(BitAnd($color, 0xFF000000), BitShift(BitAnd($color, 0x00FF0000), 16), BitAnd($color, 0x0000FF00), BitShift(BitAnd($color, 0xFF), -16))

*GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes

Share this post

Link to post
Share on other sites

You can also try to take advantage of conversion functions:

Func BGRToRGB_OrWhateverThatIs($iColor)
    Return Dec(Hex(BinaryMid($iColor, 1, 3)))
Edited by trancexx




Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.