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 { 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); }
49 
50  void SetPrefMapMode( const MapMode& rMapMode ) { Bitmap::SetPrefMapMode( rMapMode ); }
51 
52  void SetPrefSize( const Size& rSize ) { Bitmap::SetPrefSize( rSize ); }
53 
54  Bitmap const & GetBitmap() const;
55 
56  void Erase( sal_uInt8 cTransparency );
57  void Replace( const Bitmap& rMask, sal_uInt8 rReplaceTransparency );
58  void Replace( sal_uInt8 cSearchTransparency, sal_uInt8 cReplaceTransparency );
59 
62 
63  void ReleaseAccess( BitmapReadAccess* pAccess );
64 
66 
67  using Bitmap::IsEmpty;
68 
69 private:
70  friend class BitmapEx;
71  friend class ::OutputDevice;
72  friend bool VCL_DLLPUBLIC ReadDIBBitmapEx(BitmapEx& rTarget, SvStream& rIStm, bool bFileHeader, bool bMSOFormat);
73 
74  SAL_DLLPRIVATE const Bitmap& ImplGetBitmap() const;
75  SAL_DLLPRIVATE void ImplSetBitmap( const Bitmap& rBitmap );
76 
77 };
78 
79 #endif // INCLUDED_VCL_ALPHA_HXX
80 
81 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
bool operator==(const AlphaMask &rAlphaMask) const
Definition: alpha.hxx:47
bool operator==(const Bitmap &rBitmap) const
#define VCL_DLLPUBLIC
Definition: dllapi.h:29
BitmapReadAccess * AcquireReadAccess()
BitmapWriteAccess * AcquireAlphaWriteAccess()
Definition: alpha.hxx:61
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:1740
bool operator!=(const Bitmap &rBitmap) const
Definition: bitmap.hxx:119
Bitmap & operator=(const Bitmap &rBitmap)
bool operator!() const
Definition: alpha.hxx:46
void SetPrefMapMode(const MapMode &rMapMode)
Definition: bitmap.hxx:561
BitmapReadAccess * AcquireAlphaReadAccess()
Definition: alpha.hxx:60
bool operator!() const
Definition: bitmap.hxx:546
bool operator!=(const AlphaMask &rAlphaMask) const
Definition: alpha.hxx:48
void SetPrefSize(const Size &rSize)
Definition: bitmap.hxx:571
vcl::ScopedBitmapAccess< BitmapReadAccess, AlphaMask,&AlphaMask::AcquireAlphaReadAccess > ScopedReadAccess
Definition: alpha.hxx:65
static void ReleaseAccess(BitmapInfoAccess *pAccess)
AlphaMask & operator=(const AlphaMask &rAlphaMask)
Definition: alpha.hxx:44
void SetPrefMapMode(const MapMode &rMapMode)
Definition: alpha.hxx:50
unsigned char sal_uInt8
void SetPrefSize(const Size &rSize)
Definition: alpha.hxx:52
BitmapWriteAccess * AcquireWriteAccess()
bool IsEmpty() const
Definition: bitmap.hxx:551
bool Erase(const Color &rFillColor)
Fill the entire bitmap with the given color.
Definition: bitmappaint.cxx:34
bool Replace(const Bitmap &rMask, const Color &rReplaceColor)
Replace all pixel where the given mask is on with the specified color.