Krita Source Code Documentation
Loading...
Searching...
No Matches
KisImagePipeBrush Class Reference

#include <kis_imagepipe_brush.h>

+ Inheritance diagram for KisImagePipeBrush:

Classes

struct  Private
 

Public Member Functions

QVector< KisGbrBrushSPbrushes () const
 
quint32 brushIndex () const override
 
bool canPaintFor (const KisPaintInformation &info) override
 
KoResourceSP clone () const override
 
void coldInitBrush () override
 
QString defaultFileExtension () const override
 
void generateMaskAndApplyMaskOrCreateDab (KisFixedPaintDeviceSP dst, KisBrush::ColoringInformation *coloringInformation, KisDabShape const &, const KisPaintInformation &info, double subPixelX=0, double subPixelY=0, qreal softnessFactor=DEFAULT_SOFTNESS_FACTOR, qreal lightnessStrength=DEFAULT_LIGHTNESS_STRENGTH) const override
 
 KisImagePipeBrush (const KisImagePipeBrush &rhs)
 Will call KisBrush's saveToDevice as well.
 
 KisImagePipeBrush (const QString &filename)
 
 KisImagePipeBrush (const QString &name, int w, int h, QVector< QVector< KisPaintDevice * > > devices, QVector< KisParasite::SelectionMode > modes)
 
bool loadFromDevice (QIODevice *dev, KisResourcesInterfaceSP resourcesInterface) override
 
void makeMaskImage (bool preserveAlpha) override
 
qint32 maskHeight (KisDabShape const &, double subPixelX, double subPixelY, const KisPaintInformation &info) const override
 
qint32 maskWidth (KisDabShape const &, double subPixelX, double subPixelY, const KisPaintInformation &info) const override
 
void notifyBrushIsGoingToBeClonedForStroke () override
 
void notifyStrokeStarted () override
 
KisImagePipeBrushoperator= (const KisImagePipeBrush &rhs)=delete
 
KisOptimizedBrushOutline outline (bool forcePreciseOutline=false) const override
 
KisFixedPaintDeviceSP paintDevice (const KoColorSpace *colorSpace, KisDabShape const &, const KisPaintInformation &info, double subPixelX=0, double subPixelY=0) const override
 
const KisPipeBrushParasiteparasite () const
 
QString parasiteSelection ()
 
void prepareForSeqNo (const KisPaintInformation &info, int seqNo) override
 
bool saveToDevice (QIODevice *dev) const override
 
void setAdjustmentMidPoint (quint8 value) override
 
void setAngle (qreal _angle) override
 
void setAutoAdjustMidPoint (bool value) override
 
void setBrightnessAdjustment (qreal value) override
 
void setContrastAdjustment (qreal value) override
 
void setDevices (QVector< QVector< KisPaintDevice * > > devices, int w, int h)
 
void setParasite (const KisPipeBrushParasite &parasite)
 
void setScale (qreal _scale) override
 
void setSpacing (double _spacing) override
 
 ~KisImagePipeBrush () override
 
- Public Member Functions inherited from KisGbrBrush
 KisGbrBrush (const KisGbrBrush &rhs)
 
 KisGbrBrush (const QImage &image, const QString &name=QString())
 Load brush as a copy from the specified QImage (handy when you need to copy a brush!)
 
 KisGbrBrush (const QString &filename)
 Construct brush to load filename later as brush.
 
 KisGbrBrush (const QString &filename, const QByteArray &data, qint32 &dataPos)
 Load brush from the specified data, at position dataPos, and set the filename.
 
 KisGbrBrush (KisPaintDeviceSP image, int x, int y, int w, int h)
 Load brush from the specified paint device, in the specified region.
 
KisGbrBrushoperator= (const KisGbrBrush &rhs)
 
QPair< QString, QString > resourceType () const override
 
 ~KisGbrBrush () override
 
- Public Member Functions inherited from KisColorfulBrush
qreal adjustedMidPoint () const
 
quint8 adjustmentMidPoint () const
 
bool autoAdjustMidPoint () const
 
qreal brightnessAdjustment () const
 
QImage brushTipImage () const override
 brushImage the image the brush tip can paint with. Not all brush types have a single image.
 
qreal contrastAdjustment () const
 
qreal estimatedSourceMidPoint () const
 
bool hasColorAndTransparency () const
 
virtual bool isImageType () const
 
 KisColorfulBrush ()=default
 
 KisColorfulBrush (const KisColorfulBrush &rhs)=default
 
 KisColorfulBrush (const QString &filename)
 
void setHasColorAndTransparency (bool value)
 
- Public Member Functions inherited from KisScalingSizeBrush
 KisScalingSizeBrush ()
 
 KisScalingSizeBrush (const KisScalingSizeBrush &rhs)
 
 KisScalingSizeBrush (const QString &filename)
 
void setUserEffectiveSize (qreal value) override
 
qreal userEffectiveSize () const override
 
- Public Member Functions inherited from KisBrush
qreal angle () const
 
virtual bool applyingGradient () const
 
bool autoSpacingActive () const
 
qreal autoSpacingCoeff () const
 
virtual enumBrushApplication brushApplication () const
 
virtual enumBrushType brushType () const
 
virtual QSizeF characteristicSize (KisDabShape const &) const
 
void clearBrushPyramid ()
 
void generateMaskAndApplyMaskOrCreateDab (KisFixedPaintDeviceSP dst, ColoringInformation *coloringInfo, KisDabShape const &, const KisPaintInformation &info, double subPixelX=0, double subPixelY=0, qreal softnessFactor=DEFAULT_SOFTNESS_FACTOR) const
 
qint32 height () const
 
QPointF hotSpot (KisDabShape const &, const KisPaintInformation &info) const
 
virtual bool isPiercedApprox () const
 
 KisBrush ()
 
 KisBrush (const KisBrush &rhs)
 
 KisBrush (const QString &filename)
 
virtual void lodLimitations (KisPaintopLodLimitations *l) const
 
void mask (KisFixedPaintDeviceSP dst, const KisPaintDeviceSP src, KisDabShape const &shape, const KisPaintInformation &info, double subPixelX=0, double subPixelY=0, qreal softnessFactor=DEFAULT_SOFTNESS_FACTOR, qreal lightnessStrength=DEFAULT_LIGHTNESS_STRENGTH) const
 
void mask (KisFixedPaintDeviceSP dst, const KoColor &color, KisDabShape const &shape, const KisPaintInformation &info, double subPixelX=0, double subPixelY=0, qreal softnessFactor=DEFAULT_SOFTNESS_FACTOR, qreal lightnessStrength=DEFAULT_LIGHTNESS_STRENGTH) const
 
double maskAngle (double angle=0) const
 
virtual qint32 maskHeight (KisDabShape const &, qreal subPixelX, qreal subPixelY, const KisPaintInformation &info) const
 
virtual qint32 maskWidth (KisDabShape const &, qreal subPixelX, qreal subPixelY, const KisPaintInformation &info) const
 
KisBrushoperator= (const KisBrush &rhs)=delete
 
virtual KisFixedPaintDeviceSP outlineSourceImage () const
 
virtual bool preserveLightness () const
 
qreal scale () const
 
void setAutoSpacing (bool active, qreal coeff)
 
double spacing () const
 
virtual bool supportsCaching () const
 
qint32 width () const
 
 ~KisBrush () override
 
- Public Member Functions inherited from KoResource
bool active () const
 
void addMetaData (QString key, QVariant value)
 store the given key, value pair in the resource
 
virtual void clearSideLoadedResources ()
 
virtual QList< KoResourceLoadResultembeddedResources (KisResourcesInterfaceSP globalResourcesInterface) const
 
QString filename () const
 
QImage image () const
 
bool isDirty () const
 
virtual bool isEphemeral () const
 
virtual bool isSerializable () const
 
 KoResource ()
 
 KoResource (const KoResource &rhs)
 
 KoResource (const QString &filename)
 
virtual QList< KoResourceLoadResultlinkedResources (KisResourcesInterfaceSP globalResourcesInterface) const
 
bool load (KisResourcesInterfaceSP resourcesInterface)
 
QString md5Sum (bool generateIfEmpty=true) const
 
QMap< QString, QVariant > metadata () const
 get a map with all the metadata
 
virtual QString name () const
 
KoResourceoperator= (const KoResource &rhs)=delete
 
bool permanent () const
 
virtual QList< int > requiredCanvasResources () const
 
QList< KoResourceLoadResultrequiredResources (KisResourcesInterfaceSP globalResourcesInterface) const
 
int resourceId () const
 
bool save ()
 
void setActive (bool active)
 
void setDirty (bool value)
 Mark the preset as modified but not saved.
 
void setFilename (const QString &filename)
 
void setImage (const QImage &image)
 
void setMD5Sum (const QString &md5sum)
 Set the md5sum of this resource. It must be in hex-encoded string format.
 
void setName (const QString &name)
 
void setPermanent (bool permanent)
 
void setResourceId (int id)
 
void setStorageLocation (const QString &location)
 
void setValid (bool valid)
 
void setVersion (int version)
 
virtual QList< KoResourceLoadResultsideLoadedResources (KisResourcesInterfaceSP globalResourcesInterface) const
 
KoResourceSignature signature () const
 
QString storageLocation () const
 
QList< KoResourceLoadResulttakeSideLoadedResources (KisResourcesInterfaceSP globalResourcesInterface)
 
virtual QImage thumbnail () const
 thumbnail the thumbnail image to use in resource selectors
 
virtual QString thumbnailPath () const
 thumbnailPath returns the path to a separate thumbnail image, outside the actual resource file itself. If the path is relative, it is supposed start in the same location as the resource itself. If it's absolute, that is, it starts with "/", it is from the root of the storage.
 
virtual void updateThumbnail ()
 updateThumbnail updates the thumbnail for this resource. Reimplement if your thumbnail is something else than the image set with setImage.
 
bool valid () const
 
int version () const
 Get the version of the resource.
 
virtual ~KoResource ()
 
- Public Member Functions inherited from Private
 Private (KisCanvas2 *c)
 

Protected Member Functions

virtual void setBrushApplication (enumBrushApplication brushApplication) override
 
virtual void setGradient (KoAbstractGradientSP gradient) override
 
- Protected Member Functions inherited from KisGbrBrush
void setBrushTipImage (const QImage &image) override
 
void toXML (QDomDocument &d, QDomElement &e) const override
 
- Protected Member Functions inherited from KisBrush
void generateOutlineCache ()
 
bool outlineCacheIsValid () const
 
void predefinedBrushToXML (const QString &type, QDomElement &e) const
 
void resetOutlineCache ()
 
virtual void setBrushType (enumBrushType type)
 
void setHeight (qint32 height)
 
void setHotSpot (QPointF)
 
void setWidth (qint32 width)
 

Private Member Functions

bool initFromData (const QByteArray &data)
 
KisGbrBrushSP testingGetCurrentBrush (const KisPaintInformation &info) const
 
void testingSelectNextBrush (const KisPaintInformation &info) const
 

Private Attributes

Private *const d
 
QString parasiteSelectionString
 

Friends

class KisImagePipeBrushTest
 Will call KisBrush's saveToDevice as well.
 

Additional Inherited Members

- Static Public Member Functions inherited from KisBrush
static KisBrushSP fromXML (const QDomElement &element, KisResourcesInterfaceSP resourcesInterface)
 
static KoResourceLoadResult fromXMLLoadResult (const QDomElement &element, KisResourcesInterfaceSP resourcesInterface)
 
- Public Attributes inherited from KoResource
bool active {true}
 
QString filename
 
QImage image
 
QString md5sum
 
QMap< QString, QVariant > metadata
 
bool modified {false}
 
QString name
 
bool permanent {false}
 
int resourceId {-1}
 
QString storageLocation
 
bool valid {false}
 
int version {-1}
 
- Public Attributes inherited from Private
KisCanvas2canvas
 
int displayedFrame
 
int intendedFrame
 
- Static Public Attributes inherited from KisBrush
static const QString brushTypeMetaDataKey = "image-based-brush"
 

Detailed Description

Definition at line 37 of file kis_imagepipe_brush.h.

Constructor & Destructor Documentation

◆ KisImagePipeBrush() [1/3]

KisImagePipeBrush::KisImagePipeBrush ( const QString & filename)

Definition at line 216 of file kis_imagepipe_brush.cpp.

218 , d(new Private())
219{
220}
KisGbrBrush(const QString &filename)
Construct brush to load filename later as brush.
QString filename

◆ KisImagePipeBrush() [2/3]

KisImagePipeBrush::KisImagePipeBrush ( const QString & name,
int w,
int h,
QVector< QVector< KisPaintDevice * > > devices,
QVector< KisParasite::SelectionMode > modes )

Specialized constructor that makes a new pipe brush from a sequence of samesize devices. The fact that it's a vector of a vector, is to support multidimensional brushes (not yet supported!)

Definition at line 222 of file kis_imagepipe_brush.cpp.

225 : KisGbrBrush(QString())
226 , d(new Private())
227{
228 Q_ASSERT(devices.count() == modes.count());
229 Q_ASSERT(devices.count() > 0);
230 Q_ASSERT(devices.count() < 2); // XXX Multidimensionals not supported yet, change to MaxDim!
231
232 setName(name);
233
235
236 parasite.dim = devices.count();
237 // XXX Change for multidim! :
238 parasite.ncells = devices.at(0).count();
239 parasite.rank[0] = parasite.ncells; // ### This can masquerade some bugs, be careful here in the future
240 parasite.selection[0] = modes.at(0);
241
242
243 // XXX needsmovement!
244
246
248 setDevices(devices, w, h);
249 setBrushTipImage(d->brushesPipe.firstBrush()->brushTipImage());
250}
QSharedPointer< BrushType > firstBrush() const
void setBrushTipImage(const QImage &image) override
void setDevices(QVector< QVector< KisPaintDevice * > > devices, int w, int h)
const KisPipeBrushParasite & parasite() const
void setParasite(const KisPipeBrushParasite &parasite)
KisParasite::SelectionMode selection[MaxDim]
void setBrushesCount()
Initializes the brushesCount helper.
void setName(const QString &name)
QString name

References KisImagePipeBrush::Private::brushesPipe, d, KisPipeBrushParasite::dim, KisBrushesPipe< BrushType >::firstBrush(), KoResource::name, KisPipeBrushParasite::ncells, parasite(), KisPipeBrushParasite::rank, KisPipeBrushParasite::selection, KisPipeBrushParasite::setBrushesCount(), KisGbrBrush::setBrushTipImage(), setDevices(), KoResource::setName(), and setParasite().

◆ ~KisImagePipeBrush()

KisImagePipeBrush::~KisImagePipeBrush ( )
override

Definition at line 263 of file kis_imagepipe_brush.cpp.

264{
265 delete d;
266}

References d.

◆ KisImagePipeBrush() [3/3]

KisImagePipeBrush::KisImagePipeBrush ( const KisImagePipeBrush & rhs)

Will call KisBrush's saveToDevice as well.

Definition at line 252 of file kis_imagepipe_brush.cpp.

253 : KisGbrBrush(rhs),
254 d(new Private(*rhs.d))
255{
256}

Member Function Documentation

◆ brushes()

QVector< KisGbrBrushSP > KisImagePipeBrush::brushes ( ) const

Definition at line 398 of file kis_imagepipe_brush.cpp.

399{
400 return d->brushesPipe.brushes();
401}
QVector< QSharedPointer< BrushType > > brushes()

References KisBrushesPipe< BrushType >::brushes(), KisImagePipeBrush::Private::brushesPipe, and d.

◆ brushIndex()

quint32 KisImagePipeBrush::brushIndex ( ) const
overridevirtual
Returns
the currently selected index of the brush if the brush consists of multiple images
See also
prepareForSeqNo()

Reimplemented from KisBrush.

Definition at line 468 of file kis_imagepipe_brush.cpp.

469{
471}

References KisImagePipeBrush::Private::brushesPipe, KisImageBrushesPipe::currentBrushIndex(), and d.

◆ canPaintFor()

bool KisImagePipeBrush::canPaintFor ( const KisPaintInformation & )
overridevirtual

Returns true if this brush can return something useful for the info. This is used by Pipe Brushes that can't paint sometimes

Reimplemented from KisBrush.

Definition at line 458 of file kis_imagepipe_brush.cpp.

459{
460 return (!d->brushesPipe.parasite().needsMovement || info.drawingDistance() >= 0.5);
461}
const KisPipeBrushParasite & parasite() const
bool needsMovement
If true, the brush won't be painted when there is no motion.

References KisImagePipeBrush::Private::brushesPipe, d, KisPaintInformation::drawingDistance(), KisPipeBrushParasite::needsMovement, and KisImageBrushesPipe::parasite().

◆ clone()

KoResourceSP KisImagePipeBrush::clone ( ) const
overridevirtual

Reimplemented from KisGbrBrush.

Definition at line 258 of file kis_imagepipe_brush.cpp.

259{
260 return KoResourceSP(new KisImagePipeBrush(*this));
261}
KisImagePipeBrush(const QString &filename)
QSharedPointer< KoResource > KoResourceSP

References KisImagePipeBrush().

◆ coldInitBrush()

void KisImagePipeBrush::coldInitBrush ( )
overridevirtual

◆ defaultFileExtension()

QString KisImagePipeBrush::defaultFileExtension ( ) const
overridevirtual
Returns
default file extension for saving the brush

Reimplemented from KisGbrBrush.

Definition at line 463 of file kis_imagepipe_brush.cpp.

464{
465 return QString(".gih");
466}

◆ generateMaskAndApplyMaskOrCreateDab()

void KisImagePipeBrush::generateMaskAndApplyMaskOrCreateDab ( KisFixedPaintDeviceSP dst,
KisBrush::ColoringInformation * coloringInfo,
KisDabShape const & shape,
const KisPaintInformation & info,
double subPixelX = 0,
double subPixelY = 0,
qreal softnessFactor = DEFAULT_SOFTNESS_FACTOR,
qreal lightnessStrength = DEFAULT_LIGHTNESS_STRENGTH ) const
overridevirtual

Create a mask and either mask dst (that is, change all alpha values of the existing pixels to those of the mask) or, if coloringInfo is present, clear dst and fill dst with pixels according to coloringInfo, masked according to the generated mask.

Parameters
dstthe destination that will be draw on the image, and this function will edit its alpha channel
coloringInfocoloring information that will be copied on the dab, it can be null
shapea shape applied on the alpha mask
infothe painting information (this is only and should only be used by KisImagePipeBrush and only to be backward compatible with the Gimp, KisImagePipeBrush is ignoring scale and angle information)
subPixelXsub position of the brush (contained between 0.0 and 1.0)
subPixelYsub position of the brush (contained between 0.0 and 1.0)
softnessFactorsoftness factor of the brush
Returns
a mask computed from the grey-level values of the pixels in the brush.

Reimplemented from KisBrush.

Definition at line 384 of file kis_imagepipe_brush.cpp.

389{
390 d->brushesPipe.generateMaskAndApplyMaskOrCreateDab(dst, coloringInformation, shape, info, subPixelX, subPixelY, softnessFactor, lightnessStrength);
391}
void generateMaskAndApplyMaskOrCreateDab(KisFixedPaintDeviceSP dst, KisBrush::ColoringInformation *coloringInformation, KisDabShape const &shape, const KisPaintInformation &info, double subPixelX, double subPixelY, qreal softnessFactor, qreal lightnessStrength=DEFAULT_LIGHTNESS_STRENGTH)

References KisImagePipeBrush::Private::brushesPipe, d, and KisBrushesPipe< BrushType >::generateMaskAndApplyMaskOrCreateDab().

◆ initFromData()

bool KisImagePipeBrush::initFromData ( const QByteArray & data)
private

Definition at line 276 of file kis_imagepipe_brush.cpp.

277{
278 if (data.size() == 0) return false;
279 // XXX: this doesn't correctly load the image pipe brushes yet.
280
281 // XXX: This stuff is in utf-8, too.
282 // The first line contains the name -- this means we look until we arrive at the first newline
283 QByteArray line1;
284
285 qint32 i = 0;
286
287 while (i < data.size() && data[i] != '\n') {
288 line1.append(data[i]);
289 i++;
290 }
291 setName(QString::fromUtf8(line1, line1.size()));
292
293 i++; // Skip past the first newline
294
295 // The second line contains the number of brushes, separated by a space from the parasite
296
297 // XXX: This stuff is in utf-8, too.
298 QByteArray line2;
299 while (i < data.size() && data[i] != '\n') {
300 line2.append(data[i]);
301 i++;
302 }
303
304 QString paramline = QString::fromUtf8(line2, line2.size());
305 qint32 numOfBrushes = paramline.left(paramline.indexOf(' ')).toUInt();
306 QString parasiteString = paramline.mid(paramline.indexOf(' ') + 1);
307
310
311 parasiteSelectionString = parasite.selectionMode; // selection mode to return to UI
312
314 i++; // Skip past the second newline
315
316 for (int brushIndex = d->brushesPipe.sizeBrush();
317 brushIndex < numOfBrushes && i < data.size(); brushIndex++) {
318
319 KisGbrBrushSP brush = KisGbrBrushSP(new KisGbrBrush(name() + '_' + QString().setNum(brushIndex),
320 data,
321 i));
322
323 d->brushesPipe.addBrush(brush);
324 }
325
326 if (numOfBrushes > 0) {
327 setValid(true);
328 setSpacing(d->brushesPipe.lastBrush()->spacing());
329 setWidth(d->brushesPipe.firstBrush()->width());
330 setHeight(d->brushesPipe.firstBrush()->height());
331 setBrushTipImage(d->brushesPipe.firstBrush()->brushTipImage());
332 setBrushApplication(d->brushesPipe.firstBrush()->brushApplication());
335 }
336
337 return true;
338}
virtual void setBrushType(enumBrushType type)
void setWidth(qint32 width)
void setHeight(qint32 height)
QSharedPointer< BrushType > lastBrush() const
bool hasColorAndTransparency() const
void addBrush(QSharedPointer< BrushType > brush)
bool isImageType() const
void setHasColorAndTransparency(bool value)
void setParasite(const KisPipeBrushParasite &parasite)
quint32 brushIndex() const override
virtual void setBrushApplication(enumBrushApplication brushApplication) override
void setSpacing(double _spacing) override
@ PIPE_IMAGE
Definition kis_brush.h:35
@ PIPE_MASK
Definition kis_brush.h:34
QSharedPointer< KisGbrBrush > KisGbrBrushSP
void setValid(bool valid)

References KisBrushesPipe< BrushType >::addBrush(), KisImagePipeBrush::Private::brushesPipe, brushIndex(), d, KisBrushesPipe< BrushType >::firstBrush(), KisBrushesPipe< BrushType >::hasColorAndTransparency(), KisBrushesPipe< BrushType >::isImageType(), KisGbrBrush::KisGbrBrush(), KisBrushesPipe< BrushType >::lastBrush(), KoResource::name, parasite(), parasiteSelectionString, PIPE_IMAGE, PIPE_MASK, KisPipeBrushParasite::sanitize(), KisPipeBrushParasite::selectionMode, setBrushApplication(), KisGbrBrush::setBrushTipImage(), KisBrush::setBrushType(), KisColorfulBrush::setHasColorAndTransparency(), KisBrush::setHeight(), KoResource::setName(), KisImageBrushesPipe::setParasite(), setSpacing(), KoResource::setValid(), KisBrush::setWidth(), and KisBrushesPipe< BrushType >::sizeBrush().

