any_regular_t vm_dictionary_image_proc(const dictionary_t& named_argument_set)
{
    if (named_argument_set.empty())
        return any_regular_t(empty_t());

    std::string               filename;
    boost::gil::rgba8_image_t the_image;

    get_value(named_argument_set, key_name, filename);

    if (!filename.empty()) {
        auto path = boost::filesystem::path(filename);
        image_slurp(path, the_image);
    }

    return any_regular_t(the_image);
}
예제 #2
0
any_regular_t vm_dictionary_image_proc(const dictionary_t& named_argument_set)
{
    if (named_argument_set.empty())
        return any_regular_t(empty_t());

    std::string                    filename;
    boost::shared_ptr<GG::Texture> the_image;

    get_value(named_argument_set, key_name, filename);

    if (!filename.empty()) {
        try {
            the_image = GG::GUI::GetGUI()->GetTexture(filename);
            the_image->SetFilters(GL_NEAREST_MIPMAP_NEAREST, GL_NEAREST);
        } catch (...) {
            return any_regular_t(empty_t());
        }
    }

    return any_regular_t(the_image);
}