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

#include <kis_layer_projection_plane.h>

+ Inheritance diagram for KisLayerProjectionPlane:

Classes

struct  Private
 

Public Member Functions

QRect accessRect (const QRect &rect, KisLayer::PositionToFilthy pos) const override
 
void apply (KisPainter *painter, const QRect &rect) override
 
void applyMaxOutAlpha (KisPainter *painter, const QRect &rect, KritaUtils::ThresholdMode thresholdMode)
 
QRect changeRect (const QRect &rect, KisLayer::PositionToFilthy pos) const override
 
KisPaintDeviceList getLodCapableDevices () const override
 
 KisLayerProjectionPlane (KisLayer *layer)
 
QRect looseUserVisibleBounds () const override
 
QRect needRect (const QRect &rect, KisLayer::PositionToFilthy pos) const override
 
QRect needRectForOriginal (const QRect &rect) const override
 
QRect recalculate (const QRect &rect, KisNodeSP filthyNode, KisRenderPassFlags flags) override
 
QRect tightUserVisibleBounds () const override
 
 ~KisLayerProjectionPlane () override
 
- Public Member Functions inherited from KisAbstractProjectionPlane
 KisAbstractProjectionPlane ()
 
virtual ~KisAbstractProjectionPlane ()
 

Private Member Functions

void applyImpl (KisPainter *painter, const QRect &rect, KritaUtils::ThresholdMode thresholdMode)
 

Private Attributes

const QScopedPointer< Privatem_d
 

Detailed Description

An implementation of the KisAbstractProjectionPlane interface for a layer object

Definition at line 19 of file kis_layer_projection_plane.h.

Constructor & Destructor Documentation

◆ KisLayerProjectionPlane()

KisLayerProjectionPlane::KisLayerProjectionPlane ( KisLayer * layer)

Definition at line 26 of file kis_layer_projection_plane.cpp.

27 : m_d(new Private)
28{
29 m_d->layer = layer;
30}
const QScopedPointer< Private > m_d

References m_d.

◆ ~KisLayerProjectionPlane()

KisLayerProjectionPlane::~KisLayerProjectionPlane ( )
override

Definition at line 32 of file kis_layer_projection_plane.cpp.

33{
34}

Member Function Documentation

◆ accessRect()

QRect KisLayerProjectionPlane::accessRect ( const QRect & rect,
KisLayer::PositionToFilthy pos ) const
overridevirtual

Works like KisNode::needRect(), but includes more transformations of the layer

Implements KisAbstractProjectionPlane.

Definition at line 102 of file kis_layer_projection_plane.cpp.

103{
104 return m_d->layer->accessRect(rect, pos);
105}

References m_d.

◆ apply()

void KisLayerProjectionPlane::apply ( KisPainter * painter,
const QRect & rect )
overridevirtual

Writes the data of the projection plane onto a global projection using painter object.

Implements KisAbstractProjectionPlane.

Definition at line 77 of file kis_layer_projection_plane.cpp.

78{
80}
void applyImpl(KisPainter *painter, const QRect &rect, KritaUtils::ThresholdMode thresholdMode)

References applyImpl(), and KritaUtils::ThresholdNone.

◆ applyImpl()

void KisLayerProjectionPlane::applyImpl ( KisPainter * painter,
const QRect & rect,
KritaUtils::ThresholdMode thresholdMode )
private

Definition at line 41 of file kis_layer_projection_plane.cpp.

42{
43 KisPaintDeviceSP device = m_d->layer->projection();
44 if (!device) return;
45
46 QRect needRect = rect;
47
48 if (m_d->layer->compositeOpId() != COMPOSITE_COPY &&
49 m_d->layer->compositeOpId() != COMPOSITE_DESTINATION_IN &&
50 m_d->layer->compositeOpId() != COMPOSITE_DESTINATION_ATOP) {
51
52 needRect &= device->extent();
53 }
54
55 if(needRect.isEmpty()) return;
56
57 const QBitArray channelFlags = m_d->layer->projectionLeaf()->channelFlags();
58
59 QScopedPointer<KisCachedPaintDevice::Guard> d1;
60
61 if (thresholdMode != KritaUtils::ThresholdNone) {
62 d1.reset(new KisCachedPaintDevice::Guard(device, m_d->cachedDevice));
63 KisPaintDeviceSP tmp = d1->device();
64 tmp->makeCloneFromRough(device, needRect);
65
67
68 device = tmp;
69 }
70
71 painter->setChannelFlags(channelFlags);
72 painter->setCompositeOpId(m_d->layer->compositeOpId());
73 painter->setOpacityU8(m_d->layer->projectionLeaf()->opacity());
74 painter->bitBlt(needRect.topLeft(), device, needRect);
75}
const QString COMPOSITE_COPY
const QString COMPOSITE_DESTINATION_ATOP
const QString COMPOSITE_DESTINATION_IN
QRect needRect(const QRect &rect, KisLayer::PositionToFilthy pos) const override
QRect extent() const
void bitBlt(qint32 dstX, qint32 dstY, const KisPaintDeviceSP srcDev, qint32 srcX, qint32 srcY, qint32 srcWidth, qint32 srcHeight)
void setOpacityU8(quint8 opacity)
Set the opacity which is used in painting (like filling polygons)
void setChannelFlags(QBitArray channelFlags)
void setCompositeOpId(const KoCompositeOp *op)
void thresholdOpacity(KisPaintDeviceSP device, const QRect &rect, ThresholdMode mode)

References KisPainter::bitBlt(), COMPOSITE_COPY, COMPOSITE_DESTINATION_ATOP, COMPOSITE_DESTINATION_IN, KisPaintDevice::extent(), m_d, needRect(), KisPainter::setChannelFlags(), KisPainter::setCompositeOpId(), KisPainter::setOpacityU8(), KritaUtils::ThresholdNone, and KritaUtils::thresholdOpacity().

◆ applyMaxOutAlpha()

void KisLayerProjectionPlane::applyMaxOutAlpha ( KisPainter * painter,
const QRect & rect,
KritaUtils::ThresholdMode thresholdMode )

Definition at line 82 of file kis_layer_projection_plane.cpp.

83{
84 applyImpl(painter, rect, thresholdMode);
85}

References applyImpl().

◆ changeRect()

QRect KisLayerProjectionPlane::changeRect ( const QRect & rect,
KisLayer::PositionToFilthy pos ) const
overridevirtual

Works like KisNode::changeRect(), but includes more transformations of the layer

Implements KisAbstractProjectionPlane.

Definition at line 97 of file kis_layer_projection_plane.cpp.

98{
99 return m_d->layer->changeRect(rect, pos);
100}

References m_d.

◆ getLodCapableDevices()

KisPaintDeviceList KisLayerProjectionPlane::getLodCapableDevices ( ) const
overridevirtual

Returns a list of devices which should synchronize the lod cache on update

Implements KisAbstractProjectionPlane.

Definition at line 87 of file kis_layer_projection_plane.cpp.

88{
89 return KisPaintDeviceList() << m_d->layer->projection();
90}
QList< KisPaintDeviceSP > KisPaintDeviceList
Definition kis_types.h:267

References m_d.

◆ looseUserVisibleBounds()

QRect KisLayerProjectionPlane::looseUserVisibleBounds ( ) const
overridevirtual

Return an approximate (loose) rectangle, where the contents of the plane is placed from user's point of view. It includes everything belonging to the plane (e.g. layer styles).

This rectangle contains or is bigger than the rectangle returned by tightUserVisibleBounds().

Implements KisAbstractProjectionPlane.

Definition at line 117 of file kis_layer_projection_plane.cpp.

118{
119 return m_d->layer->looseUserVisibleBounds();
120}

References m_d.

◆ needRect()

QRect KisLayerProjectionPlane::needRect ( const QRect & rect,
KisLayer::PositionToFilthy pos ) const
overridevirtual

Works like KisNode::needRect(), but includes more transformations of the layer

Implements KisAbstractProjectionPlane.

Definition at line 92 of file kis_layer_projection_plane.cpp.

93{
94 return m_d->layer->needRect(rect, pos);
95}

References m_d.

◆ needRectForOriginal()

QRect KisLayerProjectionPlane::needRectForOriginal ( const QRect & rect) const
overridevirtual

Works like KisLayer::needRectForOriginal(), but includes needed rects of layer styles

Implements KisAbstractProjectionPlane.

Definition at line 107 of file kis_layer_projection_plane.cpp.

108{
109 return m_d->layer->needRectForOriginal(rect);
110}

References m_d.

◆ recalculate()

QRect KisLayerProjectionPlane::recalculate ( const QRect & rect,
KisNodeSP filthyNode,
KisRenderPassFlags flags )
overridevirtual

Is called by the async merger when the node is filthy and should recalculate its internal representation. For usual layers it means just calling updateProjection().

Implements KisAbstractProjectionPlane.

Definition at line 36 of file kis_layer_projection_plane.cpp.

37{
38 return m_d->layer->updateProjection(rect, filthyNode, flags);
39}

References m_d.

◆ tightUserVisibleBounds()

QRect KisLayerProjectionPlane::tightUserVisibleBounds ( ) const
overridevirtual

Return a tight rectangle, where the contents of the plane is placed from user's point of view. It includes everything belonging to the plane (e.g. layer styles).

Implements KisAbstractProjectionPlane.

Definition at line 112 of file kis_layer_projection_plane.cpp.

113{
114 return m_d->layer->tightUserVisibleBounds();
115}

References m_d.

Member Data Documentation

◆ m_d

const QScopedPointer<Private> KisLayerProjectionPlane::m_d
private

Definition at line 43 of file kis_layer_projection_plane.h.


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