1*24f6443dSAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*24f6443dSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*24f6443dSAndrew Rist * or more contributor license agreements. See the NOTICE file 5*24f6443dSAndrew Rist * distributed with this work for additional information 6*24f6443dSAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*24f6443dSAndrew Rist * to you under the Apache License, Version 2.0 (the 8*24f6443dSAndrew Rist * "License"); you may not use this file except in compliance 9*24f6443dSAndrew Rist * with the License. You may obtain a copy of the License at 10*24f6443dSAndrew Rist * 11*24f6443dSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*24f6443dSAndrew Rist * 13*24f6443dSAndrew Rist * Unless required by applicable law or agreed to in writing, 14*24f6443dSAndrew Rist * software distributed under the License is distributed on an 15*24f6443dSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*24f6443dSAndrew Rist * KIND, either express or implied. See the License for the 17*24f6443dSAndrew Rist * specific language governing permissions and limitations 18*24f6443dSAndrew Rist * under the License. 19*24f6443dSAndrew Rist * 20*24f6443dSAndrew Rist *************************************************************/ 21*24f6443dSAndrew Rist 22*24f6443dSAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir #ifndef _SV_SALBMP_H 25cdf0e10cSrcweir #define _SV_SALBMP_H 26cdf0e10cSrcweir 27cdf0e10cSrcweir #include <tools/gen.hxx> 28fc9fd3f1SPedro Giffuni #include <salbmp.hxx> 29cdf0e10cSrcweir 30cdf0e10cSrcweir // -------------- 31cdf0e10cSrcweir // - SalBitmap - 32cdf0e10cSrcweir // -------------- 33cdf0e10cSrcweir 34cdf0e10cSrcweir struct BitmapBuffer; 35cdf0e10cSrcweir class BitmapColor; 36cdf0e10cSrcweir class BitmapPalette; 37cdf0e10cSrcweir class SalGraphics; 38cdf0e10cSrcweir 39cdf0e10cSrcweir #define HANDLE ULONG 40cdf0e10cSrcweir #define HBITMAP ULONG 41cdf0e10cSrcweir 42cdf0e10cSrcweir class Os2SalBitmap : public SalBitmap 43cdf0e10cSrcweir { 44cdf0e10cSrcweir private: 45cdf0e10cSrcweir 46cdf0e10cSrcweir Size maSize; 47cdf0e10cSrcweir HANDLE mhDIB; 48cdf0e10cSrcweir HANDLE mhDIB1Subst; 49cdf0e10cSrcweir HBITMAP mhDDB; 50cdf0e10cSrcweir USHORT mnBitCount; 51cdf0e10cSrcweir 52cdf0e10cSrcweir public: 53cdf0e10cSrcweir ImplGethDIB() const54cdf0e10cSrcweir HANDLE ImplGethDIB() const { return mhDIB; } ImplGethDDB() const55cdf0e10cSrcweir HBITMAP ImplGethDDB() const { return mhDDB; } ImplGethDIB1Subst() const56cdf0e10cSrcweir HANDLE ImplGethDIB1Subst() const { return mhDIB1Subst; } 57cdf0e10cSrcweir 58cdf0e10cSrcweir void ImplReplacehDIB1Subst( HANDLE hDIB1Subst ); 59cdf0e10cSrcweir 60cdf0e10cSrcweir static HANDLE ImplCreateDIB( const Size& rSize, USHORT nBitCount, const BitmapPalette& rPal ); 61cdf0e10cSrcweir static HANDLE ImplCreateDIB4FromDIB1( HANDLE hDIB1 ); 62fc9fd3f1SPedro Giffuni static HANDLE ImplCopyDIBOrDDB( HANDLE hHdl, bool bDIB ); 63cdf0e10cSrcweir static USHORT ImplGetDIBColorCount( HANDLE hDIB ); 64fc9fd3f1SPedro Giffuni static void ImplDecodeRLEBuffer( const PM_BYTE* pSrcBuf, PM_BYTE* pDstBuf, 65fc9fd3f1SPedro Giffuni const Size& rSizePixel, bool bRLE4 ); 66cdf0e10cSrcweir 67cdf0e10cSrcweir //BOOL Create( HANDLE hBitmap, BOOL bDIB, BOOL bCopyHandle ); 68cdf0e10cSrcweir 69cdf0e10cSrcweir public: 70cdf0e10cSrcweir 71cdf0e10cSrcweir Os2SalBitmap(); 72cdf0e10cSrcweir ~Os2SalBitmap(); 73cdf0e10cSrcweir 74cdf0e10cSrcweir public: 75cdf0e10cSrcweir 76cdf0e10cSrcweir //BOOL Create( const Size& rSize, USHORT nBitCount, const BitmapPalette& rPal ); 77cdf0e10cSrcweir //BOOL Create( const SalBitmap& rSalBmpImpl ); 78cdf0e10cSrcweir //BOOL Create( const SalBitmap& rSalBmpImpl, SalGraphics* pGraphics ); 79cdf0e10cSrcweir //BOOL Create( const SalBitmap& rSalBmpImpl, USHORT nNewBitCount ); 80cdf0e10cSrcweir 81cdf0e10cSrcweir //void Destroy(); 82cdf0e10cSrcweir 83cdf0e10cSrcweir //Size GetSize() const { return maSize; } 84cdf0e10cSrcweir //USHORT GetBitCount() const { return mnBitCount; } 85cdf0e10cSrcweir 86cdf0e10cSrcweir //BitmapBuffer* AcquireBuffer( bool bReadOnly ); 87cdf0e10cSrcweir //void ReleaseBuffer( BitmapBuffer* pBuffer, bool bReadOnly ); 88cdf0e10cSrcweir bool Create( HANDLE hBitmap, bool bDIB, bool bCopyHandle ); 89cdf0e10cSrcweir virtual bool Create( const Size& rSize, USHORT nBitCount, const BitmapPalette& rPal ); 90cdf0e10cSrcweir virtual bool Create( const SalBitmap& rSalBmpImpl ); 91cdf0e10cSrcweir virtual bool Create( const SalBitmap& rSalBmpImpl, SalGraphics* pGraphics ); 92cdf0e10cSrcweir virtual bool Create( const SalBitmap& rSalBmpImpl, USHORT nNewBitCount ); 93cdf0e10cSrcweir 94cdf0e10cSrcweir virtual void Destroy(); 95cdf0e10cSrcweir GetSize() const96cdf0e10cSrcweir virtual Size GetSize() const { return maSize; } GetBitCount() const97cdf0e10cSrcweir virtual USHORT GetBitCount() const { return mnBitCount; } 98cdf0e10cSrcweir 99cdf0e10cSrcweir virtual BitmapBuffer* AcquireBuffer( bool bReadOnly ); 100cdf0e10cSrcweir virtual void ReleaseBuffer( BitmapBuffer* pBuffer, bool bReadOnly ); 101cdf0e10cSrcweir virtual bool GetSystemData( BitmapSystemData& rData ); 102cdf0e10cSrcweir }; 103cdf0e10cSrcweir 104cdf0e10cSrcweir #endif // _SV_SALBMP_H 105