MCPcopy Create free account
hub / github.com/microsoft/SandDance / extractAlpha

Function extractAlpha

docs/app/js/sanddance-app.js:105802–105807  ·  view source on GitHub ↗
(alphaChannel, width, height, gridOuter, gridInner, radius, cutoff)

Source from the content-addressed store, hash-verified

105800 }
105801}
105802function extractAlpha(alphaChannel, width, height, gridOuter, gridInner, radius, cutoff) {
105803 for(var i = 0; i < width * height; i++){
105804 var d = Math.sqrt(gridOuter[i]) - Math.sqrt(gridInner[i]);
105805 alphaChannel[i] = Math.round(255 - 255 * (d / radius + cutoff));
105806 }
105807}
105808TinySDF.prototype._draw = function(char, getMetrics) {
105809 var textMetrics = this.ctx.measureText(char);
105810 // Older browsers only expose the glyph width

Callers 1

sanddance-app.jsFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected