Changeset 810 for libcaca/trunk/cucul/box.c
 Timestamp:
 Apr 18, 2006, 2:59:07 PM (14 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

libcaca/trunk/cucul/box.c
r773 r810 27 27 /** \brief Draw a box on the canvas using the given character. 28 28 * 29 * \param qqThe handle to the libcucul canvas.29 * \param c The handle to the libcucul canvas. 30 30 * \param x1 X coordinate of the upperleft corner of the box. 31 31 * \param y1 Y coordinate of the upperleft corner of the box. … … 35 35 * \return void 36 36 */ 37 void cucul_draw_box(cucul_ t *qq, int x1, int y1, int x2, int y2,37 void cucul_draw_box(cucul_canvas_t *c, int x1, int y1, int x2, int y2, 38 38 char const *str) 39 39 { 40 cucul_draw_line( qq, x1, y1, x1, y2, str);41 cucul_draw_line( qq, x1, y2, x2, y2, str);42 cucul_draw_line( qq, x2, y2, x2, y1, str);43 cucul_draw_line( qq, x2, y1, x1, y1, str);40 cucul_draw_line(c, x1, y1, x1, y2, str); 41 cucul_draw_line(c, x1, y2, x2, y2, str); 42 cucul_draw_line(c, x2, y2, x2, y1, str); 43 cucul_draw_line(c, x2, y1, x1, y1, str); 44 44 } 45 45 46 46 /** \brief Draw a thin box on the canvas. 47 47 * 48 * \param qqThe handle to the libcucul canvas.48 * \param c The handle to the libcucul canvas. 49 49 * \param x1 X coordinate of the upperleft corner of the box. 50 50 * \param y1 Y coordinate of the upperleft corner of the box. … … 53 53 * \return void 54 54 */ 55 void cucul_draw_thin_box(cucul_ t *qq, int x1, int y1, int x2, int y2)55 void cucul_draw_thin_box(cucul_canvas_t *c, int x1, int y1, int x2, int y2) 56 56 { 57 57 int x, y, xmax, ymax; … … 69 69 } 70 70 71 xmax = qq>width  1;72 ymax = qq>height  1;71 xmax = c>width  1; 72 ymax = c>height  1; 73 73 74 74 if(x2 < 0  y2 < 0  x1 > xmax  y1 > ymax) … … 78 78 if(y1 >= 0) 79 79 for(x = x1 < 0 ? 1 : x1 + 1; x < x2 && x < xmax; x++) 80 _cucul_putchar32( qq, x, y1, (uint32_t)'');80 _cucul_putchar32(c, x, y1, (uint32_t)''); 81 81 82 82 if(y2 <= ymax) 83 83 for(x = x1 < 0 ? 1 : x1 + 1; x < x2 && x < xmax; x++) 84 _cucul_putchar32( qq, x, y2, (uint32_t)'');84 _cucul_putchar32(c, x, y2, (uint32_t)''); 85 85 86 86 if(x1 >= 0) 87 87 for(y = y1 < 0 ? 1 : y1 + 1; y < y2 && y < ymax; y++) 88 _cucul_putchar32( qq, x1, y, (uint32_t)'');88 _cucul_putchar32(c, x1, y, (uint32_t)''); 89 89 90 90 if(x2 <= xmax) 91 91 for(y = y1 < 0 ? 1 : y1 + 1; y < y2 && y < ymax; y++) 92 _cucul_putchar32( qq, x2, y, (uint32_t)'');92 _cucul_putchar32(c, x2, y, (uint32_t)''); 93 93 94 94 /* Draw corners */ 95 95 if(x1 >= 0 && y1 >= 0) 96 _cucul_putchar32( qq, x1, y1, (uint32_t)',');96 _cucul_putchar32(c, x1, y1, (uint32_t)','); 97 97 98 98 if(x1 >= 0 && y2 <= ymax) 99 _cucul_putchar32( qq, x1, y2, (uint32_t)'`');99 _cucul_putchar32(c, x1, y2, (uint32_t)'`'); 100 100 101 101 if(x2 <= xmax && y1 >= 0) 102 _cucul_putchar32( qq, x2, y1, (uint32_t)'.');102 _cucul_putchar32(c, x2, y1, (uint32_t)'.'); 103 103 104 104 if(x2 <= xmax && y2 <= ymax) 105 _cucul_putchar32( qq, x2, y2, (uint32_t)'\'');105 _cucul_putchar32(c, x2, y2, (uint32_t)'\''); 106 106 } 107 107 108 108 /** \brief Fill a box on the canvas using the given character. 109 109 * 110 * \param qqThe handle to the libcucul canvas.110 * \param c The handle to the libcucul canvas. 111 111 * \param x1 X coordinate of the upperleft corner of the box. 112 112 * \param y1 Y coordinate of the upperleft corner of the box. … … 116 116 * \return void 117 117 */ 118 void cucul_fill_box(cucul_ t *qq, int x1, int y1, int x2, int y2,118 void cucul_fill_box(cucul_canvas_t *c, int x1, int y1, int x2, int y2, 119 119 char const *str) 120 120 { 121 121 int x, y, xmax, ymax; 122 uint32_t c ;122 uint32_t ch; 123 123 124 124 if(x1 > x2) … … 134 134 } 135 135 136 xmax = qq>width  1;137 ymax = qq>height  1;136 xmax = c>width  1; 137 ymax = c>height  1; 138 138 139 139 if(x2 < 0  y2 < 0  x1 > xmax  y1 > ymax) … … 145 145 if(y2 > ymax) y2 = ymax; 146 146 147 c = _cucul_utf8_to_utf32(str);147 ch = _cucul_utf8_to_utf32(str); 148 148 149 149 for(y = y1; y <= y2; y++) 150 150 for(x = x1; x <= x2; x++) 151 _cucul_putchar32( qq, x, y, c);151 _cucul_putchar32(c, x, y, ch); 152 152 } 153 153
Note: See TracChangeset
for help on using the changeset viewer.