/*-----------------------------------------------------------------
LOG
    GEM - Graphics Environment for Multimedia

    Pixel color inversion

    Copyright (c) 1997-1998 Mark Danks. mark@danks.org
    For information on usage and redistribution, and for a DISCLAIMER OF ALL
    WARRANTIES, see the file, "GEM.LICENSE.TERMS" in this distribution.

-----------------------------------------------------------------*/

#ifndef INCLUDE_PIX_TOAA_H_
#define INCLUDE_PIX_TOAA_H_

#include "Base/GemPixObj.h"
#include <aalib.h>

/*-----------------------------------------------------------------
-------------------------------------------------------------------
CLASS
    pix_toaa
    
    Pixel color inversion

KEYWORDS
    pix
    
DESCRIPTION

-----------------------------------------------------------------*/
class GEM_EXTERN pix_toaa : public GemPixObj
{
     CPPEXTERN_HEADER(pix_toaa, GemPixObj)
	  
 public:
     
     //////////
     // Constructor
     pix_toaa();
     
 protected:
     aa_context * m_context;	
     int m_fast;
     aa_renderparams m_renderparams;
     t_outlet* m_out;
     t_int     m_console;

     pixBlock  m_pixBlock;
     //////////
     // Destructor
     virtual ~pix_toaa();
     
     //////////
     // Do the processing
     virtual void 	processImage(imageStruct &image);

     virtual void render(GemState *state);
     
     //////////
     // This is called whenever a new gray8 image comes through.
     //     virtual void 	processGrayImage(imageStruct &image);
     
     void setupContext(imageStruct&) ;

     void invert(int yn) { m_renderparams.inversion = yn; }
     void bright(int yn) { m_renderparams.bright = yn; }
     void contrast(int yn) { m_renderparams.contrast = yn; }
     
 private:
     static void 	invertMessCallback(void *data, t_floatarg size) 
	  { GetMyClass(data)->invert((int)size);}
     static void 	brightMessCallback(void *data, t_floatarg size) 
	  { GetMyClass(data)->bright((int)size);}
     static void 	contrastMessCallback(void *data, t_floatarg size) 
	  { GetMyClass(data)->contrast((int)size);}
     
};

#endif	// for header file
