Module pconvert_rust::wasm::utils

source ·
Expand description

PNG decode/encode and load functions, console log macros, argument parsing from javascript input to inner-crate rust types and other utility functions.

Structs

Functions

Attempts to parse a &String to a BlendAlgorithm. Returns the enum variant if it suceeds. Otherwise it returns a PConvertError.
Attempts to build a vector of blending operations and extra parameters. One pair per blending operation. Returns a PConvertError if it fails parsing.
Receives png buffer data and encodes it as a File with specified CompressionType and FilterType.
Receives png buffer data and encodes it as an ImageData object with specified CompressionType and FilterType.
Retrieves the image::codecs::png::CompressionType value from the HashMap<String, JSONValue> map if it exists. Otherwise it returns the default value: CompressionType::Fast.
Retrieves the image::codecs::png::FilterType value from the HashMap<String, JSONValue> map if it exists. Otherwise it returns the default value: FilterType::NoFilter.
Receives a File and returns the decoded PNG byte buffer.
Logs one line (algorithm, compression, filter, blend time, read time, write time) of the benchmarks table to the browser console (with console.log).
Logs the header/column names of the benchmarks table to the browser console (with console.log).
Rust Future from nodejs fs.readFile Promise (awaitable in node).
Wrapper function for nodejs fs.readFileSync.
Wrapper function for nodejs fs.writeFileSync.