UltraGrid
UltraGrid Low-Latency High-Resolution Transmission System
Loading...
Searching...
No Matches
image_pattern_text Class Reference
Inheritance diagram for image_pattern_text:
Inheritance graph
Collaboration diagram for image_pattern_text:
Collaboration graph

Public Member Functions

 image_pattern_text (const string &config)
 
- Public Member Functions inherited from image_pattern
 image_pattern ()=default
 
 image_pattern (const image_pattern &)=delete
 
 image_pattern (image_pattern &&)=delete
 
virtual ~image_pattern ()=default
 
auto init (int width, int height, enum generator_depth depth) noexcept
 
image_pattern & operator= (const image_pattern &)=delete
 
image_pattern && operator= (image_pattern &&)=delete
 

Private Member Functions

enum generator_depth fill (int width, int height, unsigned char *data) override
 

Private Attributes

uint32_t bg = 0xFFCC00CCU
 
uint32_t fg = 0xFFFFFFFFU
 
string text = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"
 

Additional Inherited Members

- Static Public Member Functions inherited from image_pattern
static unique_ptr< image_pattern > create (string const &pattern, string const &params)
 

Detailed Description

Definition at line 526 of file video_pattern_generator.cpp.

Constructor & Destructor Documentation

◆ image_pattern_text()

image_pattern_text::image_pattern_text ( const string & config)
inlineexplicit

Definition at line 528 of file video_pattern_generator.cpp.

528 {
529 if (config == "help"s) {
530 col() << "Testcard text usage:\n\t" << SBOLD(SRED("-t testcard:pattern=text") << "[=pattern][,bg=0x<AABBGGRR<][,fg=0x<AABBGGRR>]") << "\n";
531 throw 1;
532 }
533 if (!config.empty()) {
534 string_view sv = config;
535 bool text_set = false;
536 while (!sv.empty()) {
537 auto tok = tokenize(sv, ',');
538 if (tok.substr(0,3) == "bg=") {
539 bg = stol((string) tok.substr(3), nullptr, 0);
540 } else if (tok.substr(0,3) == "fg=") {
541 fg = stol((string) tok.substr(3), nullptr, 0);
542 } else if (!text_set) {
543 text = tok;
544 text_set = true;
545 } else {
546 throw ug_runtime_error("Testcard text - wrong option: " + string(tok));
547 }
548 }
549 }
550 }
#define SRED(x)
Definition color_out.h:85
#define SBOLD(x)
Definition color_out.h:80
std::string_view tokenize(std::string_view &str, char delim, char quot)
Tokenizer for string_view.

References bg, fg, SBOLD, SRED, text, and tokenize().

Here is the call graph for this function:

Member Function Documentation

◆ fill()

enum generator_depth image_pattern_text::fill ( int width,
int height,
unsigned char * data )
inlineoverrideprivatevirtual
Return values
bitdepth used by the generator (either 8 or 16)

Implements image_pattern.

Definition at line 553 of file video_pattern_generator.cpp.

553 {
554 std::fill((uint32_t *)(void *) data, (uint32_t *)(void *) (data + width * height * 4), bg);
555 string line;
556 for (int i = 0; i < width; i += 8 * (text.size() + 1)) {
557 line += " " + text;
558 }
559 for (int i = 0; i < height / 16; ++i) {
560 draw_line((char *) data + (i * 16 * width * 4), width * 4, line.c_str(), fg, false);
561 }
563 }
bool draw_line(char *buf, int pitch, const char *text, uint32_t color, bool solid)
Definition text.c:271

References bg, bits8, draw_line(), fg, and text.

Here is the call graph for this function:

Member Data Documentation

◆ bg

uint32_t image_pattern_text::bg = 0xFFCC00CCU
private

Definition at line 565 of file video_pattern_generator.cpp.

Referenced by image_pattern_text(), and fill().

◆ fg

uint32_t image_pattern_text::fg = 0xFFFFFFFFU
private

Definition at line 566 of file video_pattern_generator.cpp.

Referenced by image_pattern_text(), and fill().

◆ text

string image_pattern_text::text = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"
private

Definition at line 564 of file video_pattern_generator.cpp.

Referenced by image_pattern_text(), and fill().


The documentation for this class was generated from the following file: