Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function qrtz(filename)
- elemtype = 'qrtz'
- local f=io.open(filename,'rb')
- f:seek('set',20)
- local width=string.byte(f:read(1))+string.byte(f:read(1))*256+string.byte(f:read(1))*65536+string.byte(f:read(1))*16777216
- local height=string.byte(f:read(1))+string.byte(f:read(1))*256+string.byte(f:read(1))*65536+string.byte(f:read(1))*16777216
- f:seek('set',50)
- local red,green,blue=0,0,0
- for j=0,height-1 do
- for i=0,width-1 do
- blue,green,red=string.byte(f:read(1)),string.byte(f:read(1)),string.byte(f:read(1))
- if i<612 and height-j<380 then
- tpt.create(i,height-j,elemtype)
- tpt.set_property('tmp',((red+green+blue)*.013071895),i,height-j)
- tpt.set_property('life',((red+green+blue)*.013071895),i,height-j) -- No, life doesn't affect the color unless you change the element, but now you can change the element :)
- end
- end
- for i=1,width%4 do f:read(1) end
- end
- f:close()
- end
Advertisement
Add Comment
Please, Sign In to add comment