jfjoch_test: Bring back TIFFTest with rainbow coloring
This commit is contained in:
@@ -58,6 +58,31 @@ TEST_CASE("TIFFTest_File_signed","[TIFF]") {
|
||||
REQUIRE_NOTHROW(WriteTIFFToFile("test_image_signed.tiff", image));
|
||||
}
|
||||
|
||||
rgb rainbowColor(float t) {
|
||||
// Ensure t is in [0,1]
|
||||
t = std::max(0.0f, std::min(1.0f, t));
|
||||
|
||||
// Convert to hue (0 to 6)
|
||||
float hue = t * 6.0f;
|
||||
|
||||
int phase = static_cast<int>(hue);
|
||||
float fract = hue - phase;
|
||||
|
||||
uint8_t p = static_cast<uint8_t>(255 * (1.0f - fract));
|
||||
uint8_t q = static_cast<uint8_t>(255 * fract);
|
||||
uint8_t full = 255;
|
||||
|
||||
switch (phase) {
|
||||
case 0: return {full, q, 0}; // Red to Yellow
|
||||
case 1: return {p, full, 0}; // Yellow to Green
|
||||
case 2: return {0, full, q}; // Green to Cyan
|
||||
case 3: return {0, p, full}; // Cyan to Blue
|
||||
case 4: return {q, 0, full}; // Blue to Magenta
|
||||
case 5: return {full, 0, p}; // Magenta to Red
|
||||
default: return {full, 0, 0}; // Fallback (red)
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("TIFFTest_File_rgb","[TIFF]") {
|
||||
std::vector<rgb> values(512 * 1024);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user