Sign in to follow this  
Followers 0
Spikey0000

Pixel Color calculations

5 posts in this topic

Hi all,

What I want to accomplish is the following:

Using the color of a pixel as reference, I want to update an array of colors so that if the reference pixel changes color, my array will change by the same amount.

Hope that made sense.

The following code does not work properly... please help.

$new_background = Hex(PixelGetColor(200,790), 6)
                        if $background_color <>  $current_background Then
                            For $i = 0 to $count Step 1
                                $color[$i] = $color[$i] -$background_color + $new_background
                            Next
                        $background_color = $new_background

Share this post


Link to post
Share on other sites



Isnt this better:

if Hex(PixelGetColor(200,790), 6) <> $background_color then 
$background_color=Hex(PixelGetColor(200,790), 6) 
$difference=$color[$i]-$background_color
$color[$i]=$color[$i]+$difference
endif

It is only an simple example code, but You have the Idea?

Helped? :P


Share this post


Link to post
Share on other sites

I've modified the code to the idea above, but it's not working.

I've used the debug feature.

New Background: 64636A, Old Background: 6F6E76

Old Color: 6E2610

New Color: 0

Old Color: 39221C

New Color: 0

Here is the code

$current_background = Hex(PixelGetColor(200,790), 6)
                        if $background_color <>  $current_background Then
                            _DebugOut ("New Background: " & $current_background  & ", Old Background: " & $background_color, 0)
                            For $i = 0 to $count Step 1
                                _DebugOut ("Old Color: " & $color[$i], 0)
                                $difference = $current_background - $background_color
                                $color[$i] = $color[$i] + $difference
                                _DebugOut ("New Color: " & $color[$i], 0)
                            Next
                        $background_color = $current_background

Please help~

Share this post


Link to post
Share on other sites

can anyone help?

Share this post


Link to post
Share on other sites

Can anyone point me in the right direction?

is it related to RBG colors?

Thanks.

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