feat: Enhance Bevel & Emboss effect with contour support and algorithm improvements
- Implemented contour lookup functionality for Bevel & Emboss effect to allow for custom contour curves. - Added contour parameter to LayerStyle and updated related structures and functions. - Improved emboss algorithm by fixing height field calculations and ensuring proper handling of outside pixels. - Introduced tilt component for 3D emboss effect, enhancing visual depth. - Optimized MAE grid search parameters for better performance and accuracy. - Expanded Iced GUI panel for Bevel & Emboss to include contour selection and additional styling options. - Updated example scripts to reflect changes in the API and new features.
This commit is contained in:
@@ -1126,6 +1126,7 @@ impl HcieIcedApp {
|
||||
highlight_color: [255, 255, 255, 255],
|
||||
shadow_blend_mode: "Multiply".to_string(),
|
||||
shadow_color: [0, 0, 0, 255],
|
||||
contour: "Linear".to_string(),
|
||||
},
|
||||
"Satin" => LayerStyle::Satin {
|
||||
enabled: true,
|
||||
@@ -1398,6 +1399,7 @@ impl HcieIcedApp {
|
||||
(LayerStyle::BevelEmboss { direction, .. }, "direction") => *direction = value,
|
||||
(LayerStyle::BevelEmboss { highlight_blend_mode, .. }, "highlight_blend") => *highlight_blend_mode = value,
|
||||
(LayerStyle::BevelEmboss { shadow_blend_mode, .. }, "shadow_blend") => *shadow_blend_mode = value,
|
||||
(LayerStyle::BevelEmboss { contour, .. }, "contour") => *contour = value,
|
||||
_ => {}
|
||||
}
|
||||
self.documents[self.active_doc].engine.update_layer_style(layer_id, new_style);
|
||||
|
||||
@@ -466,19 +466,22 @@ fn build_style_params<'a>(
|
||||
}
|
||||
"BevelEmboss" => {
|
||||
let (depth, size, angle, altitude, soften, style_str, technique_str, direction_str,
|
||||
highlight_opacity, shadow_opacity, hl_color, sh_color, hl_blend, sh_blend) = match style {
|
||||
highlight_opacity, shadow_opacity, hl_color, sh_color, hl_blend, sh_blend,
|
||||
contour_str) = match style {
|
||||
Some(LayerStyle::BevelEmboss {
|
||||
depth, size, angle, altitude, soften, style, technique, direction,
|
||||
highlight_opacity, shadow_opacity, highlight_color, shadow_color,
|
||||
highlight_blend_mode, shadow_blend_mode, ..
|
||||
highlight_blend_mode, shadow_blend_mode, contour, ..
|
||||
}) => (*depth, *size, *angle, *altitude, *soften,
|
||||
style.clone(), technique.clone(), direction.clone(),
|
||||
*highlight_opacity, *shadow_opacity, *highlight_color, *shadow_color,
|
||||
highlight_blend_mode.clone(), shadow_blend_mode.clone()),
|
||||
_ => (1.0, 5.0, 120.0, 30.0, 0.0,
|
||||
highlight_blend_mode.clone(), shadow_blend_mode.clone(),
|
||||
contour.clone()),
|
||||
_ => (100.0, 5.0, 120.0, 30.0, 0.0,
|
||||
"InnerBevel".to_string(), "Smooth".to_string(), "Up".to_string(),
|
||||
0.75, 0.75, [255, 255, 255, 255], [0, 0, 0, 255],
|
||||
"Screen".to_string(), "Multiply".to_string()),
|
||||
"Screen".to_string(), "Multiply".to_string(),
|
||||
"Linear".to_string()),
|
||||
};
|
||||
|
||||
// ── Structure section: Style, Technique, Direction ──
|
||||
@@ -571,7 +574,7 @@ fn build_style_params<'a>(
|
||||
params = params.push(text("Geometry").size(10).font(iced::Font::MONOSPACE));
|
||||
|
||||
// Contour dropdown
|
||||
let contour_static: &'static str = Box::leak("Linear".to_string().into_boxed_str());
|
||||
let contour_static: &'static str = Box::leak(contour_str.clone().into_boxed_str());
|
||||
let contour_list: iced::widget::PickList<&str, &[&str], &str, Message> = pick_list(BEVEL_CONTOURS, Some(contour_static), move |v: &str| {
|
||||
Message::LayerStyleUpdateString(selected, "contour".to_string(), v.to_string())
|
||||
}).width(Length::Fixed(120.0)).text_size(10);
|
||||
|
||||
Reference in New Issue
Block a user