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
src_gui_effects_qgraphicseffect.cpp
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
3
5MyGraphicsOpacityEffect::draw(QPainter *painter)
6{
7 // Fully opaque; draw directly without going through a pixmap.
8 if (qFuzzyCompare(m_opacity, 1)) {
9 drawSource(painter);
10 return;
11 }
12 ...
13}
15
17MyGraphicsEffect::draw(QPainter *painter)
18{
19 ...
21 if (sourceIsPixmap()) {
22 // No point in drawing in device coordinates (pixmap will be scaled anyways).
23 const QPixmap pixmap = sourcePixmap(Qt::LogicalCoordinates, &offset);
24 ...
26 } else {
27 // Draw pixmap in device coordinates to avoid pixmap scaling;
28 const QPixmap pixmap = sourcePixmap(Qt::DeviceCoordinates, &offset);
30 ...
32 }
33 ...
34}
36
38...
39QLinearGradient alphaGradient(rect.topLeft(), rect.bottomLeft());
45...
void setColorAt(qreal pos, const QColor &color)
Creates a stop point at the given position with the given color.
Definition qbrush.cpp:1563
The QGraphicsOpacityEffect class provides an opacity effect.
void setOpacityMask(const QBrush &mask)
The QPainter class performs low-level painting on widgets and other paint devices.
Definition qpainter.h:46
void setWorldTransform(const QTransform &matrix, bool combine=false)
Sets the world transformation matrix.
void drawPixmap(const QRectF &targetRect, const QPixmap &pixmap, const QRectF &sourceRect)
Draws the rectangular portion source of the given pixmap into the given target in the paint device.
Returns a copy of the pixmap that is transformed using the given transformation transform and transfo...
Definition qpixmap.h:27
\inmodule QtCore\reentrant
Definition qpoint.h:25
The QTransform class specifies 2D transformations of a coordinate system.
Definition qtransform.h:20
rect
[4]
@ transparent
Definition qnamespace.h:47
@ black
Definition qnamespace.h:30
@ DeviceCoordinates
@ LogicalCoordinates
bool qFuzzyCompare(qfloat16 p1, qfloat16 p2) noexcept
Definition qfloat16.h:333
GLenum GLuint GLintptr offset
QLinearGradient alphaGradient(rect.topLeft(), rect.bottomLeft())
[1]
QGraphicsOpacityEffect * effect
the effect attached to this item
widget render & pixmap
QPainter painter(this)
[7]