2014/utils/Atil/Inc/RgbColor.inl
/// <summary>
/// This inlined method is defined in RgbColor.h. <see cref="RgbColor">
/// </summary>
///


This inlined method is defined in RgbColor.h.
This inlined method is defined in RgbColor . h .
inline Data8 RgbColor5b::asGray (DataModelAttributes::BitFields fields
    , DataModelAttributes::ChannelOrder format) const
{
    Data8 red = 0, green = 0, blue = 0;
    if (fields == DataModelAttributes::k5551) {
        green = (Data8) ((packed >> 5) & RgbModelAttributes::kLowMask);
        if (format == DataModelAttributes::kRedGreenBlueAlpha) {
            red = (Data8) (packed & RgbModelAttributes::kLowMask);
            blue = (Data8) ((packed >> 10) & RgbModelAttributes::kLowMask);
        }
        else  {
            blue = (Data8) (packed & RgbModelAttributes::kLowMask);
            red = (Data8) ((packed >> 10) & RgbModelAttributes::kLowMask);
        }
        red = (Data8) (red * 255 / 31);
        green = (Data8) (green * 255 / 31);
        blue = (Data8) (blue * 255 / 31);
    }
    else if (fields == DataModelAttributes::k565) {
        green = (Data8) ((packed & RgbModelAttributes::kMidMask565) >> 5);
        if (format == DataModelAttributes::kRedGreenBlueAlpha) {
            red = (Data8) (packed & RgbModelAttributes::kLowMask);
            blue = (Data8) ((packed >> 11) & RgbModelAttributes::kLowMask);
        }
        else  {
            blue = (Data8) (packed & RgbModelAttributes::kLowMask);
            red = (Data8) ((packed >> 11) & RgbModelAttributes::kLowMask);
        }
        red = (Data8) (red * 255 / 31);
        green = (Data8) (green * 255 / 63);
        blue = (Data8) (blue * 255 / 31);
    }
    Data8 gray = static_cast<Data8> ( red * RgbColorFactors::kLuminanceRedFactor
        + green * RgbColorFactors::kLuminanceGreenFactor
        + blue  * RgbColorFactors::kLuminanceBlueFactor + 0.5);
    return gray;
}
inline Data8 RgbColor5b :: asGray ( DataModelAttributes :: BitFields fields , DataModelAttributes :: ChannelOrder format ) const { Data8 red = 0 , green = 0 , blue = 0 ; if ( fields == DataModelAttributes :: k5551 ) { green = ( Data8 ) ( ( packed >> 5 ) & RgbModelAttributes :: kLowMask ) ; if ( format == DataModelAttributes :: kRedGreenBlueAlpha ) { red = ( Data8 ) ( packed & RgbModelAttributes :: kLowMask ) ; blue = ( Data8 ) ( ( packed >> 10 ) & RgbModelAttributes :: kLowMask ) ; } else { blue = ( Data8 ) ( packed & RgbModelAttributes :: kLowMask ) ; red = ( Data8 ) ( ( packed >> 10 ) & RgbModelAttributes :: kLowMask ) ; } red = ( Data8 ) ( red * 255 / 31 ) ; green = ( Data8 ) ( green * 255 / 31 ) ; blue = ( Data8 ) ( blue * 255 / 31 ) ; } else if ( fields == DataModelAttributes :: k565 ) { green = ( Data8 ) ( ( packed & RgbModelAttributes :: kMidMask565 ) >> 5 ) ; if ( format == DataModelAttributes :: kRedGreenBlueAlpha ) { red = ( Data8 ) ( packed & RgbModelAttributes :: kLowMask ) ; blue = ( Data8 ) ( ( packed >> 11 ) & RgbModelAttributes :: kLowMask ) ; } else { blue = ( Data8 ) ( packed & RgbModelAttributes :: kLowMask ) ; red = ( Data8 ) ( ( packed >> 11 ) & RgbModelAttributes :: kLowMask ) ; } red = ( Data8 ) ( red * 255 / 31 ) ; green = ( Data8 ) ( green * 255 / 63 ) ; blue = ( Data8 ) ( blue * 255 / 31 ) ; } Data8 gray = static_cast < Data8 > ( red * RgbColorFactors :: kLuminanceRedFactor + green * RgbColorFactors :: kLuminanceGreenFactor + blue * RgbColorFactors :: kLuminanceBlueFactor + 0.5 ) ; return gray ; }
<summary>
This inlined method is defined in RgbColor.h.
<summary > This inlined method is defined in RgbColor . h .