diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/bitmap.c | 10 | ||||
-rw-r--r-- | src/main.c | 3 |
2 files changed, 11 insertions, 2 deletions
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; } @@ -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 ); |