17 #define GETTEXT_DOMAIN "wesnoth-lib"
37 normal_rgb_(0x000000), selected_rgb_(0x000099),
38 normal_alpha_(0.2), selected_alpha_(0.6)
44 int normal_rgb,
int selected_rgb,
45 double normal_alpha,
double selected_alpha)
46 : img_base_(img_base), has_background_(has_bg), initialized_(false), load_failed_(false),
47 normal_rgb2_(normal_rgb), selected_rgb2_(selected_rgb),
48 normal_alpha2_(normal_alpha), selected_alpha2_(selected_alpha)
59 std::string
path = img_base_ +
"-" + img_sub +
".png";
61 img_map_[img_sub] =
image;
70 if( load_image(
"border-botleft")
71 && load_image(
"border-botright")
72 && load_image(
"border-topleft")
73 && load_image(
"border-topright")
74 && load_image(
"border-left")
75 && load_image(
"border-right")
76 && load_image(
"border-top")
77 && load_image(
"border-bottom") )
79 thickness_ = std::min(
80 img_map_[
"border-top"].
h(),
81 img_map_[
"border-left"].
w());
84 if(has_background_ && !load_image(
"background"))
90 normal_rgb_ = normal_rgb2_;
91 normal_alpha_ = normal_alpha2_;
92 selected_rgb_ = selected_rgb2_;
93 selected_alpha_ = selected_alpha2_;
106 return (!load_failed_);
138 image = img_map_[
"border-top"];
146 }
while( area.x <
rect.x +
rect.w );
148 image = img_map_[
"border-left"];
156 }
while( area.y <
rect.y +
rect.h );
158 image = img_map_[
"border-right"];
159 area.x =
rect.x +
rect.w - thickness_;
166 }
while( area.y <
rect.y +
rect.h );
168 image = img_map_[
"border-bottom"];
170 area.y =
rect.y +
rect.h - thickness_;
176 }
while( area.x <
rect.x +
rect.w );
178 image = img_map_[
"border-topleft"];
185 image = img_map_[
"border-topright"];
192 image = img_map_[
"border-botleft"];
199 image = img_map_[
"border-botright"];
217 bounds.w += 2 * thickness_;
218 bounds.h += 2 * thickness_ + 4;
Wrapper class to encapsulate creation and management of an SDL_Texture.
Drawing functions, for drawing things on the screen.
clip_setter reduce_clip(const SDL_Rect &clip)
Set the clipping area to the intersection of the current clipping area and the given rectangle.
void blit(const texture &tex, const SDL_Rect &dst)
Draws a texture, or part of a texture, at the given location.
Collection of helper functions relating to Pango formatting.
Functions to load and save images from/to disk.
texture get_texture(const image::locator &i_locator, TYPE type, bool skip_cache)
Returns an image texture suitable for hardware-accelerated rendering.
An abstract description of a rectangle with integer coordinates.