Change definition of "dark" colour for fdo#61993

- Increase the threshold for "dark" colours from Luminosity<=38 to
  Luminosity<=60.

  This makes LibreOffice align more closely with MS Word when
  considering whether "automatic" font colour should be black or white,
  a decision that is based on whether the background colour is "dark".

  Beware that this also affects other areas.

- Fix the coefficients for GetLuminosity which appeared to be off
  by one according to the "Rec 601" coefficients for Luma quoted at
  http://en.wikipedia.org/wiki/Luma_%28video%29

Change-Id: I0af1f77909713e3db5ea8ee98456146569679594
Reviewed-on: https://gerrit.libreoffice.org/2601
Reviewed-by: Fridrich Strba <fridrich@documentfoundation.org>
Tested-by: Fridrich Strba <fridrich@documentfoundation.org>
This commit is contained in:
Luke Deller 2013-03-09 01:26:56 +11:00 committed by Fridrich Strba
parent b0dec5f73d
commit 77e21bb36a
2 changed files with 3 additions and 3 deletions

View File

@ -198,9 +198,9 @@ inline sal_Bool Color::IsRGBEqual( const Color& rColor ) const
inline sal_uInt8 Color::GetLuminance() const
{
return( (sal_uInt8) ( ( COLORDATA_BLUE( mnColor ) * 28UL +
return( (sal_uInt8) ( ( COLORDATA_BLUE( mnColor ) * 29UL +
COLORDATA_GREEN( mnColor ) * 151UL +
COLORDATA_RED( mnColor ) * 77UL ) >> 8UL ) );
COLORDATA_RED( mnColor ) * 76UL ) >> 8UL ) );
}
inline void Color::Merge( const Color& rMergeColor, sal_uInt8 cTransparency )

View File

@ -102,7 +102,7 @@ void Color::Invert()
sal_Bool Color::IsDark() const
{
return GetLuminance() <= 38;
return GetLuminance() <= 60;
}
sal_Bool Color::IsBright() const