|
Krita Source Code Documentation
|
#include <kis_auto_brush.h>
Inheritance diagram for KisAutoBrush:Classes | |
| struct | Private |
Public Member Functions | |
| QSizeF | characteristicSize (KisDabShape const &) const override |
| KoResourceSP | clone () const override |
| void | coldInitBrush () override |
| qreal | density () const |
| void | generateMaskAndApplyMaskOrCreateDab (KisFixedPaintDeviceSP dst, KisBrush::ColoringInformation *src, KisDabShape const &, const KisPaintInformation &info, double subPixelX=0, double subPixelY=0, qreal softnessFactor=DEFAULT_SOFTNESS_FACTOR, qreal lightnessStrength=DEFAULT_LIGHTNESS_STRENGTH) const override |
| bool | isEphemeral () const override |
| bool | isPiercedApprox () const override |
| KisAutoBrush (const KisAutoBrush &rhs) | |
| KisAutoBrush (KisMaskGenerator *as, qreal angle, qreal randomness, qreal density=1.0) | |
| bool | loadFromDevice (QIODevice *dev, KisResourcesInterfaceSP resourcesInterface) override |
| void | lodLimitations (KisPaintopLodLimitations *l) const override |
| const KisMaskGenerator * | maskGenerator () const |
| qint32 | maskHeight (KisDabShape const &shape, qreal subPixelX, qreal subPixelY, const KisPaintInformation &info) const override |
| qint32 | maskWidth (KisDabShape const &shape, qreal subPixelX, qreal subPixelY, const KisPaintInformation &info) const override |
| void | notifyBrushIsGoingToBeClonedForStroke () override |
| KisAutoBrush & | operator= (const KisAutoBrush &rhs)=delete |
| KisOptimizedBrushOutline | outline (bool forcePreciseOutline=false) const override |
| KisFixedPaintDeviceSP | outlineSourceImage () const override |
| KisFixedPaintDeviceSP | paintDevice (const KoColorSpace *, KisDabShape const &, const KisPaintInformation &, double=0, double=0) const override |
| qreal | randomness () const |
| bool | saveToDevice (QIODevice *dev) const override |
| void | setUserEffectiveSize (qreal value) override |
| bool | supportsCaching () const override |
| void | toXML (QDomDocument &, QDomElement &) const override |
| qreal | userEffectiveSize () const override |
| ~KisAutoBrush () 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 quint32 | brushIndex () const |
| virtual QImage | brushTipImage () const |
| brushImage the image the brush tip can paint with. Not all brush types have a single image. | |
| virtual enumBrushType | brushType () const |
| virtual bool | canPaintFor (const KisPaintInformation &) |
| 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 |
| KisBrush () | |
| KisBrush (const KisBrush &rhs) | |
| KisBrush (const QString &filename) | |
| 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 void | notifyStrokeStarted () |
| KisBrush & | operator= (const KisBrush &rhs)=delete |
| virtual void | prepareForSeqNo (const KisPaintInformation &info, int seqNo) |
| virtual bool | preserveLightness () const |
| QPair< QString, QString > | resourceType () const override |
| qreal | scale () const |
| virtual void | setAngle (qreal _angle) |
| void | setAutoSpacing (bool active, qreal coeff) |
| virtual void | setBrushApplication (enumBrushApplication brushApplication) |
| virtual void | setBrushTipImage (const QImage &image) |
| virtual void | setGradient (KoAbstractGradientSP gradient) |
| virtual void | setScale (qreal _scale) |
| virtual void | setSpacing (double spacing) |
| double | spacing () 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 QString | defaultFileExtension () const |
| virtual QList< KoResourceLoadResult > | embeddedResources (KisResourcesInterfaceSP globalResourcesInterface) const |
| QString | filename () const |
| QImage | image () const |
| bool | isDirty () const |
| virtual bool | isSerializable () const |
| KoResource () | |
| KoResource (const KoResource &rhs) | |
| KoResource (const QString &filename) | |
| virtual QList< KoResourceLoadResult > | linkedResources (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 |
| KoResource & | operator= (const KoResource &rhs)=delete |
| bool | permanent () const |
| virtual QList< int > | requiredCanvasResources () const |
| QList< KoResourceLoadResult > | requiredResources (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< KoResourceLoadResult > | sideLoadedResources (KisResourcesInterfaceSP globalResourcesInterface) const |
| KoResourceSignature | signature () const |
| QString | storageLocation () const |
| QList< KoResourceLoadResult > | takeSideLoadedResources (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) | |
Private Member Functions | |
| QImage | createBrushPreview (int maxSize=-1) |
Private Attributes | |
| const QScopedPointer< Private > | d |
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 | |
| KisCanvas2 * | canvas |
| int | displayedFrame |
| int | intendedFrame |
Static Public Attributes inherited from KisBrush | |
| static const QString | brushTypeMetaDataKey = "image-based-brush" |
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) |
XXX: docs!
Definition at line 23 of file kis_auto_brush.h.
| KisAutoBrush::KisAutoBrush | ( | KisMaskGenerator * | as, |
| qreal | angle, | ||
| qreal | randomness, | ||
| qreal | density = 1.0 ) |
Here is a two-stage process of initialization of the brush size. It is done so for the backward compatibility reasons when the size was set to the size of brushTipImage(), which initialization is now skipped for efficiency reasons.
Definition at line 66 of file kis_auto_brush.cpp.
References KisBrush::angle(), createBrushPreview(), d, density(), KisBrush::height(), MASK, maskHeight(), maskWidth(), randomness(), KisBrush::setAngle(), KisBrush::setBrushType(), KisBrush::setHeight(), KoResource::setImage(), KisBrush::setWidth(), and KisBrush::width().
| KisAutoBrush::KisAutoBrush | ( | const KisAutoBrush & | rhs | ) |
|
override |
Definition at line 103 of file kis_auto_brush.cpp.
|
overridevirtual |
This value should not be used for calculating future dab sizes because it doesn't take any rounding into account. The only use of this metric is calculation of brush-size derivatives like hotspots and spacing.
Reimplemented from KisBrush.
Definition at line 190 of file kis_auto_brush.cpp.
References KisBrush::characteristicSize(), lieAboutDabShape(), and maskGenerator().
|
overridevirtual |
Implements KoResource.
Definition at line 164 of file kis_auto_brush.cpp.
References KisAutoBrush().
|
overridevirtual |
Reimplemented from KisBrush.
Definition at line 356 of file kis_auto_brush.cpp.
References KisBrush::generateOutlineCache().
|
private |
Definition at line 376 of file kis_auto_brush.cpp.
References KisBrush::angle(), KisFixedPaintDevice::colorSpace(), KisFixedPaintDevice::convertToQImage(), KisBrush::height(), KisFixedPaintDevice::initialize(), KoColorSpaceRegistry::instance(), KisBrush::mask(), maskHeight(), maskWidth(), KisAlgebra2D::maxDimension(), KisBrush::scale(), KisFixedPaintDevice::setRect(), and KisBrush::width().
| qreal KisAutoBrush::density | ( | ) | 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.
| dst | the destination that will be draw on the image, and this function will edit its alpha channel |
| coloringInfo | coloring information that will be copied on the dab, it can be null |
| shape | a shape applied on the alpha mask |
| info | the 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) |
| subPixelX | sub position of the brush (contained between 0.0 and 1.0) |
| subPixelY | sub position of the brush (contained between 0.0 and 1.0) |
| softnessFactor | softness factor of the brush |
Reimplemented from KisBrush.
Definition at line 281 of file kis_auto_brush.cpp.
References KisBrush::angle(), KisFixedPaintDevice::bounds(), KisBrush::ColoringInformation::color(), KisFixedPaintDevice::colorSpace(), d, KisFixedPaintDevice::data(), KisBrush::hotSpot(), KisBrushMaskApplicatorBase::initializeData(), KIS_SAFE_ASSERT_RECOVER_RETURN, KisFixedPaintDevice::lazyGrowBufferWithoutInitialization(), maskHeight(), maskWidth(), KisBrush::ColoringInformation::nextColumn(), KisBrush::ColoringInformation::nextRow(), KoColorSpace::pixelSize(), KisBrushMaskApplicatorBase::process(), KisDabShape::rotation(), KisDabShape::scaleX(), KisDabShape::scaleY(), and KisFixedPaintDevice::setRect().
|
overridevirtual |
Ephemeral resource is a type of resource that has no physical representation on disk. Therefore, its load()/save() calls do nothing. Such resources will always have empty md5Sum() and, therefore, will never be stored in the resources database.
This type of resources is created directly by the corresponding factory or other object (e.g. KisAutoBrushFactory).
Ephemeral resource cannot be serializable.
Reimplemented from KoResource.
Definition at line 107 of file kis_auto_brush.cpp.
|
overridevirtual |
Returns true if the brush has a bunch of pixels almost fully transparent in the very center. If the brush is pierced, then dulling mode may not work correctly due to empty samples.
WARNING: this method is relatively expensive since it iterates up to 100 pixels of the brush.
Reimplemented from KisBrush.
Definition at line 125 of file kis_auto_brush.cpp.
References d, KoID::id(), and SoftId().
|
overridevirtual |
Implements KoResource.
Definition at line 112 of file kis_auto_brush.cpp.
|
overridevirtual |
Reimplemented from KisBrush.
Definition at line 446 of file kis_auto_brush.cpp.
References density(), KisPaintopLodLimitations::limitations, KisBrush::lodLimitations(), qFuzzyCompare(), and randomness().
| const KisMaskGenerator * KisAutoBrush::maskGenerator | ( | ) | const |
Definition at line 412 of file kis_auto_brush.cpp.
References d.
|
overridevirtual |
Reimplemented from KisBrush.
Definition at line 176 of file kis_auto_brush.cpp.
References lieAboutDabShape(), maskGenerator(), and KisBrush::maskHeight().
|
overridevirtual |
Reimplemented from KisBrush.
Definition at line 183 of file kis_auto_brush.cpp.
References lieAboutDabShape(), maskGenerator(), and KisBrush::maskWidth().
|
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 351 of file kis_auto_brush.cpp.
|
delete |
|
overridevirtual |
Reimplemented from KisBrush.
Definition at line 427 of file kis_auto_brush.cpp.
References KisMaskGenerator::CIRCLE, d, KisBrush::height(), maskGenerator(), KisBrush::outline(), and KisBrush::width().
|
overridevirtual |
Is a paint device of the brush that should be used for generation of the brush outline. Usually, it is the same device returned by brushTipImage(), but might be different in some types of brushes, like in KisAutoBrush.
We need to generate the mask manually, skipping the construction of the image pyramid
Reimplemented from KisBrush.
Definition at line 136 of file kis_auto_brush.cpp.
References KisBrush::angle(), KoColorSpaceRegistry::instance(), KisBrush::mask(), KoColorSpaceRegistry::rgb8(), and KisBrush::scale().
|
overridevirtual |
Return a fixed paint device that contains a correctly scaled image dab.
Reimplemented from KisBrush.
Definition at line 195 of file kis_auto_brush.cpp.
| qreal KisAutoBrush::randomness | ( | ) | const |
Definition at line 422 of file kis_auto_brush.cpp.
References d.
|
overridevirtual |
Reimplemented from KoResource.
Definition at line 119 of file kis_auto_brush.cpp.
|
overridevirtual |
|
overridevirtual |
Reimplemented from KisBrush.
Definition at line 459 of file kis_auto_brush.cpp.
References density(), qFuzzyCompare(), and randomness().
|
overridevirtual |
Serialize this brush to XML.
Reimplemented from KisBrush.
Definition at line 361 of file kis_auto_brush.cpp.
References KisBrush::angle(), KisBrush::autoSpacingActive(), KisBrush::autoSpacingCoeff(), d, KisBrush::spacing(), and KisBrush::toXML().
|
overridevirtual |
|
private |
Definition at line 88 of file kis_auto_brush.h.