Leptonica  1.54
Файл bmpio.c
#include <string.h>
#include "allheaders.h"
#include "bmp.h"

Макросы

#define DEBUG   0
 

Функции

PIXpixReadStreamBmp (FILE *fp)
 
l_int32 pixWriteStreamBmp (FILE *fp, PIX *pix)
 
FILE * open_memstream (char **data, size_t *size)
 
FILE * fmemopen (void *data, size_t size, const char *mode)
 
PIXpixReadMemBmp (const l_uint8 *cdata, size_t size)
 
l_int32 pixWriteMemBmp (l_uint8 **pdata, size_t *psize, PIX *pix)
 

Переменные

RGBA_QUAD bwmap [2] = { {255,255,255,255}, {0,0,0,255} }
 
static const l_int32 L_MAX_ALLOWED_NUM_COLORS = 256
 
static const l_int32 L_MAX_ALLOWED_WIDTH = 1000000
 
static const l_int32 L_MAX_ALLOWED_HEIGHT = 1000000
 
static const l_int64 L_MAX_ALLOWED_AREA = 400000000LL
 

Макросы

◆ DEBUG

#define DEBUG   0

Функции

◆ fmemopen()

FILE* fmemopen ( void *  data,
size_t  size,
const char *  mode 
)

◆ open_memstream()

FILE* open_memstream ( char **  data,
size_t *  size 
)

◆ pixReadMemBmp()

PIX* pixReadMemBmp ( const l_uint8 cdata,
size_t  size 
)

pixReadMemBmp()

Input:  cdata (const; bmp-encoded)
        size (of data)
Return: pix, or null on error

Notes: (1) The @size byte of @data must be a null character.

◆ pixReadStreamBmp()

PIX* pixReadStreamBmp ( FILE *  fp)

pixReadStreamBmp()

Input:  stream opened for read
Return: pix, or null on error

Notes: (1) Here are references on the bmp file format: http://en.wikipedia.org/wiki/BMP_file_format http://www.fortunecity.com/skyscraper/windows/364/bmpffrmt.html

◆ pixWriteMemBmp()

l_int32 pixWriteMemBmp ( l_uint8 **  pdata,
size_t *  psize,
PIX pix 
)

pixWriteMemBmp()

Input:  &data (<return> data of tiff compressed image)
        &size (<return> size of returned data)
        pix
Return: 0 if OK, 1 on error

Notes: (1) See pixWriteStreamBmp() for usage. This version writes to memory instead of to a file stream.

◆ pixWriteStreamBmp()

l_int32 pixWriteStreamBmp ( FILE *  fp,
PIX pix 
)

pixWriteStreamBmp()

Input:  stream opened for write
        pix (1, 4, 8, 32 bpp)
Return: 0 if OK, 1 on error

Notes: (1) We position fp at the beginning of the stream, so it truncates any existing data (2) 2 bpp Bmp files are apparently not valid!. We can write and read them, but nobody else can read ours.

Переменные

◆ bwmap

RGBA_QUAD bwmap[2] = { {255,255,255,255}, {0,0,0,255} }

◆ L_MAX_ALLOWED_AREA

const l_int64 L_MAX_ALLOWED_AREA = 400000000LL
static

◆ L_MAX_ALLOWED_HEIGHT

const l_int32 L_MAX_ALLOWED_HEIGHT = 1000000
static

◆ L_MAX_ALLOWED_NUM_COLORS

const l_int32 L_MAX_ALLOWED_NUM_COLORS = 256
static

◆ L_MAX_ALLOWED_WIDTH

const l_int32 L_MAX_ALLOWED_WIDTH = 1000000
static