Krita Source Code Documentation
Loading...
Searching...
No Matches
KisSelectionDefaultBoundsBase Class Referenceabstract

#include <kis_default_bounds.h>

+ Inheritance diagram for KisSelectionDefaultBoundsBase:

Public Member Functions

QRect bounds () const override
 
int currentLevelOfDetail () const override
 
int currentTime () const override
 
bool externalFrameActive () const override
 
QRect imageBorderRect () const override
 
 KisSelectionDefaultBoundsBase ()
 
voidsourceCookie () const override
 
bool wrapAroundMode () const override
 
WrapAroundAxis wrapAroundModeAxis () const override
 
 ~KisSelectionDefaultBoundsBase () override
 
- Public Member Functions inherited from KisDefaultBoundsBase
virtual ~KisDefaultBoundsBase ()
 
- Public Member Functions inherited from KisShared
bool deref ()
 
bool ref ()
 
int refCount ()
 
QAtomicInt * sharedWeakReference ()
 

Protected Member Functions

virtual KisPaintDeviceSP parentPaintDevice () const =0
 
- Protected Member Functions inherited from KisShared
 KisShared ()
 
 ~KisShared ()
 

Detailed Description

For a selection, the default bounds are defined not by the image, but by the device the selection is attached to, i.e. the selection with non-transparent default pixel should cover the entire parent paint device, not just the image bounds.

KisSelectionDefaultBoundsBase is a base class for selection-targeted default bounds objects. The descendants can redefine how exactly "the parent paint device" is fetched.

Definition at line 59 of file kis_default_bounds.h.

Constructor & Destructor Documentation

◆ KisSelectionDefaultBoundsBase()

KisSelectionDefaultBoundsBase::KisSelectionDefaultBoundsBase ( )

Definition at line 89 of file kis_default_bounds.cpp.

90{
91}

◆ ~KisSelectionDefaultBoundsBase()

KisSelectionDefaultBoundsBase::~KisSelectionDefaultBoundsBase ( )
override

Definition at line 93 of file kis_default_bounds.cpp.

94{
95}

Member Function Documentation

◆ bounds()

QRect KisSelectionDefaultBoundsBase::bounds ( ) const
overridevirtual

Returns a virtual bounding rect of a paint device. E.g. when a paint device has non-transparent default pixel, its virtual bounds extend much wider than the actual data it contains.

This bounds rectangle should be used in all the cases when one wants to process all the non-existing pixels with default value, which may still be visible to the user.

The returned rect usually equals to the bounds of the image, except of a few special cases for selections.

Example:

KisPaintDevice adds defaultBounds->bounds() to its extent() and exactBounds() when its default pixel is non-transparent.

Implements KisDefaultBoundsBase.

Definition at line 97 of file kis_default_bounds.cpp.

98{
99 KisPaintDeviceSP parentDevice = this->parentPaintDevice();
100
101 return parentDevice ?
102 parentDevice->extent() | parentDevice->defaultBounds()->bounds() : QRect();
103}
virtual QRect bounds() const =0
QRect extent() const
KisDefaultBoundsBaseSP defaultBounds() const
virtual KisPaintDeviceSP parentPaintDevice() const =0

References KisDefaultBoundsBase::bounds(), KisPaintDevice::defaultBounds(), and KisPaintDevice::extent().

◆ currentLevelOfDetail()

int KisSelectionDefaultBoundsBase::currentLevelOfDetail ( ) const
overridevirtual

Implements KisDefaultBoundsBase.

Definition at line 126 of file kis_default_bounds.cpp.

127{
128 KisPaintDeviceSP parentDevice = this->parentPaintDevice();
129
130 return parentDevice ? parentDevice->defaultBounds()->currentLevelOfDetail() : 0;
131}
virtual int currentLevelOfDetail() const =0

References KisDefaultBoundsBase::currentLevelOfDetail(), and KisPaintDevice::defaultBounds().

◆ currentTime()

int KisSelectionDefaultBoundsBase::currentTime ( ) const
overridevirtual

