📄 mgcsoftcolor.inl
字号:
// Magic Software, Inc.
// http://www.magic-software.com
// Copyright (c) 2000, All Rights Reserved
//
// Source code from Magic Software is supplied under the terms of a license
// agreement and may not be copied or disclosed except in accordance with the
// terms of that agreement. The various license agreements may be found at
// the Magic Software web site. This file is subject to the license
//
// RESTRICTED USE SOURCE CODE
// http://www.magic-software.com/License/restricted.pdf
//---------------------------------------------------------------------------
inline MgcSoftColor::MgcSoftColor (unsigned short usColor)
{
m_usColor = usColor;
}
//---------------------------------------------------------------------------
inline MgcSoftColor::MgcSoftColor (int iR, int iG, int iB)
{
// This is 'inline' because the rasterizers make heavy use of the
// conversion.
// assert: 0 <= iR < 256 and 0 <= iG < 256 and 0 <= iB < 256
// map [0,256) to [0,32)
iR >>= 3;
iG >>= 3;
iB >>= 3;
// map to 1555-format
m_usColor = (iB | (iG << 5 ) | (iR << 10));
}
//---------------------------------------------------------------------------
inline int MgcSoftColor::GetR () const
{
// get 8-bit color value
int iR = (m_usColor & 0x7C00) >> 7;
return iR;
}
//---------------------------------------------------------------------------
inline int MgcSoftColor::GetG () const
{
// get 8-bit color value
int iG = (m_usColor & 0x03E0) >> 2;
return iG;
}
//---------------------------------------------------------------------------
inline int MgcSoftColor::GetB () const
{
// get 8-bit color value
int iB = (m_usColor & 0x001F);
return iB;
}
//---------------------------------------------------------------------------
inline MgcSoftColor::operator unsigned short ()
{
return m_usColor;
}
//---------------------------------------------------------------------------
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -