pub struct ResolvedStyle<'a> {
pub name: &'a str,
/* private fields */
}analysis only.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<'a> ResolvedStyle<'a>
impl<'a> ResolvedStyle<'a>
Sourcepub fn from_style(style: &'a Style<'a>) -> Result<Self>
pub fn from_style(style: &'a Style<'a>) -> Result<Self>
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.
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
Sourcepub fn from_style_with_parent(
style: &'a Style<'a>,
parent: &Self,
) -> Result<Self>
pub fn from_style_with_parent( style: &'a Style<'a>, parent: &Self, ) -> Result<Self>
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 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more