summaryrefslogtreecommitdiffstats
path: root/tksao/frame/colorscaletrue8.C
blob: 5233747abc7a28daa4fd97bd04286dd05f0d53d5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
// Copyright (C) 1999-2017
// Smithsonian Astrophysical Observatory, Cambridge, MA, USA
// For conditions of distribution and use, see copyright notice in "copyright"

#include "colorscaletrue8.h"

ColorScaleTrueColor8::ColorScaleTrueColor8(int s, Visual* visual)
  : ColorScale(s), TrueColor8(visual)
{
  colors_ = new unsigned char[s];

  for (int i=0; i<s; i++)
    colors_[i] =
      ((psColors_[i*3]   & bm_) >> bs_) |  // blue
      ((psColors_[i*3+1] & gm_) >> gs_) |  // green
      ((psColors_[i*3+2] & rm_) >> rs_);   // red
}

ColorScaleTrueColor8::~ColorScaleTrueColor8()
{
  if (colors_)
    delete [] colors_;
}

LinearScaleTrueColor8::LinearScaleTrueColor8(int s, 
					     unsigned char* colorCells,
					     int count,
					     Visual* visual)
  : ColorScale(s),
    LinearScale(s, colorCells, count), 
    ColorScaleTrueColor8(s, visual)
{}

LogScaleTrueColor8::LogScaleTrueColor8(int s,
				       unsigned char* colorCells,
				       int count, double exp,
				       Visual* visual)
  : ColorScale(s),
    LogScale(s, colorCells, count, exp), 
    ColorScaleTrueColor8(s, visual)
{}


PowScaleTrueColor8::PowScaleTrueColor8(int s,
				       unsigned char* colorCells,
				       int count, double exp,
				       Visual* visual)
  : ColorScale(s),
    PowScale(s, colorCells, count, exp), 
    ColorScaleTrueColor8(s, visual)
{}

SqrtScaleTrueColor8::SqrtScaleTrueColor8(int s,
					 unsigned char* colorCells,
					 int count,
					 Visual* visual)
  : ColorScale(s),
    SqrtScale(s, colorCells, count), 
    ColorScaleTrueColor8(s, visual)
{}

SquaredScaleTrueColor8::SquaredScaleTrueColor8(int s,
					       unsigned char* colorCells,
					       int count,
					       Visual* visual)
  : ColorScale(s),
    SquaredScale(s, colorCells, count), 
    ColorScaleTrueColor8(s, visual)
{}

AsinhScaleTrueColor8::AsinhScaleTrueColor8(int s,
					   unsigned char* colorCells,
					   int count,
					   Visual* visual)
  : ColorScale(s),
    AsinhScale(s, colorCells, count), 
    ColorScaleTrueColor8(s, visual)
{}

SinhScaleTrueColor8::SinhScaleTrueColor8(int s,
					 unsigned char* colorCells,
					 int count,
					 Visual* visual)
  : ColorScale(s),
    SinhScale(s, colorCells, count), 
    ColorScaleTrueColor8(s, visual)
{}

IISScaleTrueColor8::IISScaleTrueColor8(unsigned char* colorCells,
				       int count,
				       Visual* visual)
  : ColorScale(IISSIZE),
    IISScale(colorCells, count), 
    ColorScaleTrueColor8(IISSIZE, visual)
{}

HistEquScaleTrueColor8::HistEquScaleTrueColor8(int s, 
					       unsigned char* colorCells,
					       int count,
					       double* hist, int histsize,
					       Visual* visual)
  : ColorScale(s),
    HistEquScale(s, colorCells, count, hist, histsize), 
    ColorScaleTrueColor8(s, visual)
{}