summaryrefslogtreecommitdiffstats
path: root/tksao/frame/frame.h
blob: 68fdb480d5fc6f6d93d376075173d69944a5e8c5 (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
109
110
111
112
113
114
// Copyright (C) 1999-2018
// Smithsonian Astrophysical Observatory, Cambridge, MA, USA
// For conditions of distribution and use, see copyright notice in "copyright"

#ifndef __frame_h__
#define __frame_h__

#include "framebase.h"
#include "context.h"
#include "fitsmask.h"
#include "colorscale.h"

// Frame

class Frame : public FrameBase {
 protected:
  int cmapID;                // current colormap id
  float bias;                // current colormap bias
  float contrast;            // current colormap contrast

  long* colormapData;

  int colorCount;            // number of dynamic colors
  ColorScale* colorScale;    // current color scale
  unsigned char* colorCells; // current color values

  List <FitsMask> mask;

  char* maskColorName;
  float maskAlpha;
  int maskMark;
  Coord::CoordSystem maskSystem;

 private:
  unsigned char* blend(unsigned char*, unsigned char*, int, int);
  int isIIS();
  void pushMatrices();
  void pushMagnifierMatrices();
  void pushPannerMatrices();
  void pushPSMatrices(float, int, int);
  void reset();
  void setKeyFits() {}
  void unloadFits();

 protected:
  void alignWCS();
  int isFrame() {return 1;}

  unsigned char* fillImage(int width, int height, Coord::InternalSystem);
  unsigned char* fillMask(FitsMask*, int, int,  Coord::InternalSystem);
  int validColorScale() {return colorScale ? 1 : 0;}
  void updateColorCells(unsigned char*, int);
  void updateMaskMatrices();
  void loadDone(int);

 public:
  Frame(Tcl_Interp*, Tk_Canvas, Tk_Item*);
  virtual ~Frame();

  void maskClearCmd();

  void getMaskColorCmd();
  void getMaskMarkCmd();
  void getMaskSystemCmd();
  void getMaskTransparencyCmd();

  void maskColorCmd(const char*);
  void maskMarkCmd(int mm) {maskMark=mm;}
  void maskSystemCmd(Coord::CoordSystem);
  void maskTransparencyCmd(float);

  void colormapCmd(int, float, float, int, unsigned char*, int);
  void colormapBeginCmd();
  void colormapMotionCmd(int, float, float, int, unsigned char*, int);
  void colormapEndCmd();

  void getColorbarCmd();
  void getRGBChannelCmd();
  void getRGBViewCmd();
  void getRGBSystemCmd();
  void getTypeCmd();

  void iisCmd(int, int);
  void iisEraseCmd();
  void iisGetCmd(char*, int, int, int, int);
  void iisSetCmd(const char*, int, int, int, int);
  void iisWCSCmd(const Matrix&, const Vector&, int);

  void savePhotoCmd(const char*);

  void loadFitsAllocCmd(const char*, const char*, LayerType);
  void loadFitsAllocGZCmd(const char*, const char*, LayerType);
  void loadFitsChannelCmd(const char*, const char*, LayerType);
  void loadFitsMMapCmd(const char*, LayerType);
  void loadFitsSMMapCmd(const char*, const char*, LayerType);
  void loadFitsMMapIncrCmd(const char*, LayerType);
  void loadFitsShareCmd(ShmType, int, const char*, LayerType);
  void loadFitsSShareCmd(ShmType, int, int, const char*, LayerType);
  void loadFitsSocketCmd(int, const char*, LayerType);
  void loadFitsSocketGZCmd(int, const char*, LayerType);
  void loadFitsVarCmd(const char*, const char*, LayerType);

  void loadArrAllocCmd(const char*, const char*, LayerType);
  void loadArrAllocGZCmd(const char*, const char*, LayerType);
  void loadArrChannelCmd(const char*, const char*, LayerType);
  void loadArrMMapCmd(const char*, LayerType);
  void loadArrMMapIncrCmd(const char*, LayerType);
  void loadArrShareCmd(ShmType, int, const char*, LayerType);
  void loadArrSocketCmd(int, const char*, LayerType);
  void loadArrSocketGZCmd(int, const char*, LayerType);
  void loadArrVarCmd(const char*, const char*, LayerType);
};

#endif