Changeset 1376 for toilet/trunk/tools
- Timestamp:
- Nov 12, 2006, 9:37:58 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
toilet/trunk/tools/caca2tlf.c
r1368 r1376 169 169 static void add_char(unsigned long int ch) 170 170 { 171 cucul_buffer_t *buf; 171 void *buf; 172 unsigned long int len; 172 173 unsigned int x, y, myw, mygw; 173 174 int full = cucul_utf32_is_fullwidth(ch); 174 175 175 176 cucul_set_canvas_size(onechar, full ? 2 : 1, 1); 176 cucul_put char(onechar, 0, 0, ch);177 cucul_put_char(onechar, 0, 0, ch); 177 178 cucul_render_canvas(onechar, f, image, iw, ih, 4 * iw); 178 179 … … 191 192 192 193 if(c >= 0xa0) 193 cucul_put str(out, x, y, "█");194 cucul_put_str(out, x, y, "█"); 194 195 else if(c >= 0x80) 195 cucul_put str(out, x, y, "▓");196 cucul_put_str(out, x, y, "▓"); 196 197 else if(c >= 0x40) 197 cucul_put str(out, x, y, "▒");198 cucul_put_str(out, x, y, "▒"); 198 199 else if(c >= 0x20) 199 cucul_put str(out, x, y, "░");200 cucul_put_str(out, x, y, "░"); 200 201 else 201 cucul_put char(out, x, y, ' ');202 cucul_put_char(out, x, y, ' '); 202 203 } 203 204 break; … … 211 212 uint8_t p2 = image[4 * (x + (y * 2 + 1) * iw) + 2]; 212 213 213 cucul_put str(out, x, y, str[(p1 > 0x80) + 2 * (p2 > 0x80)]);214 cucul_put_str(out, x, y, str[(p1 > 0x80) + 2 * (p2 > 0x80)]); 214 215 } 215 216 break; … … 229 230 uint8_t p4 = image[4 * (x * 2 + 1 + (y * 2 + 1) * iw) + 2]; 230 231 231 cucul_put str(out, x, y, str[(p1 > 0x80) + 2 * (p2 > 0x80) +232 4 * (p3 > 0x80) + 8 * (p4 > 0x80)]);232 cucul_put_str(out, x, y, str[(p1 > 0x80) + 2 * (p2 > 0x80) + 233 4 * (p3 > 0x80) + 8 * (p4 > 0x80)]); 233 234 } 234 235 break; … … 236 237 237 238 cucul_draw_line(out, mygw, 0, mygw, gh - 1, '@'); 238 cucul_put char(out, mygw + 1, gh - 1, '@');239 240 buf = cucul_export_ canvas(out, "utf8");241 fwrite( cucul_get_buffer_data(buf), cucul_get_buffer_size(buf), 1, stdout);242 cucul_free_buffer(buf);239 cucul_put_char(out, mygw + 1, gh - 1, '@'); 240 241 buf = cucul_export_memory(out, "utf8", &len); 242 fwrite(buf, len, 1, stdout); 243 free(buf); 243 244 } 244 245
Note: See TracChangeset
for help on using the changeset viewer.