krita

kis_iterator.h

00001 /* This file is part of the KDE project
00002  *   Copyright (c) 2004 Casper Boemann <cbr@boemann.dkt>
00003  *
00004  *  This program is free software; you can redistribute it and/or modify
00005  *  it under the terms of the GNU General Public License as published by
00006  *  the Free Software Foundation; either version 2 of the License, or
00007  *  (at your option) any later version.
00008  *
00009  *  This program is distributed in the hope that it will be useful,
00010  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  *  GNU General Public License for more details.
00013  *
00014  *  You should have received a copy of the GNU General Public License
00015  *  along with this program; if not, write to the Free Software
00016  *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00017 
00018 */
00019 #ifndef KIS_ITERATOR_H_
00020 #define KIS_ITERATOR_H_
00021 
00022 #include <qglobal.h>
00023 #include <ksharedptr.h>
00024 
00025 class KisTiledRectIterator;
00026 typedef KSharedPtr<KisTiledRectIterator> KisTiledRectIteratorSP;
00027 
00028 class KisTiledVLineIterator;
00029 typedef KSharedPtr<KisTiledVLineIterator> KisTiledVLineIteratorSP;
00030 
00031 class KisTiledHLineIterator;
00032 typedef KSharedPtr<KisTiledHLineIterator> KisTiledHLineIteratorSP;
00033 
00034 class KisDataManager;
00035 
00040 class KisRectIterator
00041 {
00042 
00043 
00044 public:
00045     KisRectIterator ( KisDataManager *dm, Q_INT32  x, Q_INT32  y, Q_INT32  w, Q_INT32  h, bool writable);
00046 
00047 public:
00048     virtual ~KisRectIterator();
00049     KisRectIterator(const KisRectIterator& rhs);
00050     KisRectIterator& operator=(const KisRectIterator& rhs);
00051 
00052 
00053 public:
00055     Q_UINT8 * rawData() const;
00056 
00058     const Q_UINT8 * oldRawData() const;
00059 
00062     Q_INT32 nConseqPixels() const;
00063 
00065     KisRectIterator & operator+=(int n);
00066 
00068     KisRectIterator & operator++();
00069 
00071     bool isDone()  const;
00072 
00073      // current x position
00074      Q_INT32 x() const;
00075 
00076      // current y position
00077      Q_INT32 y() const;
00078 
00079 private:
00080 
00081     KisTiledRectIteratorSP m_iter;
00082 };
00083 
00084 class KisHLineIterator
00085 {
00086 
00087 public:
00088 
00089     KisHLineIterator ( KisDataManager *dm, Q_INT32  x, Q_INT32 y, Q_INT32 w, bool writable);
00090 
00091 public:
00092 
00093     virtual ~KisHLineIterator();
00094     KisHLineIterator(const KisHLineIterator& rhs);
00095     KisHLineIterator& operator=(const KisHLineIterator& rhs);
00096 
00097 public:
00099     Q_UINT8 *rawData() const;
00100 
00102     const Q_UINT8 *oldRawData() const;
00103 
00105     KisHLineIterator & operator++();
00106 
00109     Q_INT32 nConseqHPixels() const;
00110 
00112     KisHLineIterator & operator+=(int n);
00113 
00115     KisHLineIterator & operator--();
00116 
00118     bool isDone()  const;
00119 
00121     Q_INT32 x() const;
00122 
00124     Q_INT32 y() const;
00125 
00127     void nextRow();
00128 
00129 
00130 private:
00131 
00132     KisTiledHLineIteratorSP m_iter;
00133 };
00134 
00135 class KisVLineIterator
00136 {
00137 
00138 public:
00139     KisVLineIterator ( KisDataManager *dm, Q_INT32  x, Q_INT32 y, Q_INT32  h, bool writable);
00140 public:
00141     ~KisVLineIterator();
00142     KisVLineIterator(const KisVLineIterator& rhs);
00143     KisVLineIterator& operator=(const KisVLineIterator& rhs);
00144 
00145 public:
00147     Q_UINT8 *rawData() const;
00148 
00150     const Q_UINT8 * oldRawData() const;
00151 
00153     KisVLineIterator & operator++();
00154 
00156     bool isDone() const;
00157 
00159     Q_INT32 x() const;
00160 
00162     Q_INT32 y() const;
00163     
00165     void nextCol();
00166 
00167 private:
00168 
00169     KisTiledVLineIteratorSP m_iter;
00170 
00171 };
00172 
00173 #endif
KDE Home | KDE Accessibility Home | Description of Access Keys