Skip to main content

egui_pop_viewport/
lib.rs

1//! A generic image viewport for egui-pop: pan and zoom measured in
2//! physical pixels, tiles from an asynchronous source, overlays in image
3//! coordinates.
4//!
5//! <div class="warning">Experimental: may change in any release
6//! (docs/stability.md).</div>
7//!
8//! - [`view`]: the view model (zoom in physical pixels per image pixel,
9//!   the zoom ladder, fit) and [`view::Mapping`], the one mapping between
10//!   image and screen that drawing, hit tests and the readout share;
11//! - [`gestures`]: the gestures as data, remappable per profile;
12//! - [`widget`]: the [`Viewport`] widget and the [`Signal`]s it emits;
13//! - [`cursor`]: what the active tool shows under the pointer (system
14//!   cursors, tool cursors drawn at the window's scale, an
15//!   application's bitmaps, a brush outline that follows the zoom);
16//! - [`loupe`]: the pixels under the pointer, magnified, with a grid
17//!   and their values;
18//! - [`display`]: the display target of each window and the display
19//!   transform hook where the application plugs its colour management;
20//! - [`source`]: the [`TileSource`](source::TileSource) an application
21//!   implements (asynchronous, live) and the sink it delivers to;
22//! - [`tiles`]: the tile cache (proxy then exact, cancellation, a
23//!   texture budget, tiles within the device's largest texture);
24//! - `gpu` (feature `wgpu`): scene tiles as half-float textures, the
25//!   display transform in a shader;
26//! - `device` (feature `wgpu`): device tiles, a texture or a storage
27//!   buffer already on the render device, drawn with no copy;
28//! - `image_surface` (feature `wayland`): the image on a surface of its
29//!   own, tagged with a wide encoding through the Wayland compositor,
30//!   below an sRGB interface;
31//! - [`demo`]: a procedural source for galleries and examples;
32//! - [`overlay`]: overlays in image coordinates and the handle kit;
33//! - [`thumbnail`] and [`histogram`]: thumbnails in a virtualised grid
34//!   and a histogram, from images and bins the application supplies
35//!   (with clipping markers, and a drag handed back to the application);
36//! - [`curve`]: a curve editor (points added, moved and deleted, a
37//!   spline the application supplies, a histogram behind, the value
38//!   picked in the image);
39//! - [`wheel`]: colour wheels (lift, gamma, gain) and a hue and
40//!   saturation picker, each with a luminance slider;
41//! - [`navigator`]: a zoom control and a navigator (a minimap), sharing
42//!   the viewport's state;
43//! - [`graph`]: a node graph editor over an application's graph (typed
44//!   ports, wires, groups, an overview and a detail view with inline
45//!   sliders), every edit handed back as a request, with its minimap;
46//! - [`change`]: what the image tools share, the change they propose
47//!   and the hook that sees it (a veto, a redirect), and the form their
48//!   values take in a step;
49//! - [`hooks`]: the application's way into each step (veto, redirect,
50//!   replace, extend), traced;
51//! - [`debug`]: the `viewport` collector of the debug bridge;
52//! - [`mounts`]: what its components need and what its overlays offer
53//!   (the mount contract, ADR 0013);
54//! - [`strings`]: the text it shows, translatable;
55//! - [`tokens`]: the component tokens it draws with.
56//!
57//! Layer: a component crate on top of `egui-pop-core` (beside
58//! `egui-pop-api`, see ADR 0001). Nothing here knows about raw files,
59//! colour science or an engine: an application supplies the pixels.
60//!
61//! ```
62//! use egui_pop_viewport::{View, Viewport, ViewportState};
63//!
64//! fn ui(ui: &mut egui::Ui, state: &mut ViewportState, view: &mut View) {
65//!     let out = Viewport::new("main").image_size([6000, 4000]).show(ui, state, view);
66//!     for signal in out.signals {
67//!         // Record the view, keep a gesture in one undo step...
68//!         let _ = signal;
69//!     }
70//! }
71//! ```
72
73pub mod change;
74pub mod cursor;
75pub mod curve;
76pub mod debug;
77pub mod demo;
78#[cfg(feature = "wgpu")]
79pub mod device;
80pub mod display;
81pub mod gestures;
82#[cfg(feature = "wgpu")]
83pub mod gpu;
84pub mod graph;
85pub mod histogram;
86pub mod hooks;
87#[cfg(feature = "wayland")]
88pub mod image_surface;
89pub mod loupe;
90pub mod mounts;
91pub mod navigation;
92pub mod navigator;
93pub mod overlay;
94pub mod source;
95pub mod strings;
96pub mod thumbnail;
97pub mod tiles;
98pub mod tokens;
99pub mod view;
100pub mod wheel;
101pub mod widget;
102
103pub use hooks::{Cause, Hooks, Verdict, ViewChange};
104pub use view::{Mapping, View, Zoom};
105pub use widget::{Compare, Phase, Signal, Viewport, ViewportOutput, ViewportState};