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

API docs #652

Merged
merged 1 commit into from
Nov 30, 2024
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
2 changes: 1 addition & 1 deletion src/deflate/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
1 change: 1 addition & 0 deletions src/filters.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion src/headers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
3 changes: 3 additions & 0 deletions src/interlace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}

Expand Down
8 changes: 6 additions & 2 deletions src/options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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),
Expand Down Expand Up @@ -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,
Expand Down