Function
extractAlpha
(alphaChannel, width, height, gridOuter, gridInner, radius, cutoff)
Source from the content-addressed store, hash-verified
| 105800 | } |
| 105801 | } |
| 105802 | function 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 | } |
| 105808 | TinySDF.prototype._draw = function(char, getMetrics) { |
| 105809 | var textMetrics = this.ctx.measureText(char); |
| 105810 | // Older browsers only expose the glyph width |
Tested by
no test coverage detected