Closed lehni closed 11 years ago
i've added a number of simple calculation methods, perhaps if you let me know what you have in mind i can add additional calculation methods for colors it to my fork
Hi Frederick,
I just found it, looking good!
https://github.com/frederickk/paper.js/blob/master/src/style/Color.js
I wasn't aware of all your extensions to Paper.js. Maybe we should discuss these a bit and see which ones could make it into core?
And in order for you to avoid having to merge all the time when we do refactoring (of which a lot has happened in the past), you could write these as extensions rather than a fork:
paper.Color.inject({
add: function(color) {
return new Color(
this.red + point.red,
this.green + point.green,
this.blue + point.blue,
this.alpha + point.alpha
);
}
});
Just a thought!
I will move the ones over that I think are good, and will perhaps change the code a bit. I shall also add you to the contributors list then.
Just realizing, the code will need more work though, since this only works for the rgb type. We should work with components arrays instead. Will look into that.
i wanted to test my additions before submitting a pull request, but maybe i can just submit it and together we can possibly work on changes. let me know what you think is best.
the "library" (https://github.com/frederickk/frederickkPaper) i built was a series of extensions exactly as you've described, here... would that a better way of proposing additions for you to implement?
so a component version would look like (pseudo code):
add: function(color) {
for( var i=0; i<this.comps.length; i++ ) {
this.comps[i] + color.comps[i];
}
return this;
}
Oops, I didn't see you posted in the meantime. The code is more abstract, as it can produce the math operators in a loop. It also performs some extra magic so that color.multiply(4) actually works, and 4 is not clamped down to 1 before it's multiplied...
Allow things like mixing, averaging, etc. in a very simple way.