~ubuntu-branches/ubuntu/precise/koffice/precise

« back to all changes in this revision

Viewing changes to krita/plugins/paintops/chalk/kis_chalk_paintop.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Jonathan Riddell
  • Date: 2010-09-21 15:36:35 UTC
  • mfrom: (1.4.1 upstream) (60.2.11 maverick)
  • Revision ID: james.westby@ubuntu.com-20100921153635-6tejqkiro2u21ydi
Tags: 1:2.2.2-0ubuntu3
Add kubuntu_03_fix-crash-on-closing-sqlite-connection-2.2.2.diff and
kubuntu_04_support-large-memo-values-for-msaccess-2.2.2.diff as
recommended by upstream http://kexi-
project.org/wiki/wikiview/index.php@Kexi2.2_Patches.html#sqlite_stab
ility

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
 
 *  Copyright (c) 2008 Lukáš Tvrdý <lukast.dev@gmail.com>
 
2
 *  Copyright (c) 2008,2009 Lukáš Tvrdý <lukast.dev@gmail.com>
3
3
 *
4
4
 *  This program is free software; you can redistribute it and/or modify
5
5
 *  it under the terms of the GNU General Public License as published by
20
20
#include "kis_chalk_paintop_settings.h"
21
21
 
22
22
#include <cmath>
23
 
#include <math.h>
24
 
 
25
23
#include <QRect>
26
 
#include <QColor>
27
 
//#include <QMutexLocker>
28
24
 
29
25
#include <KoColor.h>
30
26
#include <KoColorSpace.h>
32
28
#include <kis_image.h>
33
29
#include <kis_debug.h>
34
30
 
35
 
#include <kis_brush.h>
36
31
#include <kis_global.h>
37
32
#include <kis_paint_device.h>
38
33
#include <kis_painter.h>
39
34
#include <kis_types.h>
40
35
#include <kis_paintop.h>
41
 
#include <kis_selection.h>
42
 
#include <kis_random_accessor.h>
 
36
#include <kis_paint_information.h>
43
37
 
 
38
#include <kis_pressure_opacity_option.h>
44
39
 
45
40
KisChalkPaintOp::KisChalkPaintOp(const KisChalkPaintOpSettings *settings, KisPainter * painter, KisImageWSP image)
46
41
        : KisPaintOp(painter)
47
42
        , m_settings(settings)
48
43
        , m_image(image)
49
44
{
50
 
    m_chalkBrush.setRadius(settings->radius());
 
45
    m_chalkBrush = new ChalkBrush(settings);
 
46
 
 
47
    m_opacityOption.readOptionSetting(settings);
 
48
    m_opacityOption.sensor()->reset();
51
49
}
52
50
 
53
51
KisChalkPaintOp::~KisChalkPaintOp()
54
52
{
 
53
    delete m_chalkBrush;
55
54
}
56
55
 
57
 
void KisChalkPaintOp::paintAt(const KisPaintInformation& info)
 
56
qreal KisChalkPaintOp::paintAt(const KisPaintInformation& info)
58
57
{
59
 
    if (!painter()) return;
 
58
    if (!painter()) return 1;
60
59
 
61
60
    if (!m_dab) {
62
61
        m_dab = new KisPaintDevice(painter()->device()->colorSpace());
69
68
    x1 = info.pos().x();
70
69
    y1 = info.pos().y();
71
70
 
72
 
    m_chalkBrush.paint(m_dab, x1, y1, painter()->paintColor());
 
71
    quint8 origOpacity = m_opacityOption.apply(painter(), info);
 
72
    m_chalkBrush->paint(m_dab, x1, y1, painter()->paintColor());
73
73
 
74
74
    QRect rc = m_dab->extent();
75
75
 
76
76
    painter()->bitBlt(rc.x(), rc.y(), m_dab, rc.x(), rc.y(), rc.width(), rc.height());
77
 
 
 
77
    painter()->setOpacity(origOpacity);
 
78
    return 1;
78
79
}