38 const sal_Int32 nWidth = pWriteAcc->Width();
39 const sal_Int32 nHeight = pWriteAcc->Height();
40 const sal_Int32 nMask111 = -1, nMask121 = 0, nMask131 = 1;
41 const sal_Int32 nMask211 = -2, nMask221 = 0, nMask231 = 2;
42 const sal_Int32 nMask311 = -1, nMask321 = 0, nMask331 = 1;
43 const sal_Int32 nMask112 = 1, nMask122 = 2, nMask132 = 1;
44 const sal_Int32 nMask212 = 0, nMask222 = 0, nMask232 = 0;
45 const sal_Int32 nMask312 = -1, nMask322 = -2, nMask332 = -1;
46 sal_Int32 nGrey11, nGrey12, nGrey13;
47 sal_Int32 nGrey21, nGrey22, nGrey23;
48 sal_Int32 nGrey31, nGrey32, nGrey33;
49 std::unique_ptr<long[]> pHMap(
new long[nWidth + 2]);
50 std::unique_ptr<long[]> pVMap(
new long[nHeight + 2]);
51 sal_Int32 nX, nY, nSum1, nSum2;
56 for (nX = 1; nX <= nWidth; nX++)
61 pHMap[nWidth + 1] = nWidth - 1;
65 for (nY = 1; nY <= nHeight; nY++)
70 pVMap[nHeight + 1] = nHeight - 1;
72 for (nY = 0; nY < nHeight; nY++)
84 Scanline pScanline = pWriteAcc->GetScanline(nY);
85 for (nX = 0; nX < nWidth; nX++)
89 nSum1 += nMask111 * nGrey11;
90 nSum2 += nMask112 * nGrey11;
92 nSum1 += nMask121 * nGrey12;
93 nSum2 += nMask122 * nGrey12;
95 nSum1 += nMask131 * nGrey13;
96 nSum2 += nMask132 * nGrey13;
98 nSum1 += nMask211 * nGrey21;
99 nSum2 += nMask212 * nGrey21;
101 nSum1 += nMask221 * nGrey22;
102 nSum2 += nMask222 * nGrey22;
104 nSum1 += nMask231 * nGrey23;
105 nSum2 += nMask232 * nGrey23;
107 nSum1 += nMask311 * nGrey31;
108 nSum2 += nMask312 * nGrey31;
110 nSum1 += nMask321 * nGrey32;
111 nSum2 += nMask322 * nGrey32;
113 nSum1 += nMask331 * nGrey33;
114 nSum2 += nMask332 * nGrey33;
116 nSum1 =
static_cast<sal_Int32
>(std::hypot(nSum1, nSum2));
119 ~
static_cast<sal_uInt8>(std::clamp(nSum1, sal_Int32(0), sal_Int32(255))));
120 pWriteAcc->SetPixelOnData(pScanline, nX, aGrey);
122 if (nX < (nWidth - 1))
124 const sal_Int32 nNextX = pHMap[nX + 3];
sal_uInt8 GetIndex() const
void SetIndex(sal_uInt8 cIndex)
Bitmap GetBitmap(Color aTransparentReplaceColor) const
const BitmapPalette & GetPalette() const
BitmapColor GetPixel(tools::Long nY, tools::Long nX) const
virtual BitmapEx execute(BitmapEx const &rBitmapEx) const override
void SetPrefMapMode(const MapMode &rMapMode)
const MapMode & GetPrefMapMode() const
Size GetSizePixel() const
void SetPrefSize(const Size &rSize)
SAL_DLLPRIVATE bool ImplMakeGreyscales()
const Size & GetPrefSize() const
HashMap_OWString_Interface aMap