19#ifndef KIS_SCALE_VISITOR_H_
20#define KIS_SCALE_VISITOR_H_
24#include "kis_progress_subject.h"
25#include "kis_progress_display_interface.h"
26#include "kis_thread.h"
27#include "kis_layer_visitor.h"
30#include "kis_group_layer.h"
31#include "kis_paint_layer.h"
32#include "kis_adjustment_layer.h"
33#include "kis_transaction.h"
34#include "kis_undo_adapter.h"
35#include "kis_selection.h"
37class KisProgressDisplayInterface;
38class KisFilterStrategy;
58 KisFilterStrategy *filterStrategy)
63 , m_filterStrategy(filterStrategy) {};
65 virtual ~KisScaleWorker() {};
73 KisFilterStrategy * m_filterStrategy;
84 int calcContrib(ContribList *contribX,
double cale,
double fwidth,
int srcwidth, KisFilterStrategy *filterStrategy, TQ_INT32 i);
86 ContribList * contrib;
92class KisScaleVisitor :
public KisLayerVisitor, KisProgressSubject {
96 KisScaleVisitor(KisImageSP img,
99 KisProgressDisplayInterface *progress,
100 KisFilterStrategy *filterStrategy)
105 , m_progress(progress)
106 , m_filterStrategy(filterStrategy)
109 progress -> setSubject(
this,
true,
true);
110 emit notifyProgressStage(i18n(
"Scaling..."),0);
113 virtual ~KisScaleVisitor()
117 int threadcount = m_scalethreads.count();
119 for ( t = m_scalethreads.first(); t; t = m_scalethreads.next()) {
122 emit notifyProgress((100 / threadcount) * i);
126 emit notifyProgressDone();
128 m_scalethreads.setAutoDelete(
true);
129 m_scalethreads.clear();
136 if (m_img->undoAdapter() && m_img->undoAdapter()->undo()) {
137 KisTransaction * cmd =
new KisTransaction(
"", layer->paintDevice());
138 m_img->undoAdapter()->addCommand(cmd);
141 KisScaleWorker * scaleThread =
new KisScaleWorker(layer->paintDevice(),
142 m_sx, m_sy, m_filterStrategy);
143 m_scalethreads.append(scaleThread);
144 scaleThread->start();
161 child->accept(*
this);
162 child = child->nextSibling();
175 KisThread * scaleThread =
new KisScaleWorker(layer->selection().data(), m_sx, m_sy, m_filterStrategy);
176 m_scalethreads.append(scaleThread);
177 scaleThread->start();
185 virtual void cancel()
188 for ( t = m_scalethreads.first(); t; t = m_scalethreads.next()) {
196 TQPtrList<KisThread> m_scalethreads;
200 KisProgressDisplayInterface * m_progress;
201 KisFilterStrategy * m_filterStrategy;
Class that contains a KisFilter and optionally a KisSelection.
A KisLayer that bundles child layers into a single layer.
virtual KisLayerSP firstChild() const
Returns the first child layer of this layer (if it supports that).
virtual void resetProjection(KisPaintDevice *to=0)
virtual void setDirty(bool propagate=true)
Set the entire layer extent dirty; this percolates up to parent layers all the way to the root layer.
A paint device contains the actual pixel data and offers methods to read and write pixels.
This layer is of a type that can be painted on.
virtual void setDirty(bool propagate=true)
Overridden to call the private convertMaskToSelection.
An interface for the Part Layer so that we can use it in core/, but can implement it in ui/.
A KisThread is a TQThread that can be set in the canceled state.
virtual void cancel()
Request the thread to cancel at the first opportunity.