Skip to main content

Module wheel

Module wheel 

Source
Expand description

Colour wheels: the lift, gamma and gain wheels of colour grading, and a hue and saturation picker, each with a luminance slider (egui-pop’s slider, egui_pop_core::slider).

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

A wheel’s value is a WheelValue: a hue (degrees), a chroma (0 at the centre, 1 at the rim) and a luminance. What they mean is the application’s (an offset added to shadows, a power, a gain, or a colour); the wheel draws them and handles the gestures.

  • ColorWheel::offset: neutral at the centre; a drag moves the puck relatively (a click never makes it jump; Ctrl finer, Shift coarser), Escape puts it back, a double click resets it; the luminance slider is signed, around zero.
  • ColorWheel::picker: a press picks the hue and saturation under the pointer, a drag follows it; the luminance slider runs from 0 to 1.
  • Keys when focused: the arrows move the puck by a step.

Every change, of the puck or of the luminance, goes through the on_change hook as a Change of the whole value: a drag’s frames with done: false, its end once more from the value before it (a veto puts it back), and each key, reset and typed luminance. egui-pop-imaging runs the finished ones as the wheel.change step of an application.

Accessibility. The disc is an AccessKit slider named by its label, whose value says the hue, the chroma and the luminance; increment and decrement change the chroma. The luminance slider is named after the wheel (“Lift luminance”).

use egui_pop_viewport::wheel::{ColorWheel, WheelValue};

fn grading(ui: &mut egui::Ui, wheels: &mut [WheelValue; 3]) {
    ui.horizontal(|ui| {
        for (value, label) in wheels.iter_mut().zip(["Lift", "Gamma", "Gain"]) {
            ColorWheel::offset(value, label).size(120.0).show(ui);
        }
    });
}

Structs§

ColorWheel
A colour wheel, with its luminance slider.
WheelOutput
What a wheel did in a frame.
WheelTokens
The wheels’ colours, from the theme (wheel.*).
WheelValue
A wheel’s value: a hue in degrees (0 to the right, counter-clockwise), a chroma (0 at the centre, 1 at the rim) and a luminance.

Enums§

WheelMode
How the disc answers the pointer.

Functions§

wheel_size
The size a wheel takes with its slider, for layouts.