Compare commits
No commits in common. "87c04e961ac2c007ba43b47d1f7b023c4730dd35" and "a362a9a13dab073ad0af16a33e4a76a55bf24e55" have entirely different histories.
87c04e961a
...
a362a9a13d
|
@ -2,172 +2,6 @@
|
|||
# It is not intended for manual editing.
|
||||
version = 3
|
||||
|
||||
[[package]]
|
||||
name = "addr2line"
|
||||
version = "0.21.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8a30b2e23b9e17a9f90641c7ab1549cd9b44f296d3ccbf309d2863cfe398a0cb"
|
||||
dependencies = [
|
||||
"gimli",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "adler"
|
||||
version = "1.0.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe"
|
||||
|
||||
[[package]]
|
||||
name = "anstream"
|
||||
version = "0.6.11"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6e2e1ebcb11de5c03c67de28a7df593d32191b44939c482e97702baaaa6ab6a5"
|
||||
dependencies = [
|
||||
"anstyle",
|
||||
"anstyle-parse",
|
||||
"anstyle-query",
|
||||
"anstyle-wincon",
|
||||
"colorchoice",
|
||||
"utf8parse",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "anstyle"
|
||||
version = "1.0.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7079075b41f533b8c61d2a4d073c4676e1f8b249ff94a393b0595db304e0dd87"
|
||||
|
||||
[[package]]
|
||||
name = "anstyle-parse"
|
||||
version = "0.2.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c75ac65da39e5fe5ab759307499ddad880d724eed2f6ce5b5e8a26f4f387928c"
|
||||
dependencies = [
|
||||
"utf8parse",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "anstyle-query"
|
||||
version = "1.0.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e28923312444cdd728e4738b3f9c9cac739500909bb3d3c94b43551b16517648"
|
||||
dependencies = [
|
||||
"windows-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "anstyle-wincon"
|
||||
version = "3.0.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1cd54b81ec8d6180e24654d0b371ad22fc3dd083b6ff8ba325b72e00c87660a7"
|
||||
dependencies = [
|
||||
"anstyle",
|
||||
"windows-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "backtrace"
|
||||
version = "0.3.69"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2089b7e3f35b9dd2d0ed921ead4f6d318c27680d4a5bd167b3ee120edb105837"
|
||||
dependencies = [
|
||||
"addr2line",
|
||||
"cc",
|
||||
"cfg-if",
|
||||
"libc",
|
||||
"miniz_oxide",
|
||||
"object",
|
||||
"rustc-demangle",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cc"
|
||||
version = "1.0.83"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0"
|
||||
dependencies = [
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cfg-if"
|
||||
version = "1.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
|
||||
|
||||
[[package]]
|
||||
name = "clap"
|
||||
version = "4.4.18"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1e578d6ec4194633722ccf9544794b71b1385c3c027efe0c55db226fc880865c"
|
||||
dependencies = [
|
||||
"clap_builder",
|
||||
"clap_derive",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "clap_builder"
|
||||
version = "4.4.18"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4df4df40ec50c46000231c914968278b1eb05098cf8f1b3a518a95030e71d1c7"
|
||||
dependencies = [
|
||||
"anstream",
|
||||
"anstyle",
|
||||
"clap_lex",
|
||||
"strsim",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "clap_derive"
|
||||
version = "4.4.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cf9804afaaf59a91e75b022a30fb7229a7901f60c755489cc61c9b423b836442"
|
||||
dependencies = [
|
||||
"heck",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "clap_lex"
|
||||
version = "0.6.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "702fc72eb24e5a1e48ce58027a675bc24edd52096d5397d4aea7c6dd9eca0bd1"
|
||||
|
||||
[[package]]
|
||||
name = "color-eyre"
|
||||
version = "0.6.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5a667583cca8c4f8436db8de46ea8233c42a7d9ae424a82d338f2e4675229204"
|
||||
dependencies = [
|
||||
"backtrace",
|
||||
"color-spantrace",
|
||||
"eyre",
|
||||
"indenter",
|
||||
"once_cell",
|
||||
"owo-colors",
|
||||
"tracing-error",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "color-spantrace"
|
||||
version = "0.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cd6be1b2a7e382e2b98b43b2adcca6bb0e465af0bdd38123873ae61eb17a72c2"
|
||||
dependencies = [
|
||||
"once_cell",
|
||||
"owo-colors",
|
||||
"tracing-core",
|
||||
"tracing-error",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "colorchoice"
|
||||
version = "1.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7"
|
||||
|
||||
[[package]]
|
||||
name = "console"
|
||||
version = "0.15.8"
|
||||
|
@ -192,49 +26,20 @@ version = "1.0.1"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5"
|
||||
|
||||
[[package]]
|
||||
name = "eyre"
|
||||
version = "0.6.11"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b6267a1fa6f59179ea4afc8e50fd8612a3cc60bc858f786ff877a4a8cb042799"
|
||||
dependencies = [
|
||||
"indenter",
|
||||
"once_cell",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "gegl"
|
||||
version = "0.0.0"
|
||||
dependencies = [
|
||||
"indexmap",
|
||||
"insta",
|
||||
"paste",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "gimli"
|
||||
version = "0.28.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253"
|
||||
|
||||
[[package]]
|
||||
name = "hashbrown"
|
||||
version = "0.14.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604"
|
||||
|
||||
[[package]]
|
||||
name = "heck"
|
||||
version = "0.4.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8"
|
||||
|
||||
[[package]]
|
||||
name = "indenter"
|
||||
version = "0.3.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ce23b50ad8242c51a442f3ff322d56b02f08852c77e4c0b4d3fd684abc89c683"
|
||||
|
||||
[[package]]
|
||||
name = "indexmap"
|
||||
version = "2.1.0"
|
||||
|
@ -258,17 +63,6 @@ dependencies = [
|
|||
"yaml-rust",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "interlinked"
|
||||
version = "0.0.0"
|
||||
dependencies = [
|
||||
"clap",
|
||||
"color-eyre",
|
||||
"gegl",
|
||||
"insta",
|
||||
"subprocess",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "lazy_static"
|
||||
version = "1.4.0"
|
||||
|
@ -287,211 +81,12 @@ version = "0.5.6"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f"
|
||||
|
||||
[[package]]
|
||||
name = "memchr"
|
||||
version = "2.7.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "523dc4f511e55ab87b694dc30d0f820d60906ef06413f93d4d7a1385599cc149"
|
||||
|
||||
[[package]]
|
||||
name = "miniz_oxide"
|
||||
version = "0.7.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e7810e0be55b428ada41041c41f32c9f1a42817901b4ccf45fa3d4b6561e74c7"
|
||||
dependencies = [
|
||||
"adler",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "object"
|
||||
version = "0.32.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a6a622008b6e321afc04970976f62ee297fdbaa6f95318ca343e3eebb9648441"
|
||||
dependencies = [
|
||||
"memchr",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "once_cell"
|
||||
version = "1.19.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92"
|
||||
|
||||
[[package]]
|
||||
name = "owo-colors"
|
||||
version = "3.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c1b04fb49957986fdce4d6ee7a65027d55d4b6d2265e5848bbb507b58ccfdb6f"
|
||||
|
||||
[[package]]
|
||||
name = "paste"
|
||||
version = "1.0.14"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "de3145af08024dea9fa9914f381a17b8fc6034dfb00f3a84013f7ff43f29ed4c"
|
||||
|
||||
[[package]]
|
||||
name = "pin-project-lite"
|
||||
version = "0.2.13"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8afb450f006bf6385ca15ef45d71d2288452bc3683ce2e2cacc0d18e4be60b58"
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro2"
|
||||
version = "1.0.78"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e2422ad645d89c99f8f3e6b88a9fdeca7fabeac836b1002371c4367c8f984aae"
|
||||
dependencies = [
|
||||
"unicode-ident",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "quote"
|
||||
version = "1.0.35"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rustc-demangle"
|
||||
version = "0.1.23"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76"
|
||||
|
||||
[[package]]
|
||||
name = "sharded-slab"
|
||||
version = "0.1.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f40ca3c46823713e0d4209592e8d6e826aa57e928f09752619fc696c499637f6"
|
||||
dependencies = [
|
||||
"lazy_static",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "similar"
|
||||
version = "2.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "32fea41aca09ee824cc9724996433064c89f7777e60762749a4170a14abbfa21"
|
||||
|
||||
[[package]]
|
||||
name = "strsim"
|
||||
version = "0.10.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623"
|
||||
|
||||
[[package]]
|
||||
name = "subprocess"
|
||||
version = "0.2.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0c2e86926081dda636c546d8c5e641661049d7562a68f5488be4a1f7f66f6086"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "2.0.48"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0f3531638e407dfc0814761abb7c00a5b54992b849452a0646b7f65c9f770f3f"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"unicode-ident",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "thread_local"
|
||||
version = "1.1.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3fdd6f064ccff2d6567adcb3873ca630700f00b5ad3f060c25b5dcfd9a4ce152"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"once_cell",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tracing"
|
||||
version = "0.1.40"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef"
|
||||
dependencies = [
|
||||
"pin-project-lite",
|
||||
"tracing-core",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tracing-core"
|
||||
version = "0.1.32"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54"
|
||||
dependencies = [
|
||||
"once_cell",
|
||||
"valuable",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tracing-error"
|
||||
version = "0.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d686ec1c0f384b1277f097b2f279a2ecc11afe8c133c1aabf036a27cb4cd206e"
|
||||
dependencies = [
|
||||
"tracing",
|
||||
"tracing-subscriber",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tracing-subscriber"
|
||||
version = "0.3.18"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ad0f048c97dbd9faa9b7df56362b8ebcaa52adb06b498c050d2f4e32f90a7a8b"
|
||||
dependencies = [
|
||||
"sharded-slab",
|
||||
"thread_local",
|
||||
"tracing-core",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "unicode-ident"
|
||||
version = "1.0.12"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b"
|
||||
|
||||
[[package]]
|
||||
name = "utf8parse"
|
||||
version = "0.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a"
|
||||
|
||||
[[package]]
|
||||
name = "valuable"
|
||||
version = "0.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d"
|
||||
|
||||
[[package]]
|
||||
name = "winapi"
|
||||
version = "0.3.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419"
|
||||
dependencies = [
|
||||
"winapi-i686-pc-windows-gnu",
|
||||
"winapi-x86_64-pc-windows-gnu",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "winapi-i686-pc-windows-gnu"
|
||||
version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
|
||||
|
||||
[[package]]
|
||||
name = "winapi-x86_64-pc-windows-gnu"
|
||||
version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
|
||||
|
||||
[[package]]
|
||||
name = "windows-sys"
|
||||
version = "0.52.0"
|
||||
|
|
|
@ -2,8 +2,7 @@
|
|||
|
||||
[workspace]
|
||||
members = [
|
||||
"gegl",
|
||||
"interlinked",
|
||||
"gegl"
|
||||
]
|
||||
resolver = "2"
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
[package]
|
||||
name = "gegl"
|
||||
description = "GEGL data structure library for Rust."
|
||||
repository = "https://git.bauke.xyz/driftingnebula/interlinked"
|
||||
repository = "https://git.bauke.xyz/driftingnebula/gegl"
|
||||
license = "AGPL-3.0-or-later"
|
||||
version = "0.0.0"
|
||||
authors = ["Bauke <me@bauke.xyz>"]
|
||||
|
@ -18,7 +18,6 @@ workspace = true
|
|||
|
||||
[dependencies]
|
||||
indexmap = "2.1.0"
|
||||
paste = "1.0.14"
|
||||
|
||||
[dev-dependencies]
|
||||
insta = "1.34.0"
|
||||
|
|
|
@ -15,27 +15,16 @@ pub type GeglData = indexmap::IndexMap<&'static str, String>;
|
|||
|
||||
/// The [`GeglOperation`] trait defines a set of common functions for the
|
||||
/// individual operations to implement so they can be used with the GEGL CLI.
|
||||
pub trait GeglOperation: std::fmt::Debug + Send + Sync {
|
||||
pub trait GeglOperation: Default + std::fmt::Debug {
|
||||
/// Some GEGL operations will run infinitely unless you limit the buffer in
|
||||
/// some way, so all operations must indicate whether or not they should be
|
||||
/// followed by a crop operation.
|
||||
fn append_crop_operation(&self) -> bool;
|
||||
|
||||
/// Return the default values for the operation as a [`GeglData`].
|
||||
///
|
||||
/// The reason this can't use [`Default`] is because we want the trait to be
|
||||
/// object-safe so we can use [`Box<dyn GeglOperation>`]. Implementing
|
||||
/// [`Default`] makes the trait [`Sized`] and no longer object-safe.
|
||||
///
|
||||
/// The [`gegl_operation`] macro still implements and calls [`Default`] anyway
|
||||
/// so it's easy to instantiate operations but we have to go in a roundabout
|
||||
/// way to actually get the values from it for this function.
|
||||
fn default_values(&self) -> GeglData;
|
||||
|
||||
/// Creates the parameters for the graph to be used with the GEGL CLI.
|
||||
fn graph(&self, include_default_values: bool) -> Vec<String> {
|
||||
let mut graph = vec![self.name().to_string()];
|
||||
let defaults = self.default_values();
|
||||
let defaults = Self::default().values();
|
||||
|
||||
for (key, value) in self.values() {
|
||||
if !include_default_values && defaults.get(key) == Some(&value) {
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
use crate::gegl_enum;
|
||||
|
||||
gegl_enum!(
|
||||
/// The shape for [`FocusBlur`][super::FocusBlur].
|
||||
FocusBlurShape,
|
||||
Circle => "circle",
|
||||
Square => "square",
|
||||
|
@ -13,28 +12,24 @@ gegl_enum!(
|
|||
);
|
||||
|
||||
gegl_enum!(
|
||||
/// The type for [`FocusBlur`][super::FocusBlur].
|
||||
FocusBlurType,
|
||||
Gaussian => "gaussian",
|
||||
Lens => "lens",
|
||||
);
|
||||
|
||||
gegl_enum!(
|
||||
/// The algorithm type for [`Maze`][super::Maze].
|
||||
MazeAlgorithmType,
|
||||
DepthFirst => "depth-first",
|
||||
Prim => "prim",
|
||||
);
|
||||
|
||||
gegl_enum!(
|
||||
/// The abyss policy for [`MedianBlur`][super::MedianBlur].
|
||||
MedianBlurAbyssPolicy,
|
||||
None => "none",
|
||||
Clamp => "clamp",
|
||||
);
|
||||
|
||||
gegl_enum!(
|
||||
/// The neighborhood for [`MedianBlur`][super::MedianBlur].
|
||||
MedianBlurNeighborhood,
|
||||
Square => "square",
|
||||
Circle => "circle",
|
||||
|
@ -42,7 +37,6 @@ gegl_enum!(
|
|||
);
|
||||
|
||||
gegl_enum!(
|
||||
/// The tile type for [`Mosaic`][super::Mosaic].
|
||||
MosaicTileType,
|
||||
Squares => "squares",
|
||||
Hexagons => "hexagons",
|
||||
|
@ -51,7 +45,6 @@ gegl_enum!(
|
|||
);
|
||||
|
||||
gegl_enum!(
|
||||
/// The pattern for [`Newsprint`][super::Newsprint].
|
||||
NewsprintPattern,
|
||||
Line => "line",
|
||||
Circle => "circle",
|
||||
|
@ -61,37 +54,9 @@ gegl_enum!(
|
|||
);
|
||||
|
||||
gegl_enum!(
|
||||
/// The color model for [`Newsprint`][super::Newsprint].
|
||||
NewsprintColorModel,
|
||||
BlackOnWhite => "black-on-white",
|
||||
Cmyk => "cmyk",
|
||||
Rgb => "rgb",
|
||||
WhiteOnBlack => "white-on-black",
|
||||
);
|
||||
|
||||
gegl_enum!(
|
||||
/// The sampler type for [`StereographicProjection`][super::StereographicProjection].
|
||||
StereographicProjectionSamplerType,
|
||||
Nearest => "nearest",
|
||||
Linear => "linear",
|
||||
Cubic => "cubic",
|
||||
Nohalo => "nohalo",
|
||||
Lohalo => "lohalo",
|
||||
);
|
||||
|
||||
gegl_enum!(
|
||||
/// The fill for [`Waterpixels`][super::Waterpixels].
|
||||
WaterpixelsFill,
|
||||
Average => "average",
|
||||
Random => "random",
|
||||
);
|
||||
|
||||
gegl_enum!(
|
||||
/// The sampler type for [`Waves`][super::Waves].
|
||||
WavesSamplerType,
|
||||
Nearest => "nearest",
|
||||
Linear => "linear",
|
||||
Cubic => "cubic",
|
||||
Nohalo => "nohalo",
|
||||
Lohalo => "lohalo",
|
||||
);
|
||||
|
|
|
@ -7,39 +7,17 @@ macro_rules! gegl_operation {
|
|||
struct_name: $struct_name:ident,
|
||||
gegl_name: $gegl_name:expr,
|
||||
append_crop: $append_crop:expr,
|
||||
values: (
|
||||
$(
|
||||
$(#[$key_meta:meta])*
|
||||
$key:ident: $key_type:ty, $key_default:expr
|
||||
),*,
|
||||
),
|
||||
values: ($($key:ident: $key_type:ty, $key_default:expr, $key_doc:expr),*,),
|
||||
) => {
|
||||
#[doc = concat!(" The `gegl:", $gegl_name, "` operation.")]
|
||||
#[derive(Debug)]
|
||||
pub struct $struct_name {
|
||||
$(
|
||||
$(#[$key_meta])*
|
||||
#[doc = concat!(" ", $key_doc)]
|
||||
pub $key: $key_type,
|
||||
)*
|
||||
}
|
||||
|
||||
paste::paste! {
|
||||
impl $struct_name {
|
||||
$(
|
||||
#[doc = concat!(" Builder function to assign `", stringify!($key), "`.")]
|
||||
pub fn [<with_ $key>](mut self, value: $key_type) -> $struct_name {
|
||||
self.$key = value;
|
||||
self
|
||||
}
|
||||
)*
|
||||
|
||||
/// Get this operation inside a [`Box`].
|
||||
pub fn boxed(self) -> Box<$struct_name> {
|
||||
Box::new(self)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for $struct_name {
|
||||
fn default() -> $struct_name {
|
||||
$struct_name {
|
||||
|
@ -53,10 +31,6 @@ macro_rules! gegl_operation {
|
|||
$append_crop
|
||||
}
|
||||
|
||||
fn default_values(&self) -> $crate::GeglData {
|
||||
Self::default().values()
|
||||
}
|
||||
|
||||
fn name(&self) -> &'static str {
|
||||
concat!("gegl:", $gegl_name)
|
||||
}
|
||||
|
@ -74,15 +48,14 @@ macro_rules! gegl_operation {
|
|||
#[macro_export]
|
||||
macro_rules! gegl_enum {
|
||||
(
|
||||
$(#[$enum_meta:meta])*
|
||||
$enum_name:ident,
|
||||
$($key:ident => $value:expr),*,
|
||||
) => {
|
||||
$(#[$enum_meta])*
|
||||
#[doc = "TODO: Generate documentation for [`gegl_enum!`]."]
|
||||
#[derive(Debug)]
|
||||
pub enum $enum_name {
|
||||
$(
|
||||
#[doc = concat!("The [`", stringify!($enum_name), "`] `", $value, "`." )]
|
||||
#[doc = "TODO: Generate documentation for [`gegl_enum!`]."]
|
||||
$key,
|
||||
)*
|
||||
}
|
||||
|
|
|
@ -12,16 +12,11 @@ gegl_operation!(
|
|||
gegl_name: "bloom",
|
||||
append_crop: false,
|
||||
values: (
|
||||
/// Don't over-expose highlights.
|
||||
limit_exposure: bool, false,
|
||||
/// Glow radius.
|
||||
radius: f64, 10.0,
|
||||
/// Glow-area edge softness.
|
||||
softness: f64, 25.0,
|
||||
/// Glow strength.
|
||||
strength: f64, 50.0,
|
||||
/// Glow-area brightness threshold.
|
||||
threshold: f64, 50.0,
|
||||
limit_exposure: bool, false, "Don't over-expose highlights.",
|
||||
radius: f64, 10.0, "Glow radius.",
|
||||
softness: f64, 25.0, "Glow-area edge softness.",
|
||||
strength: f64, 50.0, "Glow strength.",
|
||||
threshold: f64, 50.0, "Glow-area brightness threshold.",
|
||||
),
|
||||
);
|
||||
|
||||
|
@ -30,10 +25,8 @@ gegl_operation!(
|
|||
gegl_name: "cartoon",
|
||||
append_crop: true,
|
||||
values: (
|
||||
/// The mask radius.
|
||||
mask_radius: f64, 7.0,
|
||||
/// The percentage of black.
|
||||
pct_black: f64, 0.2,
|
||||
mask_radius: f64, 7.0, "The mask radius.",
|
||||
pct_black: f64, 0.2, "The percentage of black.",
|
||||
),
|
||||
);
|
||||
|
||||
|
@ -42,18 +35,12 @@ gegl_operation!(
|
|||
gegl_name: "cell-noise",
|
||||
append_crop: true,
|
||||
values: (
|
||||
/// The number of noise octaves.
|
||||
iterations: i64, 1,
|
||||
/// Fill each cell with a random color.
|
||||
palettize: bool, false,
|
||||
/// Select the n-th closest point
|
||||
rank: i64, 1,
|
||||
/// The scale of the noise function.
|
||||
scale: f64, 1.0,
|
||||
/// The random seed for the noise function.
|
||||
seed: f64, 0.0,
|
||||
/// Interpolate between Manhattan and Euclidean distance.
|
||||
shape: f64, 2.0,
|
||||
iterations: i64, 1, "The number of noise octaves.",
|
||||
palettize: bool, false, "Fill each cell with a random color.",
|
||||
rank: i64, 1, "Select the n-th closest point",
|
||||
scale: f64, 1.0, "The scale of the noise function.",
|
||||
seed: f64, 0.0, "The random seed for the noise function.",
|
||||
shape: f64, 2.0, "Interpolate between Manhattan and Euclidean distance.",
|
||||
),
|
||||
);
|
||||
|
||||
|
@ -62,16 +49,11 @@ gegl_operation!(
|
|||
gegl_name: "crop",
|
||||
append_crop: false,
|
||||
values: (
|
||||
/// The wanted height of the buffer.
|
||||
height: f64, 0.0,
|
||||
/// Reset the origin for the coordinates.
|
||||
reset_origin: bool, false,
|
||||
/// The wanted width of the buffer.
|
||||
width: f64, 0.0,
|
||||
/// The X coordinate to start from.
|
||||
x: f64, 0.0,
|
||||
/// The Y coordinate to start from.
|
||||
y: f64, 0.0,
|
||||
height: f64, 0.0, "The wanted height of the buffer.",
|
||||
reset_origin: bool, false, "Reset the origin for the coordinates.",
|
||||
width: f64, 0.0, "The wanted width of the buffer.",
|
||||
x: f64, 0.0, "The X coordinate to start from.",
|
||||
y: f64, 0.0, "The Y coordinate to start from.",
|
||||
),
|
||||
);
|
||||
|
||||
|
@ -80,34 +62,20 @@ gegl_operation!(
|
|||
gegl_name: "diffraction-patterns",
|
||||
append_crop: true,
|
||||
values: (
|
||||
/// Number of contours (blue);
|
||||
blue_contours: f64, 0.97,
|
||||
/// Light frequency (blue).
|
||||
blue_frequency: f64, 1.12,
|
||||
/// Number of sharp edges (blue).
|
||||
blue_sedges: f64, 0.64,
|
||||
/// Brightness and shifting/fattening of contours.
|
||||
brightness: f64, 0.07,
|
||||
/// Number of contours (green);
|
||||
green_contours: f64, 0.82,
|
||||
/// Light frequency (green).
|
||||
green_frequency: f64, 1.22,
|
||||
/// Number of sharp edges (green).
|
||||
green_sedges: f64, 0.68,
|
||||
/// Height of the generated buffer.
|
||||
height: i64, 200,
|
||||
/// Polarization.
|
||||
polarization: f64, -0.47,
|
||||
/// Number of contours (red);
|
||||
red_contours: f64, 0.82,
|
||||
/// Light frequency (red).
|
||||
red_frequency: f64, 0.81,
|
||||
/// Number of sharp edges (red).
|
||||
red_sedges: f64, 0.61,
|
||||
/// Scattering (speed vs. quality).
|
||||
scattering: f64, 37.13,
|
||||
/// Width of the generated buffer.
|
||||
width: i64, 200,
|
||||
blue_contours: f64, 0.97, "Number of contours (blue);",
|
||||
blue_frequency: f64, 1.12, "Light frequency (blue).",
|
||||
blue_sedges: f64, 0.64, "Number of sharp edges (blue).",
|
||||
brightness: f64, 0.07, "Brightness and shifting/fattening of contours.",
|
||||
green_contours: f64, 0.82, "Number of contours (green);",
|
||||
green_frequency: f64, 1.22, "Light frequency (green).",
|
||||
green_sedges: f64, 0.68, "Number of sharp edges (green).",
|
||||
height: i64, 200, "Height of the generated buffer.",
|
||||
polarization: f64, -0.47, "Polarization.",
|
||||
red_contours: f64, 0.82, "Number of contours (red);",
|
||||
red_frequency: f64, 0.81, "Light frequency (red).",
|
||||
red_sedges: f64, 0.61, "Number of sharp edges (red).",
|
||||
scattering: f64, 37.13, "Scattering (speed vs. quality).",
|
||||
width: i64, 200, "Width of the generated buffer.",
|
||||
),
|
||||
);
|
||||
|
||||
|
@ -116,34 +84,20 @@ gegl_operation!(
|
|||
gegl_name: "focus-blur",
|
||||
append_crop: false,
|
||||
values: (
|
||||
/// The aspect ratio of the focus region.
|
||||
aspect_ratio: f64, 0.0,
|
||||
/// Out-of-focus blur radius.
|
||||
blur_radius: f64, 25.0,
|
||||
/// The blur type.
|
||||
blur_type: FocusBlurType, FocusBlurType::Gaussian,
|
||||
/// The focus region's inner limit.
|
||||
focus: f64, 0.25,
|
||||
/// Relative highlight strength.
|
||||
highlight_factor: f64, 0.0,
|
||||
/// Highlight threshold (high).
|
||||
highlight_threshold_high: f64, 1.0,
|
||||
/// Highlight threshold (low).
|
||||
highlight_threshold_low: f64, 0.0,
|
||||
/// Generate more accurate and consistent output.
|
||||
high_quality: bool, false,
|
||||
/// The focus region's transition midpoint.
|
||||
midpoint: f64, 0.5,
|
||||
/// The focus region's outer radius.
|
||||
radius: f64, 0.75,
|
||||
/// The rotation of the focus region.
|
||||
rotation: f64, 0.0,
|
||||
/// The blur shape.
|
||||
shape: FocusBlurShape, FocusBlurShape::Circle,
|
||||
/// The X coordinate for the center of the blur.
|
||||
x: f64, 0.5,
|
||||
/// The Y coordinate for the center of the blur.
|
||||
y: f64, 0.5,
|
||||
aspect_ratio: f64, 0.0, "The aspect ratio of the focus region.",
|
||||
blur_radius: f64, 25.0, "Out-of-focus blur radius.",
|
||||
blur_type: FocusBlurType, FocusBlurType::Gaussian, "The blur type.",
|
||||
focus: f64, 0.25, "The focus region's inner limit.",
|
||||
highlight_factor: f64, 0.0, "Relative highlight strength.",
|
||||
highlight_threshold_high: f64, 1.0, "Highlight threshold (high).",
|
||||
highlight_threshold_low: f64, 0.0, "Highlight threshold (low).",
|
||||
high_quality: bool, false, "Generate more accurate and consistent output.",
|
||||
midpoint: f64, 0.5, "The focus region's transition midpoint.",
|
||||
radius: f64, 0.75, "The focus region's outer radius.",
|
||||
rotation: f64, 0.0, "The rotation of the focus region.",
|
||||
shape: FocusBlurShape, FocusBlurShape::Circle, "The blur shape.",
|
||||
x: f64, 0.5, "The X coordinate for the center of the blur.",
|
||||
y: f64, 0.5, "The Y coordinate for the center of the blur.",
|
||||
),
|
||||
);
|
||||
|
||||
|
@ -152,20 +106,13 @@ gegl_operation!(
|
|||
gegl_name: "maze",
|
||||
append_crop: false,
|
||||
values: (
|
||||
/// Maze algorithm type
|
||||
algorithm_type: MazeAlgorithmType, MazeAlgorithmType::DepthFirst,
|
||||
/// The background color.
|
||||
bg_color: String, "#fff".to_string(),
|
||||
/// The foreground color.
|
||||
fg_color: String, "#000".to_string(),
|
||||
/// The random seed.
|
||||
seed: f64, 0.0,
|
||||
/// Whether the maze should be tileable.
|
||||
tileable: bool, false,
|
||||
/// Horizontal width of cells pixels.
|
||||
x: i64, 16,
|
||||
/// Vertical width of cells pixels.
|
||||
y: i64, 16,
|
||||
algorithm_type: MazeAlgorithmType, MazeAlgorithmType::DepthFirst, "Maze algorithm type",
|
||||
bg_color: String, "#fff".to_string(), "The background color.",
|
||||
fg_color: String, "#000".to_string(), "The foreground color.",
|
||||
seed: f64, 0.0, "The random seed.",
|
||||
tileable: bool, false, "Whether the maze should be tileable.",
|
||||
x: i64, 16, "Horizontal width of cells pixels.",
|
||||
y: i64, 16, "Vertical width of cells pixels.",
|
||||
),
|
||||
);
|
||||
|
||||
|
@ -174,19 +121,12 @@ gegl_operation!(
|
|||
gegl_name: "median-blur",
|
||||
append_crop: false,
|
||||
values: (
|
||||
/// How image edges are handled.
|
||||
abyss_policy: MedianBlurAbyssPolicy, MedianBlurAbyssPolicy::Clamp,
|
||||
/// Neighborhood alpha percentile.
|
||||
alpha_percentile: f64, 50.0,
|
||||
/// Avoid clipping and quantization
|
||||
high_precision: bool, false,
|
||||
/// Neighborhood type.
|
||||
neighborhood: MedianBlurNeighborhood, MedianBlurNeighborhood::Circle,
|
||||
/// Neighborhood color percentile.
|
||||
percentile: f64, 50.0,
|
||||
/// Neighborhood radius, a negative value will calculate with inverted
|
||||
/// percentiles.
|
||||
radius: f64, 3.0,
|
||||
abyss_policy: MedianBlurAbyssPolicy, MedianBlurAbyssPolicy::Clamp, "How image edges are handled.",
|
||||
alpha_percentile: f64, 50.0, "Neighborhood alpha percentile.",
|
||||
high_precision: bool, false, "Avoid clipping and quantization",
|
||||
neighborhood: MedianBlurNeighborhood, MedianBlurNeighborhood::Circle, "Neighborhood type.",
|
||||
percentile: f64, 50.0, "Neighborhood color percentile.",
|
||||
radius: f64, 3.0, "Neighborhood radius, a negative value will calculate with inverted percentiles.",
|
||||
),
|
||||
);
|
||||
|
||||
|
@ -195,32 +135,19 @@ gegl_operation!(
|
|||
gegl_name: "mirrors",
|
||||
append_crop: false,
|
||||
values: (
|
||||
/// Clip result to input size.
|
||||
clip: bool, true,
|
||||
/// X coordinate of symmetry center in output.
|
||||
c_x: f64, 0.5,
|
||||
/// Y coordinate of symmetry center in output.
|
||||
c_y: f64, 0.5,
|
||||
/// Scale factor to make rendering size bigger.
|
||||
input_scale: f64, 100.0,
|
||||
/// Rotation applied to the mirrors.
|
||||
m_angle: f64, 0.0,
|
||||
/// Number of mirrors to use.
|
||||
n_segs: i64, 6,
|
||||
/// Scale factor to make rendering size bigger.
|
||||
output_scale: f64, 1.0,
|
||||
/// X axis ratio for the center of mirroring
|
||||
o_x: f64, 0.0,
|
||||
/// Y axis ratio for the center of mirroring
|
||||
o_y: f64, 0.0,
|
||||
/// Rotation applied to the result.
|
||||
r_angle: f64, 0.0,
|
||||
/// X axis ratio for trimming mirror expanse
|
||||
trim_x: f64, 0.0,
|
||||
/// Y axis ratio for trimming mirror expanse
|
||||
trim_y: f64, 0.0,
|
||||
/// Fill full output area.
|
||||
warp: bool, true,
|
||||
clip: bool, true, "Clip result to input size.",
|
||||
c_x: f64, 0.5, "X coordinate of symmetry center in output.",
|
||||
c_y: f64, 0.5, "Y coordinate of symmetry center in output.",
|
||||
input_scale: f64, 100.0, "Scale factor to make rendering size bigger.",
|
||||
m_angle: f64, 0.0, "Rotation applied to the mirrors.",
|
||||
n_segs: i64, 6, "Number of mirrors to use.",
|
||||
output_scale: f64, 1.0, "Scale factor to make rendering size bigger.",
|
||||
o_x: f64, 0.0, "X axis ratio for the center of mirroring",
|
||||
o_y: f64, 0.0, "Y axis ratio for the center of mirroring",
|
||||
r_angle: f64, 0.0, "Rotation applied to the result.",
|
||||
trim_x: f64, 0.0, "X axis ratio for trimming mirror expanse",
|
||||
trim_y: f64, 0.0, "Y axis ratio for trimming mirror expanse",
|
||||
warp: bool, true, "Fill full output area.",
|
||||
),
|
||||
);
|
||||
|
||||
|
@ -229,34 +156,20 @@ gegl_operation!(
|
|||
gegl_name: "mosaic",
|
||||
append_crop: false,
|
||||
values: (
|
||||
/// Enables smoother tile output.
|
||||
antialiasing: bool, true,
|
||||
/// Tile color based on average of subsumed pixels.
|
||||
color_averaging: bool, true,
|
||||
/// Magnitude of random color variations.
|
||||
color_variation: f64, 0.2,
|
||||
/// Joints color.
|
||||
joints_color: String, "#000".to_string(),
|
||||
/// Light color.
|
||||
light_color: String, "#fff".to_string(),
|
||||
/// Direction of light-source (in degrees).
|
||||
light_dir: f64, 135.0,
|
||||
/// Random seed.
|
||||
seed: f64, 0.0,
|
||||
/// Allows splitting tiles at hard edges.
|
||||
tile_allow_split: bool, true,
|
||||
/// Apparent height of each tile (in pixels).
|
||||
tile_height: f64, 4.0,
|
||||
/// Deviation from perfectly formed tiles.
|
||||
tile_neatness: f64, 0.65,
|
||||
/// Average diameter of each tile (in pixels).
|
||||
tile_size: f64, 15.0,
|
||||
/// Inter-tile spacing (in pixels).
|
||||
tile_spacing: f64, 1.0,
|
||||
/// Surface characteristics.
|
||||
tile_surface: bool, false,
|
||||
/// What shape to use for tiles.
|
||||
tile_type: MosaicTileType, MosaicTileType::Hexagons,
|
||||
antialiasing: bool, true, "Enables smoother tile output.",
|
||||
color_averaging: bool, true, "Tile color based on average of subsumed pixels.",
|
||||
color_variation: f64, 0.2, "Magnitude of random color variations.",
|
||||
joints_color: String, "#000".to_string(), "Joints color.",
|
||||
light_color: String, "#fff".to_string(), "Light color.",
|
||||
light_dir: f64, 135.0, "Direction of light-source (in degrees).",
|
||||
seed: f64, 0.0, "Random seed.",
|
||||
tile_allow_split: bool, true, "Allows splitting tiles at hard edges.",
|
||||
tile_height: f64, 4.0, "Apparent height of each tile (in pixels).",
|
||||
tile_neatness: f64, 0.65, "Deviation from perfectly formed tiles.",
|
||||
tile_size: f64, 15.0, "Average diameter of each tile (in pixels).",
|
||||
tile_spacing: f64, 1.0, "Inter-tile spacing (in pixels).",
|
||||
tile_surface: bool, false, "Surface characteristics.",
|
||||
tile_type: MosaicTileType, MosaicTileType::Hexagons, "What shape to use for tiles.",
|
||||
),
|
||||
);
|
||||
|
||||
|
@ -265,49 +178,24 @@ gegl_operation!(
|
|||
gegl_name: "newsprint",
|
||||
append_crop: false,
|
||||
values: (
|
||||
/// Number of samples that are averaged for antialiasing the result.
|
||||
aa_samples: i64, 16,
|
||||
/// Black angle.
|
||||
angle: f64, 75.0,
|
||||
/// Red and cyan angle.
|
||||
angle2: f64, 15.0,
|
||||
/// Green and magenta angle.
|
||||
angle3: f64, 45.0,
|
||||
/// Blue and yellow angle.
|
||||
angle4: f64, 0.0,
|
||||
/// Multiplication factor for desired rotation of the local space for
|
||||
/// texture, the way this is computed makes it weak for desaturated colors
|
||||
/// and possibly stronger where there is color.
|
||||
angleboost: f64, 0.0,
|
||||
/// How much of common gray to pull out of CMY.
|
||||
black_pullout: f64, 1.0,
|
||||
/// Number of periods per tile, this tiling avoids high frequency anomaly
|
||||
/// that angle boost causes.
|
||||
blocksize: f64, -1.0,
|
||||
/// How many inks to use.
|
||||
color_model: NewsprintColorModel, NewsprintColorModel::BlackOnWhite,
|
||||
/// Black halftoning/dot pattern to use.
|
||||
pattern: NewsprintPattern, NewsprintPattern::Line,
|
||||
/// Red and cyan halftoning/dot pattern to use.
|
||||
pattern2: NewsprintPattern, NewsprintPattern::Line,
|
||||
/// Green and magenta halftoning/dot pattern to use.
|
||||
pattern3: NewsprintPattern, NewsprintPattern::Line,
|
||||
/// Blue and yellow halftoning/dot pattern to use.
|
||||
pattern4: NewsprintPattern, NewsprintPattern::Line,
|
||||
/// Black number of pixels across one repetition of a base pattern at base
|
||||
/// resolution.
|
||||
period: f64, 12.0,
|
||||
/// Red and cyan number of pixels across one repetition of a base pattern at
|
||||
/// base resolution.
|
||||
period2: f64, 12.0,
|
||||
/// Green and magenta number of pixels across one repetition of a base pattern
|
||||
/// at base resolution.
|
||||
period3: f64, 12.0,
|
||||
/// Blue and yellow number of pixels across one repetition of a base pattern
|
||||
/// at base resolution.
|
||||
period4: f64, 12.0,
|
||||
/// Color saturation dependent compression of period.
|
||||
turbulence: f64, 0.0,
|
||||
aa_samples: i64, 16, "Number of samples that are averaged for antialiasing the result.",
|
||||
angle: f64, 75.0, "Black angle.",
|
||||
angle2: f64, 15.0, "Red and cyan angle.",
|
||||
angle3: f64, 45.0, "Green and magenta angle.",
|
||||
angle4: f64, 0.0, "Blue and yellow angle.",
|
||||
angleboost: f64, 0.0, "Multiplication factor for desired rotation of the local space for texture, the way this is computed makes it weak for desaturated colors and possibly stronger where there is color.",
|
||||
black_pullout: f64, 1.0, "How much of common gray to pull out of CMY.",
|
||||
blocksize: f64, -1.0, "Number of periods per tile, this tiling avoids high frequency anomaly that angle boost causes.",
|
||||
color_model: NewsprintColorModel, NewsprintColorModel::BlackOnWhite, "How many inks to use.",
|
||||
pattern: NewsprintPattern, NewsprintPattern::Line, "Black halftoning/dot pattern to use.",
|
||||
pattern2: NewsprintPattern, NewsprintPattern::Line, "Red and cyan halftoning/dot pattern to use.",
|
||||
pattern3: NewsprintPattern, NewsprintPattern::Line, "Green and magenta halftoning/dot pattern to use.",
|
||||
pattern4: NewsprintPattern, NewsprintPattern::Line, "Blue and yellow halftoning/dot pattern to use.",
|
||||
period: f64, 12.0, "Black number of pixels across one repetition of a base pattern at base resolution.",
|
||||
period2: f64, 12.0, "Red and cyan number of pixels across one repetition of a base pattern at base resolution.",
|
||||
period3: f64, 12.0, "Green and magenta number of pixels across one repetition of a base pattern at base resolution.",
|
||||
period4: f64, 12.0, "Blue and yellow number of pixels across one repetition of a base pattern at base resolution.",
|
||||
turbulence: f64, 0.0, "Color saturation dependent compression of period.",
|
||||
),
|
||||
);
|
||||
|
||||
|
@ -316,12 +204,9 @@ gegl_operation!(
|
|||
gegl_name: "noise-pick",
|
||||
append_crop: true,
|
||||
values: (
|
||||
/// Randomization percentage.
|
||||
pct_random: f64, 50.0,
|
||||
/// Amount of repetitions to make.
|
||||
repeat: i64, 1,
|
||||
/// Random seed.
|
||||
seed: f64, 0.0,
|
||||
pct_random: f64, 50.0, "Randomization percentage.",
|
||||
repeat: i64, 1, "Amount of repetitions to make.",
|
||||
seed: f64, 0.0, "Random seed.",
|
||||
),
|
||||
);
|
||||
|
||||
|
@ -330,14 +215,10 @@ gegl_operation!(
|
|||
gegl_name: "oilify",
|
||||
append_crop: false,
|
||||
values: (
|
||||
/// Exponent for processing, controls smoothness.
|
||||
exponent: i64, 8,
|
||||
/// Histogram size.
|
||||
intensities: i64, 128,
|
||||
/// Radius of circle around pixel.
|
||||
mask_radius: i64, 4,
|
||||
/// Use pixel luminance values.
|
||||
use_inten: bool, true,
|
||||
exponent: i64, 8, "Exponent for processing, controls smoothness.",
|
||||
intensities: i64, 128, "Histogram size.",
|
||||
mask_radius: i64, 4, "Radius of circle around pixel.",
|
||||
use_inten: bool, true, "Use pixel luminance values.",
|
||||
),
|
||||
);
|
||||
|
||||
|
@ -346,18 +227,12 @@ gegl_operation!(
|
|||
gegl_name: "plasma",
|
||||
append_crop: false,
|
||||
values: (
|
||||
/// Height of the generated buffer.
|
||||
height: i64, 768,
|
||||
/// Random seed.
|
||||
seed: f64, 0.0,
|
||||
/// High values give more variation in details.
|
||||
turbulence: f64, 1.0,
|
||||
/// Width of the generated buffer.
|
||||
width: i64, 1024,
|
||||
/// X coordinate start of the generated buffer.
|
||||
x: i64, 0,
|
||||
/// Y coordinate start of the generated buffer.
|
||||
y: i64, 0,
|
||||
height: i64, 768, "Height of the generated buffer",
|
||||
seed: f64, 0.0, "Random seed.",
|
||||
turbulence: f64, 1.0, "High values give more variation in details.",
|
||||
width: i64, 1024, "Width of the generated buffer.",
|
||||
x: i64, 0, "X coordinate start of the generated buffer.",
|
||||
y: i64, 0, "Y coordinate start of the generated buffer.",
|
||||
),
|
||||
);
|
||||
|
||||
|
@ -366,109 +241,8 @@ gegl_operation!(
|
|||
gegl_name: "simplex-noise",
|
||||
append_crop: true,
|
||||
values: (
|
||||
/// The number of noise octaves.
|
||||
iterations: i64, 1,
|
||||
/// The scale of the noise function.
|
||||
scale: f64, 1.0,
|
||||
/// The random seed for the noise function.
|
||||
seed: f64, 1.0,
|
||||
),
|
||||
);
|
||||
|
||||
gegl_operation!(
|
||||
struct_name: Softglow,
|
||||
gegl_name: "softglow",
|
||||
append_crop: false,
|
||||
values: (
|
||||
/// Brightness intensity.
|
||||
brightness: f64, 0.3,
|
||||
/// Glow radius.
|
||||
glow_radius: f64, 10.0,
|
||||
/// Sharpness of the highlights.
|
||||
sharpness: f64, 0.85,
|
||||
),
|
||||
);
|
||||
|
||||
gegl_operation!(
|
||||
struct_name: StereographicProjection,
|
||||
gegl_name: "stereographic-projection",
|
||||
append_crop: false,
|
||||
values: (
|
||||
/// Output/rendering height in pixels, -1 for input height.
|
||||
height: i64, -1,
|
||||
/// Do the inverse mapping.
|
||||
inverse: bool, false,
|
||||
/// Horizontal camera panning.
|
||||
pan: f64, 0.0,
|
||||
/// Image resampling method to use.
|
||||
sampler_type: StereographicProjectionSamplerType, StereographicProjectionSamplerType::Nearest,
|
||||
/// Spin angle around camera axis.
|
||||
spin: f64, 0.,
|
||||
/// Vertical camera panning.
|
||||
tilt: f64, 90.,
|
||||
/// Output/rendering width in pixels, -1 for input width.
|
||||
width: i64, -1,
|
||||
/// Zoom level.
|
||||
zoom: f64, 100.0,
|
||||
),
|
||||
);
|
||||
|
||||
gegl_operation!(
|
||||
struct_name: TileGlass,
|
||||
gegl_name: "tile-glass",
|
||||
append_crop: false,
|
||||
values: (
|
||||
/// Tile height.
|
||||
tile_height: i64, 25,
|
||||
/// Tile width.
|
||||
tile_width: i64, 25,
|
||||
),
|
||||
);
|
||||
|
||||
gegl_operation!(
|
||||
struct_name: TileSeamless,
|
||||
gegl_name: "tile-seamless",
|
||||
append_crop: false,
|
||||
values: (,),
|
||||
);
|
||||
|
||||
gegl_operation!(
|
||||
struct_name: Waterpixels,
|
||||
gegl_name: "waterpixels",
|
||||
append_crop: false,
|
||||
values: (
|
||||
/// How to fill superpixels.
|
||||
fill: WaterpixelsFill, WaterpixelsFill::Average,
|
||||
/// Spatial regularization, trade-off between superpixel regularity and
|
||||
/// adherence to object boundaries.
|
||||
regularization: i64, 0,
|
||||
/// Superpixels size.
|
||||
size: i64, 32,
|
||||
/// Gradient smoothness.
|
||||
smoothness: f64, 1.0,
|
||||
),
|
||||
);
|
||||
|
||||
gegl_operation!(
|
||||
struct_name: Waves,
|
||||
gegl_name: "waves",
|
||||
append_crop: true,
|
||||
values: (
|
||||
/// Amplitude of the wave ripples.
|
||||
amplitude: f64, 25.0,
|
||||
/// Aspect ratio.
|
||||
aspect: f64, 1.0,
|
||||
/// Limit deformation in the image area.
|
||||
clamp: bool, false,
|
||||
/// Period/wavelength of the ripples.
|
||||
period: f64, 100.0,
|
||||
/// Phase shift of the waves.
|
||||
phi: f64, 0.0,
|
||||
/// Mathematical method for reconstructing pixel values.
|
||||
sampler_type: WavesSamplerType, WavesSamplerType::Cubic,
|
||||
/// Center X coordinate to start the waves from.
|
||||
x: f64, 0.5,
|
||||
/// Center Y coordinate to start the waves from.
|
||||
y: f64, 0.5,
|
||||
iterations: i64, 1, "The number of noise octaves.",
|
||||
scale: f64, 1.0, "The scale of the noise function.",
|
||||
seed: f64, 1.0, "The random seed for the noise function.",
|
||||
),
|
||||
);
|
||||
|
|
|
@ -1,33 +0,0 @@
|
|||
# https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[package]
|
||||
name = "interlinked"
|
||||
description = "Generative art with GIMP, GEGL and ImageMagick."
|
||||
repository = "https://git.bauke.xyz/driftingnebula/interlinked"
|
||||
license = "AGPL-3.0-or-later"
|
||||
version = "0.0.0"
|
||||
authors = ["Bauke <me@bauke.xyz>"]
|
||||
edition = "2021"
|
||||
readme = "../README.md"
|
||||
|
||||
[lib]
|
||||
path = "source/lib.rs"
|
||||
|
||||
[[bin]]
|
||||
name = "interlinked"
|
||||
path = "source/main.rs"
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
|
||||
[dependencies]
|
||||
color-eyre = "0.6.2"
|
||||
gegl = { path = "../gegl" }
|
||||
subprocess = "0.2.9"
|
||||
|
||||
[dependencies.clap]
|
||||
features = ["derive"]
|
||||
version = "4.4.18"
|
||||
|
||||
[dev-dependencies]
|
||||
insta = "1.34.0"
|
|
@ -1,21 +0,0 @@
|
|||
//! The [`clap`] command-line definitions.
|
||||
|
||||
mod run;
|
||||
|
||||
pub use {clap::Parser, run::*};
|
||||
|
||||
/// The Interlinked CLI.
|
||||
#[derive(Debug, Parser)]
|
||||
pub struct CliArgs {
|
||||
/// Only render projects starting with the filter.
|
||||
#[clap(short, long)]
|
||||
pub filter: Option<String>,
|
||||
|
||||
/// Include default values in the GEGL graphs.
|
||||
#[clap(long, default_value = "false")]
|
||||
pub include_defaults: bool,
|
||||
|
||||
/// Don't render any images.
|
||||
#[clap(long, default_value = "false")]
|
||||
pub no_render: bool,
|
||||
}
|
|
@ -1,123 +0,0 @@
|
|||
//! The CLI logic.
|
||||
|
||||
use {
|
||||
crate::{all_projects, utilities::shell_command, CliArgs, Parser},
|
||||
color_eyre::{eyre::OptionExt, Result},
|
||||
gegl::GeglOperation,
|
||||
std::{
|
||||
fs::{create_dir_all, write},
|
||||
path::Path,
|
||||
time::Instant,
|
||||
},
|
||||
};
|
||||
|
||||
/// Run the CLI.
|
||||
pub fn run() -> Result<()> {
|
||||
let args = CliArgs::parse();
|
||||
|
||||
let projects = if let Some(filter) = args.filter {
|
||||
all_projects()
|
||||
.into_iter()
|
||||
.filter(|project| project.name.starts_with(&filter))
|
||||
.collect::<Vec<_>>()
|
||||
} else {
|
||||
all_projects().into_iter().collect()
|
||||
};
|
||||
|
||||
let base_out_dir = Path::new("output/rust/");
|
||||
for project in projects {
|
||||
let start = Instant::now();
|
||||
let (width, height) = project.resolution;
|
||||
let out_dir = base_out_dir.join(&project.name);
|
||||
create_dir_all(&out_dir)?;
|
||||
|
||||
println!(
|
||||
"→ {} ({}x{}, {} base operations ({} including crops))",
|
||||
project.name,
|
||||
width,
|
||||
height,
|
||||
project.operations.len(),
|
||||
project
|
||||
.operations
|
||||
.iter()
|
||||
.map(|op| if op.append_crop_operation() { 2 } else { 1 })
|
||||
.sum::<i32>(),
|
||||
);
|
||||
|
||||
let graph = project
|
||||
.operations
|
||||
.into_iter()
|
||||
.flat_map(|op| {
|
||||
let mut graph = vec![op.graph(args.include_defaults)];
|
||||
if op.append_crop_operation() {
|
||||
graph.push(
|
||||
gegl::Crop::default()
|
||||
.with_height(height as f64)
|
||||
.with_width(width as f64)
|
||||
.graph(args.include_defaults),
|
||||
)
|
||||
}
|
||||
|
||||
graph
|
||||
})
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
let pretty_graph = graph
|
||||
.iter()
|
||||
.map(|params| {
|
||||
params
|
||||
.iter()
|
||||
.map(|param| {
|
||||
if param.starts_with("gegl:") {
|
||||
param.to_string()
|
||||
} else {
|
||||
format!(" {}", param)
|
||||
}
|
||||
})
|
||||
.collect::<Vec<_>>()
|
||||
.join("\n")
|
||||
})
|
||||
.collect::<Vec<_>>()
|
||||
.join("\n\n");
|
||||
|
||||
let graph_file = out_dir.join(format!("{}.txt", project.name));
|
||||
write(graph_file, pretty_graph)?;
|
||||
|
||||
if args.no_render {
|
||||
let end = Instant::now();
|
||||
println!("← {:?} (not rendered)", end - start);
|
||||
continue;
|
||||
}
|
||||
|
||||
let out_file = out_dir.join(format!("{}.png", project.name));
|
||||
let out_file = out_file
|
||||
.to_str()
|
||||
.ok_or_eyre("Failed to convert out_file to str")?;
|
||||
|
||||
let input = if project.create_input_image {
|
||||
shell_command(format!(
|
||||
"convert -size {}x{} xc:white {}",
|
||||
width, height, out_file
|
||||
))?;
|
||||
format!("-i {}", out_file)
|
||||
} else {
|
||||
String::new()
|
||||
};
|
||||
|
||||
let graph = graph
|
||||
.into_iter()
|
||||
.map(|op| op.join(" "))
|
||||
.collect::<Vec<_>>()
|
||||
.join(" ");
|
||||
shell_command(format!("gegl {} -o {} -- {}", input, out_file, graph))?;
|
||||
|
||||
if project.turn_off_alpha {
|
||||
shell_command(format!("convert {0} -alpha Off {0}", out_file))?;
|
||||
}
|
||||
|
||||
let end = Instant::now();
|
||||
println!("← {:?}", end - start);
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
|
@ -1,36 +0,0 @@
|
|||
//! # Interlinked.
|
||||
//!
|
||||
//! > **Generative art with GIMP, GEGL and ImageMagick.**
|
||||
|
||||
mod cli;
|
||||
pub mod projects;
|
||||
pub mod utilities;
|
||||
|
||||
use gegl::GeglOperation;
|
||||
|
||||
pub use {cli::*, projects::all_projects};
|
||||
|
||||
/// An individual project with all the operations to generate it.
|
||||
#[derive(Debug)]
|
||||
pub struct Project {
|
||||
/// Whether to start from an empty input image.
|
||||
///
|
||||
/// Some operations require an input buffer to start from so this will create
|
||||
/// an empty image with `imagemagick` and then use that as the input.
|
||||
pub create_input_image: bool,
|
||||
|
||||
/// The name of this project.
|
||||
pub name: String,
|
||||
|
||||
/// The list of operations.
|
||||
pub operations: Vec<Box<dyn GeglOperation>>,
|
||||
|
||||
/// The resolution of the image as a tuple of width and height.
|
||||
pub resolution: (i64, i64),
|
||||
|
||||
/// Whether to explicitly turn off the image's alpha channel after finishing
|
||||
/// rendering the operations.
|
||||
///
|
||||
/// TODO: Explain why this exists after I've figured it out myself again. x)
|
||||
pub turn_off_alpha: bool,
|
||||
}
|
|
@ -1,7 +0,0 @@
|
|||
//! # Interlinked.
|
||||
//!
|
||||
//! > **Generative art with GIMP, GEGL and ImageMagick.**
|
||||
|
||||
fn main() -> color_eyre::Result<()> {
|
||||
interlinked::run()
|
||||
}
|
|
@ -1,10 +0,0 @@
|
|||
//! All [`Project`]s created with Interlinked.
|
||||
|
||||
use crate::Project;
|
||||
|
||||
pub mod year_2022;
|
||||
|
||||
/// Get all [`Project`]s in a single [`Vec`].
|
||||
pub fn all_projects() -> Vec<Project> {
|
||||
vec![year_2022::day_2022_03_06()]
|
||||
}
|
|
@ -1,59 +0,0 @@
|
|||
//! The project made on 2022-03-06.
|
||||
|
||||
use {crate::Project, gegl::*};
|
||||
|
||||
/// The project made on 2022-03-06.
|
||||
pub fn day_2022_03_06() -> Project {
|
||||
Project {
|
||||
create_input_image: false,
|
||||
name: "2022-03-06".to_string(),
|
||||
operations: vec![
|
||||
SimplexNoise::default()
|
||||
.with_scale(4.0)
|
||||
.with_seed(2_071_140_406.0)
|
||||
.boxed(),
|
||||
Newsprint::default()
|
||||
.with_color_model(NewsprintColorModel::Rgb)
|
||||
.with_pattern2(NewsprintPattern::Line)
|
||||
.with_period2(200.0)
|
||||
.with_angle2(15.0)
|
||||
.with_pattern3(NewsprintPattern::Line)
|
||||
.with_period3(200.0)
|
||||
.with_angle3(45.0)
|
||||
.with_pattern4(NewsprintPattern::Line)
|
||||
.with_period4(200.0)
|
||||
.with_angle4(0.0)
|
||||
.boxed(),
|
||||
Mirrors::default().boxed(),
|
||||
Softglow::default().boxed(),
|
||||
Newsprint::default().boxed(),
|
||||
StereographicProjection::default().with_tilt(123.0).boxed(),
|
||||
FocusBlur::default()
|
||||
.with_blur_radius(11.5)
|
||||
.with_blur_type(FocusBlurType::Gaussian)
|
||||
.with_midpoint(0.6)
|
||||
.with_radius(0.9)
|
||||
.boxed(),
|
||||
Newsprint::default()
|
||||
.with_color_model(NewsprintColorModel::Rgb)
|
||||
.with_pattern2(NewsprintPattern::Diamond)
|
||||
.with_period2(200.0)
|
||||
.with_angle2(0.0)
|
||||
.with_pattern3(NewsprintPattern::Diamond)
|
||||
.with_period3(200.0)
|
||||
.with_angle3(35.0)
|
||||
.with_pattern4(NewsprintPattern::Diamond)
|
||||
.with_period4(200.0)
|
||||
.with_angle4(55.0)
|
||||
.boxed(),
|
||||
FocusBlur::default()
|
||||
.with_blur_radius(11.5)
|
||||
.with_blur_type(FocusBlurType::Gaussian)
|
||||
.with_midpoint(0.6)
|
||||
.with_radius(0.9)
|
||||
.boxed(),
|
||||
],
|
||||
resolution: (1920, 1080),
|
||||
turn_off_alpha: false,
|
||||
}
|
||||
}
|
|
@ -1,16 +0,0 @@
|
|||
//! Helper and utility functions.
|
||||
|
||||
use {
|
||||
color_eyre::Result,
|
||||
subprocess::{Exec, NullFile},
|
||||
};
|
||||
|
||||
/// Run a command using [`subprocess`] and discard the output.
|
||||
pub fn shell_command(command: String) -> Result<()> {
|
||||
Exec::shell(command)
|
||||
.stdout(NullFile)
|
||||
.stderr(NullFile)
|
||||
.capture()?;
|
||||
|
||||
Ok(())
|
||||
}
|
Loading…
Reference in New Issue