digiKam
Digikam::InvertFilter Class Reference
+ Inheritance diagram for Digikam::InvertFilter:

Public Types

enum  State { Inactive , Scheduled , Running , Deactivating }
 

Public Slots

void start ()
 
void stop ()
 
void wait ()
 

Signals

void finished ()
 
void finished (bool success)
 
void progress (int progress)
 
void started ()
 
void starting ()
 

Public Member Functions

virtual void cancelFilter ()
 
FilterAction filterAction () override
 
QString filterIdentifier () const override
 
const QString & filterName ()
 
int filterVersion () const
 
DImg getTargetImage ()
 
 InvertFilter (DImg *const orgImage, QObject *const parent=nullptr)
 
 InvertFilter (DImgThreadedFilter *const parentFilter, const DImg &orgImage, DImg &destImage, int progressBegin=0, int progressEnd=100)
 
 InvertFilter (QObject *const parent=nullptr)
 
bool isFinished () const
 
bool isRunning () const
 
QList< int > multithreadedSteps (int stop, int start=0) const
 
virtual bool parametersSuccessfullyRead () const
 
QThread::Priority priority () const
 
void readParameters (const FilterAction &action) override
 
virtual QString readParametersError (const FilterAction &actionThatFailed) const
 
void setEmitSignals (bool emitThem)
 
void setFilterName (const QString &name)
 
void setFilterVersion (int version)
 
void setOriginalImage (const DImg &orgImage)
 
void setPriority (QThread::Priority priority)
 
void setupAndStartDirectly (const DImg &orgImage, DImgThreadedFilter *const master, int progressBegin=0, int progressEnd=100)
 
void setupFilter (const DImg &orgImage)
 
virtual void startFilter ()
 
virtual void startFilterDirectly ()
 
State state () const
 
virtual QList< int > supportedVersions () const
 
 ~InvertFilter () override
 

Static Public Member Functions

static int CurrentVersion ()
 
static QString DisplayableName ()
 
static QString FilterIdentifier ()
 
static QList< int > SupportedVersions ()
 

Protected Member Functions

virtual void cleanupFilter ()
 
virtual void initFilter ()
 
void initMaster ()
 
void initSlave (DImgThreadedFilter *const master, int progressBegin=0, int progressEnd=100)
 
virtual int modulateProgress (int progress)
 
void postProgress (int progress)
 
virtual void prepareDestImage ()
 
void run () override
 
bool runningFlag () const volatile
 
void setSlave (DImgThreadedFilter *const slave)
 
void shutDown ()
 
void start (QMutexLocker &locker)
 
void stop (QMutexLocker &locker)
 
QMutex * threadMutex () const
 
void wait (QMutexLocker &locker)
 

Protected Attributes

DImg m_destImage
 
DImgThreadedFilterm_master
 
QString m_name
 
DImg m_orgImage
 
int m_progressBegin
 
int m_progressCurrent
 To prevent signals bombarding with progress indicator value in postProgress(). More...
 
int m_progressSpan
 
DImgThreadedFilterm_slave
 
int m_version
 
bool m_wasCancelled
 

Member Enumeration Documentation

◆ State

Enumerator
Inactive 
Scheduled 
Running 
Deactivating 

Constructor & Destructor Documentation

◆ InvertFilter() [1/3]

Digikam::InvertFilter::InvertFilter ( QObject *const  parent = nullptr)
explicit

◆ InvertFilter() [2/3]

Digikam::InvertFilter::InvertFilter ( DImg *const  orgImage,
QObject *const  parent = nullptr 
)
explicit

◆ InvertFilter() [3/3]

Digikam::InvertFilter::InvertFilter ( DImgThreadedFilter *const  parentFilter,
const DImg orgImage,
DImg destImage,
int  progressBegin = 0,
int  progressEnd = 100 
)
explicit

◆ ~InvertFilter()

Digikam::InvertFilter::~InvertFilter ( )
override

Member Function Documentation

◆ cancelFilter()

void Digikam::DImgThreadedFilter::cancelFilter ( )
virtualinherited

Cancel the threaded computation.

Reimplemented in Digikam::GreycstorationFilter.

References Digikam::DImgThreadedFilter::cleanupFilter(), Digikam::DynamicThread::isRunning(), Digikam::DImgThreadedFilter::m_slave, Digikam::DImgThreadedFilter::m_wasCancelled, Digikam::DynamicThread::stop(), and Digikam::DynamicThread::wait().

Referenced by DigikamBqmRestorationPlugin::RedEyeCorrection::cancel(), Digikam::GreycstorationFilter::cancelFilter(), Digikam::EditorToolThreaded::slotAbort(), Digikam::PreviewThreadWrapper::stopFilters(), Digikam::AntiVignettingFilter::~AntiVignettingFilter(), Digikam::AutoLevelsFilter::~AutoLevelsFilter(), Digikam::BCGFilter::~BCGFilter(), Digikam::BlurFilter::~BlurFilter(), Digikam::BlurFXFilter::~BlurFXFilter(), Digikam::BorderFilter::~BorderFilter(), Digikam::BWSepiaFilter::~BWSepiaFilter(), Digikam::CBFilter::~CBFilter(), Digikam::CharcoalFilter::~CharcoalFilter(), Digikam::ColorFXFilter::~ColorFXFilter(), Digikam::CurvesFilter::~CurvesFilter(), Digikam::DImgThreadedFilter::~DImgThreadedFilter(), Digikam::DistortionFXFilter::~DistortionFXFilter(), Digikam::EmbossFilter::~EmbossFilter(), Digikam::FilmFilter::~FilmFilter(), Digikam::FilmGrainFilter::~FilmGrainFilter(), Digikam::FreeRotationFilter::~FreeRotationFilter(), Digikam::HotPixelFixer::~HotPixelFixer(), Digikam::HSLFilter::~HSLFilter(), Digikam::IccTransformFilter::~IccTransformFilter(), Digikam::InfraredFilter::~InfraredFilter(), ~InvertFilter(), Digikam::LensDistortionFilter::~LensDistortionFilter(), Digikam::LensFunFilter::~LensFunFilter(), Digikam::LevelsFilter::~LevelsFilter(), Digikam::LocalContrastFilter::~LocalContrastFilter(), Digikam::MixerFilter::~MixerFilter(), Digikam::NormalizeFilter::~NormalizeFilter(), Digikam::NRFilter::~NRFilter(), Digikam::OilPaintFilter::~OilPaintFilter(), Digikam::RainDropFilter::~RainDropFilter(), DigikamRawImportNativePlugin::RawPostProcessing::~RawPostProcessing(), Digikam::RawProcessingFilter::~RawProcessingFilter(), Digikam::RedEyeCorrectionFilter::~RedEyeCorrectionFilter(), Digikam::RefocusFilter::~RefocusFilter(), Digikam::SharpenFilter::~SharpenFilter(), Digikam::ShearFilter::~ShearFilter(), Digikam::StretchFilter::~StretchFilter(), Digikam::TextureFilter::~TextureFilter(), Digikam::TonalityFilter::~TonalityFilter(), Digikam::UnsharpMaskFilter::~UnsharpMaskFilter(), and Digikam::WBFilter::~WBFilter().

◆ cleanupFilter()

virtual void Digikam::DImgThreadedFilter::cleanupFilter ( )
inlineprotectedvirtualinherited

Clean up filter data if necessary, called by stopComputation() method. Override in subclass.

Referenced by Digikam::DImgThreadedFilter::cancelFilter().

◆ CurrentVersion()

static int Digikam::InvertFilter::CurrentVersion ( )
inlinestatic

Referenced by filterAction().

◆ DisplayableName()

QString Digikam::InvertFilter::DisplayableName ( )
static

Referenced by filterAction().

◆ filterAction()

FilterAction Digikam::InvertFilter::filterAction ( )
overridevirtual

Returns the action description corresponding to currently set options.

Implements Digikam::DImgThreadedFilter.

References CurrentVersion(), DisplayableName(), FilterIdentifier(), and Digikam::FilterAction::setDisplayableName().

◆ FilterIdentifier()

static QString Digikam::InvertFilter::FilterIdentifier ( )
inlinestatic

Referenced by filterAction().

◆ filterIdentifier()

QString Digikam::InvertFilter::filterIdentifier ( ) const
inlineoverridevirtual

Return the identifier for this filter in the image history.

Implements Digikam::DImgThreadedFilter.

