Line data Source code
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 <vcl/dllapi.h>
24 : #include <vcl/bitmap.hxx>
25 :
26 :
27 : // - AlphaMask -
28 :
29 :
30 : class ImageList;
31 : class BitmapEx;
32 :
33 : class VCL_DLLPUBLIC AlphaMask : private Bitmap
34 : {
35 : private:
36 : friend class BitmapEx;
37 : friend class OutputDevice;
38 : friend bool VCL_DLLPUBLIC ReadDIBBitmapEx(BitmapEx& rTarget, SvStream& rIStm);
39 :
40 : SAL_DLLPRIVATE const Bitmap& ImplGetBitmap() const;
41 : SAL_DLLPRIVATE void ImplSetBitmap( const Bitmap& rBitmap );
42 :
43 : public:
44 :
45 : AlphaMask();
46 : AlphaMask( const Bitmap& rBitmap );
47 : AlphaMask( const AlphaMask& rAlphaMask );
48 : AlphaMask( const Size& rSizePixel, sal_uInt8* pEraseTransparency = NULL );
49 : virtual ~AlphaMask();
50 :
51 : AlphaMask& operator=( const Bitmap& rBitmap );
52 0 : AlphaMask& operator=( const AlphaMask& rAlphaMask )
53 : {
54 0 : return (AlphaMask&) Bitmap::operator=( rAlphaMask );
55 : }
56 :
57 0 : bool operator!() const
58 : {
59 0 : return Bitmap::operator!();
60 : }
61 :
62 : bool operator==( const AlphaMask& rAlphaMask ) const
63 : {
64 : return Bitmap::operator==( rAlphaMask );
65 : }
66 :
67 0 : bool operator!=( const AlphaMask& rAlphaMask ) const
68 : {
69 0 : return Bitmap::operator!=( rAlphaMask );
70 : }
71 :
72 : const MapMode& GetPrefMapMode() const
73 : {
74 : return Bitmap::GetPrefMapMode();
75 : }
76 :
77 0 : void SetPrefMapMode( const MapMode& rMapMode )
78 : {
79 0 : Bitmap::SetPrefMapMode( rMapMode );
80 0 : }
81 :
82 : const Size& GetPrefSize() const
83 : {
84 : return Bitmap::GetPrefSize();
85 : }
86 :
87 0 : void SetPrefSize( const Size& rSize )
88 : {
89 0 : Bitmap::SetPrefSize( rSize );
90 0 : }
91 :
92 0 : Size GetSizePixel() const
93 : {
94 0 : return Bitmap::GetSizePixel();
95 : }
96 :
97 : sal_uLong GetSizeBytes() const
98 : {
99 : return Bitmap::GetSizeBytes();
100 : }
101 0 : sal_uLong GetChecksum() const
102 : {
103 0 : return Bitmap::GetChecksum();
104 : }
105 :
106 : Bitmap GetBitmap() const;
107 :
108 : bool CopyPixel( const Rectangle& rRectDst, const Rectangle& rRectSrc,
109 : const AlphaMask* pAlphaSrc = NULL);
110 :
111 : bool Erase( sal_uInt8 cTransparency );
112 : bool Replace( const Bitmap& rMask, sal_uInt8 rReplaceTransparency );
113 : bool Replace( sal_uInt8 cSearchTransparency, sal_uInt8 cReplaceTransparency,
114 : sal_uLong nTol = 0UL );
115 :
116 0 : BitmapReadAccess* AcquireReadAccess()
117 : {
118 0 : return Bitmap::AcquireReadAccess();
119 : }
120 :
121 0 : BitmapWriteAccess* AcquireWriteAccess()
122 : {
123 0 : return Bitmap::AcquireWriteAccess();
124 : }
125 :
126 : void ReleaseAccess( BitmapReadAccess* pAccess );
127 :
128 : typedef vcl::ScopedBitmapAccess< BitmapReadAccess, AlphaMask, &AlphaMask::AcquireReadAccess >
129 : ScopedReadAccess;
130 : typedef vcl::ScopedBitmapAccess< BitmapWriteAccess, AlphaMask, &AlphaMask::AcquireWriteAccess >
131 : ScopedWriteAccess;
132 : };
133 :
134 : #endif // INCLUDED_VCL_ALPHA_HXX
135 :
136 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|