Fixed tools not building

This commit is contained in:
Philippe Plantier 2004-07-19 18:31:32 +00:00
parent e3b02d0bbc
commit 8b25ef4fcf
10 changed files with 26 additions and 25 deletions

View file

@ -68,7 +68,7 @@ int main(int argc, char* argv[])
const config conf = cut.load_config(src);
cut.load_masks(conf);
const shared_sdl_surface src_surface(make_neutral_surface(IMG_Load(src.c_str())));
const surface src_surface(make_neutral_surface(IMG_Load(src.c_str())));
if(src_surface == NULL)
throw exploder_failure("Unable to load the source image " + src);
@ -78,7 +78,7 @@ int main(int argc, char* argv[])
itor != surfaces.end(); ++itor) {
const cutter::mask &mask = itor->second.mask;
shared_sdl_surface surf = shared_sdl_surface(
surface surf = surface(
create_compatible_surface(itor->second.image,
mask.cut.w, mask.cut.h));

View file

@ -13,7 +13,7 @@
#include "../video.hpp"
SDL_Surface* CVideo::getSurface()
surface CVideo::getSurface()
{
return NULL;
}
@ -22,12 +22,12 @@ void update_rect(const SDL_Rect& rect)
{
}
SDL_Surface* display_format_alpha(SDL_Surface* surf)
surface display_format_alpha(surface surf)
{
return NULL;
}
SDL_Surface* get_video_surface()
surface get_video_surface()
{
return NULL;
}

View file

@ -65,7 +65,7 @@ int main(int argc, char* argv[])
}
try {
shared_sdl_surface image = comp.compose(src, dest);
surface image = comp.compose(src, dest);
save_image(image, dest);
} catch(exploder_failure err) {
std::cerr << "Failed: " << err.message << "\n";

View file

@ -19,7 +19,7 @@ composer::composer() : interactive_(false), verbose_(false)
}
shared_sdl_surface composer::compose(const std::string &src, const std::string &dest)
surface composer::compose(const std::string &src, const std::string &dest)
{
cutter cut;
cut.set_verbose(verbose_);
@ -36,11 +36,11 @@ shared_sdl_surface composer::compose(const std::string &src, const std::string &
if(verbose_) {
std::cerr << "Loading images...\n";
}
const shared_sdl_surface src_surface(make_neutral_surface(IMG_Load(src.c_str())));
const surface src_surface(make_neutral_surface(IMG_Load(src.c_str())));
if(src_surface == NULL)
throw exploder_failure("Unable to load the source image " + src);
const shared_sdl_surface dest_surface(make_neutral_surface(IMG_Load(dest.c_str())));
const surface dest_surface(make_neutral_surface(IMG_Load(dest.c_str())));
if(dest_surface == NULL)
throw exploder_failure("Unable to load the destination image " + dest);

View file

@ -22,7 +22,7 @@ class composer
public:
composer();
shared_sdl_surface compose(const std::string &src, const std::string &dest);
surface compose(const std::string &src, const std::string &dest);
void set_interactive(bool value);
void set_verbose(bool value);

View file

@ -72,11 +72,11 @@ void cutter::load_masks(const config& conf)
cur_mask.shift = shift;
cur_mask.cut = cut;
cur_mask.filename = image;
scoped_sdl_surface tmp(IMG_Load(image.c_str()));
surface tmp(IMG_Load(image.c_str()));
if(tmp == NULL)
throw exploder_failure("Unable to load mask image " + image);
cur_mask.image = shared_sdl_surface(make_neutral_surface(tmp));
cur_mask.image = surface(make_neutral_surface(tmp));
}
if(masks_[name].image == NULL)
@ -85,7 +85,7 @@ void cutter::load_masks(const config& conf)
}
cutter::surface_map cutter::cut_surface(shared_sdl_surface surf, const config& conf)
cutter::surface_map cutter::cut_surface(surface surf, const config& conf)
{
surface_map res;
@ -117,7 +117,7 @@ std::string cutter::find_configuration(const std::string &file)
}
void cutter::add_sub_image(const shared_sdl_surface &surf, surface_map &map, const config* config)
void cutter::add_sub_image(const surface &surf, surface_map &map, const config* config)
{
const std::string name = (*config)["name"];
if(name.empty())
@ -140,7 +140,7 @@ void cutter::add_sub_image(const shared_sdl_surface &surf, surface_map &map, con
typedef std::pair<std::string, positioned_surface> sme;
positioned_surface ps;
ps.image = shared_sdl_surface(::cut_surface(surf, cut));
ps.image = surface(::cut_surface(surf, cut));
if(ps.image == NULL)
throw exploder_failure("Unable to cut surface!");
ps.name = name;

View file

@ -27,7 +27,7 @@ public:
mask() : image(NULL) {}
std::string name;
shared_sdl_surface image;
surface image;
std::string filename;
exploder_point shift;
@ -39,7 +39,7 @@ public:
std::string name;
exploder_point pos;
shared_sdl_surface image;
surface image;
cutter::mask mask;
};
@ -49,12 +49,12 @@ public:
const config load_config(const std::string& filename);
void load_masks(const config& conf);
surface_map cut_surface(shared_sdl_surface surf, const config& conf);
surface_map cut_surface(surface surf, const config& conf);
void set_verbose(bool value);
private:
std::string find_configuration(const std::string &file);
void add_sub_image(const shared_sdl_surface &surf, surface_map &map, const config* config);
void add_sub_image(const surface &surf, surface_map &map, const config* config);
mask_map masks_;

View file

@ -55,7 +55,7 @@ std::string get_exploder_dir()
//translated to the position (x,y) on dest.
//All surfaces are supposed to be neutral surfaces, mask and src are supposed
//to be of identical size.
void masked_overwrite_surface(SDL_Surface* dest, SDL_Surface* src, SDL_Surface* mask, int x, int y)
void masked_overwrite_surface(surface dest, surface src, surface mask, int x, int y)
{
surface_lock dest_lock(dest);
surface_lock src_lock(src);
@ -139,7 +139,7 @@ void masked_overwrite_surface(SDL_Surface* dest, SDL_Surface* src, SDL_Surface*
//returns true if the image is empty. the surface surf is considered to be a
//neutral surface.
bool image_empty(SDL_Surface* surf)
bool image_empty(surface surf)
{
//an image is considered empty if
// * all its pixels have 0 alpha, OR
@ -172,7 +172,7 @@ namespace {
}
//saves the given SDL structure into a given filename.
void save_image(SDL_Surface *surf, const std::string &filename)
void save_image(surface surf, const std::string &filename)
{
//opens the actual file
const util::scoped_FILE file(fopen(filename.c_str(),"wb"));

View file

@ -50,8 +50,8 @@ struct exploder_rect
std::string get_mask_dir();
std::string get_exploder_dir();
void masked_overwrite_surface(SDL_Surface* dest, SDL_Surface* src, SDL_Surface* mask, int x, int y);
bool image_empty(SDL_Surface* surf);
void save_image(SDL_Surface *surf, const std::string &filename);
void masked_overwrite_surface(surface dest, surface src, surface mask, int x, int y);
bool image_empty(surface surf);
void save_image(surface surf, const std::string &filename);
#endif

View file

@ -14,6 +14,7 @@
#define VIDEO_HPP_INCLUDED
#include "SDL.h"
#include "sdl_utils.hpp"
//possible flags when setting video modes
#define FULL_SCREEN SDL_FULLSCREEN