/******************************************************************************\
* "$RCSfile: GUI_Lib.h,v $"                                                    *
********************************************************************************
* Information by CVS or VSS:                                                   *
*     Last check in on: $Date: 2013-08-29 05:19:39 $                           *
*     by                $Author: goebel $
*     Revision        : $Revision: 1.109 $                                     *
*                                                                              *
* CVS: $Source: /Daten/Projekte/CVS/Lib/GUI_Lib/src/GUI_Lib.h,v $
********************************************************************************
* 09-Jul-2001                                                                  *
*******************************************************************************/
/*!	\file GUI_Lib.h
*	\brief GUI Library Interface
*	\author (c) 2001 - 2013 IMAGO Technologies GmbH
*
*	$Revision: 1.109 $
*	$Date: 2013-08-29 05:19:39 $
*******************************************************************************/

#ifndef _GUI_LIB_H_
#define _GUI_LIB_H_

#define _GUI_LIB_HID {"GUI_Lib.h", __DATE__, __TIME__, _REVISION($Revision: 1.109 $)}

#include "vision_box.h"

/* Check if compile for DSP or ARM */
#ifndef _TMS320C6X
	#define EXTFAR extern
	#include "vib_arm.h"
#else
	#define EXTFAR extern far
#endif

/******************************************************************************\
* Structures                                                                   *
\******************************************************************************/

//! Display device structure
typedef struct sGUI_DISPLAY
{
	unsigned char DeviceCount;					//!< # of devices
	VIB_DISPLAYDEVICE *VIB_DisplayDevice[6];	//!< Display device
	unsigned short x[6];						//!< Origin x
	unsigned short y[6];						//!< Origin y
} GUI_DISPLAY;

/******************************************************************************/
/*! \brief Color structure

	The #COLOR structure defines a color consisting of relative intensities of
	red, green and blue. (0; 0; 0) represents black, (255; 0; 0) represents red.
*******************************************************************************/
typedef struct sCOLOR
{
	unsigned char R; //!< R-component
	unsigned char G; //!< G-component
	unsigned char B; //!< B-component
} COLOR;
typedef COLOR *PCOLOR;	//!< Pointer to COLOR structure

//! \addtogroup Image Image Functions
//! \{
/******************************************************************************/
/*! \brief Color image structure

	The #CIMAGE (or formerly \p COLORIMAGE) structure defines a 24-bit color
	image consisting of three separate 8-bit images, which represent the RGB
	data. This structure can also be used to store YUV data. The point (0;0)
	is in the top left corner.
*******************************************************************************/
typedef struct sCIMAGE
{
	unsigned char *pR;	//!< Pointer to Red image
	unsigned char *pG;	//!< Pointer to Green image
	unsigned char *pB;	//!< Pointer to Blue image
	int Width;			//!< Width of image
	int Height;			//!< Height of image
} CIMAGE;
typedef CIMAGE *PCIMAGE;	//!< Pointer to CIMAGE structure

#define COLORIMAGE CIMAGE	//!< Color image structure \deprecated Use \ref CIMAGE.

/******************************************************************************/
/*! \brief Gray image structure

	The #YIMAGE structure defines an 8-bit gray (Y) image.
*******************************************************************************/
typedef struct sYIMAGE
{
	unsigned char *pY;	//!< Pointer to Y-image
	int Width;			//!< Width of image
	int Height;			//!< Height of image
} YIMAGE;
typedef YIMAGE *PYIMAGE;	//!< Pointer to YIMAGE structure

/******************************************************************************/
/*! \brief Binary image structure

	The #BIMAGE structure defines a 1-bit binary image.\n
	This image type is only supported by a few functions.
*******************************************************************************/
typedef struct sBIMAGE
{
	unsigned char *pP;	//!< Pointer to image pixels
	int Width;			//!< Width of image (pixel)
	int Height;			//!< Height of image
	int RowBytes;		//!< Number of bytes per row
} BIMAGE;
typedef BIMAGE *PBIMAGE;	//!< Pointer to BIMAGE structure

/******************************************************************************/
/*! \brief Single plane RGB image structure

	The #PIMAGE structure defines a single plane color image. (24 bit)\n
	This image type is only supported by a few functions.
*******************************************************************************/
typedef struct sPIMAGE
{
	unsigned char *pP;	//!< Pointer to RGB-image
	int Width;			//!< Width of image (pixel)
	int Height;			//!< Height of image
	int RowBytes;		//!< Number of bytes per row
} PIMAGE;
typedef PIMAGE *PPIMAGE;	//!< Pointer to PIMAGE structure

//! \}

//! Status box structure (private)
typedef struct sSTATUSBOX
{
	int Style;			//!< Border style
	int TxtPos;			//!< y-position to print text
	CIMAGE colorBox;	//!< Pointer to image
} STATUSBOX;
typedef STATUSBOX *PSTATUSBOX; //!< Pointer to STATUSBOX structure

//! Status box structure (gray) (private)
typedef struct sSTATUSBOXY
{
	int Style;	//!< Border style
	int TxtPos;	//!< y-position to print text
	YIMAGE yBox;//!< Pointer to image
} STATUSBOXY;
typedef STATUSBOXY *PSTATUSBOXY; //!< Pointer to STATUSBOXY structure

//! Single point structure
typedef struct sPOINT
{
	int x;	//!< x-position (column)
	int y;	//!< y-position (row)
} POINT;

//! \addtogroup Text
//! \{

//! Font styles
enum eGUI_FONT_STYLE
{
	GUI_FSNORMAL = 0,	//!< Normal style
	GUI_FSBOLD,			//!< Bold style
	GUI_FSSHADOW,		//!< Shadow style
	GUI_FSINVERT,		//!< Inverted style (foreground <-> background)
	GUI_FSEXTEND		//!< Extended style (different styles in one text line)
};

//! Vector font structure
typedef struct sFONT
{
	int    FontFace;	//!< One of #eGUI_VECTORFONT
	short *Ascii;		//!< Font data and metrics
	short *Greek;		//!< Greek characters
	short *Cyrillic;	//!< Cyrillic characters
	float  HScale;		//!< Horizontal scale factor
	float  VScale;		//!< Vertical scale factor
	float  Shear;		//!< Slope coefficient:\n 0: Normal\n >0: Italic
	int    Thickness;	//!< Letters thickness
	float  dx;			//!< Horizontal interval between letters
	int    LineType;	//!< Type of the strokes.\n 1 | 4: 4-connected line\n 8: 8-connected line\n 16 | GUI_AA: Anti-aliased line
} FONT;

/******************************************************************************/
/*! \brief Text parameter structure for text output

	This structure sets the style of printing text into an image.\n
	See \ref Text for more information.
*******************************************************************************/
typedef struct sTEXTPARAMETER
{
	int    Front;		//!< If set, text is drawn in TEXTPARAMETER::FrontCol
	int    Back;		//!< If set, background is drawn in TEXTPARAMETER::BackCol
	int    Scale;		//!< Scale factor (default 1)
	int    CharWidth;	//!< Character width (default 8)
	int    CharHeight;	//!< Character height (default 16)
	int    Style;		//!< Font style (#eGUI_FONT_STYLE)
	void  *Font;		//!< Pointer to bitmap font table
	FONT  *VecFont;		//!< Pointer to vector font structure (or \p NULL)
	void  *FtFont;		//!< Pointer to FreeType font (or \p NULL)
	COLOR  FrontCol;	//!< Foreground color
	COLOR  BackCol;		//!< Background color
} TEXTPARAMETER;
typedef TEXTPARAMETER *PTEXTPARAMETER; //!< Pointer to TEXTPARAMETER structure

//! \}

/******************************************************************************\
* DIALOG                                                                       *
\******************************************************************************/
//! \addtogroup Dialog
//! \{

//! Dialog constants
enum eDLG_CONST
{
	GUI_MAX_ACCEL = 64 //!< Maximum number of keyboard accelerators
};

//! \e Static dialog item types
enum eDLG_ITEM_S
{
	ITEM_TEXT = 0,		//!< \e Text item
	ITEM_LABEL,			//!< \e Label item
	ITEM_BORDER,		//!< \e Border item
	ITEM_ICON,			//!< (Animated) \e Icon item
	ITEM_DTEXT,			//!< \e DynamicText item
	ITEM_TEXTBOX,		//!< \e TextBox item
	ITEM_SBUTTON,		//!< \e StaticButton item
	ITEM_SPROGRESS,		//!< \e Progress item
	ITEM_SCHECK,		//!< \e CheckMark item
	ITEM_SFRAME			//!< \e Frame item
};

//! \e Dynamic dialog item types
enum eDLG_ITEM_D
{
	ITEM_TBUTTON = 0,	//!< \e Button item
	ITEM_ABUTTON,		//!< (Animated) \e IconButton item
	ITEM_CBBUTTON,		//!< \e CallBackButton item
	ITEM_CHECK,			//!< \e CheckBox item
	ITEM_SEDIT,			//!< \e StringEditBox item
	ITEM_VEDIT,			//!< \e ValueEditBox item
	ITEM_SLIDER,		//!< \e Slider item
	ITEM_EDITSLIDER,	//!< \e EditSlider item
	ITEM_SELECT,		//!< \e SelectBox
	ITEM_FILESELECT,	//!< \e FileSelectBox item
	ITEM_CHOICE,		//!< \e ChoiceBox item
	ITEM_CHECKICON,		//!< \e CheckIcon item
	ITEM_AREA,			//!< \e Area item
	ITEM_LOGBOX,		//!< \e LogBox item
	ITEM_PAGESEL,		//!< \e PageSelector item
	ITEM_LIST,			//!< \e ListBox item
	ITEM_VSPIN,			//!< \e ValueSpinBox item
	ITEM_UNKNOWN = 99	//!< Unknown item
};

//! Pointer to \e static dialog item
typedef struct sDLG_ITEMS *pDLG_ITEMS;

//! \brief \e Static dialog item
//!
//! This structure is internally used by the \ref Dialog.
//! Do not modify it directly! Use \ref ItemHandling.
typedef struct sDLG_ITEMS
{
	int Type;			//!< Item type
	pDLG_ITEMS Next;	//!< Next item
	int Enabled;		//!< Item state (#eDLG_ITEM_STATE)
	int Page;			//!< Dialog page
} DLG_ITEMS;

//! Pointer to \e dynamic dialog item
typedef struct sDLG_ITEMD *pDLG_ITEMD;

//! \brief \e Dynamic dialog item
//!
//! This structure is internally used by the \ref Dialog.
//! Do not modify it directly! Use \ref ItemHandling.
typedef struct sDLG_ITEMD
{
	int Type;			//!< Item type
	pDLG_ITEMD Next;	//!< Next item
	pDLG_ITEMD Prev;	//!< Previous item
	int ID;				//!< Item ID
	int Selected;		//!< If 1, item is selected
	int Enabled;		//!< Item state (#eDLG_ITEM_STATE)
	TEXTPARAMETER TP;	//!< Text parameter of item
	int Page;			//!< Dialog page
} DLG_ITEMD;

//! \brief Dialog main structure
//!
//! This structure is internally used by the \ref Dialog.
//! Do not modify it directly! Use \ref DialogWork.
typedef struct sGUI_DLG
{
	pDLG_ITEMS Static;	//!< List of static items
	pDLG_ITEMD Dynamic;	//!< List of dynamic items
	CIMAGE rgbDlg;		//!< Internal background image
	COLOR BackCol;		//!< Background color
	COLOR GradCol[4];	//!< Title gradient color
	TEXTPARAMETER TP;	//!< Parameter for background of dialog window
	char Flags;			//!< Flags for dialog style (#eDLG_FLAG)
	char Changed;		//!< Value of one or more items has been changed
	char Enabled;		//!< Dialog is enabled
	int PosX;			//!< Mouse position x
	int PosY;			//!< Mouse position y
// private:
	int x;				//!< x position (private)
	int y;				//!< y position (private)
	short Focus;		//!< ID of selected item (private)
	short LastFocus;	//!< ID of previously selected item (private)
	int Page;			//!< Current page (private)
	CIMAGE *BackImage;	//!< Background image (private)
	char Refresh;		//!< (private)
	char Modal;			//!< Dialog is modal (private)
	char Title[64];		//!< Title string (private)
	char AccelList[GUI_MAX_ACCEL]; //!< List of keyboard shortcuts (private)
	short IDList[GUI_MAX_ACCEL];   //!< List of corresponding IDs (private)
} GUI_DLG;

//! \brief Dialog return states
//!
//! \sa GUI_DlgWork()
enum eDLG_STATE
{
	DLG_EOF =			 0,	//!< No action
	DLG_ABORT =			-1,	//!< Dialog aborted (ESC)
	DLG_FOCUS_CHANGED = -2,	//!< Focus changed to another item
	DLG_VALUE_CHANGED = -3,	//!< Value of active item changed
	DLG_MOUSE_PRESSED = -4	//!< Mouse button pressed
};

//! \brief Dialog flags
//!
//! \sa GUI_DlgSetFlags()
enum eDLG_FLAG
{
	DLG_ALLPAGES =		  -1,	//!< Show (in) all dialog pages
	DLG_NOSHADOW =		0x01,	//!< Draw no shadow behind dialog window
	DLG_HIGHLIGHT =		0x02,	//!< Special highlight of active item (edit box)
	DLG_NOBBORDER =		0x04,	//!< Draw no black border around buttons
	DLG_ALTDISABLE =	0x08,	//!< Alternative visualization for disabled items
	DLG_GRADIENT =		0x10,	//!< Use window title with gradient style
	DLG_NOSINGLECLICK =	0x20	//!< Select an item before execution
};

//! \brief Dialog item states
//!
//! \sa GUI_DlgSetDItemState()\n GUI_DlgSetSItemState()
enum eDLG_ITEM_STATE
{
	DLG_I_INVISIBLE = 0,	//!< Item is invisible
	DLG_I_ENABLED =   1,	//!< Item is enabled (default)
	DLG_I_DISABLED =  2		//!< Item is disabled
};

//! \brief \e EditSlider types
//!
//! \sa GUI_DlgAddEditSlider()
enum eGUI_ES_TYPE
{
	DLG_ES_LINEAR =      0,	//!< Linear slider
	DLG_ES_LOGARITHMIC = 1,	//!< Logarithmic slider
	GUI_ESLINEAR =       0,	//!< Linear slider
	GUI_ESLOGARITHMIC =  1	//!< Logarithmic slider
};

//! \brief \e ChoiceBox styles
//!
//! \sa GUI_DlgAddChoiceBox()
enum eGUI_CB_STYLE
{
	GUI_CBHOR = 0,		//!< Horizontal style
	GUI_CBVER = 1		//!< Vertical style
};

//! \brief \e ProgressBar styles
//!
//! \sa GUI_DlgAddProgress()
enum eGUI_PB_STYLE
{
	GUI_PBSOLID = 0,	//!< Solid style
	GUI_PBGRAD =  1		//!< Gradient style
};

//! \brief \e PageSelector styles
//!
//! \sa GUI_DlgSetPageSelectorStyle()
enum eGUI_PS_STYLE
{
	GUI_PSTOP =          0,	//!< Top position (Double line)
	GUI_PSBOTTOM =       1,	//!< Bottom position (Double line)
	GUI_PSTOPSINGLE =    2,	//!< Top position (Single line)
	GUI_PSBOTTOMSINGLE = 3	//!< Bottom position (Single line)
};
//! \}

/******************************************************************************\
* Enumerations                                                                 *
\******************************************************************************/

/******************************************************************************/
/*! \brief Language strings

	There is a 'switch' to choose the language of some GUI elements like
	GUI_MessageBox().\n
	To select German language set the global integer variable
	#GUI_Language = #GUI_DEUTSCH, to select English language set
	#GUI_Language = #GUI_ENGLISH.
*******************************************************************************/
enum eGUI_LANGUAGE
{
	GUI_DEUTSCH = 0, //!< German language
	GUI_ENGLISH = 1  //!< English language
//	GUI_FRANCAISE = 2 // not yet
};

//! \addtogroup RECT
//! \{

//! \brief Border styles
//!
//! \sa GUI_Border()
enum eGUI_BORDER_STYLE
{
	GUI_BSNONE = 0,		//!< No border
	GUI_BSSINGLE,		//!< Single line
	GUI_BSSINGLEINV,	//!< Single line, inverted
	GUI_BSDOUBLE,		//!< Double line
	GUI_BSDOUBLEINV,	//!< Double line, inverted
	GUI_BSTWOCOLOR,		//!< Two colored lines
	GUI_BSTWOCOLORINV,	//!< Two colored lines, inverted
	GUI_BSBLACKFRAME=16,//!< Additional black frame
	GUI_BSGRAYFRAME =32	//!< Additional gray frame
};
//! \}

//! \addtogroup MBox
//! \{

//! \brief MessageBox styles
//!
//! \sa GUI_MessageBox()
enum eGUI_MB_STYLE
{
	GUI_MBSIMPLE = 0,	//!< The message box shows a simple text message and returns immediately
	GUI_MBOK =     1,	//!< The message box contains one push button: OK
	GUI_MBYESNO =  2	//!< The message box contains two push buttons: Yes and No
};
//! \}

//! \addtogroup COLOR
//! \{

//! Color codings
enum eGUI_COLOR_CODING
{
	GUI_NOCOLOR =	 0,
	GUI_BINARY =	 1, //!< Binary, 1 bit per pixel
	GUI_MONO8 =		10, //!< Monochrome, 8 bit per pixel
	GUI_MONO16 =	11, //!< Monochrome, 16 bit per pixel
	GUI_MONO24 =	12, //!< Monochrome, 24 bit per pixel
	GUI_MONO32 =	13, //!< Monochrome, 32 bit per pixel
	GUI_YUV8411 =	20, //!< YUV
	GUI_YUV8422 =	21, //!< YUV, 16 bit per pixel (default color)
	GUI_YUV8444 =	22, //!< YUV
	GUI_RGB8 =		30, //!< RGB, 8 bit per color, 24 bit per pixel
	GUI_RGB16 =		31, //!< RGB, 16 bit per color
	GUI_BAYER =		40, //!< Bayer pattern
	GUI_UNKNOWNC =	99  //!< Unknown color coding
};

//! Color Formats
enum eGUI_COLOR_FORMAT
{
	RGB,
	YUV
};
//! \}

//! \addtogroup VectorText
//! \{

//! \brief Vector font faces
//!
//! \sa GUI_InitFont()
enum eGUI_VECTORFONT
{
	FONT_HERSHEY_SIMPLEX = 0,	//!< Normal size sans-serif font
	FONT_HERSHEY_PLAIN,			//!< Small size sans-serif font
	FONT_HERSHEY_DUPLEX,		//!< More complex normal size sans-serif font
	FONT_HERSHEY_COMPLEX,		//!< Normal size serif font
	FONT_HERSHEY_TRIPLEX,		//!< More complex normal size serif font
	FONT_HERSHEY_COMPLEX_SMALL,	//!< Smaller version of \p FONT_HERSHEY_COMPLEX
	FONT_HERSHEY_SCRIPT_SIMPLEX,//!< Hand-writing style font
	FONT_HERSHEY_SCRIPT_COMPLEX,//!< More complex hand-writing style font
	FONT_ITALIC = 16			//!< Font flags
};
//! \}

//! \addtogroup LINE2
//! \{

//! Complex line functions constants
enum eGUI_CLF_CONST
{
	GUI_AA =     16,	//!< Anti-aliased line style
	GUI_FILLED = -1		//!< Object is filled
};
//! \}

//! \addtogroup BMP
//! \{

//! Bitmap constants
enum eGUI_BMP_CONST
{
	BMP_HEADERSIZE =   54,	//!< Size of BMP header
	BMP_COLTABSIZE = 1024	//!< Size of BMP color table
};
//! \}

//! Error codes
enum eGUI_ERROR_CODE
{
	GUI_E_OK        =  0,	//!< No error
	GUI_E_NO_SRC    = -1,	//!< No source object
	GUI_E_NO_DST    = -2,	//!< No destination object
	GUI_E_COORDS    = -3,	//!< Coordinates out of bounds
	GUI_E_MEMORY    = -4,	//!< Not enough memory available
	GUI_E_NO_FILE   = -5,	//!< File not found
	GUI_E_BAD_VALUE = -6,	//!< Bad parameter value
	GUI_E_UNDEFINED = -999	//!< Undefined error
};

