Struct HeaderExt

Source
pub struct HeaderExt { /* private fields */ }
Expand description

The extended metadata of an SWF file.

This includes the SWF header data as well as metadata from the FileAttributes and SetBackgroundColor tags.

This metadata may not reflect the actual data inside a malformed SWF; for example, the root timeline my actually contain fewer frames than HeaderExt::num_frames if it is corrupted.

Implementations§

Source§

impl HeaderExt

Source

pub fn default_with_swf_version(version: u8) -> Self

Returns the header for a dummy SWF file with the given SWF version.

Source

pub fn default_error_header() -> Self

Returns the header for the error state movie stub which is used if no file could be loaded or if the loaded content is no valid supported content.

Source

pub fn default_with_uncompressed_len(length: i32) -> Self

Returns the header for a loaded image (JPEG, GIF or PNG).

Source

pub fn background_color(&self) -> Option<Color>

The background color of the SWF from the SetBackgroundColor tag.

None will be returned if the SetBackgroundColor tag was not found.

Source

pub fn compression(&self) -> Compression

The compression format used by the SWF.

Source

pub fn frame_rate(&self) -> Fixed8

The frame rate of the SWF, in frames per second.

Source

pub fn has_metadata(&self) -> bool

Whether this SWF contains XMP metadata in a Metadata tag.

Source

pub fn swf_header(&self) -> &Header

Returns the basic SWF header.

Source

pub fn is_action_script_3(&self) -> bool

Whether this SWF uses ActionScript 3.0 (AVM2).

Source

pub fn num_frames(&self) -> u16

The number of frames on the root timeline.

Examples found in repository?
examples/reading.rs (line 9)
4fn main() {
5    let file = File::open("tests/swfs/SimpleRedBackground.swf").unwrap();
6    let reader = BufReader::new(file);
7    let swf_buf = swf::decompress_swf(reader).unwrap();
8    let swf = swf::parse_swf(&swf_buf).unwrap();
9    println!("The SWF has {} frame(s).", swf.header.num_frames());
10    println!("The SWF has {} tag(s).", swf.tags.len());
11}
Source

pub fn stage_size(&self) -> &Rectangle<Twips>

The stage dimensions of this SWF.

Source

pub fn version(&self) -> u8

The SWF version.

Source

pub fn uncompressed_len(&self) -> i32

The length of the SWF after decompression.

Source

pub fn use_direct_blit(&self) -> bool

Whether this SWF requests hardware acceleration to blit to the screen.

Source

pub fn use_gpu(&self) -> bool

Whether this SWF requests hardware acceleration for compositing.

Source

pub fn use_network_sandbox(&self) -> bool

Whether this SWF should be placed in the network sandbox when run locally.

SWFs in the network sandbox can only access network resources, not local resources. SWFs in the local sandbox can only access local resources, not network resources.

Trait Implementations§

Source§

impl Clone for HeaderExt

Source§

fn clone(&self) -> HeaderExt

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for HeaderExt

Source§

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

Formats the value using the given formatter. Read more

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.