#include "wesmage/filter.hpp"
#include "serialization/string_utils.hpp"
#include "wesmage/exit.hpp"
#include "utils/functional.hpp"
#include <iostream>
Go to the source code of this file.
Classes | |
struct | tfilter |
Contains the definition of a filter. More... | |
struct | tregister_filter |
Helper structure to register a filter to the filters. More... | |
Macros | |
#define | REGISTER(name, description) |
Register macro for a filter. More... | |
Functions | |
static void | scale (surface &surf, const std::string ¶meters) |
REGISTER (scale,"|Scales the size of an image.""|new_width""|unsigned""|The width in pixel of the image after scaling.""|new_height""|unsigned""|The height in pixel of the image after scaling.") static void brighten(surface &surf | |
if (count!=1) | |
REGISTER (brighten,"|Brightens an image.""|amount""|float""|The amount the image should be brightened. The value of the every ""color channel is multiplied by this value. Value less than zero ""are set to zero. The alpha channel is not modified.") static void blend(surface &surf | |
REGISTER (blend,"|Blends an image with another color.""|amount""|float""|The amount every pixel needs to be blended with its original value. ""The formula is:\n""result = amount * color + (1 - amount) * original\n""The value needs to be in the range [0, 1].""|color""|unsigned""|The color to blend with. The value should be given as 32-bit ""hexadecimal value. The first fields should look like AARRGGBB, ""where AA is the alpha channel, RR is the red channel, GG is the ""green channel and BB is the blue channel. (Note the alpha channel ""is ignored.") void filter_apply(surface &surf | |
if (f.size()!=2) | |
if (itor==filters.end()) | |
itor second | functor (surf, f[1]) |
std::vector< tfilter_description > | filter_list () |
Returns the list of available filters. More... | |
Variables | |
static std::map< std::string, tfilter > | filters |
The list of the available filters. More... | |
const std::string ¶meters float | amount |
const int | count = sscanf(parameters.c_str(), "%f", &amount) |
surf = brighten_image(surf, amount) | |
const std::string & | parameters |
unsigned | color |
const std::string & | filter |
std::map< std::string, tfilter > ::iterator | itor = filters.find(f[0]) |
#define REGISTER | ( | name, | |
description | |||
) |
Register macro for a filter.
name | The name of the filter. |
description | A pipe-symbol separated list with the description. The name is automatically prefixed, so the item should start with a pipe-symbol. When the list is splitted in to a vector of string its contents should be compatible with the constructor of tfilter_description. |
Definition at line 100 of file filter.cpp.
std::vector<tfilter_description> filter_list | ( | ) |
Returns the list of available filters.
Definition at line 239 of file filter.cpp.
Referenced by print_help().
Referenced by blend_image(), gui2::event::implementation::fire_event(), gui2::event::fire_event(), gui2::event::fire_event_double_click(), gui2::event::ttrigger::operator()(), gui2::event::ttrigger_mouse::operator()(), gui2::event::ttrigger_keyboard::operator()(), gui2::event::ttrigger_notification::operator()(), gui2::event::ttrigger_message::operator()(), gui2::register_builder_widget(), and gui2::register_widget().
if | ( | count! | = 1 | ) |
Definition at line 135 of file filter.cpp.
if | ( | f.size()! | = 2 | ) |
Definition at line 191 of file filter.cpp.
if | ( | itor | = = filters.end() | ) |
Definition at line 201 of file filter.cpp.
REGISTER | ( | scale | , |
"|Scales the size of an image.""|new_width""|unsigned""|The width in pixel of the image after scaling.""|new_height""|unsigned""|The height in pixel of the image after scaling." | |||
) |
REGISTER | ( | brighten | , |
"|Brightens an image.""|amount""|float""|The amount the image should be brightened. The value of the every ""color channel is multiplied by this value. Value less than zero ""are set to zero. The alpha channel is not modified." | |||
) |
REGISTER | ( | blend | , |
"|Blends an image with another color.""|amount""|float""|The amount every pixel needs to be blended with its original value. ""The formula is:\n"" | result = amount * color + (1 - amount) * original\n" "The value needs to be in the range [0 , |
||
1]." "|color" "|unsigned" "|The color to blend with.The value should be given as 32-bit" "hexadecimal value.The first fields should look like | AARRGGBB, | ||
" "where AA is the alpha | channel, | ||
RR is the red | channel | ||
) |
|
static |
Definition at line 106 of file filter.cpp.
References scale_surface().
const std::string& parameters float amount |
Definition at line 132 of file filter.cpp.
Referenced by help::help_text_area::handle_jump_cfg(), unit::heal(), game_lua_kernel::intf_heal_unit(), editor::editor_controller::quit_confirm(), team::set_countdown_time(), team::set_gold(), team::set_start_gold(), display::set_zoom(), image::set_zoom(), team::spend_gold(), and submerge_alpha().
unsigned color |
Definition at line 157 of file filter.cpp.
Definition at line 133 of file filter.cpp.
const std::string& filter |
Definition at line 188 of file filter.cpp.
|
static |
The list of the available filters.
The map contains:
first
The name of the filter.second
The filter itself. Definition at line 77 of file filter.cpp.
Referenced by game_events::t_pump::filter_event().
std::map<std::string, tfilter>::iterator itor = filters.find(f[0]) |
Definition at line 199 of file filter.cpp.
Referenced by scoped_xy_unit::activate(), game_data::activate_scope_variable(), halo::halo_impl::add(), network::add_bandwidth_in(), network::add_bandwidth_out(), gui2::ttree_view_node::add_child(), editor::location_palette::add_item(), halo::halo_impl::effect::add_overlay_location(), gui::textbox::add_text_line(), gui::scrollpane::add_widget(), simple_wml::node::apply_diff(), config::apply_diff(), ai::readonly_context_impl::best_defensive_position(), gui2::implementation::tbuilder_instance::build(), terrain_builder::build_terrains(), gui2::ttree_view_node::calculate_best_size(), unit_drawer::calculate_energy_bar(), config::clear_diff_track(), unit::clear_status_caches(), composer::compose(), gui2::event::thandler::disconnect(), gui2::tnotifier< tfunctor >::disconnect_notifiee(), gui2::event::tdispatcher::tsignal_queue< tsignal_function >::disconnect_signal(), ai::ai_default_rca::get_villages_phase::dispatch_complex(), ai::ai_default_rca::get_villages_phase::dispatch_unit_simple(), ai::ai_default_rca::get_villages_phase::dispatch_village_simple(), ai::ai_default_rca::aspect_attacks_base::do_attack_analysis(), gui2::tcanvas::draw(), gui2::twindow::draw(), mp::wait::leader_preview_pane::draw_contents(), ai::ai_default_rca::get_villages_phase::dump_reachmap(), gui::textbox::erase_selection(), ai::ai_default_rca::leader_shares_keep_phase::execute(), gui2::event::tdispatcher::execute_hotkey(), wb::side_actions::execute_net_cmd(), gui2::execute_timer(), unit_animation::fill_initial_animations(), gui::menu::fill_items(), unit_type_data::find(), campaignd::server::fire(), gui2::event::implementation::fire_event(), ai::ai_default_rca::get_villages_phase::full_dispatch(), cave_map_generator::cave_map_generator_job::generate_chambers(), filesystem::get_binary_paths(), gui2::get_control(), gui2::ttree_view_node::get_current_size(), font::ttext::get_cursor_position(), config::get_diff(), tod_manager::get_illuminated_time_of_day(), gui2::tminimap::get_image(), map_labels::get_label(), network_worker_pool::get_received_data(), gamemap::get_terrain(), wb::side_actions::get_turn_num_of(), gui2::ttree_view_node::get_unfolded_size(), wb::suppose_dead::get_unit(), wb::move::get_unit(), utils::string_map_variable_set::get_variable_const(), ai::ai_default_rca::get_villages_phase::get_villages(), gui2::get_window_builder(), gui::drop_target::handle_drop(), handle_preprocess_command(), t_translation::has_wildcard(), gui::scrollpane::hide(), gui2::policy::select_action::tselect::init(), wesnothd::ban_manager::init_ban_help(), display::init_flags_for_side_internal(), gui2::ttree_view_node::init_grid(), mp::chat::init_textbox(), unit::invisible(), gui2::event::tdistributor::keyboard_remove_from_chain(), gui::menu::basic_sorter::less(), utf8::lowercase(), main(), wesnothd::make_change_diff(), wesnothd::make_delete_diff(), wb::side_actions::make_net_cmd_refresh(), font::make_text_ellipsis(), game_events::event_handler::matches_name(), events::mouse_handler::move_action(), ai::ai_default_rca::move_to_targets_phase::move_group(), halo::halo_impl::effect::on_location(), sound::play_music_config(), sound::play_new_music(), wb::side_actions::raw_turn_shift(), playturn_network_adapter::read(), gui2::tgui_definition::read(), input_stream::read_line(), gui2::register_window(), simple_wml::node::remove_child(), gui2::ttree_view::remove_node(), wesnothd::room::remove_player(), gui2::remove_timer(), ai::ai_default_rca::get_villages_phase::remove_village(), gui::scrollpane::remove_widget(), hotkey::remove_wml_hotkey(), halo::halo_impl::render(), game_board::replace_map(), image::reverse_image(), terrain_builder::rotate(), wb::side_actions::safe_erase(), display::scroll_to_tiles(), font::set_font_list(), gui::scrollpane::set_inner_location(), halo::halo_impl::set_location(), gui2::ttoggle_button::set_members(), gui2::tcontrol::set_members(), wb::highlighter::set_mouseover_hex(), show_story(), game_events::t_pump::show_wml_messages(), gui2::shrink_cache(), gui2::event::tdistributor::signal_handler_notify_removal(), utils::square_parenthetical_split(), sound::stop_bell(), sound::stop_sound(), sound::stop_UI_sound(), t_translation::terrain_matches(), gui2::timer_callback(), halo::halo_impl::unrender(), gui::scrollpane::update_content_size(), mp::chat::update_textbox(), gui::scrollpane::update_widget_positions(), unit_display::wml_animation_internal(), wesnothd::ban_manager::write(), t_translation::write_game_map(), t_translation::write_list(), metrics::~metrics(), gui2::iterator::policy::order::tbottom_up< visit_widget, visit_grid, visit_child >::~tbottom_up(), gui2::iterator::policy::order::ttop_down< visit_widget, visit_grid, visit_child >::~ttop_down(), and unit::~unit().
const std::string& parameters |
Definition at line 155 of file filter.cpp.
Referenced by wesnothd::server::adminmsg_handler(), events::console_handler::do_unit(), wesnothd::server::motd_handler(), wesnothd::server::process_command(), random_generate_map(), random_generate_scenario(), mp::start_local_game_commandline(), and wesnothd::server::status_handler().
surf = brighten_image(surf, amount) |
Definition at line 143 of file filter.cpp.
Referenced by help::help_text_area::add_img_item(), help::help_text_area::add_text_item(), adjust_surface_color(), surface::assign(), create_optimized_surface(), events::console_handler::do_layers(), gui::dialog_frame::draw_background(), unit_drawer::draw_bar(), gui::progress_bar::draw_contents(), gui::textbox::draw_contents(), draw_label(), draw_panel(), display::drawing_buffer_commit(), get_cursor(), display::get_fog_shroud_images(), gui2::tminimap::get_image(), gui::menu::style::get_item_image(), get_neutral_pixel_format(), display::get_terrain_images(), image::getMinimap(), help::image_width(), gui2::tminimap::impl_draw_background(), light_surface(), image::load_image_sub_file(), main(), mask_surface(), recolor_image(), display::render_image(), font::render_text(), scale_surface(), scale_surface_nn(), scale_surface_sharp(), SDL_PNGFormatAlpha(), help::help_text_area::set_items(), SetWindowResolution(), stretch_surface_horizontal(), stretch_surface_vertical(), tile_surface(), and ToggleFullscreen().