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

The KisResourcesSnapshot class takes a snapshot of the various resources like colors and settings used at the begin of a stroke so subsequent changes don't impact the running stroke. The main reason for the snapshot is that the user can change the options while the stroke is being executed in the background. More...

#include <kis_resources_snapshot.h>

+ Inheritance diagram for KisResourcesSnapshot:

Classes

struct  Private
 

Public Member Functions

KisSelectionSP activeSelection () const
 
qreal airbrushingInterval () const
 
QBitArray channelLockFlags () const
 
QString compositeOpId () const
 
KoColor currentBgColor () const
 
KoColor currentFgColor () const
 
KisFilterConfigurationSP currentGenerator () const
 
KoAbstractGradientSP currentGradient () const
 
KisNodeSP currentNode () const
 
KisPaintOpPresetSP currentPaintOpPreset () const
 
KoPatternSP currentPattern () const
 
qreal effectiveZoom () const
 
QTransform fillTransform () const
 
KisImageSP image () const
 
QString indirectPaintingCompositeOp () const
 
bool isUsingOtherColor () const
 
 KisResourcesSnapshot (KisImageSP image, KisNodeSP currentNode, KisDefaultBoundsBaseSP bounds=0)
 
 KisResourcesSnapshot (KisImageSP image, KisNodeSP currentNode, KoCanvasResourceProvider *resourceManager, KisDefaultBoundsBaseSP bounds=0, KisNodeList selectedNodes=KisNodeList(), KisPaintOpPresetSP presetOverride=0)
 
bool needsAirbrushing () const
 
bool needsIndirectPainting () const
 
bool needsMaskingBrushRendering () const
 
bool needsSpacingUpdates () const
 
qreal opacity () const
 
KisPostExecutionUndoAdapterpostExecutionUndoAdapter () const
 
bool presetAllowsLod () const
 
bool presetNeedsAsynchronousUpdates () const
 
KisNodeList selectedNodes () const
 
void setBGColorOverride (const KoColor &color)
 
void setBrush (const KisPaintOpPresetSP &brush)
 
void setCurrentNode (KisNodeSP node)
 
void setFGColorOverride (const KoColor &color)
 
void setFillStyle (KisPainter::FillStyle fillStyle)
 
void setFillTransform (QTransform transform)
 
void setMirroring (bool horizontal, bool vertical)
 
void setOpacity (qreal opacity)
 
void setSelectionOverride (KisSelectionSP selection)
 
void setStrokeStyle (KisPainter::StrokeStyle strokeStyle)
 
void setupMaskingBrushPainter (KisPainter *painter)
 
void setupPainter (KisPainter *painter)
 
 ~KisResourcesSnapshot ()
 
- Public Member Functions inherited from KisShared
bool deref ()
 
bool ref ()
 
int refCount ()
 
QAtomicInt * sharedWeakReference ()
 

Private Attributes

Private *const m_d
 

Additional Inherited Members

- Protected Member Functions inherited from KisShared
 KisShared ()
 
 ~KisShared ()
 

Detailed Description

The KisResourcesSnapshot class takes a snapshot of the various resources like colors and settings used at the begin of a stroke so subsequent changes don't impact the running stroke. The main reason for the snapshot is that the user can change the options while the stroke is being executed in the background.

Definition at line 30 of file kis_resources_snapshot.h.

Constructor & Destructor Documentation

◆ KisResourcesSnapshot() [1/2]

KisResourcesSnapshot::KisResourcesSnapshot ( KisImageSP image,
KisNodeSP currentNode,
KoCanvasResourceProvider * resourceManager,
KisDefaultBoundsBaseSP bounds = 0,
KisNodeList selectedNodes = KisNodeList(),
KisPaintOpPresetSP presetOverride = 0 )

We should deep-copy the preset, so that long-running actions will have correct brush parameters. Theoretically this cloning can be expensive, but according to measurements, it takes something like 0.1 ms for an average preset.

we don't use global resource cache object in this case, because the passed preset might be not the global one

