#ifndef GRAPHLOW_H_
#define GRAPHLOW_H_

extern "C"{
	#include "main.h"
	#include "internal_flash.h"
}

//#define Hzk_24_data  ((const unsigned char *)(FLASH_USER_FONT_24X24))
//#define Hzk_24_data  ((const unsigned char *)(ADDR_FLASH_SECTOR_0_BANK2))

#define Gbk_24_data  ((const unsigned char *)(0xC0600000))

typedef struct  
{							 
	unsigned int pwidth;			//LCD面板的宽度,固定参数,不随显示方向改变,如果为0,说明没有任何RGB屏接入
	unsigned int pheight;		//LCD面板的高度,固定参数,不随显示方向改变
	unsigned short hsw;			//水平同步宽度
	unsigned short vsw;			//垂直同步宽度
	unsigned short hbp;			//水平后廊
	unsigned short vbp;			//垂直后廊
	unsigned short hfp;			//水平前廊
	unsigned short vfp;			//垂直前廊 
	unsigned char activelayer;		//当前层编号:0/1	
	unsigned char dir;				//0,竖屏;1,横屏;
	unsigned short width;			//LCD宽度
	unsigned short height;			//LCD高度
	unsigned int pixsize;		//每个像素所占字节数
}Tltdc_dev; 

extern const unsigned int LcdBaseAddr;
extern const unsigned int LcdTopAddr;

extern void LcdTopFill(unsigned int aClr);

extern unsigned int Abs32(signed int num) ;
extern void SwapCoord(int *c1, int *c2);
extern void PixelRender(int x, int y, unsigned int aColor);
extern void PixelRender(int x, int y,  int PenWidth, unsigned int Color);
extern void BoxRender2D(int x1, int y1, int x2, int y2, unsigned int color);
extern void LineRender (int x1,int y1, int x2, int y2, int PenWidth, unsigned int PenColor);     //draw line - bresenham algorithm
extern void HorizLineRender(int xpos, int ypos, int length, unsigned int clr);
extern void VertLineRender(int xpos, int ypos, int length, unsigned int clr);
extern void RectRender(int x1, int y1, int x2, int y2,int line_type, unsigned int color);   //draw rectangle
extern void RectFillRender(int x1, int y1, int x2, int y2, unsigned int color);

extern unsigned int lcd_draw_char_8x16(unsigned int xpos, unsigned int ypos, unsigned int clr, unsigned int bClr, char cr);

extern void gui_write_EN2412(unsigned short x1, unsigned short y1, unsigned int CharColor, unsigned char num);
extern void gui_write_EN2412(unsigned short x1, unsigned short y1, unsigned int CharColor, unsigned int bClr, unsigned char num);
extern void TextRender_1CN24(int x, int y, unsigned int CharColor, const char *p);
extern void TextRender_1CN24(int x, int y, unsigned int CharColor, char *p);
extern void TextRender_1CN24(int x, int y, unsigned int CharColor, unsigned int bClr, const char *p);

extern void TextRender		(int x1, int y1, const char *p, unsigned int aColor, int aFontSize);
extern void TextRender_string24(int x, int y, unsigned int CharColor, char* p);
extern void TextRender_string24(int x, int y, unsigned int CharColor, unsigned char* p);
extern void TextRender_string24(int x, int y, unsigned int CharColor, const char* p);
extern void TextRender_string24(int x, int y, unsigned int CharColor, unsigned int bClr, char* pC);
extern void TextRender_string24(int x, int y, unsigned int CharColor, unsigned int bClr, unsigned char* pC);
extern void TextRender_string24(int x, int y, unsigned int CharColor, unsigned int bClr, const char* pC);
extern void TextRenderAscii_20(unsigned int x,unsigned int y, unsigned int clr, char *pc);
extern void TextRenderAscii_20(unsigned int x,unsigned int y, unsigned int clr, const char *pc);
extern void TextRenderAscii_16(unsigned int x,unsigned int y, unsigned int clr, char *pc);
extern void TextRenderAscii_16(unsigned int x,unsigned int y, unsigned int clr, const char *pc);

extern void TextDigitRenderLeft24_1t3(int x, int y, unsigned int CharColor,   			 unsigned int dig);
extern void TextDigitRenderLeft24_1t3(int x, int y, unsigned int CharColor, unsigned int BackClr, unsigned int dig);
extern void TextDigitRender1Right24(int x, int y, unsigned int CharColor, unsigned int dig);
extern void TextDigitRender1Right24(int x, int y, unsigned int CharColor, unsigned int bClr, unsigned int dig);
extern void TextDigitRender2_24(int x, int y, unsigned int CharColor, unsigned int dig);
extern void TextDigitRender2_24(int x, int y, unsigned int CharColor, unsigned int bClr, unsigned int dig);
extern void TextDigitRender3_24(int x, int y, unsigned int CharColor, unsigned int dig);
extern void TextDigitRender3_24(int x, int y, unsigned int CharColor, unsigned int bClr, unsigned int dig);
extern void TextDigitRender4_24(int x, int y, unsigned int CharColor, unsigned int dig);
extern void TextDigitRender4_24(int x, int y, unsigned int CharColor, unsigned int bClr, unsigned int dig);
extern void TextDigitRender5_24(int x, int y, unsigned int CharColor, unsigned int dig);
extern void TextDigitRender5_24(int x, int y, unsigned int CharColor, unsigned int bClr, unsigned int dig);
extern void TextDigitRender6_24(int x, int y, unsigned int CharColor, unsigned int dig);
extern void TextDigitRender6_24(int x, int y, unsigned int CharColor, unsigned int bClr, unsigned int dig);
extern void TextDigitRender8_24(int x, int y, unsigned int CharColor, unsigned int dig);
extern void TextDigitRender8_24(int x, int y, unsigned int CharColor, unsigned int bClr, unsigned int dig);
extern void TextDigitRender2Right24(int x, int y, unsigned int CharColor, unsigned int dig);
extern void TextDigitRender3Right24(int x, int y, unsigned int CharColor, unsigned int dig);
extern void TextDigitRender4Right24(int x, int y, unsigned int CharColor, unsigned int dig);
extern void TextDigitRender4Right24(int x, int y, unsigned int CharColor, unsigned int bClr, unsigned int dig);
extern void TextDigitRender5Right24(int x, int y, unsigned int CharColor, unsigned int dig);
extern void TextDigitRender5Right24(int x, int y, unsigned int CharColor, unsigned int bClr, unsigned int dig);
extern void TextDigitRender6Right24(int x, int y, unsigned int CharColor, unsigned int dig);
extern void TextDigitRender6Right24(int x, int y, unsigned int CharColor, unsigned int bClr, unsigned int dig);
extern void TextDigitRender2Right24(int x, int y, unsigned int CharColor, unsigned int bClr, unsigned int dig);
extern void TextDigitRender3Right24(int x, int y, unsigned int CharColor, unsigned int bClr, unsigned int dig);
extern void TextDigitRender5Left24(int x, int y, unsigned int CharColor, unsigned int BackClr, unsigned int dig);
extern void TextDigitRender6Left24(int x, int y, unsigned int CharColor, unsigned int BackClr, unsigned int dig);

extern int GetFontWidth(int FS);
extern int GetFontHeight(int FS);

extern unsigned int lcd_draw_char_8x16(unsigned int xpos, unsigned int ypos, unsigned int clr, char cr);
extern void lcd_draw_str_8x16(unsigned int xpos,unsigned int ypos,unsigned int clr, char *pc);

















#endif
