Changeset 690 for libcaca


Ignore:
Timestamp:
Mar 24, 2006, 8:34:45 PM (15 years ago)
Author:
Jean-Yves Lamoureux
Message:
  • Added bitmap invert routine. It doesn't work well, so don't use it right now. Sam is working hard to correct the strange behaviour.
Location:
libcaca/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • libcaca/trunk/cucul/bitmap.c

    r672 r690  
    150150    float gamma;
    151151    int gammatab[4097];
     152    unsigned char invert;
    152153};
    153154#endif
     
    314315        bitmap->gammatab[i] = i;
    315316
     317    /* No color inversion by default */
     318    bitmap->invert = 0;
     319
    316320    return bitmap;
    317321}
     
    379383        bitmap->gammatab[i] = 4096.0 * gammapow((float)i / 4096.0, 1.0 / gamma);
    380384}
     385
     386
     387/**
     388 * \brief Invert colors of bitmap
     389 *
     390 * Invert colors of bitmap
     391 *
     392 * \param bitmap Bitmap object.
     393 * \param value 0 for normal behaviour, 1 for invert
     394 */
     395void cucul_set_bitmap_invert(struct cucul_bitmap *bitmap, unsigned char value)
     396{
     397    bitmap->invert = (value==0)?0:1;
     398}
     399
     400
    381401
    382402/**
     
    782802        }
    783803
     804        if(bitmap->invert) {
     805            outfg = 15-outfg;
     806            outbg = 15-outfg;
     807        }
     808
    784809        /* Now output the character */
    785810        cucul_set_color(qq, outfg, outbg);
  • libcaca/trunk/cucul/cucul.h

    r678 r690  
    224224void cucul_set_bitmap_gamma(struct cucul_bitmap *, float);
    225225void cucul_draw_bitmap(cucul_t *, int, int, int, int, struct cucul_bitmap const *, void *);
     226void cucul_set_bitmap_invert(struct cucul_bitmap *, unsigned char);
    226227void cucul_free_bitmap(struct cucul_bitmap *);
    227228/*  @} */
  • libcaca/trunk/test/demo.c

    r689 r690  
    494494        *dest++ = (x << 16) | (y << 8) | (z);
    495495    }
    496 
     496    cucul_set_bitmap_invert(bitmap, 1);
    497497    //bitmap = cucul_create_bitmap(16, 256, 256, 2 * 256, 0xf800, 0x07e0, 0x001f, 0x0000);
    498498    bitmap = cucul_create_bitmap(32, 256, 256, 4 * 256, 0x00ff0000, 0x0000ff00, 0x000000ff, 0xff000000);
     
    541541
    542542    bitmap = cucul_create_bitmap(32, 256, 256, 4 * 256, 0x00ff0000, 0x0000ff00, 0x000000ff, 0xff000000);
     543 cucul_set_bitmap_invert(bitmap, 1);
    543544    cucul_draw_bitmap(qq, 0, 0, cucul_get_width(qq) - 1, cucul_get_height(qq) - 1, bitmap, (char *)buffer);
    544545    cucul_free_bitmap(bitmap);
Note: See TracChangeset for help on using the changeset viewer.