pub struct PgsPdsSegment {
pub header: PgsSegmentHeader,
pub palette_id: u8,
pub palette_version_number: u8,
pub palette_entries: Vec<PgsPdsSegmentPaletteEntry>,
}
Expand description
Struct representing a Palette Definition Segment (PDS) in a PGS file. The PDS defines a color palette that can be used by various objects in the PGS file.
Fields§
§header: PgsSegmentHeader
§palette_id: u8
§palette_version_number: u8
§palette_entries: Vec<PgsPdsSegmentPaletteEntry>
Implementations§
Source§impl PgsPdsSegment
impl PgsPdsSegment
Sourcepub fn from_data(
header: PgsSegmentHeader,
data: &[u8],
) -> Result<Rc<PgsPdsSegment>>
pub fn from_data( header: PgsSegmentHeader, data: &[u8], ) -> Result<Rc<PgsPdsSegment>>
Parses a PgsPdsSegment
from the provided header and raw data buffer.
This method reads the palette ID, version number, and individual palette entries from the data buffer. Each palette entry consists of luminance, color difference (Cr, Cb), and transparency values.
§Parameters
header
: The segment header.data
: A slice of raw data representing the contents of the PDS segment.
§Errors
Returns Error::InvalidSegmentDataLength
if the length of the provided data is less than expected.
§Returns
An Rc<PgsPdsSegment>
containing the parsed segment.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for PgsPdsSegment
impl RefUnwindSafe for PgsPdsSegment
impl Send for PgsPdsSegment
impl Sync for PgsPdsSegment
impl Unpin for PgsPdsSegment
impl UnwindSafe for PgsPdsSegment
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
Mutably borrows from an owned value. Read more