Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 :
20 : #ifndef INCLUDED_VCL_UNX_GENERIC_DTRANS_BMP_HXX
21 : #define INCLUDED_VCL_UNX_GENERIC_DTRANS_BMP_HXX
22 :
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>
29 :
30 : #include <com/sun/star/uno/Sequence.hxx>
31 : #include <sal/types.h>
32 :
33 : namespace x11 {
34 :
35 : // helper methods
36 : sal_uInt8* X11_getBmpFromPixmap( Display* pDisplay,
37 : Drawable aDrawable,
38 : Colormap aColormap,
39 : sal_Int32& rOutSize );
40 :
41 : void X11_freeBmp( sal_uInt8* pBmp );
42 :
43 : class PixmapHolder
44 : {
45 : Display* m_pDisplay;
46 : Colormap m_aColormap;
47 : Pixmap m_aPixmap;
48 : Pixmap m_aBitmap;
49 : XVisualInfo m_aInfo;
50 :
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;
55 :
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 );
60 :
61 : unsigned long getTCPixel( sal_uInt8 r, sal_uInt8 g, sal_uInt8 b ) const;
62 : public:
63 : PixmapHolder( Display* pDisplay );
64 : ~PixmapHolder();
65 :
66 : // accepts bitmap file (including bitmap file header)
67 : Pixmap setBitmapData( const sal_uInt8* pData );
68 : bool needsConversion( const sal_uInt8* pData );
69 :
70 0 : Colormap getColormap() const { return m_aColormap; }
71 0 : Pixmap getPixmap() const { return m_aPixmap; }
72 0 : Pixmap getBitmap() const { return m_aBitmap; }
73 0 : VisualID getVisualID() const { return m_aInfo.visualid; }
74 : int getClass() const { return m_aInfo.c_class; }
75 0 : int getDepth() const { return m_aInfo.depth; }
76 : };
77 :
78 : css::uno::Sequence<sal_Int8> convertBitmapDepth(
79 : css::uno::Sequence<sal_Int8> const & data, int depth);
80 :
81 : }
82 :
83 : #endif
84 :
85 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|