diff --git a/CHANGELOG.md b/CHANGELOG.md index d53a09d..9d40fba 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,16 @@ # `rscolorq` changelog +## Version 0.2.0 - 2021-03-31 +Version bump for updating the `rand` dependency to `0.8`. No major API changes. + +Executables are now available for download based on the latest pushed release +tag. + +[#14][14] - Bump `rand` to 0.8 +[#13][13] - Executable build workflow +[#11][11] - Add chunks_exact[_mut] methods for accessing Matrix2d rows, +`no_file` flag to binary + ## Version 0.1.2 - 2021-02-20 Previous behavior relied on wrapping overflow in some places which could panic in debug mode. This behavior has been changed to use checked arithmetic @@ -16,5 +27,8 @@ the crate and install it from crates.io using `cargo`. ## Version 0.1.0 - 2020-10-20 - Initial Commit +[14]: https://github.com/okaneco/rscolorq/pull/14 +[13]: https://github.com/okaneco/rscolorq/pull/13 +[11]: https://github.com/okaneco/rscolorq/pull/11 [6]: https://github.com/okaneco/rscolorq/pull/6 [5]: https://github.com/okaneco/rscolorq/pull/5 diff --git a/Cargo.lock b/Cargo.lock index 6927e7e..b2bc1df 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -35,9 +35,9 @@ checksum = "bed57e2090563b83ba8f83366628ce535a7584c9afa4c9fc0612a03925c6df58" [[package]] name = "byteorder" -version = "1.4.2" +version = "1.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae44d1a3d5a19df61dd0c8beb138458ac2a53a7ac09eba97d55592540004306b" +checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" [[package]] name = "cfg-if" @@ -83,9 +83,9 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.1.16" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce" +checksum = "c9495705279e7140bf035dde1f6e750c162df8b625267cd52cc44e0b156732c8" dependencies = [ "cfg-if", "libc", @@ -103,9 +103,9 @@ dependencies = [ [[package]] name = "image" -version = "0.23.13" +version = "0.23.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "293f07a1875fa7e9c5897b51aa68b2d8ed8271b87e1a44cb64b9c3d98aabbc0d" +checksum = "24ffcb7e7244a9bf19d35bf2883b9c080c4ced3c07a9895572178cdb8f13f6a1" dependencies = [ "bytemuck", "byteorder", @@ -131,9 +131,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" -version = "0.2.86" +version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7282d924be3275cec7f6756ff4121987bc6481325397dde6ba3e7802b1a8b1c" +checksum = "56d855069fafbb9b344c0f962150cd2c1187975cb1c22c1522c240d8c4986714" [[package]] name = "miniz_oxide" @@ -269,22 +269,20 @@ dependencies = [ [[package]] name = "rand" -version = "0.7.3" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" +checksum = "0ef9e7e66b4468674bfcb0c81af8b7fa0bb154fa9f28eb840da5c447baeb8d7e" dependencies = [ - "getrandom", "libc", "rand_chacha", "rand_core", - "rand_hc", ] [[package]] name = "rand_chacha" -version = "0.2.2" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402" +checksum = "e12735cf05c9e10bf21534da50a147b924d555dc7a547c42e6bb2d5b6017ae0d" dependencies = [ "ppv-lite86", "rand_core", @@ -292,34 +290,25 @@ dependencies = [ [[package]] name = "rand_core" -version = "0.5.1" +version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" +checksum = "34cf66eb183df1c5876e2dcf6b13d57340741e8dc255b48e40a26de954d06ae7" dependencies = [ "getrandom", ] -[[package]] -name = "rand_hc" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" -dependencies = [ - "rand_core", -] - [[package]] name = "rand_pcg" -version = "0.2.1" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16abd0c1b639e9eb4d7c50c0b8100b0d0f849be2349829c740fe8e6eb4816429" +checksum = "7de198537002b913568a3847e53535ace266f93526caf5c360ec41d72c5787f0" dependencies = [ "rand_core", ] [[package]] name = "rscolorq" -version = "0.1.2" +version = "0.2.0" dependencies = [ "image", "palette", @@ -354,9 +343,9 @@ dependencies = [ [[package]] name = "syn" -version = "1.0.60" +version = "1.0.67" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c700597eca8a5a762beb35753ef6b94df201c81cca676604f547495a0d7f0081" +checksum = "6498a9efc342871f91cc2d0d694c674368b4ceb40f62b65a7a08c3792935e702" dependencies = [ "proc-macro2", "quote", @@ -392,12 +381,12 @@ checksum = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564" [[package]] name = "version_check" -version = "0.9.2" +version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5a972e5669d67ba988ce3dc826706fb0a8b01471c088cb0b6110b805cc36aed" +checksum = "5fecdca9a5291cc2b8dcf7dc02453fee791a280f3743cb0905f8822ae463b3fe" [[package]] name = "wasi" -version = "0.9.0+wasi-snapshot-preview1" +version = "0.10.2+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" +checksum = "fd6fbd9a79829dd1ad0cc20627bf1ed606756a7f77edff7b66b7064f9cb327c6" diff --git a/Cargo.toml b/Cargo.toml index 2326bf3..0a78a96 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rscolorq" -version = "0.1.2" +version = "0.2.0" authors = ["okaneco <47607823+okaneco@users.noreply.github.com>"] edition = "2018" exclude = ["test", "gfx", ".github"] @@ -37,12 +37,12 @@ features = ["std"] optional = true [dependencies.rand] -version = "0.7" +version = "0.8" default-features = false features = ["std"] [dependencies.rand_pcg] -version = "0.2" +version = "0.3" default-features = false [dependencies.structopt] diff --git a/README.md b/README.md index 4ac4e33..ee7e575 100644 --- a/README.md +++ b/README.md @@ -25,11 +25,13 @@ mix as an average illusory color in the human eye. [Pointillism]: https://en.wikipedia.org/wiki/Pointillism#Gallery To use as a library, add the following to your `Cargo.toml`; add the -`palette_color` feature to enable Lab color quantization. +`palette_color` feature to enable Lab color quantization. Executable builds can +be found at https://github.com/okaneco/rscolorq/releases. + ```toml [dependencies.rscolorq] -version = "0.1" +version = "0.2" default-features = false ``` diff --git a/src/bin/rscolorq/utils.rs b/src/bin/rscolorq/utils.rs index fa77a8c..bcd387f 100644 --- a/src/bin/rscolorq/utils.rs +++ b/src/bin/rscolorq/utils.rs @@ -65,7 +65,7 @@ pub fn print_colors_lab(colors: &[palette::Srgb]) -> Result<(), Box, - title: &std::path::PathBuf, + title: &std::path::Path, ) -> Result<(), Box> { let len = res.len() as u32; let w = match width { @@ -123,7 +123,7 @@ pub fn save_palette( *pixel = image::Rgb(color); } - Ok(save_image(title, &imgbuf.to_vec(), w, height)?) + save_image(title, &imgbuf.to_vec(), w, height) } /// Save palette image file. @@ -131,7 +131,7 @@ pub fn save_palette_lab( res: &[palette::Srgb], height: u32, width: Option, - title: &std::path::PathBuf, + title: &std::path::Path, ) -> Result<(), Box> { let len = res.len() as u32; let w = match width { @@ -160,5 +160,5 @@ pub fn save_palette_lab( *pixel = image::Rgb([color.red, color.green, color.blue]); } - Ok(save_image(title, &imgbuf.to_vec(), w, height)?) + save_image(title, &imgbuf.to_vec(), w, height) } diff --git a/src/color/lab.rs b/src/color/lab.rs index e70b79c..7ce8446 100644 --- a/src/color/lab.rs +++ b/src/color/lab.rs @@ -72,9 +72,9 @@ impl SpatialQuant for Lab { fn random(rng: &mut impl rand::Rng) -> Self { Self { - l: rng.gen_range(0.0, 100.0), - a: rng.gen_range(-128.0, 127.0), - b: rng.gen_range(-128.0, 127.0), + l: rng.gen_range(0.0..=100.0), + a: rng.gen_range(-128.0..=127.0), + b: rng.gen_range(-128.0..=127.0), white_point: PhantomData, } } diff --git a/src/color/rgb.rs b/src/color/rgb.rs index 807a47a..bd47cfb 100644 --- a/src/color/rgb.rs +++ b/src/color/rgb.rs @@ -207,9 +207,9 @@ impl SpatialQuant for Rgb { fn random(rng: &mut impl rand::Rng) -> Self { Self { - red: rng.gen_range(0.0, 1.0), - green: rng.gen_range(0.0, 1.0), - blue: rng.gen_range(0.0, 1.0), + red: rng.gen_range(0.0..=1.0), + green: rng.gen_range(0.0..=1.0), + blue: rng.gen_range(0.0..=1.0), } } diff --git a/src/quant/utility.rs b/src/quant/utility.rs index ddb29ad..14ed641 100644 --- a/src/quant/utility.rs +++ b/src/quant/utility.rs @@ -19,7 +19,7 @@ pub fn compute_max_coarse_level(mut width: usize, mut height: usize) -> usize { /// Fill a matrix with random f64 from 0 to 1. pub fn fill_random(arr: &mut Matrix3d, rng: &mut impl rand::Rng) { arr.iter_mut().for_each(|a| { - *a = rng.gen_range(0.0, 1.0); + *a = rng.gen_range(0.0..=1.0); }); }