MCPcopy Create free account
hub / github.com/OpenRCT2/OpenRCT2 / SpriteImageLoad

Function SpriteImageLoad

src/openrct2/command_line/sprite/SpriteCommands.cpp:164–180  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

162 }
163
164 std::optional<Image> SpriteImageLoad(u8string_view path, ImageImportMeta meta)
165 {
166 try
167 {
168 auto format = ImageFormat::png32;
169 if (meta.palette == Palette::KeepIndices)
170 {
171 format = ImageFormat::png;
172 }
173 return Imaging::ReadFromFile(path, format);
174 }
175 catch (const std::exception& e)
176 {
177 fprintf(stderr, "%s\n", e.what());
178 return std::nullopt;
179 }
180 }
181
182 // TODO: Remove when C++20 is enabled and std::format can be used
183 std::string PopStr(std::ostringstream& oss)

Callers 2

buildFunction · 0.85
appendFunction · 0.85

Calls 2

ReadFromFileFunction · 0.50
whatMethod · 0.45

Tested by

no test coverage detected