Expand description
The image tools of egui-pop-viewport in an application: each
finished change of a tool runs as a step (ADR 0011), so plugins may
veto it, redirect it, replace it or follow it, and the journal
records it.
The tools are egui widgets: they see their changes through a hook
(on_change). The functions here give a hook running each finished
change (done: a drag’s release, a key, a click, a reset) as the
tool’s step, named after the tool in its arguments; a drag’s frames
go through untouched.
| Step | Arguments | Default |
|---|---|---|
histogram.drag | histogram, from, to ({at, delta}: where the drag began, 0..1 or null for keys, and how far it moved in widths), cause | writes to |
curve.change | curve, from, to ([[x, y], ...]), cause (drag, add, delete, reset, key, pick, access) | writes to |
wheel.change | wheel, from, to ({hue, chroma, luminance}), cause | writes to |
zoom.change | viewport, from, to ({zoom: "fit" or a number, center: [x, y]}), cause (command, drag, click, wheel, key, reset) | writes to |
cursor.resolve | viewport, query ({tool, modifiers, dragging, panning, handle, over_image, brush}), default ({system}, {tool}, {image} or {brush}) | gives default |
graph.connect, graph.disconnect, graph.move, graph.delete, graph.add | graph, the edit’s fields, cause | hands the edit to the application (graph) |
A before-hook vetoes the change (the tool keeps, or goes back to,
from) or redirects it (another to); a run-hook gives the value to
write (its result); an after-hook follows it. ImagingPlugin
declares the steps.
cursor.resolve is not a change: a viewport asks it which cursor to
show each time the situation under the pointer changes (the tool, the
keys held, a drag, a handle). A run-hook (or a redirect of default)
gives another cursor; a veto shows the default.
preview opens a preview dialog: an image viewport in a custom
dialog over a clear backdrop (ADR 0013).
use egui_pop_api::AppHandle;
use egui_pop_viewport::curve::CurveEditor;
fn tone(ui: &mut egui::Ui, app: &AppHandle, points: &mut Vec<[f32; 2]>) {
CurveEditor::new(points, "Tone curve")
.on_change(egui_pop_imaging::curve(app, "tone"))
.show(ui);
}Re-exports§
pub use graph::GRAPHS;pub use graph::Graphs;pub use graph::show_graph;
Modules§
- graph
- The node graph editor in an application: each edit runs as a step, what the editor reports goes on the journal, and agents read and edit a graph through commands.
- preview
- A preview dialog: an image viewport in a custom dialog (ADR 0013),
the first use of
Dialog::Custom. An export or a crop shows its effect before it runs: the viewport draws from a tile source of its own, the interface behind stays as it is (aClearbackdrop) and keeps drawing, its own viewport included, while the dialog is modal.
Structs§
- Imaging
Plugin - Declares the image tools’ steps, and the node editors’ steps,
registry (
GRAPHS) and agent commands.
Constants§
- IMAGING_
PLUGIN - The plugin’s id.
- STEP_
CURSOR - A viewport asks which cursor to show.
- STEP_
CURVE - A curve’s points change.
- STEP_
HISTOGRAM - A histogram’s drag ends (or a key moves it).
- STEP_
WHEEL - A colour wheel’s value changes.
- STEP_
ZOOM - A zoom control or a navigator changes a viewport’s view.
Functions§
- cursor
- A viewport’s cursor hook (
Viewport::on_cursor) running each new situation as thecursor.resolvestep, the viewport namedname: plugins give another cursor for a tool, a key held, a handle. An answer that is not a cursor keeps the default. - curve
- A curve editor hook (
CurveEditor::on_change) running each finished change as thecurve.changestep. - histogram
- A histogram hook (
Histogram::on_change) running each finished change as thehistogram.dragstep. - specs
- The steps, as
ImagingPlugindeclares them. - wheel
- A colour wheel hook (
ColorWheel::on_change) running each finished change as thewheel.changestep. - zoom
- A zoom control or navigator hook
(
Navigator::on_change,ZoomControl::on_change) running each finished change as thezoom.changestep, the viewport namedname.
Type Aliases§
- Points
- A curve’s points,
[x, y]in 0..1.