1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 28 #ifndef _SV_ALPHA_HXX 29 #define _SV_ALPHA_HXX 30 31 #include <vcl/dllapi.h> 32 #include <vcl/bitmap.hxx> 33 34 // ------------- 35 // - AlphaMask - 36 // ------------- 37 38 class ImageList; 39 class BitmapEx; 40 41 class VCL_DLLPUBLIC AlphaMask : private Bitmap 42 { 43 friend class BitmapEx; 44 friend class OutputDevice; 45 friend VCL_DLLPUBLIC SvStream& operator<<( SvStream&, const ImageList& ); 46 47 private: 48 49 SAL_DLLPRIVATE const Bitmap& ImplGetBitmap() const; 50 SAL_DLLPRIVATE void ImplSetBitmap( const Bitmap& rBitmap ); 51 52 public: 53 54 AlphaMask(); 55 AlphaMask( const Bitmap& rBitmap ); 56 AlphaMask( const AlphaMask& rAlphaMask ); 57 AlphaMask( const Size& rSizePixel, sal_uInt8* pEraseTransparency = NULL ); 58 ~AlphaMask(); 59 60 AlphaMask& operator=( const Bitmap& rBitmap ); 61 AlphaMask& operator=( const AlphaMask& rAlphaMask ) { return (AlphaMask&) Bitmap::operator=( rAlphaMask ); } 62 sal_Bool operator!() const { return Bitmap::operator!(); } 63 sal_Bool operator==( const AlphaMask& rAlphaMask ) const { return Bitmap::operator==( rAlphaMask ); } 64 sal_Bool operator!=( const AlphaMask& rAlphaMask ) const { return Bitmap::operator!=( rAlphaMask ); } 65 66 const MapMode& GetPrefMapMode() const { return Bitmap::GetPrefMapMode(); } 67 void SetPrefMapMode( const MapMode& rMapMode ) { Bitmap::SetPrefMapMode( rMapMode ); } 68 69 const Size& GetPrefSize() const { return Bitmap::GetPrefSize(); } 70 void SetPrefSize( const Size& rSize ) { Bitmap::SetPrefSize( rSize ); } 71 72 Size GetSizePixel() const { return Bitmap::GetSizePixel(); } 73 void SetSizePixel( const Size& rNewSize ) { Bitmap::SetSizePixel( rNewSize ); } 74 75 sal_uLong GetSizeBytes() const { return Bitmap::GetSizeBytes(); } 76 sal_uLong GetChecksum() const { return Bitmap::GetChecksum(); } 77 78 Bitmap GetBitmap() const; 79 80 public: 81 82 sal_Bool Crop( const Rectangle& rRectPixel ); 83 sal_Bool Expand( sal_uLong nDX, sal_uLong nDY, sal_uInt8* pInitTransparency = NULL ); 84 sal_Bool CopyPixel( const Rectangle& rRectDst, const Rectangle& rRectSrc, const AlphaMask* pAlphaSrc = NULL ); 85 sal_Bool Erase( sal_uInt8 cTransparency ); 86 sal_Bool Invert(); 87 sal_Bool Mirror( sal_uLong nMirrorFlags ); 88 sal_Bool Scale( const Size& rNewSize, sal_uLong nScaleFlag = BMP_SCALE_FAST ); 89 sal_Bool Scale( const double& rScaleX, const double& rScaleY, sal_uLong nScaleFlag = BMP_SCALE_FAST ); 90 sal_Bool Rotate( long nAngle10, sal_uInt8 cFillTransparency ); 91 sal_Bool Replace( const Bitmap& rMask, sal_uInt8 rReplaceTransparency ); 92 sal_Bool Replace( sal_uInt8 cSearchTransparency, sal_uInt8 cReplaceTransparency, sal_uLong nTol = 0UL ); 93 sal_Bool Replace( sal_uInt8* pSearchTransparencies, sal_uInt8* pReplaceTransparencies, 94 sal_uLong nColorCount, sal_uLong* pTols = NULL ); 95 96 public: 97 98 BitmapReadAccess* AcquireReadAccess() { return Bitmap::AcquireReadAccess(); } 99 BitmapWriteAccess* AcquireWriteAccess() { return Bitmap::AcquireWriteAccess(); } 100 void ReleaseAccess( BitmapReadAccess* pAccess ); 101 102 public: 103 104 sal_Bool Read( SvStream& rIStm, sal_Bool bFileHeader = sal_True ) { return Bitmap::Read( rIStm, bFileHeader ); } 105 sal_Bool Write( SvStream& rOStm, sal_Bool bCompressed = sal_True, sal_Bool bFileHeader = sal_True ) const { return Bitmap::Write( rOStm, bCompressed, bFileHeader ); } 106 107 friend VCL_DLLPUBLIC SvStream& operator<<( SvStream& rOStm, const BitmapEx& rBitmapEx ); 108 friend VCL_DLLPUBLIC SvStream& operator>>( SvStream& rIStm, BitmapEx& rBitmapEx ); 109 }; 110 111 #endif // _SV_ALPHA_HXX 112