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

#include <kis_boundary.h>

Classes

struct  Private
 

Public Member Functions

void generateBoundary ()
 
 KisBoundary (KisFixedPaintDeviceSP dev)
 
void paint (QPainter &painter) const
 
QPainterPath path () const
 returns the outline saved in QPainterPath
 
 ~KisBoundary ()
 

Private Attributes

Private *const d
 

Detailed Description

Generates an 'outline' for a paint device. It should look a bit like the outline of a marching ants selection.

It's not really optimized, so it's not recommended to do big things with it and expect it to be fast.

Usage: construct a KisBoundary, and then run a generateBoundary(w, h) on it. After that, you can use the KisBoundaryPainter::paint method to let it paint the outline, or get a pixmap.

If you are debugging the brush outlines, be aware that the pipeline for this data is somewhat complex, involving such user classes: KisBoundary, KisBrush, KisBrushBasedPaintOpSettings, KisTool, KisCurrentOutlineFetcher

Definition at line 29 of file kis_boundary.h.

Constructor & Destructor Documentation

◆ KisBoundary()

KisBoundary::KisBoundary ( KisFixedPaintDeviceSP dev)

Definition at line 22 of file kis_boundary.cc.

22 : d(new Private)
23{
24 d->m_device = dev;
25}
Private *const d
KisFixedPaintDeviceSP m_device

References d, and KisBoundary::Private::m_device.

◆ ~KisBoundary()

KisBoundary::~KisBoundary ( )

Definition at line 27 of file kis_boundary.cc.

28{
29 delete d;
30}

References d.

Member Function Documentation

◆ generateBoundary()

void KisBoundary::generateBoundary ( )

Definition at line 32 of file kis_boundary.cc.

33{
34 if (!d->m_device)
35 return;
36
38 generator.setSimpleOutline(true);
39 d->m_boundary = generator.outline(d->m_device->data(), 0, 0, d->m_device->bounds().width(), d->m_device->bounds().height());
40
41 d->path = QPainterPath();
42 Q_FOREACH (const QPolygon & polygon, d->m_boundary) {
43 d->path.addPolygon(polygon);
44 d->path.closeSubpath();
45 }
46
47}
const quint8 OPACITY_TRANSPARENT_U8
const KoColorSpace * colorSpace() const
QVector< QPolygon > m_boundary

References KisFixedPaintDevice::bounds(), KisFixedPaintDevice::colorSpace(), d, KisFixedPaintDevice::data(), KisBoundary::Private::m_boundary, KisBoundary::Private::m_device, OPACITY_TRANSPARENT_U8, KisOutlineGenerator::outline(), KisBoundary::Private::path, and KisOutlineGenerator::setSimpleOutline().

◆ paint()

void KisBoundary::paint ( QPainter & painter) const

Definition at line 49 of file kis_boundary.cc.

50{
51 QPen pen;
52 pen.setWidth(0);
53 pen.setBrush(Qt::black);
54 painter.setPen(pen);
55
56 Q_FOREACH (const QPolygon & polygon, d->m_boundary) {
57 painter.drawPolygon(polygon);
58 }
59}

References d, and KisBoundary::Private::m_boundary.

◆ path()

QPainterPath KisBoundary::path ( ) const

returns the outline saved in QPainterPath

Definition at line 61 of file kis_boundary.cc.

62{
63 return d->path;
64}

References d, and KisBoundary::Private::path.

Member Data Documentation

◆ d

Private* const KisBoundary::d
private

Definition at line 43 of file kis_boundary.h.


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