Krita Source Code Documentation
Loading...
Searching...
No Matches
KisCanvasState.cpp
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2025 Dmitry Kazakov <dimula73@gmail.com>
3 *
4 * SPDX-License-Identifier: GPL-2.0-or-later
5 */
6
7#include "KisCanvasState.h"
9#include "KoZoomState.h"
10
28
30 KisCanvasState state;
31 state.zoom = converter.zoom();
32 state.effectiveZoom = converter.effectiveZoom();
33 state.zoomMode = converter.zoomMode();
34 state.rotation = converter.rotationAngle();
35 state.mirrorHorizontally = converter.xAxisMirrored();
36 state.mirrorVertically = converter.yAxisMirrored();
37 state.documentOffset = converter.documentOffset();
38 state.documentOffsetF = converter.documentOffsetF();
39 state.viewportOffsetF = converter.imageRectInViewportPixels().topLeft();
40 state.minimumOffset = converter.minimumOffset();
41 state.maximumOffset = converter.maximumOffset();
42 state.canvasSize = converter.getCanvasWidgetSize();
43 state.minimumZoom = converter.minZoom();
44 state.maximumZoom = converter.maxZoom();
46
47 if (state.imageRectInWidgetPixels.topLeft() != -state.documentOffsetF) {
48 qWarning() << "The imageRectInWidgetPixels topLeft() does not match the documentOffsetF!";
49 qWarning() << " imageRectInWidgetPixels:" << state.imageRectInWidgetPixels;
50 qWarning() << " documentOffsetF:" << state.documentOffsetF;
51 }
52
53 return state;
54}
55
57 KoZoomState state;
58 state.mode = zoomMode;
59 state.zoom = zoom;
60 state.minZoom = minimumZoom;
61 state.maxZoom = maximumZoom;
62 return state;
63}
QRectF imageRectInWidgetPixels
KoZoomMode::Mode zoomMode
KoZoomState zoomState() const
static KisCanvasState fromConverter(const KisCoordinatesConverter &converter)
QPointF documentOffsetF
QPointF viewportOffsetF
bool operator==(const KisCanvasState &other) const
KoZoomMode::Mode zoomMode() const
void zoom(qreal *zoomX, qreal *zoomY) const override
KoZoomMode::Mode mode
Definition KoZoomState.h:24
qreal maxZoom
Definition KoZoomState.h:27
qreal minZoom
Definition KoZoomState.h:26
static bool qFuzzyCompare(half p1, half p2)