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

Function mix

pattern/canvas.js:3253–3261  ·  view source on GitHub ↗
(p1, p2, op, luminance)

Source from the content-addressed store, hash-verified

3251 op = function(x, y) { return 0; };
3252 }
3253 function mix(p1, p2, op, luminance) {
3254 var p = [0,0,0,0];
3255 var a = p2[3] / 255 * alpha;
3256 p[0] = geometry.lerp(p1[0], op(p1[0], p2[0], luminance), a);
3257 p[1] = geometry.lerp(p1[1], op(p1[1], p2[1], luminance), a);
3258 p[2] = geometry.lerp(p1[2], op(p1[2], p2[2], luminance), a);
3259 p[3] = geometry.lerp(p1[3], 255, a);
3260 return p;
3261 }
3262 // Some blend modes swap opaque blend (alpha=255) with base layer to mimic Photoshop.
3263 // Some blend modes use luminace (overlay & hard light).
3264 if (mode == ADD|| mode == SUBTRACT) {

Callers 1

blendFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected