{"versions":{"1.0.3":{"name":"bitmap-sdf","version":"1.0.3","description":"Calculate SDF for image/bw-data/array","main":"index.js","dependencies":{"clamp":"^1.0.1"},"devDependencies":{"enable-mobile":"^1.0.7","bubleify":"^0.7.0"},"scripts":{"test":"budo test","build":"browserify test.js -g bubleify | indexhtmlify | metadataify | github-cornerify > index.html"},"repository":{"type":"git","url":"git+https://github.com/dfcreative/bitmap-sdf.git"},"keywords":["sdf","signed-distance","image-sdf","bitmap","bwdist","tiny-sdf"],"author":{"name":"Dima Yv","email":"dfcreative@gmail.com"},"license":"MIT","bugs":{"url":"https://github.com/dfcreative/bitmap-sdf/issues"},"homepage":"https://github.com/dfcreative/bitmap-sdf#readme","gitHead":"0b8bb4f0a2bbc25bbc0d1bb1ce31d7d82765d718","_id":"bitmap-sdf@1.0.3","_npmVersion":"5.6.0","_nodeVersion":"8.1.2","_npmUser":{"name":"anonymous","email":"df.creative@gmail.com"},"dist":{"shasum":"c99913e5729357a6fd350de34158180c013880b2","size":11609,"noattachment":false,"tarball":"http://123.232.10.234:8212/nexus/content/groups/npm-public/bitmap-sdf/-/bitmap-sdf-1.0.3.tgz","integrity":"sha512-ojYySSvWTx21cbgntR942zgEgqj38wHctN64vr4vYRFf3GKVmI23YlA94meWGkFslidwLwGCsMy2laJ3g/94Sg=="},"maintainers":[{"name":"anonymous","email":"df.creative@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/bitmap-sdf-1.0.3.tgz_1515771549805_0.012204900616779923"},"directories":{},"publish_time":1515771550665,"_hasShrinkwrap":false,"_cnpm_publish_time":1515771550665,"_cnpmcore_publish_time":"2021-12-16T21:38:58.545Z","contributors":[]},"1.0.2":{"name":"bitmap-sdf","version":"1.0.2","description":"Calculate SDF for image/bw-data/array","main":"index.js","dependencies":{"clamp":"^1.0.1"},"devDependencies":{"enable-mobile":"^1.0.7","bubleify":"^0.7.0"},"scripts":{"test":"budo test","build":"browserify test.js -g bubleify | indexhtmlify | metadataify | github-cornerify > index.html"},"repository":{"type":"git","url":"git+https://github.com/dfcreative/bitmap-sdf.git"},"keywords":["sdf","signed-distance","image-sdf","bitmap","bwdist","tiny-sdf"],"author":{"name":"Dima Yv","email":"dfcreative@gmail.com"},"license":"MIT","bugs":{"url":"https://github.com/dfcreative/bitmap-sdf/issues"},"homepage":"https://github.com/dfcreative/bitmap-sdf#readme","gitHead":"3a5620a07e9ffbbaed18526af74c7544890a899e","_id":"bitmap-sdf@1.0.2","_npmVersion":"5.6.0","_nodeVersion":"8.1.2","_npmUser":{"name":"anonymous","email":"df.creative@gmail.com"},"dist":{"shasum":"113b184e607c44b76f923fc2dea34e2d5d9895cc","size":11482,"noattachment":false,"tarball":"http://123.232.10.234:8212/nexus/content/groups/npm-public/bitmap-sdf/-/bitmap-sdf-1.0.2.tgz","integrity":"sha512-/CMU4dPuepQpnIrz60R7AHVlLg7nFMp3Ww65rq8eWWBBQVf6QzIrnJqni3ppxDtJgGD/qGuttGbkqlgqWlOHvw=="},"maintainers":[{"name":"anonymous","email":"df.creative@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/bitmap-sdf-1.0.2.tgz_1515184364799_0.16221345053054392"},"directories":{},"publish_time":1515184364898,"_hasShrinkwrap":false,"_cnpm_publish_time":1515184364898,"_cnpmcore_publish_time":"2021-12-16T21:38:58.757Z","contributors":[]},"1.0.1":{"name":"bitmap-sdf","version":"1.0.1","description":"Calculate SDF for image/bw-data/array","main":"index.js","dependencies":{"clamp":"^1.0.1"},"devDependencies":{"enable-mobile":"^1.0.7","bubleify":"^0.7.0"},"scripts":{"test":"budo test","build":"browserify test.js -g bubleify | indexhtmlify | metadataify | github-cornerify > index.html"},"repository":{"type":"git","url":"git+https://github.com/dfcreative/bitmap-sdf.git"},"keywords":["sdf","signed-distance","image-sdf","bitmap","bwdist","tiny-sdf"],"author":{"name":"Dima Yv","email":"dfcreative@gmail.com"},"license":"MIT","bugs":{"url":"https://github.com/dfcreative/bitmap-sdf/issues"},"homepage":"https://github.com/dfcreative/bitmap-sdf#readme","gitHead":"d9ccc1d2a5954577c690c2c523e9c02e54f00c3a","_id":"bitmap-sdf@1.0.1","_shasum":"47743081413c1fee75b8727a553a74545b9daac8","_from":".","_npmVersion":"4.6.1","_nodeVersion":"8.1.2","_npmUser":{"name":"anonymous","email":"df.creative@gmail.com"},"dist":{"shasum":"47743081413c1fee75b8727a553a74545b9daac8","size":11519,"noattachment":false,"tarball":"http://123.232.10.234:8212/nexus/content/groups/npm-public/bitmap-sdf/-/bitmap-sdf-1.0.1.tgz","integrity":"sha512-vMOP2906ciFtngZgPo46QdXSaRyS3PO97AI/yxqQFYuufPKDscZ7G2EZtsvnUbds/LnHRfNHIeQVrgZtwljI+g=="},"maintainers":[{"name":"anonymous","email":"df.creative@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/bitmap-sdf-1.0.1.tgz_1503521020677_0.9237783153075725"},"directories":{},"publish_time":1503521021673,"_hasShrinkwrap":false,"_cnpm_publish_time":1503521021673,"_cnpmcore_publish_time":"2021-12-16T21:38:58.990Z","contributors":[]},"1.0.0":{"name":"bitmap-sdf","version":"1.0.0","description":"Calculate SDF for image/bw-data/array","main":"index.js","dependencies":{"clamp":"^1.0.1","enable-mobile":"^1.0.7"},"devDependencies":{"bubleify":"^0.7.0"},"scripts":{"test":"budo test","build":"browserify test.js -g bubleify | indexhtmlify | metadataify | github-cornerify > index.html"},"repository":{"type":"git","url":"git+https://github.com/dfcreative/bitmap-sdf.git"},"keywords":["sdf","signed-distance","image-sdf","bitmap","bwdist","tiny-sdf"],"author":{"name":"Dima Yv","email":"dfcreative@gmail.com"},"license":"MIT","bugs":{"url":"https://github.com/dfcreative/bitmap-sdf/issues"},"homepage":"https://github.com/dfcreative/bitmap-sdf#readme","gitHead":"5533216d6638c5351cd3c6df50ba19a433c7abc6","_id":"bitmap-sdf@1.0.0","_shasum":"23243ba42af8100060ad7c9826157a5daea458d2","_from":".","_npmVersion":"4.6.1","_nodeVersion":"8.1.2","_npmUser":{"name":"anonymous","email":"df.creative@gmail.com"},"dist":{"shasum":"23243ba42af8100060ad7c9826157a5daea458d2","size":29399,"noattachment":false,"tarball":"http://123.232.10.234:8212/nexus/content/groups/npm-public/bitmap-sdf/-/bitmap-sdf-1.0.0.tgz","integrity":"sha512-JJCFLzdYELoXgOKRUndh/v0loIE5O6sg21zX87DIzlnCVMTfUhsofkMs188LO/c4EF44O/GuB+7CzgQRw8OfUQ=="},"maintainers":[{"name":"anonymous","email":"df.creative@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/bitmap-sdf-1.0.0.tgz_1500401511370_0.4757901984266937"},"directories":{},"publish_time":1500401513091,"_hasShrinkwrap":false,"_cnpm_publish_time":1500401513091,"_cnpmcore_publish_time":"2021-12-16T21:38:59.224Z","contributors":[]},"1.0.4":{"name":"bitmap-sdf","version":"1.0.4","description":"Calculate SDF for image/bw-data/array","main":"index.js","devDependencies":{"bubleify":"^0.7.0","enable-mobile":"^1.0.7"},"scripts":{"test":"budo test","build":"browserify test.js -g bubleify | indexhtmlify | metadataify | github-cornerify > index.html"},"repository":{"type":"git","url":"git+https://github.com/dfcreative/bitmap-sdf.git"},"keywords":["sdf","signed-distance","image-sdf","bitmap","bwdist","tiny-sdf"],"author":{"name":"Dima Yv","email":"dfcreative@gmail.com"},"license":"MIT","bugs":{"url":"https://github.com/dfcreative/bitmap-sdf/issues"},"homepage":"https://github.com/dfcreative/bitmap-sdf#readme","gitHead":"78de3569d32404a7009f62bea3befca55838118a","_id":"bitmap-sdf@1.0.4","_nodeVersion":"16.13.2","_npmVersion":"8.3.0","dist":{"integrity":"sha512-1G3U4n5JE6RAiALMxu0p1XmeZkTeCwGKykzsLTCqVzfSDaN6S7fKnkIkfejogz+iwqBWc0UYAIKnKHNN7pSfDg==","shasum":"e87b8b1d84ee846567cfbb29d60eedd34bca5b6f","tarball":"http://123.232.10.234:8212/nexus/content/groups/npm-public/bitmap-sdf/-/bitmap-sdf-1.0.4.tgz","fileCount":7,"unpackedSize":19053,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIC5T3svriBwRPKJwsMMu3zhhn+f1s8hSXRlnAzVmzxjbAiEA3hAUSTgELhgxIeE8GqBCP4CbFqjFH+JNeUtA4zb0SAg="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJicCkPACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqknRAAg0dG5ad/xiShC6tYDvUalCM98Y0ngBlntcTYLPubKhqhPEGe\r\nEMgIE+gbwDhDGJqzMhPQsPkVvLXbD0cY4SMI92Sl0go+MuyCP7L/K7LbXmq5\r\nrDKPD3JxOibcOlAHeBe4cAPyqq3E9senrIyuwYigkhMJ2xMBk/ADa6kTkx6r\r\ngFnlvDvwQl7QKb/ZyFc38uHJDRB/JRFLQUzwKnnKZRkjA24EFYBefaEN9ebf\r\nheYelx5lQEnECKiMX68kG26TJdxL1MJDCUJ+dipY/Hr4ZBBvuY+/XZEfxFuF\r\nBasDqp3Qaht/8NOX8jb1fQ4cZT6VHY7WIhqpb3DONhIjZSgtngvy8pQhovwU\r\nU51rFdCZnSu5Pe53PvInnP880jH5SaYZl6AAvGe0UP2wfg1VjWSEPaaAona0\r\nsK2o6uDLFeRh6ZZbMphkVtzrvdG7Nn+70EuvNeOc7frsABWMXT4aaXJD/ado\r\niwdsN8v7NU9I8m994JMdHLU35Aqut9TXo0wNr3+wgzIRI7t8OGbWm9kniycz\r\nGUUSPw1NQqaArxEN4YzDQoNAg0W48bOTA3NHX+jB4W9VRFAGsbjppzzeX2y9\r\nubDix/ScaqAbE9VcjmyIJL9wXmXc59VPlAvh37bSOj3dqit5UMt7q5DDusCg\r\nnDMB+927AuYAFeABgbLELRxE1JbjMfz5wsA=\r\n=s47H\r\n-----END PGP SIGNATURE-----\r\n","size":11535},"_npmUser":{"name":"anonymous","email":"df.creative@gmail.com"},"directories":{},"maintainers":[{"name":"anonymous","email":"df.creative@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/bitmap-sdf_1.0.4_1651517711199_0.2646646063669398"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2022-05-02T19:00:15.862Z","contributors":[]}},"dist-tags":{"latest":"1.0.4"},"name":"bitmap-sdf","time":{"created":"2022-01-26T18:29:56.793Z","modified":"2022-05-02T19:00:22.133Z","1.0.3":"2018-01-12T15:39:10.665Z","1.0.2":"2018-01-05T20:32:44.898Z","1.0.1":"2017-08-23T20:43:41.673Z","1.0.0":"2017-07-18T18:11:53.091Z","1.0.4":"2022-05-02T18:55:11.323Z"},"readme":"# bitmap-sdf [![unstable](https://img.shields.io/badge/stability-unstable-green.svg)](http://github.com/badges/stability-badges)\r\n\r\nCalculate signed distance field for an image / bw-data. Fork of [tiny-sdf](https://github.com/mapbox/tiny-sdf) with reduced API.\r\n\r\n![bitmap-sdf](preview.png)\r\n\r\n[Demo](https://dy.github.io/bitmap-sdf/)\r\n\r\n## Usage\r\n\r\n[![npm install bitmap-sdf](https://nodei.co/npm/bitmap-sdf.png?mini=true)](https://npmjs.org/package/bitmap-sdf/)\r\n\r\n```js\r\nlet calcSdf = requrie('bitmap-sdf')\r\n\r\n//draw image\r\nlet canvas = document.body.appendChild(document.createElement('canvas'))\r\nlet w = canvas.width = 200, h = canvas.height = 200\r\nlet ctx = canvas.getContext('2d')\r\nctx.fillStyle = 'white'\r\nctx.font = 'bold 30px sans-serif'\r\nctx.fillText('X', 20, 20)\r\n\r\n//calculate distances\r\nlet distances = calcSdf(canvas)\r\n\r\n//show distances\r\nlet imgArr = new Uint8ClampedArray(w*h*4)\r\nfor (let i = 0; i < w; i++) {\r\n\tfor (let j = 0; j < h; j++) {\r\n\t\timgArr[j*w*4 + i*4 + 0] = arr[j*w+i]*255\r\n\t\timgArr[j*w*4 + i*4 + 1] = arr[j*w+i]*255\r\n\t\timgArr[j*w*4 + i*4 + 2] = arr[j*w+i]*255\r\n\t\timgArr[j*w*4 + i*4 + 3] = 255\r\n\t}\r\n}\r\nvar data = new ImageData(imgArr, w, h)\r\nctx.putImageData(data, 0, 0)\r\n```\r\n\r\n### dist = calcSdf(source, options?)\r\n\r\nCalculate distance field for the input `source` data, based on `options`. Returns 1-channel array with distance values from `0..1` range.\r\n\r\n#### Source:\r\n\r\nType | Meaning\r\n---|---\r\n_Canvas_, _Context2D_ | Calculates sdf for the full canvas image data based on `options.channel`, by default `0`, ie. red channel.\r\n_ImageData_ | Calculates sdf for the image data based on `options.channel`\r\n_Uint8ClampedArray_, _Uint8Array_ | Handles raw pixel data, requires `options.width` and `options.height`. Stride is detected from `width` and `height`.\r\n_Float32Array_, _Array_ | Handles raw numbers from `0..1` range, requires `options.width` and `options.height`. Stride is detected from `width` and `height`.\r\n\r\n#### Options:\r\n\r\nProperty | Default | Meaning\r\n---|---|---\r\n`cutoff` | `0.25` | Cutoff parameter, balance between SDF inside `1` and outside `0` of glyph\r\n`radius` | `10` | Max length of SDF, ie. the size of SDF around the `cutoff`\r\n`width` | `canvas.width` | Width of input data, if array\r\n`height` | `canvas.height` | Height of input data, if array\r\n`channel` | `0` | Channel number, `0` is red, `1` is green, `2` is blue, `3` is alpha.\r\n`stride` | `null` | Explicitly indicate number of channels per pixel. Not needed if `height` and `width` are provided.\r\n\r\n## See also\r\n\r\n* [font-atlas-sdf](https://github.com/hughsk/font-atlas-sdf) − generate sdf atlas for a font.\r\n* [tiny-sdf](https://github.com/mapbox/tiny-sdf) − fast glyph signed distance field generation.\r\n* [optical-properties](https://github.com/dfcreative/optical-properties) − glyph optical center and bounding box calculation\r\n\r\n## Alternatives\r\n\r\n* [disttransform.wat](https://github.com/LingDong-/wasm-fun/blob/master/wat/disttransform.wat)\r\n\r\n## License\r\n\r\n(c) 2017 Dima Yv. MIT License\r\n\r\nDevelopment supported by plot.ly.","users":{}}