MCPcopy Create free account
hub / github.com/BohemiaInteractive/CWR / setupImageFormats

Function setupImageFormats

apps/tools/Tools/commands/ImageCommand.cpp:205–269  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

203}
204
205static void setupImageFormats(CLI::App& image)
206{
207 auto* cmd = image.add_subcommand("formats", "List supported pixel formats and containers");
208
209 cmd->callback(
210 []()
211 {
212 std::cout << "Pixel Formats:" << std::endl;
213 std::cout << std::endl;
214 std::cout << " ";
215 std::cout << std::left << std::setw(12) << "Name";
216 std::cout << std::right << std::setw(4) << "BPP" << " ";
217 std::cout << std::left << std::setw(14) << "Type";
218 std::cout << std::left << std::setw(8) << "Alpha";
219 std::cout << std::left << std::setw(5) << "PAA";
220 std::cout << "Description" << std::endl;
221 std::cout << " " << std::string(82, '-') << std::endl;
222
223 auto count = Poseidon::PixelFormatRegistry::AllFormatsCount();
224 auto* formats = Poseidon::PixelFormatRegistry::AllFormats();
225 for (size_t i = 0; i < count; ++i)
226 {
227 const auto& f = formats[i];
228 std::cout << " ";
229 std::cout << std::left << std::setw(12) << f.name;
230 std::cout << std::right << std::setw(4) << f.bitsPerPixel << " ";
231 std::cout << std::left << std::setw(14) << (f.isCompressed ? "compressed" : "uncompressed");
232 std::cout << std::left << std::setw(8) << (f.hasAlpha ? "yes" : "-");
233 std::cout << std::left << std::setw(5) << (f.paaMagic ? "yes" : "-");
234 std::cout << f.description << std::endl;
235 }
236
237 std::cout << std::endl;
238 std::cout << "Containers:" << std::endl;
239 std::cout << std::endl;
240 std::cout << " ";
241 std::cout << std::left << std::setw(8) << "Ext";
242 std::cout << std::left << std::setw(6) << "Name";
243 std::cout << std::left << std::setw(7) << "Read";
244 std::cout << std::left << std::setw(7) << "Write";
245 std::cout << "Description" << std::endl;
246 std::cout << " " << std::string(82, '-') << std::endl;
247
248 int cCount = Poseidon::ImageContainerRegistry::ContainerCount();
249 auto* containers = Poseidon::ImageContainerRegistry::AllContainers();
250 for (int i = 0; i < cCount; ++i)
251 {
252 const auto& c = containers[i];
253 std::cout << " ";
254 std::cout << std::left << std::setw(8) << c.extension;
255 std::cout << std::left << std::setw(6) << c.name;
256 std::cout << std::left << std::setw(7) << (c.canRead ? "yes" : "-");
257 std::cout << std::left << std::setw(7) << (c.canWrite ? "yes" : "-");
258 std::cout << c.description << std::endl;
259 }
260
261 std::cout << std::endl;
262 std::cout << "Notes:" << std::endl;

Callers 1

SetupMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected