#ifndef DRAW_H
#define DRAW_H

#include "structs.h"
#include "parameter.h"

#if defined (_MSC_VER) 
#pragma component(browser, off, references)
#pragma warning(push, 0)
#elif (__INTEL_COMPILER)
#pragma diagnostic push
#pragma warning ( disable : 61 )
#elif (__GNUC__) 
#pragma GCC diagnostic push
#pragma GCC system_header
//#pragma GCC diagnostic ignored "-Wno-multichar"
#endif

//#define cimg_use_png
#include "CImg.h"
//#include "png.h"

#if defined (_MSC_VER) 
#pragma warning(pop)
#pragma component(browser, on, references)
#elif (__INTEL_COMPILER)
#pragma diagnostic pop
#elif (__GNUC__) 
#pragma GCC diagnostic pop
#endif

using namespace cimg_library;

#undef max
#undef min

///Contains functions for graph visualization.
class draw
{
public:
	static void plotPair(inputMethod const &input, resultMethod const &result, inputInfo const &info, parameter const &params);
	static void plotSegmets(inputMethod const &input, vtr2<resultMethod> const &result, inputInfo const &info, parameter const &params);

	static CImg<short> drawCombine(vtr2<node> const &matrix, vtr<resultPath> const &warpings, vtr<coord> const &minims, parameter const &params);

	static void drawMatrix(CImg<short> &img, vtr2<node> const &matrix, parameter const &params);
	static void drawMinimums(CImg<short> &img, vtr<coord> const &minims);
	static void drawWarpings(CImg<short> &img, vtr<resultPath> const &warpings, const float *color);
	static void drawHorizontalBreaks(CImg<short> &img, vtr2<resultMethod> const &result, const float *color);
	static void drawVerticalBreaks(CImg<short> &img, vtr2<resultMethod> const &result, const float *color);
	static void drawFlexibleWindow(CImg<short> &img, vtr2<node> const &matrix, vtr<resultPath> const &warpings, const float *color, parameter const &params);

	static CImg<short> drawSeries(vtr2<double> const &series, double min, double max);
	static CImg<short> drawSeriesBars(vtr2<double> const &series, double min, double max);
	static CImg<short> drawSeriesMean(vtr2<double> const &series, double min, double max);

	static double getMax(vtr2<node> const &matrix, parameter const &params);
	static double getMin(vtr2<node> const &matrix, parameter const &params);
	static color getColor(double min, double max, double value);
	
	static std::string generateFileName(inputInfo const &info, std::string path);
};

#endif //DRAW_H