//#####################################################################
// Copyright 2010.
// This file is part of PhysBAM whose distribution is governed by the license contained in the accompanying file PHYSBAM_COPYRIGHT.txt.
//#####################################################################
// Macro INTERPOLATED_COLOR_MAP
//#####################################################################
#ifndef __INTERPOLATED_COLOR_MAP__
#define __INTERPOLATED_COLOR_MAP__

#include <Core/Interpolation/INTERPOLATION_CURVE.h>
#include <Core/Vectors/VECTOR.h>
namespace PhysBAM{

template<class T>
class INTERPOLATED_COLOR_MAP
{
    typedef VECTOR<T,3> COL;
public:
    T mn,mx;
    bool use_log;
    INTERPOLATION_CURVE<T,COL> colors;

    INTERPOLATED_COLOR_MAP();
    INTERPOLATED_COLOR_MAP(const INTERPOLATED_COLOR_MAP& icm)=default;
    template<class U>
    explicit INTERPOLATED_COLOR_MAP(const INTERPOLATED_COLOR_MAP<U>& icm);

    void Initialize_Colors(T min_value,T max_value,bool log_scale,bool reverse,bool two_sets);
    void Initialize_Matlab_Jet(T min_value,T max_value,bool log_scale,bool reverse);
    void Initialize_Matlab_Hot(T min_value,T max_value,bool log_scale,bool reverse);
    COL operator()(T x) const;
    template<class RW> void Read(UNTYPED_ISTREAM<RW>& input);
    template<class RW> void Write(UNTYPED_OSTREAM<RW>& output) const;
};
}

#endif
