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

Public Member Functions

 image_pattern_diagonal (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 = 0xFF000000U
 
uint32_t fg = 0xFFFFFFFFU
 
int line_width = 4
 
int stride = 80
 

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 569 of file video_pattern_generator.cpp.

Constructor & Destructor Documentation

◆ image_pattern_diagonal()

image_pattern_diagonal::image_pattern_diagonal ( const string & config)
inlineexplicit

Definition at line 571 of file video_pattern_generator.cpp.

571 {
572 if (config == "help"s) {
573 col() << "Testcard diagonal usage:\n\t" << SBOLD(SRED("-t testcard:pattern=diagonal") << "[,bg=0x<AABBGGRR<][,fg=0x<AABBGGRR>][,stride=<stride>][,line_width=<width>]") << "\n";
574 throw 1;
575 }
576 if (!config.empty()) {
577 string_view sv = config;
578 while (!sv.empty()) {
579 auto tok = tokenize(sv, ',');
580 auto key = tokenize(tok, '=');
581 auto val = tokenize(tok, '=');
582 if (key == "bg") {
583 bg = stol((string) val, nullptr, 0);
584 } else if (key == "fg") {
585 fg = stol((string) val, nullptr, 0);
586 } else if (key == "stride") {
587 stride = stol((string) val, nullptr, 0);
588 } else if (key == "line_width") {
589 line_width = stol((string) val, nullptr, 0);
590 } else {
591 throw ug_runtime_error("Testcard diagonal - wrong option: " + string(tok));
592 }
593 }
594 }
595 }
int void * val
#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.
const char * key
Definition cineform.cpp:125

References bg, fg, key, line_width, SBOLD, SRED, stride, tokenize(), and val.

Here is the call graph for this function:

Member Function Documentation

◆ fill()

enum generator_depth image_pattern_diagonal::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 598 of file video_pattern_generator.cpp.

598 {
599 std::fill((uint32_t *)(void *) data, (uint32_t *)(void *) (data + width * height * 4), bg);
600 for(int y = 0; y < height; y++){
601 for(int x = y % stride; x < width - line_width; x += stride){
602 for(int i = 0; i < line_width; i++){
603 *((uint32_t *) (void *) (data + (y*width + x + i) * 4)) = fg;
604 }
605 }
606 for(int x = stride - (y % stride); x < width - line_width; x += stride){
607 for(int i = 0; i < line_width; i++){
608 *((uint32_t *) (void *) (data + (y*width + x + i) * 4)) = fg;
609 }
610 }
611 }
612
614 }

References bg, bits8, fg, line_width, and stride.

Member Data Documentation

◆ bg

uint32_t image_pattern_diagonal::bg = 0xFF000000U
private

Definition at line 615 of file video_pattern_generator.cpp.

Referenced by image_pattern_diagonal(), and fill().

◆ fg

uint32_t image_pattern_diagonal::fg = 0xFFFFFFFFU
private

Definition at line 616 of file video_pattern_generator.cpp.

Referenced by image_pattern_diagonal(), and fill().

◆ line_width

int image_pattern_diagonal::line_width = 4
private

Definition at line 618 of file video_pattern_generator.cpp.

Referenced by image_pattern_diagonal(), and fill().

◆ stride

int image_pattern_diagonal::stride = 80
private

Definition at line 617 of file video_pattern_generator.cpp.

Referenced by image_pattern_diagonal(), and fill().


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