Data "" ?

Blitz3D Forums/Blitz3D Programming/Data "" ?

Boiled Sweets(Posted 2003) [#1]
I've seen some bb file files with a load of Data "asdasd" lines in 'em. What are they? One appears to be a gfx file, how do I go about encoding my own?

Thnaks.


jfk EO-11110(Posted 2003) [#2]
asdasd?

you could store an images Pixels as Integers in the Data. For this you need a little App to make a Data Block out of an Image. You can then add the Data Bock to the Code of an other Program and use it. PLease note you should not use this with big Pictures.

Converter:
graphics 640,480,32,2
setbuffer backbuffer()

img=loadimage("img2convert.bmp")
setbuffer imagebuffer(img)
w=writefile("datablock.txt")

writeline w, "Data "+imagewidth(img)
writeline w, "Data "+imageheight(img)

lockbuffer
for y=0 to imageheight(img)-1
 line$="Data "
 for x=0 to imagewidth(img)-1
  rgb=readpixelfast(x,y) and $ffffff
  line$=line$+"$"+hex$(rgb)
  if x<imagewidth(img)-1 then line$=line$+","
 next
 writeline w,line$
next
unlockbuffer

closefile w


In the Program you want to use the Image you could then
make something like this:
restore pic
read w
read h
img=createimage(w,h)
setbuffer imagebuffer(img)
lockbuffer
for j=0 to h-1
 for i=0 to w-1
  read rgb
  writepixelfast i,j,rgb
 next
next
unlockbuffer
;...
.pic
include "databock.txt"



Panno(Posted 2003) [#3]
please write

.pic
inlude "datablock.txt"



mfg panno
war mir ein vergnügen @Norc


superqix(Posted 2003) [#4]
This will make them for you...

http://www.blitzbasic.com/codearcs/codearcs.php?code=404


jfk EO-11110(Posted 2003) [#5]
PANNO - huh? Inlude? No idea what you mean. Ahh! Databock...grin. A classical freudian Lapsus :) But "Inlude" is one as well - you Luder! ;)