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
qwindowsdirect2dplatformpixmap.cpp
Go to the documentation of this file.
1// Copyright (C) 2016 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
9
10#include <QtGui/qpainter.h>
11#include <QtGui/qimage.h>
12#include <QtGui/qpaintdevice.h>
13#include <QtGui/qpaintengine.h>
14
16
43
44static int qt_d2dpixmap_serno = 0;
45
52
66
71
73{
75
76 if (!d->bitmap->resize(width, height)) {
77 qWarning("%s: Could not resize bitmap", __FUNCTION__);
78 return;
79 }
80
81 is_null = false;
82 w = width;
83 h = height;
84 this->d = 32;
85}
86
88 Qt::ImageConversionFlags flags)
89{
91
92 if (!d->bitmap->fromImage(image, flags)) {
93 qWarning("%s: Could not init from image", __FUNCTION__);
94 return;
95 }
96
97 is_null = false;
98 w = image.width();
99 h = image.height();
100 this->d = 32;
101}
102
108
110{
112 d->bitmap->fill(color);
113}
114
116{
117 return true;
118}
119
124
126{
128
129 QWindowsDirect2DPaintEngineSuspender suspender(static_cast<QWindowsDirect2DPaintEngine *>(d->device->paintEngine()));
130 return d->bitmap->toImage(rect);
131}
132
134{
136 return d->device->paintEngine();
137}
138
140{
142 return d->devicePixelRatio;
143}
144
146{
148 d->devicePixelRatio = scaleFactor;
149}
150
156
The QColor class provides colors based on RGB, HSV or CMYK values.
Definition qcolor.h:31
\inmodule QtGui
Definition qimage.h:37
\inmodule QtGui
The QPlatformPixmap class provides an abstraction for native pixmaps.
int height() const
void setSerialNumber(int serNo)
int width() const
\inmodule QtCore\reentrant
Definition qrect.h:30
QWindowsDirect2DPlatformPixmapPrivate(QWindowsDirect2DBitmap *bitmap, QWindowsDirect2DPaintEngine::Flags flags)
QScopedPointer< QWindowsDirect2DPaintDevice > device
void fromImage(const QImage &image, Qt::ImageConversionFlags flags) override
void resize(int width, int height) override
void setDevicePixelRatio(qreal scaleFactor) override
void fill(const QColor &color) override
QPaintEngine * paintEngine() const override
int metric(QPaintDevice::PaintDeviceMetric metric) const override
rect
[4]
Combined button and popup list for selecting options.
Definition image.cpp:4
#define qWarning
Definition qlogging.h:166
GLfloat GLfloat GLfloat w
[0]
GLint GLsizei GLsizei height
GLint GLsizei width
GLuint color
[2]
GLbitfield flags
GLfloat GLfloat GLfloat GLfloat h
GLsizei GLfixed GLfixed GLfixed GLfixed const GLubyte * bitmap
Q_GUI_EXPORT int qt_paint_device_metric(const QPaintDevice *device, QPaintDevice::PaintDeviceMetric metric)
XID Pixmap
double qreal
Definition qtypes.h:187
static int qt_d2dpixmap_serno