File indexing completed on 2024-05-12 15:58:22

0001 /* This file is part of the KDE project
0002  *  SPDX-FileCopyrightText: 2010 Cyrille Berger <cberger@cberger.net>
0003  *
0004  *  SPDX-License-Identifier: GPL-2.0-or-later
0005  */
0006 
0007 #ifndef _KIS_ITERATOR_NG_H_
0008 #define _KIS_ITERATOR_NG_H_
0009 
0010 #include "kis_base_accessor.h"
0011 
0012 class KRITAIMAGE_EXPORT KisBaseConstIteratorNG : public KisBaseConstAccessor
0013 {
0014     Q_DISABLE_COPY(KisBaseConstIteratorNG)
0015 public:
0016     KisBaseConstIteratorNG() {}
0017     ~KisBaseConstIteratorNG() override;
0018     /**
0019      * Move to the next pixel
0020      * @return false if there is no more pixel in the line
0021      */
0022     virtual bool nextPixel() = 0;
0023     /**
0024      * Move to the next pixels
0025      */
0026     virtual bool nextPixels(qint32 n) = 0;
0027     /**
0028      * @return return number of consequential numbers of pixels, useful for optimization
0029      */
0030     virtual qint32 nConseqPixels() const = 0;
0031 };
0032 
0033 //class KRITAIMAGE_EXPORT KisBaseIteratorNG : public virtual KisBaseConstIteratorNG, public virtual KisBaseAccessor
0034 //{
0035 //    Q_DISABLE_COPY(KisBaseIteratorNG)
0036 //public:
0037 //    KisBaseIteratorNG() {}
0038 //    virtual ~KisBaseIteratorNG();
0039 //};
0040 
0041 /**
0042  * Iterates over the line of a paint device.
0043  */
0044 class KRITAIMAGE_EXPORT KisHLineConstIteratorNG : public virtual KisBaseConstIteratorNG
0045 {
0046     Q_DISABLE_COPY(KisHLineConstIteratorNG)
0047 public:
0048     KisHLineConstIteratorNG() {}
0049     ~KisHLineConstIteratorNG() override;
0050     /**
0051      * Move to the next row
0052      */
0053     virtual void nextRow() = 0;
0054 
0055     virtual void resetPixelPos() = 0;
0056     virtual void resetRowPos() = 0;
0057 };
0058 
0059 /**
0060  * Also support writing.
0061  */
0062 class KRITAIMAGE_EXPORT KisHLineIteratorNG : public KisHLineConstIteratorNG, public KisBaseAccessor
0063 {
0064     Q_DISABLE_COPY(KisHLineIteratorNG)
0065 public:
0066     KisHLineIteratorNG() {}
0067     ~KisHLineIteratorNG() override;
0068 };
0069 
0070 /**
0071  * Iterates over the column of a paint device.
0072  */
0073 class KRITAIMAGE_EXPORT KisVLineConstIteratorNG : public virtual KisBaseConstIteratorNG
0074 {
0075     Q_DISABLE_COPY(KisVLineConstIteratorNG)
0076 public:
0077     KisVLineConstIteratorNG() {}
0078     ~KisVLineConstIteratorNG() override;
0079     /**
0080      * Move to the next row
0081      */
0082     virtual void nextColumn() = 0;
0083 
0084     virtual void resetPixelPos() = 0;
0085     virtual void resetColumnPos() = 0;
0086 };
0087 
0088 /**
0089  * Also support writing.
0090  */
0091 class KRITAIMAGE_EXPORT KisVLineIteratorNG : public KisVLineConstIteratorNG, public KisBaseAccessor
0092 {
0093     Q_DISABLE_COPY(KisVLineIteratorNG)
0094 public:
0095     KisVLineIteratorNG() {}
0096     ~KisVLineIteratorNG() override;
0097 };
0098 
0099 #include "kis_sequential_iterator.h"
0100 
0101 #endif