◆ loadFromDevice()

bool KisImagePipeBrush::loadFromDevice ( QIODevice * dev,
KisResourcesInterfaceSP resourcesInterface )
overridevirtual

Reimplemented from KisGbrBrush.

Definition at line 268 of file kis_imagepipe_brush.cpp.

269{
270 Q_UNUSED(resourcesInterface);
271
272 QByteArray data = dev->readAll();
273 return initFromData(data);
274}
bool initFromData(const QByteArray &data)

References initFromData().

◆ makeMaskImage()

void KisImagePipeBrush::makeMaskImage ( bool preserveAlpha)
overridevirtual

Convert the mask to inverted gray scale, so it is alpha mask. It can be used as MASK brush type. This operates on the data of the brush, so it destruct the original brush data.

Parameters
preserveAlphaconvert to grayscale, but save as full RGBA format, to allow preserving lightness option

Reimplemented from KisGbrBrush.

Definition at line 417 of file kis_imagepipe_brush.cpp.

418{
419 KisGbrBrush::makeMaskImage(preserveAlpha);
420 d->brushesPipe.makeMaskImage(preserveAlpha);
422}
virtual void makeMaskImage(bool preserveAlpha)
void makeMaskImage(bool preserveAlpha)

References KisImagePipeBrush::Private::brushesPipe, d, KisGbrBrush::makeMaskImage(), KisImageBrushesPipe::makeMaskImage(), PIPE_MASK, and KisBrush::setBrushType().

◆ maskHeight()

qint32 KisImagePipeBrush::maskHeight ( KisDabShape const & shape,
double subPixelX,
double subPixelY,
const KisPaintInformation & info ) const
override

Definition at line 478 of file kis_imagepipe_brush.cpp.

479{
480 return d->brushesPipe.maskHeight(shape, subPixelX, subPixelY, info);
481}
qint32 maskHeight(KisDabShape const &shape, double subPixelX, double subPixelY, const KisPaintInformation &info)

References KisImagePipeBrush::Private::brushesPipe, d, and KisBrushesPipe< BrushType >::maskHeight().

◆ maskWidth()

qint32 KisImagePipeBrush::maskWidth ( KisDabShape const & shape,
double subPixelX,
double subPixelY,
const KisPaintInformation & info ) const
override

Definition at line 473 of file kis_imagepipe_brush.cpp.

474{
475 return d->brushesPipe.maskWidth(shape, subPixelX, subPixelY, info);
476}
qint32 maskWidth(KisDabShape const &shape, double subPixelX, double subPixelY, const KisPaintInformation &info)

References KisImagePipeBrush::Private::brushesPipe, d, and KisBrushesPipe< BrushType >::maskWidth().

◆ notifyBrushIsGoingToBeClonedForStroke()

void KisImagePipeBrush::notifyBrushIsGoingToBeClonedForStroke ( )
overridevirtual

Is called by the paint op before it is going to clone the brush into multiple instances to pass to different threads. During this call the brush is free to prepare some structures that may be shared by all the clones without excessive recalculation.

Default implementation for all image-based brushes: just recreate the shared pyramid

Reimplemented from KisBrush.

Definition at line 393 of file kis_imagepipe_brush.cpp.

References KisImagePipeBrush::Private::brushesPipe, d, and KisBrushesPipe< BrushType >::notifyBrushIsGoingToBeClonedForStroke().

◆ notifyStrokeStarted()

void KisImagePipeBrush::notifyStrokeStarted ( )
overridevirtual

Is called by the paint op when a paintop starts a stroke. The point is that we store brushes a server while the paint ops are are recreated all the time. Is means that upon a stroke start the brushes may need to clear its state.

Reimplemented from KisBrush.

Definition at line 374 of file kis_imagepipe_brush.cpp.

375{
377}
void notifyStrokeStarted() override

References KisImagePipeBrush::Private::brushesPipe, d, and KisImageBrushesPipe::notifyStrokeStarted().

◆ operator=()

KisImagePipeBrush & KisImagePipeBrush::operator= ( const KisImagePipeBrush & rhs)
delete

◆ outline()

KisOptimizedBrushOutline KisImagePipeBrush::outline ( bool forcePreciseOutline = false) const
overridevirtual

Reimplemented from KisBrush.

Definition at line 448 of file kis_imagepipe_brush.cpp.

449{
450 Q_UNUSED(forcePreciseOutline);
451
453 Q_ASSERT(brush);
454
455 return brush->outline();
456}

References KisImagePipeBrush::Private::brushesPipe, d, and KisBrushesPipe< BrushType >::firstBrush().

◆ paintDevice()

