pub struct PgsDisplaySet {
pub pcs: Option<Rc<PgsPcsSegment>>,
pub wds: Option<Rc<PgsWdsSegment>>,
pub pds: Option<Rc<PgsPdsSegment>>,
pub ods: Option<Rc<PgsOdsSegment>>,
}Expand description
Struct representing a collection of PGS segments required for rendering a single subtitle frame. The segments include:
pcs: Presentation Composition Segment.wds: Window Definition Segment.pds: Palette Definition Segment.ods: Object Definition Segment.
Fields§
§pcs: Option<Rc<PgsPcsSegment>>§wds: Option<Rc<PgsWdsSegment>>§pds: Option<Rc<PgsPdsSegment>>§ods: Option<Rc<PgsOdsSegment>>Implementations§
Source§impl PgsDisplaySet
impl PgsDisplaySet
Sourcepub fn new() -> Self
pub fn new() -> Self
Creates a new, empty PgsDisplaySet with no segments.
§Returns
A new PgsDisplaySet instance with all segment options set to None.
Sourcepub fn state(&self) -> PgsDisplaySetState
pub fn state(&self) -> PgsDisplaySetState
Determines the current state of the display set.
- If PCS and WDS are present, but PDS and ODS are not, the state is
EmptyFrame. - If all segments (PCS, WDS, PDS, ODS) are present, the state is
Complete. - Otherwise, the state is
Incomplete.
§Returns
The current state of the PgsDisplaySet.
Sourcepub fn get_rle_image(&self) -> Result<&Vec<u8>>
pub fn get_rle_image(&self) -> Result<&Vec<u8>>
Sourcepub fn get_decoded_image(&self, gray: bool) -> Result<Vec<Vec<u32>>>
pub fn get_decoded_image(&self, gray: bool) -> Result<Vec<Vec<u32>>>
Decodes the RLE image data and returns the image as a 2D array of pixels.
This function decodes the image contained in the ODS segment using the palette from the PDS
segment. It can return the image in either grayscale or color depending on the gray parameter.
§Parameters
gray: A boolean flag indicating whether to decode the image in grayscale (true) or color (false).
§Errors
Returns Error::IncompleteDisplaySet if the display set is not in the Complete state.
§Returns
A 2D vector containing the decoded pixels, where each pixel is represented as a 32-bit color value.
Trait Implementations§
Source§impl Clone for PgsDisplaySet
impl Clone for PgsDisplaySet
Source§fn clone(&self) -> PgsDisplaySet
fn clone(&self) -> PgsDisplaySet
1.0.0§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for PgsDisplaySet
impl Debug for PgsDisplaySet
Source§impl Default for PgsDisplaySet
impl Default for PgsDisplaySet
Source§fn default() -> PgsDisplaySet
fn default() -> PgsDisplaySet
Auto Trait Implementations§
impl Freeze for PgsDisplaySet
impl RefUnwindSafe for PgsDisplaySet
impl !Send for PgsDisplaySet
impl !Sync for PgsDisplaySet
impl Unpin for PgsDisplaySet
impl UnwindSafe for PgsDisplaySet
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
clone_to_uninit)