| 96 | } // namespace |
| 97 | |
| 98 | void 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 |
no test coverage detected