Commit e8248790 authored by Blackbeard (alberto flores)'s avatar Blackbeard (alberto flores) 🚢

Use KisVectorHelperPipe for the Index

parent bbd5667e
......@@ -56,13 +56,14 @@ void KisVectorShapeObject::renderImage(int width, int height)
for (int i = 0; i < 256; ++i) table.push_back(qRgb(i, i, i));
theImage = theImage.convertToFormat(QImage::Format_Indexed8, table);
m_image = theImage;
setBrushTipImage(theImage);
//m_image = theImage;
}
QImage KisVectorShapeObject::image()
{
return m_image;
return brushTipImage();
}
......@@ -71,3 +72,9 @@ KoShape* KisVectorShapeObject::shape()
return m_shape;
}
KisBrush* KisVectorShapeObject::clone() const
{
return new KisVectorShapeObject(*this);
}
......@@ -20,14 +20,42 @@
#define KISVECTORSHAPEOBJECT_H
#include <KoShape.h>
#include <qimage.h>
class KisVectorShapeObject
#include <QImage>
#include <QVector>
#include <kis_types.h>
#include <kis_shared.h>
#include <brushengine/kis_paint_information.h>
#include <kis_scaling_size_brush.h>
#include "kritabrush_export.h"
class BRUSH_EXPORT KisVectorShapeObject : public KisScalingSizeBrush
{
protected:
public:
KisVectorShapeObject(KoShape* shape);
/**
* Makes a copy of this brush.
*/
KisBrush* clone() const override;
/*
bool load() override;
bool loadFromDevice(QIODevice *dev) override;
bool save() override;
bool saveToDevice(QIODevice *dev) const override;
QString defaultFileExtension() const override;
void toXML(QDomDocument& d, QDomElement& e) const override;
*/
void setShape(KoShape* shape);
......@@ -37,13 +65,12 @@ public:
private:
private:
KoShape* m_shape;
QImage m_image;
};
......
......@@ -34,7 +34,7 @@
#include <QDebug>
// helper Class to hold all the KisVectorShape Objects
class KisVectorHelperPipe : public KisBrushesPipe<KisVectorShapeObject>
{
public:
......@@ -54,10 +54,15 @@ public:
void updateBrushIndexes(const KisPaintInformation& info, int seqNo) override {
Q_UNUSED(info)
Q_UNUSED(seqNo)
qDebug() << "dab";
m_parasite.nextIndex();
m_currentIndex = m_parasite.index();
}
void notifyStrokeStarted() override {
qDebug() << "stroke";
}
void setParasite(const KisVectorBrushParasite& parasite) {
m_parasite = parasite;
}
......@@ -129,6 +134,8 @@ bool KisVectorAnimatedBrush::loadFromDevice(QIODevice *dev)
// set Index to 0
m_parasite.setIndex(0);
m_d->brushesPipe.setParasite(m_parasite);
// clean de brush
m_vectorObjects.clear();
......@@ -195,7 +202,7 @@ void KisVectorAnimatedBrush::toXML(QDomDocument& d, QDomElement& e) const
KisBrush::toXML(d, e);
}
/*
void KisVectorAnimatedBrush::prepareForSeqNo(const KisPaintInformation &info, int seqNo)
{
Q_UNUSED(info)
......@@ -206,7 +213,7 @@ void KisVectorAnimatedBrush::prepareForSeqNo(const KisPaintInformation &info, in
}
}
/*
void KisVectorAnimatedBrush::notifyCachedDabPainted(const KisPaintInformation &info)
{
Q_UNUSED(info)
......@@ -216,14 +223,24 @@ void KisVectorAnimatedBrush::notifyCachedDabPainted(const KisPaintInformation &i
newbrushTip();
}
*/
/*
void KisVectorAnimatedBrush::notifyStrokeStarted()
{
int number = m_parasite.numberStrokes();
qDebug() << "Stroke:" << number;
}
*/
void KisVectorAnimatedBrush::notifyStrokeStarted()
{
m_d->brushesPipe.notifyStrokeStarted();
}
void KisVectorAnimatedBrush::prepareForSeqNo(const KisPaintInformation &info, int seqNo)
{
m_d->brushesPipe.prepareForSeqNo(info, seqNo);
}
void KisVectorAnimatedBrush::newbrushTip()
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment