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

KisPaintDeviceq
 

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 2226 of file kis_paint_device.cc.

2227 : q(parentDevice)
2228{
2229}

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 2236 of file kis_paint_device.cc.

2237{
2238 return q->m_d->createFrame(copy, copySrc, offset, parentCommand);
2239}
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 2301 of file kis_paint_device.cc.

2302{
2303 return q->m_d->currentFrameId();
2304}

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 2241 of file kis_paint_device.cc.

2242{
2243 return q->m_d->deleteFrame(frame, parentCommand);
2244}
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 2261 of file kis_paint_device.cc.

2262{
2263 return q->m_d->frameBounds(frameId);
2264}
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 2306 of file kis_paint_device.cc.

2307{
2308 KIS_ASSERT_RECOVER(frameId >= 0) {
2309 return q->m_d->dataManager();
2310 }
2311 return q->m_d->frameDataManager(frameId);
2312}
#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 2277 of file kis_paint_device.cc.

2278{
2279 KIS_ASSERT_RECOVER(frameId >= 0) {
2280 return KoColor(Qt::red, q->m_d->colorSpace());
2281 }
2282 return q->m_d->frameDefaultPixel(frameId);
2283}
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 2266 of file kis_paint_device.cc.

2267{
2268 return q->m_d->frameOffset(frameId);
2269}
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 2231 of file kis_paint_device.cc.

2232{
2233 return q->m_d->frameIds();
2234}
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 2314 of file kis_paint_device.cc.

2315{
2316 KIS_ASSERT_RECOVER_RETURN(frameId >= 0);
2317
2318 return q->m_d->invalidateFrameCache(frameId);
2319}
#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 2293 of file kis_paint_device.cc.

2294{
2295 KIS_ASSERT_RECOVER(frameId >= 0) {
2296 return false;
2297 }
2298 return q->m_d->readFrame(stream, frameId);
2299}
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 2271 of file kis_paint_device.cc.

2272{
2273 KIS_ASSERT_RECOVER_RETURN(frameId >= 0);
2274 q->m_d->setFrameDefaultPixel(defPixel, frameId);
2275}
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 2321 of file kis_paint_device.cc.

2322{
2323 KIS_ASSERT_RECOVER_RETURN(frameId >= 0);
2324 return q->m_d->setFrameOffset(frameId, offset);
2325}
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 2328 of file kis_paint_device.cc.

2329{
2330 TestingDataObjects objects;
2331
2332 objects.m_data = q->m_d->m_data.data();
2333 objects.m_lodData = q->m_d->m_lodData.data();
2334 objects.m_externalFrameData = q->m_d->m_externalFrameData.data();
2335
2336 typedef KisPaintDevice::Private::FramesHash FramesHash;
2337
2338 FramesHash::const_iterator it = q->m_d->m_frames.constBegin();
2339 FramesHash::const_iterator end = q->m_d->m_frames.constEnd();
2340
2341 for (; it != end; ++it) {
2342 objects.m_frames.insert(it.key(), it.value().data());
2343 }
2344
2345 objects.m_currentData = q->m_d->currentData();
2346
2347 return objects;
2348}
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 2350 of file kis_paint_device.cc.

2351{
2352 return q->m_d->allDataObjects();
2353}
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 2256 of file kis_paint_device.cc.

2257{
2258 q->m_d->uploadFrame(dstFrameId, srcDevice);
2259}
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 2251 of file kis_paint_device.cc.

2252{
2253 q->m_d->uploadFrame(srcFrameId, dstFrameId, srcDevice);
2254}

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 2285 of file kis_paint_device.cc.

2286{
2287 KIS_ASSERT_RECOVER(frameId >= 0) {
2288 return false;
2289 }
2290 return q->m_d->writeFrame(store, frameId);
2291}
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 2246 of file kis_paint_device.cc.

2247{
2248 q->m_d->writeFrameToDevice(frameId, targetDevice);
2249}
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: