~raph/blurrr

7bedad9838e0cf186f70f7351575e7560544ee78 — Raph Levien 1 year, 6 months ago d2260c3
Automatic computation of radius and exponent
5 files changed, 84 insertions(+), 100 deletions(-)

M Cargo.lock
M Cargo.toml
M src/distfield.rs
M src/image.rs
M src/main.rs
M Cargo.lock => Cargo.lock +64 -93
@@ 45,26 45,6 @@ version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"

[[package]]
name = "backtrace"
version = "0.3.46"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
 "backtrace-sys 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)",
 "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)",
 "libc 0.2.68 (registry+https://github.com/rust-lang/crates.io-index)",
 "rustc-demangle 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)",
]

[[package]]
name = "backtrace-sys"
version = "0.1.35"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
 "cc 1.0.50 (registry+https://github.com/rust-lang/crates.io-index)",
 "libc 0.2.68 (registry+https://github.com/rust-lang/crates.io-index)",
]

[[package]]
name = "base-x"
version = "0.2.6"
source = "registry+https://github.com/rust-lang/crates.io-index"


@@ 83,7 63,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
name = "blurrr"
version = "0.1.0"
dependencies = [
 "druid 0.5.0 (git+https://github.com/xi-editor/druid?rev=ace395926ec641fbc6da75a250c837f3f55f7fbd)",
 "druid 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
]

[[package]]


@@ 97,6 77,11 @@ version = "3.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"

[[package]]
name = "byteorder"
version = "1.3.4"
source = "registry+https://github.com/rust-lang/crates.io-index"

[[package]]
name = "cairo-rs"
version = "0.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"


@@ 207,25 192,25 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "druid"
version = "0.5.0"
source = "git+https://github.com/xi-editor/druid?rev=ace395926ec641fbc6da75a250c837f3f55f7fbd#ace395926ec641fbc6da75a250c837f3f55f7fbd"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
 "druid-derive 0.2.0 (git+https://github.com/xi-editor/druid?rev=ace395926ec641fbc6da75a250c837f3f55f7fbd)",
 "druid-shell 0.5.0 (git+https://github.com/xi-editor/druid?rev=ace395926ec641fbc6da75a250c837f3f55f7fbd)",
 "fluent-bundle 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)",
 "fluent-langneg 0.11.1 (registry+https://github.com/rust-lang/crates.io-index)",
 "druid-derive 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
 "druid-shell 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
 "fluent-bundle 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)",
 "fluent-langneg 0.12.1 (registry+https://github.com/rust-lang/crates.io-index)",
 "fluent-syntax 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)",
 "fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)",
 "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
 "simple_logger 1.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
 "unic-langid 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)",
 "unic-langid 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
 "unicode-segmentation 1.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
 "xi-unicode 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
]

[[package]]
name = "druid-derive"
version = "0.2.0"
source = "git+https://github.com/xi-editor/druid?rev=ace395926ec641fbc6da75a250c837f3f55f7fbd#ace395926ec641fbc6da75a250c837f3f55f7fbd"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
 "proc-macro2 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)",
 "quote 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)",


@@ 235,7 220,7 @@ dependencies = [
[[package]]
name = "druid-shell"
version = "0.5.0"
source = "git+https://github.com/xi-editor/druid?rev=ace395926ec641fbc6da75a250c837f3f55f7fbd#ace395926ec641fbc6da75a250c837f3f55f7fbd"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
 "cairo-rs 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)",
 "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)",


@@ 274,46 259,25 @@ version = "1.5.3"
source = "registry+https://github.com/rust-lang/crates.io-index"

[[package]]
name = "failure"
version = "0.1.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
 "backtrace 0.3.46 (registry+https://github.com/rust-lang/crates.io-index)",
 "failure_derive 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
]

[[package]]
name = "failure_derive"
version = "0.1.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
 "proc-macro2 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)",
 "quote 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
 "syn 1.0.17 (registry+https://github.com/rust-lang/crates.io-index)",
 "synstructure 0.12.3 (registry+https://github.com/rust-lang/crates.io-index)",
]

