OpenClonk
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros
C4BMP256Info Class Reference

#include <Bitmap256.h>

Inheritance diagram for C4BMP256Info:
[legend]
Collaboration diagram for C4BMP256Info:
[legend]

Public Member Functions

void Default ()
 
void Set (int iWdt, int iHgt, CStdPalette *)
 
bool Valid ()
 
int FileBitsOffset ()
 
void Set (int iWdt, int iHgt, int iBitDepth)
 

Public Attributes

RGBQUAD Colors [256] = {}
 
BITMAPFILEHEADER Head = BITMAPFILEHEADER()
 
BITMAPINFOHEADER Info = BITMAPINFOHEADER()
 

Detailed Description

Definition at line 73 of file Bitmap256.h.

Member Function Documentation

void C4BMP256Info::Default ( )

Definition at line 90 of file Bitmap256.cpp.

References InplaceReconstruct().

Referenced by Set().

91 {
92  InplaceReconstruct(this);
93 }
std::enable_if< std::is_nothrow_default_constructible< T >::value >::type InplaceReconstruct(T *obj)
Definition: Standard.h:35

Here is the call graph for this function:

Here is the caller graph for this function:

int C4BMP256Info::FileBitsOffset ( )

Definition at line 60 of file Bitmap256.cpp.

References tagBITMAPFILEHEADER::bfOffBits, and C4BMPInfo::Head.

Referenced by CSurface8::Read(), and C4Surface::ReadBMP().

61 {
62  return Head.bfOffBits-sizeof(C4BMP256Info);
63 }
BITMAPFILEHEADER Head
Definition: Bitmap256.h:66

Here is the caller graph for this function:

void C4BMPInfo::Set ( int  iWdt,
int  iHgt,
int  iBitDepth 
)
inherited

Definition at line 34 of file Bitmap256.cpp.

References tagBITMAPFILEHEADER::bfOffBits, tagBITMAPFILEHEADER::bfSize, tagBITMAPFILEHEADER::bfType, tagBITMAPINFOHEADER::biBitCount, tagBITMAPINFOHEADER::biClrImportant, tagBITMAPINFOHEADER::biClrUsed, tagBITMAPINFOHEADER::biCompression, tagBITMAPINFOHEADER::biHeight, tagBITMAPINFOHEADER::biPlanes, tagBITMAPINFOHEADER::biSize, tagBITMAPINFOHEADER::biSizeImage, tagBITMAPINFOHEADER::biWidth, C4BMPInfo::Default(), DWordAligned(), C4BMPInfo::Head, and C4BMPInfo::Info.

35 {
36  Default();
37  // Set header
38  Head.bfType=*((const WORD*)"BM");
39  Head.bfSize=sizeof(BITMAPFILEHEADER)+sizeof(BITMAPINFOHEADER)+DWordAligned(iWdt)*iHgt;
41  // Set bitmap info
43  Info.biWidth=iWdt;
44  Info.biHeight=iHgt;
45  Info.biPlanes=1;
46  Info.biBitCount=iBitDepth;
48  Info.biSizeImage=iWdt*iHgt;
50 }
int DWordAligned(int val)
Definition: Standard.h:47
void Default()
Definition: Bitmap256.cpp:24
BITMAPINFOHEADER Info
Definition: Bitmap256.h:67
struct tagBITMAPINFOHEADER BITMAPINFOHEADER
struct tagBITMAPFILEHEADER BITMAPFILEHEADER
BITMAPFILEHEADER Head
Definition: Bitmap256.h:66
uint16_t WORD

Here is the call graph for this function:

void C4BMP256Info::Set ( int  iWdt,
int  iHgt,
CStdPalette Palette 
)

Definition at line 65 of file Bitmap256.cpp.

References tagBITMAPFILEHEADER::bfOffBits, tagBITMAPFILEHEADER::bfSize, tagBITMAPFILEHEADER::bfType, tagBITMAPINFOHEADER::biBitCount, tagBITMAPINFOHEADER::biClrImportant, tagBITMAPINFOHEADER::biClrUsed, tagBITMAPINFOHEADER::biCompression, tagBITMAPINFOHEADER::biHeight, tagBITMAPINFOHEADER::biPlanes, tagBITMAPINFOHEADER::biSize, tagBITMAPINFOHEADER::biSizeImage, tagBITMAPINFOHEADER::biWidth, Colors, CStdPalette::Colors, Default(), DWordAligned(), GetBlueValue, GetGreenValue, GetRedValue, C4BMPInfo::Head, C4BMPInfo::Info, tagRGBQUAD::rgbBlue, tagRGBQUAD::rgbGreen, and tagRGBQUAD::rgbRed.

