Skip to main content
FMuel.3
Associate
November 30, 2022
Question

Program crash after drawing a line

  • November 30, 2022
  • 1 reply
  • 718 views

Hi everyone,

I need a function to draw many lines on runtime to show different work progresses. The lines should be able to be invisible and have 4 different colors.

When I would use the lines from TouchGFX it would generate a huge code to select the correct lines in the right colors.

Therefore I wanted to draw my own lines and add them at the place I need it.

I found this code below, but my code crashes after add(line1);

Any idea what I'm doing wrong

 Line line1;
 PainterRGB565 linePainter;
 
 line1.setPosition(5, 125, 240, 1);
 linePainter.setColor(Color::Color::getColorFromRGB(112, 146, 184));
 line1.setPainter(linePainter);
 line1.setStart(2, 0);
 line1.setEnd(438, 0);
 line1.setLineWidth(1);
 line1.setLineEndingStyle(touchgfx::Line::ROUND_CAP_ENDING);
 
 
 add(line1);

?

Thank you very much

This topic has been closed for replies.

1 reply

MM..1
Super User
November 30, 2022

Is your framebuff RGB565? Where you place this code? Customize canvas buffer size for screen.