KSquare Utilities
KKB::BmpImage::PalletBuilder Class Reference

Classes

class  RGBQUAD_Pred
 

Public Member Functions

 PalletBuilder ()
 
void AddColor (uchar red, uchar green, uchar blue)
 
void BuildPallet (RGBQUAD *&palette, kkint32 &size)
 
kkint32 NumOfColors () const
 
kkint32 PalletIndex (uchar red, uchar green, uchar blue)
 

Detailed Description

Definition at line 1066 of file BMPImage.cpp.

Constructor & Destructor Documentation

KKB::BmpImage::PalletBuilder::PalletBuilder ( )
inline

Definition at line 1087 of file BMPImage.cpp.

1088  {
1089  lastColorsSet = false;
1090  }

Member Function Documentation

void KKB::BmpImage::PalletBuilder::AddColor ( uchar  red,
uchar  green,
uchar  blue 
)
inline

Definition at line 1111 of file BMPImage.cpp.

1115  {
1116  if (lastColorsSet && (red == lastRed) && (green == lastGreen) && (blue == lastBlue))
1117  return;
1118 
1119  RGBQUAD key;
1120  key.rgbRed = red;
1121  key.rgbGreen = green;
1122  key.rgbBlue = blue;
1123  idx = colorsUsed.find (key);
1124  if (idx == colorsUsed.end ())
1125  {
1126  kkint32 numEntries = (kkint32)colorsUsed.size ();
1127  colorsUsed.insert (pair<RGBQUAD,kkint32> (key, numEntries));
1128  }
1129 
1130  lastRed = red; lastGreen = green; lastBlue = blue;
1131  lastColorsSet = true;
1132  }
__int32 kkint32
Definition: KKBaseTypes.h:88
void KKB::BmpImage::PalletBuilder::BuildPallet ( RGBQUAD *&  palette,
kkint32 size 
)
inline

Definition at line 1135 of file BMPImage.cpp.

1138  {
1139  size = (kkint32)colorsUsed.size ();
1140  delete palette; palette = NULL;
1141  if (size < 1)
1142  return;
1143 
1144  palette = new RGBQUAD[size];
1145  for (idx = colorsUsed.begin (); idx != colorsUsed.end (); idx++)
1146  {
1147  palette[idx->second] = idx->first;
1148  }
1149  }
__int32 kkint32
Definition: KKBaseTypes.h:88
kkint32 KKB::BmpImage::PalletBuilder::NumOfColors ( ) const
inline

Definition at line 1092 of file BMPImage.cpp.

1092 {return (kkint32)colorsUsed.size ();}
__int32 kkint32
Definition: KKBaseTypes.h:88
kkint32 KKB::BmpImage::PalletBuilder::PalletIndex ( uchar  red,
uchar  green,
uchar  blue 
)
inline

Definition at line 1094 of file BMPImage.cpp.

1098  {
1099  RGBQUAD key;
1100  key.rgbRed = red;
1101  key.rgbGreen = green;
1102  key.rgbBlue = blue;
1103  idx = colorsUsed.find (key);
1104  if (idx == colorsUsed.end ())
1105  return -1;
1106  else
1107  return idx->second;
1108  }

The documentation for this class was generated from the following file: