2 * Pixastic Lib - Lighten filter - v0.1.0
3 * Copyright (c) 2008 Jacob Seidelin, jseidelin@nihilogic.dk, http://blog.nihilogic.dk/
4 * MIT License [http://www.opensource.org/licenses/mit-license.php]
7 Pixastic
.Actions
.lighten
= {
9 process : function(params
) {
10 var amount
= parseFloat(params
.options
.amount
) || 0;
12 if (Pixastic
.Client
.hasCanvasImageData()) {
13 var data
= Pixastic
.prepareData(params
);
14 var rect
= params
.options
.rect
;
20 var offsetY
= (y
-1)*w4
;
23 var offset
= offsetY
+ (x
-1)*4;
26 var g
= data
[offset
+1];
27 var b
= data
[offset
+2];
36 if (r
> 255 ) r
= 255;
37 if (g
> 255 ) g
= 255;
38 if (b
> 255 ) b
= 255;
48 } else if (Pixastic
.Client
.isIE()) {
49 var img
= params
.image
;
51 img
.style
.filter
+= " light()";
52 img
.filters
[img
.filters
.length
-1].addAmbient(
56 } else if (amount
> 0) {
57 img
.style
.filter
+= " light()";
58 img
.filters
[img
.filters
.length
-1].addAmbient(
62 img
.filters
[img
.filters
.length
-1].addAmbient(
70 checkSupport : function() {
71 return (Pixastic
.Client
.hasCanvasImageData() || Pixastic
.Client
.isIE());