◆ filterName()

const QString& Digikam::DImgThreadedFilter::filterName ( )
inlineinherited

◆ filterVersion()

int Digikam::DImgThreadedFilter::filterVersion ( ) const
inherited

◆ finished [1/2]

◆ finished [2/2]

void Digikam::DImgThreadedFilter::finished ( bool  success)
signalinherited

Emitted when the computation has completed.

Parameters
successTrue if computation finished without interruption on valid data False if the thread was canceled, or no data is available.

◆ getTargetImage()

◆ initFilter()

void Digikam::DImgThreadedFilter::initFilter ( )
protectedvirtualinherited

Start filter operation before threaded method. Must be called by your constructor.

References Digikam::DImgThreadedFilter::m_master, Digikam::DImgThreadedFilter::prepareDestImage(), and Digikam::DImgThreadedFilter::startFilterDirectly().

Referenced by Digikam::AntiVignettingFilter::AntiVignettingFilter(), Digikam::AutoExpoFilter::AutoExpoFilter(), Digikam::AutoLevelsFilter::AutoLevelsFilter(), Digikam::BCGFilter::BCGFilter(), Digikam::BlurFilter::BlurFilter(), Digikam::BlurFXFilter::BlurFXFilter(), Digikam::BorderFilter::BorderFilter(), Digikam::BWSepiaFilter::BWSepiaFilter(), Digikam::CBFilter::CBFilter(), Digikam::CharcoalFilter::CharcoalFilter(), Digikam::ColorFXFilter::ColorFXFilter(), Digikam::ContentAwareFilter::ContentAwareFilter(), Digikam::CurvesFilter::CurvesFilter(), Digikam::DistortionFXFilter::DistortionFXFilter(), Digikam::EmbossFilter::EmbossFilter(), Digikam::EqualizeFilter::EqualizeFilter(), Digikam::FilmFilter::FilmFilter(), Digikam::FilmGrainFilter::FilmGrainFilter(), Digikam::FilterActionFilter::FilterActionFilter(), Digikam::FreeRotationFilter::FreeRotationFilter(), Digikam::HotPixelFixer::HotPixelFixer(), Digikam::HSLFilter::HSLFilter(), Digikam::IccTransformFilter::IccTransformFilter(), Digikam::InfraredFilter::InfraredFilter(), InvertFilter(), Digikam::LensDistortionFilter::LensDistortionFilter(), Digikam::LensFunFilter::LensFunFilter(), Digikam::LevelsFilter::LevelsFilter(), Digikam::LocalContrastFilter::LocalContrastFilter(), Digikam::MixerFilter::MixerFilter(), Digikam::NormalizeFilter::NormalizeFilter(), Digikam::NRFilter::NRFilter(), Digikam::OilPaintFilter::OilPaintFilter(), Digikam::RainDropFilter::RainDropFilter(), DigikamRawImportNativePlugin::RawPostProcessing::RawPostProcessing(), Digikam::RawProcessingFilter::RawProcessingFilter(), Digikam::RedEyeCorrectionFilter::RedEyeCorrectionFilter(), Digikam::RefocusFilter::RefocusFilter(), Digikam::DImgThreadedFilter::setupFilter(), Digikam::SharpenFilter::SharpenFilter(), Digikam::ShearFilter::ShearFilter(), Digikam::StretchFilter::StretchFilter(), Digikam::TextureFilter::TextureFilter(), Digikam::TonalityFilter::TonalityFilter(), Digikam::UnsharpMaskFilter::UnsharpMaskFilter(), and Digikam::WBFilter::WBFilter().

◆ initMaster()

◆ initSlave()

void Digikam::DImgThreadedFilter::initSlave ( DImgThreadedFilter *const  master,
int  progressBegin = 0,
int  progressEnd = 100 
)
protectedinherited

◆ isFinished()

bool Digikam::DynamicThread::isFinished ( ) const
inherited

◆ isRunning()

◆ modulateProgress()

int Digikam::DImgThreadedFilter::modulateProgress ( int  progress)
protectedvirtualinherited

This method modulates the progress value from the 0..100 span to the span of this slave. Called by postProgress if master is not null.

References Digikam::DImgThreadedFilter::m_progressBegin, Digikam::DImgThreadedFilter::m_progressSpan, and Digikam::DImgThreadedFilter::progress().

Referenced by Digikam::DImgThreadedFilter::postProgress(), and Digikam::RawProcessingFilter::postProgress().

◆ multithreadedSteps()

QList< int > Digikam::DImgThreadedFilter::multithreadedSteps ( int  stop,
int  start = 0 
) const
inherited

This method return a list of steps to process parallelized operation in filter using QtConcurrents API. Usually, start and stop are rows or columns from image to process. By default, whole image will be processed and start value is 0. In this case stop will be last row or column to process. Between range [start,stop], this method will divide by equal steps depending of number of CPU cores available. To be sure that all values will be processed, in case of CPU core division give rest, the last step compensate the difference. See Blur filter loop implementation for example to see how to use this method with QtConcurrents API.

References Digikam::DynamicThread::start(), and Digikam::DynamicThread::stop().

◆ parametersSuccessfullyRead()

bool Digikam::DImgThreadedFilter::parametersSuccessfullyRead ( ) const
virtualinherited

Optional: error handling for readParameters. When readParameters() has been called, this method will return true if the call was successful, and false if not. If returning false, readParametersError() will give an error message. The default implementation always returns success. You only need to reimplement when a filter is likely to fail in a different environment, e.g. depending on availability of installed files. These methods have an undefined return value if readParameters() was not called previously.

Reimplemented in Digikam::IccTransformFilter.

◆ postProgress()

◆ prepareDestImage()

◆ priority()

QThread::Priority Digikam::DynamicThread::priority ( ) const
inherited

◆ progress

void Digikam::DImgThreadedFilter::progress ( int  progress)
signalinherited

◆ readParameters()

void Digikam::InvertFilter::readParameters ( const FilterAction action)
overridevirtual

◆ readParametersError()

QString Digikam::DImgThreadedFilter::readParametersError ( const FilterAction actionThatFailed) const
virtualinherited

Reimplemented in Digikam::IccTransformFilter.

◆ run()

void Digikam::DImgThreadedFilter::run ( )
overrideprotectedvirtualinherited

List of threaded operations by filter.

Implements Digikam::DynamicThread.

References Digikam::DImgThreadedFilter::startFilterDirectly().

◆ runningFlag()

bool Digikam::DynamicThread::runningFlag ( ) const volatile
protectedinherited

◆ setEmitSignals()

void Digikam::DynamicThread::setEmitSignals ( bool  emitThem)
inherited

◆ setFilterName()

void Digikam::DImgThreadedFilter::setFilterName ( const QString &  name)
inherited

◆ setFilterVersion()

void Digikam::DImgThreadedFilter::setFilterVersion ( int  version)
inherited

Replaying a filter action: Set the filter version. A filter may implement different versions, to preserve image history when the algorithm is changed. Any value set here must be contained in supportedVersions, otherwise this call will be ignored. Default value is 1. (Note: If you intend to record a filter action, please look at FilterAction's m_version)

References Digikam::DImgThreadedFilter::m_version, and Digikam::DImgThreadedFilter::supportedVersions().

◆ setOriginalImage()

◆ setPriority()

void Digikam::DynamicThread::setPriority ( QThread::Priority  priority)
inherited

Sets the priority for this dynamic thread. Can be set anytime. If the thread is currently not running, the priority will be set when it is run next time. When you set QThread::InheritPriority (default), the priority is not changed but inherited from the thread pool.

References Digikam::DynamicThread::priority().

Referenced by Digikam::FacePipeline::Private::applyPriority(), and Digikam::FacePipeline::Private::createThumbnailLoadThread().

◆ setSlave()

void Digikam::DImgThreadedFilter::setSlave ( DImgThreadedFilter *const  slave)
protectedinherited

Inform the master that there is currently a slave. At destruction of the slave, call with slave=0.

References Digikam::DImgThreadedFilter::m_slave.

Referenced by Digikam::DImgThreadedFilter::initSlave(), and Digikam::DImgThreadedFilter::~DImgThreadedFilter().

◆ setupAndStartDirectly()

void Digikam::DImgThreadedFilter::setupAndStartDirectly ( const DImg orgImage,
DImgThreadedFilter *const  master,
int  progressBegin = 0,
int  progressEnd = 100 
)
inherited

Initializes the filter for use as a slave and directly starts computation (in-thread)

References Digikam::DImgThreadedFilter::initSlave(), and Digikam::DImgThreadedFilter::setupFilter().

◆ setupFilter()

void Digikam::DImgThreadedFilter::setupFilter ( const DImg orgImage)
inherited

You need to call this and then start filter of you used the constructor not setting an original image. The original image's data will not be copied.

References Digikam::DImgThreadedFilter::initFilter(), and Digikam::DImgThreadedFilter::setOriginalImage().

Referenced by DigikamRAWDImgPlugin::DImgRAWLoader::postProcess(), and Digikam::DImgThreadedFilter::setupAndStartDirectly().

◆ shutDown()

void Digikam::DynamicThread::shutDown ( )
protectedinherited

If you are deleting data in your destructor which is accessed from the thread, do one of the following from your destructor to guarantee a safe shutdown: 1) Call this method 2) Call stop() and wait(), knowing that nothing will call start() anymore after this 3) Be sure the thread will never be running at destruction. Note: This irrevocably stops this object. Note: It is not sufficient that your parent class does this. Calling this method, or providing one of the above mentioned equivalent guarantees, must be done by every single last class in the hierarchy with an implemented destructor deleting data. (the base class destructor is always called after the derived class)

