Skip to content

Commit

Permalink
Merge pull request #81 from image-rs/release-0.11
Browse files Browse the repository at this point in the history
Add changelog for 0.11
  • Loading branch information
HeroicKatora committed Sep 20, 2020
2 parents 3c62d0e + 300d696 commit 691d654
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 10 deletions.
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();
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"));

0 comments on commit 691d654

Please sign in to comment.