JSPM

premultiplied-rgba

1.0.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 29
  • Score
    100M100P100Q70955F
  • License MIT

standalone function to premultiply RGB by alpha channel

Package Exports

  • premultiplied-rgba

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (premultiplied-rgba) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

premultiplied-rgba

frozen

Standalone function to premultiply RGB by alpha channel.

var premult = require('premultiplied-rgba')

premult([1, 1, 1, 0.5]) 

//=> returns new array [0.5, 0.5, 0.5, 0.5]

Usage

NPM

premultiply(rgba[, out])

Takes a 4-component array assumed to be in the form [R, G, B, A] and returns a new array with the RGB channels multiplied by the alpha channel.

The out param allows you to re-use an array rather than creating a new one. So you can premultiply an array in-place like so:

premultiply(rgba, rgba)

License

MIT, see LICENSE.md for details.