[[package]]
name = "fluent-bundle"
version = "0.9.1"
version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
 "failure 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
 "failure_derive 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
 "fluent-langneg 0.11.1 (registry+https://github.com/rust-lang/crates.io-index)",
 "fluent-langneg 0.12.1 (registry+https://github.com/rust-lang/crates.io-index)",
 "fluent-syntax 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)",
 "intl_pluralrules 5.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
 "intl-memoizer 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
 "intl_pluralrules 6.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
 "rental 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)",
 "smallvec 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
 "unic-langid 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)",
 "unic-langid 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
]

[[package]]
name = "fluent-langneg"
version = "0.11.1"
version = "0.12.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
 "unic-langid 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)",
 "unic-langid 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
]

[[package]]


@@ 403,6 367,14 @@ dependencies = [
]

[[package]]
name = "fxhash"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
 "byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
]

[[package]]
name = "gdk"
version = "0.12.1"
source = "registry+https://github.com/rust-lang/crates.io-index"


@@ 579,12 551,21 @@ dependencies = [
]

[[package]]
name = "intl-memoizer"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
 "type-map 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
 "unic-langid 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
]

[[package]]
name = "intl_pluralrules"
version = "5.0.2"
version = "6.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
 "tinystr 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
 "unic-langid 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)",
 "unic-langid 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
]

[[package]]


@@ 883,11 864,6 @@ dependencies = [
]

[[package]]
name = "rustc-demangle"
version = "0.1.16"
source = "registry+https://github.com/rust-lang/crates.io-index"

[[package]]
name = "rustc-serialize"
version = "0.3.24"
source = "registry+https://github.com/rust-lang/crates.io-index"


@@ 1044,17 1020,6 @@ dependencies = [
]

[[package]]
name = "synstructure"
version = "0.12.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
 "proc-macro2 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)",
 "quote 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
 "syn 1.0.17 (registry+https://github.com/rust-lang/crates.io-index)",
 "unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
]

[[package]]
name = "time"
version = "0.2.9"
source = "registry+https://github.com/rust-lang/crates.io-index"


@@ 1094,16 1059,24 @@ version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"

[[package]]
name = "type-map"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
 "fxhash 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
]

[[package]]
name = "unic-langid"
version = "0.7.1"
version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
 "unic-langid-impl 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)",
 "unic-langid-impl 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
]

[[package]]
name = "unic-langid-impl"
version = "0.7.2"
version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
 "tinystr 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",


@@ 1215,13 1188,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
"checksum atk-sys 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e552c1776737a4c80110d06b36d099f47c727335f9aaa5d942a72b6863a8ec6f"
"checksum atty 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)" = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8"
"checksum autocfg 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f8aac770f1885fd7e387acedd76065302551364496e46b3dd00860b2f8359b9d"
"checksum backtrace 0.3.46 (registry+https://github.com/rust-lang/crates.io-index)" = "b1e692897359247cc6bb902933361652380af0f1b7651ae5c5013407f30e109e"
"checksum backtrace-sys 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)" = "7de8aba10a69c8e8d7622c5710229485ec32e9d55fdad160ea559c086fdcd118"
"checksum base-x 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "1b20b618342cf9891c292c4f5ac2cde7287cc5c87e87e9c769d617793607dec1"
"checksum bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693"
"checksum block 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "0d8c1fef690941d3e7788d328517591fecc684c084084702d6ff1641e993699a"
"checksum boolinator 2.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "cfa8873f51c92e232f9bac4065cddef41b714152812bfc5f7672ba16d6ef8cd9"
"checksum bumpalo 3.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "12ae9db68ad7fac5fe51304d20f016c911539251075a214f8e663babefa35187"
"checksum byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "08c48aae112d48ed9f069b33538ea9e3e90aa263cfa3d1c24309612b1f7472de"
"checksum cairo-rs 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "157049ba9618aa3a61c39d5d785102c04d3b1f40632a706c621a9aedc21e6084"
"checksum cairo-sys-rs 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)" = "ff65ba02cac715be836f63429ab00a767d48336efc5497c5637afb53b4f14d63"
"checksum cc 1.0.50 (registry+https://github.com/rust-lang/crates.io-index)" = "95e28fa049fda1c330bcf9d723be7663a899c4679724b34c81e9f5a326aab8cd"


