Date: prev next · Thread: first prev next last
2011 Archives by date, by thread · List index


Le Tue, 3 May 2011 14:23:44 +0200,
David Tardon <dtardon@redhat.com> a écrit :

On Sat, Apr 30, 2011 at 06:58:29PM +0200, Sébastien Le Ray wrote:
     if(aShadowColor != SwViewOption::GetShadowColor() ) {
         aShadowColor = SwViewOption::GetShadowColor();
-        AlphaMask aMask( SW_RES( BMP_PAGE_BOTTOM_RIGHT_SHADOW_MASK
) );
-        Bitmap aFilledSquare( Size( mnShadowPxWidth,
mnShadowPxWidth ), 24 );
-        aFilledSquare.Erase( aShadowColor );
 
+        AlphaMask aMask( shadowMask.getBottomRight().GetBitmap() );
+        Bitmap aFilledSquare( aMask.GetSizePixel(), 24 );
+        aFilledSquare.Erase( aShadowColor );
...

This looks like a good candidate for a function... Like

void lcl_createShadow(Color const& rColor, BitmapEx const& rMask,
BitmapEx& rShadow)
{
    AlphaMask aMask( rMask.GetBitmap() );
    Bitmap aFilledSquare( aMask.GetSizePixel(), 24 );
    aFilledSquare.Erase( rColor );
    rShadow = aFilledSquare;
}

But this is really just "nice to have", not a blocker :)

OK, I'll try to find some time to write it

[...]
Do I count wrong or is the right shadow painted over the bottom right
corner shadow? And the same for left shadow lower.

Well, it shouldn't since we do not have visual overlap. Corners are
17px large, 8 of them come to the adjacent borders so we scale borders
to remove those 8px…


@@ -5326,20 +5326,19 @@ const sal_Int8 SwPageFrm::mnShadowPxWidth =
9; aPageTopRightShadow );
         BitmapEx aPageRightShadow = aPageRightShadowBase;
         aPageRightShadow.Scale( 1, aPagePxRect.Height() - 2 *
(mnShadowPxWidth - 1) );
-
pOut->DrawBitmapEx( pOut->PixelToLogic( Point( aPagePxRect.Right()
+ 1, aPagePxRect.Top() + mnShadowPxWidth - 1) ), aPageRightShadow );
+
pOut->DrawBitmapEx( pOut->PixelToLogic( Point( aPaintRect.Right() +
mnShadowPxWidth, aPagePxRect.Top() + mnShadowPxWidth - 1) ),
aPageRightShadow );

Is this really correct? AFAICS it moves the shadow too much to the
right... And if it is correct, why the corner shadows do not need to
be adjusted too?

Still because of the fact we've the 8px overlapping the adjacent
border. I guess this picture
http://misc.orniz.org/libreoffice/shadow-decomposition.png should make
things clearer.
As you can see, Paint rect is only used for corners shadow left/right
adjustment


Sébastien

Attachment: signature.asc
Description: PGP signature


Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.