From 04c5a0dfb7c79f496f42b2f113de9a205b3570d2 Mon Sep 17 00:00:00 2001 From: G2-Games Date: Mon, 29 Jul 2024 02:57:54 -0500 Subject: [PATCH] Improved documentation --- src/header.rs | 2 ++ src/operations.rs | 1 - src/picture.rs | 23 ++++++++++++++++++++++- 3 files changed, 24 insertions(+), 2 deletions(-) diff --git a/src/header.rs b/src/header.rs index bd09d47..383113a 100644 --- a/src/header.rs +++ b/src/header.rs @@ -1,3 +1,5 @@ +//! Structs and enums which are included in the header of SQP files. + use byteorder::{ReadBytesExt, WriteBytesExt, LE}; use std::io::{Cursor, Read, Write}; diff --git a/src/operations.rs b/src/operations.rs index cdd3299..38a2c56 100644 --- a/src/operations.rs +++ b/src/operations.rs @@ -1,5 +1,4 @@ use crate::ColorFormat; -use rayon::prelude::*; pub fn sub_rows(width: u32, height: u32, color_format: ColorFormat, input: &[u8]) -> Vec { let mut data = Vec::with_capacity(width as usize * color_format.pbc()); diff --git a/src/picture.rs b/src/picture.rs index 4cabb9b..bcf8dc9 100644 --- a/src/picture.rs +++ b/src/picture.rs @@ -39,7 +39,7 @@ impl SquishyPicture { /// /// # Example /// ```ignore - /// let dpf_lossy = SquishyPicture::from_raw( + /// let sqp = SquishyPicture::from_raw( /// input.width(), /// input.height(), /// ColorFormat::Rgba32, @@ -83,6 +83,17 @@ impl SquishyPicture { /// Convenience method over [`SquishyPicture::from_raw`] which creates a /// lossy image with a given quality. + /// + /// # Example + /// ```ignore + /// let sqp = SquishyPicture::from_raw_lossy( + /// input.width(), + /// input.height(), + /// ColorFormat::Rgba32, + /// 80, + /// input.as_raw().clone() + /// ); + /// ``` pub fn from_raw_lossy( width: u32, height: u32, @@ -102,6 +113,16 @@ impl SquishyPicture { /// Convenience method over [`SquishyPicture::from_raw`] which creates a /// lossless image. + /// + /// # Example + /// ```ignore + /// let sqp = SquishyPicture::from_raw_lossless( + /// input.width(), + /// input.height(), + /// ColorFormat::Rgba32, + /// input.as_raw().clone() + /// ); + /// ``` pub fn from_raw_lossless( width: u32, height: u32,