Structured Fax File (SFF)

Published on Torry's Delphi Pages
Version 1.02. Last change at 2000-06-06. Deutsche Version dieser Seite DE

Table of contents:

Introduction
TSFFGraphic: Methods and properties
TSFFGraphic: Methods and properties for developers
TSFFFile: Methods and properties
TSFFFile: Methods and properties for developers
Created exception
Usage conditions
Download of the Unit
History


Introduction

The classes TSFFGraphic and TSFFFile read files, that are in the Structured Fax File (SFF) format. Those are created by software like Fritz! by AVM.

There are two classes.
TSFFGraphic is inherited from TGraphic and has TGraphics' properties. TSFFGraphic contains only one page.
TSFFFile creates a list of as many TSFFGraphic instances, as there are pages in the document.

SFF-files can only be read.

This unit works from Delphi 3 up, later versions should work, too, I would be glad to get a response to this.
An implementation for Delphi 2 is in planning.

Back to the table of contents

TSFFGraphic: Methods and properties

Methods

procedure LoadFromStream(Stream: TStream); override;
Reads a single SFF page, beginning from the actual position, from the stream. The stream must be positioned on a document header or a page header. After calling this function, the stream is positioned on the beginning of the next page. This means for LoadFromFile, that only the first page is read.

procedure SaveToStream(Stream: TStream); override;
Creates an ESFF exception.

procedure ReadData(Stream: TStream); override;
Reads the length (Longint) and then a page from the stream.

procedure WriteData(Stream: TStream); override;
Writes first the length (Longint) and then a single page into the stream. This method is for saving in a form and is not a appropriate way for output into a file.

procedure LoadFromClipboardFormat(AFormat: Word; AData: THandle;
                                  APalette: HPALETTE); override;

procedure SaveToClipboardFormat(var AFormat: Word; var AData: THandle;
                                var APalette: HPALETTE); override;
The clipboard procesures create an ESFF exception.

properties

property LineLength:Integer read GetLineLength;
Returns the number of dots per page, this value should be always 1728. This value is also set for the width property.

property LineCount:Integer read GetLineCount;
Returns the number of lines from the page. At default fax resolution (203 dpi / 98 dpi) height is set on the double value from LineCount, else both values are identical.

property ResolutionHorizontal:Integer read GetResolutionHorizontal;
Returns the horizontal resolution in dpi, this value should be always 203.
If this value is 0, the resolution is unknown.

property ResolutionVertical  :Integer read GetResolutionVertical  ;
Returns the vertical resolution in lpi, default is 98 lpi, in high resolution 196 lpi.
If this value is 0, the resolution is unknown.

Back to the table of contents

TSFFGraphic: Methods and properties for developers

procedure Decompress;
With this procedure you can manually activate the decompression of the pixel data. Usually this is only necessary, if changes on the bitmap shall be undone.

property Bitmap:TBitmap read GetBitmap;
Returns a TBitmap instance, holding the decompressed data. On use the decompression is made, if necessary. If the page is empty, it returns Nil.

Back to the table of contents

TSFFFile: Methods and properties

property PageCount:Integer read GetPageCount;
Returns the number of pages, included in the document.

property Filename:String read FFilename write SetFilename;
The file name of the SFF file. If this value is changed, the file is read.

property Graphics[AIndex:Integer]:TSFFGraphic read GetGraphics;
This property returns a TSFFGraphic instance for each page.

Back to the table of contents

TSFFFile: Methods and properties for developers

function CreateStream:TStream; virtual;
With this function the kind of stream, that is used for reading the file, is set. Default is a TFileStream.

Back to the table of contents

Created exception

ESFF = class(Exception);
ESFF is the exception class for both classes.

Back to the table of contents

Usage conditions

Copyright 2000, Peter Haas

Private usage and modification is without any limitation
The author is interested on the results of changes, extensions and enhancements.

Commercial usage is allowed only after permission by the author.

The source code may be copied only in full and unmodified form with all files.

Back to the table of contents

Download der Unit

Here you candownload the unit (22 kByte). In addition to the unit, there is a simple sample application included, to demonstrate the usage of the unit.

I am interested in an exchange of experience. Please mail me.

Owing to at Sven Opitz for its translation into the English.

Back to the table of contents

History

2000-02-06 - Version 1.0 (beta)
- First public release
 
2000-02-11 - Version 1.01 (beta)
- Attempt to change the unit over to Delphi 2-Bitmaps (SFF.pas)
- Blank lines were black output, status: fixed (SFF.pas)
- Inserting additional MakeUp codes for Zeilen>1728 (MHTools.pas)
- Demo extends (Main.pas)
 
2000-06-06 - Version 1.02
- SFF.pas is based on Version 1.0
- Blank lines were black output, status: fixed (SFF.pas)
- MHTools based on 1.01
- Demo based on 1.01
 
2001-05-10 - Version 2.0 alpha
- new basic class (without using TBitmap) (DIBGraphics.pas)
- bugfix: files without end page header are valid
- bugfix: corrupt data will be skipped
 
2002-03-14 - Version 2.01
- bugfix: decoding lines with more than 216 encoded bytes (SFF.pas)
- bugfix: TSFFImage.Height do return always the scaled size (SFF.pas)
  (LineCount * 2 for normal resolution)
 
Back to the table of contents

Mail me at webmaster@pjh2.de. Disclaimer