diff --git a/Cargo.lock b/Cargo.lock index cdb2455..345fee6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -26,7 +26,7 @@ version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fcb51a0695d8f838b1ee009b3fbf66bda078cd64590202a864a8f3e8c4315c47" dependencies = [ - "getrandom 0.2.3", + "getrandom 0.2.7", "once_cell", "version_check", ] @@ -40,6 +40,15 @@ dependencies = [ "memchr", ] +[[package]] +name = "android_system_properties" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d7ed72e1635e121ca3e79420540282af22da58be50de153d36f81ddc6b83aa9e" +dependencies = [ + "libc", +] + [[package]] name = "approx" version = "0.5.1" @@ -68,9 +77,9 @@ dependencies = [ [[package]] name = "autocfg" -version = "1.0.1" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a" +checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" [[package]] name = "bichannel" @@ -92,15 +101,15 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bumpalo" -version = "3.9.1" +version = "3.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4a45a46ab1f2412e53d3a0ade76ffad2025804294569aae387231a0cd6e0899" +checksum = "37ccbd214614c6783386c1af30caf03192f17891059cecc394b4fb119e363de3" [[package]] name = "bytemuck" -version = "1.7.3" +version = "1.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "439989e6b8c38d1b6570a384ef1e49c8848128f5a97f3914baef02920842712f" +checksum = "2f5715e491b5a1598fc2bef5a606847b5dc1d48ea625bd3c02c00de8285591da" [[package]] name = "byteorder" @@ -110,9 +119,9 @@ checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" [[package]] name = "cc" -version = "1.0.72" +version = "1.0.73" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22a9137b95ea06864e018375b72adfb7db6e6f68cfc8df5a04d00288050485ee" +checksum = "2fff2a6927b3bb87f9595d67196a70493f627687a71d87a0d692242c33f58c11" dependencies = [ "jobserver", ] @@ -135,39 +144,41 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "chrono" -version = "0.4.19" +version = "0.4.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "670ad68c9088c2a963aaa298cb369688cf3f9465ce5e2d4ca10e6e0098a1ce73" +checksum = "bfd4d1b31faaa3a89d7934dbded3111da0d2ef28e3ebccdb4f0179f5929d1ef1" dependencies = [ - "libc", + "iana-time-zone", + "js-sys", "num-integer", "num-traits", "time", + "wasm-bindgen", "winapi", ] [[package]] name = "clap" -version = "3.0.5" +version = "3.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6f34b09b9ee8c7c7b400fe2f8df39cafc9538b03d6ba7f4ae13e4cb90bfbb7d" +checksum = "29e724a68d9319343bb3328c9cc2dfde263f4b3142ee1059a9980580171c954b" dependencies = [ "atty", "bitflags", "clap_derive", + "clap_lex", "indexmap", - "lazy_static", - "os_str_bytes", + "once_cell", "strsim", "termcolor", - "textwrap", + "textwrap 0.15.0", ] [[package]] name = "clap_derive" -version = "3.0.5" +version = "3.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41a0645a430ec9136d2d701e54a95d557de12649a9dd7109ced3187e648ac824" +checksum = "13547f7012c01ab4a0e8f8967730ada8f9fdf419e8b6c792788f39cf4e46eefa" dependencies = [ "heck", "proc-macro-error", @@ -176,6 +187,15 @@ dependencies = [ "syn", ] +[[package]] +name = "clap_lex" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2850f2f5a82cbf437dd5af4d49848fbdfc27c157c3d010345776f952765261c5" +dependencies = [ + "os_str_bytes", +] + [[package]] name = "cmake" version = "0.1.48" @@ -219,19 +239,25 @@ dependencies = [ ] [[package]] -name = "crc32fast" -version = "1.3.0" +name = "core-foundation-sys" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "738c290dfaea84fc1ca15ad9c168d083b05a714e1efddd8edaab678dc28d2836" +checksum = "5827cebf4670468b8772dd191856768aedcb1b0278a04f989f7766351917b9dc" + +[[package]] +name = "crc32fast" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b540bd8bc810d3885c6ea91e2018302f68baba2129ab3e88f32389ee9370880d" dependencies = [ "cfg-if", ] [[package]] name = "crossbeam-channel" -version = "0.5.2" +version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e54ea8bc3fb1ee042f5aace6e3c6e025d3874866da222930f70ce62aceba0bfa" +checksum = "c2dd04ddaf88237dc3b8d8f9a3c1004b506b54b3313403944054d23c0870c521" dependencies = [ "cfg-if", "crossbeam-utils", @@ -239,9 +265,9 @@ dependencies = [ [[package]] name = "crossbeam-deque" -version = "0.8.1" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6455c0ca19f0d2fbf751b908d5c55c1f5cbc65e03c4225427254b46890bdde1e" +checksum = "715e8152b692bba2d374b53d4875445368fdf21a94751410af607a5ac677d1fc" dependencies = [ "cfg-if", "crossbeam-epoch", @@ -250,25 +276,26 @@ dependencies = [ [[package]] name = "crossbeam-epoch" -version = "0.9.6" +version = "0.9.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97242a70df9b89a65d0b6df3c4bf5b9ce03c5b7309019777fbde37e7537f8762" +checksum = "045ebe27666471bb549370b4b0b3e51b07f56325befa4284db65fc89c02511b1" dependencies = [ + "autocfg", "cfg-if", "crossbeam-utils", - "lazy_static", "memoffset", + "once_cell", "scopeguard", ] [[package]] name = "crossbeam-utils" -version = "0.8.6" +version = "0.8.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cfcae03edb34f947e64acdb1c33ec169824e20657e9ecb61cef6c8c74dcb8120" +checksum = "51887d4adc7b564537b15adcfb307936f8075dfcd5f00dde9a9f1d29383682bc" dependencies = [ "cfg-if", - "lazy_static", + "once_cell", ] [[package]] @@ -297,9 +324,9 @@ dependencies = [ [[package]] name = "dirs-sys" -version = "0.3.6" +version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03d86534ed367a67548dc68113a0f5db55432fdfbb6e6f9d77704397d95d5780" +checksum = "1b1d1d91c932ef41c0f2663aa8b0ca0342d444d842c06914aa0a7e352d0bada6" dependencies = [ "libc", "redox_users", @@ -314,15 +341,15 @@ checksum = "453440c271cf5577fd2a40e4942540cb7d0d2f85e27c8d07dd0023c925a67541" [[package]] name = "either" -version = "1.6.1" +version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457" +checksum = "3f107b87b6afc2a64fd13cac55fe06d6c8859f12d4b14cbcdd2c67d0976781be" [[package]] name = "exr" -version = "1.4.1" +version = "1.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4badb9489a465cb2c555af1f00f0bfd8cecd6fc12ac11da9d5b40c5dd5f0200" +checksum = "14cc0e06fb5f67e5d6beadf3a382fec9baca1aa751c6d5368fdeee7e5932c215" dependencies = [ "bit_field", "deflate", @@ -336,42 +363,42 @@ dependencies = [ [[package]] name = "fallible_collections" -version = "0.4.4" +version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52db5973b6a19247baf19b30f41c23a1bfffc2e9ce0a5db2f60e3cd5dc8895f7" +checksum = "c195cf4b2285d3c993eb887b4dc56b0d5728bbe1d0f9a99c0ac6bec2da3e4d85" dependencies = [ "hashbrown", ] [[package]] name = "flate2" -version = "1.0.22" +version = "1.0.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e6988e897c1c9c485f43b47a529cef42fde0547f9d8d41a7062518f1d8fc53f" +checksum = "f82b0f4c27ad9f8bfd1f3208d882da2b09c301bc1c828fd3a00d0216d2fbbff6" dependencies = [ - "cfg-if", "crc32fast", - "libc", - "miniz_oxide 0.4.4", + "miniz_oxide", ] [[package]] name = "fltk" -version = "1.2.26" +version = "1.3.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2894b854989432cd0b13b48eb77178eb897f70b2aa5ef064575df226139ff668" +checksum = "0c48372ad8f5053f9c1eb50db2f25b36e524bc087388605c6e932774d5d3ee0c" dependencies = [ "bitflags", "crossbeam-channel", "fltk-sys", + "once_cell", "paste", + "ttf-parser 0.15.2", ] [[package]] name = "fltk-sys" -version = "1.2.26" +version = "1.3.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4cd352c677ae3a1cd20235368825cc6887847e502a753d01799ff2878d0950c9" +checksum = "8d3afcc83ab18abd6bed3da1dc777ccf60ef6d73e137d529b43ecc9490194c77" dependencies = [ "cmake", ] @@ -390,9 +417,9 @@ dependencies = [ [[package]] name = "flume" -version = "0.10.11" +version = "0.10.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b279436a715a9de95dcd26b151db590a71961cc06e54918b24fe0dd5b7d3fc4" +checksum = "1657b4441c3403d9f7b3409e47575237dac27b1b5726df654a6ecbf92f0f7577" dependencies = [ "futures-core", "futures-sink", @@ -403,15 +430,15 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.21" +version = "0.3.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c09fd04b7e4073ac7156a9539b57a484a8ea920f79c7c675d05d289ab6110d3" +checksum = "d2acedae88d38235936c3922476b10fced7b2b68136f5e3c03c2d5be348a1115" [[package]] name = "futures-sink" -version = "0.3.21" +version = "0.3.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21163e139fa306126e6eedaf49ecdb4588f939600f0b1e770f4205ee4b7fa868" +checksum = "ca0bae1fe9752cf7fd9b0064c674ae63f97b37bc714d745cbde0afb7ec4e6765" [[package]] name = "getrandom" @@ -426,22 +453,22 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.3" +version = "0.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fcd999463524c52659517fe2cea98493cfe485d10565e7b0fb07dbba7ad2753" +checksum = "4eb1a864a501629691edf6c15a593b7a51eebaa1e8468e9ddc623de7c9b58ec6" dependencies = [ "cfg-if", "js-sys", "libc", - "wasi 0.10.2+wasi-snapshot-preview1", + "wasi 0.11.0+wasi-snapshot-preview1", "wasm-bindgen", ] [[package]] name = "gif" -version = "0.11.3" +version = "0.11.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3a7187e78088aead22ceedeee99779455b23fc231fe13ec443f99bb71694e5b" +checksum = "3edd93c6756b4dfaf2709eafcc345ba2636565295c198a9cfbf75fa5e3e00b06" dependencies = [ "color_quant", "weezl", @@ -455,9 +482,9 @@ checksum = "eabb4a44450da02c90444cf74558da904edde8fb4e9035a9a6a4e15445af0bd7" [[package]] name = "hashbrown" -version = "0.11.2" +version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e" +checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" dependencies = [ "ahash", ] @@ -478,18 +505,30 @@ dependencies = [ ] [[package]] -name = "image" -version = "0.24.1" +name = "iana-time-zone" +version = "0.1.45" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db207d030ae38f1eb6f240d5a1c1c88ff422aa005d10f8c6c6fc5e75286ab30e" +checksum = "ef5528d9c2817db4e10cc78f8d4c8228906e5854f389ff6b076cee3572a09d35" +dependencies = [ + "android_system_properties", + "core-foundation-sys", + "js-sys", + "wasm-bindgen", + "winapi", +] + +[[package]] +name = "image" +version = "0.24.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e30ca2ecf7666107ff827a8e481de6a132a9b687ed3bb20bb1c144a36c00964" dependencies = [ "bytemuck", "byteorder", "color_quant", "exr", "gif", - "jpeg-decoder 0.2.2", - "num-iter", + "jpeg-decoder", "num-rational", "num-traits", "png", @@ -517,9 +556,9 @@ dependencies = [ [[package]] name = "indexmap" -version = "1.8.0" +version = "1.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "282a6247722caba404c065016bbfa522806e51714c34f5dfc3e4a3a46fcb4223" +checksum = "10a35a97730320ffe8e2d410b5d3b69279b98d2c14bdb8b70ea89ecf7888d41e" dependencies = [ "autocfg", "hashbrown", @@ -554,9 +593,9 @@ dependencies = [ [[package]] name = "itoa" -version = "1.0.1" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1aab8fc367588b89dcee83ab0fd66b72b50b72fa1904d7095045ace2b0c81c35" +checksum = "6c8af84674fe1f223a982c933a0ee1086ac4d4052aa0fb8060c12c6ad838e754" [[package]] name = "jobserver" @@ -569,24 +608,18 @@ dependencies = [ [[package]] name = "jpeg-decoder" -version = "0.1.22" +version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "229d53d58899083193af11e15917b5640cd40b29ff475a1fe4ef725deb02d0f2" - -[[package]] -name = "jpeg-decoder" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "105fb082d64e2100074587f59a74231f771750c664af903f1f9f76c9dedfc6f1" +checksum = "9478aa10f73e7528198d75109c8be5cd7d15fb530238040148d5f9a22d4c5b3b" dependencies = [ "rayon", ] [[package]] name = "js-sys" -version = "0.3.56" +version = "0.3.59" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a38fc24e30fd564ce974c02bf1d337caddff65be6cc4735a1f7eab22a7440f04" +checksum = "258451ab10b34f8af53416d1fdab72c22e805f0c92a1136d59470ec0b11138b2" dependencies = [ "wasm-bindgen", ] @@ -599,15 +632,15 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "lebe" -version = "0.5.1" +version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7efd1d698db0759e6ef11a7cd44407407399a910c774dd804c64c032da7826ff" +checksum = "03087c2bad5e1034e8cace5926dec053fb3790248370865f5117a7d0213354c8" [[package]] name = "libc" -version = "0.2.121" +version = "0.2.132" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "efaa7b300f3b5fe8eb6bf21ce3895e1751d9665086af2d64b42f19701015ff4f" +checksum = "8371e4e5341c3a96db127eb2465ac681ced4c433e01dd0e938adbef26ba93ba5" [[package]] name = "libwebp-sys" @@ -620,18 +653,19 @@ dependencies = [ [[package]] name = "lock_api" -version = "0.4.6" +version = "0.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "88943dd7ef4a2e5a4bfa2753aaab3013e34ce2533d1996fb18ef591e315e2b3b" +checksum = "327fa5b6a6940e4699ec49a9beae1ea4845c6bab9314e4f84ac68742139d8c53" dependencies = [ + "autocfg", "scopeguard", ] [[package]] name = "log" -version = "0.4.14" +version = "0.4.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51b9bbe6c47d51fc3e1a9b945965946b4c44142ab8792c50835a980d362c2710" +checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e" dependencies = [ "cfg-if", ] @@ -647,9 +681,9 @@ dependencies = [ [[package]] name = "memchr" -version = "2.4.1" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "308cc39be01b73d0d18f82a0e7b2a3df85245f84af96fdddc5d202d27e47b86a" +checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" [[package]] name = "memoffset" @@ -662,28 +696,18 @@ dependencies = [ [[package]] name = "miniz_oxide" -version = "0.4.4" +version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a92518e98c078586bc6c934028adcca4c92a53d6a958196de835170a01d84e4b" -dependencies = [ - "adler", - "autocfg", -] - -[[package]] -name = "miniz_oxide" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2b29bd4bc3f33391105ebee3589c19197c4271e3e5a9ec9bfe8127eeff8f082" +checksum = "6f5c75688da582b8ffc1f1799e9db273f32133c49e048f614d22ec3256773ccc" dependencies = [ "adler", ] [[package]] name = "mozjpeg" -version = "0.9.2" +version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75fce8c02d82d7dc473d6c156c52cc9f161e9eef0bca5145d87ad6c62a20ac3f" +checksum = "40ffb6ffccac322edcde024a132d6312a4c3006729e81291123ed34c316eca7e" dependencies = [ "arrayvec", "fallible_collections", @@ -694,9 +718,9 @@ dependencies = [ [[package]] name = "mozjpeg-sys" -version = "1.0.1" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "215a592d91abceb187028dfc6d9c07811bdfc5584d4ada50a4d387d82ed0aedc" +checksum = "ac69196a2b59950122d25194985c8070f9633ac01414dce0a48925346c70c3de" dependencies = [ "cc", "dunce", @@ -721,11 +745,11 @@ dependencies = [ [[package]] name = "nanorand" -version = "0.6.1" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "729eb334247daa1803e0a094d0a5c55711b85571179f5ec6e53eccfdf7008958" +checksum = "6a51313c5820b0b02bd422f4b44776fbf47961755c74ce64afc73bfad10226c3" dependencies = [ - "getrandom 0.2.3", + "getrandom 0.2.7", ] [[package]] @@ -761,18 +785,18 @@ dependencies = [ [[package]] name = "num-complex" -version = "0.4.0" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26873667bbbb7c5182d4a37c1add32cdf09f841af72da53318fdb81543c15085" +checksum = "7ae39348c8bc5fbd7f40c727a9925f03517afd2ab27d46702108b6a7e5414c19" dependencies = [ "num-traits", ] [[package]] name = "num-integer" -version = "0.1.44" +version = "0.1.45" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2cc698a63b549a70bc047073d2949cce27cd1c7b0a4a862d08a8031bc2801db" +checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9" dependencies = [ "autocfg", "num-traits", @@ -780,9 +804,9 @@ dependencies = [ [[package]] name = "num-iter" -version = "0.1.42" +version = "0.1.43" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2021c8337a54d21aca0d59a92577a029af9431cb59b909b03252b9c164fad59" +checksum = "7d03e6c028c5dc5cac6e2dec0efda81fc887605bb3d884578bb6d6bf7514e252" dependencies = [ "autocfg", "num-integer", @@ -791,9 +815,9 @@ dependencies = [ [[package]] name = "num-rational" -version = "0.4.0" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d41702bd167c2df5520b384281bc111a4b5efcf7fbc4c9c222c815b07e0a6a6a" +checksum = "0638a1c9d0a3c0914158145bc76cff373a75a627e6ecbfb71cbe6f453a5a19b0" dependencies = [ "autocfg", "num-bigint", @@ -803,9 +827,9 @@ dependencies = [ [[package]] name = "num-traits" -version = "0.2.14" +version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a64b1ec5cda2586e284722486d802acf1f7dbdc623e2bfc57e65ca1cd099290" +checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd" dependencies = [ "autocfg", ] @@ -822,18 +846,15 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.10.0" +version = "1.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87f3e037eac156d1775da914196f0f37741a274155e34a0b7e427c35d2a2ecb9" +checksum = "074864da206b4973b84eb91683020dbefd6a8c3f0f38e054d93954e891935e4e" [[package]] name = "os_str_bytes" -version = "6.0.0" +version = "6.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e22443d1643a904602595ba1cd8f7d896afe56d26712531c5ff73a15b2fbf64" -dependencies = [ - "memchr", -] +checksum = "9ff7415e9ae3fff1225851df9e0d9e4e5479f947619774677a63572e55e80eff" [[package]] name = "owned_ttf_parser" @@ -841,29 +862,29 @@ version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9f923fb806c46266c02ab4a5b239735c144bdeda724a50ed058e5226f594cde3" dependencies = [ - "ttf-parser", + "ttf-parser 0.6.2", ] [[package]] name = "paste" -version = "1.0.6" +version = "1.0.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0744126afe1a6dd7f394cb50a716dbe086cb06e255e53d8d0185d82828358fb5" +checksum = "9423e2b32f7a043629287a536f21951e8c6a82482d0acb1eeebfc90bc2225b22" [[package]] name = "pin-project" -version = "1.0.10" +version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58ad3879ad3baf4e44784bc6a718a8698867bb991f8ce24d1bcbe2cfb4c3a75e" +checksum = "ad29a609b6bcd67fee905812e544992d216af9d755757c05ed2d0e15a74c6ecc" dependencies = [ "pin-project-internal", ] [[package]] name = "pin-project-internal" -version = "1.0.10" +version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "744b6f092ba29c3650faf274db506afd39944f48420f6c86b17cfe0ee1cb36bb" +checksum = "069bdb1e05adc7a8990dce9cc75370895fbe4e3d58b9b73bf1aee56359344a55" dependencies = [ "proc-macro2", "quote", @@ -879,12 +900,12 @@ dependencies = [ "bitflags", "crc32fast", "deflate", - "miniz_oxide 0.5.1", + "miniz_oxide", ] [[package]] name = "post_maker" -version = "0.5.0-alpha.1" +version = "0.6.0-alpha.1" dependencies = [ "bichannel", "clap", @@ -901,7 +922,7 @@ dependencies = [ "serde", "serde_json", "simplelog", - "textwrap", + "textwrap 0.14.2", "webbrowser", "webp", ] @@ -938,18 +959,18 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.36" +version = "1.0.43" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7342d5883fbccae1cc37a2353b09c87c9b0f3afd73f5fb9bba687a1f733b029" +checksum = "0a2ca2c61bc9f3d74d2886294ab7b9853abd9c1ad903a3ac7815c58989bb7bab" dependencies = [ - "unicode-xid", + "unicode-ident", ] [[package]] name = "quote" -version = "1.0.14" +version = "1.0.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "47aa80447ce4daf1717500037052af176af5d38cc3e571d9ec1c7353fc10c87d" +checksum = "bbe448f377a7d6961e30f5955f9b8d106c3f5e449d493ee1b125c1d43c2b5179" dependencies = [ "proc-macro2", ] @@ -1012,9 +1033,9 @@ checksum = "60a357793950651c4ed0f3f52338f53b2f809f32d83a07f72909fa13e4c6c1e3" [[package]] name = "rayon" -version = "1.5.1" +version = "1.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c06aca804d41dbc8ba42dfd964f0d01334eceb64314b9ecf7c5fad5188a06d90" +checksum = "bd99e5772ead8baa5215278c9b15bf92087709e9c1b2d1f97cdb5a183c933a7d" dependencies = [ "autocfg", "crossbeam-deque", @@ -1024,41 +1045,41 @@ dependencies = [ [[package]] name = "rayon-core" -version = "1.9.1" +version = "1.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d78120e2c850279833f1dd3582f730c4ab53ed95aeaaaa862a2a5c71b1656d8e" +checksum = "258bcdb5ac6dad48491bb2992db6b7cf74878b0384908af124823d118c99683f" dependencies = [ "crossbeam-channel", "crossbeam-deque", "crossbeam-utils", - "lazy_static", "num_cpus", ] [[package]] name = "redox_syscall" -version = "0.2.10" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8383f39639269cde97d255a32bdb68c047337295414940c68bdd30c2e13203ff" +checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a" dependencies = [ "bitflags", ] [[package]] name = "redox_users" -version = "0.4.0" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "528532f3d801c87aec9def2add9ca802fe569e44a544afe633765267840abe64" +checksum = "b033d837a7cf162d7993aded9304e30a83213c648b6e389db233191f891e5c2b" dependencies = [ - "getrandom 0.2.3", + "getrandom 0.2.7", "redox_syscall", + "thiserror", ] [[package]] name = "regex" -version = "1.5.4" +version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d07a8629359eb56f1e2fb1652bb04212c072a87ba68546a04065d525673ac461" +checksum = "4c4eb3267174b8c6c2f654116623910a0fef09c4753f8dd83db29c48a0df988b" dependencies = [ "aho-corasick", "memchr", @@ -1067,15 +1088,15 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.6.25" +version = "0.6.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f497285884f3fcff424ffc933e56d7cbca511def0c9831a7f9b5f6153e3cc89b" +checksum = "a3f87b73ce11b1619a3c6332f45341e0047173771e8b8b73f87bfeefb7b56244" [[package]] name = "rgb" -version = "0.8.32" +version = "0.8.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e74fdc210d8f24a7dbfedc13b04ba5764f5232754ccebfdf5fff1bad791ccbc6" +checksum = "c3b221de559e4a29df3b957eec92bc0de6bc8eaf6ca9cfed43e5e1d67ff65a34" dependencies = [ "bytemuck", ] @@ -1092,9 +1113,9 @@ dependencies = [ [[package]] name = "ryu" -version = "1.0.9" +version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73b4b750c782965c211b42f022f59af1fbceabdd026623714f104152f1ec149f" +checksum = "4501abdff3ae82a1c1b477a17252eb69cee9e66eb915c1abaa4f44d873df9f09" [[package]] name = "safe_arch" @@ -1119,18 +1140,18 @@ checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" [[package]] name = "serde" -version = "1.0.133" +version = "1.0.143" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97565067517b60e2d1ea8b268e59ce036de907ac523ad83a0475da04e818989a" +checksum = "53e8e5d5b70924f74ff5c6d64d9a5acd91422117c60f48c4e07855238a254553" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.133" +version = "1.0.143" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed201699328568d8d08208fdd080e3ff594e6c422e438b6705905da01005d537" +checksum = "d3d8e8de557aee63c26b85b947f5e59b690d0454c753f3adeb5cd7835ab88391" dependencies = [ "proc-macro2", "quote", @@ -1139,9 +1160,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.74" +version = "1.0.83" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee2bb9cd061c5865d345bb02ca49fcef1391741b672b54a0bf7b679badec3142" +checksum = "38dd04e3c8279e75b31ef29dbdceebfe5ad89f4d0937213c53f7d49d01b3d5a7" dependencies = [ "itoa", "ryu", @@ -1150,9 +1171,9 @@ dependencies = [ [[package]] name = "simba" -version = "0.7.1" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13a2609e876d4f77f6ab7ff5254fc39b4f1927ba8e6db3d18be7c32534d3725e" +checksum = "c48e45e5961033db030b56ad67aef22e9c908c493a6e8348c0a0f6b93433cd77" dependencies = [ "approx", "num-complex", @@ -1174,9 +1195,9 @@ dependencies = [ [[package]] name = "smallvec" -version = "1.8.0" +version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2dd574626839106c320a323308629dcb1acfc96e32a8cba364ddc61ac23ee83" +checksum = "2fd0db749597d91ff862fd1d55ea87f7855a744a8425a64695b6fca237d1dad1" [[package]] name = "smawk" @@ -1186,9 +1207,9 @@ checksum = "f67ad224767faa3c7d8b6d91985b78e70a1324408abcb1cfcc2be4c06bc06043" [[package]] name = "spin" -version = "0.9.2" +version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "511254be0c5bcf062b019a6c89c01a664aa359ded62f78aa72c6fc137c0590e5" +checksum = "7f6002a767bff9e83f8eeecf883ecb8011875a21ae8da43bffb817a57e78cc09" dependencies = [ "lock_api", ] @@ -1201,20 +1222,20 @@ checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" [[package]] name = "syn" -version = "1.0.85" +version = "1.0.99" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a684ac3dcd8913827e18cd09a68384ee66c1de24157e3c556c9ab16d85695fb7" +checksum = "58dbef6ec655055e20b86b15a8cc6d439cca19b667537ac6a1369572d151ab13" dependencies = [ "proc-macro2", "quote", - "unicode-xid", + "unicode-ident", ] [[package]] name = "termcolor" -version = "1.1.2" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dfed899f0eb03f32ee8c6a0aabdb8a7949659e3466561fc0adf54e26d88c5f4" +checksum = "bab24d30b911b2376f3a13cc2cd443142f0c81dda04c118693e35b3835757755" dependencies = [ "winapi-util", ] @@ -1230,6 +1251,32 @@ dependencies = [ "unicode-width", ] +[[package]] +name = "textwrap" +version = "0.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1141d4d61095b28419e22cb0bbf02755f5e54e0526f97f1e3d1d160e60885fb" + +[[package]] +name = "thiserror" +version = "1.0.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f5f6586b7f764adc0231f4c79be7b920e766bb2f3e51b3661cdb263828f19994" +dependencies = [ + "thiserror-impl", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "12bafc5b54507e0149cdf1b145a5d80ab80a90bcd9275df43d4fff68460f6c21" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "threadpool" version = "1.8.1" @@ -1241,22 +1288,23 @@ dependencies = [ [[package]] name = "tiff" -version = "0.7.1" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0247608e998cb6ce39dfc8f4a16c50361ce71e5b52e6d24ea1227ea8ea8ee0b2" +checksum = "7259662e32d1e219321eb309d5f9d898b779769d81b76e762c07c8e5d38fcb65" dependencies = [ "flate2", - "jpeg-decoder 0.1.22", + "jpeg-decoder", "weezl", ] [[package]] name = "time" -version = "0.1.43" +version = "0.1.44" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca8a50ef2360fbd1eeb0ecd46795a87a19024eb4b53c5dc916ca1fd95fe62438" +checksum = "6db9e6914ab8b1ae1c260a4ae7a49b6c5611b40328a735b21862567685e73255" dependencies = [ "libc", + "wasi 0.10.0+wasi-snapshot-preview1", "winapi", ] @@ -1266,12 +1314,24 @@ version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3e5d7cd7ab3e47dda6e56542f4bbf3824c15234958c6e1bd6aaa347e93499fdc" +[[package]] +name = "ttf-parser" +version = "0.15.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b3e06c9b9d80ed6b745c7159c40b311ad2916abb34a49e9be2653b90db0d8dd" + [[package]] name = "typenum" version = "1.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dcf81ac59edc17cc8697ff311e8f5ef2d99fcbd9817b34cec66f90b6c3dfd987" +[[package]] +name = "unicode-ident" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4f5b37a154999a8f3f98cc23a628d850e154479cd94decf3414696e12e31aaf" + [[package]] name = "unicode-linebreak" version = "0.1.2" @@ -1287,12 +1347,6 @@ version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3ed742d4ea2bd1176e236172c8429aaf54486e7ac098db29ffe6529e0ce50973" -[[package]] -name = "unicode-xid" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ccb82d61f80a663efe1f787a51b16b5a51e3314d6ac365b08639f52387b33f3" - [[package]] name = "uuid" version = "0.8.2" @@ -1313,15 +1367,21 @@ checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" [[package]] name = "wasi" -version = "0.10.2+wasi-snapshot-preview1" +version = "0.10.0+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd6fbd9a79829dd1ad0cc20627bf1ed606756a7f77edff7b66b7064f9cb327c6" +checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f" + +[[package]] +name = "wasi" +version = "0.11.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.79" +version = "0.2.82" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25f1af7423d8588a3d840681122e72e6a24ddbcb3f0ec385cac0d12d24256c06" +checksum = "fc7652e3f6c4706c8d9cd54832c4a4ccb9b5336e2c3bd154d5cccfbf1c1f5f7d" dependencies = [ "cfg-if", "wasm-bindgen-macro", @@ -1329,13 +1389,13 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.79" +version = "0.2.82" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b21c0df030f5a177f3cba22e9bc4322695ec43e7257d865302900290bcdedca" +checksum = "662cd44805586bd52971b9586b1df85cdbbd9112e4ef4d8f41559c334dc6ac3f" dependencies = [ "bumpalo", - "lazy_static", "log", + "once_cell", "proc-macro2", "quote", "syn", @@ -1344,9 +1404,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.79" +version = "0.2.82" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f4203d69e40a52ee523b2529a773d5ffc1dc0071801c87b3d270b471b80ed01" +checksum = "b260f13d3012071dfb1512849c033b1925038373aea48ced3012c09df952c602" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -1354,9 +1414,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.79" +version = "0.2.82" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfa8a30d46208db204854cadbb5d4baf5fcf8071ba5bf48190c3e59937962ebc" +checksum = "5be8e654bdd9b79216c2929ab90721aa82faf65c48cdf08bdc4e7f51357b80da" dependencies = [ "proc-macro2", "quote", @@ -1367,15 +1427,15 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.79" +version = "0.2.82" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d958d035c4438e28c70e4321a2911302f10135ce78a9c7834c0cab4123d06a2" +checksum = "6598dd0bd3c7d51095ff6531a5b23e02acdc81804e30d8f07afb77b7215a140a" [[package]] name = "web-sys" -version = "0.3.56" +version = "0.3.59" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c060b319f29dd25724f09a2ba1418f142f539b2be99fbf4d2d5a8f7330afb8eb" +checksum = "ed055ab27f941423197eb86b2035720b1a3ce40504df082cac2ecc6ed73335a1" dependencies = [ "js-sys", "wasm-bindgen", @@ -1404,9 +1464,9 @@ dependencies = [ [[package]] name = "weezl" -version = "0.1.5" +version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8b77fdfd5a253be4ab714e4ffa3c49caf146b4de743e97510c0656cf90f1e8e" +checksum = "9193164d4de03a926d909d3bc7c30543cecb35400c02114792c2cae20d5e2dbb" [[package]] name = "wide" diff --git a/Cargo.toml b/Cargo.toml index 963c209..1daa1b0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "post_maker" -version = "0.5.0-alpha.1" +version = "0.6.0-alpha.1" edition = "2021" description = "Post Maker helps you to make post for Instagram and other Social Media apps easily." authors = ["PiyushXCoder "] diff --git a/assets/OpenSans-Regular.ttf b/assets/OpenSans-Regular.ttf new file mode 100644 index 0000000..db43334 Binary files /dev/null and b/assets/OpenSans-Regular.ttf differ diff --git a/assets/fonts/Kalam-Regular.ttf b/assets/fonts/Kalam-Regular.ttf deleted file mode 100644 index 16f1586..0000000 Binary files a/assets/fonts/Kalam-Regular.ttf and /dev/null differ diff --git a/assets/fonts/Rajdhani-Regular.ttf b/assets/fonts/Rajdhani-Regular.ttf deleted file mode 100644 index 37663a5..0000000 Binary files a/assets/fonts/Rajdhani-Regular.ttf and /dev/null differ diff --git a/assets/fonts/ReenieBeanie-Regular.ttf b/assets/fonts/ReenieBeanie-Regular.ttf deleted file mode 100644 index 73f5d59..0000000 Binary files a/assets/fonts/ReenieBeanie-Regular.ttf and /dev/null differ diff --git a/src/config.rs b/src/config.rs index 27a8520..ddaaa30 100644 --- a/src/config.rs +++ b/src/config.rs @@ -132,6 +132,7 @@ pub(crate) struct ConfigFile { pub(crate) color_layer: [u8; 4], pub(crate) minimum_width_limit: f64, // for export of image pub(crate) maximum_width_limit: f64, // for export of image + pub(crate) draw_box_around_quote: bool, pub(crate) image_format: ImageType, } @@ -155,10 +156,11 @@ impl Default for ConfigFile { tag_y_position_ratio: 0.5, tag2_position_ratio: 0.95, image_ratio: (4.0, 5.0), - color_layer: [20, 22, 25, 197], + color_layer: [20, 22, 25, 80], minimum_width_limit: 650.0, maximum_width_limit: 1080.0, - image_format: ImageType::Png, + draw_box_around_quote: true, + image_format: ImageType::Jpeg, } } } diff --git a/src/config_window.rs b/src/config_window.rs index db0e1e7..aec0dd6 100644 --- a/src/config_window.rs +++ b/src/config_window.rs @@ -23,7 +23,7 @@ use crate::{ use fltk::{ app, browser::{Browser, BrowserType}, - button::{Button, RadioRoundButton}, + button::{Button, CheckButton, RadioRoundButton}, dialog::{FileDialogOptions, NativeFileChooser}, enums::{self, Align, Event, Font}, frame::Frame, @@ -65,6 +65,7 @@ pub(crate) struct ConfigWindow { pub(crate) tag2_position_ratio: ValueInput, pub(crate) image_ratio_width: ValueInput, pub(crate) image_ratio_height: ValueInput, + pub(crate) draw_box_around_quote: CheckButton, pub(crate) minimum_width_limit: ValueInput, pub(crate) maximum_width_limit: ValueInput, /// RGB value of top translucent layer @@ -389,6 +390,18 @@ impl ConfigWindow { image_ratio_grp.end(); col.set_size(&image_ratio_grp, 30); + // Draw box around Quote + let mut label = Frame::default().with_label("Draw Box:"); + label.set_label_font(enums::Font::HelveticaBold); + col.set_size(&label, 15); + + let mut draw_box_around_quote_flex = Flex::default().row(); + draw_box_around_quote_flex.set_size(&Frame::default(), 20); + let mut draw_box_around_quote = CheckButton::default().with_label("Draw box around text"); + draw_box_around_quote.set_value(true); + draw_box_around_quote_flex.end(); + col.set_size(&draw_box_around_quote_flex, 30); + let mut label = Frame::default().with_label("Image with limits:"); label.set_label_font(enums::Font::HelveticaBold); col.set_size(&label, 15); @@ -505,6 +518,7 @@ impl ConfigWindow { tag2_position_ratio, image_ratio_width, image_ratio_height, + draw_box_around_quote, minimum_width_limit, maximum_width_limit, translucent_layer_rgb, @@ -561,6 +575,8 @@ impl ConfigWindow { .set_value(config.tag2_position_ratio); self.image_ratio_width.set_value(config.image_ratio.0); self.image_ratio_height.set_value(config.image_ratio.1); + self.draw_box_around_quote + .set_checked(config.draw_box_around_quote); self.minimum_width_limit .set_value(config.minimum_width_limit); self.maximum_width_limit @@ -611,6 +627,7 @@ impl ConfigWindow { let mut tag2_position_ratio = self.tag2_position_ratio.clone(); let mut image_ratio_width = self.image_ratio_width.clone(); let mut image_ratio_height = self.image_ratio_height.clone(); + let draw_box_around_quote = self.draw_box_around_quote.clone(); let mut minimum_width_limit = self.minimum_width_limit.clone(); let mut maximum_width_limit = self.maximum_width_limit.clone(); let mut layer_rgb = self.translucent_layer_rgb.clone(); @@ -657,6 +674,7 @@ impl ConfigWindow { tag2_position_ratio.set_value(conf.tag2_position_ratio); image_ratio_width.set_value(conf.image_ratio.0); image_ratio_height.set_value(conf.image_ratio.1); + draw_box_around_quote.set_checked(conf.draw_box_around_quote); minimum_width_limit.set_value(conf.minimum_width_limit); maximum_width_limit.set_value(conf.maximum_width_limit); utils::set_color_btn_rgba(conf.color_layer, &mut layer_rgb); @@ -687,6 +705,7 @@ impl ConfigWindow { let mut tag2_position_ratio = self.tag2_position_ratio.clone(); let mut image_ratio_width = self.image_ratio_width.clone(); let mut image_ratio_height = self.image_ratio_height.clone(); + let draw_box_around_quote = self.draw_box_around_quote.clone(); let mut minimum_width_limit = self.minimum_width_limit.clone(); let mut maximum_width_limit = self.maximum_width_limit.clone(); let mut layer_rgb = self.translucent_layer_rgb.clone(); @@ -732,6 +751,7 @@ impl ConfigWindow { tag2_position_ratio.set_value(conf.tag2_position_ratio); image_ratio_width.set_value(conf.image_ratio.0); image_ratio_height.set_value(conf.image_ratio.1); + draw_box_around_quote.set_checked(conf.draw_box_around_quote); minimum_width_limit.set_value(conf.minimum_width_limit); maximum_width_limit.set_value(conf.maximum_width_limit); utils::set_color_btn_rgba(conf.color_layer, &mut layer_rgb); @@ -759,6 +779,7 @@ impl ConfigWindow { let mut tag2_position_ratio = self.tag2_position_ratio.clone(); let mut image_ratio_width = self.image_ratio_width.clone(); let mut image_ratio_height = self.image_ratio_height.clone(); + let draw_box_around_quote = self.draw_box_around_quote.clone(); let mut minimum_width_limit = self.minimum_width_limit.clone(); let mut maximum_width_limit = self.maximum_width_limit.clone(); let mut layer_rgb = self.translucent_layer_rgb.clone(); @@ -794,6 +815,7 @@ impl ConfigWindow { tag2_position_ratio.set_value(conf.tag2_position_ratio); image_ratio_width.set_value(conf.image_ratio.0); image_ratio_height.set_value(conf.image_ratio.1); + draw_box_around_quote.set_checked(conf.draw_box_around_quote); minimum_width_limit.set_value(conf.minimum_width_limit); maximum_width_limit.set_value(conf.maximum_width_limit); utils::set_color_btn_rgba(conf.color_layer, &mut layer_rgb); @@ -1108,6 +1130,18 @@ impl ConfigWindow { true }); + let browse = self.browse.clone(); + let configs = Rc::clone(&self.configs); + self.draw_box_around_quote.handle(move |f, _| { + if let Some(conf) = configs + .borrow_mut() + .get_mut(&browse.selected_text().unwrap()) + { + conf.draw_box_around_quote = f.value(); + } + true + }); + // Minimum Width Limit let browse = self.browse.clone(); let configs = Rc::clone(&self.configs); @@ -1225,6 +1259,7 @@ impl ConfigWindow { let mut tag2_position_ratio = self.tag2_position_ratio.clone(); let mut image_ratio_width = self.image_ratio_width.clone(); let mut image_ratio_height = self.image_ratio_height.clone(); + let draw_box_around_quote = self.draw_box_around_quote.clone(); let mut minimum_width_limit = self.minimum_width_limit.clone(); let mut maximum_width_limit = self.maximum_width_limit.clone(); let mut layer_rgb = self.translucent_layer_rgb.clone(); @@ -1253,13 +1288,23 @@ impl ConfigWindow { tag2_position_ratio.set_value(conf.tag2_position_ratio); image_ratio_width.set_value(conf.image_ratio.0); image_ratio_height.set_value(conf.image_ratio.1); + draw_box_around_quote.set_checked(conf.draw_box_around_quote); minimum_width_limit.set_value(conf.minimum_width_limit); maximum_width_limit.set_value(conf.maximum_width_limit); utils::set_color_btn_rgba(conf.color_layer, &mut layer_rgb); layer_rgb.redraw(); layer_alpha.set_value(conf.color_layer[3] as f64); - png_format.set_value(true); - jpeg_format.set_value(false); + match conf.image_format { + ImageType::Png => { + png_format.set_value(true); + jpeg_format.set_value(false); + } + ImageType::Jpeg => { + png_format.set_value(false); + jpeg_format.set_value(true); + } + _ => {} + } configs .borrow_mut() .insert(browse.selected_text().unwrap(), conf); diff --git a/src/dialog.rs b/src/dialog.rs index 1f8f5a0..b6fbe7e 100644 --- a/src/dialog.rs +++ b/src/dialog.rs @@ -18,5 +18,5 @@ pub(crate) fn message_default(txt: &str) { pub(crate) fn choice_default(txt: &str, b0: &str, b1: &str) -> i32 { let (x, y) = get_mouse(); - dialog::choice(x, y, txt, b0, b1, "") + dialog::choice2(x, y, txt, b0, b1, "").unwrap_or(-1) } diff --git a/src/globals.rs b/src/globals.rs index 657c113..38efcc3 100644 --- a/src/globals.rs +++ b/src/globals.rs @@ -33,85 +33,19 @@ lazy_static! { pub(crate) static ref MAIN_SENDER: RwLock>> = RwLock::new(None); /// TTF Font for Quote - pub(crate) static ref FONT_QUOTE: Font<'static> = { - let mut buffer = Vec::new(); - if let Ok(mut file) = std::fs::File::open(rw_read!(CONFIG).quote_font.as_str()) { - if let Ok(_) = file.read_to_end(&mut buffer) { - if let Some(out) = rusttype::Font::try_from_vec(buffer) { - return out; - } - } - } - rusttype::Font::try_from_vec( - include_bytes!("../assets/fonts/ReenieBeanie-Regular.ttf").to_vec(), - ) - .unwrap() - }; + pub(crate) static ref FONT_QUOTE: Font<'static> = load_font(rw_read!(CONFIG).quote_font.as_str()); /// TTF Font for Subquote - pub(crate) static ref FONT_SUBQUOTE: Font<'static> = { - let mut buffer = Vec::new(); - if let Ok(mut file) = std::fs::File::open(rw_read!(CONFIG).subquote_font.as_str()) - { - if let Ok(_) = file.read_to_end(&mut buffer) { - if let Some(out) = rusttype::Font::try_from_vec(buffer) { - return out; - } - } - } - rusttype::Font::try_from_vec( - include_bytes!("../assets/fonts/ReenieBeanie-Regular.ttf").to_vec(), - ) - .unwrap() - }; + pub(crate) static ref FONT_SUBQUOTE: Font<'static> = load_font(rw_read!(CONFIG).subquote_font.as_str()); /// TTF Font for Subquote 2 - pub(crate) static ref FONT_SUBQUOTE2: Font<'static> = { - let mut buffer = Vec::new(); - if let Ok(mut file) = - std::fs::File::open(rw_read!(CONFIG).subquote2_font.as_str()) - { - if let Ok(_) = file.read_to_end(&mut buffer) { - if let Some(out) = rusttype::Font::try_from_vec(buffer) { - return out; - } - } - } - rusttype::Font::try_from_vec( - include_bytes!("../assets/fonts/Rajdhani-Regular.ttf").to_vec(), - ) - .unwrap() - }; + pub(crate) static ref FONT_SUBQUOTE2: Font<'static> = load_font(rw_read!(CONFIG).subquote2_font.as_str()); /// TTF Font for Tag - pub(crate) static ref FONT_TAG: Font<'static> = { - let mut buffer = Vec::new(); - if let Ok(mut file) = std::fs::File::open(&rw_read!(CONFIG).tag_font.as_str()) { - if let Ok(_) = file.read_to_end(&mut buffer) { - if let Some(out) = rusttype::Font::try_from_vec(buffer) { - return out; - } - } - } - rusttype::Font::try_from_vec(include_bytes!("../assets/fonts/Kalam-Regular.ttf").to_vec()) - .unwrap() - }; + pub(crate) static ref FONT_TAG: Font<'static> = load_font(rw_read!(CONFIG).tag_font.as_str()); /// TTF Font for Tag 2 - pub(crate) static ref FONT_TAG2: Font<'static> = { - let mut buffer = Vec::new(); - if let Ok(mut file) = std::fs::File::open(&rw_read!(CONFIG).tag2_font.as_str()) { - if let Ok(_) = file.read_to_end(&mut buffer) { - if let Some(out) = rusttype::Font::try_from_vec(buffer) { - return out; - } - } - } - rusttype::Font::try_from_vec( - include_bytes!("../assets/fonts/Rajdhani-Regular.ttf").to_vec(), - ) - .unwrap() - }; + pub(crate) static ref FONT_TAG2: Font<'static> = load_font(rw_read!(CONFIG).tag2_font.as_str()); /// Image to use for Window pub(crate) static ref ICON: OsString = include_str!("../assets/icon.svg").into(); @@ -128,3 +62,15 @@ lazy_static! { img.into() }; } + +fn load_font(path: &str) -> Font<'static> { + let mut buffer = Vec::new(); + if let Ok(mut file) = std::fs::File::open(path) { + if let Ok(_) = file.read_to_end(&mut buffer) { + if let Some(out) = rusttype::Font::try_from_vec(buffer) { + return out; + } + } + } + rusttype::Font::try_from_vec(include_bytes!("../assets/OpenSans-Regular.ttf").to_vec()).unwrap() +} diff --git a/src/main_window.rs b/src/main_window.rs index 5feea3a..367a715 100644 --- a/src/main_window.rs +++ b/src/main_window.rs @@ -777,8 +777,8 @@ impl MainWindow { self.next_btn.set_callback(move |_| { let prop = rw_read!(properties); if !prop.is_saved { - let save = fltk::dialog::choice_default("Save?", "yes", "no", "cancel"); - match save { + let save = fltk::dialog::choice2_default("Save?", "yes", "no", "cancel"); + match save.unwrap_or(-1) { 0 => sender.send_it(DrawMessage::Save), 1 => {} _ => return, @@ -801,8 +801,8 @@ impl MainWindow { self.back_btn.set_callback(move |_| { let prop = rw_read!(properties); if !prop.is_saved { - let save = fltk::dialog::choice_default("Save?", "yes", "no", "cancel"); - match save { + let save = fltk::dialog::choice2_default("Save?", "yes", "no", "cancel"); + match save.unwrap_or(-1) { 0 => sender.send_it(DrawMessage::Save), 1 => {} _ => return, @@ -824,8 +824,8 @@ impl MainWindow { self.file_choice.set_callback(move |_| { let prop = rw_read!(properties); if !prop.is_saved { - let save = fltk::dialog::choice_default("Save?", "yes", "no", "cancel"); - match save { + let save = fltk::dialog::choice2_default("Save?", "yes", "no", "cancel"); + match save.unwrap_or(-1) { 0 => sender.send_it(DrawMessage::Save), 1 => {} _ => return, diff --git a/src/utils.rs b/src/utils.rs index bfc1456..26ac041 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -20,7 +20,8 @@ use std::{ }; use fltk::{button::Button, enums, prelude::*}; -use image::{DynamicImage, GenericImageView, ImageBuffer, ImageEncoder}; +use image::{DynamicImage, GenericImageView, ImageBuffer, ImageEncoder, Pixel}; +use imageproc::rect::Rect; use serde::{Deserialize, Serialize}; use crate::globals; @@ -211,6 +212,7 @@ impl ImageContainer { &prop.tag2, prop.tag_position, prop.tag2_position, + prop.original_dimension.0, prop.original_dimension.1, ); @@ -275,6 +277,7 @@ impl ImageContainer { &prop.tag2, prop.tag_position, prop.tag2_position, + prop.original_dimension.0, prop.original_dimension.1, ); @@ -571,6 +574,7 @@ fn draw_layer_and_text( tag2: &str, tag_y_position: f64, tag2_position: f64, + original_width: f64, original_height: f64, ) { let (width, height): (f64, f64) = Coord::from(tmp.dimensions()).into(); @@ -586,16 +590,21 @@ fn draw_layer_and_text( &globals::FONT_QUOTE, size, quote_position, + original_width, original_height, + true, quote, ); + let size = subquote_from_height(height); draw_multiline_mid_string( tmp, &globals::FONT_SUBQUOTE, size, subquote_position, + original_width, original_height, + true, subquote, ); let size = subquote2_from_height(height); @@ -604,7 +613,9 @@ fn draw_layer_and_text( &globals::FONT_SUBQUOTE2, size, subquote2_position, + original_width, original_height, + true, subquote2, ); @@ -614,7 +625,9 @@ fn draw_layer_and_text( &globals::FONT_TAG2, size, tag2_position, + original_width, original_height, + false, tag2, ); @@ -645,26 +658,139 @@ pub(crate) fn draw_multiline_mid_string( font: &rusttype::Font, size: f64, position: f64, + original_width: f64, original_height: f64, + boxed: bool, text: &str, ) { + let (mut box_width, mut box_height) = (0.0, 0.0); + let (width, height): (f64, f64) = Coord::from(tmp.dimensions()).into(); for (index, line) in text.lines().enumerate() { let (text_width, text_height) = measure_line(font, line, rusttype::Scale::uniform(size as f32)); - imageproc::drawing::draw_text_mut( + if text_width > box_width { + box_width = text_width; + } + box_height += text_height * 1.15; + + let (x, y) = ( + (width - text_width) / 2.0, + (position * height) / original_height + index as f64 * (text_height * 1.15), + ); + + if !boxed || !rw_read!(globals::CONFIG).draw_box_around_quote { + imageproc::drawing::draw_text_mut( + tmp, + image::Rgba([255, 255, 255, 100]), + x as i32, + y as i32, + rusttype::Scale::uniform(size as f32), + font, + line, + ); + } + } + + if boxed && rw_read!(globals::CONFIG).draw_box_around_quote { + draw_box( + tmp, + box_width, + box_height, + position, + original_width, + original_height, + ); + + let size = quote_from_height(height); + draw_multiline_mid_string( tmp, - image::Rgba([255, 255, 255, 255]), - ((width - text_width) / 2.0) as i32, - ((position * height) / original_height + index as f64 * (text_height * 1.15)) as i32, - rusttype::Scale::uniform(size as f32), font, - line, + size, + position, + original_width, + original_height, + false, + text, ); } } +/// Draws box around text. +fn draw_box( + tmp: &mut DynamicImage, + box_width: f64, + box_height: f64, + position: f64, + original_width: f64, + original_height: f64, +) { + if box_width <= 0.0 { + return; + } + + let (width, height): (f64, f64) = Coord::from(tmp.dimensions()).into(); + let (delta_x, delta_y) = (width / original_width, height / original_height); + + let (x_gap, y_gap) = (8.0 * delta_x, 5.0 * delta_y); + let (x, y) = ( + ((width - box_width) / 2.0 - x_gap) as u32, + ((position * height) / original_height - y_gap) as u32, + ); + let (w, h) = ( + (box_width + x_gap * 2.0) as u32, + (box_height + y_gap * 2.0) as u32, + ); + + if x >= width as u32 || y >= height as u32 { + return; + } + + let mut buff = tmp.crop(x, y, w, h); + let layer = DynamicImage::ImageRgba8(ImageBuffer::from_fn(w, h, |_, _| { + image::Rgba([20, 22, 25, 80]) + })); + image::imageops::overlay(&mut buff, &layer, 0, 0); + buff = buff.blur(15.0); + + let (dx, dy) = (20.0 * delta_x, 20.0 * delta_y); + let mut shadow = DynamicImage::new_rgba8(w + (dx * 2.0) as u32, h + (dy * 2.0) as u32); + imageproc::drawing::draw_hollow_rect_mut( + &mut shadow, + Rect::at(dx as i32, dy as i32).of_size(w, h), + image::Rgba([30, 30, 30, 255]), + ); + shadow = shadow.blur(5.0 * delta_x as f32); + + image::imageops::overlay(tmp, &shadow, x as i64 - dx as i64, y as i64 - dy as i64); + image::imageops::overlay(tmp, &buff, x as i64, y as i64); + + let mut color = buff.get_pixel(0, 0).to_rgba(); + color.blend(&buff.get_pixel(0, buff.height() - 1).to_rgba()); + color.blend( + &buff + .get_pixel(buff.width() - 1, buff.height() - 1) + .to_rgba(), + ); + color.blend(&buff.get_pixel(buff.width() - 1, 0).to_rgba()); + imageproc::drawing::draw_hollow_rect_mut( + tmp, + Rect::at( + x as i32 - (delta_x * 1.0) as i32, + y as i32 - (delta_x * 1.0) as i32, + ) + .of_size(w + (delta_x * 2.0) as u32, h + (delta_x * 2.0) as u32), + color.clone(), + ); + color.blend(&image::Rgba([0, 0, 0, 2])); + imageproc::drawing::draw_hollow_rect_mut( + tmp, + Rect::at(x as i32, y as i32).of_size(w, h), + color.clone(), + ); +} + /// Get size of text to draw on image pub(crate) fn measure_line( font: &rusttype::Font,