xref: /aoo41x/main/vcl/inc/os2/salbmp.h (revision fc9fd3f1)
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_SALBMP_H
29 #define _SV_SALBMP_H
30 
31 #include <tools/gen.hxx>
32 #include <salbmp.hxx>
33 
34 // --------------
35 // - SalBitmap    -
36 // --------------
37 
38 struct    BitmapBuffer;
39 class    BitmapColor;
40 class    BitmapPalette;
41 class    SalGraphics;
42 
43 #define HANDLE ULONG
44 #define HBITMAP ULONG
45 
46 class Os2SalBitmap : public SalBitmap
47 {
48 private:
49 
50     Size                maSize;
51     HANDLE				mhDIB;
52     HANDLE				mhDIB1Subst;
53     HBITMAP             mhDDB;
54     USHORT              mnBitCount;
55 
56 public:
57 
58     HANDLE              ImplGethDIB() const { return mhDIB; }
59     HBITMAP             ImplGethDDB() const { return mhDDB; }
60     HANDLE				ImplGethDIB1Subst() const { return mhDIB1Subst; }
61 
62     void				ImplReplacehDIB1Subst( HANDLE hDIB1Subst );
63 
64     static HANDLE       ImplCreateDIB( const Size& rSize, USHORT nBitCount, const BitmapPalette& rPal );
65 	static HANDLE		ImplCreateDIB4FromDIB1( HANDLE hDIB1 );
66     static HANDLE       ImplCopyDIBOrDDB( HANDLE hHdl, bool bDIB );
67     static USHORT       ImplGetDIBColorCount( HANDLE hDIB );
68     static void         ImplDecodeRLEBuffer( const PM_BYTE* pSrcBuf, PM_BYTE* pDstBuf,
69                                              const Size& rSizePixel, bool bRLE4 );
70 
71     //BOOL                Create( HANDLE hBitmap, BOOL bDIB, BOOL bCopyHandle );
72 
73 public:
74 
75                         Os2SalBitmap();
76                         ~Os2SalBitmap();
77 
78 public:
79 
80     //BOOL                Create( const Size& rSize, USHORT nBitCount, const BitmapPalette& rPal );
81     //BOOL                Create( const SalBitmap& rSalBmpImpl );
82     //BOOL                Create( const SalBitmap& rSalBmpImpl, SalGraphics* pGraphics );
83     //BOOL                Create( const SalBitmap& rSalBmpImpl, USHORT nNewBitCount );
84 
85     //void                Destroy();
86 
87     //Size                GetSize() const { return maSize; }
88     //USHORT              GetBitCount() const { return mnBitCount; }
89 
90 	//BitmapBuffer*		AcquireBuffer( bool bReadOnly );
91 	//void				ReleaseBuffer( BitmapBuffer* pBuffer, bool bReadOnly );
92 	bool                        Create( HANDLE hBitmap, bool bDIB, bool bCopyHandle );
93 	virtual bool                Create( const Size& rSize, USHORT nBitCount, const BitmapPalette& rPal );
94 	virtual bool                Create( const SalBitmap& rSalBmpImpl );
95 	virtual bool                Create( const SalBitmap& rSalBmpImpl, SalGraphics* pGraphics );
96 	virtual bool                Create( const SalBitmap& rSalBmpImpl, USHORT nNewBitCount );
97 
98 	virtual void                Destroy();
99 
100 	virtual Size                GetSize() const { return maSize; }
101 	virtual USHORT              GetBitCount() const { return mnBitCount; }
102 
103 	virtual BitmapBuffer*		AcquireBuffer( bool bReadOnly );
104 	virtual void                ReleaseBuffer( BitmapBuffer* pBuffer, bool bReadOnly );
105     virtual bool                GetSystemData( BitmapSystemData& rData );
106 };
107 
108 #endif // _SV_SALBMP_H
109