📄 dib.h
字号:
/* //////////////////////////////////////////////////////////////////////////// INTEL CORPORATION PROPRIETARY INFORMATION// This software is supplied under the terms of a license agreement or// nondisclosure agreement with Intel Corporation and may not be copied// or disclosed except in accordance with the terms of that agreement.// Copyright(c) 2004-2005 Intel Corporation. All Rights Reserved.//////*/#ifndef __DIB_H__#define __DIB_H__static const unsigned int DIB_FILE_HEADER_N_OF_BYTES = 14;static const unsigned int DIB_UNCOMPRESSED = 0;typedef enum { Depth_8, Depth_24} DIBDepth;typedef enum { BottomLeft, TopLeft} DIBOrigin;typedef enum { Core, Common} DIBInfoStyle;inline unsigned int BitDepthPerChan(DIBDepth depth){ switch(depth) { case Depth_8: return 7; case Depth_24: return 7; default : return 0; }}inline unsigned int BitCount(DIBDepth depth){ switch(depth) { case Depth_8: return 8; case Depth_24: return 24; default : return 0; }}inline unsigned int NOfChannels(DIBDepth depth){ switch(depth) { case Depth_8: return 1; case Depth_24: return 3; default : return 0; }}// it has a meaning for uncompressed data onlyinline unsigned int LineStep(DIBDepth depth, unsigned int width){ unsigned int lineSize; switch(depth) { case Depth_8: lineSize = width; break; case Depth_24: lineSize = width * 3; break; default : lineSize = 0; } return (lineSize + 3) & 0xFFFFFFFC;}inline unsigned int InfoHeaderNOfBytes(DIBInfoStyle style){ switch(style) { case Core: return 12; case Common: return 40; default : return 0; }}class DIBRGBValue{public: DIBRGBValue() : m_r(0), m_g(0), m_b(0) {} DIBRGBValue(unsigned char value) : m_r(value), m_g(value), m_b(value) {} DIBRGBValue(unsigned char r, unsigned char g, unsigned char b) : m_r(r), m_g(g), m_b(b) {} DIBRGBValue(const DIBRGBValue& value) { operator=(value); } void SetR(unsigned char value) { m_r = value; } void SetG(unsigned char value) { m_g = value; } void SetB(unsigned char value) { m_b = value; } DIBRGBValue& operator=(const DIBRGBValue& value) { if ( this != &value ) { m_r = value.R(); m_g = value.G(); m_b = value.B(); } return *this; } unsigned char R() const { return m_r; } unsigned char G() const { return m_g; } unsigned char B() const { return m_b; } bool operator ==(const DIBRGBValue& value) const { return (m_r == value.m_r) && (m_g == value.m_g) && (m_b == value.m_b); } bool operator !=(const DIBRGBValue& value) const { return !operator==(value); }protected: unsigned char m_r; unsigned char m_g; unsigned char m_b;};#endif // __DIB_H__
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -