Skip to content

Commit 75d8d04

Browse files
committed
Add resize and scale support to create #999
Missing functionality from the legacy tool added so we can comfortably remove the legacy tools in 4.5. The following issues were discovered and fixed while adding the features: * The target imageSpec was being updated for every input file. This was only working because, until now, nothing had looked at the spec values that were being changed once the texture had been created. The fix is to make separate determineSourceColorSpace and determineTargetColorSpace functions. * An associated fix to the above is to move the checks for non-null transferFunctions to the use site with fatal errors thrown then if they are null. This avoids the need for second guessing to avoid the fatal errors when the transferFunctions will not be used. With this and the above fix, the code is now much more robust and clear. * Full help was missing --levels. * Full help had an incorrect statement regarding implicit color conversions dating from the transfer function work.
1 parent 6163359 commit 75d8d04

File tree

3 files changed

+390
-184
lines changed

3 files changed

+390
-184
lines changed

tests/cts

Submodule cts updated 876 files

tools/imageio/imageio.h

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,32 @@ constexpr bool operator!=(const ImageSpec::Origin& lhs, const ImageSpec::Origin&
211211
return lhs.x != rhs.x || lhs.y != rhs.y || lhs.z != rhs.z;
212212
}
213213

214+
[[nodiscard]] inline std::string toString(const ImageSpec::Origin& o) noexcept {
215+
std::string str;
216+
switch (o.x) {
217+
case ImageSpec::Origin::eLeft: str = "left"; break;
218+
case ImageSpec::Origin::eRight: str = "right"; break;
219+
case ImageSpec::Origin::eUnspecified: str = "unspecified"; break;
220+
default: assert(false && "Invalid origin.x");
221+
}
222+
str += ",";
223+
switch (o.y) {
224+
case ImageSpec::Origin::eTop: str += "top"; break;
225+
case ImageSpec::Origin::eBottom: str += "bottom"; break;
226+
case ImageSpec::Origin::eUnspecified: str += "unspecified"; break;
227+
default: assert(false && "Invalid origin.y");
228+
}
229+
str += ",";
230+
switch (o.z) {
231+
case ImageSpec::Origin::eFront: str += "front"; break;
232+
case ImageSpec::Origin::eBack: str += "back"; break;
233+
case ImageSpec::Origin::eUnspecified: str += "unspecified"; break;
234+
default: assert(false && "Invalid origin.z");
235+
}
236+
237+
return str;
238+
}
239+
214240
typedef std::function<void(const std::string&)> WarningCallbackFunction;
215241

216242
enum class ImageInputFormatType {

0 commit comments

Comments
 (0)