KisFixedPaintDeviceSP KisImagePipeBrush::paintDevice ( const KoColorSpace * colorSpace,
KisDabShape const & shape,
const KisPaintInformation & info,
double subPixelX = 0,
double subPixelY = 0 ) const
overridevirtual
Returns
the next image in the pipe.

Reimplemented from KisBrush.

Definition at line 403 of file kis_imagepipe_brush.cpp.

408{
409 return d->brushesPipe.paintDevice(colorSpace, shape, info, subPixelX, subPixelY);
410}
KisFixedPaintDeviceSP paintDevice(const KoColorSpace *colorSpace, KisDabShape const &shape, const KisPaintInformation &info, double subPixelX, double subPixelY)

References KisImagePipeBrush::Private::brushesPipe, d, and KisBrushesPipe< BrushType >::paintDevice().

◆ parasite()

const KisPipeBrushParasite & KisImagePipeBrush::parasite ( ) const

Definition at line 525 of file kis_imagepipe_brush.cpp.

525 {
526 return d->brushesPipe.parasite();
527}

References KisImagePipeBrush::Private::brushesPipe, d, and KisImageBrushesPipe::parasite().

◆ parasiteSelection()

QString KisImagePipeBrush::parasiteSelection ( )

Definition at line 412 of file kis_imagepipe_brush.cpp.

413{
415}

References parasiteSelectionString.

◆ prepareForSeqNo()

void KisImagePipeBrush::prepareForSeqNo ( const KisPaintInformation & info,
int seqNo )
overridevirtual

Is called by the multithreaded queue to prepare a specific brush tip for the particular seqNo.

NOTE: one should use always call prepareForSeqNo() before using the brush

Currently, this is used by pipe'd brushes to implement incremental and random parasites

Reimplemented from KisBrush.

Definition at line 379 of file kis_imagepipe_brush.cpp.

380{
381 d->brushesPipe.prepareForSeqNo(info, seqNo);
382}
void prepareForSeqNo(const KisPaintInformation &info, int seqNo)

References KisImagePipeBrush::Private::brushesPipe, d, and KisBrushesPipe< BrushType >::prepareForSeqNo().

◆ saveToDevice()

bool KisImagePipeBrush::saveToDevice ( QIODevice * dev) const
overridevirtual

Reimplemented from KisGbrBrush.

Definition at line 340 of file kis_imagepipe_brush.cpp.

341{
342 QByteArray utf8Name = name().toUtf8(); // Names in v2 brushes are in UTF-8
343 char const* name = utf8Name.data();
344 int len = qstrlen(name);
345
347 warnImage << "Save to file for pipe brushes with dim != not yet supported!";
348 return false;
349 }
350
351 // Save this pipe brush: first the header, and then all individual brushes consecutively
352 // XXX: this needs some care for when we have > 1 dimension)
353
354 // Gimp Pipe Brush header format: Name\n<number of brushes> <parasite>\n
355
356 // The name\n
357 if (dev->write(name, len) == -1)
358 return false;
359
360 if (!dev->putChar('\n'))
361 return false;
362
363 // Write the parasite (also writes number of brushes)
364 if (!d->brushesPipe.parasite().saveToDevice(dev))
365 return false;
366
367 if (!dev->putChar('\n'))
368 return false;
369
370 // <gbr brushes>
371 return d->brushesPipe.saveToDevice(dev);
372}
bool saveToDevice(QIODevice *dev) const
bool saveToDevice(QIODevice *dev) const
#define warnImage
Definition kis_debug.h:88

References KisImagePipeBrush::Private::brushesPipe, d, KisPipeBrushParasite::dim, KisPipeBrushParasite::MaxDim, KoResource::name, KisImageBrushesPipe::parasite(), KisImageBrushesPipe::saveToDevice(), KisPipeBrushParasite::saveToDevice(), and warnImage.

◆ setAdjustmentMidPoint()

void KisImagePipeBrush::setAdjustmentMidPoint ( quint8 value)
overridevirtual

◆ setAngle()

void KisImagePipeBrush::setAngle ( qreal _angle)
overridevirtual

Reimplemented from KisBrush.

Definition at line 483 of file kis_imagepipe_brush.cpp.

484{
485 KisGbrBrush::setAngle(_angle);
486 d->brushesPipe.setAngle(_angle);
487}
virtual void setAngle(qreal _angle)
void setAngle(qreal angle)

References KisImagePipeBrush::Private::brushesPipe, d, KisBrush::setAngle(), and KisBrushesPipe< BrushType >::setAngle().

◆ setAutoAdjustMidPoint()

void KisImagePipeBrush::setAutoAdjustMidPoint ( bool value)
overridevirtual

◆ setBrightnessAdjustment()

void KisImagePipeBrush::setBrightnessAdjustment ( qreal value)
overridevirtual

◆ setBrushApplication()

void KisImagePipeBrush::setBrushApplication ( enumBrushApplication brushApplication)
overrideprotectedvirtual