References Digikam::DynamicThread::stop(), and Digikam::DynamicThread::wait().

Referenced by Digikam::ManagedLoadSaveThread::shutDown(), Digikam::DynamicThread::~DynamicThread(), and Digikam::LoadSaveThread::~LoadSaveThread().

◆ start [1/2]

◆ start() [2/2]

void Digikam::DynamicThread::start ( QMutexLocker &  locker)
protectedinherited

Doing the same as start(), stop() and wait above, provide it with a locked QMutexLocker on mutex(). Note the start() will unlock and relock for scheduling once, after state change.

References Digikam::ThreadManager::instance(), and Digikam::ThreadManager::schedule().

◆ started

void Digikam::DImgThreadedFilter::started ( )
signalinherited

This signal is emitted when image data is available and the computation has started.

Referenced by Digikam::DImgThreadedFilter::startFilterDirectly().

◆ startFilter()

◆ startFilterDirectly()

◆ starting

void Digikam::DynamicThread::starting ( )
signalinherited

Emitted if emitSignals is enabled

◆ state()

◆ stop [1/2]

◆ stop() [2/2]

void Digikam::DynamicThread::stop ( QMutexLocker &  locker)
protectedinherited

◆ SupportedVersions()

static QList<int> Digikam::InvertFilter::SupportedVersions ( )
inlinestatic

◆ supportedVersions()

QList< int > Digikam::DImgThreadedFilter::supportedVersions ( ) const
virtualinherited

◆ threadMutex()

QMutex * Digikam::DynamicThread::threadMutex ( ) const
protectedinherited

◆ wait [1/2]

◆ wait() [2/2]

void Digikam::DynamicThread::wait ( QMutexLocker &  locker)
protectedinherited

Member Data Documentation

◆ m_destImage

◆ m_master

DImgThreadedFilter* Digikam::DImgThreadedFilter::m_master
protectedinherited

◆ m_name

QString Digikam::DImgThreadedFilter::m_name
protectedinherited

◆ m_orgImage

◆ m_progressBegin

int Digikam::DImgThreadedFilter::m_progressBegin
protectedinherited

The progress span that a slave filter uses in the parent filter's progress.

Referenced by Digikam::DImgThreadedFilter::initMaster(), Digikam::DImgThreadedFilter::initSlave(), and Digikam::DImgThreadedFilter::modulateProgress().

◆ m_progressCurrent

int Digikam::DImgThreadedFilter::m_progressCurrent
protectedinherited

◆ m_progressSpan

int Digikam::DImgThreadedFilter::m_progressSpan
protectedinherited

◆ m_slave

DImgThreadedFilter* Digikam::DImgThreadedFilter::m_slave
protectedinherited

◆ m_version

int Digikam::DImgThreadedFilter::m_version
protectedinherited

◆ m_wasCancelled

bool Digikam::DImgThreadedFilter::m_wasCancelled
protectedinherited

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