// --------------------------------------------------------------------------- // Convert device-independent color to device-dependent color. // --------------------------------------------------------------------------- // TInt CPeninputPenTraceDecorator::Rgb2DeviceColor( TDisplayMode aDisplayMode, const TRgb& aColor ) { switch( aDisplayMode ) { case EGray2: { return aColor.Gray2(); } case EGray4: { return aColor.Gray4(); } case EGray16: { return aColor.Gray16(); } case EGray256: { return aColor.Gray256(); } case EColor16: { return aColor.Color16(); } case EColor256: { return aColor.Color256(); } case EColor64K: { return aColor.Color64K(); } case EColor16M: { return aColor.Color16M(); } case EColor4K: { return aColor.Color4K(); } case EColor16MU: { return aColor.Color16MU(); } case EColor16MA: { return aColor.Color16MA(); } case EColor16MAP: { return aColor.Color16MAP(); } default: return aColor.Internal(); } }
EXPORT_C TRgb ColorUtils::RgbLighterColor(TRgb aRgb, TDisplayMode aMode) /** Creates a lighter colour. @param aRgb The Rgb colour. @param aMode The display mode, which indicates the screen output of the colour e.g. 256 colour display mode (8 bpp). @return The lighter colour. */ { switch (aMode) { case EColor256: return TRgb::Color256(color256lightlutab[aRgb.Color256()]); default: TInt value = aRgb.Internal(); TInt b = Min( 255, ((value & 0x000000ff) ) + KLightRgbAdder ); TInt g = Min( 255, ((value & 0x0000ff00) >> 8) + KLightRgbAdder ); TInt r = Min( 255, ((value & 0x00ff0000) >> 16) + KLightRgbAdder ); return TRgb(r,g,b,aRgb.Alpha()); } }
EXPORT_C TRgb ColorUtils::RgbDarkerColor(TRgb aRgb, TDisplayMode aMode) /** Creates a darker color. @param aRgb The RGB color. @param aMode The display mode, which indicates the screen output of the colour e.g. 256 colour display mode (8 bpp). @return The darker colour. */ { switch (aMode) { case EColor256: return TRgb::Color256(color256darklutab[aRgb.Color256()]); default: TInt value = aRgb.Internal(); TInt b = Max( 0, ((value & 0x000000ff) ) - KDarkRgbSubtractor ); TInt g = Max( 0, ((value & 0x0000ff00) >> 8) - KDarkRgbSubtractor ); TInt r = Max( 0, ((value & 0x00ff0000) >> 16) - KDarkRgbSubtractor ); return TRgb(r,g,b,aRgb.Alpha()); } }