picture from stream
BlitzMax Forums/BlitzMax Programming/picture from stream
| ||
The question has probably already been asked a couple of times but i couldn't find anything with the "search" method... is it possible to read some binary data from a file and, knowing that this data is in fact a png for example, to convert it in a TImage thing? One "ugly" way to do so would be reading the wanted part as a binary stream, then save it as a temp file wich then would be loaded with the LoadPNG function... this is "ugly" and probably slow since it requires 2 hard drive access which could be time consuming if the pictures I want to load are big or numerous or both. So i m looking for a cleanert way, the objective being to encapsulate my game data in a single binary file Thanks in advance :) |
| ||
Load it into a bank and then use a bank stream as the source of LoadImage() ? |
| ||
Funny you should ask this question, as I was recently working on a similar problem. It's as AngelDaniel suggests. Here's some sample code ripped from an encoder/decoder I wrote. Hope it helps. EDIT: Simplified initial example. |
| ||
This might also help: File nibbler |
| ||
Just to clarify the simplest solution... http://www.blitzbasic.com/Community/posts.php?topic=50729#565158 |
| ||
wow, thanks for all the replies :) |