00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef PALETTE_H
00020 #define PALETTE_H
00021
00022 class Image_window8;
00023
00024
00025
00026
00027 const int PALETTE_DAY = 0;
00028 const int PALETTE_DUSK = 1;
00029 const int PALETTE_DAWN = 1;
00030 const int PALETTE_NIGHT = 2;
00031 const int PALETTE_INVISIBLE = 3;
00032
00033 const int PALETTE_HAZE = 5;
00034
00035
00036 const int PALETTE_RED = 8;
00037
00038 const int PALETTE_LIGHTNING = 10;
00039
00040
00041
00042 class Palette
00043 {
00044 Image_window8 *win;
00045 unsigned char pal1[768];
00046 unsigned char pal2[768];
00047 int brightness;
00048 int max_val;
00049 int palette;
00050 bool faded_out;
00051 bool fades_enabled;
00052
00053 public:
00054 Palette();
00055 ~Palette();
00056
00057 void fade(int cycles, int inout, int pal_num = -1);
00058 bool is_faded_out()
00059 { return faded_out; }
00060 void flash_red();
00061
00062 void set(int pal_num, int new_brightness = -1,
00063 bool repaint=true);
00064 int get_brightness()
00065 { return brightness; }
00066
00067 void set_fades_enabled(bool f) { fades_enabled = f; }
00068 bool get_fades_enabled() const { return fades_enabled; }
00069
00070 void apply(bool repaint=true);
00071 void load(const char *fname, int index,
00072 const char *xfname = 0, int xindex = -1);
00073 void set_brightness(int bright);
00074 void set_max_val(int max);
00075 int get_max_val();
00076 void fade_in(int cycles);
00077 void fade_out(int cycles);
00078 int find_color(int r, int g, int b);
00079 void create_trans_table(unsigned char br, unsigned bg,
00080 unsigned bb, int alpha, unsigned char *table);
00081 void show();
00082
00083 void set_color(int nr, int r, int g, int b);
00084 unsigned char get_red(int nr) { return pal1[3*nr]; }
00085 unsigned char get_green(int nr) { return pal1[3*nr + 1]; }
00086 unsigned char get_blue(int nr) { return pal1[3*nr + 2]; }
00087 void set_palette (unsigned char palnew[768]);
00088 };
00089
00090
00091 #endif