cancel
Showing results for 
Search instead for 
Did you mean: 

Is thiere a way to set touchGFX canvas widget with multiple colors?

zzzzz
Senior

I need draw a curve to display the sensors readings. The curve contains dots and lines. I created a custom canvas widget to do that and it works well. Here is the problem: I want to set color for different kind of readings. but the canvas widget can only have single color, because only one painter can set to canvas widget in a time.

I found this link and looks there has a way to do that:

https://touchgfx.zendesk.com/hc/en-us/community/posts/360001267451-Drawing-particles

it mentioned at the end:

In the meantime I found a simple way to get what I want with decent performances: I draw all my particles in a CanvasWidget, but each particle uses its own Canvas in the drawCanvasWidget function. This gives better performances than using a single canvas for everything, and leaves the ability to set the alpha and color for each particle. Since I only have to draw particles of size 2, 3 and 4 pixels, I've simply hardcoded the canvas path for each size (much faster than using the general purpose circle algorithm found in the Circle canvas widget).

It has been two years since then. Does anyone know how to do so, or any alternative solution? Thanks.

0 REPLIES 0