33 const sal_Int32 nWidth = pWriteAcc->Width();
34 const sal_Int32 nHeight = pWriteAcc->Height();
35 const sal_uInt16 nEntryCount = 1 << pWriteAcc->GetBitCount();
37 std::vector<PopArtEntry> aPopArtTable(nEntryCount);
39 for (
n = 0;
n < nEntryCount;
n++)
47 for (sal_Int32 nY = 0; nY < nHeight; nY++)
49 Scanline pScanline = pWriteAcc->GetScanline(nY);
50 for (sal_Int32 nX = 0; nX < nWidth; nX++)
52 aPopArtTable[pWriteAcc->GetIndexFromData(pScanline, nX)].mnCount++;
53 assert(aPopArtTable[pWriteAcc->GetIndexFromData(pScanline, nX)].mnCount != 0);
58 std::sort(aPopArtTable.begin(), aPopArtTable.end(),
60 return lhs.mnCount > rhs.mnCount;
64 sal_uInt16 nFirstEntry;
65 sal_uInt16 nLastEntry = 0;
67 for (
n = 0;
n < nEntryCount;
n++)
74 const BitmapColor aFirstCol(pWriteAcc->GetPaletteColor(aPopArtTable[0].mnIndex));
76 for (nFirstEntry = 0; nFirstEntry < nLastEntry; nFirstEntry++)
78 pWriteAcc->SetPaletteColor(
79 aPopArtTable[nFirstEntry].
mnIndex,
80 pWriteAcc->GetPaletteColor(aPopArtTable[nFirstEntry + 1].mnIndex));
83 pWriteAcc->SetPaletteColor(aPopArtTable[nLastEntry].
mnIndex, aFirstCol);
Bitmap GetBitmap(Color aTransparentReplaceColor) const
virtual BitmapEx execute(BitmapEx const &rBitmapEx) const override
bool Convert(BmpConversion eConversion)
Convert bitmap format.
vcl::PixelFormat getPixelFormat() const
This template handles BitmapAccess the RAII way.
constexpr bool isPalettePixelFormat(PixelFormat ePixelFormat)
Is it a pixel format that forces creation of a palette.