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 _SV_ALPHA_HXX
21 : #define _SV_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 : friend class BitmapEx;
36 : friend class OutputDevice;
37 : friend VCL_DLLPUBLIC SvStream& operator<<( SvStream&, const ImageList& );
38 :
39 : private:
40 :
41 : SAL_DLLPRIVATE const Bitmap& ImplGetBitmap() const;
42 : SAL_DLLPRIVATE void ImplSetBitmap( const Bitmap& rBitmap );
43 :
44 : public:
45 :
46 : AlphaMask();
47 : AlphaMask( const Bitmap& rBitmap );
48 : AlphaMask( const AlphaMask& rAlphaMask );
49 : AlphaMask( const Size& rSizePixel, sal_uInt8* pEraseTransparency = NULL );
50 : ~AlphaMask();
51 :
52 : AlphaMask& operator=( const Bitmap& rBitmap );
53 49 : AlphaMask& operator=( const AlphaMask& rAlphaMask )
54 : {
55 49 : return (AlphaMask&) Bitmap::operator=( rAlphaMask );
56 : }
57 :
58 120 : sal_Bool operator!() const
59 : {
60 120 : return Bitmap::operator!();
61 : }
62 :
63 : sal_Bool operator==( const AlphaMask& rAlphaMask ) const
64 : {
65 : return Bitmap::operator==( rAlphaMask );
66 : }
67 :
68 0 : sal_Bool operator!=( const AlphaMask& rAlphaMask ) const
69 : {
70 0 : return Bitmap::operator!=( rAlphaMask );
71 : }
72 :
73 : const MapMode& GetPrefMapMode() const
74 : {
75 : return Bitmap::GetPrefMapMode();
76 : }
77 :
78 : void SetPrefMapMode( const MapMode& rMapMode )
79 : {
80 : Bitmap::SetPrefMapMode( rMapMode );
81 : }
82 :
83 : const Size& GetPrefSize() const
84 : {
85 : return Bitmap::GetPrefSize();
86 : }
87 :
88 : void SetPrefSize( const Size& rSize )
89 : {
90 : Bitmap::SetPrefSize( rSize );
91 : }
92 :
93 56 : Size GetSizePixel() const
94 : {
95 56 : return Bitmap::GetSizePixel();
96 : }
97 :
98 : sal_uLong GetSizeBytes() const
99 : {
100 : return Bitmap::GetSizeBytes();
101 : }
102 0 : sal_uLong GetChecksum() const
103 : {
104 0 : return Bitmap::GetChecksum();
105 : }
106 :
107 : Bitmap GetBitmap() const;
108 :
109 : sal_Bool CopyPixel( const Rectangle& rRectDst, const Rectangle& rRectSrc,
110 : const AlphaMask* pAlphaSrc = NULL);
111 :
112 : sal_Bool Erase( sal_uInt8 cTransparency );
113 : sal_Bool Replace( const Bitmap& rMask, sal_uInt8 rReplaceTransparency );
114 : sal_Bool Replace( sal_uInt8 cSearchTransparency, sal_uInt8 cReplaceTransparency,
115 : sal_uLong nTol = 0UL );
116 :
117 2 : BitmapReadAccess* AcquireReadAccess()
118 : {
119 2 : return Bitmap::AcquireReadAccess();
120 : }
121 :
122 4 : BitmapWriteAccess* AcquireWriteAccess()
123 : {
124 4 : return Bitmap::AcquireWriteAccess();
125 : }
126 :
127 : void ReleaseAccess( BitmapReadAccess* pAccess );
128 :
129 : typedef vcl::ScopedBitmapAccess< BitmapReadAccess, AlphaMask, &AlphaMask::AcquireReadAccess >
130 : ScopedReadAccess;
131 : typedef vcl::ScopedBitmapAccess< BitmapWriteAccess, AlphaMask, &AlphaMask::AcquireWriteAccess >
132 : ScopedWriteAccess;
133 :
134 : sal_Bool Read( SvStream& rIStm, sal_Bool bFileHeader = sal_True )
135 : {
136 : return Bitmap::Read( rIStm, bFileHeader );
137 : }
138 : sal_Bool Write( SvStream& rOStm, sal_Bool bCompressed = sal_True, sal_Bool bFileHeader = sal_True ) const
139 : {
140 : return Bitmap::Write( rOStm, bCompressed, bFileHeader );
141 : }
142 :
143 : friend VCL_DLLPUBLIC SvStream& operator<<( SvStream& rOStm, const BitmapEx& rBitmapEx );
144 : friend VCL_DLLPUBLIC SvStream& operator>>( SvStream& rIStm, BitmapEx& rBitmapEx );
145 : };
146 :
147 : #endif // _SV_ALPHA_HXX
148 :
149 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|