|
Krita Source Code Documentation
|
#include <kis_filter_weights_buffer.h>
Classes | |
| struct | FilterWeights |
Public Member Functions | |
| KisFilterWeightsBuffer (KisFilterStrategy *filterStrategy, qreal realScale) | |
| int | maxSpan () const |
| FilterWeights * | weights (KisFixedPoint pos) const |
| KisFixedPoint | weightsPositionScale () const |
| ~KisFilterWeightsBuffer () | |
Private Member Functions | |
| int | findMaxIndex (qint16 *buf, int size) |
Private Attributes | |
| FilterWeights * | m_filterWeights |
| int | m_maxSpan |
| KisFixedPoint | m_weightsPositionScale |
Stores the cached values for the weights of neighbouring pixels that would form the pixel in a result of resampling. The object of this class is created before a pass of the transformation basing on the desired scale factor and the filter strategy used for resampling.
Here is an example of a calculation of the span for a pixel with scale equal to 1.0. The result of the blending will be written into the dst(0) pixel, which is marked with '*' sign. Note that all the coordinates here are related to the center of the pixel, not to its leftmost border as it is common in other systems. The centerSrc coordinate represents the offset between the source and the destination buffers.
dst-coordinates: the coordinates in the resulting image. The values of the filter strategy are calculated in these coordinates.
src-coordinates: the coordinates in the source image/buffer. We pick integer values from there and calculate their dst-position to know their weights.
+----+----+----+-- scaledIter (samples, measured in dst pixels,
| | | | correspond to integers in src)
+---------+-- supportDst == filterStrategy->intSupport()
| |
+-- beginDst +-- endDst
| | |
| +-- centerDst (always zero)
| | |
dst: -—|-—|-—|-—|-—*-—|-—|-—|-—|-—|--> -4 -3 -2 -1 0 1 2 3 4 5
src: –|-—|-—|-—|-—|-—|-—|-—|-—|-—|----> -4 -3 -2 -1 0 1 2 3 4 5
^ ^ ^
| | |
| +-- centerSrc
| | |
+-- beginSrc +endSrc
| | |
| +---------+-- supportSrc ~= supportDst / realScale
| |
+-------------------+-- span (number of integers in the region)
Definition at line 133 of file kis_filter_weights_buffer.h.
|
inline |
Definition at line 147 of file kis_filter_weights_buffer.h.
References KisFilterWeightsBuffer::FilterWeights::centerIndex, DEBUG_ALL, DEBUG_SAMPLE, findMaxIndex(), KisFixedPoint::from256Frac(), KisFilterStrategy::intSupport(), KisFilterStrategy::intValueAt(), KisFixedPoint::isInteger(), m_filterWeights, m_maxSpan, m_weightsPositionScale, SANITY_CENTER_POSITION, SANITY_CHECKSUM, SANITY_ZEROS, KisFilterWeightsBuffer::FilterWeights::span, KisFixedPoint::to256Frac(), KisFixedPoint::toFloat(), KisFixedPoint::toInt(), and KisFilterWeightsBuffer::FilterWeights::weight.
|
inline |
Definition at line 230 of file kis_filter_weights_buffer.h.
References m_filterWeights.
|
inlineprivate |
Definition at line 261 of file kis_filter_weights_buffer.h.
|
inline |
The maximum width of the buffer that would be needed for calculation of a pixel value. In other words, the maximum number of support pixels that are needed for calculation of a single result pixel
Definition at line 247 of file kis_filter_weights_buffer.h.
References m_maxSpan.
|
inline |
Return a weights buffer for a particular value of offset
Definition at line 237 of file kis_filter_weights_buffer.h.
References m_filterWeights, and KisFixedPoint::to256Frac().
|
inline |
The scale of the support buffer. Note that it is not always equal to the real scale of the transformation due to interpolation/blending difference.
Definition at line 256 of file kis_filter_weights_buffer.h.
References m_weightsPositionScale.
|
private |
Definition at line 276 of file kis_filter_weights_buffer.h.
|
private |
Definition at line 277 of file kis_filter_weights_buffer.h.
|
private |
Definition at line 278 of file kis_filter_weights_buffer.h.