diff options
-rw-r--r-- | cppcanvas/source/wrapper/implbitmap.cxx | 43 |
1 files changed, 37 insertions, 6 deletions
diff --git a/cppcanvas/source/wrapper/implbitmap.cxx b/cppcanvas/source/wrapper/implbitmap.cxx index 9ed4ab22f947..22de22d5c5e7 100644 --- a/cppcanvas/source/wrapper/implbitmap.cxx +++ b/cppcanvas/source/wrapper/implbitmap.cxx @@ -2,9 +2,9 @@ * * $RCSfile: implbitmap.cxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: thb $ $Date: 2004-03-18 10:41:09 $ + * last change: $Author: rt $ $Date: 2004-11-26 20:58:48 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -59,8 +59,8 @@ * ************************************************************************/ -#include "implbitmap.hxx" -#include "implbitmapcanvas.hxx" +#include <implbitmap.hxx> +#include <implbitmapcanvas.hxx> #ifndef _BGFX_MATRIX_B2DHOMMATRIX_HXX #include <basegfx/matrix/b2dhommatrix.hxx> @@ -100,10 +100,12 @@ namespace cppcanvas "ImplBitmap::draw: invalid canvas" ); if( pCanvas.get() == NULL || - pCanvas->getUNOCanvas().is() ) + !pCanvas->getUNOCanvas().is() ) + { return false; + } - // TODO: implement caching + // TODO(P1): implement caching pCanvas->getUNOCanvas()->drawBitmap( mxBitmap, pCanvas->getViewState(), maRenderState ); @@ -111,6 +113,35 @@ namespace cppcanvas return true; } + bool ImplBitmap::drawAlphaModulated( double nAlphaModulation ) const + { + CanvasSharedPtr pCanvas( getCanvas() ); + + OSL_ENSURE( pCanvas.get() != NULL && + pCanvas->getUNOCanvas().is(), + "ImplBitmap::drawAlphaModulated(): invalid canvas" ); + + if( pCanvas.get() == NULL || + !pCanvas->getUNOCanvas().is() ) + { + return false; + } + + rendering::RenderState aLocalState( maRenderState ); + aLocalState.DeviceColor.realloc( 4 ); + aLocalState.DeviceColor[0] = 1.0; + aLocalState.DeviceColor[1] = 1.0; + aLocalState.DeviceColor[2] = 1.0; + aLocalState.DeviceColor[3] = nAlphaModulation; + + // TODO(P1): implement caching + pCanvas->getUNOCanvas()->drawBitmapModulated( mxBitmap, + pCanvas->getViewState(), + aLocalState ); + + return true; + } + BitmapCanvasSharedPtr ImplBitmap::getBitmapCanvas() const { return mpBitmapCanvas; |