Read an image file
Posted: Mon Feb 04, 2008 1:57 pm
Can anybody tell me how to read an image file, so that I can draw it with a canvas?
Thanx wrote:Maybe you could use draw_from You'ld need another actor that has the animation, but you could put the actor out of view, or make it transparent. No better idea, unless there's a C function for loading images, which I'm sure there is, but I don't know what it is, or how to use it.
DilloDude wrote:I made a function to load a BMP file (at least it works with one). Fuzzy made a TGA loader.
I'll test mine out a bit and then post it, if you want.
/* XPM */
static char * example_xpm[] = {
"24 20 3 1",
" c None",
". c #0000FF",
"+ c #FF0000",
" ",
" .. ",
" .... ",
" ......++++++++ ",
" .........+++++++ ",
" ..........+++++++ ",
" ............++++++ ",
" .............++++++ ",
" ..............++++ ",
" +.............+++ ",
" ++.............++ ",
" +++.............+ ",
" +++++............. ",
" ++++++.............. ",
" ++++++++............ ",
" +++++++++........... ",
" +++++++++......... ",
" ++++++++++....... ",
" ++++++++++..... ",
" +++++++++ ... "};