Commit 4387006b authored by Sven Langkamp's avatar Sven Langkamp

make Krita gradients available as KoResource

svn path=/trunk/koffice/; revision=730082
parent fcbe157d
......@@ -57,7 +57,6 @@ set(kritaimage_LIB_SRCS
kis_filter_strategy.cc
kis_filter_configuration.cc
kis_filter_config_widget.cc
kis_gradient.cc
kis_gradient_painter.cc
kis_histogram.cc
kis_image.cc
......
......@@ -20,7 +20,6 @@
#include "KoColorSpaceRegistry.h"
#include "KoColorSpace.h"
#include "kis_gradient.h"
#include "kis_autogradient_resource.h"
......@@ -31,8 +30,7 @@
void KisAutogradientResource::createSegment( int interpolation, int colorInterpolation, double startOffset, double endOffset, double middleOffset, QColor left, QColor right )
{
m_colorSpace = KoColorSpaceRegistry::instance()->rgb8();
pushSegment(new KisGradientSegment(interpolation, colorInterpolation, startOffset, middleOffset, endOffset, KoColor( left, m_colorSpace ), KoColor( right, m_colorSpace )));
pushSegment(new KoGradientSegment(interpolation, colorInterpolation, startOffset, middleOffset, endOffset, KoColor( left, colorSpace() ), KoColor( right, colorSpace() )));
}
......@@ -59,9 +57,9 @@ const QList<double> KisAutogradientResource::getMiddleHandlePositions() const
return middleHandlePositions;
}
void KisAutogradientResource::moveSegmentStartOffset( KisGradientSegment* segment, double t)
void KisAutogradientResource::moveSegmentStartOffset( KoGradientSegment* segment, double t)
{
QList<KisGradientSegment*>::iterator it = qFind( m_segments.begin(), m_segments.end(), segment );
QList<KoGradientSegment*>::iterator it = qFind( m_segments.begin(), m_segments.end(), segment );
if ( it != m_segments.end() )
{
if ( it == m_segments.begin() )
......@@ -69,7 +67,7 @@ void KisAutogradientResource::moveSegmentStartOffset( KisGradientSegment* segmen
segment->setStartOffset( 0.0 );
return;
}
KisGradientSegment* previousSegment = (*(it-1));
KoGradientSegment* previousSegment = (*(it-1));
if ( t > segment->startOffset() )
{
if( t > segment->middleOffset() )
......@@ -84,9 +82,9 @@ void KisAutogradientResource::moveSegmentStartOffset( KisGradientSegment* segmen
}
}
void KisAutogradientResource::moveSegmentEndOffset( KisGradientSegment* segment, double t)
void KisAutogradientResource::moveSegmentEndOffset( KoGradientSegment* segment, double t)
{
QList<KisGradientSegment*>::iterator it = qFind( m_segments.begin(), m_segments.end(), segment );
QList<KoGradientSegment*>::iterator it = qFind( m_segments.begin(), m_segments.end(), segment );
if ( it != m_segments.end() )
{
if ( it+1 == m_segments.end() )
......@@ -94,7 +92,7 @@ void KisAutogradientResource::moveSegmentEndOffset( KisGradientSegment* segment,
segment->setEndOffset( 1.0 );
return;
}
KisGradientSegment* followingSegment = (*(it+1));
KoGradientSegment* followingSegment = (*(it+1));
if ( t < segment->endOffset() )
{
if( t < segment->middleOffset() )
......@@ -109,7 +107,7 @@ void KisAutogradientResource::moveSegmentEndOffset( KisGradientSegment* segment,
}
}
void KisAutogradientResource::moveSegmentMiddleOffset( KisGradientSegment* segment, double t)
void KisAutogradientResource::moveSegmentMiddleOffset( KoGradientSegment* segment, double t)
{
if( segment )
{
......@@ -122,15 +120,15 @@ void KisAutogradientResource::moveSegmentMiddleOffset( KisGradientSegment* segme
}
}
void KisAutogradientResource::splitSegment( KisGradientSegment* segment )
void KisAutogradientResource::splitSegment( KoGradientSegment* segment )
{
Q_ASSERT(segment != 0);
QList<KisGradientSegment*>::iterator it = qFind( m_segments.begin(), m_segments.end(), segment );
QList<KoGradientSegment*>::iterator it = qFind( m_segments.begin(), m_segments.end(), segment );
if ( it != m_segments.end() )
{
KoColor midleoffsetColor;
segment->colorAt( midleoffsetColor, segment->middleOffset() );
KisGradientSegment* newSegment = new KisGradientSegment(
KoGradientSegment* newSegment = new KoGradientSegment(
segment->interpolation(), segment->colorInterpolation(),
segment ->startOffset(),
( segment->middleOffset() - segment->startOffset() ) / 2 + segment->startOffset(),
......@@ -144,15 +142,15 @@ void KisAutogradientResource::splitSegment( KisGradientSegment* segment )
}
}
void KisAutogradientResource::duplicateSegment( KisGradientSegment* segment )
void KisAutogradientResource::duplicateSegment( KoGradientSegment* segment )
{
Q_ASSERT(segment != 0);
QList<KisGradientSegment*>::iterator it = qFind( m_segments.begin(), m_segments.end(), segment );
QList<KoGradientSegment*>::iterator it = qFind( m_segments.begin(), m_segments.end(), segment );
if ( it != m_segments.end() )
{
double middlePostionPercentage = ( segment->middleOffset() - segment->startOffset() ) / segment->length();
double center = segment->startOffset() + segment->length() / 2;
KisGradientSegment* newSegment = new KisGradientSegment(
KoGradientSegment* newSegment = new KoGradientSegment(
segment->interpolation(), segment->colorInterpolation(),
segment ->startOffset(),
segment->length() / 2 * middlePostionPercentage + segment->startOffset(),
......@@ -164,7 +162,7 @@ void KisAutogradientResource::duplicateSegment( KisGradientSegment* segment )
}
}
void KisAutogradientResource::mirrorSegment( KisGradientSegment* segment )
void KisAutogradientResource::mirrorSegment( KoGradientSegment* segment )
{
Q_ASSERT(segment != 0);
KoColor tmpColor = segment->startColor();
......@@ -183,16 +181,16 @@ void KisAutogradientResource::mirrorSegment( KisGradientSegment* segment )
segment->setColorInterpolation( COLOR_INTERP_HSV_CW );
}
KisGradientSegment* KisAutogradientResource::removeSegment( KisGradientSegment* segment )
KoGradientSegment* KisAutogradientResource::removeSegment( KoGradientSegment* segment )
{
Q_ASSERT(segment != 0);
if( m_segments.count() < 2 )
return 0;
QList<KisGradientSegment*>::iterator it = qFind( m_segments.begin(), m_segments.end(), segment );
QList<KoGradientSegment*>::iterator it = qFind( m_segments.begin(), m_segments.end(), segment );
if ( it != m_segments.end() )
{
double middlePostionPercentage;
KisGradientSegment* nextSegment;
KoGradientSegment* nextSegment;
if( it == m_segments.begin() )
{
nextSegment = (*(it+1));
......
......@@ -22,13 +22,15 @@
#include <QList>
#include "kis_gradient.h"
#include <KoSegmentGradient.h>
#include <krita_export.h>
class KRITAIMAGE_EXPORT KisAutogradientResource : public KisGradient
class KRITAIMAGE_EXPORT KisAutogradientResource
: public KoSegmentGradient
{
public:
KisAutogradientResource() : KisGradient("") {}
KisAutogradientResource() : KoSegmentGradient("") {}
public:
......@@ -44,7 +46,7 @@ public:
* The offset will maximally be moved till the middle of the current or the previous
* segment
*/
void moveSegmentStartOffset( KisGradientSegment* segment, double t);
void moveSegmentStartOffset( KoGradientSegment* segment, double t);
/**
* Moves the endoffset of the specified segment to the specified value
......@@ -53,25 +55,25 @@ public:
* The offset will maximally be moved till the middle of the current or the following
* segment
*/
void moveSegmentEndOffset( KisGradientSegment* segment, double t);
void moveSegmentEndOffset( KoGradientSegment* segment, double t);
/**
* Moves the Middle of the specified segment to the specified value
* The offset will maximally be moved till the endoffset or startoffset of the segment
*/
void moveSegmentMiddleOffset( KisGradientSegment* segment, double t);
void moveSegmentMiddleOffset( KoGradientSegment* segment, double t);
void splitSegment( KisGradientSegment* segment );
void duplicateSegment( KisGradientSegment* segment );
void mirrorSegment( KisGradientSegment* segment );
void splitSegment( KoGradientSegment* segment );
void duplicateSegment( KoGradientSegment* segment );
void mirrorSegment( KoGradientSegment* segment );
/**
* Removes the specific segment from the gradient.
* @return The segment which will be at the place of the old segment.
* 0 if the segment is not in the gradient or it is not possible to remove the segment.
*/
KisGradientSegment* removeSegment( KisGradientSegment* segment );
KoGradientSegment* removeSegment( KoGradientSegment* segment );
/**
* Checks if it's possible to remove an segment(at least two segments in the gradient)
......
......@@ -38,7 +38,7 @@
#include "kis_brush.h"
#include "kis_debug_areas.h"
#include "kis_gradient.h"
#include "KoSegmentGradient.h"
#include "kis_image.h"
#include "kis_iterators_pixel.h"
#include "kis_layer.h"
......
......@@ -24,7 +24,7 @@
#include "kis_painter.h"
#include <krita_export.h>
class KisGradient;
class KoSegmentGradient;
// XXX: Need to set dirtyRegion in KisPainter
......@@ -52,8 +52,8 @@ public:
GradientRepeatAlternate
};
void setGradient(KisGradient& gradient) { m_gradient = &gradient; }
void setGradient(KisGradient* gradient) { m_gradient = gradient; }
void setGradient(KoSegmentGradient& gradient) { m_gradient = &gradient; }
void setGradient(KoSegmentGradient* gradient) { m_gradient = gradient; }
/**
* Paint a gradient in the rect between startx, starty, width and height.
......@@ -73,7 +73,7 @@ public:
private:
KisGradient *m_gradient;
KoSegmentGradient *m_gradient;
};
......
......@@ -187,9 +187,12 @@ void KisLayer::setImage(KisImageSP image)
KisSelectionMaskSP KisLayer::selectionMask() const
{
QList<KisNodeSP> masks = childNodes( QStringList( "KisSelectionMask" ), KoProperties() );
Q_ASSERT(masks.size() == 1); // Or do we allow more than one selection mask to a layer?
KisSelectionMaskSP selection = dynamic_cast<KisSelectionMask*>(masks[0].data());
return selection;
Q_ASSERT(masks.size() <= 1); // Or do we allow more than one selection mask to a layer?
if(masks.size() == 1) {
KisSelectionMaskSP selection = dynamic_cast<KisSelectionMask*>(masks[0].data());
return selection;
}
return 0;
}
KisSelectionSP KisLayer::selection() const
......
......@@ -26,9 +26,9 @@
#include <knuminput.h>
#include <KoColorSpace.h>
#include <KoSegmentGradient.h>
#include "kis_int_spinbox.h"
#include "kis_gradient.h"
#include "kis_autogradient_resource.h"
#include "kis_gradient_slider_widget.h"
......@@ -42,8 +42,8 @@ KisAutogradient::KisAutogradient(QWidget *parent, const char* name, const QStrin
setWindowTitle(caption);
m_autogradientResource = new KisAutogradientResource();
m_autogradientResource->createSegment( INTERP_LINEAR, COLOR_INTERP_RGB, 0.0, 1.0, 0.5, Qt::black, Qt::white );
connect(gradientSlider, SIGNAL( sigSelectedSegment( KisGradientSegment* ) ), SLOT( slotSelectedSegment(KisGradientSegment*) ));
connect(gradientSlider, SIGNAL( sigChangedSegment(KisGradientSegment*) ), SLOT( slotChangedSegment(KisGradientSegment*) ));
connect(gradientSlider, SIGNAL( sigSelectedSegment( KoGradientSegment* ) ), SLOT( slotSelectedSegment(KoGradientSegment*) ));
connect(gradientSlider, SIGNAL( sigChangedSegment(KoGradientSegment*) ), SLOT( slotChangedSegment(KoGradientSegment*) ));
gradientSlider->setGradientResource( m_autogradientResource );
connect(comboBoxColorInterpolationType, SIGNAL( activated(int) ), SLOT( slotChangedColorInterpolation(int) ));
connect(comboBoxInterpolationType, SIGNAL( activated(int) ), SLOT( slotChangedInterpolation(int) ));
......@@ -62,7 +62,7 @@ void KisAutogradient::activate()
paramChanged();
}
void KisAutogradient::slotSelectedSegment(KisGradientSegment* segment)
void KisAutogradient::slotSelectedSegment(KoGradientSegment* segment)
{
QColor startColor;
QColor endColor;
......@@ -86,14 +86,14 @@ void KisAutogradient::slotSelectedSegment(KisGradientSegment* segment)
paramChanged();
}
void KisAutogradient::slotChangedSegment(KisGradientSegment*)
void KisAutogradient::slotChangedSegment(KoGradientSegment*)
{
paramChanged();
}
void KisAutogradient::slotChangedInterpolation(int type)
{
KisGradientSegment* segment = gradientSlider->selectedSegment();
KoGradientSegment* segment = gradientSlider->selectedSegment();
if(segment)
segment->setInterpolation( type );
gradientSlider->update();
......@@ -103,7 +103,7 @@ void KisAutogradient::slotChangedInterpolation(int type)
void KisAutogradient::slotChangedColorInterpolation(int type)
{
KisGradientSegment* segment = gradientSlider->selectedSegment();
KoGradientSegment* segment = gradientSlider->selectedSegment();
if(segment)
segment->setColorInterpolation( type );
gradientSlider->update();
......@@ -113,7 +113,7 @@ void KisAutogradient::slotChangedColorInterpolation(int type)
void KisAutogradient::slotChangedLeftColor( const QColor& color)
{
KisGradientSegment* segment = gradientSlider->selectedSegment();
KoGradientSegment* segment = gradientSlider->selectedSegment();
if(segment)
{
QColor unused;
......@@ -128,7 +128,7 @@ void KisAutogradient::slotChangedLeftColor( const QColor& color)
void KisAutogradient::slotChangedRightColor( const QColor& color)
{
KisGradientSegment* segment = gradientSlider->selectedSegment();
KoGradientSegment* segment = gradientSlider->selectedSegment();
if(segment)
{
QColor unused;
......@@ -143,7 +143,7 @@ void KisAutogradient::slotChangedRightColor( const QColor& color)
void KisAutogradient::slotChangedLeftOpacity( int value )
{
KisGradientSegment* segment = gradientSlider->selectedSegment();
KoGradientSegment* segment = gradientSlider->selectedSegment();
if(segment)
segment->setStartColor( KoColor( segment->startColor().toQColor(), value / 100 * OPACITY_OPAQUE, segment->startColor().colorSpace() ) );
gradientSlider->repaint();
......@@ -153,7 +153,7 @@ void KisAutogradient::slotChangedLeftOpacity( int value )
void KisAutogradient::slotChangedRightOpacity( int value )
{
KisGradientSegment* segment = gradientSlider->selectedSegment();
KoGradientSegment* segment = gradientSlider->selectedSegment();
if(segment)
segment->setEndColor( KoColor( segment->endColor().toQColor(), value / 100 *OPACITY_OPAQUE, segment->endColor().colorSpace() ));
gradientSlider->repaint();
......
......@@ -23,7 +23,7 @@
#include "ui_wdgautogradient.h"
class KoResource;
class KisGradientSegment;
class KoGradientSegment;
class KisAutogradientResource;
class KisAutogradient : public QWidget, public Ui::KisWdgAutogradient
......@@ -38,8 +38,8 @@ class KisAutogradient : public QWidget, public Ui::KisWdgAutogradient
private:
KisAutogradientResource* m_autogradientResource;
private slots:
void slotSelectedSegment(KisGradientSegment* segment);
void slotChangedSegment(KisGradientSegment* segment);
void slotSelectedSegment(KoGradientSegment* segment);
void slotChangedSegment(KoGradientSegment* segment);
void slotChangedInterpolation(int type);
void slotChangedColorInterpolation(int type);
void slotChangedLeftColor( const QColor& color);
......
......@@ -42,6 +42,7 @@
#include <kaction.h>
#include <kactioncollection.h>
#include <KoDualColorButton.h>
#include <KoSegmentGradient.h>
#include "kis_resourceserver.h"
#include "kis_resource_provider.h"
......@@ -54,11 +55,10 @@
#include "kis_iconwidget.h"
#include "kis_brush.h"
#include "kis_pattern.h"
#include "kis_gradient.h"
#include "kis_brush_chooser.h"
#include "kis_view2.h"
#include "kis_autobrush.h"
#include "kis_autogradient.h"
//#include "kis_autogradient.h"
#include "kis_config.h"
#include "kis_paintop_box.h"
#include "kis_custom_brush.h"
......@@ -184,7 +184,7 @@ void KisControlFrame::slotPatternChanged(KisPattern * pattern)
}
void KisControlFrame::slotGradientChanged(KisGradient * gradient)
void KisControlFrame::slotGradientChanged(KoSegmentGradient * gradient)
{
KisIconItem *item;
if (!gradient)
......
......@@ -38,7 +38,7 @@ class KisIconWidget;
class KisAutobrush;
class KisBrush;
class KisBrushChooser;
class KisGradient;
class KoSegmentGradient;
class KisGradientChooser;
class KisItemChooser;
class KisPattern;
......@@ -67,7 +67,7 @@ public slots:
void slotBrushChanged(KisBrush * brush);
void slotPatternChanged(KisPattern * pattern);
void slotGradientChanged(KisGradient * gradient);
void slotGradientChanged(KoSegmentGradient * gradient);
private:
......
......@@ -26,7 +26,7 @@
#include "kis_view2.h"
#include "kis_global.h"
#include "kis_icon_item.h"
#include "kis_gradient.h"
#include "KoSegmentGradient.h"
#include "kis_autogradient.h"
#include "kis_resource_provider.h"
......@@ -73,7 +73,7 @@ void KisGradientChooser::update(QTableWidgetItem *item)
KisIconItem *kisItem = static_cast<KisIconItem *>(item);
if (item) {
KisGradient *gradient = static_cast<KisGradient *>(kisItem->resource());
KoSegmentGradient *gradient = static_cast<KoSegmentGradient *>(kisItem->resource());
m_lbName->setText(gradient->name());
}
......
......@@ -119,7 +119,7 @@ void KisGradientSliderWidget::mousePressEvent( QMouseEvent * e )
if( ( e->y() < MARGIN || e->y() > height() - MARGIN ) || ( e->x() < MARGIN || e->x() > width() - MARGIN ) || e-> button() != Qt::LeftButton )
return;
double t = (double)(e->x() - MARGIN) / (double)(width() - 2 * MARGIN);
KisGradientSegment* segment = 0;
KoGradientSegment* segment = 0;
segment = m_autogradientResource->segmentAt(t);
if(segment != 0)
{
......
......@@ -27,7 +27,7 @@
class KAction;
class KMenu;
class KisAutogradientResource;
class KisGradientSegment;
class KoGradientSegment;
class KisGradientSliderWidget : public QWidget
{
......@@ -39,11 +39,11 @@ public:
public:
virtual void paintEvent ( QPaintEvent * );
void setGradientResource( KisAutogradientResource* agr);
KisGradientSegment* selectedSegment() { return m_selectedSegment; }
KoGradientSegment* selectedSegment() { return m_selectedSegment; }
signals:
void sigSelectedSegment(KisGradientSegment*);
void sigChangedSegment(KisGradientSegment*);
void sigSelectedSegment(KoGradientSegment*);
void sigChangedSegment(KoGradientSegment*);
protected:
virtual void mousePressEvent( QMouseEvent * e );
......@@ -74,8 +74,8 @@ private:
};
KisAutogradientResource* m_autogradientResource;
KisGradientSegment* m_currentSegment;
KisGradientSegment* m_selectedSegment;
KoGradientSegment* m_currentSegment;
KoGradientSegment* m_selectedSegment;
KMenu* m_segmentMenu;
int m_drag;
KAction *m_removeSegmentAction;
......
......@@ -216,7 +216,7 @@ KisOpenGLConicalSymetricGradientShader::KisOpenGLConicalSymetricGradientShader(K
//-----------------------------------------------------------------------------
KisOpenGLGradientProgram::KisOpenGLGradientProgram(const KisGradient *gradient,
KisOpenGLGradientProgram::KisOpenGLGradientProgram(const KoSegmentGradient *gradient,
KisGradientPainter::enumGradientShape shape,
KisGradientPainter::enumGradientRepeat repeat,
bool reverseGradient,
......
......@@ -35,7 +35,7 @@ class KoColorSpace;
class KRITAUI_EXPORT KisOpenGLGradientProgram : public KisOpenGLProgram
{
public:
KisOpenGLGradientProgram(const KisGradient *gradient,
KisOpenGLGradientProgram(const KoSegmentGradient *gradient,
KisGradientPainter::enumGradientShape shape,
KisGradientPainter::enumGradientRepeat repeat,
bool reverseGradient,
......
......@@ -25,9 +25,9 @@
#include <KoID.h>
#include "colorprofiles/KoIccColorProfile.h"
#include <KoSegmentGradient.h>
#include <kis_brush.h>
#include <kis_pattern.h>
#include <kis_gradient.h>
#include <kis_layer.h>
#include "kis_config.h"
......@@ -125,9 +125,9 @@ KisPattern * KisResourceProvider::currentPattern() const
}
KisGradient * KisResourceProvider::currentGradient() const
KoSegmentGradient* KisResourceProvider::currentGradient() const
{
return static_cast<KisGradient*>( m_resourceProvider->resource( CurrentGradient ).value<void *>() );
return static_cast<KoSegmentGradient*>( m_resourceProvider->resource( CurrentGradient ).value<void *>() );
}
......@@ -202,7 +202,7 @@ void KisResourceProvider::slotPatternActivated(KoResource * res)
void KisResourceProvider::slotGradientActivated(KoResource *res)
{
KisGradient * gradient = dynamic_cast<KisGradient*>(res);
KoSegmentGradient * gradient = dynamic_cast<KoSegmentGradient*>(res);
QVariant v = qVariantFromValue( ( void * ) gradient );
m_resourceProvider->setResource( CurrentGradient, v );
if (gradient) {
......@@ -301,7 +301,7 @@ void KisResourceProvider::slotResourceChanged( int key, const QVariant & res )
emit sigPatternChanged( static_cast<KisPattern *>( res.value<void *>() ) );
break;
case ( CurrentGradient ):
emit sigGradientChanged( static_cast<KisGradient *>( res.value<void *>() ) );
emit sigGradientChanged( static_cast<KoSegmentGradient *>( res.value<void *>() ) );
break;
case ( CurrentPaintop ):
emit sigPaintopChanged(res.value<KoID >(), currentPaintopSettings());
......
......@@ -32,7 +32,7 @@
class KisPaintOpSettings;
class KisBrush;
class KisGradient;
class KoSegmentGradient;
class KisPattern;
class KoResource;
......@@ -40,7 +40,7 @@ class KoResource;
KisResourceProvider contains the per-view current settings that
influence painting, like paintop, color, gradients and so on.
XXX: KisBrush, KisGradient, KisPattern and the other pointers
XXX: KisBrush, KoSegmentGradient, KisPattern and the other pointers
should really be shared pointers. That would be much safer. Also
note: we should have a koffice-wide provider of brushes, patterns
and gradients.
......@@ -87,7 +87,7 @@ public:
KisBrush *currentBrush() const;
KisPattern *currentPattern() const;
KisGradient *currentGradient() const;
KoSegmentGradient *currentGradient() const;
KoID currentPaintop() const;
const KisPaintOpSettings *currentPaintopSettings() const;
......@@ -129,7 +129,7 @@ signals:
void sigFGColorChanged(const KoColor &);
void sigBGColorChanged(const KoColor &);
void sigBrushChanged(KisBrush * brush);
void sigGradientChanged(KisGradient * gradient);
void sigGradientChanged(KoSegmentGradient * gradient);
void sigPatternChanged(KisPattern * pattern);
void sigPaintopChanged(KoID paintop, const KisPaintOpSettings *paintopSettings);
void sigLayerChanged( const KisLayerSP layer );
......
......@@ -32,12 +32,12 @@
#include <kcomponentdata.h>
#include "KoResource.h"
#include "KoSegmentGradient.h"
#include "kis_factory2.h"
#include "KoGenericRegistry.h"
#include "kis_resourceserver.h"
#include "kis_brush.h"
#include "kis_imagepipe_brush.h"
#include "kis_gradient.h"
#include "kis_pattern.h"
#include "KoColorSet.h"
#include <kogradientmanager.h>
......@@ -157,7 +157,7 @@ KisResourceServerRegistry::KisResourceServerRegistry()
ResourceLoaderThread t3 (patternServer, getFileNames("*.jpg:*.gif:*.png:*.tif:*.xpm:*.bmp:*.pat", "kis_patterns"));
t3.start();
KisResourceServer<KisGradient>* gradientServer = new KisResourceServer<KisGradient>("kis_gradients");
KisResourceServer<KoSegmentGradient>* gradientServer = new KisResourceServer<KoSegmentGradient>("kis_gradients");
ResourceLoaderThread t4 (gradientServer, getFileNames(KoGradientManager::filters().join( ":" ), "kis_gradients"));
t4.start();
......
......@@ -25,6 +25,7 @@
#include <KoPointerEvent.h>
#include <KoViewConverter.h>
#include <KoSelection.h>
#include <KoSegmentGradient.h>
#include "kis_layer_shape.h"
#include "kis_layer_container_shape.h"
......@@ -41,7 +42,6 @@
#include <kis_paintop.h>
#include <kis_brush.h>
#include <kis_pattern.h>
#include <kis_gradient.h>
#include "kis_resource_provider.h"
#include "kis_canvas2.h"
......@@ -58,7 +58,7 @@ struct KisTool::Private {
// From the canvas resources
KisBrush * currentBrush;
KisPattern * currentPattern;
KisGradient * currentGradient;
KoSegmentGradient * currentGradient;
KoColor currentFgColor;
KoColor currentBgColor;
KisComplexColor * currentComplexColor;
......@@ -88,7 +88,7 @@ void KisTool::activate(bool )
d->currentBgColor = m_canvas->resourceProvider()->resource( KoCanvasResource::BackgroundColor ).value<KoColor>();
d->currentBrush = static_cast<KisBrush *>( m_canvas->resourceProvider()->resource( KisResourceProvider::CurrentBrush ).value<void *>() );
d->currentPattern = static_cast<KisPattern *>( m_canvas->resourceProvider()->resource( KisResourceProvider::CurrentPattern).value<void *>() );
d->currentGradient = static_cast<KisGradient *>( m_canvas->resourceProvider()->resource( KisResourceProvider::CurrentGradient ).value<void *>() );
d->currentGradient = static_cast<KoSegmentGradient *>( m_canvas->resourceProvider()->resource( KisResourceProvider::CurrentGradient ).value<void *>() );
d->currentComplexColor = static_cast<KisComplexColor *>( m_canvas->resourceProvider()->resource( KisResourceProvider::CurrentComplexColor ).value<void *>() );
d->currentPaintOp = m_canvas->resourceProvider()->resource( KisResourceProvider::CurrentPaintop ).value<KoID >().id();
d->currentPaintOpSettings = static_cast<KisPaintOpSettings*>( m_canvas->resourceProvider()->resource( KisResourceProvider::CurrentPaintopSettings ).value<void *>() );
......@@ -123,7 +123,7 @@ void KisTool::resourceChanged( int key, const QVariant & v )
d->currentPattern = static_cast<KisPattern *>( v.value<void *>() );
break;
case ( KisResourceProvider::CurrentGradient ):
d->currentGradient = static_cast<KisGradient *>( v.value<void *>() );
d->currentGradient = static_cast<KoSegmentGradient *>( v.value<void *>() );
break;
case ( KisResourceProvider::CurrentPaintop ):
d->currentPaintOp = v.value<KoID >().id();
......@@ -250,7 +250,7 @@ KisPattern * KisTool::currentPattern()
return d->currentPattern;
}
KisGradient * KisTool::currentGradient()
KoSegmentGradient * KisTool::currentGradient()
{
return d->currentGradient;
}
......
......@@ -32,7 +32,7 @@
class KoCanvasBase;
class KisBrush;
class KisPattern;
class KisGradient;
class KoSegmentGradient;
class KisComplexColor;
class KisPaintOpSettings;
......@@ -111,7 +111,7 @@ protected:
KisImageSP currentImage();
KisBrush* currentBrush();
KisPattern* currentPattern();
KisGradient * currentGradient();
KoSegmentGradient * currentGradient();
KisLayerSP currentLayer();
KoColor currentFgColor();
KoColor currentBgColor();
......
......@@ -30,6 +30,7 @@
#include <KoCanvasResourceProvider.h>
#include <KoTool.h>
#include <KoSegmentGradient.h>
#include <krita_export.h>
......@@ -37,7 +38,6 @@
#include <kis_image.h>
#include <kis_brush.h>
#include <kis_gradient.h>
#include <kis_pattern.h>
#include