44 const sal_Int32 nWidth = pWriteAcc->Width();
45 const sal_Int32 nHeight = pWriteAcc->Height();
46 sal_Int32 nGrey11, nGrey12, nGrey13;
47 sal_Int32 nGrey21, nGrey22, nGrey23;
48 sal_Int32 nGrey31, nGrey32, nGrey33;
51 std::unique_ptr<sal_Int32[]> pHMap(
new sal_Int32[nWidth + 2]);
52 std::unique_ptr<sal_Int32[]> pVMap(
new sal_Int32[nHeight + 2]);
53 sal_Int32 nX, nY, nNx, nNy, nDotL;
54 const sal_Int32 nLx =
FRound(cos(fAzim) * cos(fElev) * 255.0);
55 const sal_Int32 nLy =
FRound(sin(fAzim) * cos(fElev) * 255.0);
56 const sal_Int32 nLz =
FRound(sin(fElev) * 255.0);
57 const auto nZ2 = ((6 * 255) / 4) * ((6 * 255) / 4);
58 const sal_Int32 nNzLz = ((6 * 255) / 4) * nLz;
60 =
static_cast<sal_uInt8>(std::clamp(nLz, sal_Int32(0), sal_Int32(255)));
65 for (nX = 1; nX <= nWidth; nX++)
70 pHMap[nWidth + 1] = nWidth - 1;
74 for (nY = 1; nY <= nHeight; nY++)
79 pVMap[nHeight + 1] = nHeight - 1;
81 for (nY = 0; nY < nHeight; nY++)
93 Scanline pScanline = pWriteAcc->GetScanline(nY);
94 for (nX = 0; nX < nWidth; nX++)
96 nNx = nGrey11 + nGrey21 + nGrey31 - nGrey13 - nGrey23 - nGrey33;
97 nNy = nGrey31 + nGrey32 + nGrey33 - nGrey11 - nGrey12 - nGrey13;
103 else if ((nDotL = nNx * nLx + nNy * nLy + nNzLz) < 0)
110 = nDotL / sqrt(static_cast<double>(nNx * nNx + nNy * nNy + nZ2));
111 aGrey.
SetIndex(static_cast<sal_uInt8>(std::clamp(fGrey, 0.0, 255.0)));
114 pWriteAcc->SetPixelOnData(pScanline, nX, aGrey);
116 if (nX < (nWidth - 1))
118 const sal_Int32 nNextX = pHMap[nX + 3];
144 const Size aPrefSize(aBitmap.GetPrefSize());
148 aBitmap.SetPrefMapMode(
aMap);
149 aBitmap.SetPrefSize(aPrefSize);
sal_uInt8 GetIndex() const
virtual BitmapEx execute(BitmapEx const &rBitmapEx) const override
HashMap_OWString_Interface aMap
sal_uInt16 mnElevationAngle100
tools::Long FRound(double fVal)
sal_uInt16 mnAzimuthAngle100
void SetIndex(sal_uInt8 cIndex)
Bitmap GetBitmap(Color aTransparentReplaceColor) const
const BitmapPalette & GetPalette() const
SAL_DLLPRIVATE bool ImplMakeGreyscales()
BitmapColor GetPixel(tools::Long nY, tools::Long nX) const