Krita Source Code Documentation
Loading...
Searching...
No Matches
KisPaintDeviceFramesInterface Class Reference

#include <kis_paint_device_frames_interface.h>

Classes

struct  TestingDataObjects
 

Public Member Functions

int createFrame (bool copy, int copySrc, const QPoint &offset, KUndo2Command *parentCommand)
 
int currentFrameId () const
 
void deleteFrame (int frame, KUndo2Command *parentCommand)
 
QRect frameBounds (int frameId)
 
KisDataManagerSP frameDataManager (int frameId) const
 
KoColor frameDefaultPixel (int frameId) const
 
QPoint frameOffset (int frameId) const
 
QList< int > frames ()
 
void invalidateFrameCache (int frameId)
 
 KisPaintDeviceFramesInterface (KisPaintDevice *parentDevice)
 
bool readFrame (QIODevice *stream, int frameId)
 
void setFrameDefaultPixel (const KoColor &defPixel, int frameId)
 
void setFrameOffset (int frameId, const QPoint &offset)
 
TestingDataObjects testingGetDataObjects () const
 
QList< KisPaintDeviceData * > testingGetDataObjectsList () const
 
void uploadFrame (int dstFrameId, KisPaintDeviceSP srcDevice)
 
void uploadFrame (int srcFrameId, int dstFrameId, KisPaintDeviceSP srcDevice)
 
bool writeFrame (KisPaintDeviceWriter &store, int frameId)
 
void writeFrameToDevice (int frameId, KisPaintDeviceSP targetDevice)
 

Private Attributes

KisPaintDevice * q
 

Detailed Description

Definition at line 22 of file kis_paint_device_frames_interface.h.

Constructor & Destructor Documentation

◆ KisPaintDeviceFramesInterface()

KisPaintDeviceFramesInterface::KisPaintDeviceFramesInterface ( KisPaintDevice * parentDevice)

Definition at line 2197 of file kis_paint_device.cc.

2198 : q(parentDevice)
2199{
2200}

Member Function Documentation

◆ createFrame()

int KisPaintDeviceFramesInterface::createFrame ( bool copy,
int copySrc,
const QPoint & offset,
KUndo2Command * parentCommand )

Creates a new frame on the device and returns an identifier for it.

Returns
frame id of the newly created frame

Definition at line 2207 of file kis_paint_device.cc.

2208{
2209 return q->m_d->createFrame(copy, copySrc, offset, parentCommand);
2210}
Private *const m_d
int createFrame(bool copy, int copySrc, const QPoint &offset, KUndo2Command *parentCommand)

References KisPaintDevice::Private::createFrame(), KisPaintDevice::m_d, and q.

◆ currentFrameId()

int KisPaintDeviceFramesInterface::currentFrameId ( ) const

Returns frameId of the currently active frame. Should be used by Undo framework only!

Definition at line 2272 of file kis_paint_device.cc.

2273{
2274 return q->m_d->currentFrameId();
2275}

References KisPaintDevice::Private::currentFrameId(), KisPaintDevice::m_d, and q.

◆ deleteFrame()

void KisPaintDeviceFramesInterface::deleteFrame ( int frame,
KUndo2Command * parentCommand )

Delete the frame with given id

Parameters
frameframe ID
parentCommandparent command

Definition at line 2212 of file kis_paint_device.cc.

2213{
2214 return q->m_d->deleteFrame(frame, parentCommand);
2215}
void deleteFrame(int frameID, KUndo2Command *parentCommand)

References KisPaintDevice::Private::deleteFrame(), KisPaintDevice::m_d, and q.

◆ frameBounds()

QRect KisPaintDeviceFramesInterface::frameBounds ( int frameId)
Returns
extent() of frameId

Definition at line 2232 of file kis_paint_device.cc.

2233{
2234 return q->m_d->frameBounds(frameId);
2235}
QRect frameBounds(int frameId)

References KisPaintDevice::Private::frameBounds(), KisPaintDevice::m_d, and q.

◆ frameDataManager()

KisDataManagerSP KisPaintDeviceFramesInterface::frameDataManager ( int frameId) const

Returns the data manager of the specified frame. Should be used by Undo framework only!

Definition at line 2277 of file kis_paint_device.cc.

2278{
2279 KIS_ASSERT_RECOVER(frameId >= 0) {
2280 return q->m_d->dataManager();
2281 }
2282 return q->m_d->frameDataManager(frameId);
2283}
#define KIS_ASSERT_RECOVER(cond)
Definition kis_assert.h:55
KisDataManagerSP dataManager() const
KisDataManagerSP frameDataManager(int frameId) const