Implements KisDefaultBoundsBase.

Definition at line 133 of file kis_default_bounds.cpp.

134{
135 KisPaintDeviceSP parentDevice = this->parentPaintDevice();
136
137 return parentDevice ? parentDevice->defaultBounds()->currentTime() : 0;
138}
virtual int currentTime() const =0

References KisDefaultBoundsBase::currentTime(), and KisPaintDevice::defaultBounds().

◆ externalFrameActive()

bool KisSelectionDefaultBoundsBase::externalFrameActive ( ) const
overridevirtual

Implements KisDefaultBoundsBase.

Definition at line 140 of file kis_default_bounds.cpp.

141{
142 KisPaintDeviceSP parentDevice = this->parentPaintDevice();
143
144 return parentDevice ? parentDevice->defaultBounds()->externalFrameActive() : false;
145}
virtual bool externalFrameActive() const =0

References KisPaintDevice::defaultBounds(), and KisDefaultBoundsBase::externalFrameActive().

◆ imageBorderRect()

QRect KisSelectionDefaultBoundsBase::imageBorderRect ( ) const
overridevirtual

Returns the rectangle of the official image size. This rect is used for wrapping the device in wrap-around mode and in some specific operations.

NOTE: don't use it unless you know what you are doing, most probably you want to use bounds() instead!

Reimplemented from KisDefaultBoundsBase.

Definition at line 105 of file kis_default_bounds.cpp.

106{
107 KisPaintDeviceSP parentDevice = this->parentPaintDevice();
108
109 return parentDevice ? parentDevice->defaultBounds()->bounds() : QRect();
110}

References KisDefaultBoundsBase::bounds(), and KisPaintDevice::defaultBounds().

◆ parentPaintDevice()

virtual KisPaintDeviceSP KisSelectionDefaultBoundsBase::parentPaintDevice ( ) const
protectedpure virtual

Return the actual paint device the selection is attached to

Implemented in KisSelectionDefaultBounds, and KisMaskDefaultBounds.

◆ sourceCookie()

void * KisSelectionDefaultBoundsBase::sourceCookie ( ) const
overridevirtual

Return an abstract pointer to the source object, where default bounds takes its data from. It the cookie is nullptr, then the default bounds is not connected to anything. One can also compare if two default bounds are connected to the same source by comparing two pointers.

NOTE: It is intended to be used for debugging purposes only!

Implements KisDefaultBoundsBase.

Definition at line 147 of file kis_default_bounds.cpp.

148{
149 KisPaintDeviceSP parentDevice = this->parentPaintDevice();
150
151 return parentDevice.data();
152}

References KisSharedPtr< T >::data().

◆ wrapAroundMode()

bool KisSelectionDefaultBoundsBase::wrapAroundMode ( ) const
overridevirtual

Implements KisDefaultBoundsBase.

Definition at line 112 of file kis_default_bounds.cpp.

113{
114 KisPaintDeviceSP parentDevice = this->parentPaintDevice();
115
116 return parentDevice ? parentDevice->defaultBounds()->wrapAroundMode() : false;
117}
virtual bool wrapAroundMode() const =0

References KisPaintDevice::defaultBounds(), and KisDefaultBoundsBase::wrapAroundMode().

◆ wrapAroundModeAxis()

WrapAroundAxis KisSelectionDefaultBoundsBase::wrapAroundModeAxis ( ) const
overridevirtual

Implements KisDefaultBoundsBase.

Definition at line 119 of file kis_default_bounds.cpp.

120{
121 KisPaintDeviceSP parentDevice = this->parentPaintDevice();
122
123 return parentDevice ? parentDevice->defaultBounds()->wrapAroundModeAxis() : WRAPAROUND_BOTH;
124}
@ WRAPAROUND_BOTH
virtual WrapAroundAxis wrapAroundModeAxis() const =0

References KisPaintDevice::defaultBounds(), WRAPAROUND_BOTH, and KisDefaultBoundsBase::wrapAroundModeAxis().


The documentation for this class was generated from the following files: