13 #include "win_theme.h"
14 #include "win_background.h"
16 win_background::win_background()
22 set_visible_background(
false);
24 set_brightness_background(
false);
26 set_trans_background(
true);
30 win_background::win_background(
win_base * wb)
36 set_visible_background(
false);
38 set_brightness_background(
false);
40 set_trans_background(
true);
44 win_background::win_background(
char *rep)
50 set_visible_background(
false);
52 set_brightness_background(
false);
54 set_trans_background(
true);
56 win_background::load(rep);
68 set_visible_background(
false);
70 set_brightness_background(
false);
72 set_trans_background(
true);
80 win_background::~win_background()
86 void win_background::destroy()
88 if(background_template_)
delete background_template_;
89 if(background_)
delete background_;
90 if(background_brightness_)
delete background_brightness_;
95 void win_background::init()
97 background_template_=NULL;
99 background_brightness_=NULL;
100 background_draw_=NULL;
107 background_template_=
new image();
108 *background_template_=*(wb.background_template_);
109 background_=
new image();
111 background_brightness_=
new image();
112 background_brightness_->
set_mask(
true);
127 void win_background::set_background(
win_theme & wt)
129 *
this=*(wt.background);
133 void win_background::set_brightness_background(
bool b)
139 void win_background::refresh()
141 background_draw_=(brightness_)? background_brightness_ : background_ ;
144 void win_background::load(
char *rep)
148 strcpy(path,WIN_DIRECTORY);
149 strcat(path,WIN_BACKGROUND_DIRECTORY);
151 strcat(path,WIN_BACKGROUND_FILE);
152 background_template_=
new image();
153 background_template_->
load_pnm(path);
155 background_=
new image();
158 background_brightness_=
new image();
159 background_brightness_->
set_mask(
true);
163 void win_background::update()
165 if(!background_template_) return ;
168 background_->
tile(*background_template_);
169 background_brightness_->
brightness(*background_,WIN_BRIGHTNESS_LEVEL);
175 if(!visible_ || !background_draw_ || !wb_)
return;
180 void win_background::set_trans_background(
bool b)
182 if(!background_template_)
return;
u_int16 height() const
Returns the height of the drawing_area.
s_int16 real_y() const
Return the vertical position of the win_*.
void resize(u_int16 l, u_int16 h)
Resize this image.
s_int16 real_x() const
Return the horizontal position of the win_*.
Image manipulation class.
void tile(const surface &src)
Tiles a surface.
u_int16 length() const
Returns the length of the drawing_area.
void draw(s_int16 x, s_int16 y, const drawing_area *da_opt=NULL, surface *target=NULL) const
Draw the surface.
Implements "drawing zones" for drawing operations.
void set_alpha(u_int8 a)
Sets the alpha value of the surface.
A* pathfinding algorithm implementation class.
void brightness(const surface &src, u_int8 cont, bool proceed_mask=false)
Applies a "brightness" to a surface.
s_int8 load_pnm(string fname)
Loads an image from a file name, in PNM format, without alpha and mask values.
Common properties for each win_base's object.
void set_mask(bool m)
Sets the mask parameter of the surface.