|
发表于 2019-1-14 12:34:55
|
显示全部楼层
16bpp的意思绘制一个支持颜色配置的水平线
以9488为例:
- /*
- *********************************************************************************************************
- * 函 数 名: ILI9488_DrawHTransLine
- * 功能说明: 绘制一条彩色透明的水平线 (主要用于UCGUI的接口函数), 颜色值为0表示透明色
- * 形 参: _usX1 :起始点X坐标
- * _usY1 :水平线的Y坐标
- * _usWidth :直线的宽度
- * _pColor : 颜色缓冲区
- * 返 回 值: 无
- *********************************************************************************************************
- */
- void ILI9488_DrawHTransLine(uint16_t _usX1 , uint16_t _usY1, uint16_t _usWidth, const uint16_t *_pColor)
- {
- uint16_t i, j;
- uint16_t Index;
- ILI9488_SetCursor(_usX1, _usY1);
- /* 写显存 */
- ILI9488_REG = 0x2C;
- for (i = 0,j = 0; i < _usWidth; i++, j++)
- {
- Index = *_pColor++;
- if (Index)
- {
- ILI9488_RAM = Index;
- }
- else
- {
- ILI9488_SetCursor(_usX1 + j, _usY1);
- ILI9488_REG = 0x2C;
- ILI9488_RAM = Index;
- }
- }
- }
复制代码
以RA8875为例:
- /*
- *********************************************************************************************************
- * 函 数 名: RA8875_DrawHColorLine
- * 功能说明: 绘制一条彩色水平线 (主要用于UCGUI的接口函数)
- * 形 参:_usX1 :起始点X坐标
- * _usY1 :水平线的Y坐标
- * _usWidth :直线的宽度
- * _pColor : 颜色缓冲区
- * 返 回 值: 无
- *********************************************************************************************************
- */
- void RA8875_DrawHColorLine(uint16_t _usX1 , uint16_t _usY1, uint16_t _usWidth, uint16_t *_pColor)
- {
- uint16_t i;
- s_ucRA8875Busy = 1;
-
- RA8875_REG = 0x46; RA8875_RAM = _usX1;
- RA8875_REG = 0x47; RA8875_RAM = _usX1 >> 8;
- RA8875_REG = 0x48; RA8875_RAM = _usY1;
- RA8875_REG = 0x49; RA8875_RAM = _usY1 >> 8;
- RA8875_REG = 0x02; /* 用于设定RA8875 进入内存(DDRAM或CGRAM)读取/写入模式 */
-
- for (i = 0; i < _usWidth; i++)
- {
- RA8875_RAM = *_pColor++;
- //RA8875_WriteData16(*_pColor++);
- }
-
- s_ucRA8875Busy = 0;
- }
复制代码 |
|