summaryrefslogtreecommitdiffstats
path: root/src/widgets/doc/snippets/code/src_gui_image_qpixmapfilter.cpp
blob: 386daa2a0ca421ee38fbc96aaf30d6780e3d6a01 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause

//! [0]
QPixmapColorizeFilter *myFilter = new QPixmapColorFilter;
myFilter->setColor(QColor(128, 0, 0));
myFilter->draw(painter, QPoint(0, 0), originalPixmap);
//! [0]

//! [1]
QPixmapConvolutionFilter *myFilter = new QPixmapConvolutionFilter;
qreal kernel[] = {
     0.0,-1.0, 0.0,
    -1.0, 5.0,-1.0,
     0.0,-1.0, 0.0
    };
myFilter->setConvolutionKernel(kernel, 3, 3);
myFilter->draw(painter, QPoint(0, 0), originalPixmap);
//! [1]

//! [2]
QPixmapDropShadowFilter *myFilter = new QPixmapDropShadowFilter;
myFilter->draw(painter, QPoint(0, 0), originalPixmap);
//! [2]