|
Krita Source Code Documentation
|
#include <KisImageResolutionProxy.h>
Inheritance diagram for KisImageResolutionProxy:Classes | |
| struct | Private |
Public Member Functions | |
| KisImageResolutionProxySP | cloneDetached () const |
| bool | compareResolution (const KisImageResolutionProxy &rhs) const |
| KisImageResolutionProxySP | createOrCloneDetached (KisImageWSP image) const |
| KisImageResolutionProxy () | |
| KisImageResolutionProxy (const KisImageResolutionProxy &rhs) | |
| KisImageResolutionProxy (KisImageWSP image) | |
| qreal | xRes () const |
| qreal | yRes () const |
| ~KisImageResolutionProxy () | |
Static Public Member Functions | |
| static KisImageResolutionProxySP | identity () |
Private Attributes | |
| QScopedPointer< Private > | m_d |
KisImageResolutionProxy is a simple interface class that keeps a link to the resolution of KisImage. When KisImage is destroyed, the proxy still stores the "last known" image resolution and returns that to the user.
The proxy may also be in a detached state, that is, unconnected to any image. Then is stored the "last known image resolution value".
Definition at line 29 of file KisImageResolutionProxy.h.
| KisImageResolutionProxy::KisImageResolutionProxy | ( | ) |
Definition at line 63 of file KisImageResolutionProxy.cpp.
| KisImageResolutionProxy::KisImageResolutionProxy | ( | KisImageWSP | image | ) |
Definition at line 68 of file KisImageResolutionProxy.cpp.
| KisImageResolutionProxy::KisImageResolutionProxy | ( | const KisImageResolutionProxy & | rhs | ) |
Definition at line 73 of file KisImageResolutionProxy.cpp.
| KisImageResolutionProxy::~KisImageResolutionProxy | ( | ) |
Definition at line 79 of file KisImageResolutionProxy.cpp.
| KisImageResolutionProxySP KisImageResolutionProxy::cloneDetached | ( | ) | const |
Returns a copy of this proxy that stores the same resolution, but is detached from the image. That is, when the image changes its resolution any time in the future, this proxy will no react on that.
Definition at line 100 of file KisImageResolutionProxy.cpp.
References KisImageResolutionProxy().
| bool KisImageResolutionProxy::compareResolution | ( | const KisImageResolutionProxy & | rhs | ) | const |
Compare resolution of (*this) and rhs
Definition at line 93 of file KisImageResolutionProxy.cpp.
References qFuzzyCompare(), xRes(), and yRes().
| KisImageResolutionProxySP KisImageResolutionProxy::createOrCloneDetached | ( | KisImageWSP | image | ) | const |
Helper function that checks if the passed image is not null and creates a resolution proxy for that. If the passed image is null, then a detached clone of (*this) is returned.
The function is used in layers, when they are detached from the image (layer->setImage(nullptr)). In such a case it is useful to keep the old resolution stored in a detached proxy, other than resetting it to default. It allows avoiding unnecessary updates.
Definition at line 107 of file KisImageResolutionProxy.cpp.
References cloneDetached(), KisImageResolutionProxy(), and toQShared().
|
static |
Return an identity resolution proxy that returns 1.0 for both, xRes() and yRes(). Used as a fallback proxy mostly.
Definition at line 112 of file KisImageResolutionProxy.cpp.
| qreal KisImageResolutionProxy::xRes | ( | ) | const |
| qreal KisImageResolutionProxy::yRes | ( | ) | const |
|
private |
Definition at line 77 of file KisImageResolutionProxy.h.