# hdr2png

A library for various image processing operations.

## Usage

The WASM binary is embedded into the JS module. You can use the
[WASM module](./api.d.ts) directly or a [higher level API](./index.d.ts).

You can find some samples in the [`/test`](./test/) directory.

This library itself isn't multithreaded, but you can kinda achieve it on a
per-file basis by creating multiple instances of the module and using them in
your own workers.

## Building

### Building for WebAssembly

Activate the Emscripten SDK and run `make` in the root directory.

### Building for Win32

You can also build a small CLI executable for testing:

```sh
make -f Makefile.win32
```

This requires clang to be installed and MSVC cannot be used.

You can run it like so:

```sh
.\dist\hdr2png.exe
```

This is chiefly used for testing, but most operations should be available.

## Internal API

See [/src/h2p_lib.h](./src/h2p_lib.h)

```
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
```
