21#include <QCoreApplication>
27#include "pencilerror.h"
29#include "objectdata.h"
43 Q_DECLARE_TR_FUNCTIONS(
Object)
54 void createWorkingDir();
55 void deleteWorkingDir()
const;
56 void setWorkingDir(
const QString& path);
58 QString filePath()
const {
return mFilePath; }
59 void setFilePath(
const QString& strFileName) { mFilePath = strFileName; }
61 QString workingDir()
const {
return mWorkingDirPath; }
63 QString dataDir()
const {
return mDataDirPath; }
64 void setDataDir(
const QString& dirPath) { mDataDirPath = dirPath; }
66 QString mainXMLFile()
const {
return mMainXMLFile; }
67 void setMainXMLFile(
const QString& file) { mMainXMLFile = file; }
70 bool loadXML(
const QDomElement& element, ProgressCallback progressForward);
72 void paintImage(
QPainter& painter,
int frameNumber,
bool background,
bool antialiasing)
const;
78 void setColor(
int index,
const QColor& newColor);
79 void setColorRef(
int index,
const ColorRef& newColorRef);
80 void movePaletteColor(
int start,
int end);
81 void moveVectorColor(
int start,
int end);
83 void addColor(
const ColorRef& newColor) { mPalette.
append(newColor); }
84 void addColorAtIndex(
int index,
const ColorRef& newColor);
85 void removeColor(
int index);
86 bool isColorInUse(
int index)
const;
87 void renameColor(
int i,
const QString& text);
88 int getColorCount() {
return mPalette.
size(); }
89 bool importPalette(
const QString& filePath);
90 void importPaletteGPL(
QFile& file);
91 void importPalettePencil(
QFile& file);
92 void openPalette(
const QString& filePath);
94 bool exportPalette(
const QString& filePath)
const;
95 void exportPaletteGPL(
QFile& file)
const;
96 void exportPalettePencil(
QFile& file)
const;
99 void loadDefaultPalette();
106 int getLayerCount()
const;
107 Layer* getLayer(
int i)
const;
108 Layer* getLayerBelow(
int i, Layer::LAYER_TYPE type)
const;
109 Layer* findLayerByName(
const QString& strName, Layer::LAYER_TYPE type = Layer::UNDEFINED)
const;
110 Layer* findLayerById(
int layerId)
const;
111 Layer* takeLayer(
int layerId);
113 bool swapLayers(
int i,
int j);
122 bool canSwapLayers(
int layerIndexLeft,
int layerIndexRight)
const;
132 void deleteLayer(
int i);
133 void deleteLayer(
Layer*);
134 bool addLayer(
Layer* layer);
137 std::vector<T*> getLayersByType()
const
139 std::vector<T*> result;
140 for (
Layer* layer : mLayers)
142 T* t =
dynamic_cast<T*
>(layer);
151 bool transparency,
bool exportKeyframesOnly,
const QString& layerName,
bool antialiasing,
QProgressDialog* progress,
int progressMax)
const;
153 bool exportIm(
int frameStart,
const QTransform& view,
QSize cameraSize,
QSize exportSize,
const QString& filePath,
const QString& format,
bool antialiasing,
bool transparency)
const;
155 void modification() { modified =
true; }
156 bool isModified()
const {
return modified; }
157 void setModified(
bool b) { modified = b; }
159 int getUniqueLayerID();
162 const ObjectData* data()
const {
return &mData; }
165 int totalKeyFrameCount()
const;
166 void updateActiveFrames(
int frame)
const;
167 void setActiveFramePoolSize(
int sizeInMB);
178 bool modified =
false;
183 mutable std::unique_ptr<ActiveFramePool> mActiveFramePool;
ActiveFramePool implemented a LRU cache to keep tracking the most recent accessed key frames A key fr...
bool canDeleteLayer(int index) const
Allows you to check whether the layer at the given index can be deleted.
bool canSwapLayers(int layerIndexLeft, int layerIndexRight) const
Allows you to check whether two layers can be swappped, before doing the actual operation.
void append(const T &value)