Bitmap/Read a PPM file: Difference between revisions
Content added Content deleted
m (→{{header|D}}: missing D, btw implementation is probably slow, and would be cool to change it) |
(→{{header|D}}: drastically improve reading :)) |
||
Line 171: | Line 171: | ||
import tango.io.MappedBuffer; |
import tango.io.MappedBuffer; |
||
import tango.io.stream.LineStream; |
import tango.io.stream.LineStream; |
||
import tango.io.stream.DataStream; |
|||
import tango.io.protocol.Reader; |
import tango.io.protocol.Reader; |
||
import tango.text.convert.Integer; |
import tango.text.convert.Integer; |
||
Line 190: | Line 189: | ||
throw new BadInputException; |
throw new BadInputException; |
||
if (processData |
if (processData(fileBuf)) |
||
throw new BadInputException; |
throw new BadInputException; |
||
} |
} |
||
Line 221: | Line 220: | ||
} |
} |
||
int processData( |
int processData(MappedBuffer mb) { |
||
if (! gotImg) throw new NoImageException; |
if (! gotImg) throw new NoImageException; |
||
mb.fill(bitmap.data); |
|||
cell(di.getByte, di.getByte, di.getByte); |
|||
} |
|||
return 0; |
return 0; |
||
} |
} |