TGA I/O

inline std::pair<Image<RGB>, Image<float>> huira::read_image_tga(const fs::path &filepath, bool read_alpha)

Reads a TGA file and returns linear RGB + alpha data.

Convenience overload that reads the file into memory and forwards to the buffer-based implementation.

inline std::pair<Image<RGB>, Image<float>> huira::read_image_tga(const unsigned char *data, std::size_t size, bool read_alpha)

Reads a TGA from an in-memory buffer and returns linear RGB + alpha data.

Parameters:
  • data – Pointer to the TGA data in memory

  • size – Size of the data in bytes

  • read_alpha – Whether to load the alpha channel if present (default: true)

Returns:

A pair containing the linear RGB image and an optional alpha image.

inline std::pair<Image<float>, Image<float>> huira::read_image_tga_mono(const fs::path &filepath, bool read_alpha)

Reads a TGA file and returns linear mono + alpha data.

Convenience overload that reads the file into memory and forwards to the buffer-based implementation.

inline std::pair<Image<float>, Image<float>> huira::read_image_tga_mono(const unsigned char *data, std::size_t size, bool read_alpha)

Reads a TGA from an in-memory buffer and returns linear mono + alpha data.

RGB channels are averaged after linearization to produce mono output.

Parameters:
  • data – Pointer to the TGA data in memory

  • size – Size of the data in bytes

  • read_alpha – Whether to load the alpha channel if present (default: true)

Returns:

A pair containing the linear mono image and an optional alpha image.