Build the matrix for ~CHAN(r,g,b,a): each output channel is fed by whichever named input channel (or constant black/white) is given for it, missing trailing entries left as the output channel's own identity source (R,G,B,A).
~CHAN(r,g,b,a)
R,G,B,A
import { channelSwapMatrix } from '@datamoc/mw_games/two-d/render';const matrix = channelSwapMatrix(['B', 'G', 'R']); // swap the red and blue channels Copy
import { channelSwapMatrix } from '@datamoc/mw_games/two-d/render';const matrix = channelSwapMatrix(['B', 'G', 'R']); // swap the red and blue channels
Build the matrix for
~CHAN(r,g,b,a): each output channel is fed by whichever named input channel (or constant black/white) is given for it, missing trailing entries left as the output channel's own identity source (R,G,B,A).