Skip to main content

Crate egui_pop_imaging

Crate egui_pop_imaging 

Source
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.

Experimental: may change in any release (docs/stability.md).

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.

StepArgumentsDefault
histogram.draghistogram, from, to ({at, delta}: where the drag began, 0..1 or null for keys, and how far it moved in widths), causewrites to
curve.changecurve, from, to ([[x, y], ...]), cause (drag, add, delete, reset, key, pick, access)writes to
wheel.changewheel, from, to ({hue, chroma, luminance}), causewrites to
zoom.changeviewport, from, to ({zoom: "fit" or a number, center: [x, y]}), cause (command, drag, click, wheel, key, reset)writes to
cursor.resolveviewport, 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.addgraph, the edit’s fields, causehands 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 (a Clear backdrop) and keeps drawing, its own viewport included, while the dialog is modal.

Structs§

ImagingPlugin
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 the cursor.resolve step, the viewport named name: 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 the curve.change step.
histogram
A histogram hook (Histogram::on_change) running each finished change as the histogram.drag step.
specs
The steps, as ImagingPlugin declares them.
wheel
A colour wheel hook (ColorWheel::on_change) running each finished change as the wheel.change step.
zoom
A zoom control or navigator hook (Navigator::on_change, ZoomControl::on_change) running each finished change as the zoom.change step, the viewport named name.

Type Aliases§

Points
A curve’s points, [x, y] in 0..1.