krita/plugins/paintops/libbrush
KisBrush Class Reference
KisBrush is the base class for brush resources. More...
#include <kis_brush.h>

Classes | |
| class | ColoringInformation |
| class | PaintDeviceColoringInformation |
| class | PlainColoringInformation |
Public Member Functions | |
| KisBrush (const QString &filename) | |
| KisBrush () | |
| virtual | ~KisBrush () |
| virtual const KisBoundary * | boundary () const |
| virtual enumBrushType | brushType () const |
| virtual bool | canPaintFor (const KisPaintInformation &) |
| virtual void | generateMaskAndApplyMaskOrCreateDab (KisFixedPaintDeviceSP dst, ColoringInformation *coloringInfo, double scaleX, double scaleY, double angle, const KisPaintInformation &info=KisPaintInformation(), double subPixelX=0, double subPixelY=0) const |
| virtual bool | hasColor () const |
| qint32 | height () const |
| virtual QPointF | hotSpot (double scaleX, double scaleY, double rotation=0.0) const |
| virtual KisFixedPaintDeviceSP | image (const KoColorSpace *colorSpace, double scale, double angle, const KisPaintInformation &info, double subPixelX=0, double subPixelY=0) const |
| virtual QImage | img () const |
| virtual bool | load () |
| void | mask (KisFixedPaintDeviceSP dst, const KisPaintDeviceSP src, double scaleX, double scaleY, double angle, const KisPaintInformation &info=KisPaintInformation(), double subPixelX=0, double subPixelY=0) const |
| void | mask (KisFixedPaintDeviceSP dst, const KoColor &color, double scaleX, double scaleY, double angle, const KisPaintInformation &info=KisPaintInformation(), double subPixelX=0, double subPixelY=0) const |
| void | mask (KisFixedPaintDeviceSP dst, double scaleX, double scaleY, double angle, const KisPaintInformation &info=KisPaintInformation(), double subPixelX=0, double subPixelY=0) const |
| qint32 | maskHeight (double scale, double angle) const |
| qint32 | maskWidth (double scale, double angle) const |
| virtual bool | save () |
| void | setSpacing (double spacing) |
| double | spacing () const |
| virtual void | toXML (QDomDocument &, QDomElement &) const |
| qint32 | width () const |
| double | xSpacing (double scale=1.0) const |
| double | ySpacing (double scale=1.0) const |
Static Public Member Functions | |
| static KisBrushSP | fromXML (const QDomElement &element) |
Protected Member Functions | |
| KisBrush (const KisBrush &rhs) | |
| void | clearScaledBrushes () |
| void | createScaledBrushes () const |
| void | resetBoundary () |
| void | setBrushType (enumBrushType type) |
| void | setHasColor (bool hasColor) |
| void | setHeight (qint32 height) |
| void | setHotSpot (QPointF) |
| virtual void | setImage (const QImage &img) |
| void | setWidth (qint32 width) |
Protected Attributes | |
| QImage | m_image |
Detailed Description
KisBrush is the base class for brush resources.
A brush resource defines one or more images that are used to potato-stamp along the drawn path. The brush type defines how this brush is used -- the important difference is between masks (which take the current painting color) and images (which do not). It is up to the paintop to make use of this feature.
Brushes must be serializable to an xml representation and provide a factory class that can recreate or retrieve the brush based on this representation.
XXX: This api is still a big mess -- it needs a good refactoring. And the whole KoResource architecture is way over-designed.
Definition at line 76 of file kis_brush.h.
Constructor & Destructor Documentation
| KisBrush::KisBrush | ( | ) |
Definition at line 114 of file kis_brush.cpp.
| KisBrush::KisBrush | ( | const QString & | filename | ) |
Definition at line 120 of file kis_brush.cpp.
| KisBrush::~KisBrush | ( | ) | [virtual] |
Definition at line 138 of file kis_brush.cpp.
| KisBrush::KisBrush | ( | const KisBrush & | rhs | ) | [protected] |
Definition at line 126 of file kis_brush.cpp.
Member Function Documentation
| const KisBoundary * KisBrush::boundary | ( | ) | const [virtual] |
Reimplemented in KisImagePipeBrush.
Definition at line 1132 of file kis_brush.cpp.
| enumBrushType KisBrush::brushType | ( | ) | const [virtual] |
The brush type defines how the brush is used.
Reimplemented in KisGbrBrush, and KisImagePipeBrush.
Definition at line 242 of file kis_brush.cpp.
| bool KisBrush::canPaintFor | ( | const KisPaintInformation & | ) | [virtual] |
Returns true if this brush can return something useful for the info.
This is used by Pipe Brushes that can't paint sometimes
Reimplemented in KisImagePipeBrush.
Definition at line 220 of file kis_brush.cpp.
| void KisBrush::clearScaledBrushes | ( | ) | [protected] |
Definition at line 502 of file kis_brush.cpp.
| void KisBrush::createScaledBrushes | ( | ) | const [protected] |
Definition at line 507 of file kis_brush.cpp.
| KisBrushSP KisBrush::fromXML | ( | const QDomElement & | element | ) | [static] |
Definition at line 247 of file kis_brush.cpp.
| void KisBrush::generateMaskAndApplyMaskOrCreateDab | ( | KisFixedPaintDeviceSP | dst, | |
| ColoringInformation * | coloringInfo, | |||
| double | scaleX, | |||
| double | scaleY, | |||
| double | angle, | |||
| const KisPaintInformation & | info = KisPaintInformation(), |
|||
| double | subPixelX = 0, |
|||
| double | subPixelY = 0 | |||
| ) | const [virtual] |
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:
-
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 scale a scale applied on the alpha mask angle a rotation 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)
- Returns:
- a mask computed from the grey-level values of the pixels in the brush.
Reimplemented in KisAutoBrush, and KisImagePipeBrush.
Definition at line 329 of file kis_brush.cpp.
| bool KisBrush::hasColor | ( | ) | const [virtual] |
Reimplemented in KisImagePipeBrush.
Definition at line 209 of file kis_brush.cpp.
| qint32 KisBrush::height | ( | ) | const |
- Returns:
- the height (for scale == 1.0)
Definition at line 159 of file kis_brush.cpp.
| QPointF KisBrush::hotSpot | ( | double | scaleX, | |
| double | scaleY, | |||
| double | rotation = 0.0 | |||
| ) | const [virtual] |
Reimplemented in KisAutoBrush.
Definition at line 187 of file kis_brush.cpp.
| KisFixedPaintDeviceSP KisBrush::image | ( | const KoColorSpace * | colorSpace, | |
| double | scale, | |||
| double | angle, | |||
| const KisPaintInformation & | info, | |||
| double | subPixelX = 0, |
|||
| double | subPixelY = 0 | |||
| ) | const [virtual] |
Return a fixed paint device that contains a correctly scaled image dab.
Reimplemented in KisAutoBrush, and KisImagePipeBrush.
Definition at line 414 of file kis_brush.cpp.
| QImage KisBrush::img | ( | ) | const [virtual] |
- Returns:
- a preview of the brush
Reimplemented in KisGbrBrush, and KisImagePipeBrush.
Definition at line 144 of file kis_brush.cpp.
| virtual bool KisBrush::load | ( | ) | [inline, virtual] |
Reimplemented in KisAutoBrush, KisGbrBrush, KisImagePipeBrush, and KisTextBrush.
Definition at line 128 of file kis_brush.h.
| void KisBrush::mask | ( | KisFixedPaintDeviceSP | dst, | |
| const KisPaintDeviceSP | src, | |||
| double | scaleX, | |||
| double | scaleY, | |||
| double | angle, | |||
| const KisPaintInformation & | info = KisPaintInformation(), |
|||
| double | subPixelX = 0, |
|||
| double | subPixelY = 0 | |||
| ) | const |
clear dst and fill it with a mask colored with the corresponding colors of src
Definition at line 322 of file kis_brush.cpp.
| void KisBrush::mask | ( | KisFixedPaintDeviceSP | dst, | |
| const KoColor & | color, | |||
| double | scaleX, | |||
| double | scaleY, | |||
| double | angle, | |||
| const KisPaintInformation & | info = KisPaintInformation(), |
|||
| double | subPixelX = 0, |
|||
| double | subPixelY = 0 | |||
| ) | const |
clear dst fill it with a mask colored with KoColor
Definition at line 316 of file kis_brush.cpp.
| void KisBrush::mask | ( | KisFixedPaintDeviceSP | dst, | |
| double | scaleX, | |||
| double | scaleY, | |||
| double | angle, | |||
| const KisPaintInformation & | info = KisPaintInformation(), |
|||
| double | subPixelX = 0, |
|||
| double | subPixelY = 0 | |||
| ) | const |
Apply the brush mask to the pixels in dst.
Dst should be big enough!
Definition at line 311 of file kis_brush.cpp.
| qint32 KisBrush::maskHeight | ( | double | scale, | |
| double | angle | |||
| ) | const |
- Returns:
- the height of the mask for the given scale
Definition at line 273 of file kis_brush.cpp.
| qint32 KisBrush::maskWidth | ( | double | scale, | |
| double | angle | |||
| ) | const |
- Returns:
- the width of the mask for the given scale
Definition at line 254 of file kis_brush.cpp.
| void KisBrush::resetBoundary | ( | ) | [protected] |
Definition at line 1091 of file kis_brush.cpp.
| virtual bool KisBrush::save | ( | ) | [inline, virtual] |
Reimplemented in KisGbrBrush, and KisImagePipeBrush.
Definition at line 131 of file kis_brush.h.
| void KisBrush::setBrushType | ( | enumBrushType | type | ) | [protected] |
XXX.
Definition at line 237 of file kis_brush.cpp.
| void KisBrush::setHasColor | ( | bool | hasColor | ) | [protected] |
Definition at line 214 of file kis_brush.cpp.
| void KisBrush::setHeight | ( | qint32 | height | ) | [protected] |
Definition at line 164 of file kis_brush.cpp.
| void KisBrush::setHotSpot | ( | QPointF | pt | ) | [protected] |
Definition at line 169 of file kis_brush.cpp.
| void KisBrush::setImage | ( | const QImage & | img | ) | [protected, virtual] |
The image is used to represent the brush in the gui, and may also, depending on the brush type be used to define the actual brush instance.
Reimplemented in KisGbrBrush.
Definition at line 225 of file kis_brush.cpp.
| void KisBrush::setSpacing | ( | double | spacing | ) |
Change the spacing of the brush.
- Parameters:
-
spacing a spacing of 1.0 means that strokes will be separated from one time the size of the brush.
Definition at line 302 of file kis_brush.cpp.
| void KisBrush::setWidth | ( | qint32 | width | ) | [protected] |
Definition at line 154 of file kis_brush.cpp.
| double KisBrush::spacing | ( | ) | const |
- Returns:
- the spacing between two strokes for this brush
Definition at line 307 of file kis_brush.cpp.
| virtual void KisBrush::toXML | ( | QDomDocument & | , | |
| QDomElement & | ||||
| ) | const [inline, virtual] |
Serialize this brush to XML.
Reimplemented in KisAutoBrush, KisGbrBrush, and KisTextBrush.
Definition at line 262 of file kis_brush.h.
| qint32 KisBrush::width | ( | ) | const |
- Returns:
- the width (for scale == 1.0)
Definition at line 149 of file kis_brush.cpp.
| double KisBrush::xSpacing | ( | double | scale = 1.0 |
) | const |
- Returns:
- the horizontal spacing
Definition at line 292 of file kis_brush.cpp.
| double KisBrush::ySpacing | ( | double | scale = 1.0 |
) | const |
- Returns:
- the vertical spacing
Definition at line 297 of file kis_brush.cpp.
Member Data Documentation
QImage KisBrush::m_image [protected] |
Definition at line 297 of file kis_brush.h.
The documentation for this class was generated from the following files:
