1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 <sal/config.h>
27 #include <vcl/dllapi.h>
28 #include <vcl/bitmap.hxx>
32 class VCL_DLLPUBLIC AlphaMask
: private Bitmap
37 AlphaMask( const Bitmap
& rBitmap
);
38 AlphaMask( const AlphaMask
& rAlphaMask
);
39 AlphaMask( AlphaMask
&& rAlphaMask
);
40 AlphaMask( const Size
& rSizePixel
, sal_uInt8
* pEraseTransparency
= nullptr );
41 virtual ~AlphaMask() override
;
43 AlphaMask
& operator=( const Bitmap
& rBitmap
);
44 AlphaMask
& operator=( const AlphaMask
& rAlphaMask
) { return static_cast<AlphaMask
&>( Bitmap::operator=( rAlphaMask
) ); }
45 AlphaMask
& operator=( AlphaMask
&& rAlphaMask
) { return static_cast<AlphaMask
&>( Bitmap::operator=( std::move(rAlphaMask
) ) ); }
46 bool operator!() const { return Bitmap::operator!(); }
47 bool operator==( const AlphaMask
& rAlphaMask
) const { return Bitmap::operator==( rAlphaMask
); }
48 bool operator!=( const AlphaMask
& rAlphaMask
) const { return Bitmap::operator!=( rAlphaMask
); }
50 void SetPrefMapMode( const MapMode
& rMapMode
) { Bitmap::SetPrefMapMode( rMapMode
); }
52 void SetPrefSize( const Size
& rSize
) { Bitmap::SetPrefSize( rSize
); }
54 Size
GetSizePixel() const { return Bitmap::GetSizePixel(); }
56 BitmapChecksum
GetChecksum() const { return Bitmap::GetChecksum(); }
58 Bitmap
GetBitmap() const;
60 bool Erase( sal_uInt8 cTransparency
);
61 bool Replace( const Bitmap
& rMask
, sal_uInt8 rReplaceTransparency
);
62 bool Replace( sal_uInt8 cSearchTransparency
, sal_uInt8 cReplaceTransparency
);
64 BitmapReadAccess
* AcquireReadAccess() { return Bitmap::AcquireReadAccess(); }
65 BitmapWriteAccess
* AcquireWriteAccess() { return Bitmap::AcquireWriteAccess(); }
67 void ReleaseAccess( BitmapReadAccess
* pAccess
);
69 typedef vcl::ScopedBitmapAccess
< BitmapReadAccess
, AlphaMask
, &AlphaMask::AcquireReadAccess
>
71 typedef vcl::ScopedBitmapAccess
< BitmapWriteAccess
, AlphaMask
, &AlphaMask::AcquireWriteAccess
>
75 friend class BitmapEx
;
76 friend class ::OutputDevice
;
77 friend bool VCL_DLLPUBLIC
ReadDIBBitmapEx(BitmapEx
& rTarget
, SvStream
& rIStm
);
79 SAL_DLLPRIVATE
const Bitmap
& ImplGetBitmap() const;
80 SAL_DLLPRIVATE
void ImplSetBitmap( const Bitmap
& rBitmap
);
84 #endif // INCLUDED_VCL_ALPHA_HXX
86 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */