cancel
Showing results for 
Search instead for 
Did you mean: 

Program crash after drawing a line

FMuel.3
Associate II

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

1 REPLY 1
MM..1
Chief III

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