Ignore:
Timestamp:
Nov 6, 2007, 2:45:18 PM (12 years ago)
Author:
Jean-Yves Lamoureux
Message:
  • Added --dither option and updated usage()
File:
1 edited

Legend:

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

    r1902 r1906  
    4646    fprintf(stderr, "  -h, --help\tThis help\n");
    4747    fprintf(stderr, "  -W, --width=WIDTH\tWidth of resulting image\n");
    48     fprintf(stderr, "  -H, --HEIGHT=HEIGHT\tHeight of resulting image\n");
     48    fprintf(stderr, "  -H, --height=HEIGHT\tHeight of resulting image\n");
     49    fprintf(stderr, "  -d, --dither=DITHER\tDithering algorithm to use :\n");
     50    fprintf(stderr, "\t\t\tnone : Nearest color\n");
     51    fprintf(stderr, "\t\t\tordered2 : Ordered 2x2\n");
     52    fprintf(stderr, "\t\t\tordered4 : Ordered 4x4\n");
     53    fprintf(stderr, "\t\t\tordered8 : Ordered 8x8\n");
     54    fprintf(stderr, "\t\t\trandom   : Random\n");
     55    fprintf(stderr, "\t\t\tfstein   : Floyd Steinberg (default)\n");
    4956    fprintf(stderr, "  -f, --format=FORMAT\tFormat of the resulting image :\n");
    50     fprintf(stderr, "\t\t\tansi : coulored ANSI\n");
     57    fprintf(stderr, "\t\t\tansi : coulored ANSI (default)\n");
    5158    fprintf(stderr, "\t\t\tcaca : internal libcaca format\n");
    5259    fprintf(stderr, "\t\t\tutf8 : UTF8 with CR\n");
     
    6976    unsigned int cols = 0, lines = 0;
    7077    char *format = NULL;
     78    char *dither = NULL;
    7179
    7280
     
    8694            { "height", 1, NULL, 'H' },
    8795            { "format", 1, NULL, 'f' },
     96            { "dither", 1, NULL, 'd' },
    8897            { "help",   0, NULL, 'h' },
    8998        };
    90         int c = mygetopt(argc, argv, "W:H:f:h", long_options, &option_index);
     99        int c = mygetopt(argc, argv, "W:H:f:d:h", long_options, &option_index);
    91100        if(c == -1)
    92101            break;
     
    103112            format = myoptarg;
    104113            break;
     114        case 'd': /* --dither */
     115            dither = myoptarg;
     116            break;
    105117        case 'h': /* --help */
    106118            usage(argc, argv);
     
    112124        }
    113125    }
    114 
    115126
    116127
     
    149160    cucul_set_color_ansi(cv, CUCUL_DEFAULT, CUCUL_TRANSPARENT);
    150161    cucul_clear_canvas(cv);
     162    cucul_set_dither_algorithm(i->dither, dither?dither:"fstein");
    151163    cucul_dither_bitmap(cv, 0, 0, cols, lines, i->dither, i->pixels);
    152164
Note: See TracChangeset for help on using the changeset viewer.