Bitmap/Read a PPM file: Difference between revisions

→‎{{header|D}}: drastically improve reading :)
m (→‎{{header|D}}: missing D, btw implementation is probably slow, and would be cool to change it)
(→‎{{header|D}}: drastically improve reading :))
Line 171:
import tango.io.MappedBuffer;
import tango.io.stream.LineStream;
import tango.io.stream.DataStream;
import tango.io.protocol.Reader;
import tango.text.convert.Integer;
Line 190 ⟶ 189:
throw new BadInputException;
 
if (processData(new DataInput(fileBuf)))
throw new BadInputException;
}
Line 221 ⟶ 220:
}
 
int processData(DataInputMappedBuffer dimb) {
if (! gotImg) throw new NoImageException;
foreach mb.fill(ref cell; bitmap.data) {;
cell(di.getByte, di.getByte, di.getByte);
}
return 0;
}
Anonymous user