From 86ae693117bbed1f8b1f4b58a6472011c7c313bf Mon Sep 17 00:00:00 2001 From: Martin Pulec Date: Fri, 10 Feb 2023 11:52:34 +0100 Subject: [PATCH] text textcard pattern: updates - accept bg/fg options without need to alter (default) text - print error on wrong option - use #CC00CC (pink) - although looking less decent, the subsampling artifacts should be more observalble with this color --- src/utils/video_pattern_generator.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/utils/video_pattern_generator.cpp b/src/utils/video_pattern_generator.cpp index 547887bff..1efc7c2c4 100644 --- a/src/utils/video_pattern_generator.cpp +++ b/src/utils/video_pattern_generator.cpp @@ -454,15 +454,18 @@ class image_pattern_text : public image_pattern { } if (!config.empty()) { string_view sv = config; - text = ""; + bool text_set = false; while (!sv.empty()) { auto tok = tokenize(sv, ','); - if (text.empty()) { - text = tok; - } else if (tok.substr(0,3) == "bg=") { + if (tok.substr(0,3) == "bg=") { bg = stol((string) tok.substr(3), nullptr, 0); } else if (tok.substr(0,3) == "fg=") { fg = stol((string) tok.substr(3), nullptr, 0); + } else if (!text_set) { + text = tok; + text_set = true; + } else { + throw ug_runtime_error("Testcard text - wrong option: " + string(tok)); } } } @@ -481,7 +484,7 @@ class image_pattern_text : public image_pattern { return generator_depth::bits8; } string text = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"; - uint32_t bg = 0xFF0000AAU; + uint32_t bg = 0xFFCC00CCU; uint32_t fg = 0xFFFFFFFFU; };