[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-kimageshop
Subject: Re: Iterator requirements
From: Casper Boemann <cbr () boemann ! dk>
Date: 2004-07-06 0:35:44
Message-ID: 200407060235.44530.cbr () boemann ! dk
[Download RAW message or body]
On Tuesday 06 July 2004 00:49, Cyrille Berger wrote:
> > Iterators and single pixel values are passed to the colour strategies
> > for colour model specific handling.
>
> I was planning to work on that specific part during this week. And I was
> planning to implement a second type of iterrator that will return a class
> representing a pixel.
Please see attached header file. If you could implement those iterators it
would be great.
For reasons I have already stated it is no good to return a pixel class. Trust
me on this one.
When implementing please feel free to reuse the code from your previous
iterators, but it would be really great if you could reference tiles by a
row,col pair instead of tilenum. I know tileMgr doesn't take that as
arguments yet, but then just call tm->tile(tempconverter(col,row))
where tempconverter is a temporary function you write that converts to
tilenum.
Also please note that row,col, x and y can be negative and that the % operator
is undefine for negative numbers so please be careful.
Also note that I intend to make all tiles of fixed size so just use TILE_WIDTH
and TILE_HEIGHT for now. (I already have a patch that does this).
best regards
Casper Boemann
["kis_pixel_iterator.h" (text/x-chdr)]
/* This file is part of the KDE project
Copyright (c) 2004 Cyrille Berger <cberger@cberger.net>
Copyright (c) 2004 Casper Boemann <cbr@boemann.dkt>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#if !defined KIS_PIXEL_ITERATOR_H_
#define KIS_PIXEL_ITERATOR_H_
#include <qstring.h>
#include "kis_types.h"
#include "kis_paint_device.h"
#include <kistile.h>
#include <kistilemgr.h>
#include <kdebug.h>
/**
* The KisPixelIterator class iterates through the pixels of a KisPaintDevice hiding \
the tile structure
*/
class KisPixelIterator {
public:
KisPixelIterator( KisPaintDeviceSP ndevice);
virtual ~KisPixelIterator() = 0;
public:
/// returns a pointer to the pixel data. Do NOT interpret the data - leave that to a \
colorstrategy operator QUANTUM* ();
/// Advances one pixel
virtual KisPixelIterator & operator++() = 0;
/// Goes back one pixel
virtual KisPixelIterator& operator--() = 0;
/// compares position
virtual bool operator<(const KisPixelIterator& __rhs) const = 0;
/// compares position
virtual bool operator<=(const KisPixelIterator& __rhs) const = 0;
/// compares position
virtual bool operator==(const KisPixelIterator& __rhs) const = 0;
protected:
KisPaintDeviceSP m_device;
KisTileMgrSP m_ktm;
const Q_INT32 m_depth;;
};
/**
* The KisPixelRectIterator class iterates through the pixels of a rect in a \
KisPaintDevice hiding the tile
* structure
*/
class KisPixelRectIterator {
public:
KisPixelRectIterator( KisPaintDeviceSP ndevice, Q_INT32 x, Q_INT32 y, Q_INT32 w, \
Q_INT32 h);
virtual ~KisPixelRectIterator() = 0;
public:
/// returns a pointer to the pixel data. Do NOT interpret the data - leave that to a \
colorstrategy operator QUANTUM* ();
/// Advances one pixel going to the beginning of the next line when it reaches the \
end of a line virtual KisPixelIterator & operator++() = 0;
/// Goes back one pixel going to the end of the line above when it reaches the \
beginning of a line virtual KisPixelIterator& operator--() = 0;
/// compares position
virtual bool operator<(const KisPixelIterator& __rhs) const = 0;
/// compares position
virtual bool operator<=(const KisPixelIterator& __rhs) const = 0;
/// compares position
virtual bool operator==(const KisPixelIterator& __rhs) const = 0;
protected:
};
#endif
_______________________________________________
kimageshop mailing list
kimageshop@kde.org
https://mail.kde.org/mailman/listinfo/kimageshop
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic