|
Krita Source Code Documentation
|
#include <kis_sequential_iterator.h>
Public Member Functions | |
| KisSequentialIteratorBase (SourcePolicy source, const QRect &rect, ProgressPolicy progressPolicy=ProgressPolicy()) | |
| int | nConseqPixels () const |
| bool | nextPixel () |
| bool | nextPixels (int numPixels) |
| ALWAYS_INLINE const quint8 * | oldRawData () const |
| ALWAYS_INLINE quint8 * | rawData () |
| ALWAYS_INLINE const quint8 * | rawDataConst () const |
| ALWAYS_INLINE int | x () const |
| ALWAYS_INLINE int | y () const |
| ~KisSequentialIteratorBase () | |
Private Attributes | |
| int | m_columnOffset |
| int | m_columnsLeft |
| bool | m_isStarted |
| int | m_iteratorX |
| int | m_iteratorY |
| int | m_numConseqPixels |
| const int | m_pixelSize |
| IteratorPolicy | m_policy |
| ProgressPolicy | m_progressPolicy |
| int | m_rowsLeft |
Sequential iterator is supposed to be used when you need to read/write a rect of the image and you don't want to think about row or column nested loops. For the sequential iterator you will need a single loop: the data will be read line-by-line using an internal hline iterator. Please note that thanks to inline optimizations inside the sequential iterator when doing pixel-by-pixel processing it is about twice faster(!) than a usual hline iterator.
The follows the "java-style" iterators rules. Before requesting the first pixel from the iterator you should call nextPixel() to "jump over" this first pixel. After the jump is accomplished, you can easily request the "jumped over" pixel data.
The modified rules apply when the user wants accesses consequent pixels in one go. The user first asks the iterator for the number of available consequent pixels, and then calls nextPixels(numConseqPixels). In this case, iterator inserts a "virtual" pixel that one should jump over before doing any real iteration.
Iteration in pixel-by-pixel manner:
Iteration with strides:
Implementation:
The iterator is implemented using a policy pattern. The class itself is a template which accepts a special class (policy) that defines: 1) which type of the hline iterator will be used; 2) what methods of the internal hline iterator will be called. The choice of the policy declares whether the iterator will be writable or const.
Definition at line 177 of file kis_sequential_iterator.h.
|
inline |
Definition at line 180 of file kis_sequential_iterator.h.
References KisSequentialIteratorBase< IteratorPolicy, SourcePolicy, ProgressPolicy >::m_columnsLeft, KisSequentialIteratorBase< IteratorPolicy, SourcePolicy, ProgressPolicy >::m_iteratorX, KisSequentialIteratorBase< IteratorPolicy, SourcePolicy, ProgressPolicy >::m_iteratorY, KisSequentialIteratorBase< IteratorPolicy, SourcePolicy, ProgressPolicy >::m_numConseqPixels, KisSequentialIteratorBase< IteratorPolicy, SourcePolicy, ProgressPolicy >::m_policy, and KisSequentialIteratorBase< IteratorPolicy, SourcePolicy, ProgressPolicy >::m_progressPolicy.
|
inline |
Definition at line 201 of file kis_sequential_iterator.h.
References KisSequentialIteratorBase< IteratorPolicy, SourcePolicy, ProgressPolicy >::m_progressPolicy.
|
inline |
|
inline |
Definition at line 219 of file kis_sequential_iterator.h.
References KisSequentialIteratorBase< IteratorPolicy, SourcePolicy, ProgressPolicy >::m_columnOffset, KisSequentialIteratorBase< IteratorPolicy, SourcePolicy, ProgressPolicy >::m_columnsLeft, KisSequentialIteratorBase< IteratorPolicy, SourcePolicy, ProgressPolicy >::m_isStarted, KisSequentialIteratorBase< IteratorPolicy, SourcePolicy, ProgressPolicy >::m_iteratorX, KisSequentialIteratorBase< IteratorPolicy, SourcePolicy, ProgressPolicy >::m_iteratorY, KisSequentialIteratorBase< IteratorPolicy, SourcePolicy, ProgressPolicy >::m_numConseqPixels, KisSequentialIteratorBase< IteratorPolicy, SourcePolicy, ProgressPolicy >::m_pixelSize, KisSequentialIteratorBase< IteratorPolicy, SourcePolicy, ProgressPolicy >::m_policy, KisSequentialIteratorBase< IteratorPolicy, SourcePolicy, ProgressPolicy >::m_progressPolicy, and KisSequentialIteratorBase< IteratorPolicy, SourcePolicy, ProgressPolicy >::m_rowsLeft.
|
inline |
Definition at line 209 of file kis_sequential_iterator.h.
References KisSequentialIteratorBase< IteratorPolicy, SourcePolicy, ProgressPolicy >::m_columnOffset, KisSequentialIteratorBase< IteratorPolicy, SourcePolicy, ProgressPolicy >::m_columnsLeft, KisSequentialIteratorBase< IteratorPolicy, SourcePolicy, ProgressPolicy >::m_pixelSize, and KisSequentialIteratorBase< IteratorPolicy, SourcePolicy, ProgressPolicy >::nextPixel().
|
inline |
|
inline |
|
inline |
|
inline |
Definition at line 255 of file kis_sequential_iterator.h.
References KisSequentialIteratorBase< IteratorPolicy, SourcePolicy, ProgressPolicy >::m_columnsLeft, KisSequentialIteratorBase< IteratorPolicy, SourcePolicy, ProgressPolicy >::m_iteratorX, and KisSequentialIteratorBase< IteratorPolicy, SourcePolicy, ProgressPolicy >::m_numConseqPixels.
|
inline |
Definition at line 259 of file kis_sequential_iterator.h.
References KisSequentialIteratorBase< IteratorPolicy, SourcePolicy, ProgressPolicy >::m_iteratorY.
|
private |
Definition at line 287 of file kis_sequential_iterator.h.
|
private |
Definition at line 285 of file kis_sequential_iterator.h.
|
private |
Definition at line 291 of file kis_sequential_iterator.h.
|
private |
Definition at line 288 of file kis_sequential_iterator.h.
|
private |
Definition at line 289 of file kis_sequential_iterator.h.
|
private |
Definition at line 284 of file kis_sequential_iterator.h.
|
private |
Definition at line 281 of file kis_sequential_iterator.h.
|
private |
Definition at line 279 of file kis_sequential_iterator.h.
|
private |
Definition at line 280 of file kis_sequential_iterator.h.
|
private |
Definition at line 282 of file kis_sequential_iterator.h.