Changeset 1907 for libcaca


Ignore:
Timestamp:
Nov 6, 2007, 2:49:19 PM (13 years ago)
Author:
Jean-Yves Lamoureux
Message:
  • Added dither error handling
File:
1 edited

Legend:

Unmodified
Added
Removed
  • libcaca/trunk/src/img2txt.c

    r1906 r1907  
    4848    fprintf(stderr, "  -H, --height=HEIGHT\tHeight of resulting image\n");
    4949    fprintf(stderr, "  -d, --dither=DITHER\tDithering algorithm to use :\n");
    50     fprintf(stderr, "\t\t\tnone : Nearest color\n");
     50    fprintf(stderr, "\t\t\tnone     : Nearest color\n");
    5151    fprintf(stderr, "\t\t\tordered2 : Ordered 2x2\n");
    5252    fprintf(stderr, "\t\t\tordered4 : Ordered 4x4\n");
     
    160160    cucul_set_color_ansi(cv, CUCUL_DEFAULT, CUCUL_TRANSPARENT);
    161161    cucul_clear_canvas(cv);
    162     cucul_set_dither_algorithm(i->dither, dither?dither:"fstein");
     162    if(cucul_set_dither_algorithm(i->dither, dither?dither:"fstein"))
     163    {
     164        fprintf(stderr, "Can't dither image with algorithm '%s'\n", dither);
     165        unload_image(i);
     166        cucul_free_canvas(cv);
     167        return -1;
     168    }
    163169    cucul_dither_bitmap(cv, 0, 0, cols, lines, i->dither, i->pixels);
    164170
Note: See TracChangeset for help on using the changeset viewer.