|
Krita Source Code Documentation
|
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 |
Private Attributes | |
| Private *const | m_d |
Additional Inherited Members | |
Protected Member Functions inherited from KisShared | |
| KisShared () | |
| ~KisShared () | |
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.
| 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.
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::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.
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 | ( | ) |
Definition at line 195 of file kis_resources_snapshot.cpp.
References m_d.
| KisSelectionSP KisResourcesSnapshot::activeSelection | ( | ) | const |
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.
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.
| qreal KisResourcesSnapshot::airbrushingInterval | ( | ) | const |
Definition at line 344 of file kis_resources_snapshot.cpp.
References KisResourcesSnapshot::Private::currentPaintOpPreset, and m_d.
| QBitArray KisResourcesSnapshot::channelLockFlags | ( | ) | const |
Definition at line 429 of file kis_resources_snapshot.cpp.
References KoColorSpace::channelFlags(), KisPaintLayer::channelLockFlags(), KisLayer::colorSpace(), KisResourcesSnapshot::Private::currentNode, KisSharedPtr< T >::data(), KisResourcesSnapshot::Private::globalAlphaLock, and m_d.
| QString KisResourcesSnapshot::compositeOpId | ( | ) | const |
Definition at line 374 of file kis_resources_snapshot.cpp.
References KisResourcesSnapshot::Private::compositeOpId, and m_d.
| KoColor KisResourcesSnapshot::currentBgColor | ( | ) | const |
Definition at line 394 of file kis_resources_snapshot.cpp.
References KisResourcesSnapshot::Private::currentBgColor, KisResourcesSnapshot::Private::currentFgColor, KisResourcesSnapshot::Private::isUsingOtherColor, and m_d.
| KoColor KisResourcesSnapshot::currentFgColor | ( | ) | const |
Definition at line 384 of file kis_resources_snapshot.cpp.
References KisResourcesSnapshot::Private::currentBgColor, KisResourcesSnapshot::Private::currentFgColor, KisResourcesSnapshot::Private::isUsingOtherColor, and m_d.
| KisFilterConfigurationSP KisResourcesSnapshot::currentGenerator | ( | ) | const |
Definition at line 419 of file kis_resources_snapshot.cpp.
References KisResourcesSnapshot::Private::currentGenerator, and m_d.
| KoAbstractGradientSP KisResourcesSnapshot::currentGradient | ( | ) | const |
Definition at line 414 of file kis_resources_snapshot.cpp.
References KisResourcesSnapshot::Private::currentGradient, and m_d.
| KisNodeSP KisResourcesSnapshot::currentNode | ( | ) | const |
Definition at line 285 of file kis_resources_snapshot.cpp.
References KisResourcesSnapshot::Private::currentNode, and m_d.
| KisPaintOpPresetSP KisResourcesSnapshot::currentPaintOpPreset | ( | ) | const |
Definition at line 404 of file kis_resources_snapshot.cpp.
References KisResourcesSnapshot::Private::currentPaintOpPreset, and m_d.
| KoPatternSP KisResourcesSnapshot::currentPattern | ( | ) | const |
Definition at line 379 of file kis_resources_snapshot.cpp.
References KisResourcesSnapshot::Private::currentPattern, and m_d.
| qreal KisResourcesSnapshot::effectiveZoom | ( | ) | const |
Definition at line 447 of file kis_resources_snapshot.cpp.
References KisResourcesSnapshot::Private::effectiveZoom, and m_d.
| QTransform KisResourcesSnapshot::fillTransform | ( | ) | const |
Definition at line 409 of file kis_resources_snapshot.cpp.
References KisResourcesSnapshot::Private::fillTransform, and m_d.
| KisImageSP KisResourcesSnapshot::image | ( | ) | const |
Definition at line 290 of file kis_resources_snapshot.cpp.
References KisResourcesSnapshot::Private::image, and m_d.
| QString KisResourcesSnapshot::indirectPaintingCompositeOp | ( | ) | const |
Definition at line 300 of file kis_resources_snapshot.cpp.
References COMPOSITE_ALPHA_DARKEN, KisResourcesSnapshot::Private::currentPaintOpPreset, and m_d.
| bool KisResourcesSnapshot::isUsingOtherColor | ( | ) | const |
Definition at line 424 of file kis_resources_snapshot.cpp.
References KisResourcesSnapshot::Private::isUsingOtherColor, and m_d.
| bool KisResourcesSnapshot::needsAirbrushing | ( | ) | const |
Definition at line 337 of file kis_resources_snapshot.cpp.
References KisResourcesSnapshot::Private::currentPaintOpPreset, and m_d.
| bool KisResourcesSnapshot::needsIndirectPainting | ( | ) | const |
Definition at line 295 of file kis_resources_snapshot.cpp.
References KisResourcesSnapshot::Private::currentPaintOpPreset, and m_d.
| bool KisResourcesSnapshot::needsMaskingBrushRendering | ( | ) | const |
Definition at line 307 of file kis_resources_snapshot.cpp.
References KisResourcesSnapshot::Private::currentPaintOpPreset, and m_d.
| bool KisResourcesSnapshot::needsSpacingUpdates | ( | ) | const |
Definition at line 351 of file kis_resources_snapshot.cpp.
References KisResourcesSnapshot::Private::currentPaintOpPreset, and m_d.
| qreal KisResourcesSnapshot::opacity | ( | ) | const |
Definition at line 369 of file kis_resources_snapshot.cpp.
References m_d, and KisResourcesSnapshot::Private::opacity.
| KisPostExecutionUndoAdapter * KisResourcesSnapshot::postExecutionUndoAdapter | ( | ) | const |
Definition at line 255 of file kis_resources_snapshot.cpp.
References KisResourcesSnapshot::Private::image, m_d, and KisImage::postExecutionUndoAdapter().
| bool KisResourcesSnapshot::presetAllowsLod | ( | ) | const |
Definition at line 452 of file kis_resources_snapshot.cpp.
References m_d, and KisResourcesSnapshot::Private::presetAllowsLod.
| bool KisResourcesSnapshot::presetNeedsAsynchronousUpdates | ( | ) | const |
Definition at line 457 of file kis_resources_snapshot.cpp.
References KisResourcesSnapshot::Private::currentPaintOpPreset, and m_d.
| KisNodeList KisResourcesSnapshot::selectedNodes | ( | ) | const |
Definition at line 280 of file kis_resources_snapshot.cpp.
References m_d, and KisResourcesSnapshot::Private::selectedNodes.
Definition at line 467 of file kis_resources_snapshot.cpp.
References KisResourcesSnapshot::Private::currentBgColor, and m_d.
| void KisResourcesSnapshot::setBrush | ( | const KisPaintOpPresetSP & | brush | ) |
Definition at line 478 of file kis_resources_snapshot.cpp.
References KisResourcesSnapshot::Private::currentPaintOpPreset, KisResourcesSnapshot::Private::globalCanvasResourcesInterface, KisPaintOpRegistry::instance(), KisGlobalResourcesInterface::instance(), and m_d.
Definition at line 260 of file kis_resources_snapshot.cpp.
References KisResourcesSnapshot::Private::currentNode, and m_d.
Definition at line 462 of file kis_resources_snapshot.cpp.
References KisResourcesSnapshot::Private::currentFgColor, and m_d.
| void KisResourcesSnapshot::setFillStyle | ( | KisPainter::FillStyle | fillStyle | ) |
Definition at line 270 of file kis_resources_snapshot.cpp.
References KisResourcesSnapshot::Private::fillStyle, and m_d.
| void KisResourcesSnapshot::setFillTransform | ( | QTransform | transform | ) |
Definition at line 275 of file kis_resources_snapshot.cpp.
References KisResourcesSnapshot::Private::fillTransform, and m_d.
| void KisResourcesSnapshot::setMirroring | ( | bool | horizontal, |
| bool | vertical ) |
Definition at line 363 of file kis_resources_snapshot.cpp.
References m_d, KisResourcesSnapshot::Private::mirrorMaskHorizontal, and KisResourcesSnapshot::Private::mirrorMaskVertical.
| void KisResourcesSnapshot::setOpacity | ( | qreal | opacity | ) |
Definition at line 358 of file kis_resources_snapshot.cpp.
References m_d, KisResourcesSnapshot::Private::opacity, and opacity().
| void KisResourcesSnapshot::setSelectionOverride | ( | KisSelectionSP | selection | ) |
Definition at line 472 of file kis_resources_snapshot.cpp.
References KisResourcesSnapshot::Private::hasOverrideSelection, m_d, and KisResourcesSnapshot::Private::selectionOverride.
| void KisResourcesSnapshot::setStrokeStyle | ( | KisPainter::StrokeStyle | strokeStyle | ) |
Definition at line 265 of file kis_resources_snapshot.cpp.
References m_d, and KisResourcesSnapshot::Private::strokeStyle.
| 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.
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.
| 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.
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.
|
private |
Definition at line 96 of file kis_resources_snapshot.h.