2019-11-28 05:06 PM
Hello,
I tested Gauge widget.
So, I modified source code to change needle shape in Gauge.hpp.
// triangle
original : ShapePoint<float> points[3] = { { -2.5f, 0}, {0.0f, -70}, {2.5f, 0} };
// rectangle
modify : ShapePoint<float> points[4] = { { -1.0f, 0}, {-1.0f, -90}, {1.0f, -90}, {1.0f, 0} };
It was good.
But, I want to apply image file instead of shape point.
How to change needle as image file?
Let me know it!
Best regards,
Thanks.
2019-11-29 05:42 AM
Which "Gauge" Widget is this?
2019-11-29 06:36 AM
Dear Martin,
Thanks for your reply.
Refer to the below link
https://github.com/touchgfx/touchgfx-open-repository/tree/master/widgets/Gauge
Best regards,
2019-12-03 09:37 AM
There is a function in the Gauge class you provided called "setBitmaps" where you can change the background image and center image:
void Gauge::setBitmaps(Bitmap backgroundBmp, Bitmap centerBmp)
{
background.setBitmap(backgroundBmp);
background.setXY(0, 0);
I am pretty sure this Gauge class uses the "Shape" widget to create the points of the needle(s), so you won't be able to apply an "image" to the needle.
About the only way to do this is to use the Texture Mapper with an image and rotate it with animation. The Texture Mapper is very processor resource intensive (doesn't use ChromArt). If you want to experiment with it, take a look at the Analog Clock widget. Awhile back I played around changing the image for that widget, so I know it can be done.
That being said, I did manually create some decently detailed needles using the Shape class it just takes a lot of points and multiple shapes set to different colors. :smirking_face:
And the best part about that was that the Shape widget utilizes ChromArt.