OpenTTD Source 20260218-master-g2123fca5ea
bmp.h File Reference

Read and write support for bmps. More...

#include "gfx_type.h"
#include "random_access_file_type.h"

Go to the source code of this file.

Data Structures

struct  BmpInfo
struct  BmpData

Functions

bool BmpReadHeader (RandomAccessFile &file, BmpInfo &info, BmpData &data)
 Reads bitmap headers, and palette (if any).
bool BmpReadBitmap (RandomAccessFile &file, BmpInfo &info, BmpData &data)
 Reads the bitmap 1 bpp and 4 bpp bitmaps are converted to 8 bpp bitmaps.

Detailed Description

Read and write support for bmps.

Definition in file bmp.h.

Function Documentation

◆ BmpReadBitmap()

bool BmpReadBitmap ( RandomAccessFile & file,
BmpInfo & info,
BmpData & data )

Reads the bitmap 1 bpp and 4 bpp bitmaps are converted to 8 bpp bitmaps.

Parameters
fileThe file to read.
infoThe already read medata.
dataThe buffer to read the image into.
Returns
true iff the file could be read without problems.

Definition at line 313 of file bmp.cpp.

References BmpRead1(), BmpRead24(), BmpRead4(), BmpRead4Rle(), BmpRead8(), BmpRead8Rle(), BmpInfo::bpp, BmpInfo::compression, BmpInfo::height, BmpInfo::offset, RandomAccessFile::SeekTo(), and BmpInfo::width.

Referenced by ReadHeightmapBMP().

◆ BmpReadHeader()

bool BmpReadHeader ( RandomAccessFile & file,
BmpInfo & info,
BmpData & data )

Reads bitmap headers, and palette (if any).

Reads the bitmap 1 bpp and 4 bpp bitmaps are converted to 8 bpp bitmaps.

Parameters
fileThe file to read.
infoThe already read medata.
dataThe buffer to read the image into.
Returns
true iff the file could be read without problems.

Definition at line 236 of file bmp.cpp.

References BmpInfo::bpp, BmpInfo::compression, RandomAccessFile::GetPos(), BmpInfo::height, BmpInfo::offset, BmpInfo::os2_bmp, BmpInfo::palette_size, RandomAccessFile::ReadByte(), RandomAccessFile::ReadDword(), RandomAccessFile::ReadWord(), RandomAccessFile::SkipBytes(), and BmpInfo::width.

Referenced by ReadHeightmapBMP().