xref: /trunk/main/vcl/inc/impbmp.hxx (revision 161f4cd1)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef _SV_IMPBMP_HXX
25 #define _SV_IMPBMP_HXX
26 
27 #include <tools/gen.hxx>
28 #include <vcl/sv.h>
29 
30 // ---------------
31 // - ImpBitmap -
32 // ---------------
33 
34 struct BitmapBuffer;
35 class SalBitmap;
36 class BitmapPalette;
37 class SalGraphics;
38 class ImplServerBitmap;
39 class Bitmap;
40 class OutputDevice;
41 class Color;
42 class AlphaMask;
43 
44 class ImpBitmap
45 {
46 private:
47 
48     sal_uLong				mnRefCount;
49 	sal_uLong				mnChecksum;
50     SalBitmap*			mpSalBitmap;
51 	Size				maSourceSize;
52 
53 public:
54 
55 						ImpBitmap();
56 						~ImpBitmap();
57 
58 #if _SOLAR__PRIVATE
59 
60 public:
61 
62 	void				ImplSetSalBitmap( SalBitmap* pSalBitmap );
ImplGetSalBitmap() const63     SalBitmap*			ImplGetSalBitmap() const { return mpSalBitmap; }
64 
65 public:
66 
67     sal_Bool				ImplCreate( const Size& rSize, sal_uInt16 nBitCount, const BitmapPalette& rPal );
68     sal_Bool				ImplCreate( const ImpBitmap& rImpBitmap );
69     sal_Bool				ImplCreate( const ImpBitmap& rImpBitmap, SalGraphics* pGraphics );
70     sal_Bool				ImplCreate( const ImpBitmap& rImpBitmap, sal_uInt16 nNewBitCount );
71 
72     void				ImplDestroy();
73 
74     Size				ImplGetSize() const;
75     Size				ImplGetSourceSize() const;
76     void				ImplSetSourceSize( const Size&);
77     sal_uInt16				ImplGetBitCount() const;
78 
79     BitmapBuffer*		ImplAcquireBuffer( sal_Bool bReadOnly );
80     void				ImplReleaseBuffer( BitmapBuffer* pBuffer, sal_Bool bReadOnly );
81 
82 public:
83 
ImplGetRefCount() const84     sal_uLong				ImplGetRefCount() const { return mnRefCount; }
ImplIncRefCount()85     void				ImplIncRefCount() { mnRefCount++; }
ImplDecRefCount()86     void				ImplDecRefCount() { mnRefCount--; }
87 
ImplSetChecksum(sal_uLong nChecksum)88 	inline void			ImplSetChecksum( sal_uLong nChecksum ) { mnChecksum = nChecksum; }
ImplGetChecksum() const89 	inline sal_uLong		ImplGetChecksum() const { return mnChecksum; }
90 
91 #endif // PRIVATE
92 };
93 
ImplGetSourceSize() const94 inline Size ImpBitmap::ImplGetSourceSize() const
95 {
96 	return maSourceSize;
97 }
98 
ImplSetSourceSize(const Size & rSize)99 inline void ImpBitmap::ImplSetSourceSize( const Size& rSize)
100 {
101 	maSourceSize = rSize;
102 }
103 
104 #endif // _SV_IMPBMP_HXX
105