@@ 1234,15 1206,13 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
"checksum direct3d11 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "315aa929e68ba066cb6fb86f1b22af24f517e02fd9b5734c4d07e42cb9f4aefa"
"checksum directwrite 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "8cdcd739e9351c411b8caf5cab32a27c818cfe06260595da121382ecdd22083d"
"checksum discard 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "212d0f5754cb6769937f4501cc0e67f4f4483c8d2c3e1e922ee9edbe4ab4c7c0"
"checksum druid 0.5.0 (git+https://github.com/xi-editor/druid?rev=ace395926ec641fbc6da75a250c837f3f55f7fbd)" = "<none>"
"checksum druid-derive 0.2.0 (git+https://github.com/xi-editor/druid?rev=ace395926ec641fbc6da75a250c837f3f55f7fbd)" = "<none>"
"checksum druid-shell 0.5.0 (git+https://github.com/xi-editor/druid?rev=ace395926ec641fbc6da75a250c837f3f55f7fbd)" = "<none>"
"checksum druid 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "697e9211092dbed8aafc178550e3376dd63e1c96ec98619b59a3fd77c87a3ade"
"checksum druid-derive 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "054fdd987a62ffca856b095dd6d663aa49d055933832c360f1f80f2f46ea4d20"
"checksum druid-shell 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c4044a6dad2d5586cb75ac595d3c455d7b58c08f97ad8d69c8b06271882673f4"
"checksum dxgi 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "1639bbfd6765e92a40267d217a7acbac5b49320b68013f39a8e4376aa8c1e091"
"checksum either 1.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "bb1f6b1ce1c140482ea30ddd3335fc0024ac7ee112895426e0a629a6c20adfe3"
"checksum failure 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "b8529c2421efa3066a5cbd8063d2244603824daccb6936b079010bb2aa89464b"
"checksum failure_derive 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "030a733c8287d6213886dd487564ff5c8f6aae10278b3588ed177f9d18f8d231"
"checksum fluent-bundle 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cb733f6cedee059a77da074a14d1d855f3c7a04de18164b181ba2aa82221e281"
"checksum fluent-langneg 0.11.1 (registry+https://github.com/rust-lang/crates.io-index)" = "55e840a3a9938e6dd9a57a6a3be02bef1d51b1d75b883cdfe84810c7e7ca1293"
"checksum fluent-bundle 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "27ade33328521266c81cc0924523988f43ccd7359f64689a1b6e818afca3a646"
"checksum fluent-langneg 0.12.1 (registry+https://github.com/rust-lang/crates.io-index)" = "fe5815efd5542e40841cd34ef9003822352b04c67a70c595c6758597c72e1f56"
"checksum fluent-syntax 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ac0f7e83d14cccbf26e165d8881dcac5891af0d85a88543c09dd72ebd31d91ba"
"checksum fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "2fad85553e09a6f881f739c29f0b00b0f01357c743266d478b68951ce23285f3"
"checksum foreign-types 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1"


@@ 1255,6 1225,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
"checksum futures-macro 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "9a5081aa3de1f7542a794a397cde100ed903b0630152d0973479018fd85423a7"
"checksum futures-task 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "7b0a34e53cf6cdcd0178aa573aed466b646eb3db769570841fda0c7ede375a27"
"checksum futures-util 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "22766cf25d64306bedf0384da004d05c9974ab104fcc4528f1236181c18004c5"
"checksum fxhash 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c31b6d751ae2c7f11320402d34e41349dd1016f8d5d45e48c4312bc8625af50c"
"checksum gdk 0.12.1 (registry+https://github.com/rust-lang/crates.io-index)" = "fbe5e8772fc0865c52460cdd7a59d7d47700f44d9809d1dd00eecceb769a7589"
"checksum gdk-pixbuf 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e248220c46b329b097d4b158d2717f8c688f16dd76d0399ace82b3e98062bdd7"
"checksum gdk-pixbuf-sys 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d8991b060a9e9161bafd09bf4a202e6fd404f5b4dd1a08d53a1e84256fb34ab0"


