writing/
writing.rs

1use swf::*;
2
3fn main() {
4    let header = Header {
5        compression: Compression::Zlib,
6        version: 6,
7        stage_size: Rectangle {
8            x_min: Twips::ZERO,
9            x_max: Twips::from_pixels(400.0),
10            y_min: Twips::ZERO,
11            y_max: Twips::from_pixels(400.0),
12        },
13        frame_rate: Fixed8::from_f32(60.0),
14        num_frames: 1,
15    };
16    let tags = [
17        Tag::SetBackgroundColor(Color {
18            r: 255,
19            g: 0,
20            b: 0,
21            a: 255,
22        }),
23        Tag::ShowFrame,
24    ];
25    let file = std::fs::File::create("tests/swfs/SimpleRedBackground.swf").unwrap();
26    let writer = std::io::BufWriter::new(file);
27    swf::write_swf(&header, &tags, writer).unwrap();
28}