Qt 6.x
The Qt SDK
Loading...
Searching...
No Matches
qwindowsdirect2dhelpers.h
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
4#ifndef QWINDOWSDIRECT2DHELPERS_H
5#define QWINDOWSDIRECT2DHELPERS_H
6
7#include <QtCore/qrect.h>
8#include <QtCore/qsize.h>
9#include <QtCore/qpoint.h>
10#include <QtGui/qcolor.h>
11#include <QtGui/qtransform.h>
12
13#ifdef Q_CC_MINGW
14# include <qt_windows.h>
15# include <d2d1.h>
16# include <d2d1helper.h>
17# include <d2dbasetypes.h>
18# include <d2d1_1.h>
19#endif // Q_CC_MINGW
20#include <d2d1_1helper.h>
21
23
24inline D2D1_RECT_U to_d2d_rect_u(const QRect &qrect)
25{
26 return D2D1::RectU(qrect.x(), qrect.y(), qrect.x() + qrect.width(), qrect.y() + qrect.height());
27}
28
29inline D2D1_RECT_F to_d2d_rect_f(const QRectF &qrect)
30{
31 return D2D1::RectF(qrect.x(), qrect.y(), qrect.x() + qrect.width(), qrect.y() + qrect.height());
32}
33
34inline D2D1_SIZE_U to_d2d_size_u(const QSizeF &qsize)
35{
36
37 return D2D1::SizeU(UINT32(qRound(qsize.width())),
38 UINT32(qRound(qsize.height())));
39}
40
41inline D2D1_SIZE_U to_d2d_size_u(const QSize &qsize)
42{
43 return D2D1::SizeU(UINT32(qsize.width()),
44 UINT32(qsize.height()));
45}
46
47inline D2D1_POINT_2F to_d2d_point_2f(const QPointF &qpoint)
48{
49 return D2D1::Point2F(qpoint.x(), qpoint.y());
50}
51
52inline D2D1::ColorF to_d2d_color_f(const QColor &c)
53{
54 return D2D1::ColorF(c.redF(), c.greenF(), c.blueF(), c.alphaF());
55}
56
57inline D2D1_MATRIX_3X2_F to_d2d_matrix_3x2_f(const QTransform &transform)
58{
59 return D2D1::Matrix3x2F(transform.m11(), transform.m12(),
60 transform.m21(), transform.m22(),
61 transform.m31(), transform.m32());
62}
63
65
66#endif // QWINDOWSDIRECT2DHELPERS_H
The QColor class provides colors based on RGB, HSV or CMYK values.
Definition qcolor.h:31
\inmodule QtCore\reentrant
Definition qpoint.h:214
constexpr qreal x() const noexcept
Returns the x coordinate of this point.
Definition qpoint.h:333
constexpr qreal y() const noexcept
Returns the y coordinate of this point.
Definition qpoint.h:338
\inmodule QtCore\reentrant
Definition qrect.h:483
constexpr qreal y() const noexcept
Returns the y-coordinate of the rectangle's top edge.
Definition qrect.h:658
constexpr qreal height() const noexcept
Returns the height of the rectangle.
Definition qrect.h:718
constexpr qreal width() const noexcept
Returns the width of the rectangle.
Definition qrect.h:715
constexpr qreal x() const noexcept
Returns the x-coordinate of the rectangle's left edge.
Definition qrect.h:655
\inmodule QtCore\reentrant
Definition qrect.h:30
constexpr int height() const noexcept
Returns the height of the rectangle.
Definition qrect.h:238
constexpr int x() const noexcept
Returns the x-coordinate of the rectangle's left edge.
Definition qrect.h:184
constexpr int width() const noexcept
Returns the width of the rectangle.
Definition qrect.h:235
constexpr int y() const noexcept
Returns the y-coordinate of the rectangle's top edge.
Definition qrect.h:187
\inmodule QtCore
Definition qsize.h:207
constexpr qreal width() const noexcept
Returns the width.
Definition qsize.h:321
constexpr qreal height() const noexcept
Returns the height.
Definition qsize.h:324
\inmodule QtCore
Definition qsize.h:25
constexpr int height() const noexcept
Returns the height.
Definition qsize.h:132
constexpr int width() const noexcept
Returns the width.
Definition qsize.h:129
The QTransform class specifies 2D transformations of a coordinate system.
Definition qtransform.h:20
Combined button and popup list for selecting options.
int qRound(qfloat16 d) noexcept
Definition qfloat16.h:281
GLuint GLenum GLenum transform
const GLubyte * c
D2D1::ColorF to_d2d_color_f(const QColor &c)
D2D1_POINT_2F to_d2d_point_2f(const QPointF &qpoint)
D2D1_MATRIX_3X2_F to_d2d_matrix_3x2_f(const QTransform &transform)
QT_BEGIN_NAMESPACE D2D1_RECT_U to_d2d_rect_u(const QRect &qrect)
D2D1_SIZE_U to_d2d_size_u(const QSizeF &qsize)
D2D1_RECT_F to_d2d_rect_f(const QRectF &qrect)