aboutsummaryrefslogtreecommitdiff
path: root/src/main.rs
diff options
context:
space:
mode:
authormetamuffin <yvchraiqi@protonmail.com>2022-06-05 17:33:11 +0200
committermetamuffin <yvchraiqi@protonmail.com>2022-06-05 17:33:11 +0200
commita5f64a98782cc15bb3cfbc353e271c612e1ff14a (patch)
tree87f33b12f97527430871ccf85f69b58859f1dab9 /src/main.rs
parented2ff677f1977d2c163322ce9e7a55f0740d1f1a (diff)
downloadblubcat-a5f64a98782cc15bb3cfbc353e271c612e1ff14a.tar
blubcat-a5f64a98782cc15bb3cfbc353e271c612e1ff14a.tar.bz2
blubcat-a5f64a98782cc15bb3cfbc353e271c612e1ff14a.tar.zst
composite
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs26
1 files changed, 24 insertions, 2 deletions
diff --git a/src/main.rs b/src/main.rs
index 482e20a..d7b1349 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -4,7 +4,7 @@ use anyhow::Result;
use blubcat::{
color::Color,
pattern::{Gradient, Rainbow, Sequence, Solid},
- transform::{Matrix, Polar, Translate, Transpose},
+ transform::{Composite, CompositeOperation, Matrix, Polar, Translate, Transpose},
Sample,
};
use std::{
@@ -139,6 +139,28 @@ fn main() -> Result<()> {
})
}
"-T" | "--transpose" => push_queue.push(box Transpose(pat.pop().unwrap())),
+
+ "--add" => push_queue.push(box Composite {
+ a: pat.pop().unwrap(),
+ b: pat.pop().unwrap(),
+ mode: CompositeOperation::Add,
+ }),
+ "--subtract" => push_queue.push(box Composite {
+ a: pat.pop().unwrap(),
+ b: pat.pop().unwrap(),
+ mode: CompositeOperation::Subtract,
+ }),
+ "--multiply" => push_queue.push(box Composite {
+ a: pat.pop().unwrap(),
+ b: pat.pop().unwrap(),
+ mode: CompositeOperation::Multiply,
+ }),
+ "--mix" => push_queue.push(box Composite {
+ a: pat.pop().unwrap(),
+ b: pat.pop().unwrap(),
+ mode: CompositeOperation::Mix(arg_num()),
+ }),
+
_ => panic!("unknown option {}", &a),
}
pat.extend(push_queue.drain(..))
@@ -167,7 +189,7 @@ fn main() -> Result<()> {
fn flag_helper(colors: &[&str]) -> Box<dyn Sample> {
box Matrix {
- matrix: ((1.0 / 12.0, 1.0 / 12.0), (0.0, 0.0)),
+ matrix: ((1.0 / 6.0, 1.0 / 6.0), (0.0, 0.0)),
inner: box Sequence(
colors
.into_iter()