bardecode.com

  • Increase font size
  • Default font size
  • Decrease font size
Home FAQ How can I read barcodes from a bitmap in the Linux/Solaris/OSX etc version of the toolkit?

How can I read barcodes from a bitmap in the Linux/Solaris/OSX etc version of the toolkit?

The following function for reading barcodes from a memory bitmap is available in the bardecode.a library:

int STReadBarCodeFromBitmap(void *hBarcode, BITMAP *pBitmap, float resolution, char ***bc, char ***bc_type, short photometric)

Where:

hBarcode (in) is a handle to an instance of the barcode toolkit.
pBitmap (in) is a pointer to a BITMAP structure (see below)
Resolution (in) is the resolution of the bitmap.
Bc (out) is a pointer that receives a pointer to an array of barcodes found in the image.
Bc_type (out) is a pointer that receives a pointer to an array of barcode types found in the image (one for each barcode).
Photometric (in)specifies the value of a black pixel in a 1-bit image.

Return Value:

Number of barcode found in the image.

BITMAP Structure:

typedef struct tagBITMAP {
    int     bmType;
    int     bmWidth;
    int     bmHeight;
    int     bmWidthBytes;
    BYTE    bmPlanes;
    BYTE    bmBitsPixel;
    LPVOID  bmBits;
} BITMAP;



Where:

bmType should always be 0
bmWidth is the width of the bitmap in pixels
bmHeight is the height of the bitmap in pixels
bmWidthBytes is the width of a bitmap scan line in bytes (SEE NOTE BELOW).
bmPlanes should always be 1.
bmBitsPixel is the number of bits per pixel for the image and should be either 1, 8 or 24.


Important:


Please note that the end of all scan lines in the image are assumed to end on a 4 byte boundary. i.e. The number of bytes for each scan line of the bitmap should be divisible by 4.