Fill and Stroke styles are not a part of the resource manager so the tools should set them manually TODO: port stroke and fill styles to be a part of the resource manager

Definition at line 66 of file kis_resources_snapshot.cpp.

67 : m_d(new Private())
68{
69 m_d->image = image;
70 if (!bounds) {
72 }
73 m_d->bounds = bounds;
80 if(m_d->currentGradient) {
82 ->cloneAndBakeVariableColors(m_d->globalCanvasResourcesInterface);
83 }
84 }
86
93 if (presetOverride) {
97 presetOverride->cloneWithResourcesSnapshot(
100 nullptr);
101 } else {
103 if (p) {
105
106 KIS_SAFE_ASSERT_RECOVER(!cacheInterface || p->sanityCheckResourceCacheIsValid(cacheInterface)) {
107 cacheInterface.clear();
108 }
109
111 p->cloneWithResourcesSnapshot(KisGlobalResourcesInterface::instance(),
113 cacheInterface);
114 }
115 }
116
117#ifdef HAVE_THREADED_TEXT_RENDERING_WORKAROUND
118 KisPaintOpRegistry::instance()->preinitializePaintOpIfNeeded(m_d->currentPaintOpPreset);
119#endif /* HAVE_THREADED_TEXT_RENDERING_WORKAROUND */
120
121 m_d->currentExposure = resourceManager->resource(KoCanvasResource::HdrExposure).toDouble();
122
123
125 if (m_d->currentGenerator) {
126 m_d->currentGenerator = m_d->currentGenerator->cloneWithResourcesSnapshot();
127 }
128
129 QPointF relativeAxesCenter(0.5, 0.5);
130 if (m_d->image) {
131 relativeAxesCenter = m_d->image->mirrorAxesCenter();
132 }
134
137
138 m_d->opacity = resourceManager->resource(KoCanvasResource::Opacity).toDouble();
139
142
144
153
154 // Erasing and alpha lock don't mix. If both are enabled, erasing takes priority.
155 m_d->globalAlphaLock = !resourceManager->resource(KoCanvasResource::EraserMode).toBool()
156 && resourceManager->resource(KoCanvasResource::GlobalAlphaLock).toBool();
157 m_d->effectiveZoom = resourceManager->resource(KoCanvasResource::EffectiveZoom).toDouble();
158
160}
const Params2D p
virtual QRect imageBorderRect() const
static KisResourcesInterfaceSP instance()
QPointF mirrorAxesCenter() const
static KisPaintOpRegistry * instance()
void setCurrentNode(KisNodeSP node)
KisNodeList selectedNodes() const
KoCanvasResourcesInterfaceSP canvasResourcesInterface() const
#define KIS_SAFE_ASSERT_RECOVER(cond)
Definition kis_assert.h:126
#define bounds(x, a, b)
QPointF relativeToAbsolute(const QPointF &pt, const QRectF &rc)
@ CurrentPaintOpPresetCache
the cache associated with the currently active preset (this cache may be different per canvas if the ...
@ EffectiveZoom
-Used only by painting tools for non-displaying purposes
@ BackgroundColor
The active background color selected for this canvas.
@ ForegroundColor
The active foreground color selected for this canvas.
KoCanvasResourcesInterfaceSP globalCanvasResourcesInterface
KisFilterConfigurationSP currentGenerator

References KisResourcesSnapshot::Private::axesCenter, KoCanvasResource::BackgroundColor, KoCanvasResourceProvider::boolResource(), KisResourcesSnapshot::Private::bounds, bounds, KoCanvasResourceProvider::canvasResourcesInterface(), KisResourcesSnapshot::Private::compositeOpId, KisResourcesSnapshot::Private::currentBgColor, KoCanvasResource::CurrentEffectiveCompositeOp, KisResourcesSnapshot::Private::currentExposure, KisResourcesSnapshot::Private::currentFgColor, KisResourcesSnapshot::Private::currentGenerator, KoCanvasResource::CurrentGeneratorConfiguration, KoCanvasResource::CurrentGradient, KisResourcesSnapshot::Private::currentGradient, currentNode(), KoCanvasResource::CurrentPaintOpPreset, KisResourcesSnapshot::Private::currentPaintOpPreset, KoCanvasResource::CurrentPaintOpPresetCache, KoCanvasResource::CurrentPattern, KisResourcesSnapshot::Private::currentPattern, KoCanvasResource::EffectiveLodAvailability, KoCanvasResource::EffectiveZoom, KisResourcesSnapshot::Private::effectiveZoom, KoCanvasResource::EraserMode, KisResourcesSnapshot::Private::fillStyle, KisPainter::FillStyleNone, KoCanvasResource::ForegroundColor, KoCanvasResource::GlobalAlphaLock, KisResourcesSnapshot::Private::globalAlphaLock, KisResourcesSnapshot::Private::globalCanvasResourcesInterface, KoCanvasResource::HdrExposure, KisResourcesSnapshot::Private::image, image(), KisDefaultBoundsBase::imageBorderRect(), KisPaintOpRegistry::instance(), KisGlobalResourcesInterface::instance(), KisResourcesSnapshot::Private::isUsingOtherColor, KIS_SAFE_ASSERT_RECOVER, m_d, KisImage::mirrorAxesCenter(), KoCanvasResource::MirrorHorizontal, KisResourcesSnapshot::Private::mirrorMaskHorizontal, KisResourcesSnapshot::Private::mirrorMaskVertical, KoCanvasResource::MirrorVertical, KoCanvasResource::Opacity, KisResourcesSnapshot::Private::opacity, p, KisResourcesSnapshot::Private::presetAllowsLod, KisAlgebra2D::relativeToAbsolute(), KoCanvasResourceProvider::resource(), KisResourcesSnapshot::Private::selectedNodes, selectedNodes(), setCurrentNode(), KisResourcesSnapshot::Private::strokeStyle, KisPainter::StrokeStyleBrush, and KoCanvasResource::UsingOtherColor.

◆ KisResourcesSnapshot() [2/2]

KisResourcesSnapshot::KisResourcesSnapshot ( KisImageSP image,
KisNodeSP currentNode,
KisDefaultBoundsBaseSP bounds = 0 )

Fill and Stroke styles are not a part of the resource manager so the tools should set them manually TODO: port stroke and fill styles to be a part of the resource manager

Definition at line 162 of file kis_resources_snapshot.cpp.

163 : m_d(new Private())
164{
165 m_d->image = image;
166 if (!bounds) {
168 }
169 m_d->bounds = bounds;
170
171#ifdef HAVE_THREADED_TEXT_RENDERING_WORKAROUND
172 KisPaintOpRegistry::instance()->preinitializePaintOpIfNeeded(m_d->currentPaintOpPreset);
173#endif /* HAVE_THREADED_TEXT_RENDERING_WORKAROUND */
174
175 QPointF relativeAxesCenter(0.5, 0.5);
176 if (m_d->image) {
177 relativeAxesCenter = m_d->image->mirrorAxesCenter();
178 }
181
183
192}
const qreal OPACITY_OPAQUE_F

References KisResourcesSnapshot::Private::axesCenter, KisResourcesSnapshot::Private::bounds, bounds, currentNode(), KisResourcesSnapshot::Private::currentPaintOpPreset, KisResourcesSnapshot::Private::fillStyle, KisPainter::FillStyleNone, KisResourcesSnapshot::Private::image, image(), KisDefaultBoundsBase::imageBorderRect(), KisPaintOpRegistry::instance(), m_d, KisImage::mirrorAxesCenter(), KisResourcesSnapshot::Private::opacity, OPACITY_OPAQUE_F, KisAlgebra2D::relativeToAbsolute(), setCurrentNode(), KisResourcesSnapshot::Private::strokeStyle, and KisPainter::StrokeStyleBrush.

◆ ~KisResourcesSnapshot()

KisResourcesSnapshot::~KisResourcesSnapshot ( )

Definition at line 195 of file kis_resources_snapshot.cpp.

196{
197 delete m_d;
198}

References m_d.

Member Function Documentation

◆ activeSelection()

KisSelectionSP KisResourcesSnapshot::activeSelection ( ) const
Returns
currently active selection. Note that it will return null if current node is the current selection. This is done to avoid recursive selection application when painting on selection masks.

It is possible to have/use the snapshot without the image. Such usecase is present for example in the scratchpad.

Definition at line 312 of file kis_resources_snapshot.cpp.

313{
319 return m_d->selectionOverride;
320 }
321
322 KisSelectionSP selection = m_d->image ? m_d->image->globalSelection() : 0;
323
324 KisLayerSP layer;
326 if((layer = qobject_cast<KisLayer*>(m_d->currentNode.data()))) {
327 selection = layer->selection();
328 } else if ((mask = dynamic_cast<KisSelectionMask*>(m_d->currentNode.data())) &&
329 mask->selection() == selection) {
330
331 selection = 0;
332 }
333
334 return selection;
335}
KisSelectionSP globalSelection() const
Definition kis_image.cc:695
virtual KisSelectionSP selection() const
Definition kis_layer.cc:503
KisSelectionSP selection
Definition kis_mask.cc:44

