Krita

Canvas.h
1/*
2 * SPDX-FileCopyrightText: 2016 Boudewijn Rempt <boud@valdyas.org>
3 *
4 * SPDX-License-Identifier: LGPL-2.0-or-later
5 */
6#ifndef LIBKIS_CANVAS_H
7#define LIBKIS_CANVAS_H
8
9#include <QObject>
10
11#include "kritalibkis_export.h"
12#include "libkis.h"
13
14class KoCanvasBase;
15class KisDisplayColorConverter;
16
17/**
18 * Canvas wraps the canvas inside a view on an image/document.
19 * It is responsible for the view parameters of the document:
20 * zoom, rotation, mirror, wraparound and instant preview.
21 */
22class KRITALIBKIS_EXPORT Canvas : public QObject
23{
24 Q_OBJECT
25
26public:
27 explicit Canvas(KoCanvasBase *canvas, QObject *parent = 0);
28 ~Canvas() override;
29
30 bool operator==(const Canvas &other) const;
31 bool operator!=(const Canvas &other) const;
32
33public Q_SLOTS:
34
35 /**
36 * @return the current zoomlevel. 1.0 is 100%.
37 */
38 qreal zoomLevel() const;
39
40 /**
41 * @brief setZoomLevel set the zoomlevel to the given @p value. 1.0 is 100%.
42 */
43 void setZoomLevel(qreal value);
44
45 /**
46 * @brief resetZoom set the zoomlevel to 100%
47 */
48 void resetZoom();
49
50 /**
51 * @return the rotation of the canvas in degrees.
52 */
53 qreal rotation() const;
54
55 /**
56 * @brief setRotation set the rotation of the canvas to the given @param angle in degrees.
57 */
58 void setRotation(qreal angle);
59
60 /**
61 * @brief resetRotation reset the canvas rotation.
62 */
63 void resetRotation();
64
65 /**
66 * @return return true if the canvas is mirrored, false otherwise.
67 */
68 bool mirror() const;
69
70 /**
71 * @brief setMirror turn the canvas mirroring on or off depending on @param value
72 */
73 void setMirror(bool value);
74
75 /**
76 * @return true if the canvas is in wraparound mode, false if not. Only when OpenGL is enabled,
77 * is wraparound mode available.
78 */
79 bool wrapAroundMode() const;
80
81 /**
82 * @brief setWrapAroundMode set wraparound mode to @param enable
83 */
84 void setWrapAroundMode(bool enable);
85
86 /**
87 * @return true if the canvas is in Instant Preview mode, false if not. Only when OpenGL is enabled,
88 * is Instant Preview mode available.
89 */
90 bool levelOfDetailMode() const;
91
92 /**
93 * @brief setLevelOfDetailMode sets Instant Preview to @param enable
94 */
95 void setLevelOfDetailMode(bool enable);
96
97 /**
98 * @return the view that holds this canvas
99 */
100 View *view() const;
101
102
103private:
104
105 friend class ManagedColor;
106
107 KisDisplayColorConverter *displayColorConverter() const;
108
109 struct Private;
110 Private *const d;
111
112};
113
114#endif // LIBKIS_CANVAS_H
Canvas wraps the canvas inside a view on an image/document.
Definition Canvas.h:23
The ManagedColor class is a class to handle colors that are color managed.
View represents one view on a document.
Definition View.h:25
Q_SLOTSQ_SLOTS
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 4 2024 16:35:00 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.