Ai
1 Star 0 Fork 1

DFRobot/DFRobot_Display

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
DFRobot_Display.cpp 19.29 KB
一键复制 编辑 原始数据 按行查看 历史
sobeit 提交于 2019-03-14 19:19 +08:00 . fix bug
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765
#include "DFRobot_Display.h"
DFRobot_Display::DFRobot_Display(uint16_t width_, uint16_t height_)
{
width = width_ - 1;
height = height_ - 1;
rawWidth = width - 1;
rawHeight = height - 1;
textSize = 1;
pfCharacterFont = DFRobot_Character_getCharacter;
lineWidth = 1;
}
size_t DFRobot_Display::write(uint8_t ch)
{
_DEBUG_PRINT("\n print char");
drawText(&printfX, &printfY, (const char*)&ch);
return 1;
}
size_t DFRobot_Display::write(const uint8_t* pCh, size_t size)
{
_DEBUG_PRINT("\n print string");
drawText(&printfX, &printfY, (const char*)pCh);
return strlen((const char*)pCh);
}
int16_t DFRobot_Display::drawText(int16_t* pX, int16_t* pY, const char* ch)
{
uint8_t characterBuffer[32] = {0};
uint8_t rslt = 0;
uint8_t i = 0, j = 0, k = 0;
uint8_t var1 = 0;
uint8_t textWidth = 0, textHeight = 0;
#ifdef _DEBUG
_DEBUG_PRINT("\n drawText :");
_DEBUG_PRINT(ch);
for(i = 0; i < strlen(ch); i ++) {
_DEBUG_PRINT(" ");
_DEBUG_PRINTVAR(ch[i], HEX);
}
#endif
while(*ch) {
//get character
rslt = pfCharacterFont((uint8_t*) ch, characterBuffer, &textWidth, &textHeight);
fillRect(*pX - cursorX, *pY - cursorY, textWidth * textSize, textHeight * textSize, textBackground);
#ifdef _DEBUG
_DEBUG_PRINT("\n get character result :");
_DEBUG_PRINTVAR(rslt, HEX);
_DEBUG_PRINT("\n get character :");
for(i = 0; i < 32; i ++) {
_DEBUG_PRINTVAR(characterBuffer[i], HEX);
_DEBUG_PRINT(" ");
}
#endif
if(rslt < 0) {
return rslt;
} else {
if(*ch > 0x06 && *ch < 0x0e) {
if(*ch == '\n') {
*pX = 0;
*pY += textHeight * textSize;
}
ch += rslt;
continue;
}
ch += rslt;
//check range
if(*pX > rawWidth - textWidth * textSize) {
*pX = 0;
*pY += textHeight * textSize;
}
if(*pY > rawHeight - textHeight * textSize) {
return DISPLAY_WAR_OUTRANGE;
}
if(rslt > 1) {
/*display, charater example:
data: 0xf0, 0x0f, 0x55, 0xaa ...
display pixel: ****0000 0000****
0*0*0*0* *0*0*0*0
*/
for(i = 0; i < 32; i ++) {
var1 = characterBuffer[i];
for(j = 0; j < 8; j ++) {
if(var1 & (0x01 << j)) {
for(k = 0; k < textSize; k ++) {
drawVLine(*pX + (i % 2) * 8 * textSize + j * textSize + k - cursorX,
*pY + (i / 2) * textSize - cursorY, textSize , textColor);
}
}
}
}
} else {
/*display, charater example:
data: 0xf0, 0x0f, 0x55, 0xaa ...
display pixel: ****0000
0000****
0*0*0*0*
*0*0*0*0
*/
//8 * 16 text size
if(textHeight == 16) {
for(i = 0; i < 16; i ++) {
var1 = characterBuffer[i];
for(j = 0; j < 8; j ++) {
if(var1 & (0x01 << j)) {
for(k = 0; k < textSize; k ++) {
drawVLine(*pX + j * textSize + k - cursorX,
*pY + i * textSize - cursorY, textSize , textColor);
}
}
}
}
//6 * 8 text size
} else {
for(i = 0; i < textWidth; i ++) {
var1 = characterBuffer[i];
for(j = 0; j < 8; j ++) {
if(var1 & (0x01 << j)) {
for(k = 0; k < textSize; k ++) {
drawVLine(*pX + i * textSize + k - cursorX, *pY + j * textSize - cursorY, textSize, textColor);
}
}
}
}
}
}
}
*pX += textWidth * textSize;
}
}
void DFRobot_Display::drawVLine(int16_t x, int16_t y, int16_t height_, uint16_t color)
{
if((x + cursorX < 0) || (x + cursorX > width)) {return;}
int8_t direction = 1;
int16_t var1 = y + height_;
if(height_ < 0) {
direction = -1;
}
for(; y != var1; y += direction) {
drawPixel(x, y, color);
}
}
void DFRobot_Display::drawHLine(int16_t x, int16_t y, int16_t width_, uint16_t color)
{
if((y + cursorY < 0) || (y + cursorY > height)) {return;}
int8_t direction = 1;
int16_t var1 = x + width_;
if(width_ < 0) {
direction = -1;
}
for(; x != var1; x += direction) {
drawPixel(x, y, color);
}
}
void DFRobot_Display::drawRect(int16_t x, int16_t y, int16_t width, int16_t height,
uint16_t color)
{
int8_t dirX = (width > 0) ? -1 : 1;
int8_t dirY = (height > 0) ? -1 : 1;
drawHLine(x, y, width, color);
drawHLine(x, y + height + dirY, width, color);
drawVLine(x, y, height, color);
drawVLine(x + width + dirX, y, height, color);
}
void DFRobot_Display::fillRect(int16_t x, int16_t y, int16_t width, int16_t height,
uint16_t color)
{
int8_t directionX = 1;
int16_t var1 = x + width;
if(width < 0) {
directionX = -1;
}
for(; x != var1; x += directionX) {
drawVLine(x, y, height, color);
}
}
void DFRobot_Display::drawLine(int16_t x0, int16_t y0, int16_t x1, int16_t y1,
uint16_t color)
{
int16_t dx = abs(x1 - x0), dy = abs(y1 - y0);
uint8_t steep = 0;
eDirection_t eDirection = calcLineDirection(x0, y0, x1, y1);
if(dx < dy) {
steep = 1;
swap_int16(x0, y0);
swap_int16(x1, y1);
swap_int16(dx, dy);
}
int8_t dirX = (x1 - x0) > 0 ? 1 : -1;
int8_t dirY = (y1 - y0) > 0 ? 1 : -1;
int16_t endX = x0, endY = y0;
int32_t var1 = dy * 2;
int32_t var2 = (dy - dx) * 2;
int32_t var3 = dy * 2 -dx;
if(steep) {
while(endX != x1) {
if(var3 < 0) {
var3 += var1;
} else {
endY += dirY;
var3 += var2;
}
// drawPixel(endY, endX, color);
drawPixelWidth(endY, endX, eDirection, color);
endX += dirX;
}
} else {
while(endX != x1) {
if(var3 < 0) {
var3 += var1;
} else {
endY += dirY;
var3 += var2;
}
// drawPixel(endX, endY, color);
drawPixelWidth(endX, endY, eDirection, color);
endX += dirX;
}
}
}
void DFRobot_Display::drawCircle(int16_t x0, int16_t y0, int16_t r, uint16_t color)
{
r = abs(r);
int16_t varX = 0, varY = r;
int16_t endY = 0;
int32_t var1 = 3 - 2 * r;
while(varX <= varY) {
drawPixel(x0 + varX, y0 + varY, color);
drawPixel(x0 - varX, y0 + varY, color);
drawPixel(x0 + varX, y0 - varY, color);
drawPixel(x0 - varX, y0 - varY, color);
drawPixel(x0 + varY, y0 + varX, color);
drawPixel(x0 - varY, y0 + varX, color);
drawPixel(x0 + varY, y0 - varX, color);
drawPixel(x0 - varY, y0 - varX, color);
if(var1 < 0) {
var1 = var1 + 4 * varX + 6;
} else {
var1 = var1 + 4 * (varX - varY) + 10;
varY --;
}
varX ++;
}
}
void DFRobot_Display::fillCircle(int16_t x0, int16_t y0, int16_t r, uint16_t color)
{
r = abs(r);
int16_t varX = 0, varY = r;
int16_t endY = 0;
int32_t var1 = 3 - 2 * r;
while(varX <= varY) {
drawVLine(x0+varX, y0-varY, 2 * varY + 1, color);
drawVLine(x0+varY, y0-varX, 2 * varX + 1, color);
drawVLine(x0-varX, y0-varY, 2 * varY + 1, color);
drawVLine(x0-varY, y0-varX, 2 * varX + 1, color);
if(var1 < 0) {
var1 = var1 + 4 * varX + 6;
} else {
var1 = var1 + 4 * (varX - varY) + 10;
varY --;
}
varX ++;
}
}
void DFRobot_Display::drawTriangle(int16_t x0, int16_t y0, int16_t x1, int16_t y1,
int16_t x2, int16_t y2, uint16_t color)
{
drawLine(x0, y0, x1, y1, color);
drawLine(x1, y1, x2, y2, color);
drawLine(x2, y2, x0, y0, color);
}
void DFRobot_Display::fillTriangle(int16_t x, int16_t y, int16_t x1, int16_t y1,
int16_t x2, int16_t y2, uint16_t color)
{
drawLine(x, y, x1, y1, color);
drawLine(x1, y1, x2, y2, color);
drawLine(x2, y2, x, y, color);
int temp = lineWidth;
lineWidth = 1;
if( x == x1 && x == x2) {
int ymax = y;
if(ymax < y1)
ymax = y1;
if(ymax < y2)
ymax = y2;
int ymin = y;
if(ymin > y1)
ymin = y1;
if(ymin > y2)
ymin = y2;
drawHLine(x, ymin, ymax - ymin, color);
lineWidth = temp;
return;
}
if (y == y1 && y == y2) {
int xmax = y;
if(xmax < y1)
xmax = y1;
if(xmax < y2)
xmax = y2;
int xmin = y;
if(xmin > y1)
xmin = y1;
if(xmin > y2)
xmin = y2;
drawVLine(xmin, y, xmax - xmin, color);
lineWidth = temp;
return;
}
int direction = 1;
if (y == y1 || y1 == y2 || y == y2) {
if (y == y1) {
swap_int16(x, x2);
swap_int16(y, y2);
} else if (y == y2) {
swap_int16(x, x1);
swap_int16(y, y1);
}
if (y > y1) {
direction = -1;
}
if (x1 > x2) {
swap_int16(x1, x2);
swap_int16(y1, y2);
}
} else {
if (y > y1) {
swap_int16(x, x1);
swap_int16(y, y1);
}
if (y > y2) {
swap_int16(x, x2);
swap_int16(y, y2);
}
if (y1 > y2) {
swap_int16(x1, x2);
swap_int16(y1, y2);
}
}
int dx1 = x1 - x;
int dx2 = x2 - x;
int dx3 = x2 - x1;
int dy1 = y1 - y;
int dy2 = y2 - y;
int dy3 = y2 - y1;
if (direction == 1) {
for(int i = 0; i < dy1; i ++)
drawHLine(x + dx1 * i / dy1, y + i, (x + dx2 * i / dy2) - (x + dx1 * i / dy1) + 1, color);
for(int i = 0; i < dy3; i ++)
drawHLine(x1 + dx3 * i / dy3, y1 + i, (x + dx2 * (i + dy1) / dy2) - (x1 + dx3 * i / dy3) + 1, color);
} else {
y = y1 + dy1;
dy1 = - dy1;
for(int i = 0; i < dy1; i ++)
drawHLine(x + dx1 * i / dy1, y1 + dy1 - i, (x + dx2 * i / dy1) - (x + dx1 * i / dy1) + 1, color);
}
lineWidth = temp;
}
void DFRobot_Display::drawRoundRect(int16_t x, int16_t y, int16_t w,
int16_t h, int16_t r, uint16_t color)
{
r = abs(r);
// smarter version
if(w > 0) {
drawHLine(x+r , y , w-2*r+1, color); // Top
drawHLine(x+r , y+h, w-2*r+1, color); // Bottom
} else {
drawHLine(x-r , y , -(abs(w)-2*r+1), color); // Top
drawHLine(x-r , y+h, -(abs(w)-2*r+1), color); // Bottom
}
if(h > 0) {
drawVLine(x, y + r, h - 2 * r+1, color);
drawVLine(x + w, y + r, h - 2 * r+1, color);
} else {
drawVLine(x, y - r, -(abs(h) - 2 * r+1), color);
drawVLine(x + w, y - r, -(abs(h) - 2 * r+1), color);
}
// draw four corners
if(w > 0) {
if(h > 0) {
circleHelper(x + r, y + r, r, 1, color);
circleHelper(x + w - r, y + r, r, 2, color);
circleHelper(x + r, y + h - r, r, 8, color);
circleHelper(x + w - r, y + h - r, r, 4, color);
} else {
circleHelper(x + r, y - r, r, 8, color);
circleHelper(x + w - r, y - r, r, 4, color);
circleHelper(x + r, y + h + r, r, 1, color);
circleHelper(x + w - r, y + h + r, r, 2, color);
}
} else {
if(h > 0) {
circleHelper(x - r, y + r, r, 2, color);
circleHelper(x + w + r, y + r, r, 1, color);
circleHelper(x + w + r, y + h - r, r, 8, color);
circleHelper(x - r, y + h - r, r, 4, color);
} else {
circleHelper(x - r, y - r, r, 4, color);
circleHelper(x + w + r, y - r, r, 8, color);
circleHelper(x - r, y + h + r, r, 2, color);
circleHelper(x + w + r, y + h + r, r, 1, color);
}
}
}
// fill a rounded rectangle!
void DFRobot_Display::fillRoundRect(int16_t x, int16_t y, int16_t w,
int16_t h, int16_t r, uint16_t color)
{
r = abs(r);
if(w > 0) {
if(h > 0) {
fillRect(x + r, y, w - 2 * r+1, h+1, color);
} else {
fillRect(x + r, y + h, w - 2 * r+1, abs(h)+1, color);
}
} else {
if(h > 0) {
fillRect(x + w + r, y, abs(w) - 2 * r+1, h+1, color);
} else {
fillRect(x + w + r, y + h, abs(w) - 2 * r+1, abs(h)+1, color);
}
}
if(w > 0) {
if(h > 0) {
fillCircleHelper(x + r, y + r, r, 2, h - 2 * r, color);
fillCircleHelper(x + w - r, y + r, r, 1, h - 2 * r, color);
} else {
fillCircleHelper(x + r, y + h + r, r, 2, abs(h) - 2 * r, color);
fillCircleHelper(x + w - r, y + h + r, r, 1, abs(h) - 2 * r, color);
}
} else {
if(h > 0) {
fillCircleHelper(x - r, y + r, r, 1, h - 2 * r, color);
fillCircleHelper(x + w + r, y + r, r, 2, h - 2 * r, color);
} else {
fillCircleHelper(x + w + r, y + h + r, r, 2, abs(h) - 2 * r, color);
fillCircleHelper(x - r, y + h + r, r, 1, abs(h) - 2 * r, color);
}
}
}
void DFRobot_Display::circleHelper(int16_t x0, int16_t y0,
int16_t r, uint8_t part, uint16_t color)
{
r = abs(r);
int16_t varX = 0, varY = r;
int16_t endY = 0;
int32_t var1 = 3 - 2 * r;
while(varX <= varY) {
if(part & 0x04) {
drawPixel(x0 + varX, y0 + varY, color);
drawPixel(x0 + varY, y0 + varX, color);
}
if(part & 0x02) {
drawPixel(x0 + varX, y0 - varY, color);
drawPixel(x0 + varY, y0 - varX, color);
}
if(part & 0x08) {
drawPixel(x0 - varY, y0 + varX, color);
drawPixel(x0 - varX, y0 + varY, color);
}
if(part & 0x01) {
drawPixel(x0 - varX, y0 - varY, color);
drawPixel(x0 - varY, y0 - varX, color);
}
if(var1 < 0) {
var1 = var1 + 4 * varX + 6;
} else {
var1 = var1 + 4 * (varX - varY) + 10;
varY --;
}
varX ++;
}
}
void DFRobot_Display::fillCircleHelper(int16_t x0, int16_t y0, int16_t r,
uint8_t part, int16_t offset, uint16_t color)
{
r = abs(r);
int16_t varX = 0, varY = r;
int16_t endY = 0;
int32_t var1 = 3 - 2 * r;
while(varX <= varY) {
if(part & 0x02) {
drawVLine(x0-varX, y0-varY, 2*varY+1+offset, color);
drawVLine(x0-varY, y0-varX, 2*varX+1+offset, color);
}
if(part & 0x01) {
drawVLine(x0+varX, y0-varY, 2*varY+1+offset, color);
drawVLine(x0+varY, y0-varX, 2*varX+1+offset, color);
}
if(var1 < 0) {
var1 = var1 + 4 * varX + 6;
} else {
var1 = var1 + 4 * (varX - varY) + 10;
varY --;
}
varX ++;
}
}
int32_t DFRobot_Display::readN(Stream * s, uint8_t* pBuf, int32_t length)
{
int32_t l=length;
if(pBuf == 0) {
while((length --) && (s->available())) {
s->read();
}
} else {
while((length --) && (s->available())) {
*pBuf = s->read();
pBuf ++;
}
}
return l-length;
}
int16_t DFRobot_Display::drawBmp(Stream *s, int16_t x, int16_t y)
{
uint16_t i = 0, j = 0, k = 0;
int32_t picWidth = 0, picHeight = 0;
uint8_t colorBuf[4] = {0};
limitPixel(x, y);
if(s == 0) {
return DISPLAY_ERR;
} else {
readN(s, 0, 18);
readN(s, colorBuf, 4);
picWidth = colorBuf[0] | ((uint32_t)colorBuf[1] << 8) | ((uint32_t)colorBuf[2] << 16) | ((uint32_t)colorBuf[3] << 24);
_DEBUG_PRINT("\n pic width :");
_DEBUG_PRINTVAR(picWidth, DEC);
readN(s, colorBuf, 4);
picHeight = colorBuf[0] | ((uint32_t)colorBuf[1] << 8) | ((uint32_t)colorBuf[2] << 16) | ((uint32_t)colorBuf[3] << 24);
_DEBUG_PRINT("\n pic height :");
_DEBUG_PRINTVAR(picHeight, DEC);
readN(s, 0, 4);
readN(s, colorBuf, 4);
if(colorBuf[0] > 0) {
_DEBUG_PRINT("\n not support");
return DISPLAY_ERR_NOTSUPPORT;
}
readN(s, 0, 20);
#if((defined __ets__) || (defined ESP_PLATFORM))
k = picWidth * 3;
uint8_t* colorDat = (uint8_t*) malloc(k);
if(colorDat == NULL) {return DISPLAY_ERR_MEMOVER;}
for(i = 0; i < picHeight; i ++) {
#ifdef __ets__
ESP.wdtFeed();
#endif
readN(s, colorDat,k);
drawBuffer_24(x, y + (picHeight - i), colorDat, k);
}
free(colorDat);
#else
for(i = 0; i < picHeight; i ++) {
for(j = 0; j < picWidth; j ++) {
readN(s, colorBuf, 3);
drawBuffer_24(x, y + (picHeight - i), colorBuf, 3);
}
}
#endif
}
}
void DFRobot_Display::drawBmp(uint8_t* pData, int16_t x, int16_t y, uint16_t w, uint16_t h,
uint8_t size, uint16_t color)
{
uint16_t i = 0, j = 0, k = 0, m = 0;
uint8_t var1 = 0;
if((w % 8) == 0) w = w / 8;
else w = w / 8 + 1;
for(i = 0; i < h; i ++) {
for(j = 0; j < w; j ++) {
var1 = pData[i * w + j];
for(k = 0; k < 8; k ++) {
if(var1 & (0x80 >> k)) {
for(m = 0; m < size; m ++) {
drawVLine(x + k * size + 8 * j *size + m, y + i * size, size, color);
}
}
}
}
}
}
void DFRobot_Display::drawBmp(uint8_t* pData, int16_t x, int16_t y, uint16_t w, uint16_t h)
{
int16_t i = 0;
for(i = 0; i < h; i ++) {
drawBuffer_24(x, y + i, pData + i * w * 3, w * 3);
}
}
int16_t DFRobot_Display::setRotaion(eROTATION eRotation_)
{
switch(eRotation) {
case eROTATION_0: width = rawWidth; height = rawHeight; break;
case eROTATION_90: width = rawHeight; height = rawWidth; break;
case eROTATION_180: width = rawWidth; height = rawHeight; break;
case eROTATION_270: width = rawHeight; height = rawWidth; break;
default: return DISPLAY_ERR_NOTSUPPORT;
}
eRotation = eRotation_;
return DISPLAY_ERR_OK;
}
eROTATION DFRobot_Display::getRotation(void)
{
return eRotation;
}
void DFRobot_Display::setTextColor(uint16_t color)
{
textColor = color;
}
int16_t DFRobot_Display::getTextColor(void)
{
return textColor;
}
void DFRobot_Display::setTextBackground(uint16_t color)
{
textBackground = color;
}
int16_t DFRobot_Display::getTextBackground()
{
return textBackground;
}
void DFRobot_Display::setTextSize(uint8_t size)
{
textSize = size;
}
uint8_t DFRobot_Display::getTextSize(void)
{
return textSize;
}
void DFRobot_Display::setLineWidth(uint16_t w)
{
lineWidth = w;
}
uint16_t DFRobot_Display::getLineWidth()
{
return lineWidth;
}
int16_t DFRobot_Display::getWidth(void)
{
return width;
}
int16_t DFRobot_Display::getHeight(void)
{
return height;
}
void DFRobot_Display::setDisplayShape(eSHAPE eShape)
{
switch(eShape) {
case eSHAPE_CIRCLE: eShape = eSHAPE_CIRCLE; displayRadius = width / 2; break;
case eSHAPE_RECT: eShape = eSHAPE_RECT; break;
}
}
eSHAPE DFRobot_Display::getDisplayShape(void)
{
return eShape;
}
int16_t DFRobot_Display::getDisplayRadius(void)
{
if(eShape == eSHAPE_CIRCLE) {
return displayRadius;
}
return 0;
}
void DFRobot_Display::setCursor(int16_t x, int16_t y)
{
if(x > width) {
printfX = width;
} else {
printfX = x;
}
if(y > height) {
printfY = height;
} else {
printfY = y;
}
}
void DFRobot_Display::getCursor(int16_t* pX, int16_t* pY)
{
*pX = cursorX;
*pY = cursorY;
}
void DFRobot_Display::supportChineseFont(void)
{
pfCharacterFont = GT30L_getCharacter;
}
void DFRobot_Display::setOrign(int16_t x, int16_t y)
{
if(x > width) {
cursorX = width;
} else {
cursorX = x;
}
if(y > height) {
cursorY = height;
} else {
cursorY = y;
}
}
void DFRobot_Display::getOrign(int16_t* pX, int16_t* pY)
{
*pX = printfX; *pY = printfY;
}
void DFRobot_Display::drawBuffer_16(int16_t x, int16_t y, uint16_t* pBuf, uint16_t count)
{
}
void DFRobot_Display::drawBuffer_24(int16_t x, int16_t y, uint8_t* pBuf, uint16_t count)
{
uint16_t i = 0;
for(i = 0; i < (count / 3); i ++)
drawPixel(x + i, y, color24To16(pBuf[i * 3], pBuf[i * 3 + 1], pBuf[i * 3 + 2]));
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C++
1
https://gitee.com/dfrobot/DFRobot_Display.git
git@gitee.com:dfrobot/DFRobot_Display.git
dfrobot
DFRobot_Display
DFRobot_Display
master

搜索帮助