aff78a5d8e
Bumps the cargo-minor group with 8 updates in the / directory: | Package | From | To | | --- | --- | --- | | [flate2](https://github.com/rust-lang/flate2-rs) | `1.0.31` | `1.0.33` | | [serde](https://github.com/serde-rs/serde) | `1.0.208` | `1.0.209` | | [bitstream-io](https://github.com/tuffy/bitstream-io) | `2.5.0` | `2.5.3` | | [serde_json](https://github.com/serde-rs/json) | `1.0.125` | `1.0.127` | | [quote](https://github.com/dtolnay/quote) | `1.0.36` | `1.0.37` | | [syn](https://github.com/dtolnay/syn) | `2.0.75` | `2.0.76` | | [zip](https://github.com/zip-rs/zip2) | `2.1.6` | `2.2.0` | | [reqwest](https://github.com/seanmonstar/reqwest) | `0.12.6` | `0.12.7` | Updates `flate2` from 1.0.31 to 1.0.33 - [Release notes](https://github.com/rust-lang/flate2-rs/releases) - [Changelog](https://github.com/rust-lang/flate2-rs/blob/main/CHANGELOG.md) - [Commits](https://github.com/rust-lang/flate2-rs/compare/1.0.31...1.0.33) Updates `serde` from 1.0.208 to 1.0.209 - [Release notes](https://github.com/serde-rs/serde/releases) - [Commits](https://github.com/serde-rs/serde/compare/v1.0.208...v1.0.209) Updates `bitstream-io` from 2.5.0 to 2.5.3 - [Commits](https://github.com/tuffy/bitstream-io/compare/v2.5.0...v2.5.3) Updates `serde_json` from 1.0.125 to 1.0.127 - [Release notes](https://github.com/serde-rs/json/releases) - [Commits](https://github.com/serde-rs/json/compare/1.0.125...1.0.127) Updates `quote` from 1.0.36 to 1.0.37 - [Release notes](https://github.com/dtolnay/quote/releases) - [Commits](https://github.com/dtolnay/quote/compare/1.0.36...1.0.37) Updates `syn` from 2.0.75 to 2.0.76 - [Release notes](https://github.com/dtolnay/syn/releases) - [Commits](https://github.com/dtolnay/syn/compare/2.0.75...2.0.76) Updates `zip` from 2.1.6 to 2.2.0 - [Release notes](https://github.com/zip-rs/zip2/releases) - [Changelog](https://github.com/zip-rs/zip2/blob/master/CHANGELOG.md) - [Commits](https://github.com/zip-rs/zip2/compare/v2.1.6...v2.2.0) Updates `reqwest` from 0.12.6 to 0.12.7 - [Release notes](https://github.com/seanmonstar/reqwest/releases) - [Changelog](https://github.com/seanmonstar/reqwest/blob/master/CHANGELOG.md) - [Commits](https://github.com/seanmonstar/reqwest/compare/v0.12.6...v0.12.7) --- updated-dependencies: - dependency-name: flate2 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: cargo-minor - dependency-name: serde dependency-type: direct:production update-type: version-update:semver-patch dependency-group: cargo-minor - dependency-name: bitstream-io dependency-type: direct:production update-type: version-update:semver-patch dependency-group: cargo-minor - dependency-name: serde_json dependency-type: direct:production update-type: version-update:semver-patch 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: zip dependency-type: direct:production update-type: version-update:semver-minor dependency-group: cargo-minor - dependency-name: reqwest 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.