LibreOffice Module vcl (master)  1
alpha.hxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
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/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
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 .
18  */
19 
20 #ifndef INCLUDED_VCL_ALPHA_HXX
21 #define INCLUDED_VCL_ALPHA_HXX
22 
23 #include <sal/config.h>
24 
25 #include <utility>
26 
27 #include <vcl/dllapi.h>
28 #include <vcl/bitmap.hxx>
29 
30 class BitmapEx;
31 
33 {
34 public:
35 
36  AlphaMask();
37  explicit AlphaMask( const Bitmap& rBitmap );
38  AlphaMask( const AlphaMask& rAlphaMask );
39  AlphaMask( AlphaMask&& rAlphaMask );
40  explicit AlphaMask( const Size& rSizePixel, const sal_uInt8* pEraseTransparency = nullptr );
41  virtual ~AlphaMask() override;
42 
43  AlphaMask& operator=( const Bitmap& rBitmap );
44  AlphaMask& operator=( const AlphaMask& rAlphaMask ) { return static_cast<AlphaMask&>( Bitmap::operator=( rAlphaMask ) ); }
45  AlphaMask& operator=( AlphaMask&& rAlphaMask ) noexcept { return static_cast<AlphaMask&>( Bitmap::operator=( std::move(rAlphaMask) ) ); }
46  bool operator==( const AlphaMask& rAlphaMask ) const { return Bitmap::operator==(rAlphaMask); }
47  bool operator!=( const AlphaMask& rAlphaMask ) const { return Bitmap::operator!=(rAlphaMask); }
48 
49  Bitmap const & GetBitmap() const;
50 
51  void Erase( sal_uInt8 cTransparency );
52  void BlendWith(const Bitmap& rOther);
53 
56 
57  void ReleaseAccess( BitmapReadAccess* pAccess );
58 
60 
61  using Bitmap::IsEmpty;
62 
63 private:
64  friend class BitmapEx;
65  friend class ::OutputDevice;
66  friend bool VCL_DLLPUBLIC ReadDIBBitmapEx(BitmapEx& rTarget, SvStream& rIStm, bool bFileHeader, bool bMSOFormat);
67 
68  SAL_DLLPRIVATE const Bitmap& ImplGetBitmap() const;
69  SAL_DLLPRIVATE void ImplSetBitmap( const Bitmap& rBitmap );
70 
71 };
72 
73 #endif // INCLUDED_VCL_ALPHA_HXX
74 
75 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
bool operator==(const AlphaMask &rAlphaMask) const
Definition: alpha.hxx:46
bool operator==(const Bitmap &rBitmap) const
#define VCL_DLLPUBLIC
Definition: dllapi.h:29
BitmapReadAccess * AcquireReadAccess()
BitmapWriteAccess * AcquireAlphaWriteAccess()
Definition: alpha.hxx:55
This template handles BitmapAccess the RAII way.
AlphaMask & operator=(AlphaMask &&rAlphaMask) noexcept
Definition: alpha.hxx:45
bool ReadDIBBitmapEx(BitmapEx &rTarget, SvStream &rIStm, bool bFileHeader, bool bMSOFormat)
Definition: dibtools.cxx:1709
bool operator!=(const Bitmap &rBitmap) const
Definition: bitmap.hxx:122
Bitmap & operator=(const Bitmap &rBitmap)
BitmapReadAccess * AcquireAlphaReadAccess()
Definition: alpha.hxx:54
bool operator!=(const AlphaMask &rAlphaMask) const
Definition: alpha.hxx:47
vcl::ScopedBitmapAccess< BitmapReadAccess, AlphaMask,&AlphaMask::AcquireAlphaReadAccess > ScopedReadAccess
Definition: alpha.hxx:59
static void ReleaseAccess(BitmapInfoAccess *pAccess)
AlphaMask & operator=(const AlphaMask &rAlphaMask)
Definition: alpha.hxx:44
unsigned char sal_uInt8
BitmapWriteAccess * AcquireWriteAccess()
bool IsEmpty() const
Definition: bitmap.hxx:546
bool Erase(const Color &rFillColor)
Fill the entire bitmap with the given color.
Definition: bitmappaint.cxx:34