pub struct CurveEditor { /* private fields */ }Expand description
Editable points over a smooth curve that never swings past them. A press on empty space adds a point and a drag moves it; a double click or Delete removes one, except the two ends. From the keyboard, the arrows move the chosen point (with Shift, further), Page Up and Page Down choose another, and Enter adds one on the curve halfway to the next.
Points go from 0 to 1 on both axes, with the input in x. They are kept in order of x.
use ravenrs_core::Point;
use ravenrs_reactive::State;
use ravenrs_widgets::CurveEditor;
let tones = State::new(vec![Point::ZERO, Point::new(0.4, 0.55), Point::new(1.0, 1.0)]);
let editor = CurveEditor::new(tones.binding()).height(220.0).label("Tone curve");
let middle = CurveEditor::value_at(&tones.get(), 0.5);
assert!(middle > 0.55 && middle < 1.0);Implementations§
Source§impl CurveEditor
impl CurveEditor
Sourcepub fn new(points: Binding<Vec<Point>>) -> CurveEditor
pub fn new(points: Binding<Vec<Point>>) -> CurveEditor
An editor of points, across its parent, 200 logical pixels tall.
Sourcepub fn value_at(points: &[Point], x: f32) -> f32
pub fn value_at(points: &[Point], x: f32) -> f32
What the curve through points gives for the input x, for applying it. It uses the
same curve the editor draws.
Sourcepub fn size(self, width: f32, height: f32) -> CurveEditor
pub fn size(self, width: f32, height: f32) -> CurveEditor
Fixed size in logical pixels.
Sourcepub fn height(self, height: f32) -> CurveEditor
pub fn height(self, height: f32) -> CurveEditor
Height in logical pixels.
Sourcepub fn color(self, color: Color) -> CurveEditor
pub fn color(self, color: Color) -> CurveEditor
The color of the curve and its handles, as data, such as a channel’s (ink by default).
Sourcepub fn baseline(self, baseline: bool) -> CurveEditor
pub fn baseline(self, baseline: bool) -> CurveEditor
Shows the straight line of no change behind the curve (on by default).
Sourcepub fn grid(self, parts: u32) -> CurveEditor
pub fn grid(self, parts: u32) -> CurveEditor
Divides the plot in this many parts each way, with light lines (4 by default).
Sourcepub fn histogram(
self,
channels: impl IntoIterator<Item = HistogramChannel>,
scale: HistogramScale,
) -> CurveEditor
pub fn histogram( self, channels: impl IntoIterator<Item = HistogramChannel>, scale: HistogramScale, ) -> CurveEditor
Shows these channels behind the curve, as a Histogram does, faintly.
Sourcepub fn label(self, label: impl Into<String>) -> CurveEditor
pub fn label(self, label: impl Into<String>) -> CurveEditor
The name screen readers announce, instead of the one in Labels.
Sourcepub fn disabled(self, disabled: bool) -> CurveEditor
pub fn disabled(self, disabled: bool) -> CurveEditor
Turns the control off: it fades, leaves the tab order and ignores input.
Trait Implementations§
Source§impl Debug for CurveEditor
impl Debug for CurveEditor
Auto Trait Implementations§
impl !RefUnwindSafe for CurveEditor
impl !Send for CurveEditor
impl !Sync for CurveEditor
impl !UnwindSafe for CurveEditor
impl Freeze for CurveEditor
impl Unpin for CurveEditor
impl UnsafeUnpin for CurveEditor
Blanket Implementations§
impl<T> AutoreleaseSafe for Twhere
T: ?Sized,
impl<T> AutoreleaseSafe for Twhere
T: ?Sized,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<S, T> Duplex<S> for Twhere
T: FromSample<S> + ToSample<S>,
impl<T> ErasedDestructor for Twhere
T: 'static,
§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
§impl<T, U> ToSample<U> for Twhere
U: FromSample<T>,
impl<T, U> ToSample<U> for Twhere
U: FromSample<T>,
fn to_sample_(self) -> U
Source§impl<V> ViewExt for Vwhere
V: View,
impl<V> ViewExt for Vwhere
V: View,
Source§fn padding(self, padding: impl Into<Insets>) -> Styled<Self>
fn padding(self, padding: impl Into<Insets>) -> Styled<Self>
Source§fn background(self, fill: impl Into<Fill>) -> Styled<Self>
fn background(self, fill: impl Into<Fill>) -> Styled<Self>
Source§fn frame(self, width: Option<f32>, height: Option<f32>) -> Styled<Self>
fn frame(self, width: Option<f32>, height: Option<f32>) -> Styled<Self>
None keeps the content size.