Add pattern stamp tool

This commit is contained in:
Skyler Lehmkuhl
2026-03-06 08:40:17 -05:00
parent 1d9d702a59
commit 7d55443b2a
7 changed files with 127 additions and 10 deletions
@@ -172,7 +172,7 @@ impl InfopanelPane {
let is_raster_paint_tool = active_is_raster && matches!(
tool,
Tool::Draw | Tool::Pencil | Tool::Pen | Tool::Airbrush
| Tool::Erase | Tool::Smudge | Tool::CloneStamp | Tool::HealingBrush
| Tool::Erase | Tool::Smudge | Tool::CloneStamp | Tool::HealingBrush | Tool::PatternStamp
);
// Only show tool options for tools that have options
@@ -196,6 +196,7 @@ impl InfopanelPane {
Tool::Smudge => "Smudge",
Tool::CloneStamp => "Clone Stamp",
Tool::HealingBrush => "Healing Brush",
Tool::PatternStamp => "Pattern Stamp",
_ => "Brush",
}
} else {
@@ -330,6 +331,33 @@ impl InfopanelPane {
self.render_raster_tool_options(ui, shared, matches!(tool, Tool::Erase));
}
Tool::PatternStamp if is_raster_paint_tool => {
const PATTERN_NAMES: &[&str] = &[
"Checkerboard", "Dots", "H-Lines", "V-Lines", "Diagonal \\", "Diagonal /", "Crosshatch",
];
let selected_name = PATTERN_NAMES
.get(*shared.pattern_type as usize)
.copied()
.unwrap_or("Checkerboard");
ui.horizontal(|ui| {
ui.label("Pattern:");
egui::ComboBox::from_id_salt("pattern_type")
.selected_text(selected_name)
.show_ui(ui, |ui| {
for (i, name) in PATTERN_NAMES.iter().enumerate() {
ui.selectable_value(shared.pattern_type, i as u32, *name);
}
});
});
ui.horizontal(|ui| {
ui.label("Scale:");
ui.add(egui::Slider::new(shared.pattern_scale, 4.0_f32..=256.0)
.logarithmic(true).suffix(" px"));
});
ui.add_space(4.0);
self.render_raster_tool_options(ui, shared, false);
}
Tool::Smudge if is_raster_paint_tool => {
ui.horizontal(|ui| {
ui.label("Size:");