From d51a86748a2826e5508451bfd3cc6fba14adc56f Mon Sep 17 00:00:00 2001 From: Jonas Gunz Date: Fri, 4 Sep 2020 20:57:39 +0200 Subject: print_help --- src/bitmap.c | 10 +++++++++- src/main.c | 3 ++- 2 files changed, 11 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/bitmap.c b/src/bitmap.c index 31256e8..0328df8 100644 --- a/src/bitmap.c +++ b/src/bitmap.c @@ -193,6 +193,8 @@ int bitmap_convert_monochrome ( struct bitmap_image *_input, struct bitmap_image if ( !_input || !_output ) return 1; + uint8_t min_brightness = 0xff; + uint8_t max_brightness = 0x00; uint8_t **monochrome_bitmap = (uint8_t**) dynalloc_2d_array( _input->x, _input->y, sizeof(uint8_t)); for ( unsigned int x = 0; x < _input->x; x++ ) { @@ -201,6 +203,11 @@ int bitmap_convert_monochrome ( struct bitmap_image *_input, struct bitmap_image _input->R[x][y], _input->G[x][y], _input->B[x][y] ); + + if (monochrome_bitmap[x][y] > max_brightness) + max_brightness = monochrome_bitmap[x][y]; + if (monochrome_bitmap[x][y] < min_brightness) + min_brightness = monochrome_bitmap[x][y]; } } @@ -208,7 +215,8 @@ int bitmap_convert_monochrome ( struct bitmap_image *_input, struct bitmap_image _output->tags = BITMAP_MONOCHROME; _output->x = _input->x; _output->y = _input->y; - //TODO min/max brightness + _output->monochrome_maximum_brightness = max_brightness; + _output->monochrome_minimum_brightness = min_brightness; return 0; } diff --git a/src/main.c b/src/main.c index 90bfcc0..e9c5afe 100644 --- a/src/main.c +++ b/src/main.c @@ -191,7 +191,8 @@ void print_help( char* _argv_0 ) " -c: Print in ANSI color mode. Default: OFF\n" " -i: Read from STDIN instead of file.\n" " -w: print only whitespaces with background color\n" - " -d: Dynamic brightness range\n -m PALETTE: specify custom character palette from darkest to brightest\n", + " -d: Dynamic brightness range\n" + " -m PALETTE: specify custom character palette from darkest to brightest\n", _argv_0, CHAR_SIZE_X ); -- cgit v1.2.3