📄 pdf417codec.h
字号:
/*
pdf417codec library to encode/decode pdf417 barcodes
Copyright (C) 2005 Michael Butscher (mbutscher@gmx.de)
(see additional copyright notices in Copyright.txt)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/** @file
The header file of the DLL for use with C.
It is mainly taken from
cdllfront.d by removing function bodies and adding some typedefs
and preprocessor commands.
*/
#ifndef _PDF417CODEC_H_
#define _PDF417CODEC_H_
// To not confuse Doxygen
#ifdef DOXYGEN
#define DLLEXPORT(rettype) rettype
#else
// Configure this for your C/C++ compiler
#define DLLEXPORT(rettype) __declspec(dllimport) rettype
#endif
typedef unsigned int uint;
typedef unsigned char ubyte;
#ifdef __cplusplus
extern "C" {
#endif
/** Increment reference count of handle.
*/
DLLEXPORT(int) pdf417_lockHandle(uint handle);
/** Decrement reference count of handle. If it becomes 0,
the handle will be invalid.
*/
DLLEXPORT(int) pdf417_freeHandle(uint handle);
/** Set value of runtime debugging variable
*/
DLLEXPORT(void) pdf417_setRtdebug(int value);
/** Flush stdout (for debugging purposes)
*/
DLLEXPORT(void) pdf417_flushall();
/** Create the segment input text for the encoder by lines of text.
Returns a handle to the text.
@param len Length of lines array
@param lines Array of null-terminated strings describing segments in text format
*/
DLLEXPORT(uint) pdf417_createSegTextByLines(int len, char** lines);
/** Append a line of text to the lines.
*/
DLLEXPORT(int) pdf417_appendTextLine(uint lineshandle, char* zline);
/** Encoding routine if dealing with segments
@param in_rval number of rows of codewords or -1 to let the function calculate
the appropriate number.
@param in_cval number of columns of codewords including additional left and right
codeword but not start and stop.
@param in_ec_level Level of error correction (0: least, 8: most)
@param use_default if true ignores in_rval and in_cval and sets it to
default values.
@param segs_handle Handle to lines of text in the segment text format,
created by #pdf417_createRawByLines or to a Segments object
@return handle to an image with the barcode without borders, each module has
width and height of one pixel
*/
DLLEXPORT(uint) pdf417_encodeSegments(int in_rval, int in_cval, int in_ec_level,
int use_default, uint segs_handle);
/** High level encoding routine dealing with plain bytes.
@param in_rval number of rows of codewords or -1 to let the function calculate
the appropriate number.
@param in_cval number of columns of codewords including additional left and right
codeword but not start and stop.
@param in_ec_level Level of error correction (0: least, 8: most)
@param use_default if true ignores in_rval and in_cval and sets it to
default values.
@param buffer Pointer to plain bytes to encode.
@param buflen if buflen >= 0 length of buffer, if buflen == -1, length of
buffer is determined by terminating '\\0' in buffer.
@return handle to an image with the barcode without borders, each module has
width and height of one pixel
*/
DLLEXPORT(uint) pdf417_encodePlain(int in_rval, int in_cval, int in_ec_level,
int use_default, char* buffer, int buflen);
/** Process a black&white or grayscale image and read possible barcode.
Returns a handle to a char[] with the decoded plain bytes.
*/
DLLEXPORT(uint) pdf417_decodePlain(uint imghandle);
// -------------------- String handling routines --------------------
/** Returns the size of a char-Array
@param strhandle handle to char[]
*/
DLLEXPORT(int) pdf417_getStrSize(uint strhandle);
/** Copies the data of the string into dest array.
Use #pdf417_getStrSize to determine needed size.
A terminating \\0 is NOT included.
*/
DLLEXPORT(int) pdf417_getStrDataCopy(uint strhandle, char* dest);
// -------------------- Image handling routines --------------------
/** Creates a new image object, copies the data from graydata
and returns its handle.
@param width Image width in pixel
@param height Image height in pixel
@param graydata Pointer to array of gray values
(size: width*height) in the left-to-right top-to-bottom
order, or null to create a black image.
*/
DLLEXPORT(uint) pdf417_createImage(uint width, uint height, ubyte* graydata);
/** Creates a new image object, copies the data from rgbdata
and returns its handle.
@param width Image width in pixel
@param height Image height in pixel
@param method Always 0, reserved for future use.
@param rgbdata Pointer to array of rgb values
(size: width*height*3) in the left-to-right top-to-bottom
order, each pixel represented as three bytes for R, G and B,
or null to create a black image.
*/
DLLEXPORT(uint) pdf417_createImageByRgb(uint width, uint height, int method, ubyte* rgbdata);
DLLEXPORT(int) pdf417_getImageWidth(uint imghandle);
DLLEXPORT(int) pdf417_getImageHeight(uint imghandle);
/** Copies the data of the image into dest array
(size: width*height of image)
*/
DLLEXPORT(int) pdf417_getImageDataCopy(uint imghandle, ubyte* dest);
/** Copies the data of the image into dest array
(size: width*height*3 of image) as RGB values
*/
DLLEXPORT(int) pdf417_getImageDataCopyRgb(uint imghandle, ubyte* dest);
/** Create a new, scaled image enlarged by the factors scalex, scaley
and return a handle to it.
*/
DLLEXPORT(uint) pdf417_imageScale(uint imghandle, uint scalex, uint scaley);
/** Create a new, bordered image with borders of the given widths
for top, bottom, right and left and the given color (default 255)
and return a handle to it.
*/
DLLEXPORT(uint) pdf417_imageBorder(uint imghandle, uint top, uint bottom, uint right, uint left,
ubyte color);
#ifdef __cplusplus
}
#endif
#endif // _PDF417CODEC_H_
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -