#ifndef _PAINT_LCD_H_
#define _PAINT_LCD_H_
//==========================================================================
//
//      paint_lcd.h
//
//      For LCD display
//
//==========================================================================
//####ECOSGPLCOPYRIGHTBEGIN####
// -------------------------------------------
// This file is part of eCos, the Embedded Configurable Operating System.
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
//
// eCos is free software; you can redistribute it and/or modify it under
// the terms of the GNU General Public License as published by the Free
// Software Foundation; either version 2 or (at your option) any later version.
//
// eCos is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
// for more details.
//
// You should have received a copy of the GNU General Public License along
// with eCos; if not, write to the Free Software Foundation, Inc.,
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
//
// As a special exception, if other files instantiate templates or use macros
// or inline functions from this file, or you compile this file and link it
// with other works to produce a work based on this file, this file does not
// by itself cause the resulting work to be covered by the GNU General Public
// License. However the source code for this file must still be made available
// in accordance with section (3) of the GNU General Public License.
//
// This exception does not invalidate any other reasons why a work based on
// this file might be covered by the GNU General Public License.
//
// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
// at http://sources.redhat.com/ecos/ecos-license/
// -------------------------------------------
//####ECOSGPLCOPYRIGHTEND####
//==========================================================================
//#####DESCRIPTIONBEGIN####
//
// Author(s):    Ray Wang
// Contributors:
// Date:         2008-03-27
// Current Ver:  0.1
// Purpose:
// Description:  For LCD display.
// Copyright:    2008 Kinpo Beijing, Inc.
//
//####DESCRIPTIONEND####
//
//==========================================================================

/*
 * Hardware feature
 */
#define FRAMEBUF_BASE (0X80900000)
#define SCREEN_WIDTH	320
#define SCREEN_HEIGHT	240

/*
 * color value define
 */
typedef unsigned short  color_t;
#define RGB565(r,g,b) ((color_t)(((r)&0X1F)<<11)|(((g)&0X3F)<<5)|((b)&0X1F))

#define TRANSPARENT 0xFFFFFFFF

#define BLACK	(RGB565(0,0,0))
#define WHITE	(RGB565(31,63,31))
#define GRAY	(RGB565(15,31,15))
#define RED	(RGB565(31,0,0))
#define GREEN	(RGB565(0,63,0))
#define BLUE	(RGB565(0,0,31))
#define YELLOW	(RGB565(31,63,0))
#define MAGENT	(RGB565(31,0,31))
#define GRAY0	(RGB565(3,7,3))
#define GRAY1	(RGB565(7,15,7))
#define GRAY2	(RGB565(11,23,11))
#define GRAY3	(RGB565(15,31,15))
#define GRAY4	(RGB565(19,39,19))
#define GRAY5	(RGB565(23,47,23))
#define GRAY6	(RGB565(27,55,27))
#define GRAY7	(RGB565(31,63,31))

#define MAX(a, b)   ((a)>(b)?(a):(b))
#define MIN(a, b)   ((a)<(b)?(a):(b))

typedef struct tagRGBQUAD {
        unsigned char    rgbBlue;
        unsigned char    rgbGreen;
        unsigned char    rgbRed;
        unsigned char    rgbReserved;
} RGBQUAD;

typedef struct tagBITMAPINFOHEADER {
        unsigned int      biSize;
        long       biWidth;
        long       biHeight;
        unsigned short       biPlanes;
        unsigned short       biBitCount;
        unsigned int      biCompression;
        unsigned int      biSizeImage;
        long       biXPelsPerMeter;
        long       biYPelsPerMeter;
        unsigned int      biClrUsed;
	unsigned int      biClrImportant;
} BITMAPINFOHEADER;
typedef struct _tagBITMAPFILEHEADER {
        unsigned short  bfType;
        unsigned int    bfSize;
        unsigned short  bfReserved1;
        unsigned short  bfReserved2;
        unsigned int    bfOffBits;
} BITMAPFILEHEADER;

typedef struct BITMAP_FILE_TAG{
        BITMAPFILEHEADER        bitmapfileheader;
        BITMAPINFOHEADER        bitmapinfoheader;
        unsigned char           *buffer;
}BITMAP_FILES, *BITMAP_FILE_PTR;

/*
 * Function define
 */

void paint_pixel(int x, int y, color_t color);
void paint_line(int x1, int y1, int x2, int y2, color_t color);
void draw_rect(int x, int y, int width, int height, color_t color);
void paint_rect(int x, int y, int width, int height, color_t color);
void print_char(int x, int y, color_t c_color, color_t b_color, char c);
void print_fmt(int x, int y, color_t c_color, color_t b_color, char *fmt);

#endif //_PAINT_LCD_H_
