27 int aNumberOfContributions;
29 std::vector<double> aWeights;
30 std::vector<int> aPixels;
31 std::vector<int> aCounts;
34 blurContributions(nWidth, aNumberOfContributions, aBlurVector, aWeights, aPixels, aCounts);
41 bool bResult =
convolutionPass(aBitmap, aNewBitmap, pReadAcc.
get(), aNumberOfContributions,
42 aWeights.data(), aPixels.data(), aCounts.data());
60 blurContributions(nHeight, aNumberOfContributions, aBlurVector, aWeights, aPixels, aCounts);
65 aWeights.data(), aPixels.data(), aCounts.data());
86 int aNumberOfContributions,
87 const double* pWeights,
int const* pPixels,
103 double aValueRed, aValueGreen, aValueBlue;
104 double aSum, aWeight;
107 for (
int nSourceY = 0; nSourceY < nHeight; ++nSourceY)
109 for (
int nSourceX = 0; nSourceX < nWidth; ++nSourceX)
111 aBaseIndex = nSourceX * aNumberOfContributions;
112 aSum = aValueRed = aValueGreen = aValueBlue = 0.0;
114 for (
int j = 0; j < pCount[nSourceX]; ++j)
117 aWeight = pWeights[
aIndex];
122 aValueRed += aWeight * aColor.
GetRed();
123 aValueGreen += aWeight * aColor.
GetGreen();
124 aValueBlue += aWeight * aColor.
GetBlue();
131 int nDestX = nSourceY;
132 int nDestY = nSourceX;
134 pWriteAcc->SetPixel(nDestY, nDestX, aResultColor);
143 int intRadius =
static_cast<int>(radius + 1.0);
144 rows = intRadius * 2 + 1;
145 std::vector<double>
matrix(rows);
147 double sigma = radius / 3;
148 double radius2 = radius * radius;
150 for (
int row = -intRadius; row <= intRadius; row++)
167 const int aSize,
const int aNumberOfContributions,
const std::vector<double>& rBlurVector,
168 std::vector<double>& rWeights, std::vector<int>& rPixels, std::vector<int>& rCounts)
170 rWeights.resize(aSize * aNumberOfContributions);
171 rPixels.resize(aSize * aNumberOfContributions);
172 rCounts.resize(aSize);
174 int aLeft, aRight, aCurrentCount, aPixelIndex;
177 for (
int i = 0;
i < aSize;
i++)
179 aLeft =
i - aNumberOfContributions / 2;
180 aRight =
i + aNumberOfContributions / 2;
182 for (
int j = aLeft; j <= aRight; j++)
184 aWeight = rBlurVector[aCurrentCount];
193 aPixelIndex = (aSize - j) + aSize - 1;
201 if (aPixelIndex < 0 || aPixelIndex >= aSize)
206 rWeights[
i * aNumberOfContributions + aCurrentCount] = aWeight;
207 rPixels[
i * aNumberOfContributions + aCurrentCount] = aPixelIndex;
211 rCounts[
i] = aCurrentCount;
Bitmap GetBitmap(Color aTransparentReplaceColor) const
static bool convolutionPass(const Bitmap &rBitmap, Bitmap &aNewBitmap, BitmapReadAccess const *pReadAcc, int aNumberOfContributions, const double *pWeights, int const *pPixels, const int *pCount)
virtual BitmapEx execute(BitmapEx const &rBitmapEx) const override
Separable Gaussian Blur filter and accepts a blur radius as a parameter so the user can change the st...
static std::vector< double > makeBlurKernel(const double radius, int &rows)
static void blurContributions(const int aSize, const int aNumberOfContributions, const std::vector< double > &rBlurVector, std::vector< double > &rWeights, std::vector< int > &rPixels, std::vector< int > &rCounts)
BitmapColor GetColor(tools::Long nY, tools::Long nX) const
SAL_DLLPRIVATE void ReassignWithSize(const Bitmap &rBitmap)
ReassignWithSize and recalculate bitmap.
Size GetSizePixel() const
vcl::ScopedBitmapAccess< BitmapReadAccess, Bitmap, &Bitmap::AcquireReadAccess > ScopedReadAccess
sal_uInt8 GetBlue() const
sal_uInt8 GetGreen() const
constexpr tools::Long Height() const
constexpr tools::Long Width() const
std::deque< AttacherIndex_Impl > aIndex
std::enable_if< std::is_signed< T >::value||std::is_floating_point< T >::value, long >::type MinMax(T nVal, tools::Long nMin, tools::Long nMax)