Displaying Images #96
-
Hello, I just got started using the Riverdi module that has the BT817 chip and external memory and I am trying to figure out how to display images and other widgets using this library. I used EVE asset builder to convert a logo in PNG format to RGB565 and then used HxD to export it as a HEX in a CPP file.
I had it displayed over the Logo on the top right corner but I get a blank white square that has a line in it. I am not sure what I am missing here, what is the right way to display an image on the screen using this library? |
Beta Was this translation helpful? Give feedback.
Replies: 6 comments 7 replies
-
That is basically correct, although I would not use HxD since the EVE Asset Builder has a BIN2C tool built in. But I would advise against this because your image data should have a size of 91kiB and you do not only need to store this However, my example needs to work with the FT810 and up but as you are using a BT817, I strongly recommend using ASTC compressed images. Oh, and if you have not done so, you probably need to change the macro for MEM_PIC1 to a different address, could be 0x00000. |
Beta Was this translation helpful? Give feedback.
-
The format would be EVE_ASTC_8X8 then, or is this just a copy-paste error? I am trying to go thru the exact same steps now, fetch an image, converted it to 216x216, converted that to ASTC-8x8. |
Beta Was this translation helpful? Give feedback.
-
Changing the second parameter in EVE_cmd_setbitmap(MEM_PIC1, EVE_ARGB1555, 216, 216); to EVE_ASTC_8X8
Fixed the problem. Thank you I don’t know how I missed this lol
Yeah Eve asset builder will not change the output location but it compresses it for me.
Thanks again !
|
Beta Was this translation helpful? Give feedback.
-
Still not working for me though, maybe I broke something else. :-) |
Beta Was this translation helpful? Give feedback.
-
Ok, I went over it again and modified this a little. The resulting picture is 215x203 and the odd numbers are on purpose. After conversion to ASTC 8x8 the image has 216x208 pixels. Yes, the compression ratio for full color images is poor, almost not worth it. I use byte format to avoid issues with the endianness across the platforms I am using. I put the array from kitty_215x203_216x208_COMPRESSED_RGBA_ASTC_8x8_KHR.c in tft_data.c of my example code, renamed it to "pic2", because of why not. And I put a line for this array in tft_data.h: The size needs to be correct in the header file or the next step will not work. EVE_cmd_inflate(0, pic2, sizeof(pic2)); The sizeof() needs the external declaration with the size to work. Now what this does with my library is to send the array by SPI to the command co-processor in chuncks of 3840 bytes. And here is the reason why I still advise to use the compression, even though the compression ratio is hardly worth it. This is exactly what helped me to quickly find the bug I introduced. And for the final step, integrate some lines into the display-list: If you wonder about the first line, just try what happens when you use a different color. :-) |
Beta Was this translation helpful? Give feedback.
-
Yes, just use EVE_cmd_flashread() to copy the data you already have directly. Edit: be aware that there are strict alignement requirements for source, dest and number parameters of CMD_FLASHREAD. If you only have one set of images and these all fit into RAM_G at the same time, then yes, TFT_init() would be the place. |
Beta Was this translation helpful? Give feedback.
The format would be EVE_ASTC_8X8 then, or is this just a copy-paste error?
I am trying to go thru the exact same steps now, fetch an image, converted it to 216x216, converted that to ASTC-8x8.
Now I wonder what there is a .raw file and a .astc file.
And the Asset Compressor of EAB 2.9.0 does neither allow me to select an output folder, nor compress the file - strange.