Improved documentation

This commit is contained in:
G2-Games 2024-07-29 02:57:54 -05:00
parent 52deeda8c9
commit 04c5a0dfb7
3 changed files with 24 additions and 2 deletions

View file

@ -1,3 +1,5 @@
//! Structs and enums which are included in the header of SQP files.
use byteorder::{ReadBytesExt, WriteBytesExt, LE}; use byteorder::{ReadBytesExt, WriteBytesExt, LE};
use std::io::{Cursor, Read, Write}; use std::io::{Cursor, Read, Write};

View file

@ -1,5 +1,4 @@
use crate::ColorFormat; use crate::ColorFormat;
use rayon::prelude::*;
pub fn sub_rows(width: u32, height: u32, color_format: ColorFormat, input: &[u8]) -> Vec<u8> { pub fn sub_rows(width: u32, height: u32, color_format: ColorFormat, input: &[u8]) -> Vec<u8> {
let mut data = Vec::with_capacity(width as usize * color_format.pbc()); let mut data = Vec::with_capacity(width as usize * color_format.pbc());

View file

@ -39,7 +39,7 @@ impl SquishyPicture {
/// ///
/// # Example /// # Example
/// ```ignore /// ```ignore
/// let dpf_lossy = SquishyPicture::from_raw( /// let sqp = SquishyPicture::from_raw(
/// input.width(), /// input.width(),
/// input.height(), /// input.height(),
/// ColorFormat::Rgba32, /// ColorFormat::Rgba32,
@ -83,6 +83,17 @@ impl SquishyPicture {
/// Convenience method over [`SquishyPicture::from_raw`] which creates a /// Convenience method over [`SquishyPicture::from_raw`] which creates a
/// lossy image with a given quality. /// 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( pub fn from_raw_lossy(
width: u32, width: u32,
height: u32, height: u32,
@ -102,6 +113,16 @@ impl SquishyPicture {
/// Convenience method over [`SquishyPicture::from_raw`] which creates a /// Convenience method over [`SquishyPicture::from_raw`] which creates a
/// lossless image. /// 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( pub fn from_raw_lossless(
width: u32, width: u32,
height: u32, height: u32,