25 std::unique_ptr<Bitmap> pNewBmp;
29 if (aBitmap.GetBitCount() > 8)
31 pReadAcc = pWriteAcc = aBitmap.AcquireWriteAccess();
35 pNewBmp.reset(
new Bitmap(aBitmap.GetSizePixel(), 24));
36 pReadAcc = aBitmap.AcquireReadAccess();
37 pWriteAcc = pNewBmp->AcquireWriteAccess();
40 bool bConditionsMet =
false;
43 if (pReadAcc && pWriteAcc)
45 nWidth = pReadAcc->
Width();
46 nHeight = pReadAcc->
Height();
47 bConditionsMet = (nWidth > 0 && nHeight > 0);
53 tools::Long nX, nY, nX1, nX2, nY1, nY2, nSumR, nSumG, nSumB;
70 fArea_1 = 1.0 / ((nX2 - nX1 + 1) * (nY2 - nY1 + 1));
76 for (nY = nY1, nSumR = nSumG = nSumB = 0; nY <= nY2; nY++)
79 for (nX = nX1; nX <= nX2; nX++)
88 aCol.
SetRed(static_cast<sal_uInt8>(nSumR * fArea_1));
89 aCol.
SetGreen(static_cast<sal_uInt8>(nSumG * fArea_1));
90 aCol.
SetBlue(static_cast<sal_uInt8>(nSumB * fArea_1));
92 for (nY = nY1; nY <= nY2; nY++)
95 for (nX = nX1; nX <= nX2; nX++)
105 fArea_1 = 1.0 / ((nX2 - nX1 + 1) * (nY2 - nY1 + 1));
107 }
while (nX1 < nWidth);
113 for (nY = nY1, nSumR = nSumG = nSumB = 0; nY <= nY2; nY++)
116 for (nX = nX1; nX <= nX2; nX++)
126 aCol.
SetRed(static_cast<sal_uInt8>(nSumR * fArea_1));
127 aCol.
SetGreen(static_cast<sal_uInt8>(nSumG * fArea_1));
128 aCol.
SetBlue(static_cast<sal_uInt8>(nSumB * fArea_1));
130 for (nY = nY1; nY <= nY2; nY++)
133 for (nX = nX1; nX <= nX2; nX++)
143 fArea_1 = 1.0 / ((nX2 - nX1 + 1) * (nY2 - nY1 + 1));
145 }
while (nX1 < nWidth);
154 }
while (nY1 < nHeight);
168 const Size aPrefSize(aBitmap.GetPrefSize());
172 aBitmap.SetPrefMapMode(
aMap);
173 aBitmap.SetPrefSize(aPrefSize);
sal_uInt8 GetIndexFromData(const sal_uInt8 *pData, tools::Long nX) const
tools::Long Height() const
void SetBlue(sal_uInt8 nBlue)
HashMap_OWString_Interface aMap
void SetPixelOnData(sal_uInt8 *pData, tools::Long nX, const BitmapColor &rBitmapColor)
Scanline GetScanline(tools::Long nY) const
virtual BitmapEx execute(BitmapEx const &rBitmapEx) const override
sal_uInt8 GetBlue() const
tools::Long Width() const
void SetRed(sal_uInt8 nRed)
static void ReleaseAccess(BitmapInfoAccess *pAccess)
Bitmap GetBitmap(Color aTransparentReplaceColor) const
sal_uInt8 GetGreen() const
void SetGreen(sal_uInt8 nGreen)
BitmapColor GetPixelFromData(const sal_uInt8 *pData, tools::Long nX) const
const BitmapColor & GetPaletteColor(sal_uInt16 nColor) const