krita

kis_datamanager.h

00001 /*
00002  *  Copyright (c) 2004 Boudewijn Rempt <boud@valdyas.org>
00003  *
00004  *  This program is free software; you can redistribute it and/or modify
00005  *  it under the terms of the GNU General Public License as published by
00006  *  the Free Software Foundation; either version 2 of the License, or
00007  *  (at your option) any later version.
00008  *
00009  *  This program is distributed in the hope that it will be useful,
00010  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  *  GNU General Public License for more details.
00013  *
00014  *  You should have received a copy of the GNU General Public License
00015  *  along with this program; if not, write to the Free Software
00016  *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00017  */
00018 #ifndef KIS_DATAMANAGER_H_
00019 #define KIS_DATAMANAGER_H_
00020 
00021 #include <qglobal.h>
00022 #include <qvaluevector.h>
00023 #include <qrect.h>
00024 
00025 class KoStore;
00026 
00027 
00028 // Change the following two lines to switch (at compiletime) to another datamanager
00029 #include "tiles/kis_tileddatamanager.h"
00030 #define ACTUAL_DATAMGR KisTiledDataManager
00031 
00045 class KisDataManager : public ACTUAL_DATAMGR {
00046 
00047 public:
00048     KisDataManager(Q_UINT32 pixelSize, const Q_UINT8 *defPixel) : ACTUAL_DATAMGR(pixelSize, defPixel) {}
00049     KisDataManager(const KisDataManager& dm) : ACTUAL_DATAMGR(dm) { }
00050 
00051 public:
00056     inline void setDefaultPixel(const Q_UINT8 *defPixel) { return ACTUAL_DATAMGR::setDefaultPixel(defPixel); }
00057 
00061      inline const Q_UINT8 *defaultPixel() const { return ACTUAL_DATAMGR::defaultPixel(); }
00062 
00069     inline KisMementoSP getMemento() { return ACTUAL_DATAMGR::getMemento(); }
00070 
00077     inline void rollback(KisMementoSP memento) { ACTUAL_DATAMGR::rollback(memento); }
00078 
00086     inline void rollforward(KisMementoSP memento) { ACTUAL_DATAMGR::rollforward(memento); }
00087 
00088 public:
00093     inline bool write(KoStore *store) { return ACTUAL_DATAMGR::write(store); }
00094     inline bool read(KoStore *store) { return ACTUAL_DATAMGR::read(store); }
00095 
00096 public:
00097 
00101     inline Q_UINT32 pixelSize() { return ACTUAL_DATAMGR::pixelSize(); }
00102 
00106     inline void extent(Q_INT32 &x, Q_INT32 &y, Q_INT32 &w, Q_INT32 &h) const
00107                          { return ACTUAL_DATAMGR::extent(x, y, w, h); }
00108 
00109      QRect extent() const { return ACTUAL_DATAMGR::extent(); }
00110 
00111 
00112 public:
00113 
00117     inline void setExtent(Q_INT32 x, Q_INT32 y, Q_INT32 w, Q_INT32 h)
00118                          { return ACTUAL_DATAMGR::setExtent(x, y, w, h); }
00119 
00120     inline void setExtent(const QRect & rect) { setExtent(rect.x(), rect.y(), rect.width(), rect.height()); }
00121 
00122 public:
00123 
00127     inline void clear(Q_INT32 x, Q_INT32 y,
00128            Q_INT32 w, Q_INT32 h,
00129            Q_UINT8 def) { ACTUAL_DATAMGR::clear(x, y, w, h, def); }
00130 
00134     inline void clear(Q_INT32 x, Q_INT32 y,
00135            Q_INT32 w, Q_INT32 h,
00136            const Q_UINT8 * def) { ACTUAL_DATAMGR::clear(x, y, w, h, def); }
00137 
00141     inline void clear() { ACTUAL_DATAMGR::clear(); }
00142 
00143 
00144 public:
00145 
00150     inline void paste(KisDataManagerSP data,  Q_INT32 sx, Q_INT32 sy, Q_INT32 dx, Q_INT32 dy,
00151            Q_INT32 w, Q_INT32 h) { ACTUAL_DATAMGR::paste(data, sx, sy, dx, dy, w, h); }
00152 
00153 public:
00157     inline KDE_DEPRECATED const Q_UINT8* pixel(Q_INT32 x, Q_INT32 y)
00158           { return ACTUAL_DATAMGR::pixel(x, y); }
00159 
00163     inline KDE_DEPRECATED Q_UINT8* writablePixel(Q_INT32 x, Q_INT32 y)
00164           { return ACTUAL_DATAMGR::writablePixel(x, y); }
00165 
00169     inline void setPixel(Q_INT32 x, Q_INT32 y, const Q_UINT8 * data)
00170         { ACTUAL_DATAMGR::setPixel(x, y, data);}
00171 
00172 
00178      inline void readBytes(Q_UINT8 * data,
00179                Q_INT32 x, Q_INT32 y,
00180                Q_INT32 w, Q_INT32 h)
00181         { ACTUAL_DATAMGR::readBytes(data, x, y, w, h);}
00182 
00187      inline void writeBytes(const Q_UINT8 * data,
00188              Q_INT32 x, Q_INT32 y,
00189              Q_INT32 w, Q_INT32 h)
00190         {ACTUAL_DATAMGR::writeBytes( data, x, y, w, h); }
00191 
00192     // Get the number of contiguous columns starting at x, valid for all values
00193     // of y between minY and maxY.
00194     inline Q_INT32 numContiguousColumns(Q_INT32 x, Q_INT32 minY, Q_INT32 maxY)
00195         { return ACTUAL_DATAMGR::numContiguousColumns(x, minY, maxY); }
00196 
00197 
00198     // Get the number of contiguous rows starting at y, valid for all values
00199     // of x between minX and maxX.
00200     inline Q_INT32 numContiguousRows(Q_INT32 y, Q_INT32 minX, Q_INT32 maxX)
00201         { return ACTUAL_DATAMGR::numContiguousRows(y, minX, maxX); }
00202 
00203 
00204     // Get the row stride at pixel (x, y). This is the number of bytes to add to a
00205     // pointer to pixel (x, y) to access (x, y + 1).
00206     inline Q_INT32 rowStride(Q_INT32 x, Q_INT32 y)
00207         { return ACTUAL_DATAMGR::rowStride(x, y); }
00208 
00209 protected:
00210     friend class KisRectIterator;
00211     friend class KisHLineIterator;
00212     friend class KisVLineIterator;
00213 };
00214 
00215 
00216 #endif // KIS_DATAMANAGER_H_
00217 
KDE Home | KDE Accessibility Home | Description of Access Keys