19 #ifndef SCRIBBLEAREA_H
20 #define SCRIBBLEAREA_H
30 #include <QPixmapCache>
34 #include "pencildef.h"
35 #include "bitmapimage.h"
36 #include "canvaspainter.h"
37 #include "preferencemanager.h"
38 #include "strokemanager.h"
39 #include "selectionpainter.h"
54 friend class EditTool;
63 void setEditor(
Editor* e) { mEditor = e; }
64 StrokeManager* getStrokeManager()
const {
return mStrokeManager.get(); }
65 Editor* editor()
const {
return mEditor; }
67 void deleteSelection();
68 void applySelectionChanges();
69 void displaySelectionProperties();
71 void paintTransformedSelection();
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; }
89 void updateCurrentFrame();
94 void updateFrame(
int frame);
95 void updateOnionSkinsAround(
int frame);
96 void updateAllFrames();
97 void updateAllVectorLayersAtCurrentFrame();
98 void updateAllVectorLayersAt(
int frameNumber);
100 void setModified(
int layerNumber,
int frameNumber);
103 void flipSelection(
bool flipVertical);
106 BaseTool* getTool(ToolType eToolMode);
107 void setCurrentTool(ToolType eToolMode);
108 void setTemporaryTool(ToolType eToolMode);
111 void floodFillError(
int errorType);
113 bool isMouseInUse()
const {
return mMouseInUse; }
114 bool isTabletInUse()
const {
return mTabletInUse; }
115 bool isPointerInUse()
const {
return mMouseInUse || mTabletInUse; }
116 bool isTemporaryTool()
const {
return mInstantTool; }
128 void keyEventForSelection(
QKeyEvent* event);
131 void modification(
int);
132 void multiLayerOnionSkinChanged(
bool);
133 void refreshPreview();
137 void setCurveSmoothing(
int);
138 void toggleThinLines();
139 void toggleOutlines();
140 void increaseLayerVisibilityIndex();
141 void decreaseLayerVisibilityIndex();
142 void setLayerVisibility(LayerVisibility visibility);
144 void updateToolCursor();
145 void paletteColorChanged(
QColor);
147 void showLayerNotVisibleWarning();
159 void keyReleaseEvent(
QKeyEvent*)
override;
167 void drawPen(
QPointF thePoint, qreal brushWidth,
QColor fillColor,
bool useAA =
true);
168 void drawPencil(
QPointF thePoint, qreal brushWidth, qreal fixedBrushFeather,
QColor fillColor, qreal opacity);
169 void drawBrush(
QPointF thePoint, qreal brushWidth, qreal offset,
QColor fillColor, qreal opacity,
bool usingFeather =
true,
bool useAA =
false);
170 void blurBrush(
BitmapImage *bmiSource_,
QPointF srcPoint_,
QPointF thePoint_, qreal brushWidth_, qreal offset_, qreal opacity_);
171 void liquifyBrush(
BitmapImage *bmiSource_,
QPointF srcPoint_,
QPointF thePoint_, qreal brushWidth_, qreal offset_, qreal opacity_);
173 void paintBitmapBuffer();
174 void paintBitmapBufferRect(
const QRect&
rect);
175 void paintCanvasCursor(
QPainter& painter);
176 void clearBitmapBuffer();
177 void refreshBitmap(
const QRectF& rect,
int rad);
178 void refreshVector(
const QRectF& rect,
int rad);
179 void setGaussianGradient(
QGradient &gradient,
QColor color, qreal opacity, qreal offset);
185 void updateCanvasCursor();
197 void prepCanvas(
int frame,
QRect rect);
198 void drawCanvas(
int frame,
QRect rect);
199 void settingUpdated(SETTING setting);
200 void paintSelectionVisuals(
QPainter &painter);
205 MoveMode mMoveMode = MoveMode::NONE;
206 ToolType mPrevTemporalToolType = ERASER;
207 ToolType mPrevToolType = PEN;
211 std::unique_ptr<StrokeManager> mStrokeManager;
213 Editor* mEditor =
nullptr;
215 bool mIsSimplified =
false;
216 bool mShowThinLines =
false;
217 bool mQuickSizing =
true;
218 LayerVisibility mLayerVisibility = LayerVisibility::ALL;
219 bool mUsePressure =
true;
220 bool mMakeInvisible =
false;
221 bool mToolCursors =
true;
222 qreal mCurveSmoothingLevel = 0.0;
223 bool mMultiLayerOnionSkin =
false;
227 bool mKeyboardInUse =
false;
228 bool mMouseInUse =
false;
229 bool mMouseRightButtonInUse =
false;
230 bool mTabletInUse =
false;
233 void handleDoubleClick();
234 bool mIsFirstClick =
true;
235 int mDoubleClickMillis = 0;
237 const int DOUBLE_CLICK_THRESHOLD = 500;
238 QTimer* mDoubleClickTimer =
nullptr;
244 bool mInstantTool =
false;
virtual bool event(QEvent *e)
void updateAllFramesIfNeeded()
Check if the cache should be invalidated for all frames since the last paint operation.
void handleDrawingOnEmptyFrame()
Call this when starting to use a paint tool.
bool isAffectedByActiveLayer() const
Check if the content of the canvas depends on the active layer.
QObject * parent() const const