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