1. 0 2.0

Compacts pen data based on specified trim options.

Note This function is provided for compatibility with version 1.0 of the Pen API and will not be supported in future versions. Use TrimPenData and CompressPenData instead.

HPENDATA CompactPenData( HPENDATA hpndt, UINT fuTrim )



Handle to a pen data object.


Data-trimming options:


Reallocates memory block to fit the data; does not trim the data. If you call CompactPenData with this trim option and then call the GlobalSize function with the pen data handle as a parameter, you can retrieve the size of the pen data.


Removes the PENINFO structure from the header. Discards all data from pen-up points (points collected when the pen is not in contact with the tablet), and removes OEM data and collinear points.


Removes successive identical (coincident) points and collinear points from the pen data. After the operation is performed, PDTS_NOCOLLINEAR is set in the wPndts member of the PENDATAHEADER structure. The collinear points can be removed with very little if any loss of recognition accuracy. If the collinear points are removed before the points are scaled to display coordinates, there may be a small change in the displayed image.


Compresses the data without losing any information. After the data has been compressed, the compressed handle to the pen data can be passed as a parameter only to the functions CompactPenData, GetPenDataInfo, and DuplicatePenData. CompactPenData uses a "lossless" compression method that retains the ability for an application to recognize the ink after subsequent decompression. You can use this option with other trim options, including PDTT_DECOMPRESS. In this case, compression is done after all other options have been satisfied.


Decompresses the data. You can use this option with other trim options, including PDTT_COMPRESS. In this case, decompression is performed first, followed by any other trim options specified, and followed by recompression if PDTT_COMPRESS is specified. Since the compression method used by CompactPenData does not lose information, the data is completely restored.


Removes all OEM datapics/PENAPI00090001.gifthis is data other than coordinates, such as pressure. This option does not affect delayed recognition unless a recognizer is being used that expressly requires OEM data. For example, signature recognizers often use pressure information.


Removes the PENINFO structure from the header. You can use this option if there is no OEM data associated with the data points or if the application does not use any of the OEM data. This option has no effect on the pen data for delayed recognition. Any OEM data present is also removed.


Removes all data from pen-up points (points collected when the pen is not in contact with the tablet). This option has no effect on delayed recognition. This option is not usually necessary because pen-up points are not a part of standard pen data.

Return Value

If successful, CompactPenData returns a handle to a pen data object; otherwise, it returns NULL. CompactPenData may fail and return NULL in low-memory situations if compression or decompression is requested.


The PDTS_ bits are set in the wPndts member of the PENDATAHEADER structure to indicate which operations have been performed.

See Also

, TrimPenData, CreatePenData, PENINFO, PENDATAHEADER

Software for developers
Delphi Components
.Net Components
Software for Android Developers
More information resources
Unix Manual Pages
Delphi Examples
Databases for Amazon shops developers
Amazon Categories Database
Browse Nodes Database