/****************************************************************************************

	ColorBalance.h

	Copyright (c)1990 - 1999 MetaCreations. All rights reserved.

	Author:	Jonathan Trachtenberg

	Date:	06/08/99

	Revision History

	when		who			what & why
	=========== ===========	=============================================================

****************************************************************************************/

#ifndef __COLORBALANCE__
#define __COLORBALANCE__  

#if CP_PRAGMA_ONCE
#pragma once
#endif

#include "MCArray.h"
#include "BasicPostRenderer.h"
#include "ColorBalanceDef.h"
#include "IShChannel.h"

// Define the ColorBalance CLSID ( see the ColorBalanceDef.h file to get the R_CLSID_COLORBALANCE value )


extern const MCGUID CLSID_ColorBalance;

// Data storage of our extension :
struct ColorBalanceData
{
		real		fRIntensity;             // Intensity in %
		real		fGIntensity;             // Intensity in %
		real		fBIntensity;             // Intensity in %
		bool		fIgnoreBack;			 // Ignore Background;
};
 
// ColorBalance Object :

class ColorBalance : public TBasicPostRenderer
{
public :  
  ColorBalance();
  ~ColorBalance();

	// IUnknown methods
	STANDARD_RELEASE;

	// IExDataExchanger methods :
	virtual void*	 MCCOMAPI GetExtensionDataBuffer	();
	virtual int32	 MCCOMAPI GetParamsBufferSize		() const	{ return sizeof(fData);}
	virtual	MCCOMErr MCCOMAPI ExtensionDataChanged		();
  
	// I3DExPostRenderer methods
	void			 MCCOMAPI GetBufferNeeds			(RenderFilterNeeds& needs, void* renderer);
	virtual	MCCOMErr MCCOMAPI PrepareDraw				(IShRasterLayer* input,
														 const TMCRect& bounds,
														 IShChannel* buffers[],
														 I3DShScene* scene,
														 I3DShCamera* renderingCamera,
														 const TBBox2D& uvBox,
														 const TBBox2D& productionFrame);

	virtual	MCCOMErr MCCOMAPI DrawRect					(const TMCRect& outputRect,
														 const TChannelDataBucket* output[],
														 const TChannelDataBucket* compositedOutputTile[],
														 const TBBox2D& uvBox);

	virtual	MCCOMErr MCCOMAPI FinishDraw				();

protected :
	
	TMCCountedPtr<IShRasterLayer>	fColorOffscreen;
	TMCCountedPtr<IShChannel>		fIndexChannel;

	TMCArray<int32>					fIndexBuffer;	// temporary buffer for the object index

	TChannelDataBucket				fIndexBucket;

    ColorBalanceData				fData;

};

#endif
