Jump to content
Sign in to follow this  
torels

PixelGetColor Problem

Recommended Posts

torels

Hi there

Does anybody know why if I use pixelGetColor on blue pixels (any variation of blue) the returned value is a red Color and viceversa ?

thanks in advance


Some Projects:[list][*]ZIP UDF using no external files[*]iPod Music Transfer [*]iTunes UDF - fully integrate iTunes with au3[*]iTunes info (taskbar player hover)[*]Instant Run - run scripts without saving them before :)[*]Get Tube - YouTube Downloader[*]Lyric Finder 2 - Find Lyrics to any of your song[*]DeskBox - A Desktop Extension Tool[/list]indifference will ruin the world, but in the end... WHO CARES :P---------------http://torels.altervista.org

Share this post


Link to post
Share on other sites
ChangMinYang

Hi there

Does anybody know why if I use pixelGetColor on blue pixels (any variation of blue) the returned value is a red Color and viceversa ?

thanks in advance

AutoItSetOption( "ColorMode" , 0 )

;0 = Colors are defined as RGB (0xRRGGBB) (default)

;1 = Colors are defined as BGR (0xBBGGRR) (the mode used in older versions of AutoIt)

;2008-07-02(Wed) - AutoIt v3 removed this OPT.

Most of your problem, showed in AutoIt Help :-)

Share this post


Link to post
Share on other sites
torels

and how do I solve the problem considering that ColorMode opt doesn't exist anymore ?

I tried swapping blue and red but I get an inverted color then...


Some Projects:[list][*]ZIP UDF using no external files[*]iPod Music Transfer [*]iTunes UDF - fully integrate iTunes with au3[*]iTunes info (taskbar player hover)[*]Instant Run - run scripts without saving them before :)[*]Get Tube - YouTube Downloader[*]Lyric Finder 2 - Find Lyrics to any of your song[*]DeskBox - A Desktop Extension Tool[/list]indifference will ruin the world, but in the end... WHO CARES :P---------------http://torels.altervista.org

Share this post


Link to post
Share on other sites
Pain

Can't see what's wrong, try post a code snippet.

$var = PixelGetColor(1, 1)

ConsoleWrite(Hex($var, 6))

Returns: 035EE9

Share this post


Link to post
Share on other sites
torels

Global $handle = DLLCall("user32.dll","long","GetDC","hwnd",0)

For $x = 0 to @DesktopWidth
    For $y = 0 to @DesktopHeight
        PixelDraw(@DesktopWidth - $x, $y,PixelGetColor($x, $y))
    Next
Next        
        
Func PixelDraw($XCoord, $YCoord, $Color)
   DllCall("gdi32","long","SetPixel", "long",$handle[0], "long", $XCoord, "long", $YCoord, "long", $Color)
   If @error = 1 Then
      Return 0
   Else
      Return 1
   EndIf
EndFunc

reflects the screen

All blue elements turn red and all red elements turn blue

using Hex(PixelGetColor($x, $y),6) color seems to be inverted.

Edited by torels

Some Projects:[list][*]ZIP UDF using no external files[*]iPod Music Transfer [*]iTunes UDF - fully integrate iTunes with au3[*]iTunes info (taskbar player hover)[*]Instant Run - run scripts without saving them before :)[*]Get Tube - YouTube Downloader[*]Lyric Finder 2 - Find Lyrics to any of your song[*]DeskBox - A Desktop Extension Tool[/list]indifference will ruin the world, but in the end... WHO CARES :P---------------http://torels.altervista.org

Share this post


Link to post
Share on other sites
ChangMinYang

Global $handle = DLLCall("user32.dll","long","GetDC","hwnd",0)

For $x = 0 to @DesktopWidth
    For $y = 0 to @DesktopHeight
        PixelDraw(@DesktopWidth - $x, $y,PixelGetColor($x, $y))
    Next
Next        
        
Func PixelDraw($XCoord, $YCoord, $Color)
   DllCall("gdi32","long","SetPixel", "long",$handle[0], "long", $XCoord, "long", $YCoord, "long", $Color)
   If @error = 1 Then
      Return 0
   Else
      Return 1
   EndIf
EndFunc

reflects the screen

All blue elements turn red and all red elements turn blue

using Hex(PixelGetColor($x, $y),6) color seems to be inverted.

GetPixel( hDC , ( int )x , ( int )y ); // returns RGB( r , g , b )

SetPixel( hDC , ( int )x , ( int )y , (char)RGB( r , g , b ) );

Edited by GoodMan

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.