Changeset 696 for libcaca/trunk


Ignore:
Timestamp:
Mar 27, 2006, 9:40:30 AM (15 years ago)
Author:
Sam Hocevar
Message:
  • Implemented cucul_invert() to invert a canvas' colours.
Location:
libcaca/trunk/cucul
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • libcaca/trunk/cucul/cucul.h

    r690 r696  
    152152 *
    153153 *  @{ */
     154void cucul_invert(cucul_t *);
    154155void cucul_flip(cucul_t *);
    155156void cucul_flop(cucul_t *);
  • libcaca/trunk/cucul/transform.c

    r693 r696  
    2929static uint32_t flopchar(uint32_t ch);
    3030static uint32_t rotatechar(uint32_t ch);
     31
     32/** \brief Invert a canvas' colours.
     33 *
     34 *  This function inverts a canvas' colours (black becomes white, red
     35 *  becomes cyan, etc.) without changing the characters in it.
     36 *
     37 *  \param qq The canvas to invert.
     38 */
     39void cucul_invert(cucul_t *qq)
     40{
     41    uint8_t *attr = qq->attr;
     42    unsigned int i;
     43
     44    for(i = qq->height * qq->width; i--; )
     45    {
     46        *attr = ~*attr;
     47        attr++;
     48    }
     49}
    3150
    3251/** \brief Flip a canvas horizontally.
Note: See TracChangeset for help on using the changeset viewer.