#include #include #include #include #include #include "ppmwrite.h" /* * ColorTable */ char ColorTable::operator()(int i, base b) const { return tab[i].c[b]; } ColorTable::~ColorTable() { TAU_PROFILE("ColorTable::~ColorTable()", "void ()", TAU_DEFAULT); delete [] tab; } int ColorTable::numColors() const { TAU_PROFILE("ColorTable::numColors()", "int (void)", TAU_DEFAULT); return num; } int ColorTable::shades() const { TAU_PROFILE("ColorTable::shades()", "int (void)", TAU_DEFAULT); return sds; } ColorTable::ColorTable(int shades, int numColors) : sds(shades), num(numColors) { TAU_PROFILE("ColorTable::ColorTable()", "void (int, int)", TAU_DEFAULT); tab = new Color[num]; } /* * PermutationColorTable */ PermutationColorTable:: PermutationColorTable(int shades, direction d, base b1, base b2, base b3) : ColorTable(shades, shades*shades*shades) { TAU_PROFILE("PermutationColorTable::PermutationColorTable()", "void (int, direction, base, base, base)", TAU_DEFAULT); int count = d==fwd ? 0 : numColors()-1; for (int ix=0; ix= buflen ) { write(out, buf, buflen); b = 0; } } } else { idx = int (idx / factor); for (int iz=0; iz<3; ++iz) { buf[b++] = table(idx, base(iz)); if ( b >= buflen ) { write(out, buf, buflen); b = 0; } } } } } write(out, buf, b); close(out); printf("%d total iterations\n", total); }