mwg API
    Preparing search index...

    Function channelSwapMatrix

    • 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).

      Parameters

      Returns ColorMatrix

      import { channelSwapMatrix } from '@datamoc/mw_games/two-d/render';
      const matrix = channelSwapMatrix(['B', 'G', 'R']); // swap the red and blue channels