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

#include <IntegralFrameDuration.h>

+ Inheritance diagram for IntegralFrameDurationCheck:

Public Member Functions

Level check (KisImageSP) const override
 
bool checkNeeded (KisImageSP image) const override
 
 IntegralFrameDurationCheck (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 ()
 

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 21 of file IntegralFrameDuration.h.

Constructor & Destructor Documentation

◆ IntegralFrameDurationCheck()

IntegralFrameDurationCheck::IntegralFrameDurationCheck ( const QString & id,
Level level,
const QString & customWarning = QString() )
inline

Definition at line 24 of file IntegralFrameDuration.h.

27 : KisExportCheckBase(id, level, customWarning)
28 {
29 if (customWarning.isEmpty()) {
30 m_warning =
31 i18nc("image conversion warning",
32 "The image is animated with a frame duration in "
33 "<b>fractions of a millisecond</b>. The "
34 "format cannot represent this, and the frame "
35 "duration will be rounded to the nearest millisecond.");
36 }
37 }
KisExportCheckBase(const QString &id, Level level, const QString &customWarning=QString(), bool perLayerCheck=false)
KisExportCheckBase.

Member Function Documentation

◆ check()

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

Implements KisExportCheckBase.

Definition at line 51 of file IntegralFrameDuration.h.

52 {
53 return m_level;
54 }

References KisExportCheckBase::m_level.

◆ checkNeeded()

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

Implements KisExportCheckBase.

Definition at line 39 of file IntegralFrameDuration.h.

40 {
41 if (!image->animationInterface()->hasAnimation()) {
42 return false;
43 }
44
45 const auto frameDuration = 1000.0
46 / static_cast<double>(image->animationInterface()->framerate());
47
48 return std::round(frameDuration) != frameDuration;
49 }
KisImageAnimationInterface * animationInterface() const

References KisImage::animationInterface(), KisImageAnimationInterface::framerate(), and KisImageAnimationInterface::hasAnimation().


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