Wednesday, 18 September 2013

KineticJS apply multiple filters to the image and I saw a hue-filter also

KineticJS apply multiple filters to the image and I saw a hue-filter also

Since filters are poorly documented in the kineticJS I have a problem
applying two filters to a image. Couple of questions:
1) I want to set Blur and Brighten filters to the same image.
Both works separetely:
if (!!image.getAttr('filterBrightness')) {
image.setFilter(Kinetic.Filters.Brighten);
}
image.setFilterBrightness(120);
and
if (!!image.getAttr('filterAmount')){
image.setFilter(Kinetic.Filters.Blur);
}
image.setFilterRadius(2);
I tried
image.applyFilter(Kinetic.Filters.Blur)
image.setFilterAmount(2);
and it worked but again when reapplyin another filter, the blur filter
went off.
2) How do I correctly check if there is a filter set? I tried getFilter()
function but firebug's console.log only shows "function".
3) There is some ShiftHue-filter, but obviously I don't understand a word
from the source. See: http://kineticjs.com/docs/Kinetic.Filters.html and
the source
(http://d3lp1msu2r81bx.cloudfront.net/kjs/js/lib/kinetic-v4.7.0.js) says
as below. What I don't understand is "set hue shift amount @name
setFilterBrightness" is it a mistake in the source documentation?
How to use that filter? Set filter
/**
* get hue shift amount. The shift amount is a number between 0 and 360.
* @name getFilterBrightness
* @method
* @memberof Kinetic.Image.prototype
*/
/**
* set hue shift amount
* @name setFilterBrightness
* @method
* @memberof Kinetic.Image.prototype
*/
Thank you!

No comments:

Post a Comment