Ignore:
Timestamp:
Mar 23, 2006, 3:07:32 PM (14 years ago)
Author:
Sam Hocevar
Message:
  • Made cucul_putchar32() an internal-only function.
  • Changed the line, box, ellipsis etc. prototypes so that they use an UTF-8 string instead of a single character as their last argument.
File:
1 edited

Legend:

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

    r672 r678  
    3434 * \param x2 X coordinate of the lower-right corner of the box.
    3535 * \param y2 Y coordinate of the lower-right corner of the box.
    36  * \param c Character to draw the box outline with.
     36 * \param str UTF-8 string containing the character to use to draw the box.
    3737 * \return void
    3838 */
    39 void cucul_draw_box(cucul_t *qq, int x1, int y1, int x2, int y2, char c)
     39void cucul_draw_box(cucul_t *qq, int x1, int y1, int x2, int y2,
     40                    char const *str)
    4041{
    41     cucul_draw_line(qq, x1, y1, x1, y2, c);
    42     cucul_draw_line(qq, x1, y2, x2, y2, c);
    43     cucul_draw_line(qq, x2, y2, x2, y1, c);
    44     cucul_draw_line(qq, x2, y1, x1, y1, c);
     42    cucul_draw_line(qq, x1, y1, x1, y2, str);
     43    cucul_draw_line(qq, x1, y2, x2, y2, str);
     44    cucul_draw_line(qq, x2, y2, x2, y1, str);
     45    cucul_draw_line(qq, x2, y1, x1, y1, str);
    4546}
    4647
     
    7980    if(y1 >= 0)
    8081        for(x = x1 < 0 ? 1 : x1 + 1; x < x2 && x < xmax; x++)
    81             cucul_putchar(qq, x, y1, '-');
     82            _cucul_putchar32(qq, x, y1, (uint32_t)'-');
    8283
    8384    if(y2 <= ymax)
    8485        for(x = x1 < 0 ? 1 : x1 + 1; x < x2 && x < xmax; x++)
    85             cucul_putchar(qq, x, y2, '-');
     86            _cucul_putchar32(qq, x, y2, (uint32_t)'-');
    8687
    8788    if(x1 >= 0)
    8889        for(y = y1 < 0 ? 1 : y1 + 1; y < y2 && y < ymax; y++)
    89             cucul_putchar(qq, x1, y, '|');
     90            _cucul_putchar32(qq, x1, y, (uint32_t)'|');
    9091
    9192    if(x2 <= xmax)
    9293        for(y = y1 < 0 ? 1 : y1 + 1; y < y2 && y < ymax; y++)
    93             cucul_putchar(qq, x2, y, '|');
     94            _cucul_putchar32(qq, x2, y, (uint32_t)'|');
    9495
    9596    /* Draw corners */
    9697    if(x1 >= 0 && y1 >= 0)
    97         cucul_putchar(qq, x1, y1, ',');
     98        _cucul_putchar32(qq, x1, y1, (uint32_t)',');
    9899
    99100    if(x1 >= 0 && y2 <= ymax)
    100         cucul_putchar(qq, x1, y2, '`');
     101        _cucul_putchar32(qq, x1, y2, (uint32_t)'`');
    101102
    102103    if(x2 <= xmax && y1 >= 0)
    103         cucul_putchar(qq, x2, y1, '.');
     104        _cucul_putchar32(qq, x2, y1, (uint32_t)'.');
    104105
    105106    if(x2 <= xmax && y2 <= ymax)
    106         cucul_putchar(qq, x2, y2, '\'');
     107        _cucul_putchar32(qq, x2, y2, (uint32_t)'\'');
    107108}
    108109
     
    114115 * \param x2 X coordinate of the lower-right corner of the box.
    115116 * \param y2 Y coordinate of the lower-right corner of the box.
    116  * \param c Character to fill the box with.
     117 * \param str UTF-8 string containing the character to fill the box with.
    117118 * \return void
    118119 */
    119 void cucul_fill_box(cucul_t *qq, int x1, int y1, int x2, int y2, char c)
     120void cucul_fill_box(cucul_t *qq, int x1, int y1, int x2, int y2,
     121                    char const *str)
    120122{
    121123    int x, y, xmax, ymax;
     124    uint32_t c;
    122125
    123126    if(x1 > x2)
     
    144147    if(y2 > ymax) y2 = ymax;
    145148
     149    c = _cucul_utf8_to_utf32(str);
     150
    146151    for(y = y1; y <= y2; y++)
    147152        for(x = x1; x <= x2; x++)
    148             cucul_putchar(qq, x, y, c);
     153            _cucul_putchar32(qq, x, y, c);
    149154}
    150155
Note: See TracChangeset for help on using the changeset viewer.