- pal[3 * hnode->index] = (unsigned char)(key >> 16);
- pal[3 * hnode->index + 1] = (unsigned char)(key >> 8);
- pal[3 * hnode->index + 2] = (unsigned char)(key);
- delete hnode;
+ for (wxImageHistogram::iterator entry = histogram.begin();
+ entry != histogram.end(); entry++ )
+ {
+ key = entry->first;
+ index = entry->second.index;
+ pal[3 * index] = (unsigned char)(key >> 16);
+ pal[3 * index + 1] = (unsigned char)(key >> 8);
+ pal[3 * index + 2] = (unsigned char)(key);