|
Krita Source Code Documentation
|
Classes | |
| struct | AveragedSampleWrapper |
| struct | WeightedSampleWrapper |
Functions | |
| template<class WeightingModeWrapper > | |
| void | sampleColor (const QRect &srcRect, qreal sampleRadiusValue, KisColorSmudgeSourceSP sourceDevice, KisFixedPaintDeviceSP tempFixedDevice, KisFixedPaintDeviceSP maskDab, KoColor *resultColor) |
| void KisColorSmudgeSampleUtils::sampleColor | ( | const QRect & | srcRect, |
| qreal | sampleRadiusValue, | ||
| KisColorSmudgeSourceSP | sourceDevice, | ||
| KisFixedPaintDeviceSP | tempFixedDevice, | ||
| KisFixedPaintDeviceSP | maskDab, | ||
| KoColor * | resultColor ) |
Sample color from srcRect in weighted way
The function samples srcRect in an efficient way. It samples "random" pixels using Halton sequence and waits until the sampled color "converges" to stable value. The sampled area is defined by sampleRadiusValue.
The way of weighting the pixels is defined by WeightingModeWrapper template policy. If WeightedSampleWrapper is used, then the sampled color is weighted by the passed brush mask in maskDab. If AveragedSampleWrapper is used, then maskDab is not used and all sampled pixels are averaged in a uniform way.
| sampleRadiusValue | defines how many pixels are sampled. When sampleRadiusValue is 0.0, only the central pixel is sampled. When sampleRadiusValue is 1.0, the entire range of srcRect is sampled. If AveragedSampleWrapper is used, then sampleRadiusValue may be increased up to 3.0 to sample outside srcRect. |
When WeightedSampleWrapper is used, the sampler may sample more pixels than actually requested by sampleRadiusValue. It may happen if all the pixels in the sample radius area are masked out by maskDab.
| tempFixedDevice | is a temporary device that may be used by the function for internal purposes. |
Definition at line 135 of file KisColorSmudgeSampleUtils.h.
References KisAlgebra2D::blowRect(), KisFixedPaintDevice::colorSpace(), KoColor::colorSpace(), KoMixColorsOp::createMixer(), KisFixedPaintDevice::data(), KoColor::data(), KoColorSpace::differenceA(), KisAlgebra2D::HaltonSequenceGenerator::generate(), KIS_ASSERT_RECOVER_RETURN, KisFixedPaintDevice::lazyGrowBufferWithoutInitialization(), KoColorSpace::mixColorsOp, and KisFixedPaintDevice::setRect().