Var dw: Longword; b: array[0..3] of Byte absolute dw; begin bmp.Width:=32*((right-left+31) div 32); bmp.Height:=32*((bottom-top+31) div 32); bmp.PixelFormat:=pf1Bit; // ... // =========================================== // WRITE ACTUAL BITS AND BYTES.... bmp.Canvas.Rectangle(-1, -1, bmp.Width+1, bmp.Height+1); if F2DBarcode then DrawBarcode(bmp.Canvas, -Left, -Top) else bmp.Canvas.Draw(-Left, -Top, FLogo); for x:=0 to bmp.Width-1 do begin byt:=x div 8; bit:=$80 shr (x mod 8); for y:=0 to bmp.Height div 32-1 do begin dw:=0; for c:=0 to 31 do begin data:=bmp.ScanLine[32*y+c]; if (32*y+c<=bottom-top) and ((data[byt] and bit)=0) then dw:=dw or ($01 shl c); end; Write(f, b[0]); Write(f, b[1]); Write(f, b[2]); Write(f, b[3]); end; end; end.