SaveOffset example for Delphi

{This example saves a TBitmapHandle as RAW data starting at offset nOffset.

The data is padded so that each line of bytes is evenly divided by 4. 

The bits in each byte are reversed before saving. The bits per pixel of the raw data is the same as the BitmapBits Property. If the Bitmap is a palletized image, the palette is not saved--only the raw data.} 

Procedure TForm1.SaveRawData ( szFileName: String; nOffset: Integer );
var
   nRet: Integer;
begin
   LEADImage1.SaveLSB:= True;
   LEADImage1.SavePad4:= True;
   nRet:= LEADImage1.SaveOffset(szFileName, nOffset, FILE_RAW, 0, 0, 0);
   if (nRet = SUCCESS) Then
      ShowMessage ( 'SUCCESS file save: ' + szFileName + '  Size Written: ' + IntToStr(LEADImage1.FileSizeWritten) )
   else
      ShowMessage ( 'FAILED--file save: ' + szFileName )

end;