diff options
author | Kai Ahrens <ka@openoffice.org> | 2001-08-24 13:10:36 +0000 |
---|---|---|
committer | Kai Ahrens <ka@openoffice.org> | 2001-08-24 13:10:36 +0000 |
commit | 31904aa2d86596d1ca3674d7c4b789410a510a6a (patch) | |
tree | 85b962f817b39a574fbc0039aecfae36d6bf034f /vcl/source/gdi/impgraph.cxx | |
parent | 2e47f6f87119577ba4f337499ff91e07460be324 (diff) |
#84444#: added size parameter for ::GetBitmap(Ex)
Diffstat (limited to 'vcl/source/gdi/impgraph.cxx')
-rw-r--r-- | vcl/source/gdi/impgraph.cxx | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/vcl/source/gdi/impgraph.cxx b/vcl/source/gdi/impgraph.cxx index 40de2c2866f1..bc76a3de893d 100644 --- a/vcl/source/gdi/impgraph.cxx +++ b/vcl/source/gdi/impgraph.cxx @@ -2,9 +2,9 @@ * * $RCSfile: impgraph.cxx,v $ * - * $Revision: 1.10 $ + * $Revision: 1.11 $ * - * last change: $Author: ka $ $Date: 2001-08-07 11:20:13 $ + * last change: $Author: ka $ $Date: 2001-08-24 14:10:36 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -490,7 +490,7 @@ BOOL ImpGraphic::ImplIsAnimated() const // ------------------------------------------------------------------------ -Bitmap ImpGraphic::ImplGetBitmap() const +Bitmap ImpGraphic::ImplGetBitmap( const Size* pSizePixel ) const { Bitmap aRetBmp; @@ -500,6 +500,9 @@ Bitmap ImpGraphic::ImplGetBitmap() const const Color aReplaceColor( COL_WHITE ); aRetBmp = rRetBmpEx.GetBitmap( &aReplaceColor ); + + if( pSizePixel ) + aRetBmp.Scale( *pSizePixel ); } else if( ( meType != GRAPHIC_DEFAULT ) && ImplIsSupportedGraphic() ) { @@ -512,6 +515,14 @@ Bitmap ImpGraphic::ImplGetBitmap() const Size aDrawSize( aVDev.LogicToPixel( maMetaFile.GetPrefSize(), maMetaFile.GetPrefMapMode() ) ); Size aSizePix( labs( aBRPix.X() - aTLPix.X() ) + 1, labs( aBRPix.Y() - aTLPix.Y() ) + 1 ); + if( pSizePixel && aSizePix.Width() && aSizePix.Height() ) + { + aDrawSize.Width() = FRound( (double) pSizePixel->Width() * (double) aDrawSize.Width() / (double) aSizePix.Width() ); + aDrawSize.Height() = FRound( (double) pSizePixel->Height() * (double) aDrawSize.Height() / (double) aSizePix.Height() ); + + aSizePix = *pSizePixel; + } + if( aSizePix.Width() && aSizePix.Height() && ( aSizePix.Width() > GRAPHIC_MTFTOBMP_MAXEXT || aSizePix.Height() > GRAPHIC_MTFTOBMP_MAXEXT ) ) { @@ -545,16 +556,21 @@ Bitmap ImpGraphic::ImplGetBitmap() const // ------------------------------------------------------------------------ -BitmapEx ImpGraphic::ImplGetBitmapEx() const +BitmapEx ImpGraphic::ImplGetBitmapEx( const Size* pSizePixel ) const { BitmapEx aRetBmpEx; if( meType == GRAPHIC_BITMAP ) + { aRetBmpEx = ( mpAnimation ? mpAnimation->GetBitmapEx() : maEx ); + + if( pSizePixel ) + aRetBmpEx.Scale( *pSizePixel ); + } else if( ( meType != GRAPHIC_DEFAULT ) && ImplIsSupportedGraphic() ) { const ImpGraphic aMonoMask( maMetaFile.GetMonochromeMtf( COL_BLACK ) ); - aRetBmpEx = BitmapEx( ImplGetBitmap(), aMonoMask.ImplGetBitmap() ); + aRetBmpEx = BitmapEx( ImplGetBitmap( pSizePixel ), aMonoMask.ImplGetBitmap( pSizePixel ) ); } return aRetBmpEx; |