DATATRANSFER

pDATATRANSFER= ^DATATRANSFER;
DATATRANSFER= Packed Record
   nFillOrder: L_INT
   nBufMemCompression: L_INT
   nTransferMode: L_INT
   nScanFileFormat: L_INT
   nMemBufSize: L_INT
   bSaveToOneFile: L_BOOL
   bAppendToFile: L_BOOL
   bDumpMemBufsToFile: L_BOOL
   szFileName: Array [ 0..249 ] of L_CHAR
end;

The DATATRANSFER structure provides information about data transferring.

Member

Description

nFillOrder

Indicates how bytes in the image are to be filled by the source. Possible values are (according to the TWAIN 1.9 specification):

 

Value

Meaning

 

TWBO_LSBFIRST

Bytes are to be transferred with the least significant byte first.

 

TWBO_MSBFIRST

Bytes are to be transferred with the most significant byte first.

nBufMemCompression

Specifies the compression to be used when having the transfer mode set to be memory. Possible values are (according to the TWAIN 1.9 specification):

 

Value

Meaning

 

TWCP_NONE

No compression is to be used.

 

TWCP_PACKBITS

Pack Bits compression.

 

TWCP_GROUP31D

CCITT Group 3 compression with no End of Line.

 

TWCP_GROUP31DEOL

CCITT Group 3 compression with End of Line.

 

TWCP_GROUP32D

CCITT Group 3 compression (use cap for K Factor).

 

TWCP_GROUP4

CCITT Group 4 compression.

 

TWCP_JPEG

JPEG compression.

 

TWCP_LZW

LZW compression (like gifs).

 

TWCP_JBIG

JBIG compression, used mostly for bitonal images.

 

TWCP_PNG

PNG compressed.

 

TWCP_RLE4

RLE4 compression.

 

TWCP_RLE8

RLE8 compression.

 

TWCP_BITFIELDS

Bit Fields compression.

nTransferMode

Transfer mode to be used by the TWAIN source. Possible values are (according to the TWAIN 1.9 specification):

 

Value

Meaning

 

TWSX_NATIVE

Native transfer mode.

 

TWSX_MEMORY

Memory buffered transfer mode. The source will be transferring strips of data to the application according to the buffer size given.

 

TWSX_FILE

File transfer mode. This will use a specified file to have the image data saved to. This will have a certain format specified by the properties.

nScanFileFormat

Determines the file format to use when saving the files from the TWAIN source. Possible values are (according to the TWAIN 1.9 specification) :

 

Value

Meaning

 

TWFF_TIFF

Tagged image file.

 

TWFF_PICT

Macintosh PICT.

 

TWFF_BMP

Windows regular bitmap.

 

TWFF_XBM

X-Windows bitmap.

 

TWFF_JFIF

JPEG file interchange format.

 

TWFF_FPX

Flash pix file.

 

TWFF_TIFFMULTI

Multi-page tiff file format.

 

TWFF_PNG

PNG file.

 

TWFF_SPIFF

SPIFF file.

 

TWFF_EXIF

EXIF file.

nMemBufSize

Specifies the memory buffer size to be used in data transfer.

bSaveToOneFile

Flag that indicates whether to save a multiple pages to a single file. Possible values are:

 

Value

Meaning

 

TRUE

Save to a single file.

 

FALSE

Do not save to a single file.

bAppendToFile

Flag that indicates whether to append pages to the end of the file when saving a multi-page file. Possible values are:

 

Value

Meaning

 

TRUE

Append pages to the end of the file.

 

FALSE

Do not append pages to the end of the file.

bDumpMemBufsToFile

Flag that indicates whether to use the file name specified in szFileName field to dump the memory buffers received from the scanner. In this case the Bitmap Handle will not get the Bitmap Data, all the data will be saved to the file. Possible values are:

 

Value

Meaning

 

TRUE

Use file name.

 

FALSE

Do not use file name.

szFileName

Character string that contains the file name used in the file transfer mode. Use this member only if:

The nTransferMode member is set to TWSX_FILE.

Or

The nTransferMode member is set to TWSX_MEMORY and the bDumpMemBufsToFile member is set to TRUE.

Comments

pDATATRANSFER is a pointer to a DATATRANSFER structure. Where the function parameter type is pDATATRANSFER, you can declare a DATATRANSFER variable, update the structure's fields and pass the variable's address in the parameter. Declaring a pDATATRANSFER variable is necessary only if your program requires a pointer.

DATATRANSFER is used with the LTWAINPROPERTIES structure.

If the nTransferMode member value is set to TWSX_MEMORY and the bDumpMemBufsToFile member value is set to TRUE, then the Acquire method will dump the memory buffers received from the scanner (whether compressed or not) directly to the output file specified by szFileName member.

If the nTransferMode member value is set to TWSX_MEMORY, the nBufMemCompression member is set to values other than TWCP_NONE, and the bDumpMemBufsToFile member value is set to FALSE, then the Acquire method will decompress the memory buffers received from the scanner, and generate a bitmap as a result.

This generated bitmap will be returned in the Bitmap parameter of OnAcquirePageEvent event when it is fired by calling the Acquire method;