diff --git a/crates/imaging/src/fold_order.rs b/crates/imaging/src/fold_order.rs new file mode 100644 index 000000000..1144424df --- /dev/null +++ b/crates/imaging/src/fold_order.rs @@ -0,0 +1,9 @@ +//! The cell order of a warp: one order for the preview and the render, without egui or kurbo. + +/// The order the cells of a warp mesh row `row` are drawn in: turned-over cells last, then by increasing displacement, +/// a non-finite vertex under, a stable sort. `pos` are the displaced points and `rest` the points at rest, as +/// `[x, y]` pairs. +pub fn cell_order(pos: &[[f64; 2]], rest: &[[f64; 2]], row: usize) -> Vec { + let _ = (pos, rest, row); + todo!("tl.T13") +} diff --git a/crates/imaging/src/lib.rs b/crates/imaging/src/lib.rs index be3fdbb5a..b1867c989 100644 --- a/crates/imaging/src/lib.rs +++ b/crates/imaging/src/lib.rs @@ -3,7 +3,9 @@ //! [`scopes`], [`selection`], [`trace`] and [`layer_style`] work without egui and build on every target. The widgets are behind the `ui` feature. #![warn(missing_docs)] +pub mod fold_order; pub mod layer_style; +pub mod raw; pub mod scopes; pub mod selection; pub mod trace; diff --git a/crates/imaging/src/raw.rs b/crates/imaging/src/raw.rs new file mode 100644 index 000000000..a78c9fe51 --- /dev/null +++ b/crates/imaging/src/raw.rs @@ -0,0 +1,144 @@ +//! The RAW Develop settings: the typed session of the Camera Raw filter, without egui. + +use serde::{Deserialize, Serialize}; + +/// One colour grading wheel. +#[derive(Clone, Copy, Debug, Default, PartialEq, Serialize, Deserialize)] +#[serde(default)] +pub struct GradeWheel { + /// Degrees 0..360. + pub hue: f32, + /// 0..=100. + pub sat: f32, + /// -100..=100. + pub lum: f32, +} + +/// What the vignette protects. +#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub enum VignetteStyle { + /// Highlight priority. + #[default] + HighlightPriority, + /// Colour priority. + ColorPriority, + /// Paint overlay. + PaintOverlay, +} + +/// The settings the RAW Develop workspace edits and the develop reads: the field set and serde names of PhotoCraft's +/// `CameraRaw`, without its three develop inputs (`seed`, `pixel_scale`, `encoding_gamma`). +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[serde(rename_all = "camelCase", default)] +#[non_exhaustive] +pub struct RawDevelopSettings { + // Basic + /// The temperature. + pub temperature: f32, + /// The tint. + pub tint: f32, + /// The exposure. + pub exposure: f32, + /// The contrast. + pub contrast: f32, + /// The highlights. + pub highlights: f32, + /// The shadows. + pub shadows: f32, + /// The whites. + pub whites: f32, + /// The blacks. + pub blacks: f32, + /// The texture. + pub texture: f32, + /// The clarity. + pub clarity: f32, + /// The dehaze. + pub dehaze: f32, + /// The vibrance. + pub vibrance: f32, + /// The saturation. + pub saturation: f32, + // Tone curve + /// The curve highlights. + pub curve_highlights: f32, + /// The curve lights. + pub curve_lights: f32, + /// The curve darks. + pub curve_darks: f32, + /// The curve shadows. + pub curve_shadows: f32, + /// Region splits (percent). + pub curve_splits: [f32; 3], + /// Point curves as `[input, output]` in 0..=255 (empty = linear). + pub point_curve: Vec<[f32; 2]>, + /// The point curve red. + pub point_curve_red: Vec<[f32; 2]>, + /// The point curve green. + pub point_curve_green: Vec<[f32; 2]>, + /// The point curve blue. + pub point_curve_blue: Vec<[f32; 2]>, + // Color mixer: red, orange, yellow, green, aqua, blue, purple, magenta. + /// The hsl hue. + pub hsl_hue: [f32; 8], + /// The hsl sat. + pub hsl_sat: [f32; 8], + /// The hsl lum. + pub hsl_lum: [f32; 8], + // Color grading + /// The grade shadows. + pub grade_shadows: GradeWheel, + /// The grade midtones. + pub grade_midtones: GradeWheel, + /// The grade highlights. + pub grade_highlights: GradeWheel, + /// The grade global. + pub grade_global: GradeWheel, + /// The grade blending. + pub grade_blending: f32, + /// The grade balance. + pub grade_balance: f32, + // Detail + /// The sharpen amount. + pub sharpen_amount: f32, + /// The sharpen radius. + pub sharpen_radius: f32, + /// The sharpen detail. + pub sharpen_detail: f32, + /// The sharpen masking. + pub sharpen_masking: f32, + /// The noise luminance. + pub noise_luminance: f32, + /// The noise luminance detail. + pub noise_luminance_detail: f32, + /// The noise color. + pub noise_color: f32, + /// The noise color detail. + pub noise_color_detail: f32, + // Effects + /// The grain amount. + pub grain_amount: f32, + /// The grain size. + pub grain_size: f32, + /// The grain roughness. + pub grain_roughness: f32, + /// The vignette amount. + pub vignette_amount: f32, + /// The vignette midpoint. + pub vignette_midpoint: f32, + /// The vignette roundness. + pub vignette_roundness: f32, + /// The vignette feather. + pub vignette_feather: f32, + /// The vignette highlights. + pub vignette_highlights: f32, + /// The vignette style. + pub vignette_style: VignetteStyle, +} + +impl Default for RawDevelopSettings { + fn default() -> Self { + todo!("dl.K66") + } +} diff --git a/crates/imaging/src/ui/color_range/dialog.rs b/crates/imaging/src/ui/color_range/dialog.rs new file mode 100644 index 000000000..a6ed28364 --- /dev/null +++ b/crates/imaging/src/ui/color_range/dialog.rs @@ -0,0 +1,64 @@ +//! The Color Range dialog's body. + +use craft_ui::canvas::RasterSource; +use craft_ui::contract::{Bind, EditResponse, NoValue, Outcome, Pattern, Props}; +use craft_ui::runtime::env::Label; +use egui::{Response, Ui}; + +use super::ColorRangeValue; + +/// What the Color Range body reports. +#[derive(Debug)] +#[non_exhaustive] +pub struct ColorRangeOutput { + /// The edit of the value. + pub edit: EditResponse, + /// The body's response. + pub response: Response, +} + +impl Outcome for ColorRangeOutput { + type Value = NoValue; + + fn response(&self) -> &Response { + &self.response + } +} + +/// The Color Range body: the select, the sliders, the selection preview and the sampling tools. +#[must_use = "show the dialog body with `show`"] +#[derive(Pattern, Props)] +#[allow(dead_code)] // P3(dialogs-w7): dl.K54 +pub struct ColorRangeDialog<'a> { + label: Label, + value: Bind<'a, ColorRangeValue>, + /// The mask the preview shows. + #[prop] + mask: Option<&'a dyn RasterSource>, + /// The picture the preview shows. + #[prop] + image: Option<&'a dyn RasterSource>, + /// The integer proxy factor `k`, halved by integer division. + #[prop] + picture_scale: u32, + /// An error to show under the preview. + #[prop] + error: Option