cancel
Showing results for 
Search instead for 
Did you mean: 

TextureMapper and ORIENTATION_PORTRAIT

kvl
Associate II

Hi

I have som problems using ORIENTATION_PORTRAIT. I got an display physically in landscape orientation, but optionally used in portrait orientation.

Texts and lines works fine but images are not rotated automatically. :-(

But I am surprised that images using the touchgfx::Image class does not rotate automatically.

Therefore I have tried to use the TextureMapper instead. When used in portrait mode The TextureMapper works fine, rotating and scaling works perfect. But in Portrait orientation it seems only to work if the image area and/or the bitmap size are square. If e.g. the bitmap size is 96*192 pixels in an area at 96*192 the image is like interlaced in either rotation and scale.

0690X000009YLqHQAW.jpg 

The center icon is square. The others are 192x96.

The left and center icon are rotated 60° and the right one is rotated 270°

Is this a bug, or am I used the TouchGFX wrongly?

I am constructing the screens programmically as the are too dynamic to use the designer. But I am using the Designer for loading the images and controlling the screen navigation.

Here is some code snippets:

In BoardConfiguration:
hal.setDisplayOrientation(ORIENTATION_PORTRAIT);   
 
In BitmapDatabase:
const uint16_t BITMAP_AIRSPRAY_OFF_ID = 1; // Size: 192x96 pixels
 
In header file: 
#include <touchgfx/widgets/TextureMapper.hpp>
 
touchgfx::TextureMapper images1;
 
In Constructor:
images1.setPosition(0, 0, 192, 92);
images1.updateAngles(0, 0, 3*PI/2);
add(image1);
 
Later:
images1.setBitmap(touchgfx::Bitmap(BITMAP_AIRSPRAY_OFF_ID));
images1.setOrigo(images1..getWidth()/2, images1.getHeight()/2);
images1.setVisible(true);
images1.invalidate();

BR

Kasper

1 REPLY 1
kvl
Associate II

Hi,

I just got some more observations. It is the bitmap size that is the problem. If not square, the image tilts. A square image will always be shown correctly, even if the container is not square.

Kasper