26constexpr size_t OCTREE_BITS = 5;
27constexpr size_t OCTREE_BITS_1 = 10;
29constexpr sal_uLong gnBits = 8 - OCTREE_BITS;
36 , mpReduce(OCTREE_BITS + 1, nullptr)
88 rpNode->bLeaf = (OCTREE_BITS ==
mnLevel);
102 rpNode->nRed +=
color.GetRed();
103 rpNode->nGreen +=
color.GetGreen();
104 rpNode->nBlue +=
color.GetBlue();
111 | (((
color.GetGreen() & cMask) >> nShift) << 1)
112 | ((
color.GetBlue() & cMask) >> nShift);
136 for (
unsigned int i = 0;
i < 8;
i++)
142 nRedSum += pChild->
nRed;
143 nGreenSum += pChild->
nGreen;
144 nBlueSum += pChild->
nBlue;
153 pNode->
nRed = nRedSum;
154 pNode->
nGreen = nGreenSum;
155 pNode->
nBlue = nBlueSum;
170 for (
auto const&
i : pNode->
pChild)
190 | (((
color.GetGreen() & cMask) >> nShift) << 1)
191 | ((
color.GetBlue() & cMask) >> nShift);
217 const unsigned long xsqr = 1 << (gnBits << 1);
218 const unsigned long xsqr2 = xsqr << 1;
237 rdist = rdist * rdist + gdist * gdist + bdist * bdist;
239 const tools::Long crinc = (xsqr - (cRed << gnBits)) << 1;
240 const tools::Long cginc = (xsqr - (cGreen << gnBits)) << 1;
241 const tools::Long cbinc = (xsqr - (cBlue << gnBits)) << 1;
246 for (r = 0, rxx = crinc; r <
nColorMax; rdist += rxx, r++, rxx += xsqr2)
248 for (g = 0, gdist = rdist, gxx = cginc; g <
nColorMax; gdist += gxx, g++, gxx += xsqr2)
250 for (b = 0, bdist = gdist, bxx = cbinc; b <
nColorMax;
251 bdist += bxx, b++, cdp++, crgbp++, bxx += xsqr2)
tools::Long Height() const
tools::Long Width() const
const BitmapColor & GetPaletteColor(sal_uInt16 nColor) const
sal_uInt16 GetEntryCount() const
void SetEntryCount(sal_uInt16 nCount)
BitmapColor GetPixelFromData(const sal_uInt8 *pData, tools::Long nX) const
sal_uInt8 GetIndexFromData(const sal_uInt8 *pData, tools::Long nX) const
Scanline GetScanline(tools::Long nY) const
sal_uInt8 GetBlue() const
sal_uInt8 GetGreen() const
std::vector< sal_uInt8 > mpBuffer
sal_uInt16 GetBestPaletteIndex(const BitmapColor &rColor)
std::vector< sal_uInt8 > mpMap
InverseColorMap(const BitmapPalette &rPal)
sal_uInt16 GetBestPaletteIndex(const BitmapColor &rColor)
SAL_DLLPRIVATE void add(std::unique_ptr< OctreeNode > &rpNode, BitmapColor const &color)
SAL_DLLPRIVATE void reduce()
const BitmapPalette & GetPalette()
std::unique_ptr< OctreeNode > pTree
Octree(const BitmapReadAccess &rReadAcc, sal_uLong nColors)
std::vector< OctreeNode * > mpReduce
void GetPalIndex(const OctreeNode *pNode, BitmapColor const &color)
void CreatePalette(OctreeNode *pNode)
std::unique_ptr< OctreeNode > pChild[8]