LibreOffice Module vcl (master) 1
unx/salbmp.h
Go to the documentation of this file.
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_INC_UNX_SALBMP_H
21#define INCLUDED_VCL_INC_UNX_SALBMP_H
22
23#include <X11/Xlib.h>
24
25#include <vcl/salgtype.hxx>
26#include <unx/saldisp.hxx>
27#include <salbmp.hxx>
28#include <vclpluginapi.h>
29
30struct BitmapBuffer;
31class BitmapPalette;
32class SalGraphics;
33class ImplSalDDB;
35
36
37class X11SalBitmap final : public SalBitmap
38{
39private:
40
41 static std::unique_ptr<BitmapBuffer>
43 const Size& rSize,
44 vcl::PixelFormat ePixelFormat,
45 const BitmapPalette& rPal
46 );
47
48 static std::unique_ptr<BitmapBuffer>
50 Drawable aDrawable,
51 SalX11Screen nXScreen,
52 tools::Long nDrawableDepth,
53 tools::Long nX,
54 tools::Long nY,
55 tools::Long nWidth,
56 tools::Long nHeight,
57 bool bGrey
58 );
59
60public:
61
63 static unsigned int mnCacheInstCount;
64
65 static void ImplCreateCache();
66 static void ImplDestroyCache();
68
69private:
70
71 std::unique_ptr<BitmapBuffer> mpDIB;
72 mutable std::unique_ptr<ImplSalDDB> mpDDB;
73 bool mbGrey;
74
75public:
76
78 Drawable aDrawable,
79 SalX11Screen nXScreen,
80 tools::Long nDrawableDepth,
81 tools::Long nX,
82 tools::Long nY,
83 tools::Long nWidth,
84 tools::Long nHeight
85 );
86
88 SalDisplay const * pSalDisp,
89 SalX11Screen nXScreen,
90 tools::Long nDepth,
91 const SalTwoRect& rTwoRect
92 ) const;
93
95 Drawable,
96 SalX11Screen nXScreen,
97 tools::Long nDrawableDepth,
98 const SalTwoRect&
99 ) const;
100
102 Drawable aDrawable,
103 SalX11Screen nXScreen,
104 tools::Long nDrawableDepth,
105 const SalTwoRect& rTwoRect,
106 const GC& rGC
107 ) const;
108
109public:
110
112 virtual ~X11SalBitmap() override;
113
114 // override pure virtual methods
115 virtual bool Create(
116 const Size& rSize,
117 vcl::PixelFormat ePixelFormat,
118 const BitmapPalette& rPal
119 ) override;
120
121 virtual bool Create( const SalBitmap& rSalBmp ) override;
122 virtual bool Create(
123 const SalBitmap& rSalBmp,
124 SalGraphics* pGraphics
125 ) override;
126
127 virtual bool Create(
128 const SalBitmap& rSalBmp,
129 vcl::PixelFormat ePixelFormat
130 ) override;
131
132 virtual bool Create(
133 const css::uno::Reference< css::rendering::XBitmapCanvas >& rBitmapCanvas,
134 Size& rSize,
135 bool bMask = false
136 ) override;
137
138 virtual void Destroy() override;
139
140 virtual Size GetSize() const override;
141 virtual sal_uInt16 GetBitCount() const override;
142
143 virtual BitmapBuffer* AcquireBuffer( BitmapAccessMode nMode ) override;
144 virtual void ReleaseBuffer( BitmapBuffer* pBuffer, BitmapAccessMode nMode ) override;
145 virtual bool GetSystemData( BitmapSystemData& rData ) override;
146
147 virtual bool ScalingSupported() const override;
148 virtual bool Scale( const double& rScaleX, const double& rScaleY, BmpScaleFlag nScaleFlag ) override;
149 virtual bool Replace( const Color& rSearchColor, const Color& rReplaceColor, sal_uInt8 nTol ) override;
150};
151
152
154{
155private:
156
157 Pixmap maPixmap;
161
162 static void ImplDraw(
163 Drawable aSrcDrawable,
164 tools::Long nSrcDrawableDepth,
165 Drawable aDstDrawable,
166 tools::Long nSrcX,
167 tools::Long nSrcY,
168 tools::Long nDestWidth,
169 tools::Long nDestHeight,
170 tools::Long nDestX,
171 tools::Long nDestY,
172 const GC& rGC
173 );
174
175public:
176
178 XImage* pImage,
179 Drawable aDrawable,
180 SalX11Screen nXScreen,
181 const SalTwoRect& rTwoRect
182 );
183
185 Drawable aDrawable,
186 SalX11Screen nXScreen,
187 tools::Long nDrawableDepth,
188 tools::Long nX,
189 tools::Long nY,
190 tools::Long nWidth,
191 tools::Long nHeight
192 );
193
195
196 Pixmap ImplGetPixmap() const { return maPixmap; }
199 tools::Long ImplGetDepth() const { return mnDepth; }
200 const SalX11Screen& ImplGetScreen() const { return mnXScreen; }
201
202 bool ImplMatches( SalX11Screen nXScreen, tools::Long nDepth, const SalTwoRect& rTwoRect ) const;
203
205 Drawable aDrawable,
206 const SalTwoRect& rTwoRect,
207 const GC& rGC
208 ) const;
209};
210
211
212class X11SalBitmap;
213
215{
216private:
217 std::vector<X11SalBitmap*> maBmpList;
218
219public:
220
223
224 void ImplAdd( X11SalBitmap* pBmp );
225 void ImplRemove( X11SalBitmap const * pBmp );
226 void ImplClear();
227};
228
229#endif // INCLUDED_VCL_INC_UNX_SALBMP_H
230
231/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
BitmapAccessMode
std::vector< X11SalBitmap * > maBmpList
Definition: unx/salbmp.h:217
void ImplAdd(X11SalBitmap *pBmp)
void ImplRemove(X11SalBitmap const *pBmp)
tools::Long ImplGetHeight() const
Definition: unx/salbmp.h:198
bool ImplMatches(SalX11Screen nXScreen, tools::Long nDepth, const SalTwoRect &rTwoRect) const
ImplSalDDB(Drawable aDrawable, SalX11Screen nXScreen, tools::Long nDrawableDepth, tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight)
tools::Long mnDepth
Definition: unx/salbmp.h:159
Pixmap ImplGetPixmap() const
Definition: unx/salbmp.h:196
static void ImplDraw(Drawable aSrcDrawable, tools::Long nSrcDrawableDepth, Drawable aDstDrawable, tools::Long nSrcX, tools::Long nSrcY, tools::Long nDestWidth, tools::Long nDestHeight, tools::Long nDestX, tools::Long nDestY, const GC &rGC)
Pixmap maPixmap
Definition: unx/salbmp.h:157
SalTwoRect maTwoRect
Definition: unx/salbmp.h:158
SalX11Screen mnXScreen
Definition: unx/salbmp.h:160
tools::Long ImplGetDepth() const
Definition: unx/salbmp.h:199
tools::Long ImplGetWidth() const
Definition: unx/salbmp.h:197
void ImplDraw(Drawable aDrawable, const SalTwoRect &rTwoRect, const GC &rGC) const
ImplSalDDB(XImage *pImage, Drawable aDrawable, SalX11Screen nXScreen, const SalTwoRect &rTwoRect)
const SalX11Screen & ImplGetScreen() const
Definition: unx/salbmp.h:200
virtual bool ScalingSupported() const override
virtual bool Create(const SalBitmap &rSalBmp, vcl::PixelFormat ePixelFormat) override
virtual bool Create(const Size &rSize, vcl::PixelFormat ePixelFormat, const BitmapPalette &rPal) override
void ImplRemovedFromCache()
void ImplDraw(Drawable aDrawable, SalX11Screen nXScreen, tools::Long nDrawableDepth, const SalTwoRect &rTwoRect, const GC &rGC) const
static void ImplCreateCache()
static std::unique_ptr< BitmapBuffer > ImplCreateDIB(Drawable aDrawable, SalX11Screen nXScreen, tools::Long nDrawableDepth, tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight, bool bGrey)
virtual ~X11SalBitmap() override
virtual sal_uInt16 GetBitCount() const override
virtual bool Replace(const Color &rSearchColor, const Color &rReplaceColor, sal_uInt8 nTol) override
virtual void Destroy() override
std::unique_ptr< ImplSalDDB > mpDDB
Definition: unx/salbmp.h:72
XImage * ImplCreateXImage(SalDisplay const *pSalDisp, SalX11Screen nXScreen, tools::Long nDepth, const SalTwoRect &rTwoRect) const
static void ImplDestroyCache()
static ImplSalBitmapCache * mpCache
Definition: unx/salbmp.h:62
virtual Size GetSize() const override
virtual bool Create(const SalBitmap &rSalBmp, SalGraphics *pGraphics) override
virtual bool Create(const css::uno::Reference< css::rendering::XBitmapCanvas > &rBitmapCanvas, Size &rSize, bool bMask=false) override
virtual bool Scale(const double &rScaleX, const double &rScaleY, BmpScaleFlag nScaleFlag) override
ImplSalDDB * ImplGetDDB(Drawable, SalX11Screen nXScreen, tools::Long nDrawableDepth, const SalTwoRect &) const
virtual bool Create(const SalBitmap &rSalBmp) override
virtual bool GetSystemData(BitmapSystemData &rData) override
virtual void ReleaseBuffer(BitmapBuffer *pBuffer, BitmapAccessMode nMode) override
bool ImplCreateFromDrawable(Drawable aDrawable, SalX11Screen nXScreen, tools::Long nDrawableDepth, tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight)
virtual BitmapBuffer * AcquireBuffer(BitmapAccessMode nMode) override
static std::unique_ptr< BitmapBuffer > ImplCreateDIB(const Size &rSize, vcl::PixelFormat ePixelFormat, const BitmapPalette &rPal)
std::unique_ptr< BitmapBuffer > mpDIB
Definition: unx/salbmp.h:71
static unsigned int mnCacheInstCount
Definition: unx/salbmp.h:63
long Long
PixelFormat
Pixel format of the bitmap in bits per pixel.
Definition: BitmapTypes.hxx:20
tools::Long mnDestWidth
Definition: salgtype.hxx:46
tools::Long mnDestHeight
Definition: salgtype.hxx:47
unsigned char sal_uInt8