MCPcopy Create free account
hub / github.com/CesiumGS/cesium-native / writeImageToTgaFile

Function writeImageToTgaFile

CesiumNativeTests/src/writeTga.cpp:98–124  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

96} // namespace
97
98void writeImageToTgaFile(
99 const CesiumImage::ImageAsset& image,
100 const std::filesystem::path& outputPath) {
101 if (image.mipPositions.size() == 0) {
102 writeTgaImpl(
103 outputPath,
104 image.pixelData.data(),
105 image.channels,
106 image.width,
107 image.height);
108 } else {
109 for (size_t i = 0; i < image.mipPositions.size(); i++) {
110 std::filesystem::path thisPath =
111 outputPath.parent_path() / (fmt::format(
112 "{}-mip{}{}",
113 outputPath.stem().string(),
114 i,
115 outputPath.extension().string()));
116 writeTgaImpl(
117 thisPath,
118 image.pixelData.data() + image.mipPositions[i].byteOffset,
119 image.channels,
120 image.width >> i,
121 image.height >> i);
122 }
123 }
124}
125} // namespace CesiumNativeTests

Calls 4

writeTgaImplFunction · 0.85
formatFunction · 0.85
sizeMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected