JohnOne Posted May 6, 2012 Posted May 6, 2012 (edited) 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 EDIT: 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 May 6, 2012 by JohnOne AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
ProgAndy Posted May 6, 2012 Posted May 6, 2012 Here: Func _ColorSwitch($color) Return BitOr(BitAnd($color, 0xFF000000), BitShift(BitAnd($color, 0x00FF0000), 16), BitAnd($color, 0x0000FF00), BitShift(BitAnd($color, 0xFF), -16)) EndFunc *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
JohnOne Posted May 6, 2012 Author Posted May 6, 2012 Gear. Thank you ProgAndy. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
trancexx Posted May 6, 2012 Posted May 6, 2012 (edited) You can also try to take advantage of conversion functions: Func BGRToRGB_OrWhateverThatIs($iColor) Return Dec(Hex(BinaryMid($iColor, 1, 3))) EndFunc Edited May 6, 2012 by trancexx ♡♡♡ . eMyvnE
JohnOne Posted May 6, 2012 Author Posted May 6, 2012 Cheers trancexx. That also works a treat BGR = BlueGreenRed and > < AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
Malkey Posted May 6, 2012 Posted May 6, 2012 @trancexx The "Dec(Hex(" looks like a red herring. ConsoleWrite(_BGRToRGB_OrWhatever("0x332211") & @LF) ; A string ConsoleWrite(_BGRToRGB_OrWhatever(0x332211) & @LF) ; A number ;Returns:- ;0x112233 ;0x112233 Func _BGRToRGB_OrWhatever($iColor) Return BinaryMid(Number($iColor), 1, 3) EndFunc ;==>_BGRToRGB_OrWhatever
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now