34 const int nEntryCount = 1 << pWriteAcc->GetBitCount();
36 std::vector<PopArtEntry> aPopArtTable(nEntryCount);
38 for (n = 0; n < nEntryCount; n++)
41 rEntry.
mnIndex =
static_cast<sal_uInt16
>(n);
48 Scanline pScanline = pWriteAcc->GetScanline(nY);
51 aPopArtTable[pWriteAcc->GetIndexFromData(pScanline, nX)].mnCount++;
56 std::sort(aPopArtTable.begin(), aPopArtTable.end(),
58 return lhs.
mnCount < rhs.mnCount;
65 for (n = 0; n < nEntryCount; n++)
72 const BitmapColor aFirstCol(pWriteAcc->GetPaletteColor(
73 sal::static_int_cast<sal_uInt16>(aPopArtTable[0].mnIndex)));
75 for (nFirstEntry = 0; nFirstEntry < nLastEntry; nFirstEntry++)
77 pWriteAcc->SetPaletteColor(
78 sal::static_int_cast<sal_uInt16>(aPopArtTable[nFirstEntry].
mnIndex),
79 pWriteAcc->GetPaletteColor(
80 sal::static_int_cast<sal_uInt16>(aPopArtTable[nFirstEntry + 1].mnIndex)));
83 pWriteAcc->SetPaletteColor(
84 sal::static_int_cast<sal_uInt16>(aPopArtTable[nLastEntry].
mnIndex), aFirstCol);
constexpr bool isPalettePixelFormat(PixelFormat ePixelFormat)
Is it a pixel format that forces creation of a palette.
This template handles BitmapAccess the RAII way.
virtual BitmapEx execute(BitmapEx const &rBitmapEx) const override
Bitmap GetBitmap(Color aTransparentReplaceColor) const