|
Krita Source Code Documentation
|
#include <KoZoomHandler.h>
Inheritance diagram for KoZoomHandler:Public Member Functions | |
| QPointF | documentToView (const QPointF &documentPoint) const override |
| QRectF | documentToView (const QRectF &documentRect) const override |
| QSizeF | documentToView (const QSizeF &documentSize) const override |
| qreal | documentToViewX (qreal documentX) const override |
| qreal | documentToViewY (qreal documentY) const override |
| KoZoomHandler () | |
| qreal | resolutionX () const |
| qreal | resolutionY () const |
| void | setDpi (int dpiX, int dpiY) |
| void | setResolution (qreal resolutionX, qreal resolutionY) |
| void | setZoom (qreal zoom) override |
| virtual void | setZoomedResolution (qreal zoomedResolutionX, qreal zoomedResolutionY) |
| void | setZoomMarginSize (int size) |
| void | setZoomMode (KoZoomMode::Mode zoomMode) |
| qreal | unzoomItX (qreal x) const |
| qreal | unzoomItY (qreal y) const |
| QPointF | viewToDocument (const QPointF &viewPoint) const override |
| QRectF | viewToDocument (const QRectF &viewRect) const override |
| QSizeF | viewToDocument (const QSizeF &viewSize) const override |
| qreal | viewToDocumentX (qreal viewX) const override |
| qreal | viewToDocumentY (qreal viewY) const override |
| qreal | zoom () const |
| virtual void | zoom (qreal *zoomX, qreal *zoomY) const |
| void | zoom (qreal *zoomX, qreal *zoomY) const override |
| qreal | zoomedResolutionX () const |
| qreal | zoomedResolutionY () const |
| qreal | zoomFactorX () const |
| qreal | zoomFactorY () const |
| int | zoomInPercent () const |
| qreal | zoomItX (qreal z) const |
| qreal | zoomItY (qreal z) const |
| int | zoomMarginSize () const |
| KoZoomMode::Mode | zoomMode () const |
| ~KoZoomHandler () override | |
Public Member Functions inherited from KoViewConverter | |
| QTransform | documentToView () const |
| KoViewConverter () | |
| virtual KoViewTransformStillPoint | makeDocStillPoint (const QPointF &docPoint) const |
Creates a still point that links the docPoint of the image (in document pixels!) to the corresponding point on the screen (in the canvas widget). | |
| virtual KoViewTransformStillPoint | makeWidgetStillPoint (const QPointF &viewPoint) const |
Creates a still point that links the viewPoint of the widget to the corresponding point of the image. | |
| QTransform | viewToDocument () const |
| virtual QTransform | viewToWidget () const |
| virtual QTransform | widgetToView () const |
| qreal | zoom () const |
| virtual | ~KoViewConverter () |
Protected Attributes | |
| qreal | m_resolutionX |
| qreal | m_resolutionY |
| qreal | m_zoomedResolutionX |
| qreal | m_zoomedResolutionY |
| int | m_zoomMarginSize |
| KoZoomMode::Mode | m_zoomMode |
This class handles the zooming and DPI stuff (conversions between postscript pt values and pixels). If the internal data of your document does not work with postscript points (for instance raster image pixels), you need to some additional converting yourself.
An instance of KoZoomHandler operates at a given zoom and resolution so there is usually one instance of KoZoomHandler per view.
Definition at line 24 of file KoZoomHandler.h.
| KoZoomHandler::KoZoomHandler | ( | ) |
Definition at line 15 of file KoZoomHandler.cpp.
References setDpi(), setZoom(), setZoomMode(), and KoZoomMode::ZOOM_CONSTANT.
|
override |
Definition at line 32 of file KoZoomHandler.cpp.
|
overridevirtual |
Convert a coordinate in pt to pixels.
| documentPoint | the point in the document coordinate system of a KoShape. |
Reimplemented from KoViewConverter.
Definition at line 92 of file KoZoomHandler.cpp.
|
overridevirtual |
Convert a rectangle in pt to pixels.
| documentRect | the rect in the document coordinate system of a KoShape. |
Reimplemented from KoViewConverter.
Definition at line 104 of file KoZoomHandler.cpp.
|
overridevirtual |
Convert a size in pt to pixels.
| documentSize | the size in pt. |
Reimplemented from KoViewConverter.
Definition at line 122 of file KoZoomHandler.cpp.
|
overridevirtual |
Convert a single x coordinate in pt to pixels.
| documentX | the x coordinate in pt. |
Reimplemented from KoViewConverter.
Definition at line 134 of file KoZoomHandler.cpp.
References zoomItX().
|
overridevirtual |
Convert a single y coordinate in pt to pixels.
| documentY | the y coordinate in pt. |
Reimplemented from KoViewConverter.
Definition at line 139 of file KoZoomHandler.cpp.
References zoomItY().
|
inline |
Definition at line 43 of file KoZoomHandler.h.
|
inline |
Definition at line 44 of file KoZoomHandler.h.
| void KoZoomHandler::setDpi | ( | int | dpiX, |
| int | dpiY ) |
Set resolution expressed in dots-per-inch
Definition at line 36 of file KoZoomHandler.cpp.
References POINT_TO_INCH(), and setResolution().
| void KoZoomHandler::setResolution | ( | qreal | resolutionX, |
| qreal | resolutionY ) |
Set a resolution for X and Y of the output device. The zoom factor is not changed.
This number should be the result of: POINT_TO_INCH(static_cast<qreal>(DOTS_PER_INCH))
Definition at line 42 of file KoZoomHandler.cpp.
References m_resolutionX, m_resolutionY, m_zoomedResolutionX, m_zoomedResolutionY, qFuzzyCompare(), resolutionX(), resolutionY(), and zoom().
|
overridevirtual |
Change the zoom level, keeping the resolution unchanged.
| zoom | the zoom factor (e.g. 1.0 for 100%) |
Reimplemented from KoViewConverter.
Definition at line 66 of file KoZoomHandler.cpp.
References m_resolutionX, m_resolutionY, m_zoomedResolutionX, m_zoomedResolutionY, qFuzzyCompare(), KoViewConverter::setZoom(), and zoom().
|
virtual |
Set the zoomed resolution for X and Y. Compared to the setZoom... methods, this allows to set a different zoom factor for X and for Y.
Definition at line 57 of file KoZoomHandler.cpp.
References m_zoomedResolutionX, m_zoomedResolutionY, zoomedResolutionX(), and zoomedResolutionY().
| void KoZoomHandler::setZoomMarginSize | ( | int | size | ) |
|
inline |
Change the zoom mode
| zoomMode | the zoom mode. |
Definition at line 88 of file KoZoomHandler.h.
|
inline |
Definition at line 113 of file KoZoomHandler.h.
|
inline |
Definition at line 118 of file KoZoomHandler.h.
|
overridevirtual |
Convert a coordinate in pixels to pt.
| viewPoint | the point in the coordinate system of the widget, or window. |
Reimplemented from KoViewConverter.
Definition at line 98 of file KoZoomHandler.cpp.
References unzoomItX(), and unzoomItY().
|
overridevirtual |
Convert a rectangle in pixels to pt.
| viewRect | the rect in the coordinate system of the widget, or window. |
Reimplemented from KoViewConverter.
Definition at line 113 of file KoZoomHandler.cpp.
References unzoomItX(), and unzoomItY().
|
overridevirtual |
Convert a size in pixels to pt.
| viewSize | the size in pixels. |
Reimplemented from KoViewConverter.
Definition at line 128 of file KoZoomHandler.cpp.
References unzoomItX(), and unzoomItY().
|
overridevirtual |
Convert a single x coordinate in pixels to pt.
| viewX | the x coordinate in pixels. |
Reimplemented from KoViewConverter.
Definition at line 144 of file KoZoomHandler.cpp.
References unzoomItX().
|
overridevirtual |
Convert a single y coordinate in pixels to pt.
| viewY | the y coordinate in pixels. |
Reimplemented from KoViewConverter.
Definition at line 149 of file KoZoomHandler.cpp.
References unzoomItY().
| qreal KoViewConverter::zoom | ( | ) | const |
Return the current zoom level. 1.0 is 100%.
Definition at line 118 of file KoViewConverter.cpp.
|
virtual |
Retrieve the zoom levels of the individual x and y axes.
| zoomX | a pointer to a qreal which will be modified to the horizontal zoom. |
| zoomY | a pointer to a qreal which will be modified to the vertical zoom. |
Reimplemented from KoViewConverter.
Definition at line 108 of file KoViewConverter.cpp.
References KoViewConverter::documentToView(), and KoViewConverter::viewToWidget().
|
overridevirtual |
Get the zoom levels of the individual x and y axis. Copy them to the pointer parameters.
| zoomX | a pointer to a qreal which will be modified to set the horizontal zoom. |
| zoomY | a pointer to a qreal which will be modified to set the vertical zoom. |
Reimplemented from KoViewConverter.
Definition at line 154 of file KoZoomHandler.cpp.
|
inline |
Definition at line 35 of file KoZoomHandler.h.
|
inline |
Definition at line 41 of file KoZoomHandler.h.
|
inline |
Zoom factor for X. Equivalent to zoomedResolutionX()/resolutionX()
Definition at line 49 of file KoZoomHandler.h.
|
inline |
Zoom factor for Y. Equivalent to zoomedResolutionY()/resolutionY()
Definition at line 54 of file KoZoomHandler.h.
|
inline |
Definition at line 93 of file KoZoomHandler.h.
References KoViewConverter::zoom().
|
inline |
Definition at line 102 of file KoZoomHandler.h.
|
inline |
Definition at line 107 of file KoZoomHandler.h.
| int KoZoomHandler::zoomMarginSize | ( | ) | const |
Definition at line 87 of file KoZoomHandler.cpp.
References m_zoomMarginSize.
|
inline |
Definition at line 98 of file KoZoomHandler.h.
|
protected |
Definition at line 208 of file KoZoomHandler.h.
|
protected |
Definition at line 209 of file KoZoomHandler.h.
|
protected |
Definition at line 210 of file KoZoomHandler.h.
|
protected |
Definition at line 211 of file KoZoomHandler.h.
|
protected |
Definition at line 213 of file KoZoomHandler.h.
|
protected |
Definition at line 206 of file KoZoomHandler.h.