cancel
Showing results for 
Search instead for 
Did you mean: 

Is rotating the widgets is possible with the touchgfx without using the Image related widgets?

Vineetha
Associate

Hiii,

I am using the STM32H745XI Discovery Board, I need to rotate a box or any other widgets from TouchGFX in  both clockwise and anticlockwise. I have tried with using the Texture Mapper earlier by taking an image, but now all I need is without using the Image. Is it Possible to do that?

Thank you...

@Osman SOYKURT 

2 REPLIES 2
Osman SOYKURT
ST Employee

Hello @Vineetha ,

It's not possible to rotate natively other widgets than Texture Mappers and SVG Images. However, you can manage to rotate pretty much all widgets using dynamic Bitmaps in association to Texture mappers.
The idea is to put your widget in a dynamic bitmap and then use a texture mapper to show the content of your dynamic bitmap. I've managed to rotate a video for example using this trick.
Let me know if you succeed to make it, otherwise I can share a custom widget showing this.

Osman SOYKURT
ST Software Developer | TouchGFX
ramprakash13
Associate II

Rotating widgets in TouchGFX without using the Image related widgets is not directly supported. TouchGFX is designed to work with static widgets and does not provide a built-in method for rotating non-image widgets.

However, you can achieve this effect by creating a custom widget. This would involve creating a new class that inherits from the base Widget class and implementing the draw method to handle the rotation. This would require a good understanding of C++ and the TouchGFX framework.

Here is a simple example of how you might start creating a custom rotating widget:

 

 class RotatingWidget : public touchgfx::Widget { public:     RotatingWidget() : angle(0) {}
virtual void draw(const touchgfx::Rect& invalidatedArea) const { // Implement drawing code here }
void setAngle(int newAngle) { angle = newAngle; invalidate(); // Redraw the widget }
private: int angle; };

In the draw method, you would need to implement the code to draw the widget at the specified angle. This could involve drawing the widget to an off-screen buffer, rotating the buffer, and then drawing the buffer to the screen.