Stream & Pixmaps.

BlitzMax Forums/BlitzMax Programming/Stream & Pixmaps.

KillerHunter(Posted 2007) [#1]
Hello guys,

I was looking for a way to load images from a same file via a stream. I’d like to do some encrypting/decrypting. I can do it, but I have some difficult to decrypt the information with Blitz. I’ve tried to understand how BlitzMax works. If I am correct, each images/frames are stored into pixmaps and a pixmap has five properties: the height, the width, a pointer to the pixels, the pitch and the format. I almost always work with PNG images format, so I know that, first, I need to find all the necessary information such the height, width, size of the picture. This is all somewhere at the beginning of the PNG file, into the chunks of the file (Blitz probably uses them when it loads a file). Then maybe create buffer with the image data that the pixmap’s pointer will point on it?

Anyway, I’m a bit confused as you can see :D What I want to do is: I want to be able to load images via a stream into a same file. Exemple, I put my stream’s cursor to a byte X into my file then after I want to read Y bytes to get a TImage from the stream. If it could have a readImage function or something similar with the streams; it would be great!


Dreamora(Posted 2007) [#2]
LoadPixmap works on files as well as on TStream ... so you could use your stream, copy the needed part of to a temporary stream and load for it ... for example :)


KillerHunter(Posted 2007) [#3]
Ok, thanks pal!

I'm going to try this.