Bitmap Utilities API

The dll bmpUtils.dll provides functions for working with bitmap data that's in RGBTRIPLE format. This is the format for video-frame data from framecap. It's also the format for video frames forwarded from mavis for outside processing. The dll includes functions for expanding the raw video buffer into an RGB array and for reading and writing bitmap files using this format. The API for bmpUtils.dll is defined in bmpUtils.h.

 

Function Summary
int array2raw(BYTE * buf, int *** rgb, int w, int h)
             Packs an rgb array into RGBTRIPLE format
int getBmpBytes(int w, int h, char * filename, BYTE * buf)
             Reads the byte data from a bitmap file into a buffer
int getBmpSize(int * pW, int * pH, char * filename)
             Reads the bitmap dimensions from a bitmap file's header
int raw2array(BYTE * buf, int *** rgb, int w, int h)
             Unpacks raw bitmap data into an integer array of rgb values
int writeBmpFile(int w, int h, BYTE * buf, char * filename)
             Writes buffer data as a bitmap file

 

Function Detail

array2raw

int array2raw(BYTE * buf, int *** rgb, int w, int h)
Packs an rgb array into RGBTRIPLE format.

The calling code is responsible for passing a correctly sized buffer (3*w*h bytes) for the packed data.

   Parameters:
      BYTE * buf
             buffer to hold the bitmap data
      int *** rgb
             array of rgb data, as rgb[3][w][h]
      int w
             image width
      int h
             image height
   Returns:
     -1 if an error occurred
      0 otherwise


getBmpBytes

int getBmpBytes(int w, int h, char * filename, BYTE * buf)
Reads the packed byte data from a bitmap file into a buffer.

To import data from a bitmap file that's in RGBTRIPLE format, first call getBmpSize() to read the bitmap dimensions from the file's header. Allocate a buffer of size 3*w*h bytes for the packed data. Pass this buffer to getBmpBytes() to retrieve the packed data. The packed data can then be expanded into an rgb array by calling raw2array().

   Parameters:
      int w
             image width
      int h
             image height
      char * filename
             name of the bitmap file
      BYTE * buf
             buffer to hold the bitmap data
   Returns:
     -1 if an error occurred
      0 otherwise


getBmpSize

int getBmpSize(int * pW, int * pH, char * filename)
Reads the bitmap dimensions from a bitmap file's header.

   Parameters:
      int * pW
             pointer to the image-width variable
      int * pH
             pointer to the image-height variable
      char * filename
             name of the bitmap file
   Returns:
     -1 if an error occurred
      0 otherwise


raw2array

int raw2array(BYTE * buf, int *** rgb, int w, int h)
Unpacks raw bitmap data into an integer array of rgb values.

The calling code is responsible for passing a correctly sized rgb array.

   Parameters:
      BYTE * buf
             buffer that contains the packed bitmap data
      int *** rgb
             array of size int[3][w][h] that will receive the unpacked image data
      int w
             image width
      int h
             image height
   Returns:
     -1 if an error occurred
      0 otherwise


writeBmpFile

int getBmpBytes(int w, int h, BYTE * buf, char * filename)
Writes buffer data as a bitmap file.

The buffer data must be in RGBTRIPLE format.

   Parameters:
      int w
             image width
      int h
             image height
      BYTE * buf
             buffer with the bitmap data
      char * filename
             name of the bitmap file
   Returns:
     -1 if an error occurred
      0 otherwise

 

Home | Mavis | Mavis Documentation