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

    Pixel color inversion

    Copyright (c) 2000 Guenter Geiger
    For information on usage and redistribution, and for a DISCLAIMER OF ALL
    WARRANTIES, see the file, "GEM.LICENSE.TERMS" in this distribution.

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

#ifndef INCLUDE_MGCK_BASE_H_
#define INCLUDE_MGCK_BASE_H_

#include "Base/GemPixObj.h"
#include <stdio.h>
#include <magick/api.h>

/*-----------------------------------------------------------------
-------------------------------------------------------------------
CLASS
    mgck_base
    
    Pixel color inversion

KEYWORDS
    pix
    
DESCRIPTION

-----------------------------------------------------------------*/
class GEM_EXTERN mgck_base : public GemPixObj
{
    CPPEXTERN_HEADER(mgck_base, GemPixObj)

    public:

	    //////////
	    // Constructor
    	mgck_base(int num);
    	
    protected:
    	
    	//////////
    	// Destructor
    	virtual ~mgck_base();

    	//////////
    	// Do the processing
    	virtual void 	processImage(imageStruct &image);

	virtual Image* mgckProcess(imageStruct &image,t_float* m);
	int ninlets;
	t_float m_arg[10];

	Image* mgck_image;
	ExceptionInfo m_exception;
	float m_radius;
	static void a1MessCallback(void *data, t_floatarg gain);
	void a1Mess(float r);
	static void a2MessCallback(void *data, t_floatarg gain);
	void a2Mess(float r);
	static void a3MessCallback(void *data, t_floatarg gain);
	void a3Mess(float r);
	static void a4MessCallback(void *data, t_floatarg gain);
	void a4Mess(float r);
	static void mobj_setupCallback(t_class * classPtr, int num);
};



#define MAKE_MAGICK_EXTERNB(name,numarg,func) \
class GEM_EXTERN mgck_ ## name : public mgck_base {\
    CPPEXTERN_HEADER(mgck_ ## name, GemPixObj)\
public:\
  mgck_ ## name();\
protected:\
  virtual Image* mgckProcess(imageStruct &image,t_float* m);\
};\
\
CPPEXTERN_NEW(mgck_ ## name)\
\
mgck_ ## name :: mgck_ ## name() :\
    mgck_base( numarg ) {}\
\
void mgck_ ## name :: obj_setupCallback(t_class * classPtr)\
{   mobj_setupCallback(classPtr, numarg ); }


#define MAKE_MAGICK_EXTERN(name,func) \
MAKE_MAGICK_EXTERNB(name,1,func) \
Image* mgck_ ## name :: mgckProcess(imageStruct &image,t_float* a)\
{ return func ( mgck_image, a[0], &m_exception ); }\


#define MAKE_MAGICK_EXTERN0(name,func) \
MAKE_MAGICK_EXTERNB(name,0,func) \
Image* mgck_ ## name :: mgckProcess(imageStruct &image,t_float* a)\
{ return func ( mgck_image, &m_exception ); }\


#define MAKE_MAGICK_EXTERN2(name,func) \
MAKE_MAGICK_EXTERNB(name,2,func) \
Image* mgck_ ## name :: mgckProcess(imageStruct &image,t_float* a)\
{ return func ( mgck_image, a[0],a[1], &m_exception ); }\


#define MAKE_MAGICK_EXTERN3(name,func) \
MAKE_MAGICK_EXTERNB(name,3,func) \
Image* mgck_ ## name :: mgckProcess(imageStruct &image,t_float* a)\
{ return func ( mgck_image, a[0],a[1],a[2], &m_exception ); }\

#define MAKE_MAGICK_EXTERN4(name,func) \
MAKE_MAGICK_EXTERNB(name,4,func) \
Image* mgck_ ## name :: mgckProcess(imageStruct &image,t_float* a)\
{ return func ( mgck_image, a[0],a[1],a[2],a[4], &m_exception ); }\


#define MAKE_MAGICK_EXTERN_FUNC(name,numarg,func)\
MAKE_MAGICK_EXTERNB(name,numarg,func) \
Image* mgck_ ## name :: mgckProcess(imageStruct &image,t_float* a)\





#endif	// for header file
