krita

kis_iterators_pixel.h

00001 /* This file is part of the KDE project
00002  *  Copyright (c) 2004 Cyrille Berger <cberger@cberger.net>
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_ITERATORS_PIXEL_H_
00020 #define KIS_ITERATORS_PIXEL_H_
00021 
00022 #include "kis_iterator.h"
00023 #include "kis_iteratorpixeltrait.h"
00024 
00032 class KisHLineIteratorPixel : public KisHLineIterator, public KisIteratorPixelTrait <KisHLineIterator>
00033 {
00034 
00035 public:
00036 
00037     KisHLineIteratorPixel( KisPaintDevice *ndevice, KisDataManager *dm, KisDataManager *sel_dm,
00038                            Q_INT32 x , Q_INT32 y , Q_INT32 w, Q_INT32 offsetx, Q_INT32 offsety,
00039                            bool writable);
00040     
00041     KisHLineIteratorPixel(const KisHLineIteratorPixel& rhs) : KisHLineIterator(rhs), KisIteratorPixelTrait<KisHLineIterator>(rhs)
00042         { m_offsetx = rhs.m_offsetx;  m_offsety = rhs.m_offsety; }
00043         
00044     KisHLineIteratorPixel& operator=(const KisHLineIteratorPixel& rhs)
00045         {
00046           KisHLineIterator::operator=(rhs);
00047           KisIteratorPixelTrait<KisHLineIterator>::operator=(rhs);
00048           m_offsetx = rhs.m_offsetx;  m_offsety = rhs.m_offsety;
00049           return *this;
00050         }
00051 
00052     inline KisHLineIteratorPixel & operator ++() { KisHLineIterator::operator++(); advance(1); return *this;}
00053 
00055     KisHLineIteratorPixel & operator+=(int n) { KisHLineIterator::operator+=(n); advance(n); return *this; };
00056 
00057     Q_INT32 x() const { return KisHLineIterator::x() + m_offsetx; }
00058     
00059     Q_INT32 y() const { return KisHLineIterator::y() + m_offsety; }
00060     
00061 protected:
00062 
00063     Q_INT32 m_offsetx, m_offsety;
00064 };
00065 
00066 class KisVLineIteratorPixel : public KisVLineIterator, public KisIteratorPixelTrait <KisVLineIterator>
00067 {
00068 public:
00069     KisVLineIteratorPixel( KisPaintDevice *ndevice, KisDataManager *dm, KisDataManager *sel_dm,
00070                            Q_INT32 xpos , Q_INT32 ypos , Q_INT32 height, Q_INT32 offsetx, Q_INT32 offsety,
00071                            bool writable);
00072                            
00073     KisVLineIteratorPixel(const KisVLineIteratorPixel& rhs) : KisVLineIterator(rhs), KisIteratorPixelTrait<KisVLineIterator>(rhs)
00074         { m_offsetx = rhs.m_offsetx;  m_offsety = rhs.m_offsety; }
00075         
00076     KisVLineIteratorPixel& operator=(const KisVLineIteratorPixel& rhs)
00077         {
00078           KisVLineIterator::operator=(rhs);
00079           KisIteratorPixelTrait<KisVLineIterator>::operator=(rhs);
00080           m_offsetx = rhs.m_offsetx;  m_offsety = rhs.m_offsety;
00081           return *this; }
00082 
00083     inline KisVLineIteratorPixel & operator ++() { KisVLineIterator::operator++(); advance(1); return *this;}
00084 
00085     Q_INT32 x() const { return KisVLineIterator::x() + m_offsetx; }
00086     
00087     Q_INT32 y() const { return KisVLineIterator::y() + m_offsety; }
00088     
00089 protected:
00090 
00091     Q_INT32 m_offsetx, m_offsety;
00092 };
00093 
00094 class KisRectIteratorPixel : public KisRectIterator, public KisIteratorPixelTrait <KisRectIterator>
00095 {
00096 public:
00097     KisRectIteratorPixel( KisPaintDevice *ndevice, KisDataManager *dm, KisDataManager *sel_dm,
00098                           Q_INT32 x, Q_INT32 y, Q_INT32 w, Q_INT32 h, Q_INT32 offsetx, Q_INT32 offsety,
00099                           bool writable);
00100     
00101     KisRectIteratorPixel(const KisRectIteratorPixel& rhs) : KisRectIterator(rhs), KisIteratorPixelTrait<KisRectIterator>(rhs)
00102         { m_offsetx = rhs.m_offsetx;  m_offsety = rhs.m_offsety; }
00103         
00104     KisRectIteratorPixel& operator=(const KisRectIteratorPixel& rhs)
00105         {
00106           KisRectIterator::operator=(rhs);
00107           KisIteratorPixelTrait<KisRectIterator>::operator=(rhs);
00108           m_offsetx = rhs.m_offsetx;  m_offsety = rhs.m_offsety;
00109           return *this; }
00110 
00111     inline KisRectIteratorPixel & operator ++() { KisRectIterator::operator++(); advance(1); return *this;}
00112 
00113     Q_INT32 x() const { return KisRectIterator::x() + m_offsetx; }
00114     
00115     Q_INT32 y() const { return KisRectIterator::y() + m_offsety; }
00116     
00117 protected:
00118 
00119     Q_INT32 m_offsetx, m_offsety;
00120 };
00121 
00122 #endif
KDE Home | KDE Accessibility Home | Description of Access Keys