Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add changelog for 0.11 #81

Merged
merged 3 commits into from
Sep 20, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ edition = "2018"

exclude = [
"tests/*",
"benches/*.gif",
"gif-afl/*",
]

Expand Down
10 changes: 10 additions & 0 deletions Changes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# v0.11

- Rename `Reader` to `Decoder`.
- Reworked `Decoder` into `DecodeOptions`.
- The decoding error is now opaque and no longer allocates a string. Adding
more information or more error conditions is forward compatible.
- Replace the lzw decoder with `weezl`, up to +350% throughput.
- The dysfunctional C-API has been (temporarily?) removed
- It may get reintroduced as a separate crate at some point
- Added a `std` feature. It must be active for now.
14 changes: 6 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,18 @@ This library provides all functions necessary to de- and encode GIF files.

The high level interface consists of the two types
[`Encoder`](https://docs.rs/gif/0.10.1/gif/struct.Encoder.html) and [`Decoder`](https://docs.rs/gif/0.10.1/gif/struct.Decoder.html).
They as builders for the actual en- and decoders and can be used to set various
options beforehand.

### Decoding GIF files

```rust
// Open the file
use std::fs::File;
use gif::SetParameter;
let mut decoder = gif::Decoder::new(File::open("tests/samples/sample_1.gif").unwrap());
let input = File::open("tests/samples/sample_1.gif").unwrap();
// Configure the decoder such that it will expand the image to RGBA.
decoder.set(gif::ColorOutput::RGBA);
let mut options = gif::DecodeOptions::new();
options.set_color_output(gif::ColorOutput::RGBA);
// Read the file header
let mut decoder = decoder.read_info().unwrap();
let mut decoder = options.read_info(input).unwrap();
HeroicKatora marked this conversation as resolved.
Show resolved Hide resolved
while let Some(frame) = decoder.read_next_frame().unwrap() {
// Process every frame
}
Expand All @@ -34,7 +32,7 @@ while let Some(frame) = decoder.read_next_frame().unwrap() {
The encoder can be used to save simple computer generated images:

```rust
use gif::{Frame, Encoder, Repeat, SetParameter};
use gif::{Frame, Encoder, Repeat};
use std::fs::File;
use std::borrow::Cow;

Expand All @@ -57,7 +55,7 @@ let beacon_states = [[
]];
let mut image = File::create("target/beacon.gif").unwrap();
let mut encoder = Encoder::new(&mut image, width, height, color_map).unwrap();
encoder.set(Repeat::Infinite).unwrap();
encoder.set_repeat(Repeat::Infinite).unwrap();
for state in &beacon_states {
let mut frame = Frame::default();
frame.width = width;
Expand Down
11 changes: 9 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
//!
//! The high level interface consists of the two types
//! [`Encoder`](struct.Encoder.html) and [`Decoder`](struct.Decoder.html).
//! They as builders for the actual en- and decoders and can be used to set various
//! options beforehand.
//!
//! ### Decoding GIF files
//!
Expand Down Expand Up @@ -142,3 +140,12 @@ fn round_trip() {
}
assert_eq!(&data[..], &data2[..])
}

macro_rules! insert_as_doc {
{ $content:expr } => {
#[doc = $content] extern { }
}
}

// Provides the README.md as doc, to ensure the example works!
insert_as_doc!(include_str!("../README.md"));