Skip to main content
Iswarya
Associate III
August 28, 2019
Question

how to draw background image using tiling technique

  • August 28, 2019
  • 8 replies
  • 1649 views

We are trying to draw a full screen (480x272) but using a tiling method of size 16x16 pixels. We are using a struct UI_Image for each tile, like this one below:

struct UI_Image{

touchgfx::Image image;

uint8_t image_id;

uint8_t is_created;

};

struct UI_Image ui_image[30];

For our entire screen that’s mean, we need an array of 30 x 17 = 510 structures!

But, we got many error when compiling which goes away when we use a small number like [30]… here is a screen shot of the errors

Perhaps there is a better way to achieve this tiling technique?

Also, could we draw using a RAM address instead of FLASH address, which could allow procedural changes in time?

This topic has been closed for replies.

8 replies

Martin KJELDSEN
Principal III
August 29, 2019

Hi, there's no screenshot attached. Maybe you simply copy/pasted it in and while the editor will show it, it wont be in the post :(

We already have a tiling image widget in TouchGFX. Did you try it and hate it or just want to try making your own?

/Martin

YHami
Visitor II
August 29, 2019

Hi Martin,

I am coworker of Iswarya... here is the screen shot showing the errors:

0690X00000AAZ1hQAH.png

I took a look but the tiling widget "TiledImage", has the following description:

"Simple widget capable of showing a tiled bitmap. This means that when TiledImage is larger than the provided Bitmap, the Bitmap is repeated over and over horizontally and vertically. The bitmap can be alpha-blended with the background and have areas of transparency."

However, we would like to have the possibility to have a different source tile (address) for each tile in order to compose large complex images using a small amount of memory.

Our first try was to define each tiles but perhaps it's possible to create our own widget and have our own paint function?

Thanks in advanced,

Yann