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