References KisPaintDevice::Private::dataManager(), KisPaintDevice::Private::frameDataManager(), KIS_ASSERT_RECOVER, KisPaintDevice::m_d, and q.

◆ frameDefaultPixel()

KoColor KisPaintDeviceFramesInterface::frameDefaultPixel ( int frameId) const
Returns
default pixel for frameId

Definition at line 2248 of file kis_paint_device.cc.

2249{
2250 KIS_ASSERT_RECOVER(frameId >= 0) {
2251 return KoColor(Qt::red, q->m_d->colorSpace());
2252 }
2253 return q->m_d->frameDefaultPixel(frameId);
2254}
const KoColorSpace * colorSpace() const
KoColor frameDefaultPixel(int frameId) const

References KisPaintDevice::Private::colorSpace(), KisPaintDevice::Private::frameDefaultPixel(), KIS_ASSERT_RECOVER, KisPaintDevice::m_d, and q.

◆ frameOffset()

QPoint KisPaintDeviceFramesInterface::frameOffset ( int frameId) const
Returns
offset of a data on frameId

Definition at line 2237 of file kis_paint_device.cc.

2238{
2239 return q->m_d->frameOffset(frameId);
2240}
QPoint frameOffset(int frameId) const

References KisPaintDevice::Private::frameOffset(), KisPaintDevice::m_d, and q.

◆ frames()

QList< int > KisPaintDeviceFramesInterface::frames ( )

Return a list of IDs for the frames contained in this paint device

Returns
list of frame IDs

Definition at line 2202 of file kis_paint_device.cc.

2203{
2204 return q->m_d->frameIds();
2205}
const QList< int > frameIds() const

References KisPaintDevice::Private::frameIds(), KisPaintDevice::m_d, and q.

◆ invalidateFrameCache()

void KisPaintDeviceFramesInterface::invalidateFrameCache ( int frameId)

Resets the cache object associated with the frame. Should be used by Undo framework only!

Definition at line 2285 of file kis_paint_device.cc.

2286{
2287 KIS_ASSERT_RECOVER_RETURN(frameId >= 0);
2288
2289 return q->m_d->invalidateFrameCache(frameId);
2290}
#define KIS_ASSERT_RECOVER_RETURN(cond)
Definition kis_assert.h:75
void invalidateFrameCache(int frameId)

References KisPaintDevice::Private::invalidateFrameCache(), KIS_ASSERT_RECOVER_RETURN, KisPaintDevice::m_d, and q.

◆ readFrame()

bool KisPaintDeviceFramesInterface::readFrame ( QIODevice * stream,
int frameId )

Loads content of a frameId from stream.

NOTE: the frame must be created manually with createFrame() beforehand!

Definition at line 2264 of file kis_paint_device.cc.

2265{
2266 KIS_ASSERT_RECOVER(frameId >= 0) {
2267 return false;
2268 }
2269 return q->m_d->readFrame(stream, frameId);
2270}
bool readFrame(QIODevice *stream, int frameId)

References KIS_ASSERT_RECOVER, KisPaintDevice::m_d, q, and KisPaintDevice::Private::readFrame().

◆ setFrameDefaultPixel()

void KisPaintDeviceFramesInterface::setFrameDefaultPixel ( const KoColor & defPixel,
int frameId )

Sets default pixel for frameId

Definition at line 2242 of file kis_paint_device.cc.

2243{
2244 KIS_ASSERT_RECOVER_RETURN(frameId >= 0);
2245 q->m_d->setFrameDefaultPixel(defPixel, frameId);
2246}
void setFrameDefaultPixel(const KoColor &defPixel, int frameId)

References KIS_ASSERT_RECOVER_RETURN, KisPaintDevice::m_d, q, and KisPaintDevice::Private::setFrameDefaultPixel().

◆ setFrameOffset()

void KisPaintDeviceFramesInterface::setFrameOffset ( int frameId,
const QPoint & offset )

Sets the offset for frameId. Should be used by Undo framework only!

Definition at line 2292 of file kis_paint_device.cc.

2293{
2294 KIS_ASSERT_RECOVER_RETURN(frameId >= 0);
2295 return q->m_d->setFrameOffset(frameId, offset);
2296}
void setFrameOffset(int frameId, const QPoint &offset)

References KIS_ASSERT_RECOVER_RETURN, KisPaintDevice::m_d, q, and KisPaintDevice::Private::setFrameOffset().

◆ testingGetDataObjects()

KisPaintDeviceFramesInterface::TestingDataObjects KisPaintDeviceFramesInterface::testingGetDataObjects ( ) const

Definition at line 2299 of file kis_paint_device.cc.

