コード例 #1
0
    PathContainer filter(PathContainer& paths) {
        PathContainer result;

        for (size_t i = 0; i < paths.size(); ++i) {
            if (conjugateOperator(predicate(*paths.Get(i)), predicate(*paths.GetConjugate(i)))) {
                result.AddPair(paths.Get(i), paths.GetConjugate(i));
            }
        }

        return result;
    }
コード例 #2
0
ファイル: ktech.cpp プロジェクト: KINGCODESABER/ktools
static void convert_to_KTEX(const PathContainer& input_paths, const string& output_path, const KTEX::File::Header& h) {
	typedef typename PathContainer::const_iterator pc_iter;
	typedef std::vector<Magick::Image> image_container_t;
	typedef image_container_t::iterator image_iterator_t;

	const int verbosity = options::verbosity;

	if(input_paths.size() > 1 && should_resize()) {
		throw Error("Attempt to resize a mipchain.");
	}

	assert( !input_paths.empty() );

	if(verbosity >= 0) {
		cout << "Loading non-TEX from `" << input_paths.front() << "'";

		size_t count = 1;
		for(pc_iter it = ++input_paths.begin(); it != input_paths.end(); ++it, ++count) {
			cout << ", `" << *it << "'";
			if(count > 4 && verbosity < 3) {
				cout << ", [...]";
				break;
			}
		}
		cout << "." << endl;
	}
	image_container_t imgs;
	if(input_paths.size() > 1) {
		imgs.reserve( input_paths.size() );
	}
	read_images( input_paths, imgs );
	assert( input_paths.size() == imgs.size() );

	KTEX::File tex;
	ImOp::ktexCompressor(h, std::min(options::verbosity, 0)).compress( tex, imgs );
	tex.dumpTo(output_path, verbosity);
}