Skip to main content
Lviet.1
Associate II
April 29, 2020
Question

why can't we draw more than 45 lines in touchgfx?

  • April 29, 2020
  • 3 replies
  • 1310 views

..

This topic has been closed for replies.

3 replies

Martin KJELDSEN
Principal III
April 29, 2020

I need way more information than that :) thanks

Martin KJELDSEN
Principal III
April 30, 2020

What are you trying to achieve? Generally, adding as many widgets as possible to a root container of a view is not always the best option. Try bundling some lines together in a container. Maybe you really don't need a canvas line with antialiasing but can create a custom widget that implements ::draw() and writes pixels directly into the farmebuffer.

/Martin

Lviet.1
Lviet.1Author
Associate II
May 1, 2020

thank you for replying. I like your idea "create a custom widget that implements ::draw() and writes pixels directly into the farmebuffer", but I don't know how to do that. Can you help me ?

Lviet.1
Lviet.1Author
Associate II
May 1, 2020

For example, I want to draw a rectangle with 5x5 pixels, how do I do it?

  1. void MyWidget::draw(const touchgfx::Rect& invalidatedArea) const
  2. {
  3. //lock FB - Get pointer to start of framebuffer
  4. uint16_t* fb = touchgfx::HAL::getInstance()->lockFrameBuffer();
  5. for(int x = 0; x < 5; x++)
  6. {
  7. for(int y = 0; y < 5; y++)
  8. {
  9. // what do I need write here
  10. }
  11. }
  12. //Unlock FB
  13. touchgfx::HAL::getInstance()->unlockFrameBuffer();
  14. }