#pragma once
#include <cstdint>

#ifdef _WIN32
  #define mLibraryExport __declspec(dllexport)
  #define mLibraryImport __declspec(dllimport)
#else
  #define mLibraryExport __attribute__((visibility("default")))
  #define mLibraryImport mLibraryExport
#endif

#ifdef NVTT_EXPORTS
  #define mNVTTWrapperExport extern "C" mLibraryExport
#else
  #define mNVTTWrapperExport extern "C" mLibraryImport
#endif

enum class NVTTFormat : uint32_t {
  // No compression.
  RGB  = 0,
  RGBA = RGB,

  // DX9 formats.
  DXT1  = 1,
  DXT1a = 2,  // DXT1 with binary alpha.
  DXT3  = 3,
  DXT5  = 4,
  DXT5n = 5,  // Compressed HILO: R=1, G=y, B=0, A=x

  // DX10 formats.
  BC1  = DXT1,
  BC1a = DXT1a,
  BC2  = DXT3,
  BC3  = DXT5,
  BC3n = DXT5n,
  BC4  = 6,  // ATI1
  BC5  = 7,  // 3DC, ATI2
};

enum class NVTTQuality : uint32_t {
  Fastest    = 0,
  Normal     = 1,
  Production = 2,
  Highest    = 3,
};

mNVTTWrapperExport bool nvtt_compress_image(const char* input_path, const char* output_path,
                                            NVTTFormat format, NVTTQuality quality);

mNVTTWrapperExport uint8_t* nvtt_load_png(const char* input_path, int32_t* width, int32_t* height);
