d3cc9d5fa5
Bumps the cargo-minor group with 11 updates: | Package | From | To | | --- | --- | --- | | [anyhow](https://github.com/dtolnay/anyhow) | `1.0.81` | `1.0.82` | | [async-channel](https://github.com/smol-rs/async-channel) | `2.2.0` | `2.2.1` | | [chrono](https://github.com/chronotope/chrono) | `0.4.37` | `0.4.38` | | [encoding_rs](https://github.com/hsivonen/encoding_rs) | `0.8.33` | `0.8.34` | | [fluent-templates](https://github.com/XAMPPRocky/fluent-templates) | `0.9.1` | `0.9.2` | | [either](https://github.com/rayon-rs/either) | `1.10.0` | `1.11.0` | | [quote](https://github.com/dtolnay/quote) | `1.0.35` | `1.0.36` | | [syn](https://github.com/dtolnay/syn) | `2.0.58` | `2.0.59` | | [proc-macro2](https://github.com/dtolnay/proc-macro2) | `1.0.79` | `1.0.80` | | [webbrowser](https://github.com/amodm/webbrowser-rs) | `0.8.14` | `0.8.15` | | [libtest-mimic](https://github.com/LukasKalbertodt/libtest-mimic) | `0.7.0` | `0.7.2` | Updates `anyhow` from 1.0.81 to 1.0.82 - [Release notes](https://github.com/dtolnay/anyhow/releases) - [Commits](https://github.com/dtolnay/anyhow/compare/1.0.81...1.0.82) Updates `async-channel` from 2.2.0 to 2.2.1 - [Release notes](https://github.com/smol-rs/async-channel/releases) - [Changelog](https://github.com/smol-rs/async-channel/blob/master/CHANGELOG.md) - [Commits](https://github.com/smol-rs/async-channel/compare/v2.2.0...v2.2.1) Updates `chrono` from 0.4.37 to 0.4.38 - [Release notes](https://github.com/chronotope/chrono/releases) - [Changelog](https://github.com/chronotope/chrono/blob/main/CHANGELOG.md) - [Commits](https://github.com/chronotope/chrono/compare/v0.4.37...v0.4.38) Updates `encoding_rs` from 0.8.33 to 0.8.34 - [Commits](https://github.com/hsivonen/encoding_rs/compare/v0.8.33...v0.8.34) Updates `fluent-templates` from 0.9.1 to 0.9.2 - [Release notes](https://github.com/XAMPPRocky/fluent-templates/releases) - [Changelog](https://github.com/XAMPPRocky/fluent-templates/blob/master/CHANGELOG.md) - [Commits](https://github.com/XAMPPRocky/fluent-templates/compare/fluent-templates-v0.9.1...fluent-templates-v0.9.2) Updates `either` from 1.10.0 to 1.11.0 - [Commits](https://github.com/rayon-rs/either/compare/1.10.0...1.11.0) Updates `quote` from 1.0.35 to 1.0.36 - [Release notes](https://github.com/dtolnay/quote/releases) - [Commits](https://github.com/dtolnay/quote/compare/1.0.35...1.0.36) Updates `syn` from 2.0.58 to 2.0.59 - [Release notes](https://github.com/dtolnay/syn/releases) - [Commits](https://github.com/dtolnay/syn/compare/2.0.58...2.0.59) Updates `proc-macro2` from 1.0.79 to 1.0.80 - [Release notes](https://github.com/dtolnay/proc-macro2/releases) - [Commits](https://github.com/dtolnay/proc-macro2/compare/1.0.79...1.0.80) Updates `webbrowser` from 0.8.14 to 0.8.15 - [Release notes](https://github.com/amodm/webbrowser-rs/releases) - [Changelog](https://github.com/amodm/webbrowser-rs/blob/main/CHANGELOG.md) - [Commits](https://github.com/amodm/webbrowser-rs/compare/v0.8.14...v0.8.15) Updates `libtest-mimic` from 0.7.0 to 0.7.2 - [Release notes](https://github.com/LukasKalbertodt/libtest-mimic/releases) - [Changelog](https://github.com/LukasKalbertodt/libtest-mimic/blob/master/CHANGELOG.md) - [Commits](https://github.com/LukasKalbertodt/libtest-mimic/commits) --- updated-dependencies: - dependency-name: anyhow dependency-type: direct:production update-type: version-update:semver-patch dependency-group: cargo-minor - dependency-name: async-channel dependency-type: direct:production update-type: version-update:semver-patch dependency-group: cargo-minor - dependency-name: chrono dependency-type: direct:production update-type: version-update:semver-patch dependency-group: cargo-minor - dependency-name: encoding_rs dependency-type: direct:production update-type: version-update:semver-patch dependency-group: cargo-minor - dependency-name: fluent-templates dependency-type: direct:production update-type: version-update:semver-patch dependency-group: cargo-minor - dependency-name: either dependency-type: direct:production update-type: version-update:semver-minor dependency-group: cargo-minor - dependency-name: quote dependency-type: direct:production update-type: version-update:semver-patch dependency-group: cargo-minor - dependency-name: syn dependency-type: direct:production update-type: version-update:semver-patch dependency-group: cargo-minor - dependency-name: proc-macro2 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: cargo-minor - dependency-name: webbrowser dependency-type: direct:production update-type: version-update:semver-patch dependency-group: cargo-minor - dependency-name: libtest-mimic dependency-type: direct:production update-type: version-update:semver-patch dependency-group: cargo-minor ... Signed-off-by: dependabot[bot] <support@github.com> |
||
---|---|---|
.. | ||
examples | ||
src | ||
tests/swfs | ||
Cargo.toml | ||
LICENSE-APACHE | ||
LICENSE-MIT | ||
README.md |
README.md
swf
A Rust library for reading and writing the Adobe Flash SWF file format.
# Cargo.toml
[dependencies]
swf = "0.2"
Reading
use std::io::BufReader;
use std::fs::File;
let file = File::open("file.swf").unwrap();
let reader = BufReader::new(file);
let swf_buf = swf::decompress_swf(reader).unwrap();
let swf = swf::parse_swf(&swf_buf).unwrap();
println!("The SWF has {} frame(s).", swf.header.num_frames());
println!("The SWF has {} tag(s).", swf.tags.len());
Try cargo run --example reading
in this repository to run this example.
Writing
use swf::*;
let header = Header {
compression: Compression::Zlib,
version: 6,
stage_size: Rectangle {
x_min: Twips::from_pixels(0.0), x_max: Twips::from_pixels(400.0),
y_min: Twips::from_pixels(0.0), y_max: Twips::from_pixels(400.0)
},
frame_rate: Fixed8::from_f32(60.0),
num_frames: 1,
};
let tags = [
Tag::SetBackgroundColor(Color { r: 255, g: 0, b: 0, a: 255 }),
Tag::ShowFrame
];
let file = std::fs::File::create("file.swf").unwrap();
let writer = std::io::BufWriter::new(file);
swf::write_swf(&header, &tags, writer).unwrap();
Try cargo run --example writing
in this repository to run this example.
License
Licensed under either of
- Apache License, Version 2.0, (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.
Contribution
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.