[Libreoffice] [PATCH] fdo#31251 Writer & Impress shadow consistency
Sébastien Le Ray
sebastien-libreoffice at orniz.org
Wed May 4 00:06:44 PDT 2011
Le Tue, 3 May 2011 14:23:44 +0200,
David Tardon <dtardon at 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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/libreoffice/attachments/20110504/776c1f71/attachment.pgp>
More information about the LibreOffice
mailing list