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 strOriginal style name (zero-copy reference)
Implementations§
Source§impl ResolvedStyle<'_>
impl ResolvedStyle<'_>
Sourcepub const fn primary_color(&self) -> [u8; 4]
pub const fn primary_color(&self) -> [u8; 4]
Get primary color as RGBA bytes
Sourcepub const fn complexity_score(&self) -> u8
pub const fn complexity_score(&self) -> u8
Get rendering complexity score (0-100)
Sourcepub const fn has_performance_issues(&self) -> bool
pub const fn has_performance_issues(&self) -> bool
Check if style has performance concerns
Sourcepub const fn formatting(&self) -> TextFormatting
pub const fn formatting(&self) -> TextFormatting
Get text formatting flags
Sourcepub const fn is_underline(&self) -> bool
pub const fn is_underline(&self) -> bool
Check if text is underlined
Sourcepub const fn is_strike_out(&self) -> bool
pub const fn is_strike_out(&self) -> bool
Check if text has strike-through
Sourcepub const fn secondary_color(&self) -> [u8; 4]
pub const fn secondary_color(&self) -> [u8; 4]
Get secondary color as RGBA bytes
Sourcepub const fn outline_color(&self) -> [u8; 4]
pub const fn outline_color(&self) -> [u8; 4]
Get outline color as RGBA bytes
Source§impl<'a> ResolvedStyle<'a>
impl<'a> ResolvedStyle<'a>
Sourcepub fn from_style(style: &'a Style<'a>) -> Result<ResolvedStyle<'a>, CoreError>
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>
impl<'a> ResolvedStyle<'a>
Sourcepub fn from_style_with_parent(
style: &'a Style<'a>,
parent: &ResolvedStyle<'a>,
) -> Result<ResolvedStyle<'a>, CoreError>
pub fn from_style_with_parent( style: &'a Style<'a>, parent: &ResolvedStyle<'a>, ) -> Result<ResolvedStyle<'a>, CoreError>
Source§impl ResolvedStyle<'_>
impl ResolvedStyle<'_>
Sourcepub fn apply_resolution_scaling(&mut self, scale_x: f32, scale_y: f32)
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>
impl<'a> Clone for ResolvedStyle<'a>
Source§fn clone(&self) -> ResolvedStyle<'a>
fn clone(&self) -> ResolvedStyle<'a>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<'a> Debug for ResolvedStyle<'a>
impl<'a> Debug for ResolvedStyle<'a>
Source§impl<'a> PartialEq for ResolvedStyle<'a>
impl<'a> PartialEq for ResolvedStyle<'a>
Source§fn eq(&self, other: &ResolvedStyle<'a>) -> bool
fn eq(&self, other: &ResolvedStyle<'a>) -> bool
self and other values to be equal, and is used by ==.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> 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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