|
单片机C语言实例-204-彩屏控制
/*
================================================================================
File Name : GUI_Basic.c
Author : LiYOng
Date : 2008-12-12 15:51
Version : 1.0
Decription: This file contains some basic functions for GUI, It need the LCD
Drive functions
================================================================================
*/
#include "GUI_Basic.H"
#include "GUI_Type.H"
#include "fontlib.h"
/*
================================================================================
Function : GUI_DrawRectangle( )
Description : Draw a rectangle
Input : -pRect, point to a rectangle structure
output : None
================================================================================
*/
void GUI_DrawRectangle( RECT* pRect )
{
LINE line;
line.xs = pRect->xs;
line.xe = pRect->xe;
line.ys = pRect->ys;
line.ye = pRect->ys;
line.Color = pRect->Color;
LCDDrawHRLine( &line );
line.xe = pRect->xs;
line.ye = pRect->ye;
LCDDrawHRLine( &line );
line.xs = pRect->xe;
line.ys = pRect->ye;
LCDDrawHRLine( &line );
line.xe = pRect->xe;
line.ye = pRect->ys;
LCDDrawHRLine( &line );
}
/*
================================================================================
Function : GUI_DrawLine( )
Description : Draw a line
Input : -pLine, point to a line structure
output : None
================================================================================
*/
void GUI_DrawLine( LINE* pLine )
{
INT32S dx; // 直线x轴差值变量
INT32S dy; // 直线y轴差值变量
INT32S dx_sym; // x轴增长方向,为-1时减值方向,为1时增值方向
INT32S dy_sym; // y轴增长方向,为-1时减值方向,为1时增值方向
INT32S dx_x2; // dx*2值变量,用于加快运算速度
INT32S dy_x2; // dy*2值变量,用于加快运算速度
INT32S di; // 决策变量
POINT point;
LINE line;
line.xs = pLine->xs;
line.ys = pLine->ys;
line.xe = pLine->xe;
line.ye = pLine->ye;
line.Color = pLine->Color;
point.Color = pLine->Color;
dx = line.xe - line.xs;
dy = line.ye - line.ys;
更多详情参考附件文档
|
|