xref: /aoo42x/main/vcl/inc/win/salbmp.h (revision 79aad27f)
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_SALBMP_H
25 #define _SV_SALBMP_H
26 
27 #include <tools/gen.hxx>
28 #include <win/wincomp.hxx>
29 #include <salbmp.hxx>
30 
31 // --------------
32 // - SalBitmap	-
33 // --------------
34 
35 struct	BitmapBuffer;
36 class	BitmapColor;
37 class	BitmapPalette;
38 class	SalGraphics;
39 
40 class WinSalBitmap : public SalBitmap
41 {
42 private:
43 
44 	Size				maSize;
45 	HGLOBAL 			mhDIB;
46 	HBITMAP 			mhDDB;
47 	sal_uInt16				mnBitCount;
48 
49 public:
50 
51 	HGLOBAL 			ImplGethDIB() const { return mhDIB; }
52 	HBITMAP 			ImplGethDDB() const { return mhDDB; }
53 
54 	static HGLOBAL		ImplCreateDIB( const Size& rSize, sal_uInt16 nBitCount, const BitmapPalette& rPal );
55 	static HANDLE		ImplCopyDIBOrDDB( HANDLE hHdl, bool bDIB );
56 	static sal_uInt16		ImplGetDIBColorCount( HGLOBAL hDIB );
57 	static void 		ImplDecodeRLEBuffer( const BYTE* pSrcBuf, BYTE* pDstBuf,
58 											 const Size& rSizePixel, bool bRLE4 );
59 
60 public:
61 
62 						WinSalBitmap();
63 	virtual				~WinSalBitmap();
64 
65 public:
66 
67 	bool                        Create( HANDLE hBitmap, bool bDIB, bool bCopyHandle );
68 	virtual bool                Create( const Size& rSize, sal_uInt16 nBitCount, const BitmapPalette& rPal );
69 	virtual bool                Create( const SalBitmap& rSalBmpImpl );
70 	virtual bool                Create( const SalBitmap& rSalBmpImpl, SalGraphics* pGraphics );
71 	virtual bool                Create( const SalBitmap& rSalBmpImpl, sal_uInt16 nNewBitCount );
72 
73 	virtual void                Destroy();
74 
75 	virtual Size                GetSize() const { return maSize; }
76 	virtual sal_uInt16              GetBitCount() const { return mnBitCount; }
77 
78 	virtual BitmapBuffer*		AcquireBuffer( bool bReadOnly );
79 	virtual void                ReleaseBuffer( BitmapBuffer* pBuffer, bool bReadOnly );
80     virtual bool                GetSystemData( BitmapSystemData& rData );
81 };
82 
83 #endif // _SV_SALBMP_HXX
84