QGIS API Documentation
4.3.0-Master (52aa6503bed)
Toggle main menu visibility
Loading...
Searching...
No Matches
src
core
layout
qgslayouteffect.cpp
Go to the documentation of this file.
1
/***************************************************************************
2
qgslayouteffect.cpp
3
-------------------
4
begin : October 2017
5
copyright : (C) 2017 by Nyall Dawson
6
email : nyall.dawson@gmail.com
7
***************************************************************************/
8
9
/***************************************************************************
10
* *
11
* This program is free software; you can redistribute it and/or modify *
12
* it under the terms of the GNU General Public License as published by *
13
* the Free Software Foundation; either version 2 of the License, or *
14
* (at your option) any later version. *
15
* *
16
***************************************************************************/
17
18
#include "
qgslayouteffect.h
"
19
20
#include <QPainter>
21
22
#include "moc_qgslayouteffect.cpp"
23
24
void
QgsLayoutEffect::draw
( QPainter *painter )
25
{
26
QPoint offset;
27
QPixmap pixmap;
28
29
// Set desired composition mode then draw source
30
painter->setCompositionMode( mCompositionMode );
31
32
if
( mCompositionMode == QPainter::CompositionMode_SourceOver )
33
{
34
// Normal (sourceover) blending, do faster drawSource operation
35
drawSource( painter );
36
return
;
37
}
38
39
// Otherwise, draw using pixmap so QPrinter output works as expected
40
if
( sourceIsPixmap() )
41
{
42
// No point in drawing in device coordinates (pixmap will be scaled anyways).
43
pixmap = sourcePixmap( Qt::LogicalCoordinates, &offset );
44
}
45
else
46
{
47
// Draw pixmap in device coordinates to avoid pixmap scaling;
48
pixmap = sourcePixmap( Qt::DeviceCoordinates, &offset );
49
painter->setWorldTransform( QTransform() );
50
}
51
52
painter->drawPixmap( offset, pixmap );
53
}
54
55
void
QgsLayoutEffect::setCompositionMode
( QPainter::CompositionMode
compositionMode
)
56
{
57
mCompositionMode =
compositionMode
;
58
59
// force redraw with new composition mode
60
update();
61
}
QgsLayoutEffect::compositionMode
Q_DECL_DEPRECATED QPainter::CompositionMode compositionMode() const
Returns the composition (blending) mode used for rendering the item.
Definition
qgslayouteffect.h:59
QgsLayoutEffect::draw
void draw(QPainter *painter) override
Definition
qgslayouteffect.cpp:24
QgsLayoutEffect::setCompositionMode
Q_DECL_DEPRECATED void setCompositionMode(QPainter::CompositionMode mode)
Sets the composition (blending) mode used for rendering the item.
Definition
qgslayouteffect.cpp:55
qgslayouteffect.h
Generated on
for QGIS API Documentation by
1.17.0