Skip to main content
Associate III
July 21, 2025
Question

Need some help for drawing line segment freely inTouchgfx

  • July 21, 2025
  • 1 reply
  • 210 views

hello everyone:

I have a problem trying to draw lines.In touchgfx,in most cases,things are done by bitmaps,but draw lines, it is awfull to use. In designer,if I want to draw a line ,I need to first add a line statement,then set line parameter, then add this line to screen.But in many applications,I have to draw dozens of line segments,even more.So,how can I manage to draw dozens of lines into screen or a dynamic bitmap?I have read about the cavas widget,but I can't find any demo on this subject, I really hope to get some help.

1 reply

ST Employee
July 21, 2025

Hello @amb,

You can find examples in the documentation Canvas Widgets | TouchGFX Documentation.

BR,

ambAuthor
Associate III
July 21, 2025

I tried to  put that code into screen1View.cpp,but got this :  error: no matching function for call to 'touchgfx::Canvas::Canvas(const Diamond10x10*, const touchgfx::Rect&)