ScreenSaver

Blitz3D Forums/Blitz3D Beginners Area/ScreenSaver

a simple solution to convert a picture to a data-segment would also be:
f$="mypic.bmp"
pic=loadimage(f$)
wr=writefile("temp_data.bb")
writeline wr,"."+replace$(f$,".","_")
writeline wr,"Data "+imagewidth(pic)
writeline wr,"Data "+imageheight(pic)
setbuffer imagebuffer(pic)
lockbuffer()
for j=0 to imageheight(pic)-1
 z$="Data "
 for i=0 to imagewidth(pic)-1
 rgb=readpixelfast(i,j) and $ffffff
  if i<(imagewidth(pic)-1)
   z$=z$+"$"+hex$(rgb)+","
  else
   z$=z$+"$"+hex$(rgb)
  endif
 next
 writeline wr,z$
next
unlockbuffer()
closefile wr
end

(just typed, there may be typos)
Now there should be a file named temp_data.bb. You can copy paste it to your program, or use INCLUDE. To load such an image from this Data segement, you could do something like:

restore mypic_bmp
read w
read h
pic=createimage(w,h)
setbuffer imagebuffer(pic)
lockbuffer()
for j=0 to h-1
 for i=0 to w-1
  read rgb
  writepixelfast i,j,rgb
 next
next
unlockbuffer()
setbuffer backbuffer()