chalk

kis_pattern.h
1/*
2 * kis_pattern.h - part of Krayon
3 *
4 * Copyright (c) 2000 Matthias Elter <elter@kde.org>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19 */
20
21#ifndef __kis_pattern_h__
22#define __kis_pattern_h__
23
24#include <tdeio/job.h>
25
26#include "kis_debug_areas.h"
27#include "kis_resource.h"
28#include "kis_types.h"
29
30class TQPoint;
31class TQImage;
32class KisColorSpace;
33class KisPaintDevice;
34
35class KisPattern : public KisResource {
36 typedef KisResource super;
37 TQ_OBJECT
38
39
40public:
41 KisPattern(const TQString& file);
42 KisPattern(KisPaintDevice* image, int x, int y, int w, int h);
43 virtual ~KisPattern();
44
45 virtual bool load();
46 virtual bool save();
47 virtual TQImage img();
48
53 KisPaintDeviceSP image(KisColorSpace * colorSpace);
54
55 TQ_INT32 width() const;
56 TQ_INT32 height() const;
57
58 void setImage(const TQImage& img);
59
60 KisPattern* clone() const;
61
62protected:
63 void setWidth(TQ_INT32 w);
64 void setHeight(TQ_INT32 h);
65
66private:
67 bool init();
68
69private:
70 TQByteArray m_data;
71 TQImage m_img;
72 TQMap<TQString, KisPaintDeviceSP> m_colorspaces;
73 bool m_hasFile;
74
75 TQ_INT32 m_width;
76 TQ_INT32 m_height;
77};
78
79#endif
80
A colorspace is the definition of a certain color model in Chalk.
A paint device contains the actual pixel data and offers methods to read and write pixels.
The KisResource class provides a representation of Chalk image resources.
virtual TQImage img()=0
Returns a TQImage representing this resource.
KisResource(const TQString &filename)
Creates a new KisResource object using filename.
virtual bool save()=0
Save this resource asynchronously.
virtual bool load()=0
Load this resource.