Branch libreoffice-5-0-4
[LibreOffice.git] / include / vcl / alpha.hxx
blob89b6996f18e578aae0e732463ec06a1823210066
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef INCLUDED_VCL_ALPHA_HXX
21 #define INCLUDED_VCL_ALPHA_HXX
23 #include <vcl/dllapi.h>
24 #include <vcl/bitmap.hxx>
27 class ImageList;
28 class BitmapEx;
30 class VCL_DLLPUBLIC AlphaMask : private Bitmap
32 public:
34 AlphaMask();
35 AlphaMask( const Bitmap& rBitmap );
36 AlphaMask( const AlphaMask& rAlphaMask );
37 AlphaMask( const Size& rSizePixel, sal_uInt8* pEraseTransparency = NULL );
38 virtual ~AlphaMask();
40 AlphaMask& operator=( const Bitmap& rBitmap );
41 AlphaMask& operator=( const AlphaMask& rAlphaMask ) { return static_cast<AlphaMask&>( Bitmap::operator=( rAlphaMask ) ); }
42 bool operator!() const { return Bitmap::operator!(); }
43 bool operator==( const AlphaMask& rAlphaMask ) const { return Bitmap::operator==( rAlphaMask ); }
44 bool operator!=( const AlphaMask& rAlphaMask ) const { return Bitmap::operator!=( rAlphaMask ); }
46 const MapMode& GetPrefMapMode() const { return Bitmap::GetPrefMapMode(); }
47 void SetPrefMapMode( const MapMode& rMapMode ) { Bitmap::SetPrefMapMode( rMapMode ); }
49 const Size& GetPrefSize() const { return Bitmap::GetPrefSize(); }
50 void SetPrefSize( const Size& rSize ) { Bitmap::SetPrefSize( rSize ); }
52 Size GetSizePixel() const { return Bitmap::GetSizePixel(); }
53 sal_uLong GetSizeBytes() const { return Bitmap::GetSizeBytes(); }
55 BitmapChecksum GetChecksum() const { return Bitmap::GetChecksum(); }
57 Bitmap GetBitmap() const;
59 bool Erase( sal_uInt8 cTransparency );
60 bool Replace( const Bitmap& rMask, sal_uInt8 rReplaceTransparency );
61 bool Replace( sal_uInt8 cSearchTransparency, sal_uInt8 cReplaceTransparency, sal_uLong nTol = 0UL );
63 BitmapReadAccess* AcquireReadAccess() { return Bitmap::AcquireReadAccess(); }
64 BitmapWriteAccess* AcquireWriteAccess() { return Bitmap::AcquireWriteAccess(); }
66 void ReleaseAccess( BitmapReadAccess* pAccess );
68 typedef vcl::ScopedBitmapAccess< BitmapReadAccess, AlphaMask, &AlphaMask::AcquireReadAccess >
69 ScopedReadAccess;
70 typedef vcl::ScopedBitmapAccess< BitmapWriteAccess, AlphaMask, &AlphaMask::AcquireWriteAccess >
71 ScopedWriteAccess;
73 private:
74 friend class BitmapEx;
75 friend class ::OutputDevice;
76 friend bool VCL_DLLPUBLIC ReadDIBBitmapEx(BitmapEx& rTarget, SvStream& rIStm);
78 SAL_DLLPRIVATE const Bitmap& ImplGetBitmap() const;
79 SAL_DLLPRIVATE void ImplSetBitmap( const Bitmap& rBitmap );
83 #endif // INCLUDED_VCL_ALPHA_HXX
85 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */