chalk

kis_paintop.h
1/*
2 * Copyright (c) 2002 Patrick Julien <freak@codepimps.org>
3 * Copyright (c) 2004 Boudewijn Rempt <boud@valdyas.org>
4 * Copyright (c) 2004 Clarence Dang <dang@kde.org>
5 * Copyright (c) 2004 Adrian Page <adrian@pagenet.plus.com>
6 * Copyright (c) 2004 Cyrille Berger <cberger@cberger.net>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21 */
22
23#ifndef KIS_PAINTOP_H_
24#define KIS_PAINTOP_H_
25
26#include <tqstring.h>
27
28#include <ksharedptr.h>
29#include <tdelocale.h>
30
31#include "kis_global.h"
32#include "kis_types.h"
33#include "kis_id.h"
34#include "kis_vec.h"
35#include "kis_colorspace.h"
36
37#include <koffice_export.h>
38
39class KisPoint;
40class KisAlphaMask;
41class KisPainter;
42class KisColorSpace;
43class KisInputDevice;
44class TQWidget;
45
50class KRITACORE_EXPORT KisPaintInformation {
51public:
52 KisPaintInformation(double pressure = PRESSURE_DEFAULT,
53 double xTilt = 0.0, double yTilt = 0.0,
54 KisVector2D movement = KisVector2D())
55 : pressure(pressure), xTilt(xTilt), yTilt(yTilt), movement(movement) {}
56 double pressure;
57 double xTilt;
58 double yTilt;
59 KisVector2D movement;
60};
61
62class KRITACORE_EXPORT KisPaintOp : public TDEShared
63{
64
65public:
66
67 KisPaintOp(KisPainter * painter);
68 virtual ~KisPaintOp();
69
70 virtual void paintAt(const KisPoint &pos, const KisPaintInformation& info) = 0;
71 void setSource(KisPaintDeviceSP p);
72
77 virtual bool incremental() { return false; }
78
79
80protected:
81
82 virtual KisPaintDeviceSP computeDab(KisAlphaMaskSP mask);
83 virtual KisPaintDeviceSP computeDab(KisAlphaMaskSP mask, KisColorSpace *cs);
84
85
89 virtual void splitCoordinate(double coordinate, TQ_INT32 *whole, double *fraction);
90
91 KisPainter * m_painter;
92 KisPaintDeviceSP m_source; // use this layer as source layer for the operation
93private:
94 KisPaintDeviceSP m_dab;
95};
96
97class KisPaintOpSettings {
98
99public:
100 KisPaintOpSettings(TQWidget *parent) { Q_UNUSED(parent); }
101 virtual ~KisPaintOpSettings() {}
102
103 virtual TQWidget *widget() const { return 0; }
104};
105
111class KisPaintOpFactory : public TDEShared
112{
113
114public:
116 virtual ~KisPaintOpFactory() {}
117
118 virtual KisPaintOp * createOp(const KisPaintOpSettings *settings, KisPainter * painter) = 0;
119 virtual KisID id() { return KisID("abstractpaintop", i18n("Abstract PaintOp")); }
120
124 virtual TQString pixmap() { return ""; }
125
131 virtual bool userVisible(KisColorSpace * cs = 0) { return cs->id() != KisID("WET", ""); }
132
138 virtual KisPaintOpSettings* settings(TQWidget* parent, const KisInputDevice& inputDevice);
139
140};
141#endif // KIS_PAINTOP_H_
KisAlphaMask is intended to create alpha values from a TQImage for use in brush creation.
A colorspace is the definition of a certain color model in Chalk.
Chalk has a large number of extensible resources.
Definition kis_id.h:57
This class keeps information that can be used in the painting process, for example by brushes.
Definition kis_paintop.h:50
The paintop factory is responsible for creating paintops of the specified class.
virtual bool userVisible(KisColorSpace *cs=0)
Whether this paintop is internal to a certain tool or can be used in various tools.
virtual KisPaintOpSettings * settings(TQWidget *parent, const KisInputDevice &inputDevice)
Create and return an (abstracted) widget with options for this paintop when used with the specified i...
virtual TQString pixmap()
The filename of the pixmap we can use to represent this paintop in the ui.
KisPainter contains the graphics primitives necessary to draw on a KisPaintDevice.
Definition kis_painter.h:56
A double-based point class that can return it's coordinates approximated to integers.
Definition kis_point.h:28