This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// width - image width | |
// height - image height | |
// input - two-dimentional array of RGBA pixels of original image | |
// output - two-dimentional array of RGBA pixels of processed image | |
// Both are initialized with the same image | |
// channel - R, G, or B channel to copy (shifted) in output image | |
// copyChannelPoint(x, y) - pseudopoint, specifying where to place (top left corener) shifted channel data from on output image | |
// copyPixelsData - pseudostrust, specifying areas of input image to be copied (shifted) to output: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Caman.Blender.register("darkerColor", function (rgbaLayer, rgbaParent) { | |
var LUMINANCE_WEIGHTING = [0.299, 0.587, 0.114]; | |
return (CanvasHelpers.intensity(rgbaLayer, LUMINANCE_WEIGHTING) < CanvasHelpers.intensity(rgbaParent, LUMINANCE_WEIGHTING)) | |
? CanvasHelpers.blend(rgbaParent, rgbaLayer) | |
: CanvasHelpers.blend(rgbaLayer, rgbaParent); | |
}); | |
static intensity(rgba, luminanceWeighting) | |
{ |