#ifdef ASURA_USE_PRAGMA_ONCE
    #pragma once
#endif

#ifndef __PALETTEGENERATIONDLL_H__
#define __PALETTEGENERATIONDLL_H__

enum PaletteGenerationPrecision
{
	PGPrecision_16,//palette values will still be 8888 , but palettisation takes into account that bit depth will be reduced
	PGPrecision_24,
	PGPrecision_32,
};

enum PaletteGenerationAlpha
{
	PGAlpha_0,
	PGAlpha_1,
	PGAlpha_8,
};

struct PaletteGenerationImage
{
	int Width;
	int Height;
	unsigned int* PixelData;//input: picture data as 8888 argb
				   //output: palette indeces
};

struct PaletteGenerationParam
{
	PaletteGenerationParam()
	:StructureSize(sizeof(PaletteGenerationParam)),NumImages(0),Images(0),PaletteSize(0),
	Palette(0),Precision(0),Alpha(0),AlphaUsedAsNormalAlpha(true),m_bUseExistingPalette(false),
	m_bDisableDithering(false)
	{}
	int StructureSize;
	int NumImages;
	PaletteGenerationImage* Images;
	int PaletteSize;//desired palette size (max 256)
	int* Palette;//array to be filled with palette colours
	int Precision;
	int Alpha;
	int AlphaUsedAsNormalAlpha;//Determines whether premultiplied alpha can be used for intermediate values while palettising

	//'Use existing palette' causes the palette generation part of things to be skipped , and instead the function
	//will just map the colours to the nearest entries in the Palette that has been passed in.
	bool m_bUseExistingPalette;

	//Prevents the use of dithering. (Some paths won't use dithering regardless of this).
	bool m_bDisableDithering;
};


bool __cdecl PaletteGeneration(PaletteGenerationParam* param);


typedef bool (*PALETTE_GENERATION_PTR)(PaletteGenerationParam*);

#endif //__PALETTEGENERATIONDLL_H__
