main/sw/source/core/layout/paintfrm.cxx
/** lcl_DrawGraphicBackgrd - local help method to draw a background for a graphic

    OD 17.10.2002 #103876#
    Under certain circumstances we have to draw a background for a graphic.
    This method takes care of the conditions and draws the background with the
    corresponding color.
    Method introduced for bug fix #103876# in order to optimize drawing tiled
    background graphics. Previously, this code was integrated in method
    <lcl_DrawGraphic>.
    Method implemented as a inline, checking the conditions and calling method
    method <lcl_implDrawGraphicBackgrd(..)> for the intrinsic drawing.

    @author OD

    @param _rBackgrdBrush
    background brush contain the color the background has to be drawn.

    @param _pOut
    output device the background has to be drawn in.

    @param _rPaintRect
    paint rectangle in the output device, which has to be drawn with the background.
    rectangle have to be aligned by method ::SwAlignRect

    @param _rGraphicObj
    graphic object, for which the background has to be drawn. Used for checking
    the transparency of its bitmap, its type and if the graphic is drawn transparent

    @param _bNumberingGraphic
    boolean indicating that graphic is used as a numbering.

    @param _bBackgrdAlreadyDrawn
    boolean (optional; default: false) indicating, if the background is already drawn.
*/
local help method to draw a background for a graphic
OD 17.10.2002 #103876
Under certain circumstances we have to draw a background for a graphic.
This method takes care of the conditions and draws the background with the
corresponding color.
Method introduced for bug fix #103876# in order to optimize drawing tiled
background graphics. Previously, this code was integrated in method
.
Method implemented as a inline, checking the conditions and calling method
method  for the intrinsic drawing.
local help method to draw a background for a graphic OD 17 . 10 . 2002 #103876 Under certain circumstances we have to draw a background for a graphic . This method takes care of the conditions and draws the background with the corresponding color . Method introduced for bug fix #103876# in order to optimize drawing tiled background graphics . Previously this code was integrated in method . Method implemented as a inline checking the conditions and calling method method for the intrinsic drawing .
void lcl_implDrawGraphicBackgrd( const SvxBrushItem& _rBackgrdBrush,
                                 OutputDevice* _pOut,
                                 const SwRect& _rAlignedPaintRect,
                                 const GraphicObject& _rGraphicObj )
{
    const Color aColor( ( (_rBackgrdBrush.GetColor() != COL_TRANSPARENT) || bFlyMetafile )
                        ? _rBackgrdBrush.GetColor()
                        : aGlobalRetoucheColor );
    sal_Int8 nTransparencyPercent = 0;
    bool bDrawTransparent = false;
    if ( aColor.GetTransparency() != 0 )
    {
        bDrawTransparent = true;
        nTransparencyPercent = (aColor.GetTransparency()*100 + 0x7F)/0xFF;
    }
    else if ( (_rGraphicObj.GetAttr().GetTransparency() != 0) &&
                (_rBackgrdBrush.GetColor() == COL_TRANSPARENT) )
    {
        bDrawTransparent = true;
        nTransparencyPercent = (_rGraphicObj.GetAttr().GetTransparency()*100 + 0x7F)/0xFF;
    }
    if ( bDrawTransparent )
    {
        if( _pOut->GetFillColor() != aColor.GetRGBColor() )
            _pOut->SetFillColor( aColor.GetRGBColor() );
        PolyPolygon aPoly( _rAlignedPaintRect.SVRect() );
        _pOut->DrawTransparent( aPoly, nTransparencyPercent );
    }
    else
    {
        if ( _pOut->GetFillColor() != aColor )
            _pOut->SetFillColor( aColor );
        _pOut->DrawRect( _rAlignedPaintRect.SVRect() );
    }
}
void lcl_implDrawGraphicBackgrd ( const SvxBrushItem & _rBackgrdBrush , OutputDevice * _pOut , const SwRect & _rAlignedPaintRect , const GraphicObject & _rGraphicObj ) { const Color aColor ( ( ( _rBackgrdBrush . GetColor ( ) != COL_TRANSPARENT ) || bFlyMetafile ) ? _rBackgrdBrush . GetColor ( ) : aGlobalRetoucheColor ) ; sal_Int8 nTransparencyPercent = 0 ; bool bDrawTransparent = false ; if ( aColor . GetTransparency ( ) != 0 ) { bDrawTransparent = true ; nTransparencyPercent = ( aColor . GetTransparency ( ) * 100 + 0x7F ) / 0xFF ; } else if ( ( _rGraphicObj . GetAttr ( ) . GetTransparency ( ) != 0 ) && ( _rBackgrdBrush . GetColor ( ) == COL_TRANSPARENT ) ) { bDrawTransparent = true ; nTransparencyPercent = ( _rGraphicObj . GetAttr ( ) . GetTransparency ( ) * 100 + 0x7F ) / 0xFF ; } if ( bDrawTransparent ) { if ( _pOut -> GetFillColor ( ) != aColor . GetRGBColor ( ) ) _pOut -> SetFillColor ( aColor . GetRGBColor ( ) ) ; PolyPolygon aPoly ( _rAlignedPaintRect . SVRect ( ) ) ; _pOut -> DrawTransparent ( aPoly , nTransparencyPercent ) ; } else { if ( _pOut -> GetFillColor ( ) != aColor ) _pOut -> SetFillColor ( aColor ) ; _pOut -> DrawRect ( _rAlignedPaintRect . SVRect ( ) ) ; } }
lcl_DrawGraphicBackgrd - local help method to draw a background for a graphic
OD 17.10.2002 #103876
Under certain circumstances we have to draw a background for a graphic.
lcl_DrawGraphicBackgrd - local help method to draw a background for a graphic OD 17 . 10 . 2002 #103876 Under certain circumstances we have to draw a background for a graphic .
/// determine color of background ///     If color of background brush is not "no fill"/"auto fill" or ///     <bFlyMetafile> is set, use color of background brush, otherwise ///     use global retouche color. /// determine, if background color have to be drawn transparent /// and calculate transparency percent value ///     background color is transparent --> draw transparent. ///     graphic is drawn transparent and background color is ///     "no fill"/"auto fill" --> draw transparent /// draw background transparent /// draw background opaque