[How To] Colors API

[How To] Colors API

in API Development

Posted by: Dr Ishmael.9685

Dr Ishmael.9685

I also created a javascript version of our internal color shifting algorithm here: http://jsfiddle.net/cliff/jQ8ga/ . This example code uses the sylvester javascript matrix library for math.

The way it works is pretty different than the processes previously described — it calculates a transformation matrix which is then applied to the color in one pass.

I was able to convert this to Perl easily. The great thing is that Perl has “native” support for matrices, i.e. just create an array of arrays. Coupled with a subroutine for matrix multiplication from my Perl books, and I’m able to reproduce all of the pre-calculated RGB values. Thanks, Cliff!

[How To] Colors API

in API Development

Posted by: Goddchen.4958

Goddchen.4958

precalculated RGB values: thanks you so much Cliff

[How To] Colors API

in API Development

Posted by: zwei.9073

zwei.9073

precalculated RGB values: thanks you so much Cliff

I definitelly seccond this thanks!

[How To] Colors API

in API Development

Posted by: Think.8042

Think.8042

Yep, converting this new algorithm to PHP was not too hard, also using arrays for vectors and some algebra functions. Thanks for the precalculated values, too.

=)

[How To] Colors API

in API Development

Posted by: smiley.1438

smiley.1438

Yep, converting this new algorithm to PHP was not too hard, also using arrays for vectors and some algebra functions. Thanks for the precalculated values, too.

=)

Mind to share? I’m still getting incorrect values with this:
https://gist.github.com/codemasher/b869faa7603e1934c28d

(my brain melts >.<)

[How To] Colors API

in API Development

Posted by: Dr Ishmael.9685

Dr Ishmael.9685

Smiley, I think you just need to change your bgrVector (line 82) from a single-row matrix to a single-column matrix. Then swap the order in the matrix multiplication, so it matches Cliff’s order.

[How To] Colors API

in API Development

Posted by: smiley.1438

smiley.1438

Ah, thanks Dr Ishmael, that helped!

Updated and cleaned up that gist, you may take it as php example then:
https://gist.github.com/codemasher/b869faa7603e1934c28d

Also updated my color list: https://chillerlan.net/gw2color.php

Anyway, theres still the other conversion approach - i’d still like to know where the flaw is in there…

(edited by smiley.1438)

[How To] Colors API

in API Development

Posted by: Think.8042

Think.8042

Sorry, I somehow thought I posted the Gist link here. Since it’s already done now and looks pretty much exactly like mine, I won’t bother posting an identical copy, so people can focus a little more on what’s working.

[How To] Colors API

in API Development

Posted by: Primal Zed.9714

Primal Zed.9714

What about the difference between highlight, base, and shadow of each dye? The Flame & Frost dyes obviously have a greater difference in these values than most dyes do. How is this determined?