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

2222 : q(parentDevice)
2223{
2224}

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

2232{
2233 return q->m_d->createFrame(copy, copySrc, offset, parentCommand);
2234}
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 2296 of file kis_paint_device.cc.

2297{
2298 return q->m_d->currentFrameId();
2299}

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

2237{
2238 return q->m_d->deleteFrame(frame, parentCommand);
2239}
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 2256 of file kis_paint_device.cc.

2257{
2258 return q->m_d->frameBounds(frameId);
2259}
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 2301 of file kis_paint_device.cc.

2302{
2303 KIS_ASSERT_RECOVER(frameId >= 0) {
2304 return q->m_d->dataManager();
2305 }
2306 return q->m_d->frameDataManager(frameId);
2307}
#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 2272 of file kis_paint_device.cc.

2273{
2274 KIS_ASSERT_RECOVER(frameId >= 0) {
2275 return KoColor(Qt::red, q->m_d->colorSpace());
2276 }
2277 return q->m_d->frameDefaultPixel(frameId);
2278}
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 2261 of file kis_paint_device.cc.

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

2227{
2228 return q->m_d->frameIds();
2229}
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 2309 of file kis_paint_device.cc.

2310{
2311 KIS_ASSERT_RECOVER_RETURN(frameId >= 0);
2312
2313 return q->m_d->invalidateFrameCache(frameId);
2314}
#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 2288 of file kis_paint_device.cc.

2289{
2290 KIS_ASSERT_RECOVER(frameId >= 0) {
2291 return false;
2292 }
2293 return q->m_d->readFrame(stream, frameId);
2294}
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 2266 of file kis_paint_device.cc.

2267{
2268 KIS_ASSERT_RECOVER_RETURN(frameId >= 0);
2269 q->m_d->setFrameDefaultPixel(defPixel, frameId);
2270}
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 2316 of file kis_paint_device.cc.

2317{
2318 KIS_ASSERT_RECOVER_RETURN(frameId >= 0);
2319 return q->m_d->setFrameOffset(frameId, offset);
2320}
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 2323 of file kis_paint_device.cc.

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

2346{
2347 return q->m_d->allDataObjects();
2348}
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 2251 of file kis_paint_device.cc.

2252{
2253 q->m_d->uploadFrame(dstFrameId, srcDevice);
2254}
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 2246 of file kis_paint_device.cc.

2247{
2248 q->m_d->uploadFrame(srcFrameId, dstFrameId, srcDevice);
2249}

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

2281{
2282 KIS_ASSERT_RECOVER(frameId >= 0) {
2283 return false;
2284 }
2285 return q->m_d->writeFrame(store, frameId);
2286}
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 2241 of file kis_paint_device.cc.

2242{
2243 q->m_d->writeFrameToDevice(frameId, targetDevice);
2244}
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: