Ignore:
Timestamp:
Nov 16, 2003, 6:41:43 PM (17 years ago)
Author:
Sam Hocevar
Message:
  • src/blit.c: + Hue calculation now uses integers only. + Dithering is now parametrable. Implemented none, ordered, random.
  • examples/demo.c: + Added dithering selection.
File:
1 edited

Legend:

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

    r193 r195  
    4848int bounds = 0;
    4949int outline = 0;
     50int dithering = 0;
    5051struct caca_sprite *sprite = NULL;
    5152
     
    7778    //pixbuf = gdk_pixbuf_new_from_file("/home/sam/pix/pikachu.jpeg", NULL);
    7879    //pixbuf = gdk_pixbuf_new_from_file("/home/sam/pix/gradient.png", NULL);
     80    //pixbuf = gdk_pixbuf_new_from_file("/home/sam/pix/beastie.png", NULL);
     81    pixbuf = gdk_pixbuf_new_from_file("/home/sam/pix/stitch.jpg", NULL);
     82    //pixbuf = gdk_pixbuf_new_from_file("/home/sam/pix/dranac.jpeg", NULL);
    7983    //pixbuf = gdk_pixbuf_new_from_file("/home/sam/artwork/aboire.png", NULL);
    8084    //pixbuf = gdk_pixbuf_new_from_file("/home/sam/web/sam.zoy.org/artwork/goret.png", NULL);
    8185    //pixbuf = gdk_pixbuf_new_from_file("/home/sam/lilkim02.jpg", NULL);
    82     pixbuf = gdk_pixbuf_new_from_file("/home/sam/etw.bmp", NULL);
     86    //pixbuf = gdk_pixbuf_new_from_file("/home/sam/etw.bmp", NULL);
    8387if(!pixbuf) return -2;
    8488    pixels = gdk_pixbuf_get_pixels(pixbuf);
     
    124128                display_menu();
    125129                break;
     130            case 'd':
     131            case 'D':
     132                dithering = (dithering + 1) % 3;
     133                caca_set_dithering(dithering == 0 ? CACA_DITHER_NONE :
     134                                   dithering == 1 ? CACA_DITHER_ORDERED :
     135                                                    CACA_DITHER_RANDOM);
     136                display_menu();
     137                break;
    126138            case 'c':
    127139                demo = demo_color;
     
    214226    caca_printf(4, 19, "'b': drawing boundaries: %s",
    215227              bounds == 0 ? "screen" : "infinite");
     228    caca_printf(4, 20, "'d': %s dithering",
     229              dithering == 0 ? "no" : dithering == 1 ? "ordered" : "random");
    216230
    217231    caca_putstr(4, yo - 2, "'q': quit");
     
    465479static void demo_blit(void)
    466480{
    467     caca_blit(6, 4, caca_get_width() - 6, caca_get_height() - 4, pixels, bufx, bufy);
    468 }
    469 
     481    caca_blit(6, 4, caca_get_width() - 6, caca_get_height() - 4,
     482              pixels, bufx, bufy);
     483}
     484
Note: See TracChangeset for help on using the changeset viewer.