Csabo
Moderator
Posts: 541
Registered: 02-02 |
The problem is in the inner loop:
code: for b := 0 to DPic.Height-1 do
begin
dStream.Read(pixels,1);
TByteArray(Result.ScanLine[b]^)[a] := pixels;
end;
This won't work. Instead you need a while loop, which stops when a $FF is reached. Here's an example sequence from an imaginary image. If you can process this, you are in business:
$10 $03 $AA $F1 $F2 $F3 $AA
$20 $05 $AA $F1 $F2 $F3 $F4 $F5 $AA
$FF
$10 means the sequence starts from $10 pixels down. $03 means three pixels will follow, however there's an extra byte in the beginning and end, so the $AA's are ALL skipped, you should ignore those bytes completely. The $Fx values are the actual pixels. Then another 5 pixel sequence from $20, and the then $FF tells you this column is done. Every other pixel in this column is 'undefined' or 'transparent' if you will.
This is the basic doom image format, for 'tall sprites' it's a bit different, but once you have the basic, that change will be easy. Hope this helps.
|