#ifndef GFX_IMAGE_STORAGE_DEEPIMAGE_H__
#define GFX_IMAGE_STORAGE_DEEPIMAGE_H__

#include "maxon/gfx_image_storage.h"


namespace maxon
{


//----------------------------------------------------------------------------------------
/// Extends PixelConstBuffer with the count of samples per pixel for depth pixel buffers.
/// this structure is only valid if SETPIXELHANDLERFLAGS::DEPTH and SETPIXELFLAGS::DEPTH is given.
//----------------------------------------------------------------------------------------
struct DeepImagePixelConstBuffer : public PixelConstBuffer
{
public:
	//----------------------------------------------------------------------------------------
	/// DeepImagePixelConstBuffer constructor.
	/// The following example illustrates how the data needs to be delivered.
	/// @code
	/// UInt32 sampleCounts[2] = { 2, 1 };
	/// Pix8u greyPixelData[3] = { pixel1.1, pixel1.2, pixel2.1 };
	/// DeepImagePixelConstBuffer buffer(sampleCounts, greyPixelData, sizeof(Pix8u));
	/// @endcode
	/// @param[in] counts							Pointer to a memory block with the number of samples per pixel. The array needs to be as long as the
	///																number of requested pixel.
	/// @param[in] buffer							Pointer to the memory block with the pixel data. Each pixel needs exactly the number of samples defined in "counts".
	/// @param[in] inc								Pixel offset between 2 samples.
	//----------------------------------------------------------------------------------------
	DeepImagePixelConstBuffer(const UInt32* counts, const Pix* buffer, BITS inc) : PixelConstBuffer(buffer, inc), _counts(counts)
	{
	}

public:
	const UInt32* _counts = nullptr;
};



//----------------------------------------------------------------------------------------
/// Extends PixelConstBuffer with the count of samples per pixel for depth pixel buffers.
/// this structure is only valid if SETPIXELHANDLERFLAGS::DEPTH and SETPIXELFLAGS::DEPTH is given.
//----------------------------------------------------------------------------------------
struct DeepImagePixelMutableBuffer : public PixelMutableBuffer
{
public:
	//----------------------------------------------------------------------------------------
	/// DeepImagePixelConstBuffer constructor.
	/// The following example illustrates how the data needs to be delivered.
	/// @code
	/// UInt32 sampleCounts[2];
	/// Pix* pixelData;
	/// finally { DeleteMem(pixelData); };
	/// DeepImagePixelConstBuffer buffer(sampleCounts, pixelData, pixelFormat.GetBitsPerPixel());
	/// @endcode
	/// @param[in] counts							Pointer to a memory block that receives the number of samples per pixel. The array needs to be as long as the
	///																number of requested pixel.
	/// @param[in,out] buffer					Pointer to the memory block which receives the pixel data. Important: This memory is reallocated with ReAllocMem and needs
	/// 															to be freed after this call!
	/// @param[in] inc								Pixel offset between 2 samples.
	//----------------------------------------------------------------------------------------
	DeepImagePixelMutableBuffer(UInt32* counts, Pix*& buffer, BITS inc) : PixelMutableBuffer(buffer, inc), _counts(counts), _bufferPtr(buffer)
	{
	}

public:
	UInt32*		 _counts;
	Pix*&			 _bufferPtr;
};


//----------------------------------------------------------------------------------------
/// Object that can store pixel data in a special layout (e.g. compact, plain, or tiles).
//----------------------------------------------------------------------------------------
class ImagePixelDeepImageStorageInterface : MAXON_INTERFACE_BASES(ImagePixelStorageInterface)
{
	MAXON_INTERFACE(ImagePixelDeepImageStorageInterface, MAXON_REFERENCE_COPY_ON_WRITE, "net.maxon.image.interface.imagepixeldeepimagestorage", MAXON_IMPLEMENTATION_MODULE("net.maxon.image"));

public:
};



// include autogenerated headerfile here
#include "gfx_image_storage_deepimage1.hxx"

namespace ImagePixelStorageClasses
{
	//----------------------------------------------------------------------------------------
	/// ImagePixelStorageClasses::Voxel stores the image data channels in voxels of 64x64 pixels.
	/// This means that memory is only allocated where pixels are set.
	//----------------------------------------------------------------------------------------
	MAXON_DECLARATION(ImagePixelStorageClasses::EntryType, DeepImage, "net.maxon.image.imagepixelstorageclass.deepimage", MAXON_IMPLEMENTATION_MODULE("net.maxon.image"));
}

#include "gfx_image_storage_deepimage2.hxx"

}


#endif // GFX_IMAGE_STORAGE_DEEPIMAGE_H__
