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
30class BitmapEx;
31
32class VCL_DLLPUBLIC AlphaMask final : public Bitmap
33{
34public:
35
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 AlphaMask& rOther);
53
54 // check if alpha is used, returns true if at least one pixel has transparence
55 bool hasAlpha() const;
56
59
60 void ReleaseAccess( BitmapReadAccess* pAccess );
61
63
64 using Bitmap::IsEmpty;
65
66private:
67 friend class BitmapEx;
68 friend class ::OutputDevice;
69 friend bool VCL_DLLPUBLIC ReadDIBBitmapEx(BitmapEx& rTarget, SvStream& rIStm, bool bFileHeader, bool bMSOFormat);
70
71 SAL_DLLPRIVATE const Bitmap& ImplGetBitmap() const;
72
73};
74
75#endif // INCLUDED_VCL_ALPHA_HXX
76
77/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
BitmapReadAccess * AcquireAlphaReadAccess()
Definition: alpha.hxx:57
AlphaMask & operator=(AlphaMask &&rAlphaMask) noexcept
Definition: alpha.hxx:45
AlphaMask(const AlphaMask &rAlphaMask)
AlphaMask(AlphaMask &&rAlphaMask)
AlphaMask & operator=(const AlphaMask &rAlphaMask)
Definition: alpha.hxx:44
bool operator!=(const AlphaMask &rAlphaMask) const
Definition: alpha.hxx:47
bool operator==(const AlphaMask &rAlphaMask) const
Definition: alpha.hxx:46
virtual ~AlphaMask() override
BitmapWriteAccess * AcquireAlphaWriteAccess()
Definition: alpha.hxx:58
vcl::ScopedBitmapAccess< BitmapReadAccess, AlphaMask, &AlphaMask::AcquireAlphaReadAccess > ScopedReadAccess
Definition: alpha.hxx:62
Bitmap & operator=(const Bitmap &rBitmap)
BitmapWriteAccess * AcquireWriteAccess()
static void ReleaseAccess(BitmapInfoAccess *pAccess)
bool IsEmpty() const
BitmapReadAccess * AcquireReadAccess()
bool operator==(const Bitmap &rBitmap) const
bool operator!=(const Bitmap &rBitmap) const
bool Erase(const Color &rFillColor)
Fill the entire bitmap with the given color.
Definition: bitmappaint.cxx:34
This template handles BitmapAccess the RAII way.
bool ReadDIBBitmapEx(BitmapEx &rTarget, SvStream &rIStm, bool bFileHeader, bool bMSOFormat)
Definition: dibtools.cxx:1623
#define VCL_DLLPUBLIC
Definition: dllapi.h:29
unsigned char sal_uInt8