Referenced by CSurface8::Save().

66 {
67  Default();
68  // Set header
69  Head.bfType=*((const WORD*)"BM");
70  Head.bfSize=sizeof(BITMAPFILEHEADER)+sizeof(BITMAPINFOHEADER)+256*sizeof(RGBQUAD)+DWordAligned(iWdt)*iHgt;
71  Head.bfOffBits=sizeof(BITMAPFILEHEADER)+sizeof(BITMAPINFOHEADER)+256*sizeof(RGBQUAD);
72  // Set bitmap info
74  Info.biWidth=iWdt;
75  Info.biHeight=iHgt;
76  Info.biPlanes=1;
77  Info.biBitCount=8;
79  Info.biSizeImage=iWdt*iHgt;
81  // Set palette
82  for (int cnt=0; cnt<256; cnt++)
83  {
84  Colors[cnt].rgbRed = GetRedValue(Palette->Colors[cnt]);
85  Colors[cnt].rgbGreen = GetGreenValue(Palette->Colors[cnt]);
86  Colors[cnt].rgbBlue = GetBlueValue(Palette->Colors[cnt]);
87  }
88 }
BYTE rgbRed
Definition: Bitmap256.h:54
int DWordAligned(int val)
Definition: Standard.h:47
#define GetGreenValue(rgb)
Definition: StdColors.h:28
struct tagRGBQUAD RGBQUAD
BITMAPINFOHEADER Info
Definition: Bitmap256.h:67
DWORD Colors[256]
Definition: StdColors.h:184
struct tagBITMAPINFOHEADER BITMAPINFOHEADER
#define GetRedValue(rgb)
Definition: StdColors.h:29
void Default()
Definition: Bitmap256.cpp:90
BYTE rgbGreen
Definition: Bitmap256.h:53
#define GetBlueValue(rgb)
Definition: StdColors.h:27
BYTE rgbBlue
Definition: Bitmap256.h:52
struct tagBITMAPFILEHEADER BITMAPFILEHEADER
BITMAPFILEHEADER Head
Definition: Bitmap256.h:66
uint16_t WORD
RGBQUAD Colors[256]
Definition: Bitmap256.h:76

Here is the call graph for this function:

Here is the caller graph for this function:

bool C4BMP256Info::Valid ( )

Definition at line 53 of file Bitmap256.cpp.

References tagBITMAPFILEHEADER::bfType, tagBITMAPINFOHEADER::biBitCount, tagBITMAPINFOHEADER::biCompression, C4BMPInfo::Head, and C4BMPInfo::Info.

54 {
55  if (Head.bfType != *((const WORD*)"BM") ) return false;
56  if ((Info.biBitCount!=8) || (Info.biCompression!=0)) return false;
57  return true;
58 }
BITMAPINFOHEADER Info
Definition: Bitmap256.h:67
BITMAPFILEHEADER Head
Definition: Bitmap256.h:66
uint16_t WORD

Member Data Documentation

RGBQUAD C4BMP256Info::Colors[256] = {}

Definition at line 76 of file Bitmap256.h.

Referenced by CSurface8::Read(), C4Surface::ReadBMP(), and Set().

BITMAPFILEHEADER C4BMPInfo::Head = BITMAPFILEHEADER()
inherited

Definition at line 66 of file Bitmap256.h.

Referenced by C4BMPInfo::FileBitsOffset(), FileBitsOffset(), C4BMPInfo::Set(), Set(), and Valid().

BITMAPINFOHEADER C4BMPInfo::Info = BITMAPINFOHEADER()
inherited

Definition at line 67 of file Bitmap256.h.

Referenced by CSurface8::Read(), C4Surface::ReadBMP(), C4BMPInfo::Set(), Set(), and Valid().


The documentation for this class was generated from the following files: