the main code is below.
Draw2D_BufInfo sBufInfo;
uint16_t *pDisplayBuf565;
pDisplayBuf565 = tivxMemAlloc(DISPLAY_WIDTH * DISPLAY_HEIGHT * sizeof(uint16_t), TIVX_MEM_EXTERNAL);
if (pDisplayBuf565 == NULL)
{
printf("app_tidl: ERROR: Unable to allocate memory for displayBuf565, size = %ld\n", DISPLAY_WIDTH * DISPLAY_HEIGHT * sizeof(uint16_t));
status = -1;
}
if (obj->pHndl != NULL)
{
sBufInfo.bufWidth = DISPLAY_WIDTH;
sBufInfo.bufHeight = DISPLAY_HEIGHT;
sBufInfo.bufPitch[0] = DISPLAY_WIDTH * 2;
sBufInfo.dataFormat = DRAW2D_DF_BGR16_565;
sBufInfo.transperentColor = 0;
sBufInfo.transperentColorFormat = DRAW2D_DF_BGR16_565;
sBufInfo.bufAddr[0] = (uint8_t *)pDisplayBuf565;
Draw2D_setBufInfo(obj->pHndl, &sBufInfo);
// Draw2D_clearBuf(obj->pHndl);
Draw2D_FontPrm sPoint;
sPoint.fontIdx = 1;
for (int i = 0; i < new_points0_size; i++)
{
printf("corners %i, x: %i, y: %i\n", i, new_points0[i].x, new_points0[i].y);
// Draw2D_drawPixel(obj->pHndl, new_points0[i].x, new_points0[i].y, RGB888_TO_RGB565(255, 0, 0), DRAW2D_DF_BGR16_565);
Draw2D_drawString(obj->pHndl, 100, 100, "2", &sPoint);
}
}
tivxMemFree(pDisplayBuf565 , DISPLAY_WIDTH * DISPLAY_HEIGHT * sizeof(uint16_t), TIVX_MEM_EXTERNAL);pHndl is init in the init function, as below.