www.pudn.com > PtBarcodeDec.rar > PtAPI.h


//  Copyright(C) 2002-2007, PartiTek Inc. All rights reserved. 
// 
//  Title:  PtAPI.h 
//====================================================================================== 
// 
//  Description: Include file for the  PartiTek Inc. API and definitions. 
//               The modules included are: 
// 
//  PtImageRW          Image file reading/writing. 
//  PtPDF417Encode     PDF417  symbol writing. 
//  PtPDF417Decode     PDF417  symbol reading. 
//  PtQREncode         QR Code symbol writing.  
//  PtQRDecdoe         QR Code symbol reading. 
//  PtDMEncode         Data Matrix symbol writing. 
//  PtDMDecode         Data Matrix symbol reading.   
   
//====================================================================================== 
// 
//  Version:    2.0 
// 
//  Date:       07 November 2005 
// ====================================================================================== 
 
#ifndef  _PT_API_H 
#define  _PT_API_H 
 
 
#ifdef __cplusplus 
extern "C" { 
#endif  /* __cplusplus */ 
 
#pragma pack(8)  // 8 bytes alignment  
 
#if !defined( PTAPI ) 
#define PTAPI  __stdcall 
#endif 
 
 
// * ********************************************************** 
// *  Image file reading/writing APIs and definitions. 
// * ********************************************************** 
#if !defined( PT_IMAGERW_API ) 
#define PT_IMAGERW_API  __declspec( dllimport ) 
#endif 
 
 
/*----------------------------------------------------------------------------------------+ 
|                                    DEFINES SECTION                                      | 
+----------------------------------------------------------------------------------------*/ 
/* Status of an operation */ 
#define  PT_IMAGERW_FAIL                   0x00000000 //An error occurred in an operation. 
#define  PT_IMAGERW_SUCCESS                0x00000001 //An operation is successful. 
#define  PT_IMAGERW_ALLOC_ERROR            0x00000100 //Error while allocating memory. 
#define  PT_IMAGERW_FORMAT_UNSUPPORTED     0x00000101 //The format of image is unsupported.  
 
/*----------------------------------------------------------------------------------------+ 
|                                  STRUCTURES SECTION                                     | 
|                        Please refer to the SDK manul for more detail.                   | 
+-----------------------------------------------------------------------------------------*/ 
//The PTIMAGE structure contains the image information. 
typedef struct tagPTIMAGE  
{ 
    DWORD            dwWidth;       //The width of the image in pixels. 
    DWORD            dwHeight;      //The height of the image in pixels. 
    unsigned char*   pBits;         //Pointer to the image data. 
    unsigned char*   pPalette;      //Pointer to the palette data (RGBQUAD)for 1,4,8 bits image. 
    WORD             wBitsPerPixel; //Number of bits per pixel. 
}PTIMAGE, *pPTIMAGE; 
 
/*---------------------------------------------------------------------------------------+ 
|                                  FUNCTIONS SECTION                                     | 
|                        Please refer to the SDK manul for more detail.                  | 
+---------------------------------------------------------------------------------------*/ 
/*Initialize the PTIMAGE structure.*/ 
PT_IMAGERW_API  void  PTAPI  PtInitImage 
( 
    PTIMAGE* pImage           //Pointer to a PTIMAGE structure. 
); 
 
 
/*Load an image from a file*/ 
PT_IMAGERW_API  int   PTAPI  PtLoadImage 
(  
    const char* FileName,     //Name of the file. 
    PTIMAGE*    pImage,       //Pointer to a PTIMAGE structure. 
    DWORD       dwFrameIndex  //The index of the frame wanted to load(start from 0).Some image files contain multi-frames, such as tiff file. 
); 
 
 
/*Save an image to a file*/ 
PT_IMAGERW_API  int   PTAPI  PtSaveImage 
(  
    const char* FileName,     //Name of the file 
    PTIMAGE*    pImage        //Pointer to a PTIMAGE structure. 
); 
 
 
/*Display an image with the hDC.*/ 
PT_IMAGERW_API  void  PTAPI  PtShowImage 
( 
    PTIMAGE*  pImage,         //Pointer to a PTIMAGE structure. 
    HDC       hDc,            //Contains a handle of a window's device context to display the image.  
    int       StartX,         //The x-coordinate in pixels, of the upper-left corner of the destination rectangle. 
    int       StartY,         //The y-coordinate in pixels, of the upper-left corner of the destination rectangle. 
    float     scale           //Used to stretch or compress the image. 
); 
 
/*Allocate the memory for data and palette*/ 
PT_IMAGERW_API  int   PTAPI  PtCreateImage 
( 
    PTIMAGE* pImage,          //Pointer to a PTIMAGE structure. 
    DWORD    ImageSize,       //The data dimension in byte. 
    DWORD    PaletteSize      //The palette dimension in byte. 
); 
 
 
/*Free the memory allocated by the engine in PtLoadImage or PtCreateImage function.*/ 
PT_IMAGERW_API  void  PTAPI  PtFreeImage 
( 
    PTIMAGE* pImage           //Pointer to a PTIMAGE structure. 
); 
 
 
/*Get the frames of an image file. Some image files contain multi-frames, such as tiff file.*/ 
PT_IMAGERW_API  int   PTAPI  PtGetImageFrames 
(  
    const char* FileName     //Name of the file. 
); 
 
 
// * ********************************************************** 
// *  PDF417 symbol writing APIs and definitions 
// * ********************************************************** 
#if !defined( PT_PDF417ENCODE_API ) 
#define PT_PDF417ENCODE_API __declspec( dllimport ) 
#endif 
 
/*--------------------------------------------------------------------------------------+ 
|                                    DEFINES SECTION                                    | 
+--------------------------------------------------------------------------------------*/ 
/* Status of an operation */ 
#define PT_PDF417ENCODE_FAIL               0x00000000 //An operation is Failed. 
#define PT_PDF417ENCODE_SUCCESS            0x00000001 //An operation is successful. 
#define PT_PDF417ENCODE_ALLOC_ERROR        0x00000200 //Error while allocating the memory. 
#define PT_PDF417ENCODE_DATA_BIG           0x00000201 //Data to be encoded is too big.  
#define PT_PDF417ENCODE_SIZE_SMALL         0x00000202 //The size of image to be pasted the symbol is too small.  
#define PT_PDF417ENCODE_IMAGE_INVALID      0x00000203 //The image to be pasted is invalid.  
   
/* PDF417 ECC level constants */ 
#define PT_PDF417_ECCLEVEL_0      0x0000 //Use ECC level 0. This uses 2   codewords for error correction. 
#define PT_PDF417_ECCLEVEL_1      0x0001 //Use ECC level 1. This uses 4   codewords for error correction. 
#define PT_PDF417_ECCLEVEL_2      0x0002 //Use ECC level 2. This uses 8   codewords for error correction. 
#define PT_PDF417_ECCLEVEL_3      0x0003 //Use ECC level 3. This uses 16  codewords for error correction. 
#define PT_PDF417_ECCLEVEL_4      0x0004 //Use ECC level 4. This uses 32  codewords for error correction. 
#define PT_PDF417_ECCLEVEL_5      0x0005 //Use ECC level 5. This uses 64  codewords for error correction. 
#define PT_PDF417_ECCLEVEL_6      0x0006 //Use ECC level 6. This uses 128 codewords for error correction. 
#define PT_PDF417_ECCLEVEL_7      0x0007 //Use ECC level 7. This uses 256 codewords for error correction. 
#define PT_PDF417_ECCLEVEL_8      0x0008 //Use ECC level 8. This uses 512 codewords for error correction. 
#define PT_PDF417_ECC_PERCENT     0x0009 //Use the percentage to determine the ECC level. 
 
/*--------------------------------------------------------------------------------------+ 
|                                  STRUCTURES SECTION                                   | 
|                        Please refer to the SDK manul for more detail.                 | 
+---------------------------------------------------------------------------------------*/   
/*The PTPDF417ENCODE structure contains the information related to PDF417 barcodes*/ 
typedef struct tagPTPDF417ENCODE 
{ 
    char*        pData;             //Pointer to the data to be encoded. 
    int          nDataLength;       //Length of the data in bytes. 
    int          bIsTruncated;      //Writes truncated PDF417 symbols or not. 
    WORD         wEccPercent;       //Determines the error correction level by percentage.  
    WORD         wEccLevel;         //Determines the ECC level for encoding a PDF417 symbol. 
    WORD         wCols;             //Number of columns in the symbol.  
    WORD         wRows;             //Number of rows in the symbol.  
    WORD         wAspectHeigh;      //The height part of the aspect ratio of the symbol. 
    WORD         wAspectWidth;      //The width part of the aspect ratio of the symbol.  
    WORD         wXModule;          //The smallest element width in pixels. 
    WORD         wModuleAspectRatio;//The ratio of a row height to XModule. 
    WORD         wLeftSpace;        //The left   space of the symbol in pixels while generating the image.  
    WORD         wRightSpace;       //The right  space of the symbol in pixels while generating the image.   
    WORD         wTopSpace;         //The top    space of the symbol in pixels while generating the image. 
    WORD         wBottomSpace;      //The bottom space of the symbol in pixels while generating the image.  
}PTPDF417ENCODE, *pPTPDF417ENCODE;   
 
 
/*--------------------------------------------------------------------------------------+ 
|                                  FUNCTIONS SECTION                                    | 
|                        Please refer to the SDK manul for more detail.                 | 
+--------------------------------------------------------------------------------------*/ 
/*Verify the licnese key for the engine.*/ 
PT_PDF417ENCODE_API  int   PTAPI  PtPDF417EncodeRegister 
(  
    char* pKeyStr                  //Pointer to the string of license key. 
); 
 
 
/*Initialize the PTPDF417ENCODE structure with default values.*/ 
PT_PDF417ENCODE_API  void  PTAPI  PtPDF417EncodeInit 
( 
    PTPDF417ENCODE*  pEncode   //Pointer to a PTPDF417ENCODE structure. 
); 
 
 
/*Encode a PDF417 symbol and then generate an image.*/ 
PT_PDF417ENCODE_API  int  PTAPI  PtPDF417Encode 
(  
    PTPDF417ENCODE*  pEncode, //Pointer to a PTPDF417ENCODE structure. 
    PTIMAGE*         pImage   //Pointer to a PTIMAGE structure. 
); 
 
 
/*Encode a PDF417 symbol and then save as an image file*/ 
PT_PDF417ENCODE_API  int  PTAPI  PtPDF417EncodeToFile 
(  
    PTPDF417ENCODE*  pEncode, //Pointer to a PTPDF417ENCODE structure. 
    const char*      FileName //Name of the image file. 
);  
 
 
/*Encode a PDF417 symbol and then paste the symbol to an existing image.*/ 
PT_PDF417ENCODE_API  int  PTAPI  PtPDF417EncodeToImage 
(  
    PTPDF417ENCODE*  pEncode, //Pointer to a PTPDF417ENCODE structure. 
    PTIMAGE*         pDstImg, //Pointer to a PTIMAGE structure. 
    int              StartX,  //The x-coordinate in pixels, of the upper-left corner of the destination rectangle. 
    int              StartY   //The y-coordinate in pixels, of the upper-left corner of the destination rectangle. 
); 
 
 
 
 
 
// * ********************************************************** 
// *  PDF417 symbol reading APIs and definitions 
// * ********************************************************** 
#if !defined( PT_PDF417DECODE_API ) 
#define PT_PDF417DECODE_API __declspec( dllimport ) 
#endif 
 
/*--------------------------------------------------------------------------------------+ 
|                                    DEFINES SECTION                                    | 
+--------------------------------------------------------------------------------------*/ 
/* Status of an operation */ 
#define PT_PDF417DECODE_FAIL                0x00000000//An error occurred in an operation. 
#define PT_PDF417DECODE_SUCCESS             0x00000001//An operation is successful. 
#define PT_PDF417DECODE_ALLOC_ERROR         0x00000300//Error while allocating the memory. 
#define PT_PDF417DECODE_IMAGE_INVALID       0x00000301//The image to be decode is invalid.  
#define PT_PDF417DECODE_PARAMETERS_INVALID  0x00000302//The parameters input to a function are invalid. 
 
 
/*--------------------------------------------------------------------------------------+ 
|                                  STRUCTURES SECTION                                   | 
|                        Please refer to the SDK manul for more detail.                 | 
+---------------------------------------------------------------------------------------*/   
/*The PTDECODEPARA structure is used to decide parameter when decoding barcodes from an image.*/ 
typedef struct tagPTDECODEPARA 
{ 
    DWORD       dwStartX;     //The start X-coordinate in pixels of the search window in the image to decode the symbol. 
    DWORD       dwStartY;     //The start Y-coordinate in pixels of the search window in the image to decode the symbol. 
    DWORD       dwEndX;       //The end X-coordinate in pixels of the search window in the image to decode the symbol. 
    DWORD       dwEndY;       //The end Y-coordinate in pixels of the search window in the image to decode the symbol. 
    DWORD       dwMaxCount;   //The maximal number of symbols to be searched. If it's set to 0 then search the all symbols. 
} PTDECODEPARA, *pPTDECODEPARA  
; 
 
 
/*The PTBARCODEINFO structure contains a barcode information after decoding*/ 
typedef struct tagPTBARCODEINFO 
{ 
    DWORD      dwX1, dwY1;    //Four corners' coordinates in pixels of the barcode.  
    DWORD      dwX2, dwY2; 
    DWORD      dwX3, dwY3; 
    DWORD      dwX4, dwY4; 
    BYTE*      pData;         //Pointer to the buffer that contains the barcode's data. 
    DWORD      dwDataLen;     //The barcode data's length in bytes. 
}PTBARCODEINFO, *pPTBARCODEINFO 
; 
 
 
/*The PTTOTALBARCODEINFO structure contains all barcodes' information after decoding*/ 
typedef struct tagPTTOTALBARCODEINFO 
{ 
    PTBARCODEINFO*  pInfoList;    //Pointer to the start address of the list of barcodes' info.   
    DWORD           dwTotalCount; //The number of barcode that have been decoded. 
}PTTOTALBARCODEINFO, *pPTOTALBARCODEINFO 
; 
 
 
/*--------------------------------------------------------------------------------------+ 
|                                  FUNCTIONS SECTION                                    | 
|                        Please refer to the SDK manul for more detail.                 | 
+--------------------------------------------------------------------------------------*/ 
/*Verify the licnese key for the engine.*/ 
PT_PDF417DECODE_API  int   PTAPI  PtPDF417DecodeRegister 
(  
    char* pKeyStr                  //Pointer to the string of license key. 
); 
 
 
/*Initialize the PTTOTALBARCODEINFO structure.*/ 
PT_PDF417DECODE_API  void  PTAPI  PtPDF417DecodeInit 
( 
    PTTOTALBARCODEINFO* pInfo      //Pointer to a PTTOTALBARCODEINFO structure. 
); 
 
 
/*Decode PDF417 barcode from an image.*/ 
PT_PDF417DECODE_API  int  PTAPI  PtPDF417Decode 
( 
    PTIMAGE*            pImage,    //Pointer to a PTIMAGE structure. 
    PTDECODEPARA*       pPara,     //Pointer to a PTDECODEPARA structure. 
    PTTOTALBARCODEINFO* pInfo      //Pointer to a PTTOTALBARCODEINFO structure. 
); 
 
 
/*Decode PDF417 barcode from an image file. The function supports multiframes image, such as tiff*/ 
PT_PDF417DECODE_API  int  PTAPI  PtPDF417DecodeFromFile 
(  
    const char*         FileName,  //Name of the image file. 
    PTDECODEPARA*       pPara,     //Pointer to a PTDECODEPARA structure. 
    PTTOTALBARCODEINFO* pInfo      //Pointer to a PTTOTALBARCODEINFO structure. 
); 
 
 
/*Free the memory allocated in the function PtPDF417Decode.*/ 
PT_PDF417DECODE_API  void  PTAPI  PtPDF417DecodeFree 
(  
    PTTOTALBARCODEINFO* pInfo      //Pointer to a PTTOTALBARCODEINFO structure. 
); 
 
 
 
// * ********************************************************** 
// *  QR Code symbol writing APIs and definitions 
// * ********************************************************** 
#if !defined( PT_QRENCODE_API ) 
#define PT_QRENCODE_API __declspec( dllimport ) 
#endif 
 
/*--------------------------------------------------------------------------------------+ 
|                                    DEFINES SECTION                                    | 
+--------------------------------------------------------------------------------------*/ 
/* Status of an operation */ 
#define PT_QRENCODE_FAIL             0x00000000 //An operation is Failed. 
#define PT_QRENCODE_SUCCESS          0x00000001 //An operation is successful. 
#define PT_QRENCODE_ALLOC_ERROR      0x00000200 //Error while allocating the memory. 
#define PT_QRENCODE_DATA_BIG         0x00000201 //Data to be encoded is too big.  
#define PT_QRENCODE_SIZE_SMALL       0x00000202 //The size of image to be pasted the symbol is too small.  
#define PT_QRENCODE_IMAGE_INVALID    0x00000203 //The image to be pasted is invalid.  
     
/* QR Code ECC level constants */ 
#define PT_QR_ECCLEVEL_L             0x0001 //Use ECC level L. (7% )  
#define PT_QR_ECCLEVEL_M             0x0000 //Use ECC level M. (15%) 
#define PT_QR_ECCLEVEL_Q             0x0003 //Use ECC level Q. (25%) 
#define PT_QR_ECCLEVEL_H             0x0002 //Use ECC level H. (30%) 
 
/* QR Code version constants */ 
#define PT_QR_VERSION_AUTO           0x0000 //Determine the version by the engine,then use the smallest version that can contain the data. 
 
/* QR Code mask number constants */ 
#define PT_QR_MASKNUMBER_AUTO        0x0008 //Determine the mask number by the engine. 
  
 
 
/*--------------------------------------------------------------------------------------+ 
|                                  STRUCTURES SECTION                                   | 
|                        Please refer to the SDK manul for more detail.                 | 
+---------------------------------------------------------------------------------------*/   
/*The PTQRENCODE structure contains the information related to QR Code barcodes*/ 
typedef struct tagPTQRENCODE 
{ 
    char*        pData;             //Pointer to the data to be encoded. 
    int          nDataLength;       //Length of the data in bytes. 
    WORD         wVersion;          //The version of the QR Code. 
    WORD         wMaskNumber;       //The mask number of the QR Code. 
    WORD         wEccLevel;         //Determines the ECC level for encoding a QR Code symbol. 
    WORD         wModule;           //The size of one module in pixels. 
    WORD         wGroupTotal;       //The number of symbols that belong to the group. 
    WORD         wGroupIndex;       //The index of the symbol in the group, 
    WORD         wLeftSpace;        //The left   space of the symbol in pixels while generating the image.  
    WORD         wRightSpace;       //The right  space of the symbol in pixels while generating the image.   
    WORD         wTopSpace;         //The top    space of the symbol in pixels while generating the image. 
    WORD         wBottomSpace;      //The bottom space of the symbol in pixels while generating the image.  
}PTQRENCODE, *pPTQRENCODE;   
 
 
/*--------------------------------------------------------------------------------------+ 
|                                  FUNCTIONS SECTION                                    | 
|                        Please refer to the SDK manul for more detail.                 | 
+--------------------------------------------------------------------------------------*/ 
/*Verify the licnese key for the engine.*/ 
PT_QRENCODE_API  int   PTAPI  PtQREncodeRegister 
(  
    char* pKeyStr                  //Pointer to the string of license key. 
); 
 
 
/*Initialize the PTQRENCODE structure with default values.*/ 
PT_QRENCODE_API  void  PTAPI  PtQREncodeInit 
( 
    PTQRENCODE*  pEncode   //Pointer to a PTQRENCODE structure. 
); 
 
 
/*Encode a QR Code symbol and then generate an image.*/ 
PT_QRENCODE_API  int  PTAPI  PtQREncode 
(  
    PTQRENCODE*  pEncode, //Pointer to a PTQRENCODE structure. 
    PTIMAGE*     pImage   //Pointer to a PTIMAGE structure. 
); 
 
 
/*Encode a QR Code symbol and then save as an image file*/ 
PT_QRENCODE_API  int  PTAPI  PtQREncodeToFile 
(  
    PTQRENCODE*  pEncode, //Pointer to a PTQRENCODE structure. 
    const char*  FileName //Name of the image file. 
); 
 
  
/*Encode a QR Code symbol and then paste the symbol to an existing image.*/ 
PT_QRENCODE_API  int  PTAPI  PtQREncodeToImage 
(  
    PTQRENCODE*  pEncode, //Pointer to a PTQRENCODE structure. 
    PTIMAGE*     pDstImg, //Pointer to a PTIMAGE structure. 
    int          StartX,  //The x-coordinate in pixels, of the upper-left corner of the destination rectangle. 
    int          StartY   //The y-coordinate in pixels, of the upper-left corner of the destination rectangle. 
); 
 
 
// * ********************************************************** 
// *  QR Code symbol reading APIs and definitions 
// * ********************************************************** 
#if !defined( PT_QRDECODE_API ) 
#define PT_QRDECODE_API __declspec( dllimport ) 
#endif 
 
/*--------------------------------------------------------------------------------------+ 
|                                    DEFINES SECTION                                    | 
+--------------------------------------------------------------------------------------*/ 
/* Status of an operation */ 
#define PT_QRDECODE_FAIL                0x00000000//An error occurred in an operation. 
#define PT_QRDECODE_SUCCESS             0x00000001//An operation is successful. 
#define PT_QRDECODE_ALLOC_ERROR         0x00000300//Error while allocating the memory. 
#define PT_QRDECODE_IMAGE_INVALID       0x00000301//The image to be decode is invalid.  
#define PT_QRDECODE_PARAMETERS_INVALID  0x00000302//The parameters input to a function are invalid. 
  
/*--------------------------------------------------------------------------------------+ 
|                                  FUNCTIONS SECTION                                    | 
|                        Please refer to the SDK manul for more detail.                 | 
+--------------------------------------------------------------------------------------*/ 
/*Verify the licnese key for the engine.*/ 
PT_QRDECODE_API  int   PTAPI PtQRDecodeRegister 
(  
    char* pKeyStr                  //Pointer to the string of license key. 
); 
 
 
/*Initialize the PTTOTALBARCODEINFO structure.*/ 
PT_QRDECODE_API  void  PTAPI  PtQRDecodeInit 
( 
    PTTOTALBARCODEINFO* pInfo      //Pointer to a PTTOTALBARCODEINFO structure. 
); 
 
 
/*Decode QR Code barcode from an image.*/ 
PT_QRDECODE_API  int  PTAPI  PtQRDecode 
( 
    PTIMAGE*            pImage,    //Pointer to a PTIMAGE structure. 
    PTDECODEPARA*       pPara,     //Pointer to a PTDECODEPARA structure. 
    PTTOTALBARCODEINFO* pInfo      //Pointer to a PTTOTALBARCODEINFO structure. 
); 
 
 
/*Decode QR Code barcode from an image file. The function supports multiframes image, such as tiff*/ 
PT_QRDECODE_API  int  PTAPI  PtQRDecodeFromFile 
(  
    const char*         FileName,  //Name of the image file. 
    PTDECODEPARA*       pPara,     //Pointer to a PTDECODEPARA structure. 
    PTTOTALBARCODEINFO* pInfo      //Pointer to a PTTOTALBARCODEINFO structure. 
); 
 
 
/*Free the memory allocated in the function PtQRDecode.*/ 
PT_QRDECODE_API  void  PTAPI  PtQRDecodeFree 
(  
    PTTOTALBARCODEINFO* pInfo      //Pointer to a PTTOTALBARCODEINFO structure. 
); 
 
 
 
// * ********************************************************** 
// *  Data Matrix symbol writing APIs and definitions 
// * ********************************************************** 
#if !defined( PT_DMENCODE_API ) 
#define PT_DMENCODE_API __declspec( dllimport ) 
#endif 
 
/*--------------------------------------------------------------------------------------+ 
|                                    DEFINES SECTION                                    | 
+--------------------------------------------------------------------------------------*/ 
/* Status of an operation */ 
#define  PT_DMENCODE_FAIL             0x00000000 //An operation is Failed. 
#define  PT_DMENCODE_SUCCESS          0x00000001 //An operation is successful. 
#define  PT_DMENCODE_ALLOC_ERROR      0x00000200 //Error while allocating the memory. 
#define  PT_DMENCODE_DATA_BIG         0x00000201 //Data to be encoded is too big.  
#define  PT_DMENCODE_SIZE_SMALL       0x00000202 //The size of image to be pasted the symbol is too small.  
#define  PT_DMENCODE_IMAGE_INVALID    0x00000203 //The image to be pasted is invalid.  
 
/* Symbol size */ 
#define  PT_DM_SQUARE_AUTO    0  //Use the smallest square size that can contain the data. 
#define  PT_DM_10x10          1  //Data Matrix Type 10x10. 
#define  PT_DM_12x12          2  //Data Matrix Type 12x12. 
#define  PT_DM_14x14          3  //Data Matrix Type 14x14. 
#define  PT_DM_16x16          4  //Data Matrix Type 16x16. 
#define  PT_DM_18x18          5  //Data Matrix Type 18x18. 
#define  PT_DM_20x20          6  //Data Matrix Type 20x20. 
#define  PT_DM_22x22          7  //Data Matrix Type 22x22. 
#define  PT_DM_24x24          8  //Data Matrix Type 24x24. 
#define  PT_DM_26x26          9  //Data Matrix Type 26x26. 
#define  PT_DM_32x32          10 //Data Matrix Type 32x32. 
#define  PT_DM_36x36          11 //Data Matrix Type 36x36. 
#define  PT_DM_40x40          12 //Data Matrix Type 40x40. 
#define  PT_DM_44x44          13 //Data Matrix Type 44x44. 
#define  PT_DM_48x48          14 //Data Matrix Type 48x48. 
#define  PT_DM_52x52          15 //Data Matrix Type 52x52. 
#define  PT_DM_64x64          16 //Data Matrix Type 64x64. 
#define  PT_DM_72x72          17 //Data Matrix Type 72x72. 
#define  PT_DM_80x80          18 //Data Matrix Type 80x80. 
#define  PT_DM_88x88          19 //Data Matrix Type 88x88. 
#define  PT_DM_96x96          20 //Data Matrix Type 96x96. 
#define  PT_DM_104x104        21 //Data Matrix Type 104x104. 
#define  PT_DM_120x120        22 //Data Matrix Type 120x120. 
#define  PT_DM_132x132        23 //Data Matrix Type 132x132. 
#define  PT_DM_144x144        24 //Data Matrix Type 144x144. 
#define  PT_DM_8x18           25 //Data Matrix Type 8x18. 
#define  PT_DM_8x32           26 //Data Matrix Type 8x32. 
#define  PT_DM_12x26          27 //Data Matrix Type 12x26. 
#define  PT_DM_12x36          28 //Data Matrix Type 12x36. 
#define  PT_DM_16x36          29 //Data Matrix Type 16x36. 
#define  PT_DM_16x48          30 //Data Matrix Type 16x48. 
#define  PT_DM_RECTANGLE_AUTO 31 //use the smallest rectangular size that can contain the data. 
 
  
 
/*--------------------------------------------------------------------------------------+ 
|                                  STRUCTURES SECTION                                   | 
|                        Please refer to the SDK manul for more detail.                 | 
+---------------------------------------------------------------------------------------*/   
/*The PTDMENCODE structure contains the information related to Data Matrix Code barcodes*/ 
typedef struct tagPTDMENCODE 
{ 
    char*        pData;             //Pointer to the data to be encoded. 
    int          nDataLength;       //Length of the data in bytes. 
    WORD         wSymbolSize;       //The symbol size. 
    WORD         wModule;           //The size of one module in pixels. 
    WORD         wGroupTotal;       //The number of symbols that belong to the group. 
    WORD         wGroupIndex;       //The index of the symbol in the group. 
    WORD         wFileIDHigh;       //The high byte of the file ID number. 
    WORD         wFileIDLow;        //The low byte of the file ID number. 
    WORD         wLeftSpace;        //The left   space of the symbol in pixels while generating the image.  
    WORD         wRightSpace;       //The right  space of the symbol in pixels while generating the image.   
    WORD         wTopSpace;         //The top    space of the symbol in pixels while generating the image. 
    WORD         wBottomSpace;      //The bottom space of the symbol in pixels while generating the image.  
}PTDMENCODE, *pPTDMENCODE;   
 
 
/*--------------------------------------------------------------------------------------+ 
|                                  FUNCTIONS SECTION                                    | 
|                        Please refer to the SDK manul for more detail.                 | 
+--------------------------------------------------------------------------------------*/ 
/*Verify the licnese key for the engine.*/ 
PT_DMENCODE_API  int   PTAPI  PtDMEncodeRegister 
(  
    char* pKeyStr                  //Pointer to the string of license key. 
); 
 
 
/*Initialize the PTDMENCODE structure with default values.*/ 
PT_DMENCODE_API  void  PTAPI  PtDMEncodeInit 
( 
    PTDMENCODE*  pEncode   //Pointer to a PTDMENCODE structure. 
); 
 
 
/*Encode a Data Matrix symbol and then generate an image.*/ 
PT_DMENCODE_API  int  PTAPI  PtDMEncode 
(  
    PTDMENCODE*  pEncode, //Pointer to a PTDMENCODE structure. 
    PTIMAGE*     pImage   //Pointer to a PTIMAGE structure. 
); 
 
 
/*Encode a Data Matrix symbol and then save as an image file*/ 
PT_DMENCODE_API  int  PTAPI  PtDMEncodeToFile 
(  
    PTDMENCODE*  pEncode, //Pointer to a PTDMENCODE structure. 
    const char*  FileName //Name of the image file. 
); 
  
 
/*Encode a Data Matrix symbol and then paste the symbol to an existing image.*/ 
PT_DMENCODE_API  int  PTAPI  PtDMEncodeToImage 
(  
    PTDMENCODE*  pEncode, //Pointer to a PTDMENCODE structure. 
    PTIMAGE*     pDstImg, //Pointer to a PTIMAGE structure. 
    int          StartX,  //The x-coordinate in pixels, of the upper-left corner of the destination rectangle. 
    int          StartY   //The y-coordinate in pixels, of the upper-left corner of the destination rectangle. 
); 
 
 
 
 
// * ********************************************************** 
// *  Data Matrix symbol reading APIs and definitions 
// * ********************************************************** 
#if !defined( PT_DMDECODE_API ) 
#define PT_DMDECODE_API __declspec( dllimport ) 
#endif 
 
/*--------------------------------------------------------------------------------------+ 
|                                    DEFINES SECTION                                    | 
+--------------------------------------------------------------------------------------*/ 
/* Status of an operation */ 
#define PT_DMDECODE_FAIL                0x00000000//An error occurred in an operation. 
#define PT_DMDECODE_SUCCESS             0x00000001//An operation is successful. 
#define PT_DMDECODE_ALLOC_ERROR         0x00000300//Error while allocating the memory. 
#define PT_DMDECODE_IMAGE_INVALID       0x00000301//The image to be decode is invalid.  
#define PT_DMDECODE_PARAMETERS_INVALID  0x00000302//The parameters input to a function are invalid. 
  
/*--------------------------------------------------------------------------------------+ 
|                                  FUNCTIONS SECTION                                    | 
|                        Please refer to the SDK manul for more detail.                 | 
+--------------------------------------------------------------------------------------*/ 
/*Verify the licnese key for the engine.*/ 
PT_DMDECODE_API  int   PTAPI  PtDMDecodeRegister 
(  
    char* pKeyStr                  //Pointer to the string of license key. 
); 
 
 
/*Initialize the PTTOTALBARCODEINFO structure.*/ 
PT_DMDECODE_API  void  PTAPI  PtDMDecodeInit 
( 
    PTTOTALBARCODEINFO* pInfo      //Pointer to a PTTOTALBARCODEINFO structure. 
); 
 
 
/*Decode DM Code barcode from an image.*/ 
PT_DMDECODE_API  int  PTAPI  PtDMDecode 
( 
    PTIMAGE*            pImage,    //Pointer to a PTIMAGE structure. 
    PTDECODEPARA*       pPara,     //Pointer to a PTDECODEPARA structure. 
    PTTOTALBARCODEINFO* pInfo      //Pointer to a PTTOTALBARCODEINFO structure. 
); 
 
 
/*Decode Data Matrix symbol from an image file. The function supports multiframes image, such as tiff*/ 
PT_DMDECODE_API  int  PTAPI  PtDMDecodeFromFile 
(  
    const char*         FileName,  //Name of the image file. 
    PTDECODEPARA*       pPara,     //Pointer to a PTDECODEPARA structure. 
    PTTOTALBARCODEINFO* pInfo      //Pointer to a PTTOTALBARCODEINFO structure. 
); 
 
 
/*Free the memory allocated in the function PtDMDecode.*/ 
PT_DMDECODE_API  void  PTAPI  PtDMDecodeFree 
(  
    PTTOTALBARCODEINFO* pInfo      //Pointer to a PTTOTALBARCODEINFO structure. 
); 
 
 
#ifdef __cplusplus 
} 
#endif  /* __cplusplus */ 
 
#endif