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

    Load an image into a pix block

    Copyright (c) 2000 Guenter Geiger <geiger@epy.co.at>
    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_FROMSIG_H_
#define INCLUDE_PIX_FROMSIG_H_

#include <string.h>

#include "Base/GemBase.h"
#include "Base/GemPixUtil.h"
#include "Base/GemPixImageLoad.h"

/*-----------------------------------------------------------------
-------------------------------------------------------------------
CLASS
    pix_fromsig
    
    Loads in an image
    
KEYWORDS
    pix
    
DESCRIPTION

    "open" - opens a file
    
-----------------------------------------------------------------*/
class GEM_EXTERN pix_fromsig : public GemBase
{
    CPPEXTERN_HEADER(pix_fromsig, GemBase)

    public:

	    //////////
	    // Constructor
    	pix_fromsig(t_float& width, t_float& height);
    	
    protected:
    	
    	//////////
    	// Destructor
    virtual ~pix_fromsig();

    /////////////
    // DSP perform
    static t_int* perform(t_int* w);


    	//////////
    	// Do the rendering
    	virtual void 	render(GemState *state);

    	//////////
    	// Clear the dirty flag on the pixBlock
    	virtual void 	postrender(GemState *state);

    	//////////
    	virtual void	startRendering();

    	//////////
    	// Clean up the image and the pixBlock
    	void	    	cleanImage();
    
	//-----------------------------------
	// GROUP:	Image data
	//-----------------------------------
    
    	//////////
    	// The pixBlock with the current image
    	pixBlock    	m_pixBlock;
	t_float             m_red;
	t_float             m_blue;
	t_float             m_green;
	t_float             m_alpha;
	unsigned char*           m_datastart;
    	int             m_pixsize;
	 unsigned char*            m_current;
	int             m_mode; // scrolling or replacing
    private:
    	
    	//////////
    	// static member functions
	static void     dspMessCallback(void* data,t_signal** sp);
    	static void 	colorMessCallback(void *data, t_float r, t_float g, t_float b,t_float a);

};

#endif	// for header file
