diff options
author | Thorsten Behrens <thb@openoffice.org> | 2006-06-02 12:57:26 +0000 |
---|---|---|
committer | Thorsten Behrens <thb@openoffice.org> | 2006-06-02 12:57:26 +0000 |
commit | db83a2292b3e75df100bf377c5202b11f423c9d7 (patch) | |
tree | f6d178f005e5071029fcc097247d85020a5e7df2 /basebmp/source | |
parent | 1ee80e3be2f120116180be826d0fc203c54be8f3 (diff) |
#i65904# Completed mask support; fixed color difference bug; added more tests
Diffstat (limited to 'basebmp/source')
-rw-r--r-- | basebmp/source/bitmapdevice.cxx | 102 | ||||
-rw-r--r-- | basebmp/source/debug.cxx | 31 |
2 files changed, 69 insertions, 64 deletions
diff --git a/basebmp/source/bitmapdevice.cxx b/basebmp/source/bitmapdevice.cxx index bd7425bf4526..eb40b57c7dce 100644 --- a/basebmp/source/bitmapdevice.cxx +++ b/basebmp/source/bitmapdevice.cxx @@ -4,9 +4,9 @@ * * $RCSfile: bitmapdevice.cxx,v $ * - * $Revision: 1.4 $ + * $Revision: 1.5 $ * - * last change: $Author: thb $ $Date: 2006-06-02 08:50:38 $ + * last change: $Author: thb $ $Date: 2006-06-02 13:57:25 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -475,7 +475,9 @@ namespace pAlpha->maAccessor, maBegin + vigra::Diff2D(rDstPoint.getX(), rDstPoint.getY()), - maAccessor ); + ConstantColorBlendAccessorAdapter<DestAccessor,Color>( + maAccessor, + rSrcColor) ); } virtual void drawMaskedColor_i(Color rSrcColor, @@ -865,19 +867,16 @@ void BitmapDevice::drawBitmap( const BitmapDeviceSharedPtr& rSrcBitmap, DrawMode drawMode ) { const basegfx::B2IVector& rSrcSize( rSrcBitmap->getSize() ); - const basegfx::B2IRange aSrcBounds( 0,0,rSrcSize.getX()+1,rSrcSize.getY()+1 ); - const basegfx::B2IVector& rDstSize( getSize() ); - const basegfx::B2IRange aDstBounds( 0,0,rDstSize.getX()+1,rDstSize.getY()+1 ); - - basegfx::B2IRange aSrcRange( rSrcRect ); - basegfx::B2IRange aDestRange( rDstRect ); + const basegfx::B2IRange aSrcBounds( 0,0,rSrcSize.getX(),rSrcSize.getY() ); + basegfx::B2IRange aSrcRange( rSrcRect ); + basegfx::B2IRange aDestRange( rDstRect ); if( clipAreaImpl( aDestRange, aSrcRange, - aDstBounds, + mpImpl->maBounds, aSrcBounds )) { - assertImageRange(aDestRange,aDstBounds); + assertImageRange(aDestRange,mpImpl->maBounds); assertImageRange(aSrcRange,aSrcBounds); if( isCompatibleBitmap( rSrcBitmap ) ) @@ -894,19 +893,16 @@ void BitmapDevice::drawBitmap( const BitmapDeviceSharedPtr& rSrcBitmap, const BitmapDeviceSharedPtr& rClip ) { const basegfx::B2IVector& rSrcSize( rSrcBitmap->getSize() ); - const basegfx::B2IRange aSrcBounds( 0,0,rSrcSize.getX()+1,rSrcSize.getY()+1 ); - const basegfx::B2IVector& rDstSize( getSize() ); - const basegfx::B2IRange aDstBounds( 0,0,rDstSize.getX()+1,rDstSize.getY()+1 ); - - basegfx::B2IRange aSrcRange( rSrcRect ); - basegfx::B2IRange aDestRange( rDstRect ); + const basegfx::B2IRange aSrcBounds( 0,0,rSrcSize.getX(),rSrcSize.getY() ); + basegfx::B2IRange aSrcRange( rSrcRect ); + basegfx::B2IRange aDestRange( rDstRect ); if( clipAreaImpl( aDestRange, aSrcRange, - aDstBounds, + mpImpl->maBounds, aSrcBounds )) { - assertImageRange(aDestRange,aDstBounds); + assertImageRange(aDestRange,mpImpl->maBounds); assertImageRange(aSrcRange,aSrcBounds); if( isCompatibleBitmap( rSrcBitmap ) && @@ -927,19 +923,16 @@ void BitmapDevice::drawMaskedColor( Color rSrcColor, const basegfx::B2IPoint& rDstPoint ) { const basegfx::B2IVector& rSrcSize( rAlphaMask->getSize() ); - const basegfx::B2IRange aSrcBounds( 0,0,rSrcSize.getX()+1,rSrcSize.getY()+1 ); - const basegfx::B2IVector& rDstSize( getSize() ); - const basegfx::B2IRange aDstBounds( 0,0,rDstSize.getX()+1,rDstSize.getY()+1 ); - - basegfx::B2IRange aSrcRange( rSrcRect ); - basegfx::B2IPoint aDestPoint( rDstPoint ); + const basegfx::B2IRange aSrcBounds( 0,0,rSrcSize.getX(),rSrcSize.getY() ); + basegfx::B2IRange aSrcRange( rSrcRect ); + basegfx::B2IPoint aDestPoint( rDstPoint ); if( clipAreaImpl( aSrcRange, aDestPoint, aSrcBounds, - aDstBounds )) + mpImpl->maBounds )) { - assertImagePoint(aDestPoint,aDstBounds); + assertImagePoint(aDestPoint,mpImpl->maBounds); assertImageRange(aSrcRange,aSrcBounds); if( isCompatibleAlphaMask( rAlphaMask ) ) @@ -956,19 +949,16 @@ void BitmapDevice::drawMaskedColor( Color rSrcColor, const BitmapDeviceSharedPtr& rClip ) { const basegfx::B2IVector& rSrcSize( rAlphaMask->getSize() ); - const basegfx::B2IRange aSrcBounds( 0,0,rSrcSize.getX()+1,rSrcSize.getY()+1 ); - const basegfx::B2IVector& rDstSize( getSize() ); - const basegfx::B2IRange aDstBounds( 0,0,rDstSize.getX()+1,rDstSize.getY()+1 ); - - basegfx::B2IRange aSrcRange( rSrcRect ); - basegfx::B2IPoint aDestPoint( rDstPoint ); + const basegfx::B2IRange aSrcBounds( 0,0,rSrcSize.getX(),rSrcSize.getY() ); + basegfx::B2IRange aSrcRange( rSrcRect ); + basegfx::B2IPoint aDestPoint( rDstPoint ); if( clipAreaImpl( aSrcRange, aDestPoint, aSrcBounds, - aDstBounds )) + mpImpl->maBounds )) { - assertImagePoint(aDestPoint,aDstBounds); + assertImagePoint(aDestPoint,mpImpl->maBounds); assertImageRange(aSrcRange,aSrcBounds); if( isCompatibleAlphaMask( rAlphaMask ) && @@ -992,19 +982,16 @@ void BitmapDevice::drawMaskedBitmap( const BitmapDeviceSharedPtr& rSrcBitmap, OSL_ASSERT( rMask->getSize() == rSrcBitmap->getSize() ); const basegfx::B2IVector& rSrcSize( rSrcBitmap->getSize() ); - const basegfx::B2IRange aSrcBounds( 0,0,rSrcSize.getX()+1,rSrcSize.getY()+1 ); - const basegfx::B2IVector& rDstSize( getSize() ); - const basegfx::B2IRange aDstBounds( 0,0,rDstSize.getX()+1,rDstSize.getY()+1 ); - - basegfx::B2IRange aSrcRange( rSrcRect ); - basegfx::B2IRange aDestRange( rDstRect ); + const basegfx::B2IRange aSrcBounds( 0,0,rSrcSize.getX(),rSrcSize.getY() ); + basegfx::B2IRange aSrcRange( rSrcRect ); + basegfx::B2IRange aDestRange( rDstRect ); if( clipAreaImpl( aDestRange, aSrcRange, - aDstBounds, + mpImpl->maBounds, aSrcBounds )) { - assertImageRange(aDestRange,aDstBounds); + assertImageRange(aDestRange,mpImpl->maBounds); assertImageRange(aSrcRange,aSrcBounds); if( isCompatibleBitmap( rSrcBitmap ) && @@ -1029,19 +1016,16 @@ void BitmapDevice::drawMaskedBitmap( const BitmapDeviceSharedPtr& rSrcBitmap, OSL_ASSERT( rMask->getSize() == rSrcBitmap->getSize() ); const basegfx::B2IVector& rSrcSize( rSrcBitmap->getSize() ); - const basegfx::B2IRange aSrcBounds( 0,0,rSrcSize.getX()+1,rSrcSize.getY()+1 ); - const basegfx::B2IVector& rDstSize( getSize() ); - const basegfx::B2IRange aDstBounds( 0,0,rDstSize.getX()+1,rDstSize.getY()+1 ); - - basegfx::B2IRange aSrcRange( rSrcRect ); - basegfx::B2IRange aDestRange( rDstRect ); + const basegfx::B2IRange aSrcBounds( 0,0,rSrcSize.getX(),rSrcSize.getY() ); + basegfx::B2IRange aSrcRange( rSrcRect ); + basegfx::B2IRange aDestRange( rDstRect ); if( clipAreaImpl( aDestRange, aSrcRange, - aDstBounds, + mpImpl->maBounds, aSrcBounds )) { - assertImageRange(aDestRange,aDstBounds); + assertImageRange(aDestRange,mpImpl->maBounds); assertImageRange(aSrcRange,aSrcBounds); if( isCompatibleBitmap( rSrcBitmap ) && @@ -1076,9 +1060,9 @@ BitmapDeviceSharedPtr createBitmapDevice( const basegfx::B2IVector& rSize, // HACK: 1bpp and 32bpp only, currently if( nScanlineFormat == Format::ONE_BIT_MSB_PAL - || nScanlineFormat == Format::ONE_BIT_MSB_TC_MASK ) + || nScanlineFormat == Format::ONE_BIT_MSB_GRAY ) nScanlineStride = (rSize.getX() + 7) >> 3; - else if( nScanlineFormat == Format::EIGHT_BIT_TC_MASK ) + else if( nScanlineFormat == Format::EIGHT_BIT_GRAY ) nScanlineStride = rSize.getX(); else if( nScanlineFormat == Format::THIRTYTWO_BIT_TC_MASK ) nScanlineStride = 4*rSize.getX(); @@ -1100,7 +1084,7 @@ BitmapDeviceSharedPtr createBitmapDevice( const basegfx::B2IVector& rSize, switch( nScanlineFormat ) { - case Format::ONE_BIT_MSB_TC_MASK: + case Format::ONE_BIT_MSB_GRAY: { return BitmapDeviceSharedPtr( new OneBitMsbMaskRenderer( @@ -1143,7 +1127,7 @@ BitmapDeviceSharedPtr createBitmapDevice( const basegfx::B2IVector& rSize, pPal )); } - case Format::EIGHT_BIT_TC_MASK: + case Format::EIGHT_BIT_GRAY: { return BitmapDeviceSharedPtr( new EightBitTrueColorRenderer( @@ -1197,9 +1181,9 @@ BitmapDeviceSharedPtr createBitmapDevice( const basegfx::B2IVector& rSize // HACK: 1bpp and 32bpp only, currently if( nScanlineFormat == Format::ONE_BIT_MSB_PAL - || nScanlineFormat == Format::ONE_BIT_MSB_TC_MASK ) + || nScanlineFormat == Format::ONE_BIT_MSB_GRAY ) nScanlineStride = (rSize.getX() + 7) >> 3; - else if( nScanlineFormat == Format::EIGHT_BIT_TC_MASK ) + else if( nScanlineFormat == Format::EIGHT_BIT_GRAY ) nScanlineStride = rSize.getX(); else if( nScanlineFormat == Format::THIRTYTWO_BIT_TC_MASK ) nScanlineStride = 4*rSize.getX(); @@ -1214,7 +1198,7 @@ BitmapDeviceSharedPtr createBitmapDevice( const basegfx::B2IVector& rSize switch( nScanlineFormat ) { - case Format::ONE_BIT_MSB_TC_MASK: + case Format::ONE_BIT_MSB_GRAY: { return BitmapDeviceSharedPtr( new OneBitMsbMaskRenderer( @@ -1253,7 +1237,7 @@ BitmapDeviceSharedPtr createBitmapDevice( const basegfx::B2IVector& rSize rPalette )); } - case Format::EIGHT_BIT_TC_MASK: + case Format::EIGHT_BIT_GRAY: { return BitmapDeviceSharedPtr( new EightBitTrueColorRenderer( diff --git a/basebmp/source/debug.cxx b/basebmp/source/debug.cxx index e4b331757202..d789f39b1d79 100644 --- a/basebmp/source/debug.cxx +++ b/basebmp/source/debug.cxx @@ -2,9 +2,9 @@ * * $RCSfile: debug.cxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: thb $ $Date: 2006-05-31 10:12:12 $ + * last change: $Author: thb $ $Date: 2006-06-02 13:57:25 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -79,10 +79,30 @@ namespace basebmp { switch( nScanlineFormat ) { + case Format::ONE_BIT_MSB_GRAY: + return "ONE_BIT_MSB_GRAY"; + case Format::ONE_BIT_LSB_GRAY: + return "ONE_BIT_LSB_GRAY"; case Format::ONE_BIT_MSB_PAL: return "ONE_BIT_MSB_PAL"; - case Format::EIGHT_BIT_TC_MASK: - return "EIGHT_BIT_TC_MASK"; + case Format::ONE_BIT_LSB_PAL: + return "ONE_BIT_LSB_PAL"; + case Format::TWO_BIT_MSB_PAL: + return "TWO_BIT_MSB_PAL"; + case Format::TWO_BIT_LSB_PAL: + return "TWO_BIT_LSB_PAL"; + case Format::FOUR_BIT_MSB_PAL: + return "FOUR_BIT_MSB_PAL"; + case Format::FOUR_BIT_LSB_PAL: + return "FOUR_BIT_LSB_PAL"; + case Format::EIGHT_BIT_PAL: + return "EIGHT_BIT_PAL"; + case Format::EIGHT_BIT_GRAY: + return "EIGHT_BIT_GRAY"; + case Format::SIXTEEN_BIT_TC_MASK: + return "SIXTEEN_BIT_TC_MASK"; + case Format::TWENTYFOUR_BIT_TC_MASK: + return "TWENTYFOUR_BIT_TC_MASK"; case Format::THIRTYTWO_BIT_TC_MASK: return "THIRTYTWO_BIT_TC_MASK"; default: @@ -99,11 +119,12 @@ namespace basebmp const sal_Int32 nScanlineFormat( rDevice->getScanlineFormat() ); rOutputStream - << "/* basebmp::BitmapDevice memory dump */" << std::endl + << "/* basebmp::BitmapDevice content dump */" << std::endl << "/* Width = " << aSize.getX() << " */" << std::endl << "/* Height = " << aSize.getY() << " */" << std::endl << "/* TopDown = " << bTopDown << " */" << std::endl << "/* Format = " << getFormatString(nScanlineFormat) << " */" << std::endl + << "/* (dumped entries are already mapped RGBA color values) */" << std::endl << std::endl; rOutputStream << std::hex; |