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