The Battle for Wesnoth  1.19.15+dev
Public Member Functions | Private Types | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
gui2::image_shape Class Reference

#include <canvas_private.hpp>

Inheritance diagram for gui2::image_shape:

Public Member Functions

 image_shape (const config &cfg, wfl::action_function_symbol_table &functions)
 Constructor. More...
 
void draw (wfl::map_formula_callable &variables) override
 Draws the canvas. More...
 
- Public Member Functions inherited from gui2::canvas::shape
 shape (const config &cfg)
 
virtual ~shape ()
 
bool immutable () const
 

Private Types

enum class  resize_mode {
  scale , scale_sharp , stretch , tile ,
  tile_center , tile_highres
}
 Determines the way an image will be resized. More...
 

Private Member Functions

resize_mode get_resize_mode (const std::string &resize_mode)
 Converts a string to a resize mode. More...
 

Static Private Member Functions

static void dimension_validation (unsigned value, const std::string &name, const std::string &key)
 

Private Attributes

typed_formula< unsigned > x_
 The x coordinate of the image. More...
 
typed_formula< unsigned > y_
 The y coordinate of the image. More...
 
typed_formula< unsigned > w_
 The width of the image. More...
 
typed_formula< unsigned > h_
 The height of the image. More...
 
typed_formula< std::string > image_name_
 String to pass to the image loader. More...
 
resize_mode resize_mode_
 The resize mode for an image. More...
 
typed_formula< bool > mirror_
 Mirror the image over the vertical axis. More...
 
wfl::formula actions_formula_
 
bool failure_logged_
 Prevents duplicate error logs when an image can't be loaded. More...
 

Detailed Description

Definition at line 179 of file canvas_private.hpp.

Member Enumeration Documentation

◆ resize_mode

enum gui2::image_shape::resize_mode
strongprivate

Determines the way an image will be resized.

If the image is smaller is needed it needs to resized, how is determined by the value of this enum.

Enumerator
scale 
scale_sharp 
stretch 
tile 
tile_center 
tile_highres 

Definition at line 207 of file canvas_private.hpp.

Constructor & Destructor Documentation

◆ image_shape()

gui2::image_shape::image_shape ( const config cfg,
wfl::action_function_symbol_table functions 
)

Constructor.

Parameters
cfgThe config object to define the image.
functionsWFL functions to execute.

Definition at line 237 of file canvas.cpp.

References cfg, DBG_GUI_P, and debug.

Member Function Documentation

◆ dimension_validation()

void gui2::image_shape::dimension_validation ( unsigned  value,
const std::string &  name,
const std::string &  key 
)
staticprivate

Definition at line 255 of file canvas.cpp.

References _(), and VALIDATE_WITH_DEV_MESSAGE.

Referenced by draw().

◆ draw()

void gui2::image_shape::draw ( wfl::map_formula_callable variables)
overridevirtual

◆ get_resize_mode()

image_shape::resize_mode gui2::image_shape::get_resize_mode ( const std::string &  resize_mode)
private

Converts a string to a resize mode.

Definition at line 366 of file canvas.cpp.

References ERR_GUI_E, scale, scale_sharp, stretch, tile, tile_center, and tile_highres.

Member Data Documentation

◆ actions_formula_

wfl::formula gui2::image_shape::actions_formula_
private

Definition at line 226 of file canvas_private.hpp.

Referenced by draw().

◆ failure_logged_

bool gui2::image_shape::failure_logged_
private

Prevents duplicate error logs when an image can't be loaded.

Definition at line 231 of file canvas_private.hpp.

Referenced by draw().

◆ h_

typed_formula<unsigned> gui2::image_shape::h_
private

The height of the image.

Definition at line 196 of file canvas_private.hpp.

Referenced by draw().

◆ image_name_

typed_formula<std::string> gui2::image_shape::image_name_
private

String to pass to the image loader.

May be a Data URI, may include Image Path Functions.

Definition at line 199 of file canvas_private.hpp.

Referenced by draw().

◆ mirror_

typed_formula<bool> gui2::image_shape::mirror_
private

Mirror the image over the vertical axis.

Definition at line 223 of file canvas_private.hpp.

Referenced by draw().

◆ resize_mode_

resize_mode gui2::image_shape::resize_mode_
private

The resize mode for an image.

Definition at line 220 of file canvas_private.hpp.

Referenced by draw().

◆ w_

typed_formula<unsigned> gui2::image_shape::w_
private

The width of the image.

Definition at line 195 of file canvas_private.hpp.

Referenced by draw().

◆ x_

typed_formula<unsigned> gui2::image_shape::x_
private

The x coordinate of the image.

Definition at line 193 of file canvas_private.hpp.

Referenced by draw().

◆ y_

typed_formula<unsigned> gui2::image_shape::y_
private

The y coordinate of the image.

Definition at line 194 of file canvas_private.hpp.

Referenced by draw().


The documentation for this class was generated from the following files: