Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qpixmap_x11_p.h
Go to the documentation of this file.
1// Copyright (C) 2018 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QX11PLATFORMPIXMAP_H
5#define QX11PLATFORMPIXMAP_H
6
7#include <QBitmap>
8#include <QPixmap>
9
10#include <qpa/qplatformpixmap.h>
11#include "qxcbnativepainting.h"
12
13typedef unsigned long XID;
14typedef XID Drawable;
15typedef XID Picture;
16typedef XID Pixmap;
17
19
20class QX11PaintEngine;
21struct QXImageWrapper;
22
24{
25public:
28
30 void resize(int width, int height) override;
31 void fromImage(const QImage &img, Qt::ImageConversionFlags flags) override;
32 void copy(const QPlatformPixmap *data, const QRect &rect) override;
33 bool scroll(int dx, int dy, const QRect &rect) override;
35 void fill(const QColor &fillColor) override;
36 QBitmap mask() const override;
37 void setMask(const QBitmap &mask) override;
38 bool hasAlphaChannel() const override;
40 QImage toImage() const override;
41 QImage toImage(const QRect &rect) const override;
42 QPaintEngine *paintEngine() const override;
43 qreal devicePixelRatio() const override;
44 void setDevicePixelRatio(qreal scaleFactor) override;
45
46 inline Drawable handle() const { return hd; }
47 inline Picture x11PictureHandle() const { return picture; }
48 inline const QXcbX11Info *x11_info() const { return &xinfo; }
49
52
53#if QT_CONFIG(xrender)
54 void convertToARGB32(bool preserveContents = true);
55#endif
56
57 bool isBackingStore() const;
58 void setIsBackingStore(bool on);
59private:
60 friend class QX11PaintEngine;
61 friend const QXcbX11Info &qt_x11Info(const QPixmap &pixmap);
62 friend void qt_x11SetScreen(QPixmap &pixmap, int screen);
63
64 void release();
65 QImage toImage(const QXImageWrapper &xi, const QRect &rect) const;
66 QBitmap mask_to_bitmap(int screen) const;
67 static Pixmap bitmap_to_mask(const QBitmap &, int screen);
68 void bitmapFromImage(const QImage &image);
69 bool canTakeQImageFromXImage(const QXImageWrapper &xi) const;
70 QImage takeQImageFromXImage(const QXImageWrapper &xi) const;
71
72 Pixmap hd = 0;
73
74 enum Flag {
75 NoFlags = 0x0,
76 Uninitialized = 0x1,
77 Readonly = 0x2,
78 InvertedWhenBoundToTexture = 0x4,
79 GlSurfaceCreatedWithAlpha = 0x8,
80 IsBackingStore = 0x10
81 };
82 uint flags;
83
84 QXcbX11Info xinfo;
85 Pixmap x11_mask;
87 Picture mask_picture;
88 Pixmap hd2; // sorted in the default display depth
89 //QPixmap::ShareMode share_mode;
90 qreal dpr;
91
92 QX11PaintEngine *pengine;
93};
94
96{
97 return (pixmap.handle() && pixmap.handle()->classId() == QPlatformPixmap::X11Class)
98 ? static_cast<QX11PlatformPixmap *>(pixmap.handle())
99 : nullptr;
100}
101
103{
105 return pm->x11PictureHandle();
106
107 return 0;
108}
109
111{
113 return pm->handle();
114
115 return 0;
116}
117
119{
121 return pm->xinfo;
122 } else {
123 static QXcbX11Info nullX11Info;
124 return nullX11Info;
125 }
126}
127
130
132
133#endif // QX11PLATFORMPIXMAP_H
\inmodule QtGui
Definition qbitmap.h:16
The QColor class provides colors based on RGB, HSV or CMYK values.
Definition qcolor.h:31
\inmodule QtGui
Definition qimage.h:37
\inmodule QtGui
Returns a copy of the pixmap that is transformed using the given transformation transform and transfo...
Definition qpixmap.h:27
The QPlatformPixmap class provides an abstraction for native pixmaps.
friend class QX11PlatformPixmap
PixelType pixelType() const
\inmodule QtCore\reentrant
Definition qrect.h:30
The QTransform class specifies 2D transformations of a coordinate system.
Definition qtransform.h:20
qreal devicePixelRatio() const override
bool isBackingStore() const
friend void qt_x11SetScreen(QPixmap &pixmap, int screen)
void copy(const QPlatformPixmap *data, const QRect &rect) override
QBitmap mask() const override
QPlatformPixmap * createCompatiblePlatformPixmap() const override
Drawable handle() const
void setIsBackingStore(bool on)
static XID createBitmapFromImage(const QImage &image)
Pixmap x11ConvertToDefaultDepth()
void fromImage(const QImage &img, Qt::ImageConversionFlags flags) override
QImage toImage() const override
QPaintEngine * paintEngine() const override
const QXcbX11Info * x11_info() const
void fill(const QColor &fillColor) override
Picture x11PictureHandle() const
void resize(int width, int height) override
void setMask(const QBitmap &mask) override
friend const QXcbX11Info & qt_x11Info(const QPixmap &pixmap)
void setDevicePixelRatio(qreal scaleFactor) override
bool hasAlphaChannel() const override
bool scroll(int dx, int dy, const QRect &rect) override
int metric(QPaintDevice::PaintDeviceMetric metric) const override
QPixmap transformed(const QTransform &matrix, Qt::TransformationMode mode) const override
rect
[4]
Combined button and popup list for selecting options.
TransformationMode
Definition image.cpp:4
constexpr int Uninitialized
GLenum mode
GLint GLsizei GLsizei height
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLint GLsizei width
GLbitfield flags
GLint GLint GLint GLint GLint GLint GLint GLbitfield mask
GLint void * img
Definition qopenglext.h:233
GLuint GLenum matrix
unsigned long XID
XID Picture
XID Pixmap
Pixmap qt_x11PixmapHandle(const QPixmap &pixmap)
void qt_x11SetScreen(QPixmap &pixmap, int screen)
Picture qt_x11PictureHandle(const QPixmap &pixmap)
unsigned long XID
QX11PlatformPixmap * qt_x11Pixmap(const QPixmap &pixmap)
XID Drawable
const QXcbX11Info & qt_x11Info(const QPixmap &pixmap)
int qt_x11SetDefaultScreen(int screen)
static QT_BEGIN_NAMESPACE qreal dpr(const QWindow *w)
QScreen * screen
[1]
Definition main.cpp:29
unsigned int uint
Definition qtypes.h:34
double qreal
Definition qtypes.h:187
sem release()
widget render & pixmap