read GIMP color palette file
int ocu_read_GIMP_palette( LPCSTR lpcszFilename, int * pR, int * pG, int * pB, int nBuffSize )
EX1
#define CE_MAX_COLORS 256 #define CE_MIN_COLORS 2 void read_palette(string strFileName = "d:\Spectral_11.gpl") { int nR[CE_MAX_COLORS], nG[CE_MAX_COLORS], nB[CE_MAX_COLORS]; int nColors = ocu_read_GIMP_palette(strFileName, nR, nG, nB, CE_MAX_COLORS); if( CE_MIN_COLORS <= nColors && nColors <= CE_MAX_COLORS ) { Worksheet wks = Project.ActiveLayer(); wks.SetSize(-1, 3); Dataset dsR, dsG, dsB; dsR.Attach(wks, 0); dsR.SetSize(nColors); dsG.Attach(wks, 1); dsG.SetSize(nColors); dsB.Attach(wks, 2); dsB.SetSize(nColors); for( int i = 0; i < nColors; i++ ) { dsR[i] = nR[i]; dsG[i] = nG[i]; dsB[i] = nB[i]; } } }
ocu.h