1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
//! Library for reading and writing PCX images.
//!
//! Example of reading a PCX image:
//!
//! let mut reader = pcx::Reader::from_file("test-data/marbles.pcx").unwrap();
//! println!("width = {}, height = {}, paletted = {}", reader.width(), reader.height(), reader.is_paletted());
//!
//! let mut buffer = vec![0; reader.width() as usize * reader.height() as usize * 3];
//! reader.read_rgb_pixels(&mut buffer).unwrap();
//!
//! Example of writing a PCX image:
//!
//! // Create 5x5 RGB file.
//! let mut writer = pcx::WriterRgb::create_file("test.pcx", (5, 5), (300, 300)).unwrap();
//! for y in 0..5 {
//! // Write 5 green pixels.
//! writer.write_row(&[0, 255, 0, 0, 255, 0, 0, 255, 0, 0, 255, 0, 0, 255, 0]);
//! }
//! writer.finish().unwrap();
//!
//! This library does not implement its own error type, instead it uses `std::io::Error`. In the case of an invalid
//! PCX file it will return an error with `.kind() == ErrorKind::InvalidData`.
// References:
// https://github.com/FFmpeg/FFmpeg/blob/415f907ce8dcca87c9e7cfdc954b92df399d3d80/libavcodec/pcx.c
// http://www.fileformat.info/format/pcx/egff.htm
// http://www.fileformat.info/format/pcx/spec/index.htm
use io;
pub use crateReader;
pub use crate;
// Error caused by the incorrect usage of the API.