-
Notifications
You must be signed in to change notification settings - Fork 141
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add watermark_red_dot JSON node and querystring command
- Loading branch information
Showing
9 changed files
with
91 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
use super::internal_prelude::*; | ||
|
||
pub static WATERMARK_RED_DOT: WatermarkRedDotDef = WatermarkRedDotDef{}; | ||
|
||
#[derive(Debug,Clone)] | ||
pub struct WatermarkRedDotDef; | ||
impl WatermarkRedDotDef{ | ||
} | ||
|
||
impl NodeDef for WatermarkRedDotDef{ | ||
fn as_one_input_expand(&self) -> Option<&dyn NodeDefOneInputExpand>{ | ||
Some(self) | ||
} | ||
} | ||
impl NodeDefOneInputExpand for WatermarkRedDotDef { | ||
fn fqn(&self) -> &'static str { | ||
"imazen.watermark" | ||
} | ||
fn expand(&self, ctx: &mut OpCtxMut, ix: NodeIndex, params: NodeParams, input: FrameInfo) -> Result<()> { | ||
if let NodeParams::Json(imageflow_types::Node::WatermarkRedDot) = params { | ||
let canvas_sufficient = input.w > 3 && | ||
input.h > 3; | ||
if canvas_sufficient { | ||
|
||
ctx.replace_node(ix, vec![ | ||
Node::from(imageflow_types::Node::FillRect { | ||
x1: input.w as u32 - 3, | ||
y1: input.h as u32 - 3, | ||
x2: input.w as u32, | ||
y2: input.h as u32, | ||
color: imageflow_types::Color::Srgb(imageflow_types::ColorSrgb::Hex("FF0000".to_owned())) | ||
}) | ||
]); | ||
|
||
} | ||
Ok(()) | ||
} else { | ||
Err(nerror!(crate::ErrorKind::NodeParamsMismatch, "Need WatermarkRedDot, got {:?}", params)) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters