// Copyright (C) 1999-2018 // Smithsonian Astrophysical Observatory, Cambridge, MA, USA // For conditions of distribution and use, see copyright notice in "copyright" #include "colorscale.h" ColorScale::ColorScale(int ss) { size_ = ss; psColors_ = new unsigned char[ss*3]; memset(psColors_, '0', size_*3); } ColorScale::~ColorScale() { if (psColors_) delete [] psColors_; } LinearScale::LinearScale(int ss, unsigned char* colorCells, int count) : ColorScale(ss) { for (int ii=0; ii=count) ll = count-1; memcpy(psColors_+ii*3, colorCells+ll*3, 3); } } PowScale::PowScale(int ss, unsigned char* colorCells, int count, double exp) : ColorScale(ss) { for (int ii=0; ii=count) ll = count-1; memcpy(psColors_+ii*3, colorCells+ll*3, 3); } } SqrtScale::SqrtScale(int ss, unsigned char* colorCells, int count) : ColorScale(ss) { for(int ii=0; ii=count) ll = count-1; memcpy(psColors_+ii*3, colorCells+ll*3,3); } } SinhScale::SinhScale(int ss, unsigned char* colorCells, int count) : ColorScale(ss) { for(int ii=0; ii=count) ll = count-1; memcpy(psColors_+ii*3, colorCells+ll*3,3); } } HistEquScale::HistEquScale(int ss, unsigned char* colorCells, int count, double* hist, int histsize) : ColorScale(ss) { // if no histogram, return linear distribution if (!hist) for (int ii=0; ii