//================================================================
// lib2D
//
// - Graphs
//
// AUTHOR:  Gabor Nagy
// DATE:    2024-Jan-22 02:09:41
//
// Copyright (C) 2014-2026 by Gabor Nagy. All rights reserved.
//================================================================
#ifndef _EGraphs_h
#define _EGraphs_h


#include <stdio.h>

#include <Color/Color.h>

#include <E3D/Spline.h>

#if defined (__cplusplus) && (!(defined (__CPLUSLIBS)))
extern "C" {
#endif


enum
{
	EpLINE_GRAPH = 1,
	EpHISTOGRAM
};


#define EpGraphCore\
	int  Type


typedef struct
{
	EpGraphCore;
	int            ValueType, NumOfValues;
	void*          Table;
	EcRGBAiColor   Color;
	E3dSpline*     Spline;
} EpLineGraph;


typedef struct
{
	EpGraphCore;
	int           ValueType, NumOfValues;
	void*         Table;
	EcRGBAiColor  Color;
} EpHistogram;


typedef union
{
	EpGraphCore;
	EpLineGraph  LineGraph;
	EpHistogram  Histogram;
} EpGraph;




typedef struct
{
	XeWidget      DrawW;
	EpImage       Image;
	EcRGBAiColor  BackgroundColor;
	EpRGBA8Pixel  CurrentRGBA8Color;
	EIndex2       Size;
	EInt16_2      Orientation;  // ERight, EUp etc.

	EList(, EpGraph*, Graphs);
} EpGraphDisplay;




extern void             EpGraph_Update(EpGraph* PGraph,  const EIndex PComponentIndex, EpConvertComponentFunc PConvertComponentProc,  void* PStruct);
extern EpGraphDisplay*  EpGraphDisplay_New(XeWidget PParentW,  const EIndex PSizeX, const EIndex PSizeY,  const EBool PSizeAdjustableX,  const EBool PSizeAdjustableY);
extern EpGraph*         EpGraphDisplay_AddGraph(EpGraphDisplay* PGraphDisplay, const int PType, const int PValueType, const int PNumOfValues);
extern void             EpGraphDisplay_Free(EpGraphDisplay* PGraphDisplay);
extern void             EpGraphDisplay_Redraw(EpGraphDisplay* PGraphDisplay);



#if defined (__cplusplus) && (!(defined (__CPLUSLIBS)))
}	// Close scope of 'extern "C"' declaration
#endif


#endif // _EGraphs_h
