Version 4.3.0.0.beta1, tag libreoffice-4.3.0.0.beta1
[LibreOffice.git] / vcl / unx / generic / dtrans / bmp.hxx
blob6a0c801b0eac143b652d69ece06c80c76c0b3dcd
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef INCLUDED_VCL_UNX_GENERIC_DTRANS_BMP_HXX
21 #define INCLUDED_VCL_UNX_GENERIC_DTRANS_BMP_HXX
23 #include <prex.h>
24 #include <X11/Xatom.h>
25 #include <X11/keysym.h>
26 #include <X11/Xlib.h>
27 #include <X11/Xutil.h>
28 #include <postx.h>
30 #include <com/sun/star/uno/Sequence.hxx>
31 #include <sal/types.h>
33 namespace x11 {
35 // helper methods
36 sal_uInt8* X11_getBmpFromPixmap( Display* pDisplay,
37 Drawable aDrawable,
38 Colormap aColormap,
39 sal_Int32& rOutSize );
41 void X11_freeBmp( sal_uInt8* pBmp );
43 class PixmapHolder
45 Display* m_pDisplay;
46 Colormap m_aColormap;
47 Pixmap m_aPixmap;
48 Pixmap m_aBitmap;
49 XVisualInfo m_aInfo;
51 int m_nRedShift, m_nRedShift2;
52 int m_nGreenShift, m_nGreenShift2;
53 int m_nBlueShift, m_nBlueShift2;
54 unsigned long m_nBlueShift2Mask, m_nRedShift2Mask, m_nGreenShift2Mask;
56 // these expect data pointers to bitmapinfo header
57 void setBitmapDataTC( const sal_uInt8* pData, XImage* pImage );
58 void setBitmapDataTCDither( const sal_uInt8* pData, XImage* pImage );
59 void setBitmapDataPalette( const sal_uInt8* pData, XImage* pImage );
61 unsigned long getTCPixel( sal_uInt8 r, sal_uInt8 g, sal_uInt8 b ) const;
62 public:
63 PixmapHolder( Display* pDisplay );
64 ~PixmapHolder();
66 // accepts bitmap file (including bitmap file header)
67 Pixmap setBitmapData( const sal_uInt8* pData );
68 bool needsConversion( const sal_uInt8* pData );
70 Colormap getColormap() const { return m_aColormap; }
71 Pixmap getPixmap() const { return m_aPixmap; }
72 Pixmap getBitmap() const { return m_aBitmap; }
73 VisualID getVisualID() const { return m_aInfo.visualid; }
74 int getClass() const { return m_aInfo.c_class; }
75 int getDepth() const { return m_aInfo.depth; }
78 css::uno::Sequence<sal_Int8> convertBitmapDepth(
79 css::uno::Sequence<sal_Int8> const & data, int depth);
83 #endif
85 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */