|
OpenTTD Source 20260218-master-g2123fca5ea
|
Read and write support for bmps. More...
#include "stdafx.h"#include "random_access_file_type.h"#include "bmp.h"#include "core/bitmath_func.hpp"#include "safeguards.h"Go to the source code of this file.
Functions | |
| static bool | BmpRead1 (RandomAccessFile &file, BmpInfo &info, BmpData &data) |
| Reads a 1 bpp uncompressed bitmap. | |
| static bool | BmpRead4 (RandomAccessFile &file, BmpInfo &info, BmpData &data) |
| Reads a 4 bpp uncompressed bitmap. | |
| static bool | BmpRead4Rle (RandomAccessFile &file, BmpInfo &info, BmpData &data) |
| Reads a 4-bit RLE compressed bitmap. | |
| static bool | BmpRead8 (RandomAccessFile &file, BmpInfo &info, BmpData &data) |
| Reads a 8 bpp bitmap. | |
| static bool | BmpRead8Rle (RandomAccessFile &file, BmpInfo &info, BmpData &data) |
| Reads a 8-bit RLE compressed bpp bitmap. | |
| static bool | BmpRead24 (RandomAccessFile &file, BmpInfo &info, BmpData &data) |
| Reads a 24 bpp uncompressed bitmap. | |
| 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. | |
Read and write support for bmps.
Definition in file bmp.cpp.
|
inlinestatic |
Reads a 1 bpp uncompressed bitmap.
The bitmap is converted to a 8 bpp bitmap. Reads the bitmap 1 bpp and 4 bpp bitmaps are converted to 8 bpp bitmaps.
| file | The file to read. |
| info | The already read medata. |
| data | The buffer to read the image into. |
true iff the file could be read without problems. Definition at line 21 of file bmp.cpp.
References RandomAccessFile::AtEndOfFile(), GB(), BmpInfo::height, RandomAccessFile::ReadByte(), RandomAccessFile::SkipBytes(), and BmpInfo::width.
Referenced by BmpReadBitmap().
|
inlinestatic |
Reads a 24 bpp uncompressed bitmap.
Reads the bitmap 1 bpp and 4 bpp bitmaps are converted to 8 bpp bitmaps.
| file | The file to read. |
| info | The already read medata. |
| data | The buffer to read the image into. |
true iff the file could be read without problems. Definition at line 217 of file bmp.cpp.
References RandomAccessFile::AtEndOfFile(), GB(), BmpInfo::height, RandomAccessFile::ReadByte(), RandomAccessFile::SkipBytes(), and BmpInfo::width.
Referenced by BmpReadBitmap().
|
inlinestatic |
Reads a 4 bpp uncompressed bitmap.
The bitmap is converted to a 8 bpp bitmap. Reads the bitmap 1 bpp and 4 bpp bitmaps are converted to 8 bpp bitmaps.
| file | The file to read. |
| info | The already read medata. |
| data | The buffer to read the image into. |
true iff the file could be read without problems. Definition at line 45 of file bmp.cpp.
References RandomAccessFile::AtEndOfFile(), GB(), BmpInfo::height, RandomAccessFile::ReadByte(), RandomAccessFile::SkipBytes(), and BmpInfo::width.
Referenced by BmpReadBitmap().
|
inlinestatic |
Reads a 4-bit RLE compressed bitmap.
The bitmap is converted to a 8 bpp bitmap. Reads the bitmap 1 bpp and 4 bpp bitmaps are converted to 8 bpp bitmaps.
| file | The file to read. |
| info | The already read medata. |
| data | The buffer to read the image into. |
true iff the file could be read without problems. Definition at line 71 of file bmp.cpp.
References RandomAccessFile::AtEndOfFile(), GB(), BmpInfo::height, RandomAccessFile::ReadByte(), RandomAccessFile::SkipBytes(), and BmpInfo::width.
Referenced by BmpReadBitmap().
|
inlinestatic |
Reads a 8 bpp bitmap.
Reads the bitmap 1 bpp and 4 bpp bitmaps are converted to 8 bpp bitmaps.
| file | The file to read. |
| info | The already read medata. |
| data | The buffer to read the image into. |
true iff the file could be read without problems. Definition at line 143 of file bmp.cpp.
References RandomAccessFile::AtEndOfFile(), GB(), BmpInfo::height, RandomAccessFile::ReadByte(), RandomAccessFile::SkipBytes(), and BmpInfo::width.
Referenced by BmpReadBitmap().
|
inlinestatic |
Reads a 8-bit RLE compressed bpp bitmap.
Reads the bitmap 1 bpp and 4 bpp bitmaps are converted to 8 bpp bitmaps.
| file | The file to read. |
| info | The already read medata. |
| data | The buffer to read the image into. |
true iff the file could be read without problems. Definition at line 157 of file bmp.cpp.
References RandomAccessFile::AtEndOfFile(), BmpInfo::height, RandomAccessFile::ReadByte(), RandomAccessFile::SkipBytes(), and BmpInfo::width.
Referenced by BmpReadBitmap().
| bool BmpReadBitmap | ( | RandomAccessFile & | file, |
| BmpInfo & | info, | ||
| BmpData & | data ) |
Reads the bitmap 1 bpp and 4 bpp bitmaps are converted to 8 bpp bitmaps.
| file | The file to read. |
| info | The already read medata. |
| data | The buffer to read the image into. |
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().
| 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.
| file | The file to read. |
| info | The already read medata. |
| data | The buffer to read the image into. |
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().