ReadBarCodeFromBitmap
Overview
int STReadBarCodeFromBitmap(void *hBarcode, BITMAP *pBitmap, float resolution, char ***bc, char ***bc_type, short photometric)
STReadBarCodeFromBitmap scans an bitmap held in memory for barcodes and returns the number of barcodes found or an error number.
hBarcode | Handle to barcode session. |
pBitmap | (input) Pointer to a BITMAP structure (see below) |
resolution | (input) is the resolution in DPI of the image held in the bitmap. |
bc | (output) is a pointer to an array of character strings containing barcodes. |
bc_type | (output) is a pointer to an array of character strings containing the barcode types in the bar_codes array. |
photometric | (input) is the photometric interpretation for a black and white bitmap. A value of 1 means that a bit of value 1 is black and a value of 0 means that a bit of value 0 is black. |
BITMAP Structure
typedef struct tagBITMAP
{
int bmType;
int bmWidth;
int bmHeight;
int bmWidthBytes;
unsigned char bmPlanes;
unsigned char bmBitsPixel;
void * bmBits;
} BITMAP;
bmType should always be 1.
bmWidth is the width of the image in pixels. Note that all scan lines in the image must begin on 4 byte boundary. For example, if your image is black and white and 1000 pixels wide; then the first scan line will start on byte 0, the second on byte 128, the third on 256 etc.
bmHeight is the height of the bitmap in pixels.
bmWidthBytes is the width of a scan lines in bytes.
bmPlanes should always be 1.
bmBitsPixel is the number of bits per pixel. Black and white images have a value of 1.
bmBits is a pointer to the first scan line of the image.
Return Value
A negative number indicates an error (see below), other values inidicate the number of barcodes found in the file.
ST_ERROR_MULTI_PLANE (-2) | Multiplane images not supported |
ST_ERROR_BITS_PER_SAMPLE (-3) | Unsupported number of bits per sample |
ST_ERROR_MALLOC (-4) | Memory allocation error |
ST_ERROR_COLOR_TIFF (-5) | Unsupported compression |