Skip to main content

RenderState

Struct RenderState 

Source
pub struct RenderState {
Show 29 fields pub alpha_mul: f32, pub transform: Transform2D, pub rotate_radians: f32, pub rotate_x_radians: f32, pub rotate_y_radians: f32, pub scale: (f32, f32), pub translate: Option<(f32, f32)>, pub blur_sigma: f32, pub clip_rect: Option<ClipRect>, pub clip_drawing: Option<String>, pub primary_color: Option<(u8, u8, u8)>, pub font_size: Option<f32>, pub pivot: Option<(f32, f32)>, pub border: Option<(f32, f32)>, pub shadow: Option<(f32, f32)>, pub be_strength: u8, pub shear: (f32, f32), pub iclip_rect: Option<ClipRect>, pub iclip_drawing: Option<String>, pub secondary_color: Option<(u8, u8, u8)>, pub outline_color: Option<(u8, u8, u8)>, pub shadow_color: Option<(u8, u8, u8)>, pub primary_alpha: Option<u8>, pub secondary_alpha: Option<u8>, pub outline_alpha: Option<u8>, pub shadow_alpha: Option<u8>, pub letter_spacing: Option<f32>, pub wrap_style: Option<u8>, pub alignment: Option<u8>,
}
Expand description

Resolved state of the cue at a particular timestamp.

All quantities are expressed in the cue’s local coordinate space (the same space \pos / \move use). transform composes movescalerotate so the rotation pivot is the translation point.

Fields§

§alpha_mul: f32

1.0 = fully opaque, 0.0 = fully transparent.

§transform: Transform2D

Combined affine transform to apply to the rendered text glyph group.

§rotate_radians: f32

\frz rotation in radians (also baked into transform but exposed for renderers that compose their own matrix).

§rotate_x_radians: f32

\frx rotation in radians (X axis, 3D). Renderers project this to 2D via a perspective camera anchored at pivot.

§rotate_y_radians: f32

\fry rotation in radians (Y axis, 3D).

§scale: (f32, f32)

(sx, sy) scale factors, where 1.0 = 100%.

§translate: Option<(f32, f32)>

(tx, ty) translation. None when neither \pos nor \move applied, in which case the renderer falls back to the cue’s style margins.

§blur_sigma: f32

Gaussian blur sigma in pixels. 0.0 = no blur.

§clip_rect: Option<ClipRect>

Active rectangular clip in cue local coordinates, if any.

§clip_drawing: Option<String>

\clip(drawing) raw drawing string, if active. Parse through crate::drawing::parse_drawing for a vector path mask.

§primary_color: Option<(u8, u8, u8)>

\c primary-colour override, if active.

§font_size: Option<f32>

\fs size override, if active.

§pivot: Option<(f32, f32)>

\org(x, y) pivot point for \frz / \frx / \fry. None means “use the alignment point” (the renderer fills it in).

§border: Option<(f32, f32)>

(x_border, y_border) per-axis text border width in px from \bord / \xbord / \ybord. None = fall back to style.

§shadow: Option<(f32, f32)>

(x_shadow, y_shadow) per-axis shadow distance in px from \shad / \xshad / \yshad. None = fall back to style. Per-axis values may be negative; \shad itself is clamped to non-negative per spec.

§be_strength: u8

\be(N) iterative box-blur strength (0 = off). Distinct from blur_sigma (\blur).

§shear: (f32, f32)

(fax, fay) shear factors applied after rotation. (0.0, 0.0) = no shear.

§iclip_rect: Option<ClipRect>

Active inverse rectangular clip from \iclip(x1,y1,x2,y2). Renderers should hide pixels inside this rectangle.

§iclip_drawing: Option<String>

\iclip(drawing) raw drawing string; renderer parses to a path and masks against its inverse.

§secondary_color: Option<(u8, u8, u8)>

\2c secondary fill colour override, if active.

§outline_color: Option<(u8, u8, u8)>

\3c border / outline colour override, if active.

§shadow_color: Option<(u8, u8, u8)>

\4c shadow colour override, if active.

§primary_alpha: Option<u8>

\1a primary fill alpha (0 = opaque, 255 = transparent), if set. None means “fall back to style alpha”. Independent of Self::alpha_mul, which is the \fad / \fade cue-level envelope. Renderers compose: final_primary_alpha = primary_alpha.unwrap_or(style) * alpha_mul.

§secondary_alpha: Option<u8>

\2a secondary fill alpha, if set.

§outline_alpha: Option<u8>

\3a border / outline alpha, if set.

§shadow_alpha: Option<u8>

\4a shadow alpha, if set.

§letter_spacing: Option<f32>

\fsp additional letter-spacing in script-resolution pixels, if set. None = use the style’s Spacing field. May be negative or decimal.

§wrap_style: Option<u8>

\q wrap-style override for the line, if set. None = use the script’s WrapStyle header. Values per SSA spec: 0 smart-top / 1 EOL / 2 no-wrap / 3 smart-bottom. Not animatable per spec.

§alignment: Option<u8>

\an<pos> (or its legacy \a<pos> form, converted to numpad) alignment override for the line, if set. None = fall back to the cue’s style Alignment. Values are the Aegisub numpad codes 1..=9:

  • 1/2/3 — bottom-left / bottom-center / bottom-right
  • 4/5/6 — middle-left / middle-center / middle-right
  • 7/8/9 — top-left / top-center / top-right

The alignment doubles as the anchor point for \pos / \move translation per the Aegisub spec, so renderers should look here to decide which glyph corner sits on the translate point. Static, not animatable.

Implementations§

Source§

impl RenderState

Source

pub fn identity() -> Self

State with no animated overrides.

Trait Implementations§

Source§

impl Clone for RenderState

Source§

fn clone(&self) -> RenderState

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 Debug for RenderState

Source§

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

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

impl Default for RenderState

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl PartialEq for RenderState

Source§

fn eq(&self, other: &RenderState) -> 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 StructuralPartialEq for RenderState

Auto Trait Implementations§

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> 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.