/******************************************************************************\
* External definitions                                                         *
\******************************************************************************/

EXTFAR COLOR rgbRed;
EXTFAR COLOR rgbGreen;
EXTFAR COLOR rgbYellow;
EXTFAR COLOR rgbCyan;
EXTFAR COLOR rgbMagenta;
EXTFAR COLOR rgbBlue;
EXTFAR COLOR rgbBlack;
EXTFAR COLOR rgbWhite;
EXTFAR COLOR rgbDkBlue;
EXTFAR COLOR rgbCoolBlue;
EXTFAR COLOR rgbGray50;
EXTFAR COLOR rgbGradBlue[4];
EXTFAR COLOR rgbGradBlack[4];
EXTFAR COLOR rgbGradLight[4];

EXTFAR COLOR yuvRed;
EXTFAR COLOR yuvGreen;
EXTFAR COLOR yuvYellow;
EXTFAR COLOR yuvBlue;
EXTFAR COLOR yuvBlack;
EXTFAR COLOR yuvWhite;
EXTFAR COLOR yuvDkBlue;
EXTFAR COLOR yuvCoolBlue;
EXTFAR COLOR yuvGray50;

EXTFAR int GUI_Language;
EXTFAR int GUI_MBShadow;
EXTFAR int GUI_MBGradient;
EXTFAR unsigned char GUI_ColorFormat;

//! \addtogroup BitmapText
//! \{
EXTFAR unsigned char *GUI_SysFont; //!< System font
EXTFAR unsigned char *GUI_LGFont;  //!< Letter Gothic font

//! \}
//! \addtogroup FreeType
//! \{
EXTFAR int GUI_FTVeraSize;				//!< Size of Vera Sans font
EXTFAR int GUI_FTVeraMonoSize;			//!< Size of Vera Sans Mono font
EXTFAR unsigned char GUI_FTVera[];		//!< Data of Vera Sans font
EXTFAR unsigned char GUI_FTVeraMono[];	//!< Data of Vera Sans Mono font

//! \}

EXTFAR const char *GUI_LibName;
EXTFAR const char *GUI_LibVersion;
EXTFAR const char *GUI_LibDate;

EXTFAR GUI_DISPLAY *GuiActiveDisplay;

/******************************************************************************\
* Prototypes                                                                   *
\******************************************************************************/

