Ignore:
Timestamp:
Nov 29, 2003, 8:35:07 PM (17 years ago)
Author:
Sam Hocevar
Message:
  • src/caca.c src/caca.h: + Added caca_get_dithering_name().
  • src/bitmap.c: + Created a new dithering method with an 8x8 ordered matrix. + Replaced the char list with a string for better readability. + Dithering functions now return a value between 0 and 255.
  • examples/demo.c examples/view.c: + Adapted to use caca_get_dithering_name().
Location:
libcaca/trunk/examples
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • libcaca/trunk/examples/demo.c

    r226 r235  
    101101            case 'd':
    102102            case 'D':
    103                 dithering = (dithering + 1) % 3;
    104                 caca_set_dithering(dithering == 0 ? CACA_DITHER_NONE :
    105                                    dithering == 1 ? CACA_DITHER_ORDERED :
    106                                                     CACA_DITHER_RANDOM);
     103                dithering = (dithering + 1) % 4;
     104                caca_set_dithering(dithering);
    107105                display_menu();
    108106                break;
     
    204202    caca_printf(4, 18, "'b': drawing boundaries: %s",
    205203              bounds == 0 ? "screen" : "infinite");
    206     caca_printf(4, 19, "'d': %s dithering",
    207               dithering == 0 ? "no" : dithering == 1 ? "ordered" : "random");
     204    caca_printf(4, 19, "'d': dithering (%s)",
     205                caca_get_dithering_name(dithering));
    208206
    209207    caca_putstr(4, yo - 2, "'q': quit");
  • libcaca/trunk/examples/view.c

    r233 r235  
    3838int x, y, w, h;
    3939
    40 int dithering = 1;
    41 const enum caca_dithering dithering_list[] =
    42     { CACA_DITHER_NONE, CACA_DITHER_ORDERED, CACA_DITHER_RANDOM };
     40int dithering = CACA_DITHERING_ORDERED4;
    4341
    4442static void load_image(const char *);
     
    105103            case CACA_EVENT_KEY_PRESS | 'd':
    106104            case CACA_EVENT_KEY_PRESS | 'D':
    107                 dithering = (dithering + 1) % 3;
     105                dithering = (dithering + 1) % 4;
    108106                update = 1;
    109107                break;
     
    179177        {
    180178            caca_clear();
    181             caca_set_dithering(dithering_list[dithering]);
     179            caca_set_dithering(dithering);
    182180            caca_set_color(CACA_COLOR_WHITE, CACA_COLOR_BLUE);
    183181
     
    227225                              "d:Dithering  ?:Help");
    228226            caca_printf(3, wh - 1, "cacaview %s", VERSION);
     227            caca_printf(ww / 2 - 5, wh - 1, "(dithering: %s)",
     228                        caca_get_dithering_name(dithering));
    229229            caca_printf(ww - 14, wh - 1,
    230230                        "(zoom: %s%i)", zoom > 0 ? "+" : "", zoom);
Note: See TracChangeset for help on using the changeset viewer.