chalk

kis_iterators_pixel.cpp
1/*
2 * This file is part of the Chalk project
3 *
4 * Copyright (c) 2004 Cyrille Berger <cberger@cberger.net>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19 */
20
21#include "kis_iterators_pixel.h"
22#include "kis_global.h"
23#include "kis_paint_device.h"
24
25KisHLineIteratorPixel::KisHLineIteratorPixel( KisPaintDevice *ndevice, KisDataManager *dm, KisDataManager *sel_dm, TQ_INT32 x, TQ_INT32 y, TQ_INT32 w, TQ_INT32 offsetx, TQ_INT32 offsety, bool writable) :
26 KisHLineIterator(dm, x - offsetx, y - offsety, w, writable),
27 KisIteratorPixelTrait <KisHLineIterator> ( ndevice, this ),
28 m_offsetx(offsetx), m_offsety(offsety)
29{
30 if(sel_dm) {
31 KisHLineIterator * i = new KisHLineIterator(sel_dm, x - offsetx, y - offsety, w, false);
32 TQ_CHECK_PTR(i);
33 KisIteratorPixelTrait <KisHLineIterator>::setSelectionIterator(i);
34 }
35}
36
37KisVLineIteratorPixel::KisVLineIteratorPixel( KisPaintDevice *ndevice, KisDataManager *dm, KisDataManager *sel_dm, TQ_INT32 x, TQ_INT32 y, TQ_INT32 h, TQ_INT32 offsetx, TQ_INT32 offsety, bool writable) :
38 KisVLineIterator(dm, x - offsetx, y - offsety, h, writable),
39 KisIteratorPixelTrait <KisVLineIterator> ( ndevice, this ),
40 m_offsetx(offsetx), m_offsety(offsety)
41{
42 if(sel_dm) {
43 KisVLineIterator * i = new KisVLineIterator(sel_dm, x - offsetx, y - offsety, h, false);
44 TQ_CHECK_PTR(i);
45 KisIteratorPixelTrait <KisVLineIterator>::setSelectionIterator(i);
46 }
47}
48
49KisRectIteratorPixel::KisRectIteratorPixel( KisPaintDevice *ndevice, KisDataManager *dm, KisDataManager *sel_dm, TQ_INT32 x, TQ_INT32 y, TQ_INT32 w, TQ_INT32 h, TQ_INT32 offsetx, TQ_INT32 offsety, bool writable) :
50 KisRectIterator(dm, x - offsetx, y - offsety, w, h, writable),
51 KisIteratorPixelTrait <KisRectIterator> ( ndevice, this ),
52 m_offsetx(offsetx), m_offsety(offsety)
53{
54 if(sel_dm) {
55 KisRectIterator * i = new KisRectIterator(sel_dm, x - offsetx, y - offsety, w, h, false);
56 TQ_CHECK_PTR(i);
57 KisIteratorPixelTrait <KisRectIterator>::setSelectionIterator(i);
58 }
59}
KisDataManager defines the interface that modules responsible for storing and retrieving data must in...
A paint device contains the actual pixel data and offers methods to read and write pixels.
The KisRectIterator iterators over a rectangular area in the most efficient order.