Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.
Ian_lett Newbie Joined: 21/08/2020 Location: United KingdomPosts: 6
Posted: 10:22am 07 Oct 2020
Copy link to clipboard
Print this post
Ian_lett Newbie Joined: 21/08/2020 Location: United KingdomPosts: 6
Posted: 10:33am 07 Oct 2020
Copy link to clipboard
Print this post
Hi
i have a png file that’s 750x750, and about 503k, contain my sprites i create a frame buffer of the same size or larger, and try to load the png file into it and i am getting the error message not enough heap memory.
i have also tried to load it directly to a mode 9 (1024x768) screen and got the same error and if i cut the sheet into 2 i can load the first half and create all my sprites from it, but get the error message when i attempt to load the second half of the sprites set.
is there a physical file size limit or a way to increase the heap?
regards ian
matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 10582
Posted: 10:49am 07 Oct 2020
Copy link to clipboard
Print this post
Unfortunately decoding PNG files is very inefficient when it comes to memory. Nothing can be done about this. Suggest you load it in smaller bits.
MauroXavier Guru Joined: 06/03/2016 Location: BrazilPosts: 303
Posted: 10:50am 07 Oct 2020
Copy link to clipboard
Print this post
The PNG file is a compressed file format and consumes RAM to be decoded on the framebuffer.
I had the same problem trying to fill a large framebuffer, and it solved using a single BMP file in RGB888 format (it will not work if use other formats).
The file size is bigger than PNG and will load a little slower, but will fix the problem. Edited 2020-10-07 20:53 by MauroXavier
Ian_lett Newbie Joined: 21/08/2020 Location: United KingdomPosts: 6
Posted: 03:45pm 07 Oct 2020
Copy link to clipboard
Print this post
Many thanks,
its working now, but i have lost the trasparency and all my sprites now have black borders, how do i set the black area to transparent, as i cant see how to do this.
MauroXavier Guru Joined: 06/03/2016 Location: BrazilPosts: 303
Posted: 03:59pm 07 Oct 2020
Copy link to clipboard
Print this post
Have you tried using full black RGB (0,0,0) as a transparent color?
matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 10582
Posted: 04:04pm 07 Oct 2020
Copy link to clipboard
Print this post
PNG should also work if you load smaller images at a time
elk1984 Senior Member Joined: 11/07/2020 Location: United KingdomPosts: 229
Posted: 04:18pm 07 Oct 2020
Copy link to clipboard
Print this post
I'm sure I've missed this somewhere, but does sprite always assume RGB(0,0,0) as transparent? I've had a few cases where I don't want transparency but when using sprite read / write black is changed to transparent.
Ian_lett Newbie Joined: 21/08/2020 Location: United KingdomPosts: 6
Posted: 10:17am 10 Oct 2020
Copy link to clipboard
Print this post
thanks for the help so far.
the bmp background is RGB(0,0,0), so how do i set this as transparent from basic ?