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 private: 40 friend class BitmapEx; 41 friend class OutputDevice; 42 friend bool VCL_DLLPUBLIC ReadDIBBitmapEx(BitmapEx& rTarget, SvStream& rIStm); 43 44 SAL_DLLPRIVATE const Bitmap& ImplGetBitmap() const; 45 SAL_DLLPRIVATE void ImplSetBitmap( const Bitmap& rBitmap ); 46 47 public: 48 49 AlphaMask(); 50 AlphaMask( const Bitmap& rBitmap ); 51 AlphaMask( const AlphaMask& rAlphaMask ); 52 AlphaMask( const Size& rSizePixel, sal_uInt8* pEraseTransparency = NULL ); 53 ~AlphaMask(); 54 55 AlphaMask& operator=( const Bitmap& rBitmap ); 56 AlphaMask& operator=( const AlphaMask& rAlphaMask ) { return (AlphaMask&) Bitmap::operator=( rAlphaMask ); } 57 sal_Bool operator!() const { return Bitmap::operator!(); } 58 sal_Bool operator==( const AlphaMask& rAlphaMask ) const { return Bitmap::operator==( rAlphaMask ); } 59 sal_Bool operator!=( const AlphaMask& rAlphaMask ) const { return Bitmap::operator!=( rAlphaMask ); } 60 61 const MapMode& GetPrefMapMode() const { return Bitmap::GetPrefMapMode(); } 62 void SetPrefMapMode( const MapMode& rMapMode ) { Bitmap::SetPrefMapMode( rMapMode ); } 63 64 const Size& GetPrefSize() const { return Bitmap::GetPrefSize(); } 65 void SetPrefSize( const Size& rSize ) { Bitmap::SetPrefSize( rSize ); } 66 67 Size GetSizePixel() const { return Bitmap::GetSizePixel(); } 68 void SetSizePixel( const Size& rNewSize, sal_uInt32 nScaleFlag = BMP_SCALE_FASTESTINTERPOLATE ) 69 { 70 Bitmap::SetSizePixel( rNewSize, nScaleFlag ); 71 } 72 73 sal_uLong GetSizeBytes() const { return Bitmap::GetSizeBytes(); } 74 sal_uLong GetChecksum() const { return Bitmap::GetChecksum(); } 75 76 Bitmap GetBitmap() const; 77 78 public: 79 80 sal_Bool Crop( const Rectangle& rRectPixel ); 81 sal_Bool Expand( sal_uLong nDX, sal_uLong nDY, sal_uInt8* pInitTransparency = NULL ); 82 sal_Bool CopyPixel( const Rectangle& rRectDst, const Rectangle& rRectSrc, const AlphaMask* pAlphaSrc = NULL ); 83 sal_Bool Erase( sal_uInt8 cTransparency ); 84 sal_Bool Invert(); 85 sal_Bool Mirror( sal_uLong nMirrorFlags ); 86 sal_Bool Scale( const Size& rNewSize, sal_uInt32 nScaleFlag = BMP_SCALE_FASTESTINTERPOLATE ); 87 sal_Bool Scale( const double& rScaleX, const double& rScaleY, sal_uInt32 nScaleFlag = BMP_SCALE_FASTESTINTERPOLATE ); 88 sal_Bool Rotate( long nAngle10, sal_uInt8 cFillTransparency ); 89 sal_Bool Replace( const Bitmap& rMask, sal_uInt8 rReplaceTransparency ); 90 sal_Bool Replace( sal_uInt8 cSearchTransparency, sal_uInt8 cReplaceTransparency, sal_uLong nTol = 0UL ); 91 sal_Bool Replace( sal_uInt8* pSearchTransparencies, sal_uInt8* pReplaceTransparencies, 92 sal_uLong nColorCount, sal_uLong* pTols = NULL ); 93 94 public: 95 96 BitmapReadAccess* AcquireReadAccess() { return Bitmap::AcquireReadAccess(); } 97 BitmapWriteAccess* AcquireWriteAccess() { return Bitmap::AcquireWriteAccess(); } 98 void ReleaseAccess( BitmapReadAccess* pAccess ); 99 }; 100 101 #endif // _SV_ALPHA_HXX 102 // eof 103