CPalette * PaletteFromMapFile(const char * filename) { FILE * fh = fopen(filename, "rt"); if (! fh) return 0; CPalette * p = PaletteLinear(false); uint i; for (i=0; i<257 && !feof(fh); i++) { char line[256]; uint r,g,b; fgets(line, sizeof(line)-1, fh); if (sscanf(line, "%u %u %u", &r,&g,&b) != 3) { delete p; p=0; break; } p->Add(i/256., r/255., g/255., b/255.); } fclose(fh); return p; }
CPalette * PaletteLinear(COLORREF c) { CPalette * p = PaletteLinear(false); p->Add(0.5, GetRValue(c)/255., GetGValue(c)/255., GetBValue(c)/255.); return p; }
CPalette * PaletteSimple(COLORREF c1, COLORREF c2) { CPalette * p = PaletteLinear(false); p->Add(0.0, GetRValue(c1)/255., GetGValue(c1)/255., GetBValue(c1)/255.); p->Add(1.0, GetRValue(c2)/255., GetGValue(c2)/255., GetBValue(c2)/255.); return p; }
CPalette * CFractalLyapunov::DefaultPalette(bool in) { CPalette * p; if (in) { p = PaletteSingle(0x1B1C1F); } else { p = PaletteLinear(false); p->Add(0.00, HEXRGB(0x191400)); p->Add(1.00, HEXRGB(0xFFE119)); //0xFFD40A)); } return p; }