|
Krita Source Code Documentation
|
#include <kis_datamanager.h>
Inheritance diagram for KisDataManager:Public Member Functions | |
| void | bitBlt (KisTiledDataManagerSP srcDM, const QRect &rect) |
| void | bitBltOldData (KisTiledDataManagerSP srcDM, const QRect &rect) |
| void | bitBltRough (KisTiledDataManagerSP srcDM, const QRect &rect) |
| void | bitBltRoughOldData (KisTiledDataManagerSP srcDM, const QRect &rect) |
| void | clear () |
| void | clear (qint32 x, qint32 y, qint32 w, qint32 h, const quint8 *def) |
| void | clear (qint32 x, qint32 y, qint32 w, qint32 h, quint8 def) |
| const quint8 * | defaultPixel () const |
| QRect | extent () const |
| void | extent (qint32 &x, qint32 &y, qint32 &w, qint32 &h) const |
| KisMementoSP | getMemento () |
| bool | hasCurrentMemento () const |
| KisDataManager (const KisDataManager &dm) | |
| KisDataManager (quint32 pixelSize, const quint8 *defPixel) | |
| qint32 | numContiguousColumns (qint32 x, qint32 minY, qint32 maxY) const |
| qint32 | numContiguousRows (qint32 y, qint32 minX, qint32 maxX) const |
| quint32 | pixelSize () const |
| void | purge (const QRect &area) |
| bool | read (QIODevice *io) |
| void | readBytes (quint8 *data, qint32 x, qint32 y, qint32 w, qint32 h, qint32 dataRowStride=-1) const |
| QVector< quint8 * > | readPlanarBytes (QVector< qint32 > channelsizes, qint32 x, qint32 y, qint32 w, qint32 h) const |
| KisRegion | region () const |
| void | rollback (KisMementoSP memento) |
| void | rollforward (KisMementoSP memento) |
| qint32 | rowStride (qint32 x, qint32 y) const |
| void | setDefaultPixel (const quint8 *defPixel) |
| void | setExtent (const QRect &rect) |
| void | setExtent (qint32 x, qint32 y, qint32 w, qint32 h) |
| void | setPixel (qint32 x, qint32 y, const quint8 *data) |
| bool | write (KisPaintDeviceWriter &writer) |
| void | writeBytes (const quint8 *data, qint32 x, qint32 y, qint32 w, qint32 h, qint32 dataRowStride=-1) |
| void | writePlanarBytes (QVector< quint8 * > planes, QVector< qint32 > channelsizes, qint32 x, qint32 y, qint32 w, qint32 h) |
| ~KisDataManager () override | |
Static Public Member Functions | |
| static void | releaseInternalPools () |
Friends | |
| class | KisHLineIterator |
| class | KisRectIterator |
| class | KisVLineIterator |
KisDataManager defines the interface that modules responsible for storing and retrieving data must implement. Data modules, like the tile manager, are responsible for:
A datamanager knows nothing about the type of pixel data except how many quint8's a single pixel takes.
Definition at line 33 of file kis_datamanager.h.
|
inline |
Create a new datamanager where every pixel will take pixelSize bytes and will be initialized by default with defPixel. The value of defPixel is copied, the caller still owns the pointer.
Note that if pixelSize > size of the defPixel array, we will happily read beyond the defPixel array.
Definition at line 45 of file kis_datamanager.h.
|
inline |
Definition at line 46 of file kis_datamanager.h.
|
inlineoverride |
Definition at line 48 of file kis_datamanager.h.
|
inline |
Clones rect from another datamanager. The cloned area will be shared between both datamanagers as much as possible using copy-on-write. Parts of the rect that cannot be shared (cross tiles) are deep-copied,
Definition at line 207 of file kis_datamanager.h.
References KisSharedPtr< T >::data().
|
inline |
The same as bitBlt() but reads old data
Definition at line 214 of file kis_datamanager.h.
References KisSharedPtr< T >::data().
|
inline |
Clones rect from another datamanager in a rough and fast way. All the tiles touched by rect will be shared, between both devices, that means it will copy a bigger area than was requested. This method is supposed to be used for bitBlt'ing into temporary paint devices.
Definition at line 225 of file kis_datamanager.h.
References KisSharedPtr< T >::data().
|
inline |
The same as bitBltRough() but reads old data
Definition at line 232 of file kis_datamanager.h.
References KisSharedPtr< T >::data().
|
inline |
Clear all back to default values.
Definition at line 195 of file kis_datamanager.h.
|
inline |
Clear the specified rect to the specified pixel value.
Definition at line 185 of file kis_datamanager.h.
|
inline |
Clear the specified rect to the specified value.
Definition at line 176 of file kis_datamanager.h.
|
inline |
Get a pointer to the default pixel.
Definition at line 63 of file kis_datamanager.h.
|
inline |
Definition at line 150 of file kis_datamanager.h.
|
inline |
Return the extent of the data in x,y,w,h.
Definition at line 146 of file kis_datamanager.h.
|
inline |
Requests a memento from the data manager. There is only one memento active at any given moment for a given paint device and all and any write actions on the datamanager builds undo data into this memento necessary to rollback the transaction.
Definition at line 73 of file kis_datamanager.h.
|
inline |
Definition at line 102 of file kis_datamanager.h.
|
inline |
Get the number of contiguous columns starting at x, valid for all values of y between minY and maxY.
Definition at line 315 of file kis_datamanager.h.
|
inline |
Get the number of contiguous rows starting at y, valid for all values of x between minX and maxX.
Definition at line 324 of file kis_datamanager.h.
|
inline |
Returns the number of bytes a pixel takes
Definition at line 139 of file kis_datamanager.h.
|
inline |
Definition at line 120 of file kis_datamanager.h.
|
inline |
Definition at line 116 of file kis_datamanager.h.
|
inline |
Copy the bytes in the specified rect to a chunk of memory. The pixelSize in bytes is w * h * pixelSize
Definition at line 250 of file kis_datamanager.h.
|
inline |
Copy the bytes in the paint device into a vector of arrays of bytes, where the number of arrays is the number of channels in the paint device. If the specified area is larger than the paint device's extent, the default pixel will be read.
| channelsizes | a vector with for every channel its size in bytes |
| x | x coordinate of the top left corner |
| y | y coordinate of the top left corner |
| w | width |
| h | height |
Definition at line 281 of file kis_datamanager.h.
|
inline |
Definition at line 154 of file kis_datamanager.h.
|
inlinestatic |
The tiles may be not allocated directly from the glibc, but instead can be allocated in bigger blobs. After you freed quite a lot of data and are sure you won't need it anymore, you can release these pools to save the memory.
Definition at line 130 of file kis_datamanager.h.
|
inline |
Restores the image data to the state at the time of the getMemento() call.
Note that rollback should be performed with mementos in the reverse order of their creation, as mementos only store incremental changes
Definition at line 83 of file kis_datamanager.h.
|
inline |
Restores the image data to the state at the time of the rollback call of the memento.
Note that rollforward must only be called when an rollback have previously been performed, and no intermittent actions have been performed (though it's ok to rollback other mementos and roll them forward again)
Definition at line 94 of file kis_datamanager.h.
|
inline |
Get the row stride at pixel (x, y). This is the number of bytes to add to a pointer to pixel (x, y) to access (x, y + 1).
Definition at line 333 of file kis_datamanager.h.
|
inline |
Sets the default pixel. New data will be initialised with this pixel. The pixel is copied: the caller still owns the pointer.
Definition at line 56 of file kis_datamanager.h.
|
inline |
Definition at line 167 of file kis_datamanager.h.
References setExtent().
|
inline |
Crop or extend the data to x, y, w, h.
Definition at line 163 of file kis_datamanager.h.
|
inline |
Write the specified data to x, y. There is no checking on pixelSize!
Definition at line 241 of file kis_datamanager.h.
|
inline |
Reads and writes the tiles
Definition at line 112 of file kis_datamanager.h.
|
inline |
Copy the bytes to the specified rect. w * h * pixelSize bytes will be read, whether the caller prepared them or not.
Definition at line 261 of file kis_datamanager.h.
|
inline |
Write the data in the separate arrays to the channels. If there are less vectors than channels, the remaining channels will not be copied. If any of the arrays points to 0, the channel in that location will not be touched. If the specified area is larger than the paint device, the paint device will be extended. There are no guards: if the area covers more pixels than there are bytes in the arrays, krita will happily fill your paint device with areas of memory you never wanted to be read. Krita may also crash.
| planes | a vector with a byte array for every plane |
| channelsizes | a vector with for every channel its size in bytes |
| x | x coordinate of the top left corner |
| y | y coordinate of the top left corner |
| w | width |
| h | height |
XXX: what about undo?
Definition at line 306 of file kis_datamanager.h.
|
friend |
Definition at line 339 of file kis_datamanager.h.
|
friend |
Definition at line 338 of file kis_datamanager.h.
|
friend |
Definition at line 340 of file kis_datamanager.h.