xref: /aoo41x/main/vcl/inc/impbmp.hxx (revision cdf0e10c)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 #ifndef _SV_IMPBMP_HXX
29 #define _SV_IMPBMP_HXX
30 
31 #include <tools/gen.hxx>
32 #include <vcl/sv.h>
33 
34 // ---------------
35 // - ImpBitmap -
36 // ---------------
37 
38 struct BitmapBuffer;
39 class SalBitmap;
40 class BitmapPalette;
41 class SalGraphics;
42 class ImplServerBitmap;
43 class Bitmap;
44 class OutputDevice;
45 class Color;
46 class AlphaMask;
47 
48 class ImpBitmap
49 {
50 private:
51 
52     sal_uLong				mnRefCount;
53 	sal_uLong				mnChecksum;
54     SalBitmap*			mpSalBitmap;
55 	Size				maSourceSize;
56 
57 public:
58 
59 						ImpBitmap();
60 						~ImpBitmap();
61 
62 #if _SOLAR__PRIVATE
63 
64 public:
65 
66 	void				ImplSetSalBitmap( SalBitmap* pSalBitmap );
67     SalBitmap*			ImplGetSalBitmap() const { return mpSalBitmap; }
68 
69 public:
70 
71     sal_Bool				ImplCreate( const Size& rSize, sal_uInt16 nBitCount, const BitmapPalette& rPal );
72     sal_Bool				ImplCreate( const ImpBitmap& rImpBitmap );
73     sal_Bool				ImplCreate( const ImpBitmap& rImpBitmap, SalGraphics* pGraphics );
74     sal_Bool				ImplCreate( const ImpBitmap& rImpBitmap, sal_uInt16 nNewBitCount );
75 
76     void				ImplDestroy();
77 
78     Size				ImplGetSize() const;
79     Size				ImplGetSourceSize() const;
80     void				ImplSetSourceSize( const Size&);
81     sal_uInt16				ImplGetBitCount() const;
82 
83     BitmapBuffer*		ImplAcquireBuffer( sal_Bool bReadOnly );
84     void				ImplReleaseBuffer( BitmapBuffer* pBuffer, sal_Bool bReadOnly );
85 
86 public:
87 
88     sal_uLong				ImplGetRefCount() const { return mnRefCount; }
89     void				ImplIncRefCount() { mnRefCount++; }
90     void				ImplDecRefCount() { mnRefCount--; }
91 
92 	inline void			ImplSetChecksum( sal_uLong nChecksum ) { mnChecksum = nChecksum; }
93 	inline sal_uLong		ImplGetChecksum() const { return mnChecksum; }
94 
95 #endif // PRIVATE
96 };
97 
98 inline Size ImpBitmap::ImplGetSourceSize() const
99 {
100 	return maSourceSize;
101 }
102 
103 inline void ImpBitmap::ImplSetSourceSize( const Size& rSize)
104 {
105 	maSourceSize = rSize;
106 }
107 
108 #endif // _SV_IMPBMP_HXX
109