Files
source/Utils/Quantize.h
Marco Antonio J. Costaandmajcosta 86ad401186 add newline at end of file where it's lacking
.editorconfig already enforces it but it's getting changed piecemeal in
every commit. just get it done with.

the script:
```

find . -type f -not -path "./.git/*" -not -path "./.vs/*" | while read -r file; do
	isFile=$(file -0 "$file" | cut -d $'\0' -f2)
	case "$isFile" in
		(*text*)
			echo "$file is text"
			if [[ $(tail -c 1 "$file" | wc -l) -ne 1 ]]; then
				echo "" >> "$file"
			fi
			;;
		(*)
			echo "file isn't text"
			;;
	esac
done
```
2024-12-14 19:05:48 -03:00

44 lines
1.3 KiB
C++

#ifndef __QUANTIZE_H_
#define __QUANTIZE_H_
typedef struct _NODE {
BOOL bIsLeaf; // TRUE if node has no children
UINT nPixelCount; // Number of pixels represented by this leaf
UINT nRedSum; // Sum of red components
UINT nGreenSum; // Sum of green components
UINT nBlueSum; // Sum of blue components
struct _NODE* pChild[8]; // Pointers to child nodes
struct _NODE* pNext; // Pointer to next reducible node
} NODE;
class CQuantizer
{
protected:
NODE* m_pTree;
UINT m_nLeafCount;
NODE* m_pReducibleNodes[9];
UINT m_nMaxColors;
UINT m_nColorBits;
public:
CQuantizer (UINT nMaxColors, UINT nColorBits);
virtual ~CQuantizer ();
BOOL ProcessImage (BYTE *pData, int iWidth, int iHeight );
UINT GetColorCount ();
void GetColorTable (RGBQUAD* prgb);
protected:
int GetLeftShiftCount (DWORD dwVal);
int GetRightShiftCount (DWORD dwVal);
void AddColor (NODE** ppNode, BYTE r, BYTE g, BYTE b, UINT nColorBits,
UINT nLevel, UINT* pLeafCount, NODE** pReducibleNodes);
NODE* CreateNode (UINT nLevel, UINT nColorBits, UINT* pLeafCount,
NODE** pReducibleNodes);
void ReduceTree (UINT nColorBits, UINT* pLeafCount,
NODE** pReducibleNodes);
void DeleteTree (NODE** ppNode);
void GetPaletteColors (NODE* pTree, RGBQUAD* prgb, UINT* pIndex);
};
#endif