Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #ifndef _SV_ALPHA_HXX
30 : : #define _SV_ALPHA_HXX
31 : :
32 : : #include <vcl/dllapi.h>
33 : : #include <vcl/bitmap.hxx>
34 : :
35 : : // -------------
36 : : // - AlphaMask -
37 : : // -------------
38 : :
39 : : class ImageList;
40 : : class BitmapEx;
41 : :
42 : : class VCL_DLLPUBLIC AlphaMask : private Bitmap
43 : : {
44 : : friend class BitmapEx;
45 : : friend class OutputDevice;
46 : : friend VCL_DLLPUBLIC SvStream& operator<<( SvStream&, const ImageList& );
47 : :
48 : : private:
49 : :
50 : : SAL_DLLPRIVATE const Bitmap& ImplGetBitmap() const;
51 : : SAL_DLLPRIVATE void ImplSetBitmap( const Bitmap& rBitmap );
52 : :
53 : : public:
54 : :
55 : : AlphaMask();
56 : : AlphaMask( const Bitmap& rBitmap );
57 : : AlphaMask( const AlphaMask& rAlphaMask );
58 : : AlphaMask( const Size& rSizePixel, sal_uInt8* pEraseTransparency = NULL );
59 : : ~AlphaMask();
60 : :
61 : : AlphaMask& operator=( const Bitmap& rBitmap );
62 : 392 : AlphaMask& operator=( const AlphaMask& rAlphaMask )
63 : : {
64 : 392 : return (AlphaMask&) Bitmap::operator=( rAlphaMask );
65 : : }
66 : :
67 : 88898 : sal_Bool operator!() const
68 : : {
69 : 88898 : return Bitmap::operator!();
70 : : }
71 : :
72 : : sal_Bool operator==( const AlphaMask& rAlphaMask ) const
73 : : {
74 : : return Bitmap::operator==( rAlphaMask );
75 : : }
76 : :
77 : 1101 : sal_Bool operator!=( const AlphaMask& rAlphaMask ) const
78 : : {
79 : 1101 : return Bitmap::operator!=( rAlphaMask );
80 : : }
81 : :
82 : : const MapMode& GetPrefMapMode() const
83 : : {
84 : : return Bitmap::GetPrefMapMode();
85 : : }
86 : :
87 : : void SetPrefMapMode( const MapMode& rMapMode )
88 : : {
89 : : Bitmap::SetPrefMapMode( rMapMode );
90 : : }
91 : :
92 : : const Size& GetPrefSize() const
93 : : {
94 : : return Bitmap::GetPrefSize();
95 : : }
96 : :
97 : : void SetPrefSize( const Size& rSize )
98 : : {
99 : : Bitmap::SetPrefSize( rSize );
100 : : }
101 : :
102 : 1549 : Size GetSizePixel() const
103 : : {
104 : 1549 : return Bitmap::GetSizePixel();
105 : : }
106 : :
107 : : sal_uLong GetSizeBytes() const
108 : : {
109 : : return Bitmap::GetSizeBytes();
110 : : }
111 : 0 : sal_uLong GetChecksum() const
112 : : {
113 : 0 : return Bitmap::GetChecksum();
114 : : }
115 : :
116 : : Bitmap GetBitmap() const;
117 : :
118 : : sal_Bool CopyPixel( const Rectangle& rRectDst, const Rectangle& rRectSrc,
119 : : const AlphaMask* pAlphaSrc = NULL);
120 : :
121 : : sal_Bool Erase( sal_uInt8 cTransparency );
122 : : sal_Bool Replace( const Bitmap& rMask, sal_uInt8 rReplaceTransparency );
123 : : sal_Bool Replace( sal_uInt8 cSearchTransparency, sal_uInt8 cReplaceTransparency,
124 : : sal_uLong nTol = 0UL );
125 : :
126 : 188328 : BitmapReadAccess* AcquireReadAccess()
127 : : {
128 : 188328 : return Bitmap::AcquireReadAccess();
129 : : }
130 : :
131 : 22537 : BitmapWriteAccess* AcquireWriteAccess()
132 : : {
133 : 22537 : return Bitmap::AcquireWriteAccess();
134 : : }
135 : :
136 : : void ReleaseAccess( BitmapReadAccess* pAccess );
137 : :
138 : : typedef vcl::ScopedBitmapAccess< BitmapReadAccess, AlphaMask, &AlphaMask::AcquireReadAccess >
139 : : ScopedReadAccess;
140 : : typedef vcl::ScopedBitmapAccess< BitmapWriteAccess, AlphaMask, &AlphaMask::AcquireWriteAccess >
141 : : ScopedWriteAccess;
142 : :
143 : : sal_Bool Read( SvStream& rIStm, sal_Bool bFileHeader = sal_True )
144 : : {
145 : : return Bitmap::Read( rIStm, bFileHeader );
146 : : }
147 : : sal_Bool Write( SvStream& rOStm, sal_Bool bCompressed = sal_True, sal_Bool bFileHeader = sal_True ) const
148 : : {
149 : : return Bitmap::Write( rOStm, bCompressed, bFileHeader );
150 : : }
151 : :
152 : : friend VCL_DLLPUBLIC SvStream& operator<<( SvStream& rOStm, const BitmapEx& rBitmapEx );
153 : : friend VCL_DLLPUBLIC SvStream& operator>>( SvStream& rIStm, BitmapEx& rBitmapEx );
154 : : };
155 : :
156 : : #endif // _SV_ALPHA_HXX
157 : :
158 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|