Reimplemented from KisBrush.

Definition at line 501 of file kis_imagepipe_brush.cpp.

502{
503 //Set all underlying brushes to use the same brush Application
506}
virtual enumBrushApplication brushApplication() const
virtual void setBrushApplication(enumBrushApplication brushApplication)
void setBrushApplication(enumBrushApplication brushApplication) const

References KisBrush::brushApplication(), KisImagePipeBrush::Private::brushesPipe, d, KisBrush::setBrushApplication(), and KisBrushesPipe< BrushType >::setBrushApplication().

◆ setContrastAdjustment()

void KisImagePipeBrush::setContrastAdjustment ( qreal value)
overridevirtual

◆ setDevices()

void KisImagePipeBrush::setDevices ( QVector< QVector< KisPaintDevice * > > devices,
int w,
int h )

Definition at line 534 of file kis_imagepipe_brush.cpp.

535{
536
537 for (int i = 0; i < devices.at(0).count(); i++) {
538 d->brushesPipe.addBrush(KisGbrBrushSP(new KisGbrBrush(devices.at(0).at(i), 0, 0, w, h)));
539 }
540}

References KisBrushesPipe< BrushType >::addBrush(), KisImagePipeBrush::Private::brushesPipe, d, and KisGbrBrush::KisGbrBrush().

◆ setGradient()

void KisImagePipeBrush::setGradient ( KoAbstractGradientSP gradient)
overrideprotectedvirtual

Reimplemented from KisBrush.

Definition at line 508 of file kis_imagepipe_brush.cpp.

508 {
509 //Set all underlying brushes to use the same gradient
510 KisGbrBrush::setGradient(gradient);
511 d->brushesPipe.setGradient(gradient);
512}
virtual void setGradient(KoAbstractGradientSP gradient)
void setGradient(KoAbstractGradientSP gradient) const

References KisImagePipeBrush::Private::brushesPipe, d, KisBrush::setGradient(), and KisBrushesPipe< BrushType >::setGradient().

◆ setParasite()

void KisImagePipeBrush::setParasite ( const KisPipeBrushParasite & parasite)

◆ setScale()

void KisImagePipeBrush::setScale ( qreal _scale)
overridevirtual

Reimplemented from KisBrush.

Definition at line 489 of file kis_imagepipe_brush.cpp.

490{
491 KisGbrBrush::setScale(_scale);
492 d->brushesPipe.setScale(_scale);
493}
virtual void setScale(qreal _scale)
void setScale(qreal scale)

References KisImagePipeBrush::Private::brushesPipe, d, KisBrush::setScale(), and KisBrushesPipe< BrushType >::setScale().

◆ setSpacing()

void KisImagePipeBrush::setSpacing ( double spacing)
overridevirtual

Change the spacing of the brush.

Parameters
spacinga spacing of 1.0 means that strokes will be separated from one time the size of the brush.

Reimplemented from KisBrush.

Definition at line 495 of file kis_imagepipe_brush.cpp.

496{
497 KisGbrBrush::setSpacing(_spacing);
498 d->brushesPipe.setSpacing(_spacing);
499}
virtual void setSpacing(double spacing)
void setSpacing(double spacing)

References KisImagePipeBrush::Private::brushesPipe, d, KisBrush::setSpacing(), and KisBrushesPipe< BrushType >::setSpacing().

◆ testingGetCurrentBrush()

KisGbrBrushSP KisImagePipeBrush::testingGetCurrentBrush ( const KisPaintInformation & info) const
private

Definition at line 514 of file kis_imagepipe_brush.cpp.

515{
516 return d->brushesPipe.currentBrush(info);
517}
QSharedPointer< BrushType > currentBrush(const KisPaintInformation &info)

References KisImagePipeBrush::Private::brushesPipe, KisBrushesPipe< BrushType >::currentBrush(), and d.

◆ testingSelectNextBrush()

void KisImagePipeBrush::testingSelectNextBrush ( const KisPaintInformation & info) const
private

Definition at line 520 of file kis_imagepipe_brush.cpp.

521{
523}
void testingSelectNextBrush(const KisPaintInformation &info)

References KisImagePipeBrush::Private::brushesPipe, d, and KisBrushesPipe< BrushType >::testingSelectNextBrush().

Friends And Related Symbol Documentation

◆ KisImagePipeBrushTest

friend class KisImagePipeBrushTest
friend

Will call KisBrush's saveToDevice as well.

Definition at line 119 of file kis_imagepipe_brush.h.

Member Data Documentation

◆ d

Private* const KisImagePipeBrush::d
private

Definition at line 130 of file kis_imagepipe_brush.h.

◆ parasiteSelectionString

QString KisImagePipeBrush::parasiteSelectionString
private

Definition at line 126 of file kis_imagepipe_brush.h.


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