use super::{Op, OpVec, Pixel};
use std::any::Any;
use std::sync::Arc;
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum MarkerKind {
File,
Look,
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct MarkerNoOp {
pub kind: MarkerKind,
pub value: String,
}
impl Op for MarkerNoOp {
fn name(&self) -> &'static str {
match self.kind {
MarkerKind::File => "FileNoOp",
MarkerKind::Look => "LookNoOp",
}
}
fn apply(&self, _pixels: &mut [Pixel]) {}
fn is_no_op(&self) -> bool {
true
}
fn is_no_op_type(&self) -> bool {
true
}
fn has_channel_crosstalk(&self) -> bool {
false
}
fn cache_id(&self) -> String {
String::new()
}
fn as_any(&self) -> &dyn Any {
self
}
fn clone_box(&self) -> Box<dyn Op> {
Box::new(self.clone())
}
}
pub fn create_file_no_op(ops: &mut OpVec, fname: &str) {
ops.push(Arc::new(MarkerNoOp {
kind: MarkerKind::File,
value: fname.to_string(),
}));
}
pub fn create_look_no_op(ops: &mut OpVec, look: &str) {
ops.push(Arc::new(MarkerNoOp {
kind: MarkerKind::Look,
value: look.to_string(),
}));
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct MetadataNoOp {
pub metadata: crate::format_metadata::FormatMetadata,
}
impl Op for MetadataNoOp {
fn name(&self) -> &'static str {
"MetadataNoOp"
}
fn apply(&self, _pixels: &mut [Pixel]) {}
fn is_no_op(&self) -> bool {
true
}
fn is_no_op_type(&self) -> bool {
true
}
fn has_channel_crosstalk(&self) -> bool {
false
}
fn cache_id(&self) -> String {
String::new()
}
fn as_any(&self) -> &dyn Any {
self
}
fn clone_box(&self) -> Box<dyn Op> {
Box::new(self.clone())
}
}
pub fn create_metadata_no_op(ops: &mut OpVec, metadata: &crate::format_metadata::FormatMetadata) {
ops.push(Arc::new(MetadataNoOp {
metadata: metadata.clone(),
}));
}