References KisResourcesSnapshot::Private::currentNode, KisSharedPtr< T >::data(), KisImage::globalSelection(), KisResourcesSnapshot::Private::hasOverrideSelection, KisResourcesSnapshot::Private::image, m_d, KisLayer::selection(), KisMask::selection, and KisResourcesSnapshot::Private::selectionOverride.

◆ airbrushingInterval()

qreal KisResourcesSnapshot::airbrushingInterval ( ) const

Definition at line 344 of file kis_resources_snapshot.cpp.

345{
346 return ( m_d->currentPaintOpPreset
347 && m_d->currentPaintOpPreset->settings()
348 && m_d->currentPaintOpPreset->settings()->airbrushInterval());
349}

References KisResourcesSnapshot::Private::currentPaintOpPreset, and m_d.

◆ channelLockFlags()

QBitArray KisResourcesSnapshot::channelLockFlags ( ) const
Returns
the channel lock flags of the current node with the global override applied

Definition at line 429 of file kis_resources_snapshot.cpp.

430{
431 QBitArray channelFlags;
432 KisPaintLayer *paintLayer;
433 if ((paintLayer = dynamic_cast<KisPaintLayer*>(m_d->currentNode.data()))) {
434
435 channelFlags = paintLayer->channelLockFlags();
436 if (m_d->globalAlphaLock) {
437 if (channelFlags.isEmpty()) {
438 channelFlags = paintLayer->colorSpace()->channelFlags(true, true);
439 }
440
441 channelFlags &= paintLayer->colorSpace()->channelFlags(true, false);
442 }
443 }
444 return channelFlags;
445}
QBitArray channelFlags(bool color=true, bool alpha=false) const
const KoColorSpace * colorSpace() const override
returns the image's colorSpace or null, if there is no image
Definition kis_layer.cc:225
const QBitArray & channelLockFlags() const

References KoColorSpace::channelFlags(), KisPaintLayer::channelLockFlags(), KisLayer::colorSpace(), KisResourcesSnapshot::Private::currentNode, KisSharedPtr< T >::data(), KisResourcesSnapshot::Private::globalAlphaLock, and m_d.

◆ compositeOpId()

QString KisResourcesSnapshot::compositeOpId ( ) const

Definition at line 374 of file kis_resources_snapshot.cpp.

375{
376 return m_d->compositeOpId;
377}

References KisResourcesSnapshot::Private::compositeOpId, and m_d.

◆ currentBgColor()

KoColor KisResourcesSnapshot::currentBgColor ( ) const

Definition at line 394 of file kis_resources_snapshot.cpp.

395{
396 if (m_d->isUsingOtherColor) {
397 // temporarily swap colors if requested by user
398 return m_d->currentFgColor;
399 } else {
400 return m_d->currentBgColor;
401 }
402}

References KisResourcesSnapshot::Private::currentBgColor, KisResourcesSnapshot::Private::currentFgColor, KisResourcesSnapshot::Private::isUsingOtherColor, and m_d.

◆ currentFgColor()

KoColor KisResourcesSnapshot::currentFgColor ( ) const

Definition at line 384 of file kis_resources_snapshot.cpp.

