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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
//! SQP (**SQ**uishy **P**icture Format) is an image format. It can be used to store
//! image data in lossless or lossy compressed form. It is designed to be
//! relatively simple compared to other more standard formats.
//!
//! This image format is mainly for experimentation and learning about
//! compression. While it can be used, there are no guarantees about stability,
//! breaking changes, or features.
//!
//! If you're looking for an image format to use, you might want to consider
//! using a more standard one such as those supported by the
//! [image crate](https://docs.rs/image/latest/image/).
//!
//! # Example
//! ## Creating and writing an SQP
//! ```no_run
//! use sqp::{SquishyPicture, ColorFormat};
//!
//! let width = 2;
//! let height = 2;
//! let bitmap = vec![
//! 255, 255, 255, 255, 0, 255, 0, 128,
//! 255, 255, 255, 255, 0, 255, 0, 128
//! ];
//!
//! // Create a 2×2 image in memory. Nothing is compressed or encoded
//! // at this point.
//! let sqp_image = SquishyPicture::from_raw_lossless(
//! width,
//! height,
//! ColorFormat::Rgba8,
//! bitmap
//! );
//!
//! // Write it out to a file. This performs compression and encoding.
//! sqp_image.save("my_image.sqp").expect("Could not save the image");
//! ```
//!
//! ## Reading an SQP from a file.
//! ```no_run
//! use std::fs::File;
//! use sqp::SquishyPicture;
//!
//! // Load it directly with the `open` function...
//! let image = sqp::open("my_image.sqp").expect("Could not open file");
//!
//! // ...or from something implementing Read.
//! let input_file = File::open("my_image.sqp").expect("Could not open image file");
//! let image2 = SquishyPicture::decode(&input_file);
//! ```
// ----------------------- //
// INLINED USEFUL FEATURES //
// ----------------------- //
pub use SquishyPicture;
pub use open;
pub use ColorFormat;
pub use CompressionType;