1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 #ifndef _SV_ALPHA_HXX 25 #define _SV_ALPHA_HXX 26 27 #include <vcl/dllapi.h> 28 #include <vcl/bitmap.hxx> 29 30 // ------------- 31 // - AlphaMask - 32 // ------------- 33 34 class ImageList; 35 class BitmapEx; 36 37 class VCL_DLLPUBLIC AlphaMask : private Bitmap 38 { 39 friend class BitmapEx; 40 friend class OutputDevice; 41 friend VCL_DLLPUBLIC SvStream& operator<<( SvStream&, const ImageList& ); 42 43 private: 44 45 SAL_DLLPRIVATE const Bitmap& ImplGetBitmap() const; 46 SAL_DLLPRIVATE void ImplSetBitmap( const Bitmap& rBitmap ); 47 48 public: 49 50 AlphaMask(); 51 AlphaMask( const Bitmap& rBitmap ); 52 AlphaMask( const AlphaMask& rAlphaMask ); 53 AlphaMask( const Size& rSizePixel, sal_uInt8* pEraseTransparency = NULL ); 54 ~AlphaMask(); 55 56 AlphaMask& operator=( const Bitmap& rBitmap ); 57 AlphaMask& operator=( const AlphaMask& rAlphaMask ) { return (AlphaMask&) Bitmap::operator=( rAlphaMask ); } 58 sal_Bool operator!() const { return Bitmap::operator!(); } 59 sal_Bool operator==( const AlphaMask& rAlphaMask ) const { return Bitmap::operator==( rAlphaMask ); } 60 sal_Bool operator!=( const AlphaMask& rAlphaMask ) const { return Bitmap::operator!=( rAlphaMask ); } 61 62 const MapMode& GetPrefMapMode() const { return Bitmap::GetPrefMapMode(); } 63 void SetPrefMapMode( const MapMode& rMapMode ) { Bitmap::SetPrefMapMode( rMapMode ); } 64 65 const Size& GetPrefSize() const { return Bitmap::GetPrefSize(); } 66 void SetPrefSize( const Size& rSize ) { Bitmap::SetPrefSize( rSize ); } 67 68 Size GetSizePixel() const { return Bitmap::GetSizePixel(); } 69 void SetSizePixel( const Size& rNewSize ) { Bitmap::SetSizePixel( rNewSize ); } 70 71 sal_uLong GetSizeBytes() const { return Bitmap::GetSizeBytes(); } 72 sal_uLong GetChecksum() const { return Bitmap::GetChecksum(); } 73 74 Bitmap GetBitmap() const; 75 76 public: 77 78 sal_Bool Crop( const Rectangle& rRectPixel ); 79 sal_Bool Expand( sal_uLong nDX, sal_uLong nDY, sal_uInt8* pInitTransparency = NULL ); 80 sal_Bool CopyPixel( const Rectangle& rRectDst, const Rectangle& rRectSrc, const AlphaMask* pAlphaSrc = NULL ); 81 sal_Bool Erase( sal_uInt8 cTransparency ); 82 sal_Bool Invert(); 83 sal_Bool Mirror( sal_uLong nMirrorFlags ); 84 sal_Bool Scale( const Size& rNewSize, sal_uLong nScaleFlag = BMP_SCALE_FASTESTINTERPOLATE ); 85 sal_Bool Scale( const double& rScaleX, const double& rScaleY, sal_uLong nScaleFlag = BMP_SCALE_FASTESTINTERPOLATE ); 86 sal_Bool Rotate( long nAngle10, sal_uInt8 cFillTransparency ); 87 sal_Bool Replace( const Bitmap& rMask, sal_uInt8 rReplaceTransparency ); 88 sal_Bool Replace( sal_uInt8 cSearchTransparency, sal_uInt8 cReplaceTransparency, sal_uLong nTol = 0UL ); 89 sal_Bool Replace( sal_uInt8* pSearchTransparencies, sal_uInt8* pReplaceTransparencies, 90 sal_uLong nColorCount, sal_uLong* pTols = NULL ); 91 92 public: 93 94 BitmapReadAccess* AcquireReadAccess() { return Bitmap::AcquireReadAccess(); } 95 BitmapWriteAccess* AcquireWriteAccess() { return Bitmap::AcquireWriteAccess(); } 96 void ReleaseAccess( BitmapReadAccess* pAccess ); 97 98 public: 99 100 sal_Bool Read( SvStream& rIStm, sal_Bool bFileHeader = sal_True ) { return Bitmap::Read( rIStm, bFileHeader ); } 101 sal_Bool Write( SvStream& rOStm, sal_Bool bCompressed = sal_True, sal_Bool bFileHeader = sal_True ) const { return Bitmap::Write( rOStm, bCompressed, bFileHeader ); } 102 103 friend VCL_DLLPUBLIC SvStream& operator<<( SvStream& rOStm, const BitmapEx& rBitmapEx ); 104 friend VCL_DLLPUBLIC SvStream& operator>>( SvStream& rIStm, BitmapEx& rBitmapEx ); 105 }; 106 107 #endif // _SV_ALPHA_HXX 108