385{
386 if (m_d->isUsingOtherColor) {
387 // temporarily swap colors if requested by user
388 return m_d->currentBgColor;
389 } else {
390 return m_d->currentFgColor;
391 }
392}

References KisResourcesSnapshot::Private::currentBgColor, KisResourcesSnapshot::Private::currentFgColor, KisResourcesSnapshot::Private::isUsingOtherColor, and m_d.

◆ currentGenerator()

KisFilterConfigurationSP KisResourcesSnapshot::currentGenerator ( ) const

Definition at line 419 of file kis_resources_snapshot.cpp.

420{
421 return m_d->currentGenerator;
422}

References KisResourcesSnapshot::Private::currentGenerator, and m_d.

◆ currentGradient()

KoAbstractGradientSP KisResourcesSnapshot::currentGradient ( ) const

Definition at line 414 of file kis_resources_snapshot.cpp.

415{
416 return m_d->currentGradient;
417}

References KisResourcesSnapshot::Private::currentGradient, and m_d.

◆ currentNode()

KisNodeSP KisResourcesSnapshot::currentNode ( ) const

Definition at line 285 of file kis_resources_snapshot.cpp.

286{
287 return m_d->currentNode;
288}

References KisResourcesSnapshot::Private::currentNode, and m_d.

◆ currentPaintOpPreset()

KisPaintOpPresetSP KisResourcesSnapshot::currentPaintOpPreset ( ) const

Definition at line 404 of file kis_resources_snapshot.cpp.

405{
407}

References KisResourcesSnapshot::Private::currentPaintOpPreset, and m_d.

◆ currentPattern()

KoPatternSP KisResourcesSnapshot::currentPattern ( ) const

Definition at line 379 of file kis_resources_snapshot.cpp.

380{
381 return m_d->currentPattern;
382}

References KisResourcesSnapshot::Private::currentPattern, and m_d.

◆ effectiveZoom()

qreal KisResourcesSnapshot::effectiveZoom ( ) const

Definition at line 447 of file kis_resources_snapshot.cpp.

448{
449 return m_d->effectiveZoom;
450}

References KisResourcesSnapshot::Private::effectiveZoom, and m_d.

◆ fillTransform()

QTransform KisResourcesSnapshot::fillTransform ( ) const

Definition at line 409 of file kis_resources_snapshot.cpp.

410{
411 return m_d->fillTransform;
412}

References KisResourcesSnapshot::Private::fillTransform, and m_d.

◆ image()

KisImageSP KisResourcesSnapshot::image ( ) const

Definition at line 290 of file kis_resources_snapshot.cpp.

291{
292 return m_d->image;
293}

References KisResourcesSnapshot::Private::image, and m_d.

◆ indirectPaintingCompositeOp()

QString KisResourcesSnapshot::indirectPaintingCompositeOp ( ) const

Definition at line 300 of file kis_resources_snapshot.cpp.

301{
302 return m_d->currentPaintOpPreset ?
303 m_d->currentPaintOpPreset->settings()->indirectPaintingCompositeOp()
305}
const QString COMPOSITE_ALPHA_DARKEN

References COMPOSITE_ALPHA_DARKEN, KisResourcesSnapshot::Private::currentPaintOpPreset, and m_d.

◆ isUsingOtherColor()

bool KisResourcesSnapshot::isUsingOtherColor ( ) const

Definition at line 424 of file kis_resources_snapshot.cpp.

425{
426 return m_d->isUsingOtherColor;
427}

References KisResourcesSnapshot::Private::isUsingOtherColor, and m_d.

◆ needsAirbrushing()

bool KisResourcesSnapshot::needsAirbrushing ( ) const

Definition at line 337 of file kis_resources_snapshot.cpp.

338{
339 return ( m_d->currentPaintOpPreset
340 && m_d->currentPaintOpPreset->settings()
341 && m_d->currentPaintOpPreset->settings()->isAirbrushing());
342}

References KisResourcesSnapshot::Private::currentPaintOpPreset, and m_d.

◆ needsIndirectPainting()

bool KisResourcesSnapshot::needsIndirectPainting ( ) const

Definition at line 295 of file kis_resources_snapshot.cpp.

296{
297 return !m_d->currentPaintOpPreset->settings()->paintIncremental();
298}

References KisResourcesSnapshot::Private::currentPaintOpPreset, and m_d.

◆ needsMaskingBrushRendering()

bool KisResourcesSnapshot::needsMaskingBrushRendering ( ) const

Definition at line 307 of file kis_resources_snapshot.cpp.

308{
309 return m_d->currentPaintOpPreset && m_d->currentPaintOpPreset->hasMaskingPreset();
310}

References KisResourcesSnapshot::Private::currentPaintOpPreset, and m_d.

◆ needsSpacingUpdates()

bool KisResourcesSnapshot::needsSpacingUpdates ( ) const

Definition at line 351 of file kis_resources_snapshot.cpp.

352{
353 return ( m_d->currentPaintOpPreset
354 && m_d->currentPaintOpPreset->settings()
355 && m_d->currentPaintOpPreset->settings()->useSpacingUpdates());
356}

References KisResourcesSnapshot::Private::currentPaintOpPreset, and m_d.

◆ opacity()

qreal KisResourcesSnapshot::opacity ( ) const

Definition at line 369 of file kis_resources_snapshot.cpp.

370{
371 return m_d->opacity;
372}

References m_d, and KisResourcesSnapshot::Private::opacity.

◆ postExecutionUndoAdapter()

KisPostExecutionUndoAdapter * KisResourcesSnapshot::postExecutionUndoAdapter ( ) const

Definition at line 255 of file kis_resources_snapshot.cpp.

256{
257 return m_d->image ? m_d->image->postExecutionUndoAdapter() : 0;
258}
KisPostExecutionUndoAdapter * postExecutionUndoAdapter() const override

References KisResourcesSnapshot::Private::image, m_d, and KisImage::postExecutionUndoAdapter().

◆ presetAllowsLod()

bool KisResourcesSnapshot::presetAllowsLod ( ) const

Definition at line 452 of file kis_resources_snapshot.cpp.

453{
454 return m_d->presetAllowsLod;
455}

References m_d, and KisResourcesSnapshot::Private::presetAllowsLod.

◆ presetNeedsAsynchronousUpdates()

bool KisResourcesSnapshot::presetNeedsAsynchronousUpdates ( ) const

Definition at line 457 of file kis_resources_snapshot.cpp.

458{
459 return m_d->currentPaintOpPreset && m_d->currentPaintOpPreset->settings()->needsAsynchronousUpdates();
460}

References KisResourcesSnapshot::Private::currentPaintOpPreset, and m_d.

◆ selectedNodes()

KisNodeList KisResourcesSnapshot::selectedNodes ( ) const

Definition at line 280 of file kis_resources_snapshot.cpp.

281{
282 return m_d->selectedNodes;
283}

References m_d, and KisResourcesSnapshot::Private::selectedNodes.

◆ setBGColorOverride()

void KisResourcesSnapshot::setBGColorOverride ( const KoColor & color)

Definition at line 467 of file kis_resources_snapshot.cpp.

468{
469 m_d->currentBgColor = color;
470}

References KisResourcesSnapshot::Private::currentBgColor, and m_d.

◆ setBrush()

void KisResourcesSnapshot::setBrush ( const KisPaintOpPresetSP & brush)

Definition at line 478 of file kis_resources_snapshot.cpp.

479{
481 brush->cloneWithResourcesSnapshot(
484 nullptr);
485
486#ifdef HAVE_THREADED_TEXT_RENDERING_WORKAROUND
487 KisPaintOpRegistry::instance()->preinitializePaintOpIfNeeded(m_d->currentPaintOpPreset);
488#endif /* HAVE_THREADED_TEXT_RENDERING_WORKAROUND */
489}

References KisResourcesSnapshot::Private::currentPaintOpPreset, KisResourcesSnapshot::Private::globalCanvasResourcesInterface, KisPaintOpRegistry::instance(), KisGlobalResourcesInterface::instance(), and m_d.

◆ setCurrentNode()

void KisResourcesSnapshot::setCurrentNode ( KisNodeSP node)

Definition at line 260 of file kis_resources_snapshot.cpp.

261{
262 m_d->currentNode = node;
263}

References KisResourcesSnapshot::Private::currentNode, and m_d.

◆ setFGColorOverride()

void KisResourcesSnapshot::setFGColorOverride ( const KoColor & color)

Definition at line 462 of file kis_resources_snapshot.cpp.

463{
464 m_d->currentFgColor = color;
465}

References KisResourcesSnapshot::Private::currentFgColor, and m_d.

◆ setFillStyle()

void KisResourcesSnapshot::setFillStyle ( KisPainter::FillStyle fillStyle)

Definition at line 270 of file kis_resources_snapshot.cpp.

271{
272 m_d->fillStyle = fillStyle;
273}

References KisResourcesSnapshot::Private::fillStyle, and m_d.

◆ setFillTransform()

void KisResourcesSnapshot::setFillTransform ( QTransform transform)

Definition at line 275 of file kis_resources_snapshot.cpp.

276{
277 m_d->fillTransform = transform;
278}

References KisResourcesSnapshot::Private::fillTransform, and m_d.

◆ setMirroring()

void KisResourcesSnapshot::setMirroring ( bool horizontal,
bool vertical )

◆ setOpacity()

void KisResourcesSnapshot::setOpacity ( qreal opacity)

Definition at line 358 of file kis_resources_snapshot.cpp.

359{
361}

References m_d, KisResourcesSnapshot::Private::opacity, and opacity().

◆ setSelectionOverride()

void KisResourcesSnapshot::setSelectionOverride ( KisSelectionSP selection)

Definition at line 472 of file kis_resources_snapshot.cpp.

473{
474 m_d->selectionOverride = selection;
475 m_d->hasOverrideSelection = true; // needed if selection passed is null to ignore selection
476}

References KisResourcesSnapshot::Private::hasOverrideSelection, m_d, and KisResourcesSnapshot::Private::selectionOverride.

◆ setStrokeStyle()

void KisResourcesSnapshot::setStrokeStyle ( KisPainter::StrokeStyle strokeStyle)

Definition at line 265 of file kis_resources_snapshot.cpp.

266{
267 m_d->strokeStyle = strokeStyle;
268}

References m_d, and KisResourcesSnapshot::Private::strokeStyle.

◆ setupMaskingBrushPainter()

void KisResourcesSnapshot::setupMaskingBrushPainter ( KisPainter * painter)

The paintOp should be initialized the last, because it may ask the painter for some options while initialization

Definition at line 229 of file kis_resources_snapshot.cpp.

230{
233
234 painter->setPaintColor(KoColor(Qt::white, painter->device()->colorSpace()));
235 painter->setBackgroundColor(KoColor(Qt::black, painter->device()->colorSpace()));
236
237 painter->setOpacityToUnit();
238 painter->setChannelFlags(QBitArray());
239
240 // masked brush always paints in indirect mode
242
244
245 painter->setStrokeStyle(m_d->strokeStyle);
246
251 painter->setPaintOpPreset(m_d->currentPaintOpPreset->createMaskingPreset(),
253}
const KoColorSpace * colorSpace() const
void setPaintOpPreset(KisPaintOpPresetSP preset, KisNodeSP node, KisImageSP image)
void setStrokeStyle(StrokeStyle strokeStyle)
Set the current brush stroke style.
void setMirrorInformation(const QPointF &axesCenter, bool mirrorHorizontally, bool mirrorVertically)
void setBackgroundColor(const KoColor &color)
void setOpacityToUnit()
KisPaintDeviceSP device
void setPaintColor(const KoColor &color)
void setChannelFlags(QBitArray channelFlags)
void setCompositeOpId(const KoCompositeOp *op)
#define KIS_SAFE_ASSERT_RECOVER_RETURN(cond)
Definition kis_assert.h:128

References KisResourcesSnapshot::Private::axesCenter, KisPaintDevice::colorSpace(), COMPOSITE_ALPHA_DARKEN, KisResourcesSnapshot::Private::currentNode, KisResourcesSnapshot::Private::currentPaintOpPreset, KisPainter::device, KisResourcesSnapshot::Private::image, KIS_SAFE_ASSERT_RECOVER_RETURN, m_d, KisResourcesSnapshot::Private::mirrorMaskHorizontal, KisResourcesSnapshot::Private::mirrorMaskVertical, KisPainter::setBackgroundColor(), KisPainter::setChannelFlags(), KisPainter::setCompositeOpId(), KisPainter::setMirrorInformation(), KisPainter::setOpacityToUnit(), KisPainter::setPaintColor(), KisPainter::setPaintOpPreset(), KisPainter::setStrokeStyle(), and KisResourcesSnapshot::Private::strokeStyle.

◆ setupPainter()

void KisResourcesSnapshot::setupPainter ( KisPainter * painter)

The paintOp should be initialized the last, because it may ask the painter for some options while initialization

Definition at line 200 of file kis_resources_snapshot.cpp.

201{
202 painter->setPaintColor(currentFgColor());
205 painter->setPattern(m_d->currentPattern);
207
208 QBitArray lockflags = channelLockFlags();
209 if (lockflags.size() > 0) {
210 painter->setChannelFlags(lockflags);
211 }
212
213 painter->setOpacityF(m_d->opacity);
216
217 painter->setStrokeStyle(m_d->strokeStyle);
218 painter->setFillStyle(m_d->fillStyle);
220
221
227}
void setPatternTransform(QTransform transform)
Set the transform on the pattern.
void setOpacityF(qreal opacity)
void setGenerator(KisFilterConfigurationSP generator)
Set the current generator (a generator can be used to fill an area.
void setGradient(const KoAbstractGradientSP gradient)
void setFillStyle(FillStyle fillStyle)
Set the current style with which to fill.
void setPattern(const KoPatternSP pattern)
Set the current pattern.

References KisResourcesSnapshot::Private::axesCenter, channelLockFlags(), KisResourcesSnapshot::Private::compositeOpId, currentBgColor(), currentFgColor(), KisResourcesSnapshot::Private::currentGenerator, KisResourcesSnapshot::Private::currentGradient, KisResourcesSnapshot::Private::currentNode, KisResourcesSnapshot::Private::currentPaintOpPreset, KisResourcesSnapshot::Private::currentPattern, KisResourcesSnapshot::Private::fillStyle, KisResourcesSnapshot::Private::fillTransform, KisResourcesSnapshot::Private::image, m_d, KisResourcesSnapshot::Private::mirrorMaskHorizontal, KisResourcesSnapshot::Private::mirrorMaskVertical, KisResourcesSnapshot::Private::opacity, KisPainter::setBackgroundColor(), KisPainter::setChannelFlags(), KisPainter::setCompositeOpId(), KisPainter::setFillStyle(), KisPainter::setGenerator(), KisPainter::setGradient(), KisPainter::setMirrorInformation(), KisPainter::setOpacityF(), KisPainter::setPaintColor(), KisPainter::setPaintOpPreset(), KisPainter::setPattern(), KisPainter::setPatternTransform(), KisPainter::setStrokeStyle(), and KisResourcesSnapshot::Private::strokeStyle.

Member Data Documentation

◆ m_d

Private* const KisResourcesSnapshot::m_d
private

Definition at line 96 of file kis_resources_snapshot.h.


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