diff options
Diffstat (limited to 'vcl/source/gdi/bitmap.cxx')
-rw-r--r-- | vcl/source/gdi/bitmap.cxx | 234 |
1 files changed, 117 insertions, 117 deletions
diff --git a/vcl/source/gdi/bitmap.cxx b/vcl/source/gdi/bitmap.cxx index 074935086b0b..c1572fd6d462 100644 --- a/vcl/source/gdi/bitmap.cxx +++ b/vcl/source/gdi/bitmap.cxx @@ -87,7 +87,7 @@ Bitmap::Bitmap( SalBitmap* pSalBitmap ) // ------------------------------------------------------------------ -Bitmap::Bitmap( const Size& rSizePixel, USHORT nBitCount, const BitmapPalette* pPal ) +Bitmap::Bitmap( const Size& rSizePixel, sal_uInt16 nBitCount, const BitmapPalette* pPal ) { if( rSizePixel.Width() && rSizePixel.Height() ) { @@ -127,12 +127,12 @@ Bitmap::Bitmap( const Size& rSizePixel, USHORT nBitCount, const BitmapPalette* p // Dither-Palette erzeugen if( 8 == nBitCount ) { - USHORT nActCol = 16; + sal_uInt16 nActCol = 16; - for( USHORT nB = 0; nB < 256; nB += 51 ) - for( USHORT nG = 0; nG < 256; nG += 51 ) - for( USHORT nR = 0; nR < 256; nR += 51 ) - aPal[ nActCol++ ] = BitmapColor( (BYTE) nR, (BYTE) nG, (BYTE) nB ); + for( sal_uInt16 nB = 0; nB < 256; nB += 51 ) + for( sal_uInt16 nG = 0; nG < 256; nG += 51 ) + for( sal_uInt16 nR = 0; nR < 256; nR += 51 ) + aPal[ nActCol++ ] = BitmapColor( (sal_uInt8) nR, (sal_uInt8) nG, (sal_uInt8) nB ); // Standard-Office-Farbe setzen aPal[ nActCol++ ] = BitmapColor( 0, 184, 255 ); @@ -197,11 +197,11 @@ const BitmapPalette& Bitmap::GetGreyPalette( int nEntries ) { if( !aGreyPalette16.GetEntryCount() ) { - BYTE cGrey = 0, cGreyInc = 17; + sal_uInt8 cGrey = 0, cGreyInc = 17; aGreyPalette16.SetEntryCount( 16 ); - for( USHORT i = 0; i < 16; i++, cGrey = sal::static_int_cast<BYTE>(cGrey + cGreyInc) ) + for( sal_uInt16 i = 0; i < 16; i++, cGrey = sal::static_int_cast<sal_uInt8>(cGrey + cGreyInc) ) aGreyPalette16[ i ] = BitmapColor( cGrey, cGrey, cGrey ); } @@ -213,8 +213,8 @@ const BitmapPalette& Bitmap::GetGreyPalette( int nEntries ) { aGreyPalette256.SetEntryCount( 256 ); - for( USHORT i = 0; i < 256; i++ ) - aGreyPalette256[ i ] = BitmapColor( (BYTE) i, (BYTE) i, (BYTE) i ); + for( sal_uInt16 i = 0; i < 256; i++ ) + aGreyPalette256[ i ] = BitmapColor( (sal_uInt8) i, (sal_uInt8) i, (sal_uInt8) i ); } return aGreyPalette256; @@ -261,7 +261,7 @@ Bitmap& Bitmap::operator=( const Bitmap& rBitmap ) // ------------------------------------------------------------------ -BOOL Bitmap::IsEqual( const Bitmap& rBmp ) const +sal_Bool Bitmap::IsEqual( const Bitmap& rBmp ) const { return( IsSameInstance( rBmp ) || ( rBmp.GetSizePixel() == GetSizePixel() && @@ -310,17 +310,17 @@ void Bitmap::SetSourceSizePixel( const Size& rSize) // ------------------------------------------------------------------ -USHORT Bitmap::GetBitCount() const +sal_uInt16 Bitmap::GetBitCount() const { return( mpImpBmp ? mpImpBmp->ImplGetBitCount() : 0 ); } // ------------------------------------------------------------------ -BOOL Bitmap::HasGreyPalette() const +sal_Bool Bitmap::HasGreyPalette() const { - const USHORT nBitCount = GetBitCount(); - BOOL bRet = FALSE; + const sal_uInt16 nBitCount = GetBitCount(); + sal_Bool bRet = sal_False; if( 1 == nBitCount ) { @@ -333,12 +333,12 @@ BOOL Bitmap::HasGreyPalette() const if( rCol0.GetRed() == rCol0.GetGreen() && rCol0.GetRed() == rCol0.GetBlue() && rCol1.GetRed() == rCol1.GetGreen() && rCol1.GetRed() == rCol1.GetBlue() ) { - bRet = TRUE; + bRet = sal_True; } ( (Bitmap*) this )->ReleaseAccess( pRAcc ); } else - bRet = TRUE; + bRet = sal_True; } else if( 4 == nBitCount || 8 == nBitCount ) { @@ -347,7 +347,7 @@ BOOL Bitmap::HasGreyPalette() const if( pRAcc ) { if( pRAcc->HasPalette() && ( (BitmapPalette&) pRAcc->GetPalette() == GetGreyPalette( 1 << nBitCount ) ) ) - bRet = TRUE; + bRet = sal_True; ( (Bitmap*) this )->ReleaseAccess( pRAcc ); } @@ -358,9 +358,9 @@ BOOL Bitmap::HasGreyPalette() const // ------------------------------------------------------------------ -ULONG Bitmap::GetChecksum() const +sal_uIntPtr Bitmap::GetChecksum() const { - ULONG nRet = 0UL; + sal_uIntPtr nRet = 0UL; if( mpImpBmp ) { @@ -524,44 +524,44 @@ void Bitmap::ReleaseAccess( BitmapReadAccess* pBitmapAccess ) // ------------------------------------------------------------------ -BOOL Bitmap::Erase( const Color& rFillColor ) +sal_Bool Bitmap::Erase( const Color& rFillColor ) { if( !(*this) ) - return TRUE; + return sal_True; BitmapWriteAccess* pWriteAcc = AcquireWriteAccess(); - BOOL bRet = FALSE; + sal_Bool bRet = sal_False; if( pWriteAcc ) { - const ULONG nFormat = pWriteAcc->GetScanlineFormat(); - BYTE cIndex = 0; - BOOL bFast = FALSE; + const sal_uIntPtr nFormat = pWriteAcc->GetScanlineFormat(); + sal_uInt8 cIndex = 0; + sal_Bool bFast = sal_False; switch( nFormat ) { case( BMP_FORMAT_1BIT_MSB_PAL ): case( BMP_FORMAT_1BIT_LSB_PAL ): { - cIndex = (BYTE) pWriteAcc->GetBestPaletteIndex( rFillColor ); + cIndex = (sal_uInt8) pWriteAcc->GetBestPaletteIndex( rFillColor ); cIndex = ( cIndex ? 255 : 0 ); - bFast = TRUE; + bFast = sal_True; } break; case( BMP_FORMAT_4BIT_MSN_PAL ): case( BMP_FORMAT_4BIT_LSN_PAL ): { - cIndex = (BYTE) pWriteAcc->GetBestPaletteIndex( rFillColor ); + cIndex = (sal_uInt8) pWriteAcc->GetBestPaletteIndex( rFillColor ); cIndex = cIndex | ( cIndex << 4 ); - bFast = TRUE; + bFast = sal_True; } break; case( BMP_FORMAT_8BIT_PAL ): { - cIndex = (BYTE) pWriteAcc->GetBestPaletteIndex( rFillColor ); - bFast = TRUE; + cIndex = (sal_uInt8) pWriteAcc->GetBestPaletteIndex( rFillColor ); + bFast = sal_True; } break; @@ -572,21 +572,21 @@ BOOL Bitmap::Erase( const Color& rFillColor ) ( rFillColor.GetRed() == rFillColor.GetBlue() ) ) { cIndex = rFillColor.GetRed(); - bFast = TRUE; + bFast = sal_True; } else - bFast = FALSE; + bFast = sal_False; } break; default: - bFast = FALSE; + bFast = sal_False; break; } if( bFast ) { - const ULONG nBufSize = pWriteAcc->GetScanlineSize() * pWriteAcc->Height(); + const sal_uIntPtr nBufSize = pWriteAcc->GetScanlineSize() * pWriteAcc->Height(); memset( pWriteAcc->GetBuffer(), cIndex, nBufSize ); } else @@ -598,7 +598,7 @@ BOOL Bitmap::Erase( const Color& rFillColor ) } ReleaseAccess( pWriteAcc ); - bRet = TRUE; + bRet = sal_True; } return bRet; @@ -606,19 +606,19 @@ BOOL Bitmap::Erase( const Color& rFillColor ) // ------------------------------------------------------------------ -BOOL Bitmap::Invert() +sal_Bool Bitmap::Invert() { BitmapWriteAccess* pAcc = AcquireWriteAccess(); - BOOL bRet = FALSE; + sal_Bool bRet = sal_False; if( pAcc ) { if( pAcc->HasPalette() ) { BitmapPalette aBmpPal( pAcc->GetPalette() ); - const USHORT nCount = aBmpPal.GetEntryCount(); + const sal_uInt16 nCount = aBmpPal.GetEntryCount(); - for( USHORT i = 0; i < nCount; i++ ) + for( sal_uInt16 i = 0; i < nCount; i++ ) aBmpPal[ i ].Invert(); pAcc->SetPalette( aBmpPal ); @@ -634,7 +634,7 @@ BOOL Bitmap::Invert() } ReleaseAccess( pAcc ); - bRet = TRUE; + bRet = sal_True; } return bRet; @@ -642,11 +642,11 @@ BOOL Bitmap::Invert() // ------------------------------------------------------------------ -BOOL Bitmap::Mirror( ULONG nMirrorFlags ) +sal_Bool Bitmap::Mirror( sal_uIntPtr nMirrorFlags ) { - BOOL bHorz = ( ( nMirrorFlags & BMP_MIRROR_HORZ ) == BMP_MIRROR_HORZ ); - BOOL bVert = ( ( nMirrorFlags & BMP_MIRROR_VERT ) == BMP_MIRROR_VERT ); - BOOL bRet = FALSE; + sal_Bool bHorz = ( ( nMirrorFlags & BMP_MIRROR_HORZ ) == BMP_MIRROR_HORZ ); + sal_Bool bVert = ( ( nMirrorFlags & BMP_MIRROR_VERT ) == BMP_MIRROR_VERT ); + sal_Bool bRet = sal_False; if( bHorz && !bVert ) { @@ -671,7 +671,7 @@ BOOL Bitmap::Mirror( ULONG nMirrorFlags ) } ReleaseAccess( pAcc ); - bRet = TRUE; + bRet = sal_True; } } else if( bVert && !bHorz ) @@ -681,7 +681,7 @@ BOOL Bitmap::Mirror( ULONG nMirrorFlags ) if( pAcc ) { const long nScanSize = pAcc->GetScanlineSize(); - BYTE* pBuffer = new BYTE[ nScanSize ]; + sal_uInt8* pBuffer = new sal_uInt8[ nScanSize ]; const long nHeight = pAcc->Height(); const long nHeight1 = nHeight - 1L; const long nHeight_2 = nHeight >> 1L; @@ -695,7 +695,7 @@ BOOL Bitmap::Mirror( ULONG nMirrorFlags ) delete[] pBuffer; ReleaseAccess( pAcc ); - bRet = TRUE; + bRet = sal_True; } } else if( bHorz && bVert ) @@ -732,26 +732,26 @@ BOOL Bitmap::Mirror( ULONG nMirrorFlags ) } ReleaseAccess( pAcc ); - bRet = TRUE; + bRet = sal_True; } } else - bRet = TRUE; + bRet = sal_True; return bRet; } // ------------------------------------------------------------------ -BOOL Bitmap::Rotate( long nAngle10, const Color& rFillColor ) +sal_Bool Bitmap::Rotate( long nAngle10, const Color& rFillColor ) { - BOOL bRet = FALSE; + sal_Bool bRet = sal_False; nAngle10 %= 3600L; nAngle10 = ( nAngle10 < 0L ) ? ( 3599L + nAngle10 ) : nAngle10; if( !nAngle10 ) - bRet = TRUE; + bRet = sal_True; else if( 1800L == nAngle10 ) bRet = Mirror( BMP_MIRROR_HORZ | BMP_MIRROR_VERT ); else @@ -801,7 +801,7 @@ BOOL Bitmap::Rotate( long nAngle10, const Color& rFillColor ) Point aTmpPoint; Rectangle aTmpRectangle( aTmpPoint, aSizePix ); Polygon aPoly( aTmpRectangle ); - aPoly.Rotate( aTmpPoint, (USHORT) nAngle10 ); + aPoly.Rotate( aTmpPoint, (sal_uInt16) nAngle10 ); Rectangle aNewBound( aPoly.GetBoundRect() ); const Size aNewSizePix( aNewBound.GetSize() ); @@ -877,7 +877,7 @@ BOOL Bitmap::Rotate( long nAngle10, const Color& rFillColor ) ReleaseAccess( pReadAcc ); } - if( ( bRet = !!aRotatedBmp ) == TRUE ) + if( ( bRet = !!aRotatedBmp ) == sal_True ) ImplAssignWithSize( aRotatedBmp ); } @@ -886,11 +886,11 @@ BOOL Bitmap::Rotate( long nAngle10, const Color& rFillColor ) // ------------------------------------------------------------------ -BOOL Bitmap::Crop( const Rectangle& rRectPixel ) +sal_Bool Bitmap::Crop( const Rectangle& rRectPixel ) { const Size aSizePix( GetSizePixel() ); Rectangle aRect( rRectPixel ); - BOOL bRet = FALSE; + sal_Bool bRet = sal_False; aRect.Intersection( Rectangle( Point(), aSizePix ) ); @@ -917,7 +917,7 @@ BOOL Bitmap::Crop( const Rectangle& rRectPixel ) pWriteAcc->SetPixel( nY, nX, pReadAcc->GetPixel( nY2, nX2 ) ); aNewBmp.ReleaseAccess( pWriteAcc ); - bRet = TRUE; + bRet = sal_True; } ReleaseAccess( pReadAcc ); @@ -932,12 +932,12 @@ BOOL Bitmap::Crop( const Rectangle& rRectPixel ) // ------------------------------------------------------------------ -BOOL Bitmap::CopyPixel( const Rectangle& rRectDst, +sal_Bool Bitmap::CopyPixel( const Rectangle& rRectDst, const Rectangle& rRectSrc, const Bitmap* pBmpSrc ) { const Size aSizePix( GetSizePixel() ); Rectangle aRectDst( rRectDst ); - BOOL bRet = FALSE; + sal_Bool bRet = sal_False; aRectDst.Intersection( Rectangle( Point(), aSizePix ) ); @@ -948,8 +948,8 @@ BOOL Bitmap::CopyPixel( const Rectangle& rRectDst, Bitmap* pSrc = (Bitmap*) pBmpSrc; const Size aCopySizePix( pSrc->GetSizePixel() ); Rectangle aRectSrc( rRectSrc ); - const USHORT nSrcBitCount = pBmpSrc->GetBitCount(); - const USHORT nDstBitCount = GetBitCount(); + const sal_uInt16 nSrcBitCount = pBmpSrc->GetBitCount(); + const sal_uInt16 nDstBitCount = GetBitCount(); if( nSrcBitCount > nDstBitCount ) { @@ -977,25 +977,25 @@ BOOL Bitmap::CopyPixel( const Rectangle& rRectDst, { const long nSrcCount = pDstAcc->GetPaletteEntryCount(); const long nDstCount = 1 << nDstBitCount; - BOOL bFound; + sal_Bool bFound; for( long i = 0L; ( i < nSrcCount ) && ( nNextIndex < nSrcCount ); i++ ) { - const BitmapColor& rSrcCol = pSrcAcc->GetPaletteColor( (USHORT) i ); + const BitmapColor& rSrcCol = pSrcAcc->GetPaletteColor( (sal_uInt16) i ); - bFound = FALSE; + bFound = sal_False; for( long j = 0L; j < nDstCount; j++ ) { - if( rSrcCol == pDstAcc->GetPaletteColor( (USHORT) j ) ) + if( rSrcCol == pDstAcc->GetPaletteColor( (sal_uInt16) j ) ) { - bFound = TRUE; + bFound = sal_True; break; } } if( !bFound ) - pDstAcc->SetPaletteColor( (USHORT) nNextIndex++, rSrcCol ); + pDstAcc->SetPaletteColor( (sal_uInt16) nNextIndex++, rSrcCol ); } } @@ -1027,14 +1027,14 @@ BOOL Bitmap::CopyPixel( const Rectangle& rRectDst, if( pReadAcc->HasPalette() && pWriteAcc->HasPalette() ) { - const USHORT nCount = pReadAcc->GetPaletteEntryCount(); - BYTE* pMap = new BYTE[ nCount ]; + const sal_uInt16 nCount = pReadAcc->GetPaletteEntryCount(); + sal_uInt8* pMap = new sal_uInt8[ nCount ]; // Index-Map fuer Farbtabelle // aufbauen, da das Bild ja (relativ) farbgenau // kopiert werden soll - for( USHORT i = 0; i < nCount; i++ ) - pMap[ i ] = (BYTE) pWriteAcc->GetBestPaletteIndex( pReadAcc->GetPaletteColor( i ) ); + for( sal_uInt16 i = 0; i < nCount; i++ ) + pMap[ i ] = (sal_uInt8) pWriteAcc->GetBestPaletteIndex( pReadAcc->GetPaletteColor( i ) ); for( long nSrcY = aRectSrc.Top(); nSrcY < nSrcEndY; nSrcY++, nDstY++ ) for( long nSrcX = aRectSrc.Left(), nDstX = aRectDst.Left(); nSrcX < nSrcEndX; nSrcX++, nDstX++ ) @@ -1110,7 +1110,7 @@ BOOL Bitmap::CopyPixel( const Rectangle& rRectDst, } ReleaseAccess( pWriteAcc ); - bRet = TRUE; + bRet = sal_True; } } } @@ -1121,9 +1121,9 @@ BOOL Bitmap::CopyPixel( const Rectangle& rRectDst, // ------------------------------------------------------------------ -BOOL Bitmap::Expand( ULONG nDX, ULONG nDY, const Color* pInitColor ) +sal_Bool Bitmap::Expand( sal_uIntPtr nDX, sal_uIntPtr nDY, const Color* pInitColor ) { - BOOL bRet = FALSE; + sal_Bool bRet = sal_False; if( nDX || nDY ) { @@ -1167,7 +1167,7 @@ BOOL Bitmap::Expand( ULONG nDX, ULONG nDY, const Color* pInitColor ) pWriteAcc->SetPixel( nY, nX, aColor ); aNewBmp.ReleaseAccess( pWriteAcc ); - bRet = TRUE; + bRet = sal_True; } ReleaseAccess( pReadAcc ); @@ -1182,11 +1182,11 @@ BOOL Bitmap::Expand( ULONG nDX, ULONG nDY, const Color* pInitColor ) // ------------------------------------------------------------------ -Bitmap Bitmap::CreateMask( const Color& rTransColor, ULONG nTol ) const +Bitmap Bitmap::CreateMask( const Color& rTransColor, sal_uIntPtr nTol ) const { Bitmap aNewBmp( GetSizePixel(), 1 ); BitmapWriteAccess* pWriteAcc = aNewBmp.AcquireWriteAccess(); - BOOL bRet = FALSE; + sal_Bool bRet = sal_False; if( pWriteAcc ) { @@ -1208,7 +1208,7 @@ Bitmap Bitmap::CreateMask( const Color& rTransColor, ULONG nTol ) const pReadAcc->GetScanlineFormat() == BMP_FORMAT_4BIT_LSN_PAL ) { // optimized for 4Bit-MSN/LSN source palette - const BYTE cTest = aTest.GetIndex(); + const sal_uInt8 cTest = aTest.GetIndex(); const long nShiftInit = ( ( pReadAcc->GetScanlineFormat() == BMP_FORMAT_4BIT_MSN_PAL ) ? 4 : 0 ); if( pWriteAcc->GetScanlineFormat() == BMP_FORMAT_1BIT_MSB_PAL && @@ -1246,7 +1246,7 @@ Bitmap Bitmap::CreateMask( const Color& rTransColor, ULONG nTol ) const else if( pReadAcc->GetScanlineFormat() == BMP_FORMAT_8BIT_PAL ) { // optimized for 8Bit source palette - const BYTE cTest = aTest.GetIndex(); + const sal_uInt8 cTest = aTest.GetIndex(); if( pWriteAcc->GetScanlineFormat() == BMP_FORMAT_1BIT_MSB_PAL && aWhite.GetIndex() == 1 ) @@ -1353,7 +1353,7 @@ Bitmap Bitmap::CreateMask( const Color& rTransColor, ULONG nTol ) const } ( (Bitmap*) this )->ReleaseAccess( pReadAcc ); - bRet = TRUE; + bRet = sal_True; } aNewBmp.ReleaseAccess( pWriteAcc ); @@ -1425,11 +1425,11 @@ Region Bitmap::CreateRegion( const Color& rColor, const Rectangle& rRect ) const // ------------------------------------------------------------------ -BOOL Bitmap::Replace( const Bitmap& rMask, const Color& rReplaceColor ) +sal_Bool Bitmap::Replace( const Bitmap& rMask, const Color& rReplaceColor ) { BitmapReadAccess* pMaskAcc = ( (Bitmap&) rMask ).AcquireReadAccess(); BitmapWriteAccess* pAcc = AcquireWriteAccess(); - BOOL bRet = FALSE; + sal_Bool bRet = sal_False; if( pMaskAcc && pAcc ) { @@ -1440,15 +1440,15 @@ BOOL Bitmap::Replace( const Bitmap& rMask, const Color& rReplaceColor ) if( pAcc->HasPalette() ) { - const USHORT nActColors = pAcc->GetPaletteEntryCount(); - const USHORT nMaxColors = 1 << pAcc->GetBitCount(); + const sal_uInt16 nActColors = pAcc->GetPaletteEntryCount(); + const sal_uInt16 nMaxColors = 1 << pAcc->GetBitCount(); // erst einmal naechste Farbe nehmen aReplace = pAcc->GetBestMatchingColor( rReplaceColor ); // falls Palettenbild, und die zu setzende Farbe ist nicht // in der Palette, suchen wir nach freien Eintraegen (teuer) - if( pAcc->GetPaletteColor( (BYTE) aReplace ) != BitmapColor( rReplaceColor ) ) + if( pAcc->GetPaletteColor( (sal_uInt8) aReplace ) != BitmapColor( rReplaceColor ) ) { // erst einmal nachsehen, ob wir unsere ReplaceColor // nicht auf einen freien Platz am Ende der Palette @@ -1457,26 +1457,26 @@ BOOL Bitmap::Replace( const Bitmap& rMask, const Color& rReplaceColor ) { pAcc->SetPaletteEntryCount( nActColors + 1 ); pAcc->SetPaletteColor( nActColors, rReplaceColor ); - aReplace = BitmapColor( (BYTE) nActColors ); + aReplace = BitmapColor( (sal_uInt8) nActColors ); } else { - BOOL* pFlags = new BOOL[ nMaxColors ]; + sal_Bool* pFlags = new sal_Bool[ nMaxColors ]; // alle Eintraege auf 0 setzen memset( pFlags, 0, nMaxColors ); for( long nY = 0L; nY < nHeight; nY++ ) for( long nX = 0L; nX < nWidth; nX++ ) - pFlags[ (BYTE) pAcc->GetPixel( nY, nX ) ] = TRUE; + pFlags[ (sal_uInt8) pAcc->GetPixel( nY, nX ) ] = sal_True; - for( USHORT i = 0UL; i < nMaxColors; i++ ) + for( sal_uInt16 i = 0UL; i < nMaxColors; i++ ) { // Hurra, wir haben einen unbenutzten Eintrag if( !pFlags[ i ] ) { - pAcc->SetPaletteColor( (USHORT) i, rReplaceColor ); - aReplace = BitmapColor( (BYTE) i ); + pAcc->SetPaletteColor( (sal_uInt16) i, rReplaceColor ); + aReplace = BitmapColor( (sal_uInt8) i ); } } @@ -1492,7 +1492,7 @@ BOOL Bitmap::Replace( const Bitmap& rMask, const Color& rReplaceColor ) if( pMaskAcc->GetPixel( nY, nX ) == aMaskWhite ) pAcc->SetPixel( nY, nX, aReplace ); - bRet = TRUE; + bRet = sal_True; } ( (Bitmap&) rMask ).ReleaseAccess( pMaskAcc ); @@ -1503,13 +1503,13 @@ BOOL Bitmap::Replace( const Bitmap& rMask, const Color& rReplaceColor ) // ------------------------------------------------------------------ -BOOL Bitmap::Replace( const AlphaMask& rAlpha, const Color& rMergeColor ) +sal_Bool Bitmap::Replace( const AlphaMask& rAlpha, const Color& rMergeColor ) { Bitmap aNewBmp( GetSizePixel(), 24 ); BitmapReadAccess* pAcc = AcquireReadAccess(); BitmapReadAccess* pAlphaAcc = ( (AlphaMask&) rAlpha ).AcquireReadAccess(); BitmapWriteAccess* pNewAcc = aNewBmp.AcquireWriteAccess(); - BOOL bRet = FALSE; + sal_Bool bRet = sal_False; if( pAcc && pAlphaAcc && pNewAcc ) { @@ -1522,11 +1522,11 @@ BOOL Bitmap::Replace( const AlphaMask& rAlpha, const Color& rMergeColor ) for( long nX = 0L; nX < nWidth; nX++ ) { aCol = pAcc->GetColor( nY, nX ); - pNewAcc->SetPixel( nY, nX, aCol.Merge( rMergeColor, 255 - (BYTE) pAlphaAcc->GetPixel( nY, nX ) ) ); + pNewAcc->SetPixel( nY, nX, aCol.Merge( rMergeColor, 255 - (sal_uInt8) pAlphaAcc->GetPixel( nY, nX ) ) ); } } - bRet = TRUE; + bRet = sal_True; } ReleaseAccess( pAcc ); @@ -1549,7 +1549,7 @@ BOOL Bitmap::Replace( const AlphaMask& rAlpha, const Color& rMergeColor ) // ------------------------------------------------------------------ -BOOL Bitmap::Replace( const Color& rSearchColor, const Color& rReplaceColor, ULONG nTol ) +sal_Bool Bitmap::Replace( const Color& rSearchColor, const Color& rReplaceColor, sal_uIntPtr nTol ) { // Bitmaps with 1 bit color depth can cause problems // if they have other entries than black/white in their palette @@ -1557,7 +1557,7 @@ BOOL Bitmap::Replace( const Color& rSearchColor, const Color& rReplaceColor, ULO Convert( BMP_CONVERSION_4BIT_COLORS ); BitmapWriteAccess* pAcc = AcquireWriteAccess(); - BOOL bRet = FALSE; + sal_Bool bRet = sal_False; if( pAcc ) { @@ -1570,7 +1570,7 @@ BOOL Bitmap::Replace( const Color& rSearchColor, const Color& rReplaceColor, ULO if( pAcc->HasPalette() ) { - for( USHORT i = 0, nPalCount = pAcc->GetPaletteEntryCount(); i < nPalCount; i++ ) + for( sal_uInt16 i = 0, nPalCount = pAcc->GetPaletteEntryCount(); i < nPalCount; i++ ) { const BitmapColor& rCol = pAcc->GetPaletteColor( i ); @@ -1604,7 +1604,7 @@ BOOL Bitmap::Replace( const Color& rSearchColor, const Color& rReplaceColor, ULO } ReleaseAccess( pAcc ); - bRet = TRUE; + bRet = sal_True; } return bRet; @@ -1612,8 +1612,8 @@ BOOL Bitmap::Replace( const Color& rSearchColor, const Color& rReplaceColor, ULO // ------------------------------------------------------------------ -BOOL Bitmap::Replace( const Color* pSearchColors, const Color* pReplaceColors, - ULONG nColorCount, ULONG* _pTols ) +sal_Bool Bitmap::Replace( const Color* pSearchColors, const Color* pReplaceColors, + sal_uIntPtr nColorCount, sal_uIntPtr* _pTols ) { // Bitmaps with 1 bit color depth can cause problems // if they have other entries than black/white in their palette @@ -1621,7 +1621,7 @@ BOOL Bitmap::Replace( const Color* pSearchColors, const Color* pReplaceColors, Convert( BMP_CONVERSION_4BIT_COLORS ); BitmapWriteAccess* pAcc = AcquireWriteAccess(); - BOOL bRet = FALSE; + sal_Bool bRet = sal_False; if( pAcc ) { @@ -1632,7 +1632,7 @@ BOOL Bitmap::Replace( const Color* pSearchColors, const Color* pReplaceColors, long* pMinB = new long[ nColorCount ]; long* pMaxB = new long[ nColorCount ]; long* pTols; - ULONG i; + sal_uIntPtr i; if( !_pTols ) { @@ -1657,7 +1657,7 @@ BOOL Bitmap::Replace( const Color* pSearchColors, const Color* pReplaceColors, if( pAcc->HasPalette() ) { - for( USHORT nEntry = 0, nPalCount = pAcc->GetPaletteEntryCount(); nEntry < nPalCount; nEntry++ ) + for( sal_uInt16 nEntry = 0, nPalCount = pAcc->GetPaletteEntryCount(); nEntry < nPalCount; nEntry++ ) { const BitmapColor& rCol = pAcc->GetPaletteColor( nEntry ); @@ -1667,7 +1667,7 @@ BOOL Bitmap::Replace( const Color* pSearchColors, const Color* pReplaceColors, pMinG[ i ] <= rCol.GetGreen() && pMaxG[ i ] >= rCol.GetGreen() && pMinB[ i ] <= rCol.GetBlue() && pMaxB[ i ] >= rCol.GetBlue() ) { - pAcc->SetPaletteColor( (USHORT)nEntry, pReplaceColors[ i ] ); + pAcc->SetPaletteColor( (sal_uInt16)nEntry, pReplaceColors[ i ] ); break; } } @@ -1713,7 +1713,7 @@ BOOL Bitmap::Replace( const Color* pSearchColors, const Color* pReplaceColors, delete[] pMinB; delete[] pMaxB; ReleaseAccess( pAcc ); - bRet = TRUE; + bRet = sal_True; } return bRet; @@ -1748,7 +1748,7 @@ Bitmap Bitmap::GetColorTransformedBitmap( BmpColorMode eColorMode ) const { Color* pSrcColors = NULL; Color* pDstColors = NULL; - ULONG nColorCount = 0; + sal_uIntPtr nColorCount = 0; aRet = *this; @@ -1772,11 +1772,11 @@ Bitmap Bitmap::GetColorTransformedBitmap( BmpColorMode eColorMode ) const // ------------------------------------------------------------------ -BOOL Bitmap::CombineSimple( const Bitmap& rMask, BmpCombine eCombine ) +sal_Bool Bitmap::CombineSimple( const Bitmap& rMask, BmpCombine eCombine ) { BitmapReadAccess* pMaskAcc = ( (Bitmap&) rMask ).AcquireReadAccess(); BitmapWriteAccess* pAcc = AcquireWriteAccess(); - BOOL bRet = FALSE; + sal_Bool bRet = sal_False; if( pMaskAcc && pAcc ) { @@ -1900,7 +1900,7 @@ BOOL Bitmap::CombineSimple( const Bitmap& rMask, BmpCombine eCombine ) break; } - bRet = TRUE; + bRet = sal_True; } ( (Bitmap&) rMask ).ReleaseAccess( pMaskAcc ); @@ -1911,7 +1911,7 @@ BOOL Bitmap::CombineSimple( const Bitmap& rMask, BmpCombine eCombine ) // ------------------------------------------------------------------ -BOOL Bitmap::Blend( const AlphaMask& rAlpha, const Color& rBackgroundColor ) +sal_Bool Bitmap::Blend( const AlphaMask& rAlpha, const Color& rBackgroundColor ) { // TODO: Have a look at OutputDevice::ImplDrawAlpha() for some // optimizations. Might even consolidate the code here and there. @@ -1923,7 +1923,7 @@ BOOL Bitmap::Blend( const AlphaMask& rAlpha, const Color& rBackgroundColor ) BitmapReadAccess* pAlphaAcc = const_cast<AlphaMask&>(rAlpha).AcquireReadAccess(); BitmapWriteAccess* pAcc = AcquireWriteAccess(); - BOOL bRet = FALSE; + sal_Bool bRet = sal_False; if( pAlphaAcc && pAcc ) { @@ -1936,7 +1936,7 @@ BOOL Bitmap::Blend( const AlphaMask& rAlpha, const Color& rBackgroundColor ) pAcc->GetPixel( nY, nX ).Merge( rBackgroundColor, 255 - pAlphaAcc->GetPixel( nY, nX ) ) ); - bRet = TRUE; + bRet = sal_True; } const_cast<AlphaMask&>(rAlpha).ReleaseAccess( pAlphaAcc ); @@ -1947,7 +1947,7 @@ BOOL Bitmap::Blend( const AlphaMask& rAlpha, const Color& rBackgroundColor ) // ------------------------------------------------------------------ -BOOL Bitmap::MakeMono( BYTE cThreshold ) +sal_Bool Bitmap::MakeMono( sal_uInt8 cThreshold ) { return ImplMakeMono( cThreshold ); } |