Changeset 1066


Ignore:
Timestamp:
Sep 19, 2006, 6:07:13 PM (14 years ago)
Author:
Sam Hocevar
Message:
  • Implemented cucul_getchar(). Useful because you don’t necessarily know what you are importing.
Location:
libcaca/trunk/cucul
Files:
2 edited

Legend:

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

    r988 r1066  
    7373
    7474    return 0;
     75}
     76
     77/** \brief Get the Unicode character at the given coordinates.
     78 *
     79 *  This function gets the ASCII or Unicode value of the character at
     80 *  the given coordinates. If the value is less or equal to 127 (0x7f),
     81 *  the character can be printed as ASCII. Otherise, it must be handled
     82 *  as a UTF-32 value.
     83 *
     84 *  If the coordinates are outside the canvas boundaries, a space (0x20)
     85 *  is returned.
     86 *
     87 *  This function never fails.
     88 *
     89 *  \param cv A handle to the libcucul canvas.
     90 *  \param x X coordinate.
     91 *  \param y Y coordinate.
     92 *  \param ch The requested character value.
     93 *  \return The character always returns 0.
     94 */
     95unsigned long int cucul_getchar(cucul_canvas_t *cv, int x, int y)
     96{
     97    if(x < 0 || x >= (int)cv->width || y < 0 || y >= (int)cv->height)
     98        return 0;
     99
     100    return (unsigned long int)cv->chars[x + y * cv->width];
    75101}
    76102
  • libcaca/trunk/cucul/cucul.h

    r1062 r1066  
    102102char const *cucul_get_color_name(unsigned int);
    103103int cucul_putchar(cucul_canvas_t *, int, int, unsigned long int);
     104unsigned long int cucul_getchar(cucul_canvas_t *, int, int);
    104105int cucul_putstr(cucul_canvas_t *, int, int, char const *);
    105106int cucul_printf(cucul_canvas_t *, int, int, char const *, ...);
Note: See TracChangeset for help on using the changeset viewer.