renaissance1: #i107215# Fixed painting of page object backgrounds. Page numbers of selected pages are now painted darker.
This commit is contained in:
@@ -325,9 +325,15 @@ void PageObjectPainter::PaintPageNumber (
|
|||||||
|
|
||||||
// Determine the color of the page number.
|
// Determine the color of the page number.
|
||||||
Color aPageNumberColor (mpTheme->GetColor(Theme::Color_PageNumberDefault));
|
Color aPageNumberColor (mpTheme->GetColor(Theme::Color_PageNumberDefault));
|
||||||
if (rpDescriptor->HasState(model::PageDescriptor::ST_MouseOver))
|
if (rpDescriptor->HasState(model::PageDescriptor::ST_MouseOver) ||
|
||||||
|
rpDescriptor->HasState(model::PageDescriptor::ST_Selected))
|
||||||
|
{
|
||||||
|
// Page number is painted on background for hover or selection or
|
||||||
|
// both. Each of these background colors has a predefined luminance
|
||||||
|
// which is compatible with the PageNumberHover color.
|
||||||
aPageNumberColor = Color(mpTheme->GetColor(Theme::Color_PageNumberHover));
|
aPageNumberColor = Color(mpTheme->GetColor(Theme::Color_PageNumberHover));
|
||||||
else if ( ! rpDescriptor->HasState(model::PageDescriptor::ST_Selected))
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
const Color aBackgroundColor (mpTheme->GetColor(Theme::Color_Background));
|
const Color aBackgroundColor (mpTheme->GetColor(Theme::Color_Background));
|
||||||
const sal_Int32 nBackgroundLuminance (aBackgroundColor.GetLuminance());
|
const sal_Int32 nBackgroundLuminance (aBackgroundColor.GetLuminance());
|
||||||
@@ -338,8 +344,8 @@ void PageObjectPainter::PaintPageNumber (
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Compare luminance of default page number color and background
|
// Compare luminance of default page number color and background
|
||||||
// color. When the two are similar then use a darker (preferred) or
|
// color. When the two are similar then use a darker
|
||||||
// brighter font color.
|
// (preferred) or brighter font color.
|
||||||
const sal_Int32 nFontLuminance (aPageNumberColor.GetLuminance());
|
const sal_Int32 nFontLuminance (aPageNumberColor.GetLuminance());
|
||||||
if (abs(nBackgroundLuminance - nFontLuminance) < 60)
|
if (abs(nBackgroundLuminance - nFontLuminance) < 60)
|
||||||
if (nBackgroundLuminance > nFontLuminance-30)
|
if (nBackgroundLuminance > nFontLuminance-30)
|
||||||
@@ -474,12 +480,18 @@ Bitmap PageObjectPainter::CreateBackgroundBitmap(
|
|||||||
aBitmapDevice.SetOutputSizePixel(aSize);
|
aBitmapDevice.SetOutputSizePixel(aSize);
|
||||||
|
|
||||||
// Fill the background with the background color of the slide sorter.
|
// Fill the background with the background color of the slide sorter.
|
||||||
aBitmapDevice.SetFillColor(mpTheme->GetColor(Theme::Color_Background));
|
const Color aBackgroundColor (mpTheme->GetColor(Theme::Color_Background));
|
||||||
aBitmapDevice.SetLineColor(mpTheme->GetColor(Theme::Color_Background));
|
OSL_TRACE("filling background of page object bitmap with color %x", aBackgroundColor.GetColor());
|
||||||
|
aBitmapDevice.SetFillColor(aBackgroundColor);
|
||||||
|
aBitmapDevice.SetLineColor(aBackgroundColor);
|
||||||
aBitmapDevice.DrawRect(Rectangle(Point(0,0), aSize));
|
aBitmapDevice.DrawRect(Rectangle(Point(0,0), aSize));
|
||||||
|
|
||||||
// Paint the slide area with a linear gradient that starts some pixels
|
// Paint the slide area with a linear gradient that starts some pixels
|
||||||
// below the top and ends some pixels above the bottom.
|
// below the top and ends some pixels above the bottom.
|
||||||
|
const Color aTopColor(mpTheme->GetGradientColor(eColorType, Theme::Fill1));
|
||||||
|
const Color aBottomColor(mpTheme->GetGradientColor(eColorType, Theme::Fill2));
|
||||||
|
if (aTopColor != aBottomColor)
|
||||||
|
{
|
||||||
const sal_Int32 nHeight (aPageObjectBox.GetHeight());
|
const sal_Int32 nHeight (aPageObjectBox.GetHeight());
|
||||||
const sal_Int32 nDefaultConstantSize(nHeight/4);
|
const sal_Int32 nDefaultConstantSize(nHeight/4);
|
||||||
const sal_Int32 nMinimalGradientSize(40);
|
const sal_Int32 nMinimalGradientSize(40);
|
||||||
@@ -490,8 +502,6 @@ Bitmap PageObjectPainter::CreateBackgroundBitmap(
|
|||||||
nDefaultConstantSize,
|
nDefaultConstantSize,
|
||||||
(nHeight - nMinimalGradientSize)/2)));
|
(nHeight - nMinimalGradientSize)/2)));
|
||||||
const sal_Int32 nY2 (nHeight-nY1);
|
const sal_Int32 nY2 (nHeight-nY1);
|
||||||
const Color aTopColor(mpTheme->GetGradientColor(eColorType, Theme::Fill1));
|
|
||||||
const Color aBottomColor(mpTheme->GetGradientColor(eColorType, Theme::Fill2));
|
|
||||||
const sal_Int32 nTop (aPageObjectBox.Top());
|
const sal_Int32 nTop (aPageObjectBox.Top());
|
||||||
for (sal_Int32 nY=0; nY<nHeight; ++nY)
|
for (sal_Int32 nY=0; nY<nHeight; ++nY)
|
||||||
{
|
{
|
||||||
@@ -509,6 +519,12 @@ Bitmap PageObjectPainter::CreateBackgroundBitmap(
|
|||||||
Point(aPageObjectBox.Left(), nY+nTop),
|
Point(aPageObjectBox.Left(), nY+nTop),
|
||||||
Point(aPageObjectBox.Right(), nY+nTop));
|
Point(aPageObjectBox.Right(), nY+nTop));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
aBitmapDevice.SetFillColor(aTopColor);
|
||||||
|
aBitmapDevice.DrawRect(aPageObjectBox);
|
||||||
|
}
|
||||||
|
|
||||||
// Paint the simple border and, for some backgrounds, the focus border.
|
// Paint the simple border and, for some backgrounds, the focus border.
|
||||||
if (bHasFocusBorder)
|
if (bHasFocusBorder)
|
||||||
|
@@ -380,7 +380,9 @@ void Theme::SetGradient (
|
|||||||
|
|
||||||
rGradient.mnSaturationOverride = nSaturationOverride;
|
rGradient.mnSaturationOverride = nSaturationOverride;
|
||||||
rGradient.mnBrightnessOverride = nBrightnessOverride;
|
rGradient.mnBrightnessOverride = nBrightnessOverride;
|
||||||
const ColorData aColor (HGBAdapt(aBaseColor, nSaturationOverride, nBrightnessOverride));
|
const ColorData aColor (nSaturationOverride>=0 || nBrightnessOverride>=0
|
||||||
|
? HGBAdapt(aBaseColor, nSaturationOverride, nBrightnessOverride)
|
||||||
|
: aBaseColor);
|
||||||
|
|
||||||
rGradient.maFillColor1 = ChangeLuminance(aColor, nFillStartOffset);
|
rGradient.maFillColor1 = ChangeLuminance(aColor, nFillStartOffset);
|
||||||
rGradient.maFillColor2 = ChangeLuminance(aColor, nFillEndOffset);
|
rGradient.maFillColor2 = ChangeLuminance(aColor, nFillEndOffset);
|
||||||
|
Reference in New Issue
Block a user