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

Inherit from KisScalingsizebrush in KisVectorShapeObject

parent dfc52d7b
......@@ -24,6 +24,25 @@
#include <KoXmlReader.h>
#include <KoShapePainter.h>
#define DEFAULT_SPACING 5.0
KisVectorShapeObject::KisVectorShapeObject(const QString& filename)
: KisScalingSizeBrush(filename)
{
setBrushType(MASK);
setHasColor(false);
setSpacing(DEFAULT_SPACING);
}
KisVectorShapeObject::KisVectorShapeObject(const KisVectorShapeObject& rhs)
: KisScalingSizeBrush(rhs)
, m_shape(rhs.m_shape)
, m_image(rhs.m_image)
{
}
KisVectorShapeObject::KisVectorShapeObject(KoShape* shape)
{
m_shape = shape;
......@@ -56,13 +75,18 @@ 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);
setValid(true);
setBrushType(MASK);
setHasColor(false);
setBrushTipImage(theImage);
// m_image = theImage;
}
enumBrushType KisVectorShapeObject::brushType() const
{
return IMAGE;
return MASK;
}
//QImage KisVectorShapeObject::image()
......
......@@ -37,7 +37,12 @@ class BRUSH_EXPORT KisVectorShapeObject : public KisScalingSizeBrush
protected:
public:
/// Construct brush to load filename later as brush
KisVectorShapeObject(const QString& filename);
KisVectorShapeObject(KoShape* shape);
KisVectorShapeObject(const KisVectorShapeObject& rhs);
/**
......
......@@ -94,17 +94,16 @@ public:
};
KisVectorAnimatedBrush::KisVectorAnimatedBrush(const QString& filename)
: KisScalingSizeBrush(filename)
: KisVectorShapeObject(filename)
, m_d(new Private())
{
setBrushType(PIPE_IMAGE);
setSpacing(1.0);
setBrushType(PIPE_MASK);
setSpacing(5.0);
setHasColor(false);
}
KisVectorAnimatedBrush::KisVectorAnimatedBrush(const KisVectorAnimatedBrush& rhs)
: KisScalingSizeBrush(rhs)
: KisVectorShapeObject(rhs)
, m_d(new Private(*rhs.m_d))
, m_svg(rhs.m_svg)
{
......@@ -168,17 +167,14 @@ bool KisVectorAnimatedBrush::loadFromDevice(QIODevice *dev)
}
// KisVectorShapeObject currentVectorObject = m_vectorObjects.at(m_parasite.index());
// QImage tip = currentVectorObject.image();
// for(int i = 0; i<m_shapes.count(); i++)
// {
// KisVectorShapeObject* brush = new KisVectorShapeObject(name() + '_' + QString().setNum(i),
// m_vectorObjects.at(m_parasite.)
// }
// // setBrushTipImage(tip);
setBrushTipImage(m_d->brushesPipe.firstBrush()->brushTipImage());
setValid(true);
......
......@@ -34,7 +34,7 @@
//
class BRUSH_EXPORT KisVectorAnimatedBrush : public KisScalingSizeBrush
class BRUSH_EXPORT KisVectorAnimatedBrush : public KisVectorShapeObject
{
public:
......
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