Krita Source Code Documentation
Loading...
Searching...
No Matches
kis_canvas2.h
Go to the documentation of this file.
1/* This file is part of the KDE project
2 * SPDX-FileCopyrightText: 2006, 2010 Boudewijn Rempt <boud@valdyas.org>
3 * SPDX-FileCopyrightText: 2011 Silvio Heinrich <plassy@web.de>
4 *
5 * SPDX-License-Identifier: GPL-2.0-or-later
6 */
7
8#ifndef KIS_CANVAS_H
9#define KIS_CANVAS_H
10
11#include <QObject>
12#include <QWidget>
13#include <QSize>
14#include <QString>
15
16#include <KoConfig.h>
18#include <KoCanvasBase.h>
19#include <kritaui_export.h>
20#include <kis_types.h>
21#include <KoPointerEvent.h>
22
23#include "opengl/kis_opengl.h"
24
25#include "kis_ui_types.h"
31#include "KisWraparoundAxis.h"
32
33class KoToolProxy;
35
36
37class KisViewManager;
42class KisView;
43class KisInputManager;
47class KoViewConverter;
49class KisPopupPalette;
50
51
57class KRITAUI_EXPORT KisCanvas2 : public KoCanvasBase
58{
59
60 Q_OBJECT
61
62public:
63
71 KisCanvas2(KisCoordinatesConverter *coordConverter, KoCanvasResourceProvider *resourceManager, KisMainWindow *mainWindow, KisView *view, KoShapeControllerBase *sc);
72
73 ~KisCanvas2() override;
74
75 void disconnectCanvasObserver(QObject *object) override;
76
77public: // KoCanvasBase implementation
78
79 bool canvasIsOpenGL() const override;
80
82
83 void gridSize(QPointF *offset, QSizeF *spacing) const override;
84
85 bool snapToGrid() const override;
86
87 // This method only exists to support flake-related operations
88 void addCommand(KUndo2Command *command) override;
89
90 QPoint documentOrigin() const override;
91 QPoint documentOffset() const;
92
99 KoShapeManager * shapeManager() const override;
100
106
110 KoShapeManager *globalShapeManager() const;
111
112 KoShape *currentShapeManagerOwnerShape() const override;
114
119 KoShapeManager *localShapeManager() const;
120
121
122 void updateCanvas(const QRectF& rc) override;
123
125 const KoViewConverter *viewConverter() const override;
126 KoViewConverter *viewConverter() override;
127
128 QWidget* canvasWidget() override;
129
130 const QWidget* canvasWidget() const override;
131
132 KoUnit unit() const override;
133
134 KoToolProxy* toolProxy() const override;
135
136 // FIXME:
137 // Temporary! Either get the current layer and image from the
138 // resource provider, or use this, which gets them from the
139 // current shape selection.
140 KisImageWSP currentImage() const;
141
148 KisInputManager* globalInputManager() const;
149
150 KisPaintingAssistantsDecorationSP paintingAssistantsDecoration() const;
151 KisReferenceImagesDecorationSP referenceImagesDecoration() const;
152
153public: // KisCanvas2 methods
154
155 KisImageWSP image() const;
156 KisViewManager* viewManager() const;
157 QPointer<KisView> imageView() const;
158
160 void addDecoration(KisCanvasDecorationSP deco);
161 KisCanvasDecorationSP decoration(const QString& id) const;
162
163 void setDisplayFilter(QSharedPointer<KisDisplayFilter> displayFilter);
164 QSharedPointer<KisDisplayFilter> displayFilter() const;
165
167 KisExposureGammaCorrectionInterface* exposureGammaCorrectionInterface() const;
168
174 void fetchProofingOptions();
175 void updateProofingState();
176 KisProofingConfigurationSP proofingConfiguration() const;
177
183 void setProofingConfigUpdated(bool updated);
184
191
192 void setCursor(const QCursor &cursor) override;
194 KisCanvasAnimationState *animationState() const;
195 void refetchDataFromImage();
196
201 QRect regionOfInterest() const;
202
207 void setRenderingLimit(const QRect &rc);
208
212 QRect renderingLimit() const;
213
215
220
226 QString colorManagementReport() const;
227
228Q_SIGNALS:
230
232 void sigContinueResizeImage(qint32 w, qint32 h);
233
235
236 // emitted whenever the canvas widget thinks sketch should update
237 void updateCanvasRequested(const QRect &rc);
238
239 void sigRegionOfInterestChanged(const QRect &roi);
240
241public Q_SLOTS:
242
244 void updateCanvas();
245
246 void updateCanvasProjection(const QRectF &docRect);
247 void updateCanvasDecorations();
248 void updateCanvasDecorations(const QRectF &docRect);
249 void updateCanvasToolOutlineDoc(const QRectF &docRect);
250 void updateCanvasToolOutlineWdg(const QRect &widgetRect);
251 void updateCanvasScene();
252
253 void startResizingImage();
254 void finishResizingImage(qint32 w, qint32 h);
255
257 qreal rotationAngle() const;
259 bool xAxisMirrored() const;
260 bool yAxisMirrored() const;
261 void slotSoftProofing();
262 void slotGamutCheck();
263 void slotChangeGlobalProofingConfig();
264 void slotChangeProofingConfig();
265 void slotPopupPaletteRequestedZoomChange(int zoom);
266
267 void channelSelectionChanged();
268
269 void startUpdateInPatches(const QRect &imageRect);
270
271 void slotTrySwitchShapeManager();
272
276 void slotConfigChanged();
277
278 void slotScreenChanged(QScreen *screen);
279
280
281private Q_SLOTS:
282
285 void startUpdateCanvasProjection(const QRect & rc);
286 void updateCanvasProjection();
287
288 void slotBeginUpdatesBatch();
289 void slotEndUpdatesBatch();
290 void slotSetLodUpdatesBlocked(bool value);
291
292 void slotEffectiveZoomChanged(qreal newZoom);
293 void slotCanvasStateChanged();
294
295 void slotSelectionChanged();
296
297 void slotDoCanvasUpdate();
298
299 void bootstrapFinished();
300
301 void slotUpdateRegionOfInterest();
302 void slotUpdateReferencesBounds();
303
304 void slotImageColorSpaceChanged();
305
306public:
307 // interface for KisCanvasController only
308 void setWrapAroundViewingMode(bool value);
309 bool wrapAroundViewingMode() const;
310
311 void setWrapAroundViewingModeAxis(WrapAroundAxis value);
312 WrapAroundAxis wrapAroundViewingModeAxis() const;
313
314 void setLodPreferredInCanvas(bool value);
315 bool lodPreferredInCanvas() const;
316
317 void initializeImage();
318 void disconnectImage();
319
320 void setFavoriteResourceManager(KisFavoriteResourceManager* favoriteResourceManager);
321
322private:
323 Q_DISABLE_COPY(KisCanvas2)
324
325 void requestCanvasUpdateMaybeCompressed();
326 void connectCurrentCanvas();
327 void createCanvas(bool useOpenGL);
328 void createQPainterCanvas();
329 void createOpenGLCanvas();
330 void updateCanvasWidgetImpl(const QRect &rc = QRect());
331 void setCanvasWidget(KisAbstractCanvasWidget *widget);
332 void resetCanvas(bool useOpenGL);
333 void slotSurfaceFormatChanged(const KisDisplayConfig &config);
334
335 void notifyLevelOfDetailChange();
336
337 // Completes construction of canvas.
338 // To be called by KisView in its constructor, once it has been setup enough
339 // (to be defined what that means) for things KisCanvas2 expects from KisView
340 // TODO: see to avoid that
341 void setup();
342
343 void initializeFpsDecoration();
344
345private:
346 friend class KisView; // calls setup()
347 class KisCanvas2Private;
348 KisCanvas2Private * const m_d;
349};
350
351#endif
float value(const T *src, size_t ch)
KisMagneticGraph::vertex_descriptor source(typename KisMagneticGraph::edge_descriptor e, KisMagneticGraph g)
WrapAroundAxis
bool proofingConfigUpdated()
proofingConfigUpdated ask the canvas whether or not it updated the proofing config.
KisCanvas2Private *const m_d
KoSelectedShapesProxy * selectedShapesProxy() const override
const KisCoordinatesConverter * coordinatesConverter() const
const QWidget * canvasWidget() const override
void sigCanvasStateChanged()
void sigContinueResizeImage(qint32 w, qint32 h)
KisPopupPalette * popupPalette()
KoShapeManager * shapeManager() const override
QRect renderingLimit() const
KisOpenGL::FilterMode openGLFilterMode() const
KisAnimationFrameCacheSP frameCache() const
QRect regionOfInterest() const
QWidget * canvasWidget() override
KoToolProxy * toolProxy() const override
void sigCanvasEngineChanged()
void sigRegionOfInterestChanged(const QRect &roi)
KisInputActionGroupsMaskInterface::SharedInterface inputActionGroupsMaskInterface()
KisDisplayColorConverter * displayColorConverter() const
void sigCanvasCacheUpdated()
void updateCanvasRequested(const QRect &rc)
The KisCanvasAnimationState class stores all of the canvas-specific animation state.
KisDisplayConfig This class keeps track of the color management configuration for image to display....
The KisDisplayFilter class is the base class for filters that are applied by the canvas to the projec...
Central object to manage canvas input.
Main window for Krita.
virtual KoShape * currentShapeManagerOwnerShape() const
the shape that owns the currently active shape manager
virtual void setCurrentShapeManagerOwnerShape(KoShape *source)
sets the group shape that is supposed to be "entered"
virtual void disconnectCanvasObserver(QObject *object)
virtual void setCursor(const QCursor &cursor)=0
virtual void gridSize(QPointF *offset, QSizeF *spacing) const =0
virtual bool canvasIsOpenGL() const
virtual KoUnit unit() const =0
virtual QPoint documentOrigin() const
virtual const KoViewConverter * viewConverter() const =0
virtual void updateCanvas(const QRectF &rc)=0
virtual void addCommand(KUndo2Command *command)=0
virtual bool snapToGrid() const =0
The KoSelectedShapesProxy class is a special interface of KoCanvasBase to have a stable connection to...