@@ 1267,7 1238,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
"checksum gtk 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "87e1e8d70290239c668594002d1b174fcc7d7ef5d26670ee141490ede8facf8f"
"checksum gtk-sys 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)" = "53def660c7b48b00b510c81ef2d2fbd3c570f1527081d8d7947f471513e1a4c1"
"checksum hermit-abi 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "1010591b26bbfe835e9faeabeb11866061cc7dcebffd56ad7d0942d0e61aefd8"
"checksum intl_pluralrules 5.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "752ecba25a0554836d7921e383ba5c78ffea6e4825cc70dac75e2ab8e43af1be"
"checksum intl-memoizer 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9867e2d65d82936ef34217ed0f87b639a94384e93a0676158142c861c705391f"
"checksum intl_pluralrules 6.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d82c14d8eece42c03353e0ce86a4d3f97b1f1cef401e4d962dca6c6214a85002"
"checksum itoa 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)" = "b8b7a7c0c47db5545ed3fef7468ee7bb5b74691498139e4b3f6a20685dc6dd8e"
"checksum js-sys 0.3.37 (registry+https://github.com/rust-lang/crates.io-index)" = "6a27d435371a2fa5b6d2b028a74bbdb1234f308da363226a2854ca3ff8ba7055"
"checksum kurbo 0.5.11 (registry+https://github.com/rust-lang/crates.io-index)" = "bf50e17a1697110c694d47c5b1a6b64faf5eb3ffe5a286df23fb8cd516e33be6"


@@ 1302,7 1274,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
"checksum rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "678054eb77286b51581ba43620cc911abf02758c91f93f479767aed0f90458b2"
"checksum rental 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)" = "8545debe98b2b139fb04cad8618b530e9b07c152d99a5de83c860b877d67847f"
"checksum rental-impl 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)" = "475e68978dc5b743f2f40d8e0a8fdc83f1c5e78cbf4b8fa5e74e73beebc340de"
"checksum rustc-demangle 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)" = "4c691c0e608126e00913e33f0ccf3727d5fc84573623b8d65b2df340b5201783"
"checksum rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)" = "dcf128d1287d2ea9d80910b5f1120d0b8eede3fbf1abe91c40d39ea7d51e6fda"
"checksum rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a"
"checksum rustversion 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "b3bba175698996010c4f6dce5e7f173b6eb781fce25d2cfc45e27091ce0b79f6"


@@ 1323,13 1294,13 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
"checksum stdweb-internal-macros 0.2.9 (registry+https://github.com/rust-lang/crates.io-index)" = "58fa5ff6ad0d98d1ffa8cb115892b6e69d67799f6763e162a1c9db421dc22e11"
"checksum stdweb-internal-runtime 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "213701ba3370744dcd1a12960caa4843b3d68b4d1c0a5d575e0d65b2ee9d16c0"
"checksum syn 1.0.17 (registry+https://github.com/rust-lang/crates.io-index)" = "0df0eb663f387145cab623dea85b09c2c5b4b0aef44e945d928e682fce71bb03"
"checksum synstructure 0.12.3 (registry+https://github.com/rust-lang/crates.io-index)" = "67656ea1dc1b41b1451851562ea232ec2e5a80242139f7e679ceccfb5d61f545"
"checksum time 0.2.9 (registry+https://github.com/rust-lang/crates.io-index)" = "6329a7835505d46f5f3a9a2c237f8d6bf5ca6f0015decb3698ba57fcdbb609ba"
"checksum time-macros 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9ae9b6e9f095bc105e183e3cd493d72579be3181ad4004fceb01adbe9eecab2d"
"checksum time-macros-impl 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e987cfe0537f575b5fc99909de6185f6c19c3ad8889e2275e686a873d0869ba1"
"checksum tinystr 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "4bac79c4b51eda1b090b1edebfb667821bbb51f713855164dc7cec2cb8ac2ba3"
"checksum unic-langid 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7935b530ca240640bf8dd67d04301a3ed02bfc8635105fea9e9a26477143ca22"
"checksum unic-langid-impl 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)" = "86ab4a5be993d5b9d082476a7dd7149c083cf63a72469e700c09e69784511957"
"checksum type-map 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9d2741b1474c327d95c1f1e3b0a2c3977c8e128409c572a33af2914e7d636717"
"checksum unic-langid 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "24d81136159f779c35b10655f45210c71cd5ca5a45aadfe9840a61c7071735ed"
"checksum unic-langid-impl 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c43c61e94492eb67f20facc7b025778a904de83d953d8fcb60dd9adfd6e2d0ea"
"checksum unicode-segmentation 1.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e83e153d1053cbb5a118eeff7fd5be06ed99153f00dbcd8ae310c5fb2b22edc0"
"checksum unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "826e7639553986605ec5979c7dd957c7895e93eabed50ab2ffa7f6128a75097c"
"checksum wasm-bindgen 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)" = "2cc57ce05287f8376e998cbddfb4c8cb43b84a7ec55cf4551d7c00eef317a47f"

