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
129
130 QWidget* canvasWidget() override;
131
132 const QWidget* canvasWidget() const override;
133
134 KoUnit unit() const override;
135
136 KoToolProxy* toolProxy() const override;
137
138 // FIXME:
139 // Temporary! Either get the current layer and image from the
140 // resource provider, or use this, which gets them from the
141 // current shape selection.
142 KisImageWSP currentImage() const;
143
150 KisInputManager* globalInputManager() const;
151
152 KisPaintingAssistantsDecorationSP paintingAssistantsDecoration() const;
153 KisReferenceImagesDecorationSP referenceImagesDecoration() const;
154
155public: // KisCanvas2 methods
156
157 KisImageWSP image() const;
158 KisViewManager* viewManager() const;
159 QPointer<KisView> imageView() const;
160
162 void addDecoration(KisCanvasDecorationSP deco);
163 KisCanvasDecorationSP decoration(const QString& id) const;
164
165 void setDisplayFilter(QSharedPointer<KisDisplayFilter> displayFilter);
166 QSharedPointer<KisDisplayFilter> displayFilter() const;
167
169 KisExposureGammaCorrectionInterface* exposureGammaCorrectionInterface() const;
170
176 void fetchProofingOptions();
177 void updateProofingState();
178 KisProofingConfigurationSP proofingConfiguration() const;
179
185 void setProofingConfigUpdated(bool updated);
186
193
194 void setCursor(const QCursor &cursor) override;
196 KisCanvasAnimationState *animationState() const;
197 void refetchDataFromImage();
198
203 QRect regionOfInterest() const;
204
209 void setRenderingLimit(const QRect &rc);
210
214 QRect renderingLimit() const;
215
217
222
228 QString colorManagementReport() const;
229
230Q_SIGNALS:
232
234 void sigContinueResizeImage(qint32 w, qint32 h);
235
237
238 // emitted whenever the canvas widget thinks sketch should update
239 void updateCanvasRequested(const QRect &rc);
240
241 void sigRegionOfInterestChanged(const QRect &roi);
242
243public Q_SLOTS:
244
246 void updateCanvas();
247
248 void updateCanvasProjection(const QRectF &docRect);
249 void updateCanvasDecorations();
250 void updateCanvasDecorations(const QRectF &docRect);
251 void updateCanvasToolOutlineDoc(const QRectF &docRect);
252 void updateCanvasToolOutlineWdg(const QRect &widgetRect);
253 void updateCanvasScene();
254
255 void startResizingImage();
256 void finishResizingImage(qint32 w, qint32 h);
257
259 qreal rotationAngle() const;
261 bool xAxisMirrored() const;
262 bool yAxisMirrored() const;
263 void slotSoftProofing();
264 void slotGamutCheck();
265 void slotChangeGlobalProofingConfig();
266 void slotChangeProofingConfig();
267 void slotPopupPaletteRequestedZoomChange(int zoom);
268
269 void channelSelectionChanged();
270
271 void startUpdateInPatches(const QRect &imageRect);
272
273 void slotTrySwitchShapeManager();
274
278 void slotConfigChanged();
279
280 void slotScreenChanged(QScreen *screen);
281
282
283private Q_SLOTS:
284
287 void startUpdateCanvasProjection(const QRect & rc);
288 void updateCanvasProjection();
289
290 void slotBeginUpdatesBatch();
291 void slotEndUpdatesBatch();
292 void slotSetLodUpdatesBlocked(bool value);
293
294 void slotEffectiveZoomChanged(qreal newZoom);
295 void slotCanvasStateChanged();
296
297 void slotSelectionChanged();
298
299 void slotDoCanvasUpdate();
300
301 void bootstrapFinished();
302
303 void slotUpdateRegionOfInterest();
304 void slotUpdateReferencesBounds();
305
306 void slotImageColorSpaceChanged();
307
308public:
309 // interface for KisCanvasController only
310 void setWrapAroundViewingMode(bool value);
311 bool wrapAroundViewingMode() const;
312
313 void setWrapAroundViewingModeAxis(WrapAroundAxis value);
314 WrapAroundAxis wrapAroundViewingModeAxis() const;
315
316 void setLodPreferredInCanvas(bool value);
317 bool lodPreferredInCanvas() const;
318
319 void initializeImage();
320 void disconnectImage();
321
322 void setFavoriteResourceManager(KisFavoriteResourceManager* favoriteResourceManager);
323
324private:
325 Q_DISABLE_COPY(KisCanvas2)
326
327 void requestCanvasUpdateMaybeCompressed();
328 void connectCurrentCanvas();
329 void createCanvas(bool useOpenGL);
330 void createQPainterCanvas();
331 void createOpenGLCanvas();
332 void updateCanvasWidgetImpl(const QRect &rc = QRect());
333 void setCanvasWidget(KisAbstractCanvasWidget *widget);
334 void resetCanvas(bool useOpenGL);
335 void slotSurfaceFormatChanged(const KisDisplayConfig &config);
336
337 void notifyLevelOfDetailChange();
338
339 // Completes construction of canvas.
340 // To be called by KisView in its constructor, once it has been setup enough
341 // (to be defined what that means) for things KisCanvas2 expects from KisView
342 // TODO: see to avoid that
343 void setup();
344
345 void initializeFpsDecoration();
346
347private:
348 friend class KisView; // calls setup()
349 class KisCanvas2Private;
350 KisCanvas2Private * const m_d;
351};
352
353#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 KoColorDisplayRendererInterface * displayRendererInterface() const
displayRendererInterface The display renderer interface has a number of color conversion functions wh...
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...