Sign in to follow this  
Followers 0
Vindicator209

Invert RGB hex

10 posts in this topic

How do you invert RGB hex codes? I can't do it one by one because it's going to be on a massive scale (like 10000)

Theres probably something right in my face but I'm not thinking too well at 1am.

Thanks


[center]"When you look at old, classic games like Snake, you often put it off because it's such a simple game, but it's only when you actually try and create your own unique game from scratch, do you finally appreciate those games."[/center][center]Don't ask for answers if you haven't TRIED yet![/center][center]Most answers can be answered in the help file! Use it![/center]

Share this post


Link to post
Share on other sites




[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

I understand the subtracting the RGB colors, which is much easier so I'll just change my cript to us that instead of hex... but down below it says to multiply r by 255.... I didn't know you could multiply numbers by letters, but I'll look into it tomorrow, thanks

EDIT: haha, what am I thinking... RGB isin't a color mode in autoit.....

so I guess that means I'm stuck back at square one... anyway, I'll get back to it after I've had some rest... writing scripts is addicting, although I don't understand how I spend 3 hours on 159 lines of script....

Edited by VindicatorOmega

[center]"When you look at old, classic games like Snake, you often put it off because it's such a simple game, but it's only when you actually try and create your own unique game from scratch, do you finally appreciate those games."[/center][center]Don't ask for answers if you haven't TRIED yet![/center][center]Most answers can be answered in the help file! Use it![/center]

Share this post


Link to post
Share on other sites

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

I've written a script few days ago to do this to the whole screen :P sadly it's to slow to be a real effect :P but maybe it can also help.

$dll = DllOpen("Gdi32.dll")
$hwnd = DllCall("user32.dll", "hwnd", "GetActiveWindow")
$dc = DllCall("user32.dll", "hwnd", "GetDC", "hwnd", $hwnd[0])
For $i = 0 to @DesktopWidth 
    For $j = 0 to @DesktopHeight
        $rgb = DllCall($dll, "int", "GetPixel", "hwnd", $dc[0], "int", $i, "int", $j)
        $rgb[0] = BitNOT("0x" & Hex($RGB[0]))
        DllCall($dll, "int", "SetPixel", "hwnd", $dc[0], "int", $i, "int", $j, "int", "0x00" & StringTrimLeft(Hex($rgb[0]), 2))
    Next
Next    
DllClose($dll)

If you have an idea how it can be done quicker let me know ;P

Edited by CHronologist

Share this post


Link to post
Share on other sites

yeah looks pretty funny but is quite useless if it can't be refreshed fast enough to hold up the effect, maybe i'll start a new topic and hope someone with more experiance about gdi and gdiplus can help

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

I've written a script few days ago to do this to the whole screen :P sadly it's to slow to be a real effect :P but maybe it can also help.

$dll = DllOpen("Gdi32.dll")
$hwnd = DllCall("user32.dll", "hwnd", "GetActiveWindow")
$dc = DllCall("user32.dll", "hwnd", "GetDC", "hwnd", $hwnd[0])
For $i = 0 to @DesktopWidth 
    For $j = 0 to @DesktopHeight
        $rgb = DllCall($dll, "int", "GetPixel", "hwnd", $dc[0], "int", $i, "int", $j)
        $rgb[0] = BitNOT("0x" & Hex($RGB[0]))
        DllCall($dll, "int", "SetPixel", "hwnd", $dc[0], "int", $i, "int", $j, "int", "0x00" & StringTrimLeft(Hex($rgb[0]), 2))
    Next
Next    
DllClose($dll)

If you have an idea how it can be done quicker let me know ;P

Well, you can do it like a TV screen, have one script do every OTHER vertical line, and another do the ones it missed Edited by VindicatorOmega

[center]"When you look at old, classic games like Snake, you often put it off because it's such a simple game, but it's only when you actually try and create your own unique game from scratch, do you finally appreciate those games."[/center][center]Don't ask for answers if you haven't TRIED yet![/center][center]Most answers can be answered in the help file! Use it![/center]

Share this post


Link to post
Share on other sites

I have opened an own post you can post your ideas there would be great :P

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  
Followers 0