19,472
社区成员




//RGB24
void CPixelRGB24::ConvertByCover(unsigned char * inPixel)
{
if (inPixel)
{
*inPixel = m_TargetB;
inPixel++;
*inPixel = m_TargetG;
inPixel++;
*inPixel = m_TargetR;
}
}
//RGB555
void CPixelRGB555::ConvertByCover(unsigned char * inPixel)
{
if (inPixel)
{
*inPixel = m_Mask[0];
inPixel++;
*inPixel = m_Mask[1];
}
}
void CPixelRGB555::SideEffectColorChanged(void)
{
CBasePixel::SideEffectColorChanged();
const unsigned int bits555[] = {0x7C00, 0x03E0, 0x001F}; // RGB
// Caculate the mask bits
unsigned int wMask, wTemp;
wTemp = unsigned int (m_TargetB / 256. * 32);
wMask = wTemp & bits555[2];
wTemp = unsigned int (m_TargetG / 256. * 32);
wTemp = wTemp << 5;
wMask += wTemp & bits555[1];
wTemp = unsigned int (m_TargetR / 256. * 32);
wTemp = wTemp << 10;
wMask += wTemp & bits555[0];
// Store the high byte and low byte seperately
m_Mask[0] = wMask & 0xff;
wMask = wMask >> 8;
m_Mask[1] = wMask & 0xff;
}
//RGB565
void CPixelRGB565::ConvertByCover(unsigned char * inPixel)
{
if (inPixel)
{
*inPixel = m_Mask[0];
inPixel++;
*inPixel = m_Mask[1];
}
}
void CPixelRGB565::SideEffectColorChanged(void)
{
CBasePixel::SideEffectColorChanged();
const unsigned int bits565[] = {0xF800, 0x07E0, 0x001F}; // RGB
// Caculate the mask bits
unsigned int wMask, wTemp;
wTemp = unsigned int (m_TargetB / 256. * 32);
wMask = wTemp & bits565[2];
wTemp = unsigned int (m_TargetG / 256. * 64);
wTemp = wTemp << 5;
wMask += wTemp & bits565[1];
wTemp = unsigned int (m_TargetR / 256. * 32);
wTemp = wTemp << 11;
wMask += wTemp & bits565[0];
// Store the high byte and low byte seperately
m_Mask[0] = wMask & 0xff;
wMask = wMask >> 8;
m_Mask[1] = wMask & 0xff;
}