/*
* Copyright (c) 2011 Nokia Corporation.
*/

#ifndef CMIRRORHOUSE_H
#define CMIRRORHOUSE_H

enum eMIRRORTRANSFORM { eNONE, eHORIZONTAL_WAVE, eVERTICAL_WAVE, eBUBBLES, eINVBUBBLES, eSPIRAL, eRIPPLE, eSPIKE, eTILE1, eDITHER1 };

class CMirrorHouse
{
public:
    CMirrorHouse();
    ~CMirrorHouse();

        // Source and target must be set before process can be called.
    void setSource( unsigned int *data, int w, int h, int pitch );
    void setTarget( unsigned int *data, int w, int h, int pitch );

        // Do the transform from source to target
    bool process();

    bool highQuality() { return m_hquality; }
    void setHighQuality( bool set ) { m_hquality = set; }


    void setMirrorTransform( eMIRRORTRANSFORM set, float power = 1.0f, float size = 1.0f )
        { m_selectedTransform = set; m_selectedTransformPower = power; m_selectedTransformSize = size; }


protected:
    void processLine( unsigned int *t, unsigned int *t_target, int *srcCoords );
    void processLine_hq( unsigned int *t, unsigned int *t_target, int *srcCoords );
    eMIRRORTRANSFORM m_selectedTransform;
    float m_selectedTransformPower;
    float m_selectedTransformSize;
    bool m_hquality;

    unsigned int *m_targetData;
    int m_targetWidth;
    int m_targetHeight;
    int m_targetPitch;

    unsigned int *m_sourceData;
    int m_sourceWidth;
    int m_sourceHeight;
    int m_sourcePitch;


    void recreateTransformMap( int w, int h );
    void recreateTransform( eMIRRORTRANSFORM t, float power, float size );
    eMIRRORTRANSFORM m_currentTransform;
    float m_currentTransformPower;
    float m_currentTransformSize;
    int *m_transMap; // source coordinatemap

};

#endif // CMIRRORHOUSE_H