2300{
2301 TestingDataObjects objects;
2302
2303 objects.m_data = q->m_d->m_data.data();
2304 objects.m_lodData = q->m_d->m_lodData.data();
2305 objects.m_externalFrameData = q->m_d->m_externalFrameData.data();
2306
2307 typedef KisPaintDevice::Private::FramesHash FramesHash;
2308
2309 FramesHash::const_iterator it = q->m_d->m_frames.constBegin();
2310 FramesHash::const_iterator end = q->m_d->m_frames.constEnd();
2311
2312 for (; it != end; ++it) {
2313 objects.m_frames.insert(it.key(), it.value().data());
2314 }
2315
2316 objects.m_currentData = q->m_d->currentData();
2317
2318 return objects;
2319}
QHash< int, DataSP > FramesHash
QScopedPointer< Data > m_externalFrameData
QScopedPointer< Data > m_lodData

References KisPaintDevice::Private::currentData(), KisPaintDeviceFramesInterface::TestingDataObjects::m_currentData, KisPaintDevice::m_d, KisPaintDevice::Private::m_data, KisPaintDeviceFramesInterface::TestingDataObjects::m_data, KisPaintDevice::Private::m_externalFrameData, KisPaintDeviceFramesInterface::TestingDataObjects::m_externalFrameData, KisPaintDevice::Private::m_frames, KisPaintDeviceFramesInterface::TestingDataObjects::m_frames, KisPaintDevice::Private::m_lodData, KisPaintDeviceFramesInterface::TestingDataObjects::m_lodData, and q.

◆ testingGetDataObjectsList()

QList< KisPaintDeviceData * > KisPaintDeviceFramesInterface::testingGetDataObjectsList ( ) const

Definition at line 2321 of file kis_paint_device.cc.

2322{
2323 return q->m_d->allDataObjects();
2324}
QList< Data * > allDataObjects() const

References KisPaintDevice::Private::allDataObjects(), KisPaintDevice::m_d, and q.

◆ uploadFrame() [1/2]

void KisPaintDeviceFramesInterface::uploadFrame ( int dstFrameId,
KisPaintDeviceSP srcDevice )

Copy the given paint device contents into the specified frame

Parameters
dstFrameIdID of the frame to be overwritten (must exist)
srcDevicepaint device to copy from

Definition at line 2227 of file kis_paint_device.cc.

2228{
2229 q->m_d->uploadFrame(dstFrameId, srcDevice);
2230}
void uploadFrame(int srcFrameId, int dstFrameId, KisPaintDeviceSP srcDevice)

References KisPaintDevice::m_d, q, and KisPaintDevice::Private::uploadFrame().

◆ uploadFrame() [2/2]

void KisPaintDeviceFramesInterface::uploadFrame ( int srcFrameId,
int dstFrameId,
KisPaintDeviceSP srcDevice )

Copy the given paint device contents into the specified frame

Parameters
srcFrameIdID of the frame to copy from (must exist)
dstFrameIdID of the frame to be overwritten (must exist)
srcDevicepaint device to copy from

Definition at line 2222 of file kis_paint_device.cc.

2223{
2224 q->m_d->uploadFrame(srcFrameId, dstFrameId, srcDevice);
2225}

References KisPaintDevice::m_d, q, and KisPaintDevice::Private::uploadFrame().

◆ writeFrame()

bool KisPaintDeviceFramesInterface::writeFrame ( KisPaintDeviceWriter & store,
int frameId )

Write a frameId onto store

Definition at line 2256 of file kis_paint_device.cc.

2257{
2258 KIS_ASSERT_RECOVER(frameId >= 0) {
2259 return false;
2260 }
2261 return q->m_d->writeFrame(store, frameId);
2262}
bool writeFrame(KisPaintDeviceWriter &store, int frameId)

References KIS_ASSERT_RECOVER, KisPaintDevice::m_d, q, and KisPaintDevice::Private::writeFrame().

◆ writeFrameToDevice()

void KisPaintDeviceFramesInterface::writeFrameToDevice ( int frameId,
KisPaintDeviceSP targetDevice )

Copy the given frame into the target device

Parameters
frameIdID of the frame to be copied
targetDevicepaint device to copy to

Definition at line 2217 of file kis_paint_device.cc.

2218{
2219 q->m_d->writeFrameToDevice(frameId, targetDevice);
2220}
void writeFrameToDevice(int frameId, KisPaintDeviceSP targetDevice)

References KisPaintDevice::m_d, q, and KisPaintDevice::Private::writeFrameToDevice().

Member Data Documentation

◆ q

KisPaintDevice* KisPaintDeviceFramesInterface::q
private

Definition at line 143 of file kis_paint_device_frames_interface.h.


The documentation for this class was generated from the following files: