-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathPalette.H
91 lines (77 loc) · 2.92 KB
/
Palette.H
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
// -------------------------------------------------------------------
// Palette.H
// -------------------------------------------------------------------
#ifndef _PALETTE_H
#define _PALETTE_H
#include "REAL.H"
#include "aString.H"
#include "Array.H"
const int PALLISTLENGTH = 8;
const int PALWIDTH = 24;
const int TEXTCOLOR = 224;
const int TOTALPALHEIGHT = 280;
const int TOTALPALWIDTH = 150;
#include <Intrinsic.h>
#include <StringDefs.h>
extern "C" {
int close(int);
}
class Palette {
protected:
Array<XColor> ccells;
Pixmap palPixmap;
int totalPalWidth, palWidth, totalPalHeight;
Array<Real> dataList;
Window palWindow;
Colormap colmap;
int totalColorSlots, colorSlots;
int reserveSystemColors, colorOffset, paletteStart;
int blackIndex, whiteIndex;
Real pmin, pmax;
aString defaultFormat;
int transSet;
Array<float> transY; // float for compaitbility with volpack
unsigned char *remapTable; // for remapping to a smaller color index set
Display *display;
Visual *visual;
Screen *screen;
XVisualInfo visualInfo;
GC gc;
Window root;
int screenNumber;
Array<XColor> sysccells;
static Colormap systemColmap;
public:
Palette(Widget &w, int datalistlength, int width,
int totalwidth, int totalheight, int reservesystemcolors);
~Palette();
int ReadSeqPalette(const aString &fileName);
void Draw(Real palMin, Real palMax, const aString &numberFormat);
void SetWindow(Window drawPaletteHere);
void SetWindowPalette(const aString &palName, Window newPalWindow);
void ChangeWindowPalette(const aString &palName, Window newPalWindow);
void ExposePalette();
void Redraw();
void SetReserveSystemColors(int reservesystemcolors);
void SetFormat(const aString &newFormat);
void SetTransfers(const Array<int> &transx, const Array<float> &transy);
Colormap GetColormap() const { return colmap; }
const Array<XColor> &GetColorCells() const { return ccells; }
int BlackIndex() const { return blackIndex; }
int WhiteIndex() const { return whiteIndex; }
int ColorSlots() const { return colorSlots; }
int PaletteStart() const { return paletteStart; }
int PaletteEnd() const { return totalColorSlots - 1; }
int PaletteSize() const { return totalColorSlots; }
int PaletteWidth() const { return totalPalWidth; }
int PaletteHeight() const { return totalPalHeight; }
Real PaletteMin() const { return pmin; }
Real PaletteMax() const { return pmax; }
const Array<Real> &PaletteDataList() const { return dataList; }
aString PaletteNumberFormat() { return defaultFormat; }
XImage *GetPictureXImage();
unsigned char *RemapTable() const { return remapTable; }
private:
Palette(Widget &w);
};
#endif