Skip to main content

ResolvedStyle

Struct ResolvedStyle 

Source
pub struct ResolvedStyle<'a> {
    pub name: &'a str,
    /* private fields */
}
Expand description

Fully resolved style with computed values and performance metrics

Contains effective style values after applying inheritance, overrides, and defaults. Optimized for rendering with pre-computed color values and complexity scoring for performance assessment.

Fields§

§name: &'a str

Original style name (zero-copy reference)

Implementations§

Source§

impl ResolvedStyle<'_>

Source

pub fn font_name(&self) -> &str

Get font family name

Source

pub const fn font_size(&self) -> f32

Get font size in points

Source

pub const fn primary_color(&self) -> [u8; 4]

Get primary color as RGBA bytes

Source

pub const fn complexity_score(&self) -> u8

Get rendering complexity score (0-100)

Source

pub const fn has_performance_issues(&self) -> bool

Check if style has performance concerns

Source

pub const fn formatting(&self) -> TextFormatting

Get text formatting flags

Source

pub const fn is_bold(&self) -> bool

Check if text is bold

Source

pub const fn is_italic(&self) -> bool

Check if text is italic

Source

pub const fn is_underline(&self) -> bool

Check if text is underlined

Source

pub const fn is_strike_out(&self) -> bool

Check if text has strike-through

Source

pub const fn margin_l(&self) -> u16

Get left margin in pixels

Source

pub const fn margin_r(&self) -> u16

Get right margin in pixels

Source

pub const fn margin_t(&self) -> u16

Get top margin in pixels

Source

pub const fn margin_b(&self) -> u16

Get bottom margin in pixels

Source

pub const fn outline(&self) -> f32

Get outline thickness

Source

pub const fn shadow(&self) -> f32

Get shadow distance

Source

pub const fn secondary_color(&self) -> [u8; 4]

Get secondary color as RGBA bytes

Source

pub const fn outline_color(&self) -> [u8; 4]

Get outline color as RGBA bytes

Source

pub const fn spacing(&self) -> f32

Get character spacing

Source

pub const fn angle(&self) -> f32

Get text rotation angle

Source§

impl<'a> ResolvedStyle<'a>

Source

pub fn from_style(style: &'a Style<'a>) -> Result<ResolvedStyle<'a>, CoreError>

Create ResolvedStyle from base Style definition

Resolves all style properties, validates values, and computes performance metrics. Invalid values are replaced with defaults.

§Arguments
  • style - Base style definition to resolve
§Returns

Fully resolved style with computed properties.

§Example
let style = Style { name: "Default", fontname: "Arial", fontsize: "20", ..Default::default() };
let resolved = ResolvedStyle::from_style(&style)?;
assert_eq!(resolved.font_name(), "Arial");
assert_eq!(resolved.font_size(), 20.0);
§Errors

Returns an error if style parsing fails or contains invalid values.

Source§

impl<'a> ResolvedStyle<'a>

Source

pub fn from_style_with_parent( style: &'a Style<'a>, parent: &ResolvedStyle<'a>, ) -> Result<ResolvedStyle<'a>, CoreError>

Create resolved style with inheritance from parent

§Arguments
  • style - Style definition with possible overrides
  • parent - Parent style to inherit from
§Returns

Resolved style inheriting parent properties with child overrides

§Errors

Returns an error if style parsing fails

Source§

impl ResolvedStyle<'_>

Source

pub fn apply_resolution_scaling(&mut self, scale_x: f32, scale_y: f32)

Apply resolution scaling to coordinate-based properties

Scales font size, spacing, outline, shadow, and margins based on the resolution difference between layout and play resolutions.

§Arguments
  • scale_x - Horizontal scaling factor (PlayResX / LayoutResX)
  • scale_y - Vertical scaling factor (PlayResY / LayoutResY)

Trait Implementations§

Source§

impl<'a> Clone for ResolvedStyle<'a>

Source§

fn clone(&self) -> ResolvedStyle<'a>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'a> Debug for ResolvedStyle<'a>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl<'a> PartialEq for ResolvedStyle<'a>

Source§

fn eq(&self, other: &ResolvedStyle<'a>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<'a> StructuralPartialEq for ResolvedStyle<'a>

Auto Trait Implementations§

§

impl<'a> Freeze for ResolvedStyle<'a>

§

impl<'a> RefUnwindSafe for ResolvedStyle<'a>

§

impl<'a> Send for ResolvedStyle<'a>

§

impl<'a> Sync for ResolvedStyle<'a>

§

impl<'a> Unpin for ResolvedStyle<'a>

§

impl<'a> UnsafeUnpin for ResolvedStyle<'a>

§

impl<'a> UnwindSafe for ResolvedStyle<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.