MCPcopy Index your code
hub / github.com/clips/pattern / colorize

Function colorize

pattern/canvas.js:3081–3096  ·  view source on GitHub ↗
(img, color, bias)

Source from the content-addressed store, hash-verified

3079}
3080
3081function colorize(img, color, bias) {
3082 /* Returns a colorized image.
3083 * - color: a Color (or array) of RGBA-values to multiply with each image pixel.
3084 * - bias : a Color (or array) of RGBA-values to add to each image pixel.
3085 */
3086 var m1 = new Color(color || [1,1,1,1]).rgba();
3087 var m2 = new Color(bias || [0,0,0,0]).map({base: 255});
3088 return filter(img, function(p) {
3089 return [
3090 p[0] * m1[0] + m2[0],
3091 p[1] * m1[1] + m2[1],
3092 p[2] * m1[2] + m2[2],
3093 p[3] * m1[3] + m2[3]
3094 ];
3095 });
3096}
3097
3098// function adjust(img, {hue:0, saturation:1.0, brightness:1.0, contrast:1.0})
3099function adjust(img, options) {

Callers

nothing calls this directly

Calls 2

filterFunction · 0.70
mapMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…