#ifdef __cplusplus
extern "C" {
#endif

//! \addtogroup DialogCreate
//! \{

//! \brief Call-back function for GUI_DlgAddCBButton()
//! \param pData Data that is sent to the function and can be modified
typedef void(*GUI_FxnCallback)(void *pData);
//! Get coordinates function
typedef int (*GUI_FxnDlgGetCoord)(int *px, int *py);
//! \}

void GUI_Init(void);
int  GUI_GetLibVersion(int *pMajor, int *pMinor);
void *GUI_MemAlloc(unsigned int Size);
void GUI_MemFree(void *ptr, unsigned int Size);

//! \name AVI Functions
//! \{
int GUI_AVIReadHeader(int Device, const char *pFilename, int *pWidth, int *pHeight, int *pDepth, int *pFrames);
int GUI_AVIReadHeaderMem(const void *pMem, int *pWidth, int *pHeight, int *pDepth, int *pFrames);
unsigned char *GUI_AVICreateHeader(int Width, int Height, int Depth, int Frames, int *pSize);
unsigned char *GUI_AVICreateIndex(int Width, int Height, int Depth, int Frames, int *pSize);
int GUI_AVICalcSize(const void *pHeader);
int GUI_AVIReadFile(int Device, const char *pFilename, CIMAGE *pImages, int Frames);
int GUI_AVIReadFileY(int Device, const char *pFilename, YIMAGE *pImages, int Frames);
int GUI_AVIWriteFile(int Device, const char *pFilename, CIMAGE *pImages, int Frames);
int GUI_AVIWriteFileY(int Device, const char *pFilename, YIMAGE *pImages, int Frames);
int GUI_AVICreateFile(int Device, const char *pFilename, int Width, int Height, int Depth, int Frames);
int GUI_AVICreateFileC(int Device, const char *pFilename, const CIMAGE *pImages, int Frames);
int GUI_AVICreateFileY(int Device, const char *pFilename, const YIMAGE *pImages, int Frames);
int GUI_AVICreateFileMem(void *pBuffer, int Width, int Height, int Depth, int Frames);
int GUI_AVICreateFileMem2(void *pBuffer, const void *pHeader);
int GUI_AVIReadImage(int Device, const char *pFilename, CIMAGE *pImage, int Frame);
int GUI_AVIReadImageY(int Device, const char *pFilename, YIMAGE *pImage, int Frame);
int GUI_AVIWriteImage(int Device, const char *pFilename, const CIMAGE *pImage, int Frame);
int GUI_AVIWriteImageY(int Device, const char *pFilename, const YIMAGE *pImage, int Frame);
int GUI_AVIWriteImageMem(void *pMem, const CIMAGE *pImage, int Frame);
int GUI_AVIWriteImageMemY(void *pMem, const YIMAGE *pImage, int Frame);
int GUI_AVIToCImage(CIMAGE *pImage, const void *pMem, int StartPos);
int GUI_AVIToYImage(YIMAGE *pImage, const void *pMem, int StartPos);
int GUI_AVIFromCImage(const CIMAGE *pImage, void *pMem, int StartPos);
int GUI_AVIFromYImage(const YIMAGE *pImage, void *pMem, int StartPos);
int GUI_AVIGetFrameOffset(const void *pMem, int Frame);
//! \}

//! \name BMP Functions
//! \{
int GUI_ReadCImage(int Device, const char *pFilename, CIMAGE *pImage);
int GUI_ReadCImageMem(const void *pMem, CIMAGE *pImage);
int GUI_WriteCImage(int Device, const char *pFilename, const CIMAGE *pImage);
int GUI_WriteCImageMem(void *pMem, const CIMAGE *pImage);
int GUI_ReadYImage(int Device, const char *pFilename, YIMAGE *pImage);
int GUI_ReadYImageMem(const void *pMem, YIMAGE *pImage);
int GUI_WriteYImage(int Device, const char *pFilename, const YIMAGE *pImage);
int GUI_WriteYImageMem(void *pMem, const YIMAGE *pImage);
int GUI_ReadBImage(int Device, const char *pFilename, BIMAGE *pImage);
int GUI_ReadBImageMem(const void *pMem, BIMAGE *pImage);
int GUI_ReadPImage(int Device, const char *pFilename, PIMAGE *pImage);
int GUI_ReadPImageMem(const void *pMem, PIMAGE *pImage);
int GUI_WriteBImage(int Device, const char *pFilename, const BIMAGE *pImage);
int GUI_WriteBImageMem(void *pMem, const BIMAGE *pImage);
int GUI_GetBMPInfo(int Device, const char *pFilename, int *pWidth, int *pHeight, int *pDepth);
int GUI_GetBMPInfoMem(const void *pMem, int *pWidth, int *pHeight, int *pDepth);
CIMAGE GUI_ReadNewCImage(int Device, const char *pFilename);
CIMAGE GUI_ReadNewCImageMem(const void *pMem);
YIMAGE GUI_ReadNewYImage(int Device, const char *pFilename);
YIMAGE GUI_ReadNewYImageMem(const void *pMem);
void GUI_GenerateBMPHeaderRGB(unsigned char *BMPBuffer, const CIMAGE *pImage);
void GUI_GenerateBMPHeaderY(unsigned char *BMPBuffer, const YIMAGE *pImage);
void GUI_GenerateBMPHeaderB(unsigned char *BMPBuffer, const BIMAGE *pImage);
//! \}

//! Deprecated for GUI_ReadCImage()
#define GUI_ReadColorImage(Device, pFilename, pImage) GUI_ReadCImage(Device, pFilename, pImage)
//! Deprecated for GUI_WriteCImage()
#define GUI_WriteColorImage(Device, pFilename, pImage) GUI_WriteCImage(Device, pFilename, pImage)

//! \name DirBox Functions
//! \{
int GUI_DirBox(CIMAGE *pImage, int Device, int x, int y, int Width, int Height, char FileName[], FILE *fKB);
int GUI_DirBoxY(YIMAGE *pImage, int Device, int x, int y, int Width, int Height, char FileName[], FILE *fKB);
int GUI_DirBoxEx(CIMAGE *pImage, int Device, int x, int y, int Width, int Height,
	FILE *fKB, unsigned char Flags, FILEINFO *pFInfo);
int GUI_DirBoxExY(YIMAGE *pImage, int Device, int x, int y, int Width, int Height,
	FILE *fKB, unsigned char Flags, FILEINFO *pFInfo);
//! \}

//! \name Basic Functions
//! \{
void GUI_Button(CIMAGE *pImage, int x, int y, int Width, int Height, const char *pText, int Style);
void GUI_Button2(CIMAGE *pImage, int x, int y, int Width, int Height, const char *pText, int Style);
void GUI_ButtonY(YIMAGE *pImage, int x, int y, int Width, int Height, const char *pText, int Style);
void GUI_Button2Y(YIMAGE *pImage, int x, int y, int Width, int Height, const char *pText, int Style);
void GUI_ButtonG(CIMAGE *pImage, int x, int y, int Width, int Height, const char *pText, int Style, COLOR Col[4]);
void GUI_ButtonG2(CIMAGE *pImage, int x, int y, int Width, int Height, const char *pText, int Style, COLOR Col[4]);
void GUI_ButtonGY(YIMAGE *pImage, int x, int y, int Width, int Height, const char *pText, int Style, unsigned char Col[4]);
void GUI_ButtonG2Y(YIMAGE *pImage, int x, int y, int Width, int Height, const char *pText, int Style, unsigned char Col[4]);
void GUI_ButtonEx(CIMAGE *pImage, int x, int y, int Width, int Height, const char *pText, int Style, COLOR Col[4], int Underscore, TEXTPARAMETER *pTP);
void GUI_ButtonExY(YIMAGE *pImage, int x, int y, int Width, int Height, const char *pText, int Style, unsigned char Col[4], int Underscore, TEXTPARAMETER *pTP);
int  GUI_TextBox(CIMAGE *pImage, int x, int y, int Width, const char *pText, int Style, int Filled);
int  GUI_TextBoxY(YIMAGE *pImage, int x, int y, int Width, const char *pText, int Style, int Filled);
int  GUI_EditBox(CIMAGE *pImage, int x, int y, int Width, char *pText, FILE *fKB, int Style, int Filled);
int  GUI_EditBox2(CIMAGE *pImage, int x, int y, int Width, char *pText, FILE *fKB, int Style, int Filled);
int  GUI_EditBoxY(YIMAGE *pImage, int x, int y, int Width, char *pText, FILE *fKB, int Style, int Filled);
int  GUI_EditBox2Y(YIMAGE *pImage, int x, int y, int Width, char *pText, FILE *fKB, int Style, int Filled);
void GUI_DrawEditBox(CIMAGE *pImage, int x, int y, int Width, const char *pText, int Style, int Filled, int Cursor);
void GUI_DrawEditBoxY(YIMAGE *pImage, int x, int y, int Width, const char *pText, int Style, int Filled, int Cursor);
void GUI_CheckMark(CIMAGE *pImage, int x, int y, int Width, int Height, int Checked);
void GUI_CheckMarkY(YIMAGE *pImage, int x, int y, int Width, int Height, int Checked);
void GUI_CheckBox(CIMAGE *pImage, int x, int y, int Width, const char *pText, int Style, int Checked);
void GUI_CheckBox2(CIMAGE *pImage, int x, int y, int Width, int Height, const char *pText, int Style, int Checked);
void GUI_CheckBoxG(CIMAGE *pImage, int x, int y, int Width, int Height, const char *pText, int Style, int Checked, COLOR Col[4]);
void GUI_CheckBoxY(YIMAGE *pImage, int x, int y, int Width, const char *pText, int Style, int Checked);
void GUI_CheckBox2Y(YIMAGE *pImage, int x, int y, int Width, int Height, const char *pText, int Style, int Checked);
void GUI_CheckBoxGY(YIMAGE *pImage, int x, int y, int Width, int Height, const char *pText, int Style, int Checked, unsigned char Col[4]);
void GUI_Icon(CIMAGE *pImage, int x, int y, const CIMAGE *pIcon, int Style);
void GUI_IconY(YIMAGE *pImage, int x, int y, const YIMAGE *pIcon, int Style);
//! \}

//! \name MessageBox Functions
//! \{
int GUI_MessageBox(CIMAGE *pImage, const char *pText, FILE *fKB, int Type);
int GUI_MessageBoxY(YIMAGE *pImage, const char *pText, FILE *fKB, int Type);
int GUI_MessageBoxFormat(CIMAGE *pImage, FILE *fKB, int Type, const char *pFormat, ...);
int GUI_MessageBoxFormatY(YIMAGE *pImage, FILE *fKB, int Type, const char *pFormat, ...);
int GUI_MessageBoxEx(CIMAGE *pImage, FILE *fKB, const char *pText, const char *pTitle, const char *pButton1, const char *pButton2, const char *pButton3);
int GUI_ValueBox(CIMAGE *pImage, const char *pLabel, const char *pTitle, int *pValue, int Min, int Max, FILE *fKB);
int GUI_StringBox(CIMAGE *pImage, const char *pLabel, const char *pTitle, char *pString, int MaxLen, FILE *fKB);
int GUI_OpenFileBox(int Device, CIMAGE *pImage, const char *pTitle, char *pFilename, const char *pFilter, FILE *fKB);
int GUI_SaveFileBox(int Device, CIMAGE *pImage, const char *pTitle, char *pFilename, const char *pFilter, FILE *fKB);
int GUI_SelDirBox(int Device, CIMAGE *pImage, const char *pTitle, char *pPath, FILE *fKB);
void GUI_FileBoxShowDir(int Show);
void GUI_SetMBGradCol(COLOR GradCol[4]);
//! \}

//! \name Slider Functions
//! \{
void GUI_Slider(CIMAGE *pImage, int x, int y, int Width, int Height, int Pos);
void GUI_SliderY(YIMAGE *pImage, int x, int y, int Width, int Height, int Pos);
void GUI_DrawSliderTP(CIMAGE *pImage, int x, int y, int Width, int Height, int Pos, const TEXTPARAMETER *pTP);
int  GUI_EditSlider(CIMAGE *pImage, int x, int y, int Width, const char *pText,
	int *pValue, int nMin, int nMax, FILE *fKB);
void GUI_DrawEditSlider(CIMAGE *pImage, int x, int y, int Width, const char *pText,
	int Value, int nMin, int nMax, int Active, int Logarithmic);
void GUI_DrawEditSliderTP(CIMAGE *pImage, int x, int y, int Width, const char *pText,
	int Value, int nMin, int nMax, int Active, int Logarithmic, TEXTPARAMETER *pTP);
int  GUI_EditSliderY(YIMAGE *pImage, int x, int y, int Width, const char *pText,
	int *pValue, int nMin, int nMax, FILE *fKB);
void GUI_Progress(CIMAGE *pImage, int x, int y, int Width, int Height, int Pos, int Style);
void GUI_ProgressY(YIMAGE *pImage, int x, int y, int Width, int Height, int Pos, int Style);
//! \}

//! \name StatusBox Functions
//! \{
STATUSBOX GUI_StatusBox(int Width, int Height, int Style);
STATUSBOXY GUI_StatusBoxY(int Width, int Height, int Style);
void GUI_FreeStatusBox(STATUSBOX *pStatusBox);
void GUI_FreeStatusBoxY(STATUSBOXY *pStatusBox);
void GUI_DrawStatusBox(STATUSBOX *pStatusBox, CIMAGE *pImage, int x, int y);
void GUI_DrawStatusBoxY(STATUSBOXY *pStatusBox, YIMAGE *pImage, int x, int y);
void GUI_AppendStatusBox(STATUSBOX *pStatusBox, const char *pText);
void GUI_AppendStatusBoxY(STATUSBOXY *pStatusBox, const char *pText);
void GUI_UpdateStatusBox(STATUSBOX *pStatusBox, CIMAGE *pImage, const char *pText, int x, int y);
void GUI_UpdateStatusBoxY(STATUSBOXY *pStatusBox, YIMAGE *pImage, const char *pText, int x, int y);
//! \}

//! \name Editor Functions
//! \{
int GUI_Editor(CIMAGE *pImage, const char *cTitle, int x, int y, int Width, int Height,
	int MaxBuffer, char *pText, FILE *fKB, int *pFileLength, int *pExitKey);
int GUI_EditorY(YIMAGE *pImage, const char *cTitle, int x, int y, int Width, int Height,
	int MaxBuffer, char *pText, FILE *fKB, int *pFileLength, int *pExitKey);
//! \}

//! \name SelectBox Functions
//! \{
int GUI_SelectBox(CIMAGE *pImage, int x, int y, int Width, int Height,
	const char *pText, FILE *fKB, int Select);
int GUI_SelectBoxY(YIMAGE *pImage, int x, int y, int Width, int Height,
	const char *pText, FILE *fKB, int Select);
int GUI_SelectBoxEx(CIMAGE *pImage, int x, int y, int Width, int Height, int SelectType,
	const char *pText, FILE *fKB, int *pSelect, int *pKey, int *pVisSelect);
int GUI_ListBox(CIMAGE *pImage, int x, int y, int Width, int Height,
	char *pText[], int Elements, FILE *fKB, int Select);
int GUI_ListBoxEx(CIMAGE *pImage, int x, int y, int Width, int Height, int SelectType,
	char *pText[], int Elements, FILE *fKB, int *pSelect, int *pKey, int *pScrolled);
//! \}

//! \name Circle Functions
//! \{
void GUI_CircleM(CIMAGE *pImage, int xm, int ym, int r, const COLOR *pColor, int Flag);
void GUI_CircleMY(YIMAGE *pImage, int xm, int ym, int r, unsigned char Color, int Flag);
void GUI_CircleM2(CIMAGE *pImage, int xm, int ym, int r, int d, const COLOR *pColor, int Flag);
void GUI_CircleM2Y(YIMAGE *pImage, int xm, int ym, int r, int d, unsigned char Color, int Flag);
void GUI_FCircleM(CIMAGE *pImage, int xm, int ym, int r, const COLOR *pColor);
void GUI_FCircleMY(YIMAGE *pImage, int xm, int ym, int r, unsigned char Color);
//! \}

//! \name Cross Functions
//! \{
void GUI_Cross(CIMAGE *pImage, int xm, int ym, int Radius, const COLOR *pColor);
void GUI_CrossY(YIMAGE *pImage, int xm, int ym, int Radius, unsigned char Color);
void GUI_Cross2(CIMAGE *pImage, int xm, int ym, int Radius, const COLOR *pColor,
	int Thickness, int Mode);
void GUI_Cross2Y(YIMAGE *pImage, int xm, int ym, int Radius, unsigned char Color,
	int Thickness, int Mode);
void GUI_ICross(CIMAGE *pImage, int xm, int ym, int Radius);
void GUI_ICrossY(YIMAGE *pImage, int xm, int ym, int Radius);
//! \}

//! \name Complex Line Functions
//! \{
void GUI_Line2(CIMAGE *pImage, int x1, int y1, int x2, int y2, const COLOR *pColor, int Thickness, int LineType);
void GUI_Line2Y(YIMAGE *pImage, int x1, int y1, int x2, int y2, unsigned char Color,
	int Thickness, int LineType);
void GUI_Rectangle(CIMAGE *pImage, int x1, int y1, int x2, int y2, const COLOR *pColor, int Thickness, int LineType);
void GUI_RectangleY(YIMAGE *pImage, int x1, int y1, int x2, int y2, unsigned char Color,
	int Thickness, int LineType);
void GUI_Circle(CIMAGE *pImage, int x, int y, int Radius, const COLOR *pColor, int Thickness, int LineType);
void GUI_CircleY(YIMAGE *pImage, int x, int y, int Radius, unsigned char Color, int Thickness, int LineType);
void GUI_Ellipse(CIMAGE *pImage, int x, int y, int Width, int Height, int Angle,
	int StartAngle, int EndAngle, const COLOR *pColor, int Thickness, int LineType);
void GUI_EllipseY(YIMAGE *pImage, int x, int y, int Width, int Height,
	int Angle, int StartAngle, int EndAngle, unsigned char Color, int Thickness, int LineType);
void GUI_FillConvexPoly(CIMAGE *pImage, const POINT *pPts, int nPts, const COLOR *pColor, int LineType);
void GUI_FillConvexPolyY(YIMAGE *pImage, const POINT *pPts, int nPts, unsigned char Color, int LineType);
void GUI_PolyLine(CIMAGE *pImage, const POINT *pPts, int nPts, int Closed, const COLOR *pColor, int Thickness, int LineType);
void GUI_PolyLineY(YIMAGE *pImage, const POINT *pPts, int nPts, int Closed,
	unsigned char Color, int Thickness, int LineType);
//! \}
static inline POINT GUI_Point(int x, int y)
{
	POINT p;
	p.x = x;
	p.y = y;
	return p;
}

//! \name Simple Line Functions
//! \{
void GUI_Line(CIMAGE *pImage, int x1, int y1, int x2, int y2, const COLOR *pColor);
void GUI_LineY(YIMAGE *pImage, int x1, int y1, int x2, int y2, unsigned char Color);
int  GUI_LineClip(int *x1, int *y1, int *x2, int *y2, int Width, int Height);
void GUI_LineH(CIMAGE *pImage, int x1, int y, int x2, const COLOR *pColor);
void GUI_LineHY(YIMAGE *pImage, int x1, int y, int x2, unsigned char Color);
void GUI_LineV(CIMAGE *pImage, int x, int y1, int y2, const COLOR *pColor);
void GUI_LineVY(YIMAGE *pImage, int x, int y1, int y2, unsigned char Color);
void GUI_SetPoint(CIMAGE *pImage, int x, int y, const COLOR *pColor);
void GUI_SetPointY(YIMAGE *pImage, int x, int y, unsigned char Color);
COLOR GUI_GetPoint(const CIMAGE *pImage, int x, int y);
unsigned char GUI_GetPointY(const YIMAGE *pImage, int x, int y);
int GUI_GetBPixel(const BIMAGE *pImage, int x, int y);
void GUI_SetBPixel(BIMAGE *pImage, int x, int y, int Color);
//! \}

//! \name Rectangle Functions
//! \{
void GUI_Rect(CIMAGE *pImage, int x, int y, int Width, int Height, const COLOR *pColor);
void GUI_RectY(YIMAGE *pImage, int x, int y, int Width, int Height, unsigned char Color);
void GUI_Rect2(CIMAGE *pImage, int x, int y, int Width, int Height, int w, const COLOR *pColor);
void GUI_Rect2Y(YIMAGE *pImage, int x, int y, int Width, int Height, int w, unsigned char Color);
void GUI_FRect(CIMAGE *pImage, int x, int y, int Width, int Height, const COLOR *pColor);
void GUI_FRectY(YIMAGE *pImage, int x, int y, int Width, int Height, unsigned char Color);
void GUI_IRect(CIMAGE *pImage, int x, int y, int Width, int Height);
void GUI_IRectY(YIMAGE *pImage, int x, int y, int Width, int Height);
void GUI_FIRect(CIMAGE *pImage, int x, int y, int Width, int Height);
void GUI_FIRectY(YIMAGE *pImage, int x, int y, int Width, int Height);
void GUI_Frame(CIMAGE *pImage, int x, int y, int Width, int Height, const char *pText);
void GUI_FrameY(YIMAGE *pImage, int x, int y, int Width, int Height, const char *pText);
void GUI_Border(CIMAGE *pImage, int x, int y, int Width, int Height, int Style);
void GUI_BorderY(YIMAGE *pImage, int x, int y, int Width, int Height, int Style);
void GUI_SetWndTitleStyle(const TEXTPARAMETER *pTP, int Enabled);
void GUI_WndFrame(CIMAGE *pImage, const char *pTitle);
void GUI_WndFrameY(YIMAGE *pImage, const char *pTitle);
void GUI_WndFrame2(CIMAGE *pImage, const char *pTitle, const COLOR *pBackCol);
void GUI_WndFrame2Y(YIMAGE *pImage, const char *pTitle, unsigned char BackCol);
void GUI_WndFrameG(CIMAGE *pImage, const char *pTitle, const COLOR *pBackCol, COLOR GradCol[4]);
void GUI_WndFrameGY(YIMAGE *pImage, const char *pTitle, unsigned char BackCol, unsigned char GradCol[4]);
//! \}
static inline void GUI_Fill(CIMAGE *pImage, const COLOR *pColor)
	{ GUI_FRect(pImage, 0, 0, pImage->Width, pImage->Height, pColor); }
static inline void GUI_FillY(YIMAGE *pImage, unsigned char Color)
	{ GUI_FRectY(pImage, 0, 0, pImage->Width, pImage->Height, Color); }

//! \name Mirror Functions
//! \{
int GUI_MirrorXA(CIMAGE *pSrc, CIMAGE *pDst);
int GUI_MirrorXAY(YIMAGE *pSrc, YIMAGE *pDst);
int GUI_MirrorYA(CIMAGE *pSrc, CIMAGE *pDst);
int GUI_MirrorYAY(YIMAGE *pSrc, YIMAGE *pDst);
int GUI_MirrorXYA(CIMAGE *pSrc, CIMAGE *pDst);
int GUI_MirrorXYAY(YIMAGE *pSrc, YIMAGE *pDst);
//! \}

int GUI_Rotate90(const CIMAGE *pSrc, CIMAGE *pDst, int Direction);
int GUI_Rotate90Y(const YIMAGE *pSrc, YIMAGE *pDst, int Direction);

//! \name Scale Functions
//! \{
int GUI_ScaleImage(const CIMAGE *pSrc, CIMAGE *pDst, int Interpolation);
int GUI_ScaleImageY(const YIMAGE *pSrc, YIMAGE *pDst, int Interpolation);
int GUI_ScaleArea(const CIMAGE *pSrc, CIMAGE *pDst, int DstX, int DstY,
	int Width, int Height, int Interpolation);
int GUI_ScaleAreaY(const YIMAGE *pSrc, YIMAGE *pDst, int DstX, int DstY,
	int Width, int Height, int Interpolation);
int GUI_ScaleAreaNN(const CIMAGE *pSrc, CIMAGE *pDst, int DstX, int DstY, int Width, int Height);
int GUI_ScaleAreaNNY(const YIMAGE *pSrc, YIMAGE *pDst, int DstX, int DstY, int Width, int Height);
int GUI_ScaleArea2NNY(const YIMAGE *pSrc, YIMAGE *pDst, int SrcX, int SrcY, int Width, int Height);
int GUI_ScaleAreaBL(const CIMAGE *pSrc, CIMAGE *pDst, int DstX, int DstY, int Width, int Height);
int GUI_ScaleAreaBLY(const YIMAGE *pSrc, YIMAGE *pDst, int DstX, int DstY, int Width, int Height);
int GUI_ZoomImage(const CIMAGE *pSrc, CIMAGE *pDst, int VirtWidth, int VirtHeight,
	int VirtX, int VirtY, int Interpolation);
int GUI_ZoomImageNN(const CIMAGE *pSrc, CIMAGE *pDst, int VirtWidth, int VirtHeight, int VirtX, int VirtY);
int GUI_ZoomImageBL(const CIMAGE *pSrc, CIMAGE *pDst, int VirtWidth, int VirtHeight, int VirtX, int VirtY);
int GUI_ZoomAreaBL(const CIMAGE *pSrc, CIMAGE *pDst, int VirtWidth, int VirtHeight, int VirtX, int VirtY,
	int AreaWidth, int AreaHeight, int DstX, int DstY);
int GUI_ZoomAreaBLY(const YIMAGE *pSrc, YIMAGE *pDst, int VirtWidth, int VirtHeight, 
	int VirtX, int VirtY, int AreaWidth, int AreaHeight, int DstX, int DstY);
int GUI_ScaleAreaY2RGB(const YIMAGE *pSrc, CIMAGE *pDst, int DstX, int DstY,
	int Width, int Height, int Interpolation);
int GUI_ScaleAreaNNY2RGB(const YIMAGE *pSrc, CIMAGE *pDst, int DstX, int DstY,
	int Width, int Height);
//! \}
static inline int GUI_ScaleImageNN(const CIMAGE *pSrc, CIMAGE *pDst)
	{ return GUI_ScaleAreaNN(pSrc, pDst, 0, 0, pDst->Width, pDst->Height); }
static inline int GUI_ScaleImageNNY(const YIMAGE *pSrc, YIMAGE *pDst)
	{ return GUI_ScaleAreaNNY(pSrc, pDst, 0, 0, pDst->Width, pDst->Height); }
static inline int GUI_ScaleImageBL(const CIMAGE *pSrc, CIMAGE *pDst)
	{ return GUI_ScaleAreaBL(pSrc, pDst, 0, 0, pDst->Width, pDst->Height); }
static inline int GUI_ScaleImageBLY(const YIMAGE *pSrc, YIMAGE *pDst)
	{ return GUI_ScaleAreaBLY(pSrc, pDst, 0, 0, pDst->Width, pDst->Height); }

//! \name Color Conversion
//! \{
int GUI_YUV2CImage(const void *pSrc, int Width, int Height, CIMAGE *pImage);
int GUI_YUV2YImage(const void *pSrc, int Width, int Height, YIMAGE *pImage);
int GUI_Bayer2CImage(const void *pSrc, int Width, int Height, CIMAGE *pImage, int Flag);
int GUI_Bayer2CImageHQ(const void *pSrc, int Width, int Height, CIMAGE *pImage, int Flag);
int GUI_Bayer2YImage(const void *pSrc, int Width, int Height, YIMAGE *pImage, int Flag);
int GUI_PackedRGB2CImage(const void *pSrc, int Width, int Height, CIMAGE *pImage);
int GUI_CImage2PackedRGB(const CIMAGE *pImage, void *pDst, int Width, int Height);
int GUI_CImage2PackedRGB32(const CIMAGE *pImage, void *pDst, int Width, int Height);
int GUI_Y162YImage(const void *pSrc, int Width, int Height, YIMAGE *pImage, const unsigned char *pGammaTable);
int GUI_Y122YImage(const void *pSrc, int Width, int Height, YIMAGE *pImage,	const unsigned char *pGammaTable);
int GUI_Y2YImage(const void *pSrc, int Width, int Height, YIMAGE *pImage);
//! \}

//! \name Set and Convert Colors
//! \{
COLOR GUI_RGB(unsigned char R, unsigned char G, unsigned char B);
unsigned char GUI_RGB2Y(const COLOR *pRGBColor);
COLOR GUI_RGB2YUV(const COLOR *pRGBColor);
COLOR GUI_YUV2RGB(const COLOR *pYUVColor);
COLOR GUI_RGB2HSI(const COLOR *pRGBColor);
COLOR GUI_HSI2RGB(const COLOR *pHSIColor);
//! \}

//! \name Area Functions
//! \{
int GUI_CopyArea(const CIMAGE *pSrc, CIMAGE *pDst, int SrcX, int SrcY,
	int Width, int Height, int DstX, int DstY);
int GUI_CopyYArea(const YIMAGE *pSrc, YIMAGE *pDst, int SrcX, int SrcY,
	int Width, int Height, int DstX, int DstY);
int GUI_CopyYArea2RGB(const YIMAGE *pSrc, CIMAGE *pDst, int SrcX, int SrcY,
	int Width, int Height, int DstX, int DstY);
int GUI_CopyRGBArea2Y(const CIMAGE *pSrc, YIMAGE *pDst, int SrcX, int SrcY,
	int Width, int Height, int DstX, int DstY, char Mode);
//! \}
static inline int GUI_GetArea(const CIMAGE *pSrc, CIMAGE *pDst, int x, int y, int Width, int Height)
	{ return GUI_CopyArea(pSrc, pDst, x, y, pDst->Width, pDst->Height, 0, 0); }
static inline int GUI_GetYArea(const YIMAGE *pSrc, YIMAGE *pDst, int x, int y, int Width, int Height)
	{ return GUI_CopyYArea(pSrc, pDst, x, y, pDst->Width, pDst->Height, 0, 0); }
static inline int GUI_PutArea(const CIMAGE *pSrc, CIMAGE *pDst, int x, int y)
	{ return GUI_CopyArea(pSrc, pDst, 0, 0, pSrc->Width, pSrc->Height, x, y); }
static inline int GUI_PutYArea(const YIMAGE *pSrc, YIMAGE *pDst, int x, int y)
	{ return GUI_CopyYArea(pSrc, pDst, 0, 0, pSrc->Width, pSrc->Height, x, y); }

//! Alternative for GUI_GetYArea()
#define GUI_GetAreaY(pSrc, pDst, x, y, Width, Height) GUI_GetYArea(pSrc, pDst, x, y, Width, Height)
//! Alternative for GUI_PutYArea()
#define GUI_PutAreaY(pSrc, pDst, x, y) GUI_PutYArea(pSrc, pDst, x, y)
//! Alternative for GUI_CopyYArea()
#define GUI_CopyAreaY(pSrc, pDst, SrcX, SrcY, Width, Height, DstX, DstY) GUI_CopyYArea(pSrc, pDst, SrcX, SrcY, Width, Height, DstX, DstY)
//! Alternative for GUI_CopyYArea2RGB()
#define GUI_CopyAreaY2RGB(pSrc, pDst, SrcX, SrcY, Width, Height, DstX, DstY) GUI_CopyYArea2RGB(pSrc, pDst, SrcX, SrcY, Width, Height, DstX, DstY)
//! Alternative for GUI_CopyRGBArea2Y()
#define GUI_CopyAreaRGB2Y(pSrc, pDst, SrcX, SrcY, Width, Height, DstX, DstY, Mode) GUI_CopyRGBArea2Y(pSrc, pDst, SrcX, SrcY, Width, Height, DstX, DstY, Mode)

//! \name Image Functions
//! \{
CIMAGE GUI_CImage(unsigned char *pRImage, unsigned char *pGImage, unsigned char *pBImage,
				  int Width, int Height);
YIMAGE GUI_YImage(unsigned char *pYImage, int Width, int Height);
BIMAGE GUI_BImage(unsigned char *pBImage, int Width, int Height);
PIMAGE GUI_PImage(unsigned char *pPImage, int Width, int Height);
void GUI_FreeCImage(CIMAGE *pImage);
void GUI_FreeYImage(YIMAGE *pImage);
void GUI_FreeBImage(BIMAGE *pImage);
void GUI_FreePImage(PIMAGE *pImage);
//! \}

//! \name Display Functions
//! \{
GUI_DISPLAY GUI_NewDisplay(void);
int GUI_DisplayAddDevice(GUI_DISPLAY *pGuiDisplay, VIB_DISPLAYDEVICE *pDisplayDevice,
						 unsigned short PosX, unsigned short PosY);
void GUI_SetActiveDisplay(GUI_DISPLAY *pGuiDisplay);
GUI_DISPLAY *GUI_GetActiveDisplay(void);
void GUI_Display(const CIMAGE *pImage, int x, int y);
void GUI_DisplayY(const YIMAGE *pImage, int x, int y);
void GUI_DisplayArea(const CIMAGE *pImage,
					 unsigned short DstX,  unsigned short DstY,
					 unsigned short SrcX,  unsigned short SrcY,
					 unsigned short Width, unsigned short Height);
void GUI_DisplayAreaY(const YIMAGE *pImage,
					  unsigned short DstX,  unsigned short DstY,
					  unsigned short SrcX,  unsigned short SrcY,
					  unsigned short Width, unsigned short Height);
//! \}

//! \name Image Conversion Functions
//! \{
void GUI_CImage2YImage(const CIMAGE *pImageC, YIMAGE *pImageY, char Mode);
void GUI_CImage2BImage(const CIMAGE *pImageC, BIMAGE *pImageB, char Mode);
void GUI_CImage2PImage(const CIMAGE *pImageC, PIMAGE *pImageP);
void GUI_YImage2CImage(const YIMAGE *pImageY, CIMAGE *pImageC, char Mode);
void GUI_YImage2BImage(const YIMAGE *pImageY, BIMAGE *pImageB);
void GUI_YImage2BImageT(const YIMAGE *pImageY, BIMAGE *pImageB, int Threshold);
void GUI_BImage2CImage(const BIMAGE *pImageB, CIMAGE *pImageC, char Mode);
void GUI_BImage2CImageCol(const BIMAGE *pImageB, CIMAGE *pImageC, const COLOR *pDark, const COLOR *pLight);
void GUI_BImage2YImage(const BIMAGE *pImageB, YIMAGE *pImageY);
void GUI_BImage2YImageCol(const BIMAGE *pImageB, YIMAGE *pImageY,
	unsigned char Dark, unsigned char Light);
void GUI_PImage2CImage(const PIMAGE *pImageP, CIMAGE *pImageC);
CIMAGE GUI_RAW2CImage(const unsigned char *pImage, const unsigned char *pPalette, int Width, int Height);
void GUI_MarkColorFromY(const YIMAGE *pImageY, CIMAGE *pImageC, int Low, int High, const COLOR *pColor, int Mode);
//! \}

//! Deprecated for GUI_CImage()
#define GUI_ColorImage(pRImage, pGImage, pBImage, Width, Height) GUI_CImage(pRImage, pGImage, pBImage, Width, Height)
//! Deprecated for GUI_FreeCImage()
#define GUI_FreeColorImage(pImage) GUI_FreeCImage(pImage)

//! \name Functions for Creating Dialogs
//! \{
GUI_DLG GUI_DlgCreate(int Width, int Height, const char *pTitle);
int GUI_DlgCreate2(GUI_DLG *pDialog, int Width, int Height, const char *pTitle);
void GUI_DlgFree(GUI_DLG *pDialog);
DLG_ITEMS *GUI_DlgAddText(GUI_DLG *pDialog, int x, int y, const char *pLabel);
DLG_ITEMS *GUI_DlgAddLabel(GUI_DLG *pDialog, int x, int y, const char *pLabel, int Id);
DLG_ITEMS *GUI_DlgAddBorder(GUI_DLG *pDialog, int x, int y, int Width, int Height, int Style);
DLG_ITEMS *GUI_DlgAddIcon(GUI_DLG *pDialog, int x, int y, CIMAGE *pIcon);
DLG_ITEMS *GUI_DlgAddAnimIcon(GUI_DLG *pDialog, int x, int y, CIMAGE *pIconList, int NumIcons);
DLG_ITEMS *GUI_DlgAddDynamicText(GUI_DLG *pDialog, int x, int y, char *pString);
DLG_ITEMS *GUI_DlgAddTextBox(GUI_DLG *pDialog, int x, int y, int Width, int Height, const char *pString, int Style);
DLG_ITEMS *GUI_DlgAddStaticButton(GUI_DLG *pDialog, int x, int y, int Width, int Height, const char *pString, int Style);
DLG_ITEMS *GUI_DlgAddStaticGButton(GUI_DLG *pDialog, int x, int y, int Width, int Height, const char *pString, int Style, COLOR Col[4]);
DLG_ITEMS *GUI_DlgAddProgress(GUI_DLG *pDialog, int x, int y, int Width, int Height, int *pPos, int Style);
DLG_ITEMS *GUI_DlgAddCheckMark(GUI_DLG *pDialog, int x, int y, int Width, int Height, const char *pLabel, int *pState);
DLG_ITEMS *GUI_DlgAddFrame(GUI_DLG *pDialog, int x, int y, int Width, int Height, const char *pLabel);
DLG_ITEMD *GUI_DlgAddButton(GUI_DLG *pDialog, int x, int y, int Width, int Height, const char *pLabel, int Id);
DLG_ITEMD *GUI_DlgAddIconButton(GUI_DLG *pDialog, int x, int y, int Width, int Height, const char *pLabel, CIMAGE *pIcon, int Id);
DLG_ITEMD *GUI_DlgAddAnimButton(GUI_DLG *pDialog, int x, int y, int Width, int Height, const char *pLabel, CIMAGE *pIconList, int NumIcons, int Id);
DLG_ITEMD *GUI_DlgAddCBButton(GUI_DLG *pDialog, int x, int y, int Width, int Height, const char *pLabel, GUI_FxnCallback Fxn, void *pData, int Id);
DLG_ITEMD *GUI_DlgAddGButton(GUI_DLG *pDialog, int x, int y, int Width, int Height, const char *pLabel, COLOR Col[4], int Id);
DLG_ITEMD *GUI_DlgAddCheckBox(GUI_DLG *pDialog, int x, int y, int Width, const char *pLabel, int *pState, int Id);
DLG_ITEMD *GUI_DlgAddCheckBox2(GUI_DLG *pDialog, int x, int y, int Width, int Height, const char *pLabel, int *pState, int Id);
DLG_ITEMD *GUI_DlgAddGCheckBox(GUI_DLG *pDialog, int x, int y, int Width, int Height, const char *pLabel, int *pState, COLOR Col[4], int Id);
DLG_ITEMD *GUI_DlgAddSEditBox(GUI_DLG *pDialog, int x, int y, int Width, char *pString, int Id);
DLG_ITEMD *GUI_DlgAddSEditBox2(GUI_DLG *pDialog, int x, int y, int Width, char *pString, int Id);
DLG_ITEMD *GUI_DlgAddVEditBox(GUI_DLG *pDialog, int x, int y, int Width, int *pValue, int Min, int Max, int Id);
DLG_ITEMD *GUI_DlgAddVSpinBox(GUI_DLG *pDialog, int x, int y, int Width, int *pValue, int Min, int Max, int Id);
DLG_ITEMD *GUI_DlgAddSlider(GUI_DLG *pDialog, int x, int y, int Width, int Height, int *pPos, int Min, int Max, int Id);
DLG_ITEMD *GUI_DlgAddEditSlider(GUI_DLG *pDialog, int x, int y, int Width, const char *pLabel, int *pPos, int Min, int Max, int Id);
DLG_ITEMD *GUI_DlgAddSelectBox(GUI_DLG *pDialog, int x, int y, int Width, int Height, char *pText, int *pSelect, int Id);
DLG_ITEMD *GUI_DlgAddFileSelectBox(GUI_DLG *pDialog, int x, int y, int Width, int Height, int Device, char *pFilename, int Flags, const char *pFilter, int Id);
DLG_ITEMD *GUI_DlgAddListBox(GUI_DLG *pDialog, int x, int y, int Width, int Height, char *pText[], int Elements, int *pSelect, int Id);
DLG_ITEMD *GUI_DlgAddChoiceBox(GUI_DLG *pDialog, int x, int y, int Width, int Height, char *pText, int Style, int *pSelect, int Id);
DLG_ITEMD *GUI_DlgAddGChoiceBox(GUI_DLG *pDialog, int x, int y,	int Width, int Height, char *pText, int Style, int *pSelect, COLOR Col[4], int Id);
DLG_ITEMD *GUI_DlgAddCheckIcon(GUI_DLG *pDialog, int x, int y, int Width, int Height, const char *pLabel, CIMAGE *pIconList, int *pState, int Id);
DLG_ITEMD *GUI_DlgAddArea(GUI_DLG *pDialog, int x, int y, int Width, int Height, int Id);
DLG_ITEMD *GUI_DlgAddLogBox(GUI_DLG *pDialog, int x, int y, int Width, int Height, char *pText, int Id);
DLG_ITEMD *GUI_DlgAddPageSelector(GUI_DLG *pDialog, int x, int y, int Width, int Height, const char *pLabel, int Page, int Id);
int GUI_DlgAddAccel(GUI_DLG *pDialog, char Accel, int Id);
void GUI_DlgModifyText(DLG_ITEMS *pItem, int x, int y, const char *pLabel);
void GUI_DlgModifyBorder(DLG_ITEMS *pItem, int x, int y, int Width, int Height, int Style);
void GUI_DlgModifyIcon(DLG_ITEMS *pItem, int x, int y, CIMAGE *pIcon);
void GUI_DlgModifyAnimIcon(DLG_ITEMS *pItem, int x, int y, CIMAGE *pIconList, int NumIcons);
void GUI_DlgModifyTextBox(DLG_ITEMS *pItem, int x, int y, int Width, int Height, const char *pString, int Style);
void GUI_DlgModifyButton(DLG_ITEMD *pItem, int x, int y, int Width, int Height, const char *pLabel);
void GUI_DlgModifyIconButton(DLG_ITEMD *pItem, int x, int y, int Width, int Height, const char *pLabel, CIMAGE *pIcon);
void GUI_DlgModifyAnimButton(DLG_ITEMD *pItem, int x, int y, int Width, int Height, const char *pLabel, CIMAGE *pIconList, int NumIcons);
void GUI_DlgModifyGButton(DLG_ITEMD *pItem, int x, int y, int Width, int Height, const char *pLabel, COLOR Col[4]);
void GUI_DlgModifyCheckBox(DLG_ITEMD *pItem, int x, int y, int Width, int Height, const char *pLabel);
void GUI_DlgModifyGCheckBox(DLG_ITEMD *pItem, int x, int y, int Width, int Height, const char *pLabel, COLOR Col[4]);
void GUI_DlgModifySEditBox(DLG_ITEMD *pItem, int x, int y, int Width);
void GUI_DlgModifyVEditBox(DLG_ITEMD *pItem, int x, int y, int Width, int Min, int Max);
void GUI_DlgModifyVSpinBox(DLG_ITEMD *pItem, int x, int y, int Width, int Min, int Max);
void GUI_DlgModifySlider(DLG_ITEMD *pItem, int x, int y, int Width, int Height, int Min, int Max);
void GUI_DlgModifyEditSlider(DLG_ITEMD *pItem, int x, int y, int Width, const char *pLabel, int Min, int Max);
void GUI_DlgModifySelectBox(DLG_ITEMD *pItem, int x, int y, int Width, int Height, char *pText);
void GUI_DlgModifySelectBoxText(DLG_ITEMD *pItem, char *pText);
void GUI_DlgModifyFileSelectBox(DLG_ITEMD *pItem, int x, int y, int Width, int Height, int Device, int Flags, const char *pFilter);
void GUI_DlgModifyFileSelectBoxLine(DLG_ITEMD *pItem, int Select);
void GUI_DlgModifyListBox(DLG_ITEMD *pItem, int x, int y, int Width, int Height, char *pText[], int Elements);
void GUI_DlgModifyChoiceBox(DLG_ITEMD *pItem, int x, int y, int Width, int Height, char *pText, int Style);
void GUI_DlgModifyGChoiceBox(DLG_ITEMD *pItem, int x, int y, int Width, int Height, char *pText, int Style, COLOR Col[4]);
void GUI_DlgModifyCheckIcon(DLG_ITEMD *pItem, int x, int y, int Width, int Height, const char *pLabel, CIMAGE *pIconList);
void GUI_DlgModifyArea(DLG_ITEMD *pItem, int x, int y, int Width, int Height);
void GUI_DlgModifyLogBox(DLG_ITEMD *pItem, int x, int y, int Width, int Height);
void GUI_DlgModifyPageSelector(DLG_ITEMD *pItem, int x, int y, int Width, int Height, const char *pLabel, int Page);
void GUI_DlgSetPageSelectorStyle(DLG_ITEMD *pItem, int Style);
void GUI_DlgSetEditSliderType(DLG_ITEMD *pItem, int Type);
void GUI_DlgSetSliderType(DLG_ITEMD *pItem, int Type);
void GUI_DlgChangeText(DLG_ITEMS *pItem, const char *pLabel);
//! \}

EXTFAR GUI_FxnDlgGetCoord GUI_DlgGetCoord;

//! \name Functions for Handling Dialogs
//! \{
void GUI_DlgRefresh(GUI_DLG *pDialog);
void GUI_DlgRefreshItem(GUI_DLG *pDialog, DLG_ITEMD *pDItem);
void GUI_DlgRefreshSItem(GUI_DLG *pDialog, DLG_ITEMS *pSItem);
void GUI_DlgPaint(GUI_DLG *pDialog, CIMAGE *pImage, int x, int y);
void GUI_DlgPaint2(GUI_DLG *pDialog, int x, int y);
void GUI_DlgPaintS(GUI_DLG *pDialog, CIMAGE *pImage, int x, int y);
void GUI_DlgUpdate(GUI_DLG *pDialog, CIMAGE *pImage, int x, int y);
void GUI_DlgUpdate3(GUI_DLG *pDialog, DLG_ITEMD *pItem, int x, int y);
void GUI_DlgUpdateS(GUI_DLG *pDialog, CIMAGE *pImage, int x, int y);
void GUI_DlgDraw(GUI_DLG *pDialog, CIMAGE *pImage, int x, int y, int Refresh, int Shadow);
void GUI_DlgShow(GUI_DLG *pDialog);
int  GUI_DlgModal(GUI_DLG *pDialog, CIMAGE *pImage, int x, int y, FILE *fKB);
int  GUI_DlgWork(GUI_DLG *pDialog, int nKey);
void GUI_DlgStoreValues(GUI_DLG *pDialog);
void GUI_DlgRestoreValues(GUI_DLG *pDialog);
int  GUI_DlgGetSelectedID(GUI_DLG *pDialog);
int  GUI_DlgGetLastID(GUI_DLG *pDialog);
int  GUI_DlgNextItem(GUI_DLG *pDialog);
int  GUI_DlgPrevItem(GUI_DLG *pDialog);
int  GUI_DlgGotoItem(GUI_DLG *pDialog, int ItemID);
int  GUI_DlgGotoItem2(GUI_DLG *pDialog, DLG_ITEMD *pItem);
int  GUI_DlgResize(GUI_DLG *pDialog, int Width, int Height);
void GUI_DlgEnable(GUI_DLG *pDialog, int Enable);
void GUI_DlgSetTitle(GUI_DLG *pDialog, const char *pTitle);
void GUI_DlgSetFlags(GUI_DLG *pDialog, int Flags);
int  GUI_DlgGetFlags(GUI_DLG *pDialog);
void GUI_DlgSetPage(GUI_DLG *pDialog, int Page);
int  GUI_DlgGetPage(GUI_DLG *pDialog);
void GUI_DlgSwitchPage(GUI_DLG *pDialog, int Page);
void GUI_DlgGetZeroZero(GUI_DLG *pDialog, int *px, int *py);
void GUI_DlgGetMousePos(GUI_DLG *pDialog, int *pPosX, int *pPosY);
void GUI_DlgSetBackCol(GUI_DLG *pDialog, const COLOR *pBackCol);
void GUI_DlgSetGradCol(GUI_DLG *pDialog, COLOR GradCol[4]);
void GUI_DlgSetBackImage(GUI_DLG *pDialog, CIMAGE *pImage);
//! \}
static inline void GUI_DlgUpdate2(GUI_DLG *pDialog, int x, int y)
	{ GUI_DlgUpdate(pDialog, NULL, x, y); }

//! \name Functions for Handling Dialog Items
//! \{
int  GUI_DlgRemoveDItem(GUI_DLG *pDialog, int ItemID);
int  GUI_DlgRemoveDItem2(GUI_DLG *pDialog, DLG_ITEMD *pItem);
int  GUI_DlgRemoveSItem(GUI_DLG *pDialog, DLG_ITEMS *pItem);
int  GUI_DlgIsDItemSelected(const DLG_ITEMD *pItem);
void GUI_DlgSetDItemState(DLG_ITEMD *pItem, int State);
int  GUI_DlgGetDItemState(const DLG_ITEMD *pItem);
void GUI_DlgSetSItemState(DLG_ITEMS *pItem, int State);
int  GUI_DlgGetSItemState(const DLG_ITEMS *pItem);
void GUI_DlgSetDItemPage(DLG_ITEMD *pItem, int Page);
int  GUI_DlgGetDItemPage(const DLG_ITEMD *pItem);
void GUI_DlgSetSItemPage(DLG_ITEMS *pItem, int Page);
int  GUI_DlgGetSItemPage(const DLG_ITEMS *pItem);
DLG_ITEMD *GUI_DlgGetItem(GUI_DLG *pDialog, int ItemID);
int  GUI_DlgGetItemType(GUI_DLG *pDialog, int ItemID);
int  GUI_DlgGetItemType2(const DLG_ITEMD *pItem);
void GUI_DlgGetDItemTxtParam(const DLG_ITEMD *pItem, TEXTPARAMETER *pTP);
void GUI_DlgSetDItemTxtParam(DLG_ITEMD *pItem, const TEXTPARAMETER *pTP);
void GUI_DlgSetAnimButton(DLG_ITEMD *pItem, int Icon);
void GUI_DlgSetAnimIcon(DLG_ITEMS *pItem, int Icon);
void GUI_DlgLogBoxClear(DLG_ITEMD *pItem);
void GUI_DlgLogBoxPrint(DLG_ITEMD *pItem, const char *pText);
void GUI_DlgLogBoxPrintFormat(DLG_ITEMD *pItem, const char *pFormat, ...);
const char *GUI_DlgLogBoxGetText(const DLG_ITEMD *pItem, int *pLength);
void GUI_DlgRefreshFileSelectBox(DLG_ITEMD *pItem);
int  GUI_DlgGetFileSelectBoxLine(const DLG_ITEMD *pItem);
int  GUI_DlgGetFileSelectBoxFSize(const DLG_ITEMD *pItem);
//! \}

//! Deprecated for GUI_DlgSetDItemState()
#define GUI_DlgSetItemState(pItem, State) GUI_DlgSetDItemState(pItem, State)

//! \name Sensitive Spot Functions
//! \{
void GUI_InitSensitiveSpots(void);
int  GUI_AddSensitiveSpot(int x, int y, int Width, int Height, int Id);
int  GUI_CheckSensitiveSpots(int xp, int yp);
int  GUI_CheckSensitiveSpots2(void);
//! \}

//! \name Bitmap Text Functions
//! \{
int GUI_TextOut(CIMAGE *pImage, int Column, int Row, const char *pText);
int GUI_TextOutY(YIMAGE *pImage, int Column, int Row, const char *pText);
int GUI_TextOutTP(CIMAGE *pImage, int Column, int Row, const char *pText, TEXTPARAMETER *pTP);
int GUI_TextOutTPY(YIMAGE *pImage, int Column, int Row, const char *pText, TEXTPARAMETER *pTP);
int GUI_TextOutFormat(CIMAGE *pImage, int Column, int Row, const char *pFormat, ...);
int GUI_TextOutFormatY(YIMAGE *pImage, int Column, int Row, const char *pFormat, ...);
int GUI_TextOutMark(CIMAGE *pImage, int Column, int Row, const char *pText);
int GUI_TextOutMarkY(YIMAGE *pImage, int Column, int Row, const char *pText);
int GUI_TextOutMarkTP(CIMAGE *pImage, int Column, int Row, const char *pText, TEXTPARAMETER *pTP);
int GUI_TextOutMarkTPY(YIMAGE *pImage, int Column, int Row, const char *pText, TEXTPARAMETER *pTP);
//! \}

//! \name Text Functions
//! \{
void GUI_InitTxtParam(TEXTPARAMETER *pTP);
void GUI_GetTxtParam(TEXTPARAMETER *pTP);
void GUI_SetTxtParam(const TEXTPARAMETER *pTP);
void GUI_SetTxtParamSet(TEXTPARAMETER *pTPList, int Num);
void GUI_SetTxtStyle(int Style);
void GUI_SetTxtFrontCol(COLOR FrontCol);
void GUI_SetTxtBackCol(COLOR BackCol);
int  GUI_GetTextWidth(const char *pText);
int  GUI_GetCharHeight2(void);
int  GUI_GetBoxHeight2(void);
int  GUI_ClipString(const char *pIn, int MaxWidth, char *pOut);
int  GUI_ClipStringTP(const char *pIn, int MaxWidth, char *pOut, const TEXTPARAMETER *pTP);
//! \}
static inline int GUI_GetCharWidth(const TEXTPARAMETER *pTP)
	{ return (short)pTP->CharWidth * (short)pTP->Scale; }
static inline int GUI_GetCharHeight(const TEXTPARAMETER *pTP)
	{ return (short)pTP->CharHeight * (short)pTP->Scale; }
static inline int GUI_GetBoxHeight(const TEXTPARAMETER *pTP)
	{ return (short)(pTP->CharHeight + 4) * (short)pTP->Scale; }

//! \name Vector Text Functions
//! \{
int  GUI_InitFont(FONT *pFont, int FontFace, float dHScale, float dVScale,
	float dShear, int Thickness, int LineType);
int  GUI_PutText(CIMAGE *pImage, int x, int y, const char *pText, const FONT *pFont);
int  GUI_PutTextTP(CIMAGE *pImage, int x, int y, const char *pText, const FONT *pFont, const TEXTPARAMETER *pTP);
int  GUI_PutTextY(YIMAGE *pImage, int x, int y, const char *pText, const FONT *pFont);
int  GUI_PutTextTPY(YIMAGE *pImage, int x, int y, const char *pText, const FONT *pFont, const TEXTPARAMETER *pTP);
void GUI_GetTextSize(const char *pText, const FONT *pFont, int *pWidth, int *pHeight, int *pBaseLine);
//! \}

//! \name FreeType Text Functions
//! \{
void GUI_FTSprintLibInfo(char *pString);
void *GUI_FTFontBold(const void *pMem, int BufferSize, int CharWidth, int CharHeight, int AntiAlias, int Strength);
void GUI_FTFreeFont(void *pFtFont);
int  GUI_FTGetTextWidth(const char *pText, const void *pFtFont);
int  GUI_FTGetCharWidth(char c, const void *pFtFont);
char *GUI_FTGetName(const void *pFtFont);
int  GUI_FTPrint(CIMAGE *pImage, int col, int line, const char *pText, const void *pFtFont);
int  GUI_FTPrintY(YIMAGE *pImage, int col, int line, const char *pText, const void *pFtFont);
int  GUI_FTPrintTP(CIMAGE *pImage, int col, int line, const char *pText, const void *pFtFont, const TEXTPARAMETER *pTP);
int  GUI_FTPrintTPY(YIMAGE *pImage, int col, int line, const char *pText, const void *pFtFont, const TEXTPARAMETER *pTP);
void GUI_SetTxtFTFont(void *pFtFont);
void GUI_SetTxtFTFontParam(void *pFtFont, TEXTPARAMETER *pTP);
//! \}
static inline void *GUI_FTFont(const void *pMem, int BufferSize, int CharWidth, int CharHeight, int AntiAlias)
	{ return GUI_FTFontBold(pMem, BufferSize, CharWidth, CharHeight, AntiAlias, 0); }
void *GUI_FTFontFileBold(int Device, const char *pFilename, int CharWidth, int CharHeight, int AntiAlias, int Strength);
static inline void *GUI_FTFontFile(int Device, const char *pFilename, int CharWidth, int CharHeight, int AntiAlias)
	{ return GUI_FTFontFileBold(Device, pFilename, CharWidth, CharHeight, AntiAlias, 0); }

//! \name Special Functions
//! \{
void GUI_DrawILogo(CIMAGE *pImage, int x, int y, int Type);
void GUI_DrawILogoYUV(CIMAGE *pImage, int x, int y, int Type);
void GUI_DrawILogoY(YIMAGE *pImage, int x, int y, int Type);

void GUI_Shadow(CIMAGE *pImage, int x, int y, int Width, int Height);
void GUI_ShadowY(YIMAGE *pImage, int x, int y, int Width, int Height);
void GUI_Shadow2(CIMAGE *pImage, int x, int y, int Width, int Height, const COLOR *pCol);
void GUI_Shadow2Y(YIMAGE *pImage, int x, int y, int Width, int Height, unsigned char Col);
void GUI_GradientV(CIMAGE *pImage, int x, int y, int Width, int Height, const COLOR *pStart, const COLOR *pStop);
void GUI_GradientVY(YIMAGE *pImage, int x, int y, int Width, int Height,
	unsigned char Start, unsigned char Stop);
void GUI_GradientH(CIMAGE *pImage, int x, int y, int Width, int Height, const COLOR *pStart, const COLOR *pStop);
void GUI_GradientHY(YIMAGE *pImage, int x, int y, int Width, int Height,
	unsigned char Start, unsigned char Stop);
//! \}

//! Deprecated for GUI_DrawILogo()
#define GUI_DrawSLogo(pImage, x, y, Type) GUI_DrawILogo(pImage, x, y, Type) 
//! Deprecated for GUI_DrawILogoYUV()
#define GUI_DrawSLogoYUV(pImage, x, y, Type) GUI_DrawILogoYUV(pImage, x, y, Type)
//! Deprecated for GUI_DrawILogoY()
#define GUI_DrawSLogoY(pImage, x, y, Type) GUI_DrawILogoY(pImage, x, y, Type)

/******************************************************************************/

#ifdef __cplusplus
}
#endif

#endif

/******************************************************************************/
