30#include <QPixmapCache>
35#include "bitmapimage.h"
36#include "canvaspainter.h"
37#include "overlaypainter.h"
38#include "preferencemanager.h"
39#include "strokemanager.h"
40#include "selectionpainter.h"
41#include "camerapainter.h"
56 friend class EditTool;
65 void setEditor(
Editor* e) { mEditor = e; }
66 StrokeManager* getStrokeManager()
const {
return mStrokeManager.get(); }
67 Editor* editor()
const {
return mEditor; }
69 void deleteSelection();
70 void displaySelectionProperties();
72 void applyTransformedSelection();
73 void cancelTransformedSelection();
75 bool isLayerPaintable()
const;
79 void setEffect(SETTING e,
bool isOn);
81 LayerVisibility getLayerVisibility()
const {
return mLayerVisibility; }
82 qreal getCurveSmoothing()
const {
return mCurveSmoothingLevel; }
83 bool usePressure()
const {
return mUsePressure; }
84 bool makeInvisible()
const {
return mMakeInvisible; }
86 QRect getCameraRect();
134 void flipSelection(
bool flipVertical);
137 BaseTool* getTool(ToolType eToolMode);
138 void setCurrentTool(ToolType eToolMode);
140 void floodFillError(
int errorType);
142 bool isMouseInUse()
const {
return mMouseInUse; }
143 bool isTabletInUse()
const {
return mTabletInUse; }
144 bool isPointerInUse()
const {
return mMouseInUse || mTabletInUse; }
147 void keyEventForSelection(
QKeyEvent* event);
150 void multiLayerOnionSkinChanged(
bool);
151 void refreshPreview();
152 void selectionUpdated();
156 void setCurveSmoothing(
int);
157 void toggleThinLines();
158 void toggleOutlines();
159 void increaseLayerVisibilityIndex();
160 void decreaseLayerVisibilityIndex();
161 void setLayerVisibility(LayerVisibility visibility);
163 void updateToolCursor();
164 void paletteColorChanged(
QColor);
166 void showLayerNotVisibleWarning();
169 bool event(
QEvent *event)
override;
177 void keyReleaseEvent(
QKeyEvent*)
override;
185 void drawPen(
QPointF thePoint, qreal brushWidth,
QColor fillColor,
bool useAA =
true);
186 void drawPencil(
QPointF thePoint, qreal brushWidth, qreal fixedBrushFeather,
QColor fillColor, qreal opacity);
187 void drawBrush(
QPointF thePoint, qreal brushWidth, qreal offset,
QColor fillColor, qreal opacity,
bool usingFeather =
true,
bool useAA =
false);
188 void blurBrush(
BitmapImage *bmiSource_,
QPointF srcPoint_,
QPointF thePoint_, qreal brushWidth_, qreal offset_, qreal opacity_);
189 void liquifyBrush(
BitmapImage *bmiSource_,
QPointF srcPoint_,
QPointF thePoint_, qreal brushWidth_, qreal offset_, qreal opacity_);
191 void paintBitmapBuffer();
192 void paintCanvasCursor(
QPainter& painter);
193 void clearBitmapBuffer();
194 void setGaussianGradient(
QGradient &gradient,
QColor color, qreal opacity, qreal offset);
200 void updateCanvasCursor();
232 void prepOverlays(
int frame);
233 void prepCameraPainter(
int frame);
236 void settingUpdated(SETTING setting);
237 void paintSelectionVisuals(
QPainter &painter);
242 MoveMode mMoveMode = MoveMode::NONE;
244 std::unique_ptr<StrokeManager> mStrokeManager;
246 Editor* mEditor =
nullptr;
249 bool mIsSimplified =
false;
250 bool mShowThinLines =
false;
251 bool mQuickSizing =
true;
252 LayerVisibility mLayerVisibility = LayerVisibility::ALL;
253 bool mUsePressure =
true;
254 bool mMakeInvisible =
false;
255 bool mToolCursors =
true;
256 qreal mCurveSmoothingLevel = 0.0;
257 bool mMultiLayerOnionSkin =
false;
259 int mDeltaFactor = 1;
270 void tabletReleaseEventFired();
271 bool mKeyboardInUse =
false;
272 bool mMouseInUse =
false;
273 bool mMouseRightButtonInUse =
false;
274 bool mTabletInUse =
false;
275 qreal mDevicePixelRatio = 1.;
278 void handleDoubleClick();
279 bool mIsFirstClick =
true;
280 int mDoubleClickMillis = 0;
282 const int DOUBLE_CLICK_THRESHOLD = 500;
283 QTimer* mDoubleClickTimer =
nullptr;
284 int mTabletReleaseMillisAgo;
285 const int MOUSE_FILTER_THRESHOLD = 200;
287 QTimer* mMouseFilterTimer =
nullptr;
void onScrubbed(int frameNumber)
Frame scrubbed, invalidate relevant cache.
void onToolPropertyUpdated(ToolType, ToolPropertyType)
Tool property updated, invalidate cache and frame if needed.
void onViewChanged()
View updated, invalidate relevant cache.
void onObjectLoaded()
Object updated, invalidate all cache.
void invalidateCacheForDirtyFrames()
invalidate cache for dirty keyframes.
void handleDrawingOnEmptyFrame()
Call this when starting to use a paint tool.
void invalidatePainterCaches()
Invalidate the layer pixmap and camera painter caches.
void invalidateOnionSkinsCacheAround(int frame)
invalidate onion skin cache around frame
void onSelectionChanged()
Selection was changed, keep cache.
void onOnionSkinTypeChanged()
Onion skin type changed, all frames will be affected.
void onFramesModified()
Multiple frames modified, invalidate cache for affected frames.
void onToolChanged(ToolType)
Tool changed, invalidate cache and frame if needed.
void onPlayStateChanged()
Playstate changed, invalidate relevant cache.
void updateCurrentFrame()
Update current frame.
void invalidateAllCache()
Invalidate all cache.
void invalidateCacheForFrame(int frameNumber)
Invalidate cache for the given frame.
void updateFrame(int frame)
Update frame.
void setModified(int layerNumber, int frameNumber)
Set frame on layer to modified and invalidate current frame cache.
void onLayerChanged()
Layer changed, invalidate relevant cache.
void onFrameModified(int frameNumber)
Frame modified, invalidate cache for frame if any.
QObject * parent() const const