Код:
//Обрабатываем массив пикселей
for row:=0 to PicHeight-1 do begin
InSrc:=($13+(PicHeight-row-1)*PicWidth*BPCount);
for col:=0 to PicWidth-1 do begin
for pix:=0 to 7 do begin
InSrcTp:=InSrc;
if (pix mod 2)=0 then begin
ColByte:=%00000000;
if (BPMask and %00000001)<>0 then begin
ColByte:=ColByte or (((File4View[InSrcTp] and (%10000000>>pix))>>(7-pix))<<0);
Inc(InSrcTp,PicWidth);
end;
if (BPMask and %00000010)<>0 then begin
ColByte:=ColByte or (((File4View[InSrcTp] and (%10000000>>pix))>>(7-pix))<<1);
Inc(InSrcTp,PicWidth);
end;
if (BPMask and %00000100)<>0 then begin
ColByte:=ColByte or (((File4View[InSrcTp] and (%10000000>>pix))>>(7-pix))<<2);
Inc(InSrcTp,PicWidth);
end;
if (BPMask and %00001000)<>0 then begin
ColByte:=ColByte or (((File4View[InSrcTp] and (%10000000>>pix))>>(7-pix))<<3);
Inc(InSrcTp,PicWidth);
end;
ColByte:=ColByte<<4;
end
else begin
if (BPMask and %00000001)<>0 then begin
ColByte:=ColByte or (((File4View[InSrcTp] and (%10000000>>pix))>>(7-pix))<<0);
Inc(InSrcTp,PicWidth);
end;
if (BPMask and %00000010)<>0 then begin
ColByte:=ColByte or (((File4View[InSrcTp] and (%10000000>>pix))>>(7-pix))<<1);
Inc(InSrcTp,PicWidth);
end;
if (BPMask and %00000100)<>0 then begin
ColByte:=ColByte or (((File4View[InSrcTp] and (%10000000>>pix))>>(7-pix))<<2);
Inc(InSrcTp,PicWidth);
end;
if (BPMask and %00001000)<>0 then begin
ColByte:=ColByte or (((File4View[InSrcTp] and (%10000000>>pix))>>(7-pix))<<3);
Inc(InSrcTp,PicWidth);
end;
MBuffer.WriteByte(ColByte);
end;
end;
Inc(InSrc);
end;
end;