📄 ltm024d130.c
字号:
** 日 期: 2008年7月22日
**-------------------------------------------------------------------------------------------------------
** 修 改 人:
** 日 期:
**------------------------------------------------------------------------------------------------------
********************************************************************************************************/
void pixelDraw(unsigned short x, unsigned short y,unsigned short usValue)
{
setCoordinate(x, y); /* 坐标设置 */
__writeData16(usValue); /* 画一个点的像素值 */
}
/*********************************************************************************************************
** 函数名称: lineDrawH
** 功能描述: 在指定位置画一水平线
** 输 入: x1 列起始坐标
** x2 列结束坐标
** y 行坐标
** usValue 线的颜色值
** 输 出: 无
** 全局变量: 无
** 调用模块: windowset()、__writeCommand()、setCoordinate()、__writeData16()
** 作 者: 张展威
** 日 期: 2008年7月22日
**-------------------------------------------------------------------------------------------------------
** 修 改 人:
** 日 期:
**------------------------------------------------------------------------------------------------------
********************************************************************************************************/
void lineDrawH(unsigned short x1, unsigned short x2, unsigned short y, unsigned short usValue)
{
unsigned short usTmp;
if (x1 > x2) {
usTmp = x1;
x1 = x2;
x2 = usTmp;
}
if (x1 > 239) {x1 = 239;}
if (x2 > 239) {x2 = 239;}
//窗口设置
windowset(0, y, 239, y);
// 设置增长方向为:左 --> 右,上 --> 下
__writeCommand(0,0x00,0x04); /* 扫描方向控制 */
__writeCommand(0,0x01,0x07); /* 扫描方向控制 */
setCoordinate(x1, y); /* 设置起始坐标 */
while (x1++ <= x2) {
__writeData16(usValue); /* 画一个点的像素值 */
}
}
/*********************************************************************************************************
** 函数名称: lineDrawV
** 功能描述: 在指定位置画一竖线
** 输 入: x 列坐标
** y1 行起始坐标
** y2 行结束坐标
** usValue 线的颜色值
** 输 出: 无
** 全局变量: 无
** 调用模块: windowset()、__writeCommand()、setCoordinate()、__writeData16()
** 作 者: 张展威
** 日 期: 2008年7月22日
**-------------------------------------------------------------------------------------------------------
** 修 改 人:
** 日 期:
**------------------------------------------------------------------------------------------------------
********************************************************************************************************/
void lineDrawV(unsigned short x, unsigned short y1, unsigned short y2, unsigned short usValue)
{
unsigned short usTmp;
if (y1 > y2) {
usTmp = y1;
y1 = y2;
y2 = usTmp;
}
if (y1 > 319) {y1 = 319;}
if (y2 > 319) {y2 = 319;}
//窗口设置
windowset(x, 0, x, 319);
// 设置增长方向为:左 --> 右,上 --> 下
__writeCommand(0,0x00,0x04); /* 扫描方向控制 */
__writeCommand(0,0x01,0x07); /* 扫描方向控制 */
setCoordinate(x, y1); /* 设置起始坐标 */
while (y1++ <= y2) {
__writeData16(usValue); /* 画一个点的像素值 */
}
}
/*********************************************************************************************************
** 函数名称: rectFill
** 功能描述: 用颜色值ulValue填充pRect所指定的区域
** 输 入: pRect 指向矩形区域结构体变量的指针
** ulValue 颜色值
** 输 出: 无
** 全局变量: 无
** 调用模块: windowset()、__writeCommand()、setCoordinate()、__writeData16()
** 返 回:无
** 作 者: 张展威
** 日 期: 2008年7月22日
**------------------------------------------------------------------------------------------------------
** 修 改 人:
** 日 期:
**------------------------------------------------------------------------------------------------------
*********************************************************************************************************/
void rectFill(RECTANGLE *pRect, unsigned long ulValue)
{
long lCount;
//扫描方向控制
__writeCommand(0,0x00,0x04); /* 扫描方向控制 */
__writeCommand(0,0x01,0x07); /* 扫描方向控制 */
//窗口设置
windowset(pRect->usXMin, pRect->usYMin, pRect->usXMax, pRect->usYMax);
setCoordinate(pRect->usXMin, pRect->usYMin); /* 设置起始坐标 */
lCount = (pRect->usXMax - pRect->usXMin + 1) * (pRect->usYMax - pRect->usYMin + 1);
while(lCount-- > 0) {
__writeData16(ulValue); /* 发送像素值 */
}
// 复位矩形窗口
windowset(0, 0, 239, 319);
}
/*********************************************************************************************************
** 函数名称: windowExactlySet
** 功能描述: 根据pRect指向的参数精确设置窗口(包括坐标在窗口内部的偏移量),并为写数据做好了准备
** 输 入: pRect 指向矩形区域结构体变量的指针
** 输 出: 无
** 全局变量: 无
** 调用模块: windowset()、__writeCommand()、setCoordinate()
** 返 回:无
** 作 者: 张展威
** 日 期: 2008年7月22日
**------------------------------------------------------------------------------------------------------
** 修 改 人:
** 日 期:
**------------------------------------------------------------------------------------------------------
*********************************************************************************************************/
void windowExactlySet(RECTANGLE *pRect)
{
//窗口设置
windowset(pRect->usXMin, pRect->usYMin, pRect->usXMax, pRect->usYMax);
// 设置增长方向为:左 --> 右,上 --> 下
__writeCommand(0,0x00,0x04); /* 扫描方向控制 */
__writeCommand(0,0x01,0x07); /* 扫描方向控制 */
setCoordinate(pRect->usXMin + pRect->usXinZoon, pRect->usYMin + pRect->usYinZoon);
/* 设置当前的坐标 */
}
/*********************************************************************************************************
** 函数名称: pictureFill
** 功能描述: 向psZone指向的矩形区域填充 16 bitRGB 格式的图片数据
** 输 入: psZone 指向矩形区域结构体变量的指针
** pusValue 指向图片数据的起始地址
** ulCounter 需要填充的像素个数
** 输 出: 无
** 全局变量: 无
** 调用模块: windowExactlySet()、__writeData16()、windowset()
** 返 回:无
** 作 者: 张展威
** 日 期: 2008年7月22日
**------------------------------------------------------------------------------------------------------
** 修 改 人:
** 日 期:
**------------------------------------------------------------------------------------------------------
*********************************************************************************************************/
void pictureFill(RECTANGLE *psZone, unsigned short *pusValue, unsigned long ulCounter)
{
unsigned long i = 0;
unsigned short *pusValueptr = pusValue;
RECTANGLE *pRect;
pRect = psZone;
windowExactlySet(psZone);
for(i = 0; i < ulCounter; i++) {
__writeData16(*pusValueptr++); /* 发送像素值 */
}
pRect->usXinZoon = pRect->usXinZoon + ulCounter;
if (pRect->usXinZoon > (pRect->usXMax - pRect->usXMin + 1)) {
pRect->usYinZoon += pRect->usXinZoon / (pRect->usXMax - pRect->usXMin + 1);
pRect->usXinZoon = pRect->usXinZoon % (pRect->usXMax - pRect->usXMin + 1);
if (pRect->usYinZoon > (pRect->usYMax - pRect->usYMin + 1)) {
pRect->usYinZoon = 0;
}
}
// 复位矩形窗口
windowset(0, 0, 239, 319);
}
/*********************************************************************************************************
像素格式转换 将 24-bit RGB 格式转换为 5-6-5 RGB 格式
*********************************************************************************************************/
unsigned long colorTranslate(unsigned long ulValue)
{
return (((ulValue & 0x00F80000) >> 8) |
((ulValue & 0x0000FC00) >> 5) |
((ulValue & 0x000000F8) >> 3));
}
/*********************************************************************************************************
屏幕刷新
*********************************************************************************************************/
void screenFlush(void *pvDisplayData)
{
;
}
/*********************************************************************************************************
开背景灯
*********************************************************************************************************/
void backlightOn(void)
{
;
}
/*********************************************************************************************************
关背景灯
*********************************************************************************************************/
void backlightOff(void)
{
;
}
/*********************************************************************************************************
** End of File
*********************************************************************************************************/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -