cancel
Showing results for 
Search instead for 
Did you mean: 

Is there a way to dynamically scale/resize widgets along one axis only?

YTalh.1
Associate II

Hi there,

I am using a 800x480 display that does not have square pixels. Therefore, my custom containers are always "stretched" along the y-axis. This is not a problem for static images in my container, since I can scale the image before on the PC side. However, for more complex assets, like images that need to be rotated, I cannot scale the images on the PC side because the scaling needs to change depending at what angle the image is rotated. In other words, the image needs to be scaled dynamically along the y-axis only. Is there a way to do that with TouchGFX?

4 REPLIES 4
MM..1
Chief II

I use this on scalable image

background.setWidth(2*background.getWidth());	
    background.setScalingAlgorithm(touchgfx::ScalableImage::NEAREST_NEIGHBOR);

YTalh.1
Associate II

I don't think this will work with any widget though (I tried on my custom container, and it does not rescale the image, it just crops the container to whatever width/height you set it to).

Thank you for your input though.

MM..1
Chief II

Oh yes you ask widget but write about images. Widgets except scalable image cant be rescaled only resized as you write result is crop.

Alexandre RENOUX
Principal

Hello YTalh,

As MM..1 mentioned, you cannot re-scale widgets like this. The only widgets that are re-scalable are only the scalable image, the zoomAnimatedImage and the Texture Mapper. Scaling requires a lot of MCU power so I would suggest you to avoid using it too much depending on which MCU you're working on.

/Alexandre