file type

I want to use as less libraries as possible.

I don’t see bad stuffs in your code, it should work.
Try to use char instead of unsigned char to store the values (and cast into char if necessary).
Also, ensure your rendering context is still available when you do that.
I really don’t see what’s wrong, sorry.

You’re not using libraries (apart from C/C++) if you write your own image handling code. The header has nothing to do with the library.

Originally posted by jide:
I don’t see bad stuffs in your code, it should work.
Try to use char instead of unsigned char to store the values (and cast into char if necessary).
Also, ensure your rendering context is still available when you do that.
I really don’t see what’s wrong, sorry.

Ok.

You’re not using libraries (apart from C/C++) if you write your own image handling code. The header has nothing to do with the library.
What I meant was, I don’t want to use libpng, because I want to use as less libraries as possible, so that’s why I choose for creating my own headers.