API docs
This commit is contained in:
parent
e8e8309c2d
commit
f8c84c258d
5 changed files with 12 additions and 4 deletions
|
|
@ -11,8 +11,8 @@ mod zopfli_oxipng;
|
|||
#[cfg(feature = "zopfli")]
|
||||
pub use zopfli_oxipng::deflate as zopfli_deflate;
|
||||
|
||||
/// DEFLATE algorithms supported by oxipng (for use in [`Options`][crate::Options])
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
|
||||
/// DEFLATE algorithms supported by oxipng
|
||||
pub enum Deflaters {
|
||||
/// Use libdeflater.
|
||||
Libdeflater {
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ use std::{fmt, fmt::Display, mem::transmute};
|
|||
|
||||
use crate::error::PngError;
|
||||
|
||||
/// Filtering strategy for use in [`Options`][crate::Options]
|
||||
#[repr(u8)]
|
||||
#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Clone, Copy, Hash)]
|
||||
pub enum RowFilter {
|
||||
|
|
|
|||
|
|
@ -71,8 +71,8 @@ pub struct Chunk {
|
|||
pub data: Vec<u8>,
|
||||
}
|
||||
|
||||
/// [`Options`][crate::Options] to use when stripping chunks (metadata)
|
||||
#[derive(Debug, PartialEq, Eq, Clone)]
|
||||
/// Options to use when stripping chunks
|
||||
pub enum StripChunks {
|
||||
/// None
|
||||
None,
|
||||
|
|
|
|||
|
|
@ -4,10 +4,13 @@ use bitvec::prelude::*;
|
|||
|
||||
use crate::{headers::IhdrData, png::PngImage, PngError};
|
||||
|
||||
/// Whether to enable progressive rendering. See [`Options`][crate::Options])
|
||||
#[repr(u8)]
|
||||
#[derive(Debug, PartialEq, Eq, Clone, Copy)]
|
||||
pub enum Interlacing {
|
||||
/// Makes images load top to bottom.
|
||||
None,
|
||||
/// Makes it possible to render partially-loaded images at lower resolution. Usually increases file sizes.
|
||||
Adam7,
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -9,6 +9,8 @@ use log::warn;
|
|||
|
||||
use crate::{deflate::Deflaters, filters::RowFilter, headers::StripChunks, interlace::Interlacing};
|
||||
|
||||
/// Write destination for [`optimize`][crate::optimize].
|
||||
/// You can use [`optimize_from_memory`](crate::optimize_from_memory) to avoid external I/O.
|
||||
#[derive(Clone, Debug)]
|
||||
pub enum OutFile {
|
||||
/// Don't actually write any output, just calculate the best results.
|
||||
|
|
@ -46,7 +48,8 @@ impl OutFile {
|
|||
}
|
||||
}
|
||||
|
||||
/// Where to read images from
|
||||
/// Where to read images from in [`optimize`][crate::optimize].
|
||||
/// You can use [`optimize_from_memory`](crate::optimize_from_memory) to avoid external I/O.
|
||||
#[derive(Clone, Debug)]
|
||||
pub enum InFile {
|
||||
Path(PathBuf),
|
||||
|
|
@ -133,7 +136,8 @@ pub struct Options {
|
|||
///
|
||||
/// Default: `None`
|
||||
pub strip: StripChunks,
|
||||
/// Which DEFLATE algorithm to use
|
||||
/// Which DEFLATE (zlib) algorithm to use
|
||||
#[cfg_attr(feature = "zopfli", doc = "(e.g. Zopfli)")]
|
||||
///
|
||||
/// Default: `Libdeflater`
|
||||
pub deflate: Deflaters,
|
||||
|
|
|
|||
Loading…
Reference in a new issue