33 const sal_Int32 nWidth = pWriteAcc->Width();
34 const sal_Int32 nHeight = pWriteAcc->Height();
35 const int nEntryCount = 1 << pWriteAcc->GetBitCount();
37 std::vector<PopArtEntry> aPopArtTable(nEntryCount);
39 for (
n = 0;
n < nEntryCount;
n++)
42 rEntry.
mnIndex =
static_cast<sal_uInt16
>(
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++;
57 std::sort(aPopArtTable.begin(), aPopArtTable.end(),
59 return lhs.mnCount < rhs.mnCount;
66 for (
n = 0;
n < nEntryCount;
n++)
73 const BitmapColor aFirstCol(pWriteAcc->GetPaletteColor(
74 sal::static_int_cast<sal_uInt16>(aPopArtTable[0].mnIndex)));
76 for (nFirstEntry = 0; nFirstEntry < nLastEntry; nFirstEntry++)
78 pWriteAcc->SetPaletteColor(
79 sal::static_int_cast<sal_uInt16>(aPopArtTable[nFirstEntry].
mnIndex),
80 pWriteAcc->GetPaletteColor(
81 sal::static_int_cast<sal_uInt16>(aPopArtTable[nFirstEntry + 1].mnIndex)));
84 pWriteAcc->SetPaletteColor(
85 sal::static_int_cast<sal_uInt16>(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.