Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #ifndef EXPLODER_CUTTER_HPP_INCLUDED
00017 #define EXPLODER_CUTTER_HPP_INCLUDED
00018
00019 #include "../sdl_utils.hpp"
00020 #include "../config.hpp"
00021 #include "../sdl_utils.hpp"
00022 #include "exploder_utils.hpp"
00023
00024 class cutter
00025 {
00026 public:
00027 struct mask
00028 {
00029 mask()
00030 : name()
00031 , image(NULL)
00032 , filename()
00033 , shift()
00034 , cut()
00035 {
00036 }
00037
00038 std::string name;
00039 surface image;
00040 std::string filename;
00041
00042 exploder_point shift;
00043 exploder_rect cut;
00044 };
00045 typedef std::map<std::string, mask> mask_map;
00046 struct positioned_surface {
00047 positioned_surface()
00048 : name()
00049 , pos()
00050 , image(NULL)
00051 , mask()
00052 {
00053 };
00054
00055 std::string name;
00056 exploder_point pos;
00057 surface image;
00058
00059 cutter::mask mask;
00060 };
00061 typedef std::multimap<std::string, positioned_surface> surface_map;
00062
00063 cutter();
00064
00065 const config load_config(const std::string& filename);
00066 void load_masks(const config& conf);
00067 surface_map cut_surface(surface surf, const config& conf);
00068
00069 void set_verbose(bool value);
00070 private:
00071 std::string find_configuration(const std::string &file);
00072 void add_sub_image(const surface &surf, surface_map &map, const config* config);
00073
00074 mask_map masks_;
00075
00076 bool verbose_;
00077 };
00078
00079 #endif
00080