Update ooo320-m1
[ooovba.git] / vcl / unx / source / dtrans / bmp.hxx
blob0dc79dddad176589c99207ff8e97ccaab375044a
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: bmp.hxx,v $
10 * $Revision: 1.4 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef _DTRANS_BMP_HXX_
32 #define _DTRANS_BMP_HXX_
34 #include <X11/Xatom.h>
35 #include <X11/keysym.h>
36 #include <X11/Xlib.h>
37 #include <X11/Xutil.h>
39 #include <sal/types.h>
40 #include <com/sun/star/awt/XBitmap.hpp>
41 #include <cppuhelper/compbase1.hxx>
45 namespace x11 {
47 // helper methods
48 sal_uInt8* X11_getBmpFromPixmap( Display* pDisplay,
49 Drawable aDrawable,
50 Colormap aColormap,
51 sal_Int32& rOutSize );
53 void X11_freeBmp( sal_uInt8* pBmp );
55 class PixmapHolder
57 Display* m_pDisplay;
58 Colormap m_aColormap;
59 Pixmap m_aPixmap;
60 Pixmap m_aBitmap;
61 XVisualInfo m_aInfo;
63 int m_nRedShift, m_nRedShift2;
64 int m_nGreenShift, m_nGreenShift2;
65 int m_nBlueShift, m_nBlueShift2;
66 unsigned long m_nBlueShift2Mask, m_nRedShift2Mask, m_nGreenShift2Mask;
68 // these expect data pointers to bitmapinfo header
69 void setBitmapDataTC( const sal_uInt8* pData, XImage* pImage );
70 void setBitmapDataTCDither( const sal_uInt8* pData, XImage* pImage );
71 void setBitmapDataPalette( const sal_uInt8* pData, XImage* pImage );
73 unsigned long getTCPixel( sal_uInt8 r, sal_uInt8 g, sal_uInt8 b ) const;
74 public:
75 PixmapHolder( Display* pDisplay );
76 ~PixmapHolder();
78 // accepts bitmap file (including bitmap file header)
79 Pixmap setBitmapData( const sal_uInt8* pData );
80 bool needsConversion( const sal_uInt8* pData );
82 Colormap getColormap() const { return m_aColormap; }
83 Pixmap getPixmap() const { return m_aPixmap; }
84 Pixmap getBitmap() const { return m_aBitmap; }
85 VisualID getVisualID() const { return m_aInfo.visualid; }
86 int getClass() const { return m_aInfo.c_class; }
87 int getDepth() const { return m_aInfo.depth; }
90 class BmpTransporter :
91 public cppu::WeakImplHelper1< com::sun::star::awt::XBitmap >
93 com::sun::star::uno::Sequence<sal_Int8> m_aBM;
94 com::sun::star::awt::Size m_aSize;
95 public:
96 BmpTransporter( const com::sun::star::uno::Sequence<sal_Int8>& rBmp );
97 virtual ~BmpTransporter();
99 virtual com::sun::star::awt::Size SAL_CALL getSize() throw();
100 virtual com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getDIB() throw();
101 virtual com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getMaskDIB() throw();
106 #endif