Jump to content

_PixelFindAll()


Wolvereness
 Share

Recommended Posts

The reason it is converted to hex is to break it down into smaller components.

16777215 cannot be broken down into 3 sections for each RGB

FFFFFF is the converted version, always have 6 characters because of hex format.

FF|FF|FF Each of those is compared to the broken down version of they color like so:

FE|FF|FF

FF|FE|FE

That is 1 difference in each catagory and it'll return it as possitive for that pixel when shade variation is 1

Edit: Top Bottom Left Right - > I wanted to have a different format then PixelSearch()

Edited by Wolvereness

Offering any help to anyone (to my capabilities of course)Want to say thanks? Click here! [quote name='Albert Einstein']Only two things are infinite, the universe and human stupidity, and I'm not sure about the former.[/quote][quote name='Wolvereness' date='7:35PM Central, Jan 11, 2005']I'm NEVER wrong, I call it something else[/quote]

Link to comment
Share on other sites

  • Administrators

The reason it is converted to hex is to break it down into smaller components.

16777215 cannot be broken down into 3 sections for each RGB

FFFFFF is the converted version, always have 6 characters because of hex format.

FF|FF|FF Each of those is compared to the broken down version of they color like so:

FE|FF|FF

FF|FE|FE

That is 1 difference in each catagory and it'll return it as possitive for that pixel when shade variation is 1

Edit: Top Bottom Left Right - > I wanted to have a different format then PixelSearch()

I might be wrong but I think you've fallen into the dec/hex trap. For instance the _ColorGetBlue standard UDF is this:

Func _ColorGetBlue($nColor)
    Return BitAND($nColor, 0xff)
EndFunc  ;==>_ColorGetBlue

It doesn't care if you use a decimal or hex number as the input - you will still get the same return which is the blue component I've not looked at your script but you shouldn;t need to convert dec->hex just to work with colors.

Link to comment
Share on other sites

Exactly, I will refuse to do it if it isn't my way. You can't force me to do or think anything. But if someone were to give me a suggestion to make it faster, that would be cool.

He can't, you're right. But he did give you a suggestion, and it was faster. What are you saying?
Link to comment
Share on other sites

@ryeguy, The ONLY reason it was faster was it took out the $Shade

I might be wrong but I think you've fallen into the dec/hex trap.  For instance the _ColorGetBlue standard UDF is this:

Func _ColorGetBlue($nColor)
    Return BitAND($nColor, 0xff)
EndFunc  ;==>_ColorGetBlue

It doesn't care if you use a decimal or hex number as the input - you will still get the same return which is the blue component  I've not looked at your script but you shouldn;t need to convert dec->hex just to work with colors.

<{POST_SNAPBACK}>

Jon, I would like to talk about this. What I did to get each color was to put in hexidecimal as to make each color 2 characters, so as if the color was dark purple the resulting hex to the 6th value is A000A0 so I string split every 2 characters.

So $Array[0] = A000A0 Or Hex($DecimalFormOfNumber, 6)

and the blue value is $Array[1] = Dec(StringMid($Array[0], 1, 2)

Green value is $Array[1] = Dec(StringMid($Array[0], 3, 2)

Blue value is $Array[1] = Dec(StringMid($Array[0], 5, 2)

I never really understood the use of Bit funcs.

Edited by Wolvereness

Offering any help to anyone (to my capabilities of course)Want to say thanks? Click here! [quote name='Albert Einstein']Only two things are infinite, the universe and human stupidity, and I'm not sure about the former.[/quote][quote name='Wolvereness' date='7:35PM Central, Jan 11, 2005']I'm NEVER wrong, I call it something else[/quote]

Link to comment
Share on other sites

Wolver yours checks for shade even if it's set to 1?

Yours should be just as fast as mine if shade = 1 (same shade)...

"I thoroughly disapprove of duels. If a man should challenge me, I would take him kindly and forgivingly by the hand and lead him to a quiet place and kill him." - Mark TwainPatient: "It hurts when I do $var_"Doctor: "Don't do $var_" - Lar.
Link to comment
Share on other sites

Edit: Data is wrong. The colors added up < $shade = positive

Edited by Wolvereness

Offering any help to anyone (to my capabilities of course)Want to say thanks? Click here! [quote name='Albert Einstein']Only two things are infinite, the universe and human stupidity, and I'm not sure about the former.[/quote][quote name='Wolvereness' date='7:35PM Central, Jan 11, 2005']I'm NEVER wrong, I call it something else[/quote]

Link to comment
Share on other sites

Didn't realize that.

So if shade is set to 0... it should be just as fast as mine?

EDIT -

Checked, I was using shade = 0

Edited by Insolence
"I thoroughly disapprove of duels. If a man should challenge me, I would take him kindly and forgivingly by the hand and lead him to a quiet place and kill him." - Mark TwainPatient: "It hurts when I do $var_"Doctor: "Don't do $var_" - Lar.
Link to comment
Share on other sites

New version, I did some thinking and I changed up the way $i_Shade worked!

Insolence had about a 40~50 and mine had about a 170~190

Mine has $shade variation and $step

After changing $shade had almost no effect.

After changing $step > 1, Insolence's function was annihilated.

Edited by Wolvereness

Offering any help to anyone (to my capabilities of course)Want to say thanks? Click here! [quote name='Albert Einstein']Only two things are infinite, the universe and human stupidity, and I'm not sure about the former.[/quote][quote name='Wolvereness' date='7:35PM Central, Jan 11, 2005']I'm NEVER wrong, I call it something else[/quote]

Link to comment
Share on other sites

That kinda defeats the purpose, if you skip over some pixels you won't find them all... but I suppose if you're just looking for a certain ratio it's fine.

My function works great for what I want, yours has more features and sanity checks. I suggest using your function over mine, it was only an example anyhow :idiot:

"I thoroughly disapprove of duels. If a man should challenge me, I would take him kindly and forgivingly by the hand and lead him to a quiet place and kill him." - Mark TwainPatient: "It hurts when I do $var_"Doctor: "Don't do $var_" - Lar.
Link to comment
Share on other sites

The problem with mine was that it was doing 6 Dec() > or < checks and assigning a new array each time it runs.

I used a better format because I could never find a tool to turn negative numbers into abs without ($self * $self) / $Self , I guess I just skipped over the function.

I'm thinking of adding Dual step, that way you can step the Y and X factors seperate.

Edited by Wolvereness

Offering any help to anyone (to my capabilities of course)Want to say thanks? Click here! [quote name='Albert Einstein']Only two things are infinite, the universe and human stupidity, and I'm not sure about the former.[/quote][quote name='Wolvereness' date='7:35PM Central, Jan 11, 2005']I'm NEVER wrong, I call it something else[/quote]

Link to comment
Share on other sites

Last version->

Fixed problem seperating the original color.

Slightly fixed speed problem (faster now).

Fixed problem when comparing colors using BitAnd().

Offering any help to anyone (to my capabilities of course)Want to say thanks? Click here! [quote name='Albert Einstein']Only two things are infinite, the universe and human stupidity, and I'm not sure about the former.[/quote][quote name='Wolvereness' date='7:35PM Central, Jan 11, 2005']I'm NEVER wrong, I call it something else[/quote]

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...