M Cargo.toml => Cargo.toml +1 -1
@@ 7,4 7,4 @@ edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
druid = { git = "https://github.com/xi-editor/druid", rev = "ace395926ec641fbc6da75a250c837f3f55f7fbd" }
druid = "0.5"

M src/distfield.rs => src/distfield.rs +10 -4
@@ 1,21 1,27 @@
//! Approximate solution based on distance fields.

use std::f64::consts::{FRAC_1_SQRT_2, LN_2};
use crate::math::compute_erf7;

/// Generate a blurred rounded rectangle using distance field approximation.
pub fn gen_distfield(width: usize, height: usize, w: f64, h: f64, r: f64, s: f64, r_mul: f64, exponent: f64) -> Vec<u8> {
    // Try to calculate parameters
    let r_orig = r;
    let r = r.hypot(s * 1.25);

    let r = r * r_mul;
    let min_edge = w.min(h);
    let rmax = 0.5 * min_edge;
    let r0 = r.hypot(s * 1.15).min(rmax);
    let r1 = r.hypot(s * 2.0).min(rmax);

    let r = r.min(0.5 * w.min(h));
    //let exponent = (-LN_2) / (1.0 - (1.0 - FRAC_1_SQRT_2) * r0 / r1).ln();
    //let exponent = 6.0 * r1 / r0 - 4.0;
    let exponent = 2.0 * r1 / r0;
    println!("r1/r {}, exponent {}", r1 / r, exponent);
    let r = r1;

    let s_inv = s.max(1e-6).recip();
    let recip_exponent = exponent.recip();
    let mut buf = vec![0u8; width * height];
    let min_edge = w.min(h);
    let scale = 0.5 * compute_erf7(s_inv * 0.5 * (w.max(h) - 0.5 * r_orig));
    for j in 0..height {
        let y = (j as f64) + 0.5 - 0.5 * (height as f64);

M src/image.rs => src/image.rs +8 -2
@@ 14,11 14,17 @@ pub fn make_image_one(ctx: &mut PaintCtx, w: usize, h: usize, data: &[u8]) -> Im
    ctx.make_image(w, h, &buf, ImageFormat::RgbaPremul).unwrap()
}

const N_STEPS: f64 = 255.0;

fn quantize(b: u8) -> u8 {
    ((b as f64 * (N_STEPS / 255.0)).round() * (255.0 / N_STEPS)).round() as u8
}

pub fn make_image_two(ctx: &mut PaintCtx, w: usize, h: usize, d0: &[u8], d1: &[u8]) -> Image {
    let mut buf = vec![255u8; w * h * 4];
    for i in 0..(w * h) {
        let r = d0[i] ^ 0;
        let g = d1[i] ^ 0;
        let r = quantize(d0[i]);
        let g = quantize(d1[i]);
        buf[i * 4] = r;
        buf[i * 4 + 1] = g;
        buf[i * 4 + 2] = g;

M src/main.rs => src/main.rs +1 -0
@@ 71,6 71,7 @@ impl Widget<AppState> for BlurWidget {
            data.std_dev,
        );
        let image = image::make_image_two(ctx, IM_WIDTH, IM_HEIGHT, &d0, &d1);
        //let image = image::make_image_one(ctx, IM_WIDTH, IM_HEIGHT, &d0);
        let scale = (ctx.size().width / IM_WIDTH as f64).min(ctx.size().height / IM_HEIGHT as f64);
        let rect = (Size::new(IM_WIDTH as f64, IM_HEIGHT as f64) * scale).to_rect();
        ctx.draw_image(&image, rect, InterpolationMode::NearestNeighbor);