diff --git a/imageflow_core/src/flow/nodes/scale_render.rs b/imageflow_core/src/flow/nodes/scale_render.rs index c4af4c329..7969b94b0 100644 --- a/imageflow_core/src/flow/nodes/scale_render.rs +++ b/imageflow_core/src/flow/nodes/scale_render.rs @@ -257,6 +257,7 @@ impl NodeDefOneInputOneCanvas for DrawImageDef { return Err(cerror!(c, "Failed to execute Scale2D: ")); } } + canvas.compositing_mode = crate::ffi::BitmapCompositingMode::BlendWithSelf; Ok(()) } else { diff --git a/imageflow_core/tests/visuals.rs b/imageflow_core/tests/visuals.rs index d662b8be6..f10deea59 100644 --- a/imageflow_core/tests/visuals.rs +++ b/imageflow_core/tests/visuals.rs @@ -203,6 +203,8 @@ fn test_watermark_image() { assert!(matched); } + + #[test] fn test_watermark_image_command_string() { let matched = compare_multiple(Some(vec![ @@ -241,6 +243,45 @@ fn test_watermark_image_command_string() { assert!(matched); } + +#[test] +fn test_watermark_image_command_string_with_bgcolor() { + let matched = compare_multiple(Some(vec![ + IoTestEnum::Url("https://s3-us-west-2.amazonaws.com/imageflow-resources/test_inputs/waterhouse.jpg".to_owned()), + IoTestEnum::Url("https://s3-us-west-2.amazonaws.com/imageflow-resources/test_inputs/dice.png".to_owned()) + ]), 500, + "Watermark1", POPULATE_CHECKSUMS, DEBUG_GRAPH, vec![ + Node::CommandString{ + kind: CommandStringKind::ImageResizer4, + value: "width=800&height=800&mode=max&bgcolor=aaeeff".to_string(), + decode: Some(0), + encode: None, + watermarks: Some(vec![imageflow_types::Watermark{ + io_id: 1, + fit_box: Some(imageflow_types::WatermarkConstraintBox::ImagePercentage {x1: 30f32, y1: 50f32, x2: 90f32, y2: 90f32}), + fit_mode: Some(imageflow_types::WatermarkConstraintMode::FitCrop), + gravity: Some(imageflow_types::ConstraintGravity::Percentage {x: 100f32, y: 100f32}), + min_canvas_width: None, + min_canvas_height: None, + opacity: Some(0.9f32), + hints: Some(imageflow_types::ResampleHints{ + sharpen_percent: Some(15f32), + down_filter: None, + up_filter: None, + scaling_colorspace: None, + background_color: None, + resample_when: None, + sharpen_when: None + }), + + } + ]) + } + ] + ); + assert!(matched); +} + #[test] fn test_watermark_image_small() { let matched = compare_multiple(Some(vec![