Krita Source Code Documentation
Loading...
Searching...
No Matches
ImageSizeCheck Class Reference

#include <CheckImageSize.h>

+ Inheritance diagram for ImageSizeCheck:

Public Member Functions

Level check (KisImageSP) const
 
Level check (KisImageSP) const override
 
bool checkNeeded (KisImageSP image) const
 
bool checkNeeded (KisImageSP image) const override
 
 ImageSizeCheck (int maxWidth, int maxHeight, const QString &id, Level level, const QString &customWarning=QString())
 
 ImageSizeCheck (int maxWidth, int maxHeight, const QString &id, Level level, const QString &customWarning=QString())
 
- Public Member Functions inherited from KisExportCheckBase
virtual QString id () const
 
 KisExportCheckBase (const QString &id, Level level, const QString &customWarning=QString(), bool perLayerCheck=false)
 KisExportCheckBase.
 
virtual bool perLayerCheck () const
 
QString warning () const
 
virtual ~KisExportCheckBase ()
 

Public Attributes

int m_maxH
 
int m_maxW
 

Additional Inherited Members

- Public Types inherited from KisExportCheckBase
enum  Level { SUPPORTED , PARTIALLY , UNSUPPORTED }
 
- Protected Attributes inherited from KisExportCheckBase
QString m_id
 
Level m_level {UNSUPPORTED}
 
bool m_perLayerCheck {false}
 
QString m_warning
 

Detailed Description

Definition at line 17 of file CheckImageSize.h.

Constructor & Destructor Documentation

◆ ImageSizeCheck() [1/2]

ImageSizeCheck::ImageSizeCheck ( int maxWidth,
int maxHeight,
const QString & id,
Level level,
const QString & customWarning = QString() )
inline

Definition at line 21 of file CheckImageSize.h.

22 : KisExportCheckBase(id, level, customWarning, true)
23 , m_maxW(maxWidth)
24 , m_maxH(maxHeight)
25 {
26 if (customWarning.isEmpty()) {
27 m_warning = i18nc("image conversion warning", "This image is larger than <b>%1 x %2</b>. Images this size cannot be saved to this format.", m_maxW, m_maxH);
28 }
29 }
KisExportCheckBase(const QString &id, Level level, const QString &customWarning=QString(), bool perLayerCheck=false)
KisExportCheckBase.

References m_maxH, m_maxW, and KisExportCheckBase::m_warning.

◆ ImageSizeCheck() [2/2]

ImageSizeCheck::ImageSizeCheck ( int maxWidth,
int maxHeight,
const QString & id,
Level level,
const QString & customWarning = QString() )
inline

Definition at line 20 of file ImageSizeCheck.h.

21 : KisExportCheckBase(id, level, customWarning, true)
22 , m_maxW(maxWidth)
23 , m_maxH(maxHeight)
24 {
25 if (customWarning.isEmpty()) {
26 m_warning = i18nc("image conversion warning", "This image is larger than <b>%1 x %2</b>. Images this size cannot be saved to this format.", m_maxW, m_maxH);
27 }
28 }

Member Function Documentation

◆ check() [1/2]

Level ImageSizeCheck::check ( KisImageSP image) const
inlinevirtual
Returns
the level of support for this feature

Implements KisExportCheckBase.

Definition at line 36 of file CheckImageSize.h.

37 {
38 return m_level;
39 }

References KisExportCheckBase::m_level.

◆ check() [2/2]

Level ImageSizeCheck::check ( KisImageSP image) const
inlineoverridevirtual
Returns
the level of support for this feature

Implements KisExportCheckBase.

Definition at line 35 of file ImageSizeCheck.h.

36 {
37 return m_level;
38 }

References KisExportCheckBase::m_level.

◆ checkNeeded() [1/2]

bool ImageSizeCheck::checkNeeded ( KisImageSP image) const
inlinevirtual
Returns
whether the image uses this feature

Implements KisExportCheckBase.

Definition at line 31 of file CheckImageSize.h.

32 {
33 return image->width() <= m_maxW && image->height() <= m_maxH;
34 }
qint32 width() const
qint32 height() const

References KisImage::height(), m_maxH, m_maxW, and KisImage::width().

◆ checkNeeded() [2/2]

bool ImageSizeCheck::checkNeeded ( KisImageSP image) const
inlineoverridevirtual
Returns
whether the image uses this feature

Implements KisExportCheckBase.

Definition at line 30 of file ImageSizeCheck.h.

31 {
32 return image->width() >= m_maxW && image->height() >= m_maxH;
33 }

References KisImage::height(), and KisImage::width().

Member Data Documentation

◆ m_maxH

int ImageSizeCheck::m_maxH

Definition at line 42 of file CheckImageSize.h.

◆ m_maxW

int ImageSizeCheck::m_maxW

Definition at line 41 of file CheckImageSize.h.


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