Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local f=io.open(filename,'rb')
- f:seek('set',18)
- local y=string.byte(f:read(1))+string.byte(f:read(1))*256+string.byte(f:read(1))*65536+string.byte(f:read(1))*16777216
- local x=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',54)
- local r,g,b=0,0,0
- for j=0,x-1 do
- for i=0,y-1 do
- b,g,r=string.byte(f:read(1)),string.byte(f:read(1)),string.byte(f:read(1))
- if i<612 and x-j<380 and(not(r==0 and g==0 and b==0)) then
- tpt.create(i,x-j,elemtype)
- tpt.set_property('dcolour',r*65536+g*256+b+16777216*255,i,x-j)
- tpt.set_property(proptype,(r + g + b),i,x-j)
- if scale > 0 then
- tpt.set_property(proptype,(r + g + b) * scale,i,x-j)
- end
- end
- end
- end
- for i=1,y%4 do f:read(1) end
- f:close()
Advertisement
Add Comment
Please, Sign In to add comment