krita

kis_pattern.h

00001 /*
00002  *  kis_pattern.h - part of Krayon
00003  *
00004  *  Copyright (c) 2000 Matthias Elter  <elter@kde.org>
00005  *
00006  *  This program is free software; you can redistribute it and/or modify
00007  *  it under the terms of the GNU General Public License as published by
00008  *  the Free Software Foundation; either version 2 of the License, or
00009  *  (at your option) any later version.
00010  *
00011  *  This program is distributed in the hope that it will be useful,
00012  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  *  GNU General Public License for more details.
00015  *
00016  *  You should have received a copy of the GNU General Public License
00017  *  along with this program; if not, write to the Free Software
00018  *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00019  */
00020 
00021 #ifndef __kis_pattern_h__
00022 #define __kis_pattern_h__
00023 
00024 #include <kio/job.h>
00025 
00026 #include "kis_debug_areas.h"
00027 #include "kis_resource.h"
00028 #include "kis_types.h"
00029 
00030 class QPoint;
00031 class QImage;
00032 class KisColorSpace;
00033 class KisPaintDevice;
00034 
00035 class KisPattern : public KisResource {
00036     typedef KisResource super;
00037     Q_OBJECT
00038 
00039 public:
00040     KisPattern(const QString& file);
00041     KisPattern(KisPaintDevice* image, int x, int y, int w, int h);
00042     virtual ~KisPattern();
00043 
00044     virtual bool load();
00045     virtual bool save();
00046     virtual QImage img();
00047 
00052     KisPaintDeviceSP image(KisColorSpace * colorSpace);
00053 
00054     Q_INT32 width() const;
00055     Q_INT32 height() const;
00056 
00057     void setImage(const QImage& img);
00058 
00059     KisPattern* clone() const;
00060 
00061 protected:
00062     void setWidth(Q_INT32 w);
00063     void setHeight(Q_INT32 h);
00064 
00065 private:
00066     bool init();
00067 
00068 private:
00069     QByteArray m_data;
00070     QImage m_img;
00071     QMap<QString, KisPaintDeviceSP> m_colorspaces;
00072     bool m_hasFile;
00073 
00074     Q_INT32 m_width;
00075     Q_INT32 m_height;
00076 };
00077 
00078 #endif
00079 
KDE Home | KDE Accessibility Home | Description of Access Keys