My Project
Loading...
Searching...
No Matches
Enumerations | Functions
bmp.h File Reference

BMP image handling functions. More...

#include "_file.h"
#include "image.h"
#include "image_io.h"
#include "result.h"
#include <inttypes.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>

Go to the source code of this file.

Enumerations

enum  FromBmpStatus {
  FROM_BMP_OK = 0 , FROM_BMP_INVALID_HEADER , FROM_BMP_UNSUPPORTED_FORMAT , FROM_BMP_UNSUPPORTED_COMPRESSION ,
  FROM_BMP_UNSUPPORTED_COLOR_DEPTH , FROM_BMP_INVALID_PIXELS , FROM_BMP_CANNOT_ALLOC_MEMORY
}
 Status codes for reading BMP images. More...
 
enum  ToBmpStatus { TO_BMP_OK = 0 , TO_BMP_BAD_IMAGE_DATA , TO_BMP_WRITE_FAILED , TO_BMP_CANNOT_ALLOC_MEMORY }
 Status codes for writing BMP images. More...
 

Functions

ImageParserResult from_bmp (FileBuffer buffer)
 Read BMP image from file.
 
ImageBuilderResult to_bmp (Image img)
 Write image to file in BMP format.
 

Detailed Description

BMP image handling functions.

Enumeration Type Documentation

◆ FromBmpStatus

Status codes for reading BMP images.

Enumerator
FROM_BMP_OK 

Image read properly.

FROM_BMP_INVALID_HEADER 

Unsupported or broken header.

FROM_BMP_UNSUPPORTED_FORMAT 

Not BMP format.

FROM_BMP_UNSUPPORTED_COMPRESSION 

Unsupported compression.

FROM_BMP_UNSUPPORTED_COLOR_DEPTH 

Unsupported color depth.

FROM_BMP_INVALID_PIXELS 

Cannot read pixel data.

FROM_BMP_CANNOT_ALLOC_MEMORY 

Not enough memory for image.

◆ ToBmpStatus

Status codes for writing BMP images.

Enumerator
TO_BMP_OK 

Image read properly.

TO_BMP_BAD_IMAGE_DATA 

Image data is null.

TO_BMP_WRITE_FAILED 

Writing to file failed.

TO_BMP_CANNOT_ALLOC_MEMORY 

Not enough memory for image.

Function Documentation

◆ from_bmp()

ImageParserResult from_bmp ( FileBuffer  buffer)

Read BMP image from file.

Parameters
bufferFile buffer containing BMP data.
Returns
Image parser result.

◆ to_bmp()

ImageBuilderResult to_bmp ( Image  img)

Write image to file in BMP format.

Parameters
imgImage to be written.
Returns
Image builder result.