krita

kis_random_accessor.cpp

00001 /*
00002  * This file is part of the Krita project
00003  *
00004  *  Copyright (c) 2006 Cyrille Berger <cberger@cberger.net>
00005  *
00006  *  This program is free software; you can redistribute it and/or modify
00007  *  it under the terms of the GNU General Public License as published by
00008  *  the Free Software Foundation; version 2 of the License.
00009  *
00010  *  This program is distributed in the hope that it will be useful,
00011  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  *  GNU General Public License for more details.
00014  *
00015  *  You should have received a copy of the GNU General Public License
00016  *  along with this program; if not, write to the Free Software
00017  *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00018  */
00019 
00020 #include "kis_random_accessor.h"
00021 
00022 #include "kis_tiled_random_accessor.h"
00023 
00024 KisRandomAccessor::KisRandomAccessor(KisTiledDataManager *ktm, Q_INT32 x, Q_INT32 y, Q_INT32 offsetx, Q_INT32 offsety, bool writable) : m_offsetx(offsetx), m_offsety(offsety)
00025 {
00026     m_accessor = new KisTiledRandomAccessor(ktm, x, y, writable);
00027 }
00028 
00029 KisRandomAccessor::KisRandomAccessor(const KisRandomAccessor& rhs) {
00030     m_accessor = rhs.m_accessor;
00031 }
00032 
00033 KisRandomAccessor::~KisRandomAccessor()
00034 {
00035     
00036 }
00037 
00038 void KisRandomAccessor::moveTo(Q_INT32 x, Q_INT32 y)
00039 {
00040     m_accessor->moveTo(x - m_offsetx, y  - m_offsety);
00041 }
00042 
00043 Q_UINT8* KisRandomAccessor::rawData() const
00044 {
00045     return m_accessor->rawData();
00046 }
00047 
00048 const Q_UINT8* KisRandomAccessor::oldRawData() const
00049 {
00050     return m_accessor->oldRawData();
00051 }
00052 
00053 KisRandomAccessorPixel::KisRandomAccessorPixel(KisTiledDataManager *ktm, KisTiledDataManager *ktmselect, Q_INT32 x, Q_INT32 y, Q_INT32 offsetx, Q_INT32 offsety, bool writable) :
00054         KisRandomAccessor( ktm, x, y, offsetx, offsety, writable),
00055         KisRandomAccessorPixelTrait( this, (ktmselect) ? new KisRandomAccessor(ktm, x, y, offsetx, offsety, false) : 0 )
00056 {
00057     
00058 }
KDE Home | KDE Accessibility Home | Description of Access Keys