40 const sal_Int32 nWidth = pWriteAcc->Width();
41 const sal_Int32 nHeight = pWriteAcc->Height();
42 sal_Int32 nGrey11, nGrey12, nGrey13;
43 sal_Int32 nGrey21, nGrey22, nGrey23;
44 sal_Int32 nGrey31, nGrey32, nGrey33;
47 std::unique_ptr<sal_Int32[]> pHMap(
new sal_Int32[nWidth + 2]);
48 std::unique_ptr<sal_Int32[]> pVMap(
new sal_Int32[nHeight + 2]);
49 sal_Int32 nX, nY, nNx, nNy, nDotL;
50 const sal_Int32 nLx =
FRound(cos(fAzim) * cos(fElev) * 255.0);
51 const sal_Int32 nLy =
FRound(sin(fAzim) * cos(fElev) * 255.0);
52 const sal_Int32 nLz =
FRound(sin(fElev) * 255.0);
53 const auto nZ2 = ((6 * 255) / 4) * ((6 * 255) / 4);
54 const sal_Int32 nNzLz = ((6 * 255) / 4) * nLz;
55 const sal_uInt8 cLz =
static_cast<sal_uInt8>(std::clamp(nLz, sal_Int32(0), sal_Int32(255)));
60 for (nX = 1; nX <= nWidth; nX++)
65 pHMap[nWidth + 1] = nWidth - 1;
69 for (nY = 1; nY <= nHeight; nY++)
74 pVMap[nHeight + 1] = nHeight - 1;
76 for (nY = 0; nY < nHeight; nY++)
88 Scanline pScanline = pWriteAcc->GetScanline(nY);
89 for (nX = 0; nX < nWidth; nX++)
91 nNx = nGrey11 + nGrey21 + nGrey31 - nGrey13 - nGrey23 - nGrey33;
92 nNy = nGrey31 + nGrey32 + nGrey33 - nGrey11 - nGrey12 - nGrey13;
98 else if ((nDotL = nNx * nLx + nNy * nLy + nNzLz) < 0)
104 const double fGrey = nDotL / sqrt(
static_cast<double>(nNx * nNx + nNy * nNy + nZ2));
108 pWriteAcc->SetPixelOnData(pScanline, nX, aGrey);
110 if (nX < (nWidth - 1))
112 const sal_Int32 nNextX = pHMap[nX + 3];
sal_uInt8 GetIndex() const
void SetIndex(sal_uInt8 cIndex)
virtual BitmapEx execute(BitmapEx const &rBitmapEx) const override
sal_uInt16 mnAzimuthAngle100
sal_uInt16 mnElevationAngle100
Bitmap GetBitmap(Color aTransparentReplaceColor) const
const BitmapPalette & GetPalette() const
BitmapColor GetPixel(tools::Long nY, tools::Long nX) const
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
tools::Long FRound(double fVal)
HashMap_OWString_Interface aMap