Struct nih_plug_vizia::ViziaState
source · pub struct ViziaState { /* private fields */ }
Expand description
State for an nih_plug_vizia
editor. The scale factor can be manipulated at runtime using
cx.set_user_scale_factor()
.
Implementations§
source§impl ViziaState
impl ViziaState
sourcepub fn new(
size_fn: impl Fn() -> (u32, u32) + Send + Sync + 'static
) -> Arc<ViziaState>
pub fn new( size_fn: impl Fn() -> (u32, u32) + Send + Sync + 'static ) -> Arc<ViziaState>
Initialize the GUI’s state. This value can be passed to create_vizia_editor()
. The
callback always returns the window’s current size is in logical pixels, so before it is
multiplied by the DPI scaling factor. This size can be computed based on the plugin’s
current state.
sourcepub fn new_with_default_scale_factor(
size_fn: impl Fn() -> (u32, u32) + Send + Sync + 'static,
default_scale_factor: f64
) -> Arc<ViziaState>
pub fn new_with_default_scale_factor( size_fn: impl Fn() -> (u32, u32) + Send + Sync + 'static, default_scale_factor: f64 ) -> Arc<ViziaState>
The same as new()
, but with a separate initial scale factor. This scale
factor gets applied on top of any HiDPI scaling, and it can be modified at runtime by
changing cx.set_user_scale_factor()
.
sourcepub fn scaled_logical_size(&self) -> (u32, u32)
pub fn scaled_logical_size(&self) -> (u32, u32)
Returns a (width, height)
pair for the current size of the GUI in logical pixels, after
applying the user scale factor.
sourcepub fn inner_logical_size(&self) -> (u32, u32)
pub fn inner_logical_size(&self) -> (u32, u32)
Returns a (width, height)
pair for the current size of the GUI in logical pixels before
applying the user scale factor.
sourcepub fn user_scale_factor(&self) -> f64
pub fn user_scale_factor(&self) -> f64
Get the non-DPI related uniform scaling factor the GUI’s size will be multiplied with. This
can be changed by changing cx.user_scale_factor
.
Trait Implementations§
source§impl Debug for ViziaState
impl Debug for ViziaState
source§impl<'de> Deserialize<'de> for ViziaState
impl<'de> Deserialize<'de> for ViziaState
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where __D: Deserializer<'de>,
source§impl<'a> PersistentField<'a, ViziaState> for Arc<ViziaState>
impl<'a> PersistentField<'a, ViziaState> for Arc<ViziaState>
source§fn set(&self, new_value: ViziaState)
fn set(&self, new_value: ViziaState)
T
value using interior mutability.source§fn map<F, R>(&self, f: F) -> Rwhere
F: Fn(&ViziaState) -> R,
fn map<F, R>(&self, f: F) -> Rwhere F: Fn(&ViziaState) -> R,
T
value, and apply a function to it. This is used to
serialize the T
value.