split is rendered moot by the plugin system: when enabled, binaries do not link directly with libX11 or libGL. I hope this is a step towards more consisteny and clarity.tags/v0.99.beta14
| @@ -1,6 +1,6 @@ | |||
| # $Id$ | |||
| SUBDIRS = kernel cucul caca src examples tests tools csharp cxx python ruby doc | |||
| SUBDIRS = kernel caca src examples tests tools csharp cxx python ruby doc | |||
| DIST_SUBDIRS = $(SUBDIRS) msvc | |||
| EXTRA_DIST = NOTES COPYING.GPL COPYING.LGPL bootstrap build-dos build-kernel build-win32 caca-config.in stubs.h libcaca.spec | |||
| @@ -20,7 +20,7 @@ upload-doc: doc/html FORCE | |||
| scp -r doc/html/* $(webhost):$(webdir)/manual/ | |||
| fonts: tools/makefont | |||
| tools/makefont mono9 "Monospace 9" 96 4 >| $(srcdir)/cucul/mono9.data | |||
| tools/makefont monobold12 "Monospace Bold 12" 96 4 >| $(srcdir)/cucul/monobold12.data | |||
| tools/makefont mono9 "Monospace 9" 96 4 >| $(srcdir)/caca/mono9.data | |||
| tools/makefont monobold12 "Monospace Bold 12" 96 4 >| $(srcdir)/caca/monobold12.data | |||
| FORCE: | |||
| @@ -6,7 +6,7 @@ | |||
| set -x | |||
| set -e | |||
| CFLAGS="-fno-builtin -O2 -I. -I.. -I../cucul/ -Wall" | |||
| CFLAGS="-fno-builtin -O2 -I. -I.. -I../caca/ -Wall" | |||
| CPPFLAGS="-D__KERNEL__ -nostdinc -include kernel/kernel.h" | |||
| LDFLAGS="-nostdlib -Wl,-N -Wl,-Ttext -Wl,100000" | |||
| @@ -18,7 +18,6 @@ LDFLAGS="-nostdlib -Wl,-N -Wl,-Ttext -Wl,100000" | |||
| # We need this. | |||
| make clean | |||
| cd cucul && make && cd .. | |||
| cd caca && make && cd .. | |||
| cd src && make cacademo.o && cd .. | |||
| @@ -28,7 +27,7 @@ cd kernel && | |||
| gcc $CFLAGS $CPPFLAGS -c kernel.c -o kernel.o && | |||
| cd .. | |||
| gcc $LDFLAGS -o src/cacademo kernel/multiboot.o kernel/kernel.o src/cacademo.o caca/.libs/libcaca.a cucul/.libs/libcucul.a | |||
| gcc $LDFLAGS -o src/cacademo kernel/multiboot.o kernel/kernel.o src/cacademo.o caca/.libs/libcaca.a | |||
| objcopy -O binary src/cacademo cacademo.boot | |||
| @@ -67,11 +67,8 @@ do | |||
| --libs | --plugin-libs) | |||
| echo_libs=yes | |||
| ;; | |||
| cucul) | |||
| libs="$libs -lcucul" | |||
| ;; | |||
| caca) | |||
| libs="$libs -lcaca -lcucul" | |||
| libs="$libs -lcaca" | |||
| ;; | |||
| *) | |||
| usage 1 1>&2 | |||
| @@ -82,7 +79,7 @@ done | |||
| if test "$libs" = "" | |||
| then | |||
| libs="-lcaca -lcucul" | |||
| libs="-lcaca" | |||
| fi | |||
| if test "$local_prefix" = "yes" | |||
| @@ -1,24 +1,41 @@ | |||
| # $Id$ | |||
| EXTRA_DIST = caca.pc.in | |||
| DISTCLEANFILES = caca.pc | |||
| EXTRA_DIST = caca_types.h.in caca.pc.in mono9.data monobold12.data | |||
| DISTCLEANFILES = caca_types.h caca.pc | |||
| AM_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/cucul -I../cucul \ | |||
| -DPLUGINDIR=\"$(plugindir)\" | |||
| AM_CPPFLAGS = -I$(top_srcdir) -DPLUGINDIR=\"$(plugindir)\" | |||
| pkgconfig_DATA = caca.pc | |||
| pkgconfigdir = $(libdir)/pkgconfig | |||
| include_HEADERS = caca.h caca0.h | |||
| include_HEADERS = caca.h caca_types.h caca0.h | |||
| lib_LTLIBRARIES = libcaca.la | |||
| libcaca_la_SOURCES = \ | |||
| caca.c \ | |||
| caca.h \ | |||
| caca_types.h \ | |||
| caca_internals.h \ | |||
| caca0.c \ | |||
| caca0.h \ | |||
| canvas.c \ | |||
| string.c \ | |||
| legacy.c \ | |||
| transform.c \ | |||
| charset.c \ | |||
| attr.c \ | |||
| line.c \ | |||
| box.c \ | |||
| conic.c \ | |||
| triangle.c \ | |||
| frame.c \ | |||
| dither.c \ | |||
| font.c \ | |||
| import.c \ | |||
| export.c \ | |||
| file.c \ | |||
| figfont.c \ | |||
| graphics.c \ | |||
| event.c \ | |||
| time.c \ | |||
| @@ -31,9 +48,13 @@ libcaca_la_SOURCES = \ | |||
| $(cocoa_source) \ | |||
| $(extra_source) \ | |||
| $(NULL) | |||
| libcaca_la_DEPENDENCIES = \ | |||
| mono9.data \ | |||
| monobold12.data \ | |||
| $(NULL) | |||
| libcaca_la_CPPFLAGS = $(AM_CPPFLAGS) @CACA_CFLAGS@ | |||
| libcaca_la_LDFLAGS = -no-undefined -version-number @LT_VERSION@ | |||
| libcaca_la_LIBADD = ../cucul/libcucul.la @CACA_LIBS@ | |||
| libcaca_la_LIBADD = @CACA_LIBS@ $(ZLIB_LIBS) | |||
| if USE_PLUGINS | |||
| plugin_LTLIBRARIES = libx11_plugin.la libgl_plugin.la | |||
| @@ -42,12 +63,12 @@ plugindir = $(libdir)/caca | |||
| libx11_plugin_la_SOURCES = driver_x11.c | |||
| libx11_plugin_la_CPPFLAGS = $(AM_CPPFLAGS) $(X11_CFLAGS) | |||
| libx11_plugin_la_LDFLAGS = -no-undefined -module -no-version | |||
| libx11_plugin_la_LIBADD = libcaca.la ../cucul/libcucul.la $(X11_LIBS) | |||
| libx11_plugin_la_LIBADD = libcaca.la $(X11_LIBS) | |||
| libgl_plugin_la_SOURCES = driver_gl.c | |||
| libgl_plugin_la_CPPFLAGS = $(AM_CPPFLAGS) $(GL_CFLAGS) #$(FTGL_CFLAGS) | |||
| libgl_plugin_la_LDFLAGS = -no-undefined -module -no-version | |||
| libgl_plugin_la_LIBADD = libcaca.la ../cucul/libcucul.la $(GL_LIBS) #$(FTGL_LIBS) | |||
| libgl_plugin_la_LIBADD = libcaca.la $(GL_LIBS) #$(FTGL_LIBS) | |||
| else | |||
| extra_source = driver_x11.c driver_gl.c | |||
| endif | |||
| @@ -1,5 +1,5 @@ | |||
| /* | |||
| * libcucul Canvas for ultrafast compositing of Unicode letters | |||
| * libcaca Colour ASCII-Art library | |||
| * Copyright (c) 2002-2006 Sam Hocevar <sam@zoy.org> | |||
| * All Rights Reserved | |||
| * | |||
| @@ -19,8 +19,8 @@ | |||
| #include "config.h" | |||
| #include "cucul.h" | |||
| #include "cucul_internals.h" | |||
| #include "caca.h" | |||
| #include "caca_internals.h" | |||
| static uint8_t nearest_ansi(uint16_t); | |||
| @@ -42,7 +42,7 @@ static const uint16_t ansitab14[16] = | |||
| /** \brief Get the text attribute at the given coordinates. | |||
| * | |||
| * Get the internal \e libcucul attribute value of the character at the | |||
| * Get the internal \e libcaca attribute value of the character at the | |||
| * given coordinates. The attribute value has 32 significant bits, | |||
| * organised as follows from MSB to LSB: | |||
| * - 3 bits for the background alpha | |||
| @@ -60,12 +60,12 @@ static const uint16_t ansitab14[16] = | |||
| * | |||
| * This function never fails. | |||
| * | |||
| * \param cv A handle to the libcucul canvas. | |||
| * \param cv A handle to the libcaca canvas. | |||
| * \param x X coordinate. | |||
| * \param y Y coordinate. | |||
| * \return The requested attribute. | |||
| */ | |||
| uint32_t cucul_get_attr(cucul_canvas_t const *cv, int x, int y) | |||
| uint32_t caca_get_attr(caca_canvas_t const *cv, int x, int y) | |||
| { | |||
| if(x < 0 || x >= (int)cv->width || y < 0 || y >= (int)cv->height) | |||
| return cv->curattr; | |||
| @@ -82,21 +82,21 @@ uint32_t cucul_get_attr(cucul_canvas_t const *cv, int x, int y) | |||
| * will use this attribute. | |||
| * | |||
| * The value of \e attr is either: | |||
| * - a 32-bit integer as returned by cucul_get_attr(), in which case it | |||
| * - a 32-bit integer as returned by caca_get_attr(), in which case it | |||
| * also contains colour information, | |||
| * - a combination (bitwise OR) of style values (\e CUCUL_UNDERLINE, | |||
| * \e CUCUL_BLINK, \e CUCUL_BOLD and \e CUCUL_ITALICS), in which case | |||
| * - a combination (bitwise OR) of style values (\e CACA_UNDERLINE, | |||
| * \e CACA_BLINK, \e CACA_BOLD and \e CACA_ITALICS), in which case | |||
| * setting the attribute does not modify the current colour information. | |||
| * | |||
| * To retrieve the current attribute value, use cucul_get_attr(-1,-1). | |||
| * To retrieve the current attribute value, use caca_get_attr(-1,-1). | |||
| * | |||
| * This function never fails. | |||
| * | |||
| * \param cv A handle to the libcucul canvas. | |||
| * \param cv A handle to the libcaca canvas. | |||
| * \param attr The requested attribute value. | |||
| * \return This function always returns 0. | |||
| */ | |||
| int cucul_set_attr(cucul_canvas_t *cv, uint32_t attr) | |||
| int caca_set_attr(caca_canvas_t *cv, uint32_t attr) | |||
| { | |||
| if(attr < 0x00000010) | |||
| attr = (cv->curattr & 0xfffffff0) | attr; | |||
| @@ -113,21 +113,21 @@ int cucul_set_attr(cucul_canvas_t *cv, uint32_t attr) | |||
| * cells' attributes are replaced. | |||
| * | |||
| * The value of \e attr is either: | |||
| * - a 32-bit integer as returned by cucul_get_attr(), in which case it | |||
| * - a 32-bit integer as returned by caca_get_attr(), in which case it | |||
| * also contains colour information, | |||
| * - a combination (bitwise OR) of style values (\e CUCUL_UNDERLINE, | |||
| * \e CUCUL_BLINK, \e CUCUL_BOLD and \e CUCUL_ITALICS), in which case | |||
| * - a combination (bitwise OR) of style values (\e CACA_UNDERLINE, | |||
| * \e CACA_BLINK, \e CACA_BOLD and \e CACA_ITALICS), in which case | |||
| * setting the attribute does not modify the current colour information. | |||
| * | |||
| * This function never fails. | |||
| * | |||
| * \param cv A handle to the libcucul canvas. | |||
| * \param cv A handle to the libcaca canvas. | |||
| * \param x X coordinate. | |||
| * \param y Y coordinate. | |||
| * \param attr The requested attribute value. | |||
| * \return This function always returns 0. | |||
| */ | |||
| int cucul_put_attr(cucul_canvas_t *cv, int x, int y, uint32_t attr) | |||
| int caca_put_attr(caca_canvas_t *cv, int x, int y, uint32_t attr) | |||
| { | |||
| uint32_t *curattr, *curchar; | |||
| @@ -142,9 +142,9 @@ int cucul_put_attr(cucul_canvas_t *cv, int x, int y, uint32_t attr) | |||
| else | |||
| curattr[0] = attr; | |||
| if(x && curchar[0] == CUCUL_MAGIC_FULLWIDTH) | |||
| if(x && curchar[0] == CACA_MAGIC_FULLWIDTH) | |||
| curattr[-1] = curattr[0]; | |||
| else if(x + 1 < (int)cv->width && curchar[1] == CUCUL_MAGIC_FULLWIDTH) | |||
| else if(x + 1 < (int)cv->width && curchar[1] == CACA_MAGIC_FULLWIDTH) | |||
| curattr[1] = curattr[0]; | |||
| return 0; | |||
| @@ -156,18 +156,18 @@ int cucul_put_attr(cucul_canvas_t *cv, int x, int y, uint32_t attr) | |||
| * as caca_printf() and graphical primitive functions such as caca_draw_line() | |||
| * will use these attributes. | |||
| * | |||
| * Color values are those defined in cucul.h, such as CUCUL_RED | |||
| * or CUCUL_TRANSPARENT. | |||
| * Color values are those defined in caca.h, such as CACA_RED | |||
| * or CACA_TRANSPARENT. | |||
| * | |||
| * If an error occurs, 0 is returned and \b errno is set accordingly: | |||
| * - \c EINVAL At least one of the colour values is invalid. | |||
| * | |||
| * \param cv A handle to the libcucul canvas. | |||
| * \param cv A handle to the libcaca canvas. | |||
| * \param fg The requested ANSI foreground colour. | |||
| * \param bg The requested ANSI background colour. | |||
| * \return 0 in case of success, -1 if an error occurred. | |||
| */ | |||
| int cucul_set_color_ansi(cucul_canvas_t *cv, uint8_t fg, uint8_t bg) | |||
| int caca_set_color_ansi(caca_canvas_t *cv, uint8_t fg, uint8_t bg) | |||
| { | |||
| uint32_t attr; | |||
| @@ -195,12 +195,12 @@ int cucul_set_color_ansi(cucul_canvas_t *cv, uint8_t fg, uint8_t bg) | |||
| * | |||
| * This function never fails. | |||
| * | |||
| * \param cv A handle to the libcucul canvas. | |||
| * \param cv A handle to the libcaca canvas. | |||
| * \param fg The requested ARGB foreground colour. | |||
| * \param bg The requested ARGB background colour. | |||
| * \return This function always returns 0. | |||
| */ | |||
| int cucul_set_color_argb(cucul_canvas_t *cv, uint16_t fg, uint16_t bg) | |||
| int caca_set_color_argb(caca_canvas_t *cv, uint16_t fg, uint16_t bg) | |||
| { | |||
| uint32_t attr; | |||
| @@ -226,9 +226,9 @@ int cucul_set_color_argb(cucul_canvas_t *cv, uint16_t fg, uint16_t bg) | |||
| * 4 bits are the foreground colour. | |||
| * | |||
| * If the attribute has ARGB colours, the nearest colour is used. Special | |||
| * attributes such as \e CUCUL_DEFAULT and \e CUCUL_TRANSPARENT are not | |||
| * handled and are both replaced with \e CUCUL_LIGHTGRAY for the foreground | |||
| * colour and \e CUCUL_BLACK for the background colour. | |||
| * attributes such as \e CACA_DEFAULT and \e CACA_TRANSPARENT are not | |||
| * handled and are both replaced with \e CACA_LIGHTGRAY for the foreground | |||
| * colour and \e CACA_BLACK for the background colour. | |||
| * | |||
| * This function never fails. If the attribute value is outside the expected | |||
| * 32-bit range, higher order bits are simply ignored. | |||
| @@ -236,21 +236,21 @@ int cucul_set_color_argb(cucul_canvas_t *cv, uint16_t fg, uint16_t bg) | |||
| * \param attr The requested attribute value. | |||
| * \return The corresponding DOS ANSI value. | |||
| */ | |||
| uint8_t cucul_attr_to_ansi(uint32_t attr) | |||
| uint8_t caca_attr_to_ansi(uint32_t attr) | |||
| { | |||
| uint8_t fg = nearest_ansi((attr >> 4) & 0x3fff); | |||
| uint8_t bg = nearest_ansi(attr >> 18); | |||
| return (fg < 0x10 ? fg : CUCUL_LIGHTGRAY) | |||
| | ((bg < 0x10 ? bg : CUCUL_BLACK) << 4); | |||
| return (fg < 0x10 ? fg : CACA_LIGHTGRAY) | |||
| | ((bg < 0x10 ? bg : CACA_BLACK) << 4); | |||
| } | |||
| /** \brief Get ANSI foreground information from attribute. | |||
| * | |||
| * Get the ANSI foreground colour value for a given attribute. The returned | |||
| * value is either one of the \e CUCUL_RED, \e CUCUL_BLACK etc. predefined | |||
| * colours, or the special value \e CUCUL_DEFAULT meaning the media's | |||
| * default foreground value, or the special value \e CUCUL_TRANSPARENT. | |||
| * value is either one of the \e CACA_RED, \e CACA_BLACK etc. predefined | |||
| * colours, or the special value \e CACA_DEFAULT meaning the media's | |||
| * default foreground value, or the special value \e CACA_TRANSPARENT. | |||
| * | |||
| * If the attribute has ARGB colours, the nearest colour is returned. | |||
| * | |||
| @@ -260,7 +260,7 @@ uint8_t cucul_attr_to_ansi(uint32_t attr) | |||
| * \param attr The requested attribute value. | |||
| * \return The corresponding ANSI foreground value. | |||
| */ | |||
| uint8_t cucul_attr_to_ansi_fg(uint32_t attr) | |||
| uint8_t caca_attr_to_ansi_fg(uint32_t attr) | |||
| { | |||
| return nearest_ansi(((uint16_t)attr >> 4) & 0x3fff); | |||
| } | |||
| @@ -268,9 +268,9 @@ uint8_t cucul_attr_to_ansi_fg(uint32_t attr) | |||
| /** \brief Get ANSI background information from attribute. | |||
| * | |||
| * Get the ANSI background colour value for a given attribute. The returned | |||
| * value is either one of the \e CUCUL_RED, \e CUCUL_BLACK etc. predefined | |||
| * colours, or the special value \e CUCUL_DEFAULT meaning the media's | |||
| * default background value, or the special value \e CUCUL_TRANSPARENT. | |||
| * value is either one of the \e CACA_RED, \e CACA_BLACK etc. predefined | |||
| * colours, or the special value \e CACA_DEFAULT meaning the media's | |||
| * default background value, or the special value \e CACA_TRANSPARENT. | |||
| * | |||
| * If the attribute has ARGB colours, the nearest colour is returned. | |||
| * | |||
| @@ -280,7 +280,7 @@ uint8_t cucul_attr_to_ansi_fg(uint32_t attr) | |||
| * \param attr The requested attribute value. | |||
| * \return The corresponding ANSI background value. | |||
| */ | |||
| uint8_t cucul_attr_to_ansi_bg(uint32_t attr) | |||
| uint8_t caca_attr_to_ansi_bg(uint32_t attr) | |||
| { | |||
| return nearest_ansi(attr >> 18); | |||
| } | |||
| @@ -300,18 +300,18 @@ uint8_t cucul_attr_to_ansi_bg(uint32_t attr) | |||
| * \param attr The requested attribute value. | |||
| * \return The corresponding 12-bit RGB foreground value. | |||
| */ | |||
| uint16_t cucul_attr_to_rgb12_fg(uint32_t attr) | |||
| uint16_t caca_attr_to_rgb12_fg(uint32_t attr) | |||
| { | |||
| uint16_t fg = (attr >> 4) & 0x3fff; | |||
| if(fg < (0x10 | 0x40)) | |||
| return ansitab16[fg ^ 0x40] & 0x0fff; | |||
| if(fg == (CUCUL_DEFAULT | 0x40)) | |||
| return ansitab16[CUCUL_LIGHTGRAY] & 0x0fff; | |||
| if(fg == (CACA_DEFAULT | 0x40)) | |||
| return ansitab16[CACA_LIGHTGRAY] & 0x0fff; | |||
| if(fg == (CUCUL_TRANSPARENT | 0x40)) | |||
| return ansitab16[CUCUL_LIGHTGRAY] & 0x0fff; | |||
| if(fg == (CACA_TRANSPARENT | 0x40)) | |||
| return ansitab16[CACA_LIGHTGRAY] & 0x0fff; | |||
| return (fg << 1) & 0x0fff; | |||
| } | |||
| @@ -331,18 +331,18 @@ uint16_t cucul_attr_to_rgb12_fg(uint32_t attr) | |||
| * \param attr The requested attribute value. | |||
| * \return The corresponding 12-bit RGB background value. | |||
| */ | |||
| uint16_t cucul_attr_to_rgb12_bg(uint32_t attr) | |||
| uint16_t caca_attr_to_rgb12_bg(uint32_t attr) | |||
| { | |||
| uint16_t bg = attr >> 18; | |||
| if(bg < (0x10 | 0x40)) | |||
| return ansitab16[bg ^ 0x40] & 0x0fff; | |||
| if(bg == (CUCUL_DEFAULT | 0x40)) | |||
| return ansitab16[CUCUL_BLACK] & 0x0fff; | |||
| if(bg == (CACA_DEFAULT | 0x40)) | |||
| return ansitab16[CACA_BLACK] & 0x0fff; | |||
| if(bg == (CUCUL_TRANSPARENT | 0x40)) | |||
| return ansitab16[CUCUL_BLACK] & 0x0fff; | |||
| if(bg == (CACA_TRANSPARENT | 0x40)) | |||
| return ansitab16[CACA_BLACK] & 0x0fff; | |||
| return (bg << 1) & 0x0fff; | |||
| } | |||
| @@ -366,16 +366,16 @@ uint16_t cucul_attr_to_rgb12_bg(uint32_t attr) | |||
| * \param attr The requested attribute value. | |||
| * \param argb An array of 8-bit integers. | |||
| */ | |||
| void cucul_attr_to_argb64(uint32_t attr, uint8_t argb[8]) | |||
| void caca_attr_to_argb64(uint32_t attr, uint8_t argb[8]) | |||
| { | |||
| uint16_t fg = (attr >> 4) & 0x3fff; | |||
| uint16_t bg = attr >> 18; | |||
| if(bg < (0x10 | 0x40)) | |||
| bg = ansitab16[bg ^ 0x40]; | |||
| else if(bg == (CUCUL_DEFAULT | 0x40)) | |||
| bg = ansitab16[CUCUL_BLACK]; | |||
| else if(bg == (CUCUL_TRANSPARENT | 0x40)) | |||
| else if(bg == (CACA_DEFAULT | 0x40)) | |||
| bg = ansitab16[CACA_BLACK]; | |||
| else if(bg == (CACA_TRANSPARENT | 0x40)) | |||
| bg = 0x0fff; | |||
| else | |||
| bg = ((bg << 2) & 0xf000) | ((bg << 1) & 0x0fff); | |||
| @@ -387,9 +387,9 @@ void cucul_attr_to_argb64(uint32_t attr, uint8_t argb[8]) | |||
| if(fg < (0x10 | 0x40)) | |||
| fg = ansitab16[fg ^ 0x40]; | |||
| else if(fg == (CUCUL_DEFAULT | 0x40)) | |||
| fg = ansitab16[CUCUL_LIGHTGRAY]; | |||
| else if(fg == (CUCUL_TRANSPARENT | 0x40)) | |||
| else if(fg == (CACA_DEFAULT | 0x40)) | |||
| fg = ansitab16[CACA_LIGHTGRAY]; | |||
| else if(fg == (CACA_TRANSPARENT | 0x40)) | |||
| fg = 0x0fff; | |||
| else | |||
| fg = ((fg << 2) & 0xf000) | ((fg << 1) & 0x0fff); | |||
| @@ -411,13 +411,13 @@ static uint8_t nearest_ansi(uint16_t argb14) | |||
| if(argb14 < (0x10 | 0x40)) | |||
| return argb14 ^ 0x40; | |||
| if(argb14 == (CUCUL_DEFAULT | 0x40) || argb14 == (CUCUL_TRANSPARENT | 0x40)) | |||
| if(argb14 == (CACA_DEFAULT | 0x40) || argb14 == (CACA_TRANSPARENT | 0x40)) | |||
| return argb14 ^ 0x40; | |||
| if(argb14 < 0x0fff) /* too transparent */ | |||
| return CUCUL_TRANSPARENT; | |||
| return CACA_TRANSPARENT; | |||
| best = CUCUL_DEFAULT; | |||
| best = CACA_DEFAULT; | |||
| dist = 0x3fff; | |||
| for(i = 0; i < 16; i++) | |||
| { | |||
| @@ -451,13 +451,13 @@ static uint8_t nearest_ansi(uint16_t argb14) | |||
| | ((uint32_t)((i & 0x0f0) >> 4) * 0x001100) \ | |||
| | ((uint32_t)(i & 0x00f) * 0x000011)) | |||
| uint32_t _cucul_attr_to_rgb24fg(uint32_t attr) | |||
| uint32_t _caca_attr_to_rgb24fg(uint32_t attr) | |||
| { | |||
| return RGB12TO24(cucul_attr_to_rgb12_fg(attr)); | |||
| return RGB12TO24(caca_attr_to_rgb12_fg(attr)); | |||
| } | |||
| uint32_t _cucul_attr_to_rgb24bg(uint32_t attr) | |||
| uint32_t _caca_attr_to_rgb24bg(uint32_t attr) | |||
| { | |||
| return RGB12TO24(cucul_attr_to_rgb12_bg(attr)); | |||
| return RGB12TO24(caca_attr_to_rgb12_bg(attr)); | |||
| } | |||
| @@ -1,5 +1,5 @@ | |||
| /* | |||
| * libcucul Canvas for ultrafast compositing of Unicode letters | |||
| * libcaca Colour ASCII-Art library | |||
| * Copyright (c) 2002-2006 Sam Hocevar <sam@zoy.org> | |||
| * All Rights Reserved | |||
| * | |||
| @@ -22,14 +22,14 @@ | |||
| # include <stdlib.h> | |||
| #endif | |||
| #include "cucul.h" | |||
| #include "cucul_internals.h" | |||
| #include "caca.h" | |||
| #include "caca_internals.h" | |||
| /** \brief Draw a box on the canvas using the given character. | |||
| * | |||
| * This function never fails. | |||
| * | |||
| * \param cv The handle to the libcucul canvas. | |||
| * \param cv The handle to the libcaca canvas. | |||
| * \param x X coordinate of the upper-left corner of the box. | |||
| * \param y Y coordinate of the upper-left corner of the box. | |||
| * \param w Width of the box. | |||
| @@ -37,15 +37,15 @@ | |||
| * \param ch UTF-32 character to be used to draw the box. | |||
| * \return This function always returns 0. | |||
| */ | |||
| int cucul_draw_box(cucul_canvas_t *cv, int x, int y, int w, int h, uint32_t ch) | |||
| int caca_draw_box(caca_canvas_t *cv, int x, int y, int w, int h, uint32_t ch) | |||
| { | |||
| int x2 = x + w - 1; | |||
| int y2 = y + h - 1; | |||
| cucul_draw_line(cv, x, y, x, y2, ch); | |||
| cucul_draw_line(cv, x, y2, x2, y2, ch); | |||
| cucul_draw_line(cv, x2, y2, x2, y, ch); | |||
| cucul_draw_line(cv, x2, y, x, y, ch); | |||
| caca_draw_line(cv, x, y, x, y2, ch); | |||
| caca_draw_line(cv, x, y2, x2, y2, ch); | |||
| caca_draw_line(cv, x2, y2, x2, y, ch); | |||
| caca_draw_line(cv, x2, y, x, y, ch); | |||
| return 0; | |||
| } | |||
| @@ -54,14 +54,14 @@ int cucul_draw_box(cucul_canvas_t *cv, int x, int y, int w, int h, uint32_t ch) | |||
| * | |||
| * This function never fails. | |||
| * | |||
| * \param cv The handle to the libcucul canvas. | |||
| * \param cv The handle to the libcaca canvas. | |||
| * \param x X coordinate of the upper-left corner of the box. | |||
| * \param y Y coordinate of the upper-left corner of the box. | |||
| * \param w Width of the box. | |||
| * \param h Height of the box. | |||
| * \return This function always returns 0. | |||
| */ | |||
| int cucul_draw_thin_box(cucul_canvas_t *cv, int x, int y, int w, int h) | |||
| int caca_draw_thin_box(caca_canvas_t *cv, int x, int y, int w, int h) | |||
| { | |||
| int i, j, xmax, ymax; | |||
| @@ -89,25 +89,25 @@ int cucul_draw_thin_box(cucul_canvas_t *cv, int x, int y, int w, int h) | |||
| /* Draw edges */ | |||
| if(y >= 0) | |||
| for(i = x < 0 ? 1 : x + 1; i < x2 && i < xmax; i++) | |||
| cucul_put_char(cv, i, y, '-'); | |||
| caca_put_char(cv, i, y, '-'); | |||
| if(y2 <= ymax) | |||
| for(i = x < 0 ? 1 : x + 1; i < x2 && i < xmax; i++) | |||
| cucul_put_char(cv, i, y2, '-'); | |||
| caca_put_char(cv, i, y2, '-'); | |||
| if(x >= 0) | |||
| for(j = y < 0 ? 1 : y + 1; j < y2 && j < ymax; j++) | |||
| cucul_put_char(cv, x, j, '|'); | |||
| caca_put_char(cv, x, j, '|'); | |||
| if(x2 <= xmax) | |||
| for(j = y < 0 ? 1 : y + 1; j < y2 && j < ymax; j++) | |||
| cucul_put_char(cv, x2, j, '|'); | |||
| caca_put_char(cv, x2, j, '|'); | |||
| /* Draw corners */ | |||
| cucul_put_char(cv, x, y, ','); | |||
| cucul_put_char(cv, x, y2, '`'); | |||
| cucul_put_char(cv, x2, y, '.'); | |||
| cucul_put_char(cv, x2, y2, '\''); | |||
| caca_put_char(cv, x, y, ','); | |||
| caca_put_char(cv, x, y2, '`'); | |||
| caca_put_char(cv, x2, y, '.'); | |||
| caca_put_char(cv, x2, y2, '\''); | |||
| return 0; | |||
| } | |||
| @@ -116,14 +116,14 @@ int cucul_draw_thin_box(cucul_canvas_t *cv, int x, int y, int w, int h) | |||
| * | |||
| * This function never fails. | |||
| * | |||
| * \param cv The handle to the libcucul canvas. | |||
| * \param cv The handle to the libcaca canvas. | |||
| * \param x X coordinate of the upper-left corner of the box. | |||
| * \param y Y coordinate of the upper-left corner of the box. | |||
| * \param w Width of the box. | |||
| * \param h Height of the box. | |||
| * \return This function always returns 0. | |||
| */ | |||
| int cucul_draw_cp437_box(cucul_canvas_t *cv, int x, int y, int w, int h) | |||
| int caca_draw_cp437_box(caca_canvas_t *cv, int x, int y, int w, int h) | |||
| { | |||
| int i, j, xmax, ymax; | |||
| @@ -151,25 +151,25 @@ int cucul_draw_cp437_box(cucul_canvas_t *cv, int x, int y, int w, int h) | |||
| /* Draw edges */ | |||
| if(y >= 0) | |||
| for(i = x < 0 ? 1 : x + 1; i < x2 && i < xmax; i++) | |||
| cucul_put_char(cv, i, y, 0x2500); /* ─ */ | |||
| caca_put_char(cv, i, y, 0x2500); /* ─ */ | |||
| if(y2 <= ymax) | |||
| for(i = x < 0 ? 1 : x + 1; i < x2 && i < xmax; i++) | |||
| cucul_put_char(cv, i, y2, 0x2500); /* ─ */ | |||
| caca_put_char(cv, i, y2, 0x2500); /* ─ */ | |||
| if(x >= 0) | |||
| for(j = y < 0 ? 1 : y + 1; j < y2 && j < ymax; j++) | |||
| cucul_put_char(cv, x, j, 0x2502); /* │ */ | |||
| caca_put_char(cv, x, j, 0x2502); /* │ */ | |||
| if(x2 <= xmax) | |||
| for(j = y < 0 ? 1 : y + 1; j < y2 && j < ymax; j++) | |||
| cucul_put_char(cv, x2, j, 0x2502); /* │ */ | |||
| caca_put_char(cv, x2, j, 0x2502); /* │ */ | |||
| /* Draw corners */ | |||
| cucul_put_char(cv, x, y, 0x250c); /* ┌ */ | |||
| cucul_put_char(cv, x, y2, 0x2514); /* └ */ | |||
| cucul_put_char(cv, x2, y, 0x2510); /* ┐ */ | |||
| cucul_put_char(cv, x2, y2, 0x2518); /* ┘ */ | |||
| caca_put_char(cv, x, y, 0x250c); /* ┌ */ | |||
| caca_put_char(cv, x, y2, 0x2514); /* └ */ | |||
| caca_put_char(cv, x2, y, 0x2510); /* ┐ */ | |||
| caca_put_char(cv, x2, y2, 0x2518); /* ┘ */ | |||
| return 0; | |||
| } | |||
| @@ -178,7 +178,7 @@ int cucul_draw_cp437_box(cucul_canvas_t *cv, int x, int y, int w, int h) | |||
| * | |||
| * This function never fails. | |||
| * | |||
| * \param cv The handle to the libcucul canvas. | |||
| * \param cv The handle to the libcaca canvas. | |||
| * \param x X coordinate of the upper-left corner of the box. | |||
| * \param y Y coordinate of the upper-left corner of the box. | |||
| * \param w Width of the box. | |||
| @@ -186,7 +186,7 @@ int cucul_draw_cp437_box(cucul_canvas_t *cv, int x, int y, int w, int h) | |||
| * \param ch UTF-32 character to be used to draw the box. | |||
| * \return This function always returns 0. | |||
| */ | |||
| int cucul_fill_box(cucul_canvas_t *cv, int x, int y, int w, int h, | |||
| int caca_fill_box(caca_canvas_t *cv, int x, int y, int w, int h, | |||
| uint32_t ch) | |||
| { | |||
| int i, j, xmax, ymax; | |||
| @@ -219,7 +219,7 @@ int cucul_fill_box(cucul_canvas_t *cv, int x, int y, int w, int h, | |||
| for(j = y; j <= y2; j++) | |||
| for(i = x; i <= x2; i++) | |||
| cucul_put_char(cv, i, j, ch); | |||
| caca_put_char(cv, i, j, ch); | |||
| return 0; | |||
| } | |||
| @@ -31,7 +31,6 @@ | |||
| # endif | |||
| #endif | |||
| #include "cucul.h" | |||
| #include "caca.h" | |||
| #include "caca_internals.h" | |||
| @@ -48,14 +47,14 @@ static int caca_select_driver(caca_display_t *, char const *); | |||
| static int caca_plugin_install(caca_display_t *, char const *); | |||
| #endif | |||
| /** \brief Attach a caca graphical context to a cucul canvas. | |||
| /** \brief Attach a caca graphical context to a caca canvas. | |||
| * | |||
| * Create a graphical context using device-dependent features (ncurses for | |||
| * terminals, an X11 window, a DOS command window...) that attaches to a | |||
| * libcucul canvas. Everything that gets drawn in the libcucul canvas can | |||
| * libcaca canvas. Everything that gets drawn in the libcaca canvas can | |||
| * then be displayed by the libcaca driver. | |||
| * | |||
| * If no cucul canvas is provided, a new one is created. Its handle can be | |||
| * If no caca canvas is provided, a new one is created. Its handle can be | |||
| * retrieved using caca_get_canvas() and it is automatically destroyed when | |||
| * caca_free_display() is called. | |||
| * | |||
| @@ -65,22 +64,22 @@ static int caca_plugin_install(caca_display_t *, char const *); | |||
| * - \c ENOMEM Not enough memory. | |||
| * - \c ENODEV Graphical device could not be initialised. | |||
| * | |||
| * \param cv The cucul canvas or NULL to create a canvas automatically. | |||
| * \param cv The caca canvas or NULL to create a canvas automatically. | |||
| * \return The caca graphical context or NULL if an error occurred. | |||
| */ | |||
| caca_display_t * caca_create_display(cucul_canvas_t *cv) | |||
| caca_display_t * caca_create_display(caca_canvas_t *cv) | |||
| { | |||
| return caca_create_display_with_driver(cv, NULL); | |||
| } | |||
| /** \brief Attach a specific caca graphical context to a cucul canvas. | |||
| /** \brief Attach a specific caca graphical context to a caca canvas. | |||
| * | |||
| * Create a graphical context using device-dependent features (ncurses for | |||
| * terminals, an X11 window, a DOS command window...) that attaches to a | |||
| * libcucul canvas. Everything that gets drawn in the libcucul canvas can | |||
| * libcaca canvas. Everything that gets drawn in the libcaca canvas can | |||
| * then be displayed by the libcaca driver. | |||
| * | |||
| * If no cucul canvas is provided, a new one is created. Its handle can be | |||
| * If no caca canvas is provided, a new one is created. Its handle can be | |||
| * retrieved using caca_get_canvas() and it is automatically destroyed when | |||
| * caca_free_display() is called. | |||
| * | |||
| @@ -93,12 +92,12 @@ caca_display_t * caca_create_display(cucul_canvas_t *cv) | |||
| * - \c ENOMEM Not enough memory. | |||
| * - \c ENODEV Graphical device could not be initialised. | |||
| * | |||
| * \param cv The cucul canvas or NULL to create a canvas automatically. | |||
| * \param cv The caca canvas or NULL to create a canvas automatically. | |||
| * \param driver A string describing the desired output driver or NULL to | |||
| * choose the best driver automatically. | |||
| * \return The caca graphical context or NULL if an error occurred. | |||
| */ | |||
| caca_display_t * caca_create_display_with_driver(cucul_canvas_t *cv, | |||
| caca_display_t * caca_create_display_with_driver(caca_canvas_t *cv, | |||
| char const *driver) | |||
| { | |||
| caca_display_t *dp = malloc(sizeof(caca_display_t)); | |||
| @@ -111,15 +110,15 @@ caca_display_t * caca_create_display_with_driver(cucul_canvas_t *cv, | |||
| if((dp->autorelease = (cv == NULL))) | |||
| { | |||
| cv = cucul_create_canvas(0, 0); | |||
| cv = caca_create_canvas(0, 0); | |||
| } | |||
| dp->cv = cv; | |||
| if(cucul_manage_canvas(cv, (int (*)(void *))caca_can_resize, (void *)dp)) | |||
| if(caca_manage_canvas(cv, (int (*)(void *))caca_can_resize, (void *)dp)) | |||
| { | |||
| if(dp->autorelease) | |||
| cucul_free_canvas(dp->cv); | |||
| caca_free_canvas(dp->cv); | |||
| free(dp); | |||
| seterrno(EBUSY); | |||
| return NULL; | |||
| @@ -127,9 +126,9 @@ caca_display_t * caca_create_display_with_driver(cucul_canvas_t *cv, | |||
| if(caca_install_driver(dp, driver)) | |||
| { | |||
| cucul_unmanage_canvas(cv, (int (*)(void *))caca_can_resize, (void *)dp); | |||
| caca_unmanage_canvas(cv, (int (*)(void *))caca_can_resize, (void *)dp); | |||
| if(dp->autorelease) | |||
| cucul_free_canvas(dp->cv); | |||
| caca_free_canvas(dp->cv); | |||
| free(dp); | |||
| seterrno(ENODEV); | |||
| return NULL; | |||
| @@ -223,13 +222,13 @@ int caca_set_display_driver(caca_display_t *dp, char const *driver) | |||
| return 0; | |||
| } | |||
| /** \brief Detach a caca graphical context from a cucul backend context. | |||
| /** \brief Detach a caca graphical context from a caca backend context. | |||
| * | |||
| * Detach a graphical context from its cucul backend and destroy it. The | |||
| * libcucul canvas continues to exist and other graphical contexts can be | |||
| * Detach a graphical context from its caca backend and destroy it. The | |||
| * libcaca canvas continues to exist and other graphical contexts can be | |||
| * attached to it afterwards. | |||
| * | |||
| * If the cucul canvas was automatically created by caca_create_display(), | |||
| * If the caca canvas was automatically created by caca_create_display(), | |||
| * it is automatically destroyed and any handle to it becomes invalid. | |||
| * | |||
| * This function never fails. | |||
| @@ -240,9 +239,9 @@ int caca_set_display_driver(caca_display_t *dp, char const *driver) | |||
| int caca_free_display(caca_display_t *dp) | |||
| { | |||
| caca_uninstall_driver(dp); | |||
| cucul_unmanage_canvas(dp->cv, (int (*)(void *))caca_can_resize, (void *)dp); | |||
| caca_unmanage_canvas(dp->cv, (int (*)(void *))caca_can_resize, (void *)dp); | |||
| if(dp->autorelease) | |||
| cucul_free_canvas(dp->cv); | |||
| caca_free_canvas(dp->cv); | |||
| free(dp); | |||
| return 0; | |||
| @@ -250,15 +249,15 @@ int caca_free_display(caca_display_t *dp) | |||
| /** \brief Get the canvas attached to a caca graphical context. | |||
| * | |||
| * Return a handle on the \e cucul_canvas_t object that was either attached | |||
| * Return a handle on the \e caca_canvas_t object that was either attached | |||
| * or created by caca_create_display(). | |||
| * | |||
| * This function never fails. | |||
| * | |||
| * \param dp The libcaca graphical context. | |||
| * \return The libcucul canvas. | |||
| * \return The libcaca canvas. | |||
| */ | |||
| cucul_canvas_t * caca_get_canvas(caca_display_t *dp) | |||
| caca_canvas_t * caca_get_canvas(caca_display_t *dp) | |||
| { | |||
| return dp->cv; | |||
| } | |||
| @@ -330,8 +329,8 @@ static int caca_install_driver(caca_display_t *dp, char const *driver) | |||
| dp->lastticks = 0; | |||
| /* Mouse position */ | |||
| dp->mouse.x = cucul_get_canvas_width(dp->cv) / 2; | |||
| dp->mouse.y = cucul_get_canvas_height(dp->cv) / 2; | |||
| dp->mouse.x = caca_get_canvas_width(dp->cv) / 2; | |||
| dp->mouse.y = caca_get_canvas_height(dp->cv) / 2; | |||
| /* Resize events */ | |||
| dp->resize.resized = 0; | |||
| @@ -24,7 +24,7 @@ | |||
| #ifndef __CACA_H__ | |||
| #define __CACA_H__ | |||
| #include <cucul.h> | |||
| #include <caca_types.h> | |||
| #undef __extern | |||
| #if defined(_DOXYGEN_SKIP_ME) | |||
| @@ -42,11 +42,49 @@ extern "C" | |||
| { | |||
| #endif | |||
| /** \e libcaca canvas */ | |||
| typedef struct caca_canvas caca_canvas_t; | |||
| /** dither structure */ | |||
| typedef struct caca_dither caca_dither_t; | |||
| /** font structure */ | |||
| typedef struct caca_font caca_font_t; | |||
| /** file handle structure */ | |||
| typedef struct caca_file caca_file_t; | |||
| /** \e libcaca display context */ | |||
| typedef struct caca_display caca_display_t; | |||
| /** \e libcaca event structure */ | |||
| typedef struct caca_event caca_event_t; | |||
| /** \defgroup caca_attr libcaca attribute definitions | |||
| * | |||
| * Colours and styles that can be used with caca_set_attr(). | |||
| * | |||
| * @{ */ | |||
| #define CACA_BLACK 0x00 /**< The colour index for black. */ | |||
| #define CACA_BLUE 0x01 /**< The colour index for blue. */ | |||
| #define CACA_GREEN 0x02 /**< The colour index for green. */ | |||
| #define CACA_CYAN 0x03 /**< The colour index for cyan. */ | |||
| #define CACA_RED 0x04 /**< The colour index for red. */ | |||
| #define CACA_MAGENTA 0x05 /**< The colour index for magenta. */ | |||
| #define CACA_BROWN 0x06 /**< The colour index for brown. */ | |||
| #define CACA_LIGHTGRAY 0x07 /**< The colour index for light gray. */ | |||
| #define CACA_DARKGRAY 0x08 /**< The colour index for dark gray. */ | |||
| #define CACA_LIGHTBLUE 0x09 /**< The colour index for blue. */ | |||
| #define CACA_LIGHTGREEN 0x0a /**< The colour index for light green. */ | |||
| #define CACA_LIGHTCYAN 0x0b /**< The colour index for light cyan. */ | |||
| #define CACA_LIGHTRED 0x0c /**< The colour index for light red. */ | |||
| #define CACA_LIGHTMAGENTA 0x0d /**< The colour index for light magenta. */ | |||
| #define CACA_YELLOW 0x0e /**< The colour index for yellow. */ | |||
| #define CACA_WHITE 0x0f /**< The colour index for white. */ | |||
| #define CACA_DEFAULT 0x10 /**< The output driver's default colour. */ | |||
| #define CACA_TRANSPARENT 0x20 /**< The transparent colour. */ | |||
| #define CACA_BOLD 0x01 /**< The style mask for bold. */ | |||
| #define CACA_ITALICS 0x02 /**< The style mask for italics. */ | |||
| #define CACA_UNDERLINE 0x04 /**< The style mask for underline. */ | |||
| #define CACA_BLINK 0x08 /**< The style mask for blink. */ | |||
| /* @} */ | |||
| /** \brief User event type enumeration. | |||
| * | |||
| * This enum serves two purposes: | |||
| @@ -158,18 +196,247 @@ enum caca_key | |||
| /** \defgroup libcaca libcaca basic functions | |||
| * | |||
| * These functions provide the basic \e libcaca routines for driver | |||
| * These functions provide the basic \e libcaca routines for library | |||
| * initialisation, system information retrieval and configuration. | |||
| * | |||
| * @{ */ | |||
| __extern caca_canvas_t * caca_create_canvas(int, int); | |||
| __extern int caca_manage_canvas(caca_canvas_t *, int (*)(void *), void *); | |||
| __extern int caca_unmanage_canvas(caca_canvas_t *, int (*)(void *), void *); | |||
| __extern int caca_set_canvas_size(caca_canvas_t *, int, int); | |||
| __extern int caca_get_canvas_width(caca_canvas_t const *); | |||
| __extern int caca_get_canvas_height(caca_canvas_t const *); | |||
| __extern uint8_t const * caca_get_canvas_chars(caca_canvas_t const *); | |||
| __extern uint8_t const * caca_get_canvas_attrs(caca_canvas_t const *); | |||
| __extern int caca_free_canvas(caca_canvas_t *); | |||
| __extern int caca_rand(int, int); | |||
| __extern char const * caca_get_version(void); | |||
| /* @} */ | |||
| /** \defgroup caca_canvas libcaca canvas drawing | |||
| * | |||
| * These functions provide low-level character printing routines and | |||
| * higher level graphics functions. | |||
| * | |||
| * @{ */ | |||
| #define CACA_MAGIC_FULLWIDTH 0x000ffffe /**< Used to indicate that the previous character was a fullwidth glyph. */ | |||
| __extern int caca_gotoxy(caca_canvas_t *, int, int); | |||
| __extern int caca_get_cursor_x(caca_canvas_t const *); | |||
| __extern int caca_get_cursor_y(caca_canvas_t const *); | |||
| __extern int caca_put_char(caca_canvas_t *, int, int, uint32_t); | |||
| __extern uint32_t caca_get_char(caca_canvas_t const *, int, int); | |||
| __extern int caca_put_str(caca_canvas_t *, int, int, char const *); | |||
| __extern uint32_t caca_get_attr(caca_canvas_t const *, int, int); | |||
| __extern int caca_set_attr(caca_canvas_t *, uint32_t); | |||
| __extern int caca_put_attr(caca_canvas_t *, int, int, uint32_t); | |||
| __extern int caca_set_color_ansi(caca_canvas_t *, uint8_t, uint8_t); | |||
| __extern int caca_set_color_argb(caca_canvas_t *, uint16_t, uint16_t); | |||
| __extern int caca_printf(caca_canvas_t *, int, int, char const *, ...); | |||
| __extern int caca_clear_canvas(caca_canvas_t *); | |||
| __extern int caca_set_canvas_handle(caca_canvas_t *, int, int); | |||
| __extern int caca_get_canvas_handle_x(caca_canvas_t const *); | |||
| __extern int caca_get_canvas_handle_y(caca_canvas_t const *); | |||
| __extern int caca_blit(caca_canvas_t *, int, int, caca_canvas_t const *, | |||
| caca_canvas_t const *); | |||
| __extern int caca_set_canvas_boundaries(caca_canvas_t *, int, int, int, int); | |||
| /* @} */ | |||
| /** \defgroup caca_transform libcaca canvas transformation | |||
| * | |||
| * These functions perform horizontal and vertical canvas flipping. | |||
| * | |||
| * @{ */ | |||
| __extern int caca_invert(caca_canvas_t *); | |||
| __extern int caca_flip(caca_canvas_t *); | |||
| __extern int caca_flop(caca_canvas_t *); | |||
| __extern int caca_rotate_180(caca_canvas_t *); | |||
| __extern int caca_rotate_left(caca_canvas_t *); | |||
| __extern int caca_rotate_right(caca_canvas_t *); | |||
| __extern int caca_stretch_left(caca_canvas_t *); | |||
| __extern int caca_stretch_right(caca_canvas_t *); | |||
| /* @} */ | |||
| /** \defgroup caca_attributes libcaca attribute conversions | |||
| * | |||
| * These functions perform conversions between attribute values. | |||
| * | |||
| * @{ */ | |||
| __extern uint8_t caca_attr_to_ansi(uint32_t); | |||
| __extern uint8_t caca_attr_to_ansi_fg(uint32_t); | |||
| __extern uint8_t caca_attr_to_ansi_bg(uint32_t); | |||
| __extern uint16_t caca_attr_to_rgb12_fg(uint32_t); | |||
| __extern uint16_t caca_attr_to_rgb12_bg(uint32_t); | |||
| __extern void caca_attr_to_argb64(uint32_t, uint8_t[8]); | |||
| /* @} */ | |||
| /** \defgroup caca_charset libcaca character set conversions | |||
| * | |||
| * These functions perform conversions between usual character sets. | |||
| * | |||
| * @{ */ | |||
| __extern uint32_t caca_utf8_to_utf32(char const *, size_t *); | |||
| __extern size_t caca_utf32_to_utf8(char *, uint32_t); | |||
| __extern uint8_t caca_utf32_to_cp437(uint32_t); | |||
| __extern uint32_t caca_cp437_to_utf32(uint8_t); | |||
| __extern char caca_utf32_to_ascii(uint32_t); | |||
| __extern int caca_utf32_is_fullwidth(uint32_t); | |||
| /* @} */ | |||
| /** \defgroup caca_primitives libcaca primitives drawing | |||
| * | |||
| * These functions provide routines for primitive drawing, such as lines, | |||
| * boxes, triangles and ellipses. | |||
| * | |||
| * @{ */ | |||
| __extern int caca_draw_line(caca_canvas_t *, int, int, int, int, uint32_t); | |||
| __extern int caca_draw_polyline(caca_canvas_t *, int const x[], | |||
| int const y[], int, uint32_t); | |||
| __extern int caca_draw_thin_line(caca_canvas_t *, int, int, int, int); | |||
| __extern int caca_draw_thin_polyline(caca_canvas_t *, int const x[], | |||
| int const y[], int); | |||
| __extern int caca_draw_circle(caca_canvas_t *, int, int, int, uint32_t); | |||
| __extern int caca_draw_ellipse(caca_canvas_t *, int, int, int, int, uint32_t); | |||
| __extern int caca_draw_thin_ellipse(caca_canvas_t *, int, int, int, int); | |||
| __extern int caca_fill_ellipse(caca_canvas_t *, int, int, int, int, uint32_t); | |||
| __extern int caca_draw_box(caca_canvas_t *, int, int, int, int, uint32_t); | |||
| __extern int caca_draw_thin_box(caca_canvas_t *, int, int, int, int); | |||
| __extern int caca_draw_cp437_box(caca_canvas_t *, int, int, int, int); | |||
| __extern int caca_fill_box(caca_canvas_t *, int, int, int, int, uint32_t); | |||
| __extern int caca_draw_triangle(caca_canvas_t *, int, int, int, int, int, | |||
| int, uint32_t); | |||
| __extern int caca_draw_thin_triangle(caca_canvas_t *, int, int, int, int, | |||
| int, int); | |||
| __extern int caca_fill_triangle(caca_canvas_t *, int, int, int, int, int, | |||
| int, uint32_t); | |||
| /* @} */ | |||
| /** \defgroup caca_frame libcaca canvas frame handling | |||
| * | |||
| * These functions provide high level routines for canvas frame insertion, | |||
| * removal, copying etc. | |||
| * | |||
| * @{ */ | |||
| __extern int caca_get_frame_count(caca_canvas_t const *); | |||
| __extern int caca_set_frame(caca_canvas_t *, int); | |||
| __extern char const *caca_get_frame_name(caca_canvas_t const *); | |||
| __extern int caca_set_frame_name(caca_canvas_t *, char const *); | |||
| __extern int caca_create_frame(caca_canvas_t *, int); | |||
| __extern int caca_free_frame(caca_canvas_t *, int); | |||
| /* @} */ | |||
| /** \defgroup caca_dither libcaca bitmap dithering | |||
| * | |||
| * These functions provide high level routines for dither allocation and | |||
| * rendering. | |||
| * | |||
| * @{ */ | |||
| __extern caca_dither_t *caca_create_dither(int, int, int, int, | |||
| uint32_t, uint32_t, | |||
| uint32_t, uint32_t); | |||
| __extern int caca_set_dither_palette(caca_dither_t *, | |||
| uint32_t r[], uint32_t g[], | |||
| uint32_t b[], uint32_t a[]); | |||
| __extern int caca_set_dither_brightness(caca_dither_t *, float); | |||
| __extern float caca_get_dither_brightness(caca_dither_t const *); | |||
| __extern int caca_set_dither_gamma(caca_dither_t *, float); | |||
| __extern float caca_get_dither_gamma(caca_dither_t const *); | |||
| __extern int caca_set_dither_contrast(caca_dither_t *, float); | |||
| __extern float caca_get_dither_contrast(caca_dither_t const *); | |||
| __extern int caca_set_dither_antialias(caca_dither_t *, char const *); | |||
| __extern char const * const * caca_get_dither_antialias_list(caca_dither_t | |||
| const *); | |||
| __extern char const * caca_get_dither_antialias(caca_dither_t const *); | |||
| __extern int caca_set_dither_color(caca_dither_t *, char const *); | |||
| __extern char const * const * caca_get_dither_color_list(caca_dither_t | |||
| const *); | |||
| __extern char const * caca_get_dither_color(caca_dither_t const *); | |||
| __extern int caca_set_dither_charset(caca_dither_t *, char const *); | |||
| __extern char const * const * caca_get_dither_charset_list(caca_dither_t | |||
| const *); | |||
| __extern char const * caca_get_dither_charset(caca_dither_t const *); | |||
| __extern int caca_set_dither_algorithm(caca_dither_t *, char const *); | |||
| __extern char const * const * caca_get_dither_algorithm_list(caca_dither_t | |||
| const *); | |||
| __extern char const * caca_get_dither_algorithm(caca_dither_t const *); | |||
| __extern int caca_dither_bitmap(caca_canvas_t *, int, int, int, int, | |||
| caca_dither_t const *, void *); | |||
| __extern int caca_free_dither(caca_dither_t *); | |||
| /* @} */ | |||
| /** \defgroup caca_font libcaca font handling | |||
| * | |||
| * These functions provide font handling routines and high quality | |||
| * canvas to bitmap rendering. | |||
| * | |||
| * @{ */ | |||
| __extern caca_font_t *caca_load_font(void const *, size_t); | |||
| __extern char const * const * caca_get_font_list(void); | |||
| __extern int caca_get_font_width(caca_font_t const *); | |||
| __extern int caca_get_font_height(caca_font_t const *); | |||
| __extern uint32_t const *caca_get_font_blocks(caca_font_t const *); | |||
| __extern int caca_render_canvas(caca_canvas_t const *, caca_font_t const *, | |||
| void *, int, int, int); | |||
| __extern int caca_free_font(caca_font_t *); | |||
| /* @} */ | |||
| /** \defgroup caca_figfont libcaca FIGfont handling | |||
| * | |||
| * These functions provide FIGlet and TOIlet font handling routines. | |||
| * | |||
| * @{ */ | |||
| __extern int caca_canvas_set_figfont(caca_canvas_t *, char const *); | |||
| __extern int caca_put_figchar(caca_canvas_t *, uint32_t); | |||
| __extern int caca_flush_figlet(caca_canvas_t *); | |||
| /* @} */ | |||
| /** \defgroup caca_file libcaca file IO | |||
| * | |||
| * These functions allow to read and write files in a platform-independent | |||
| * way. | |||
| * @{ */ | |||
| __extern caca_file_t *caca_file_open(char const *, const char *); | |||
| __extern int caca_file_close(caca_file_t *); | |||
| __extern uint64_t caca_file_tell(caca_file_t *); | |||
| __extern size_t caca_file_read(caca_file_t *, void *, size_t); | |||
| __extern size_t caca_file_write(caca_file_t *, const void *, size_t); | |||
| __extern char * caca_file_gets(caca_file_t *, char *, int); | |||
| __extern int caca_file_eof(caca_file_t *); | |||
| /* @} */ | |||
| /** \defgroup caca_importexport libcaca importers/exporters from/to various | |||
| * formats | |||
| * | |||
| * These functions import various file formats into a new canvas, or export | |||
| * the current canvas to various text formats. | |||
| * | |||
| * @{ */ | |||
| __extern ssize_t caca_import_memory(caca_canvas_t *, void const *, | |||
| size_t, char const *); | |||
| __extern ssize_t caca_import_file(caca_canvas_t *, char const *, | |||
| char const *); | |||
| __extern char const * const * caca_get_import_list(void); | |||
| __extern void *caca_export_memory(caca_canvas_t const *, char const *, | |||
| size_t *); | |||
| __extern char const * const * caca_get_export_list(void); | |||
| /* @} */ | |||
| /** \defgroup caca_display libcaca display functions | |||
| * | |||
| * These functions provide the basic \e libcaca routines for display | |||
| * initialisation, system information retrieval and configuration. | |||
| * | |||
| * @{ */ | |||
| __extern caca_display_t * caca_create_display(cucul_canvas_t *); | |||
| __extern caca_display_t * caca_create_display_with_driver(cucul_canvas_t *, | |||
| __extern caca_display_t * caca_create_display(caca_canvas_t *); | |||
| __extern caca_display_t * caca_create_display_with_driver(caca_canvas_t *, | |||
| char const *); | |||
| __extern char const * const * caca_get_display_driver_list(void); | |||
| __extern char const * caca_get_display_driver(caca_display_t *); | |||
| __extern int caca_set_display_driver(caca_display_t *, char const *); | |||
| __extern int caca_free_display(caca_display_t *); | |||
| __extern cucul_canvas_t * caca_get_canvas(caca_display_t *); | |||
| __extern caca_canvas_t * caca_get_canvas(caca_display_t *); | |||
| __extern int caca_refresh_display(caca_display_t *); | |||
| __extern int caca_set_display_time(caca_display_t *, int); | |||
| __extern int caca_get_display_time(caca_display_t const *); | |||
| @@ -178,7 +445,6 @@ __extern int caca_get_display_height(caca_display_t const *); | |||
| __extern int caca_set_display_title(caca_display_t *, char const *); | |||
| __extern int caca_set_mouse(caca_display_t *, int); | |||
| __extern int caca_set_cursor(caca_display_t *, int); | |||
| __extern char const * caca_get_version(void); | |||
| /* @} */ | |||
| /** \defgroup caca_event libcaca event handling | |||
| @@ -201,6 +467,77 @@ __extern int caca_get_event_resize_width(caca_event_t const *); | |||
| __extern int caca_get_event_resize_height(caca_event_t const *); | |||
| /* @} */ | |||
| #if !defined(_DOXYGEN_SKIP_ME) | |||
| /* Legacy stuff from beta versions, will probably disappear in 1.0 */ | |||
| typedef struct cucul_buffer cucul_buffer_t; | |||
| #define cucul_canvas_t caca_canvas_t | |||
| #define cucul_dither_t caca_dither_t | |||
| #define cucul_font_t caca_font_t | |||
| #define cucul_file_t caca_file_t | |||
| #define cucul_display_t caca_display_t | |||
| #define cucul_event_t caca_event_t | |||
| # if defined __GNUC__ && __GNUC__ >= 3 | |||
| # define CACA_DEPRECATED __attribute__ ((__deprecated__)) | |||
| # else | |||
| # define CACA_DEPRECATED | |||
| # endif | |||
| __extern int cucul_putchar(cucul_canvas_t *, int, int, | |||
| unsigned long int) CACA_DEPRECATED; | |||
| __extern unsigned long int cucul_getchar(cucul_canvas_t *, | |||
| int, int) CACA_DEPRECATED; | |||
| __extern int cucul_putstr(cucul_canvas_t *, int, int, | |||
| char const *) CACA_DEPRECATED; | |||
| __extern int cucul_set_color(cucul_canvas_t *, unsigned char, | |||
| unsigned char) CACA_DEPRECATED; | |||
| __extern int cucul_set_truecolor(cucul_canvas_t *, unsigned int, | |||
| unsigned int) CACA_DEPRECATED; | |||
| __extern unsigned int cucul_get_canvas_frame_count(cucul_canvas_t *) | |||
| CACA_DEPRECATED; | |||
| __extern int cucul_set_canvas_frame(cucul_canvas_t *, | |||
| unsigned int) CACA_DEPRECATED; | |||
| __extern int cucul_create_canvas_frame(cucul_canvas_t *, | |||
| unsigned int) CACA_DEPRECATED; | |||
| __extern int cucul_free_canvas_frame(cucul_canvas_t *, | |||
| unsigned int) CACA_DEPRECATED; | |||
| __extern cucul_buffer_t *cucul_load_memory(void *, | |||
| unsigned long int) CACA_DEPRECATED; | |||
| __extern cucul_buffer_t *cucul_load_file(char const *) CACA_DEPRECATED; | |||
| __extern unsigned long int cucul_get_buffer_size(cucul_buffer_t *) | |||
| CACA_DEPRECATED; | |||
| __extern void * cucul_get_buffer_data(cucul_buffer_t *) CACA_DEPRECATED; | |||
| __extern int cucul_free_buffer(cucul_buffer_t *) CACA_DEPRECATED; | |||
| __extern cucul_buffer_t * cucul_export_canvas(cucul_canvas_t *, | |||
| char const *) CACA_DEPRECATED; | |||
| __extern cucul_canvas_t * cucul_import_canvas(cucul_buffer_t *, | |||
| char const *) CACA_DEPRECATED; | |||
| __extern int cucul_rotate(cucul_canvas_t *) CACA_DEPRECATED; | |||
| __extern int cucul_set_dither_invert(cucul_dither_t *, int) CACA_DEPRECATED; | |||
| __extern int cucul_set_dither_mode(cucul_dither_t *, | |||
| char const *) CACA_DEPRECATED; | |||
| __extern char const * const * cucul_get_dither_mode_list(cucul_dither_t | |||
| const *) | |||
| CACA_DEPRECATED; | |||
| # define CUCUL_COLOR_BLACK CACA_BLACK | |||
| # define CUCUL_COLOR_BLUE CACA_BLUE | |||
| # define CUCUL_COLOR_GREEN CACA_GREEN | |||
| # define CUCUL_COLOR_CYAN CACA_CYAN | |||
| # define CUCUL_COLOR_RED CACA_RED | |||
| # define CUCUL_COLOR_MAGENTA CACA_MAGENTA | |||
| # define CUCUL_COLOR_BROWN CACA_BROWN | |||
| # define CUCUL_COLOR_LIGHTGRAY CACA_LIGHTGRAY | |||
| # define CUCUL_COLOR_DARKGRAY CACA_DARKGRAY | |||
| # define CUCUL_COLOR_LIGHTBLUE CACA_LIGHTBLUE | |||
| # define CUCUL_COLOR_LIGHTGREEN CACA_LIGHTGREEN | |||
| # define CUCUL_COLOR_LIGHTCYAN CACA_LIGHTCYAN | |||
| # define CUCUL_COLOR_LIGHTRED CACA_LIGHTRED | |||
| # define CUCUL_COLOR_LIGHTMAGENTA CACA_LIGHTMAGENTA | |||
| # define CUCUL_COLOR_YELLOW CACA_YELLOW | |||
| # define CUCUL_COLOR_WHITE CACA_YELLOW | |||
| # define CUCUL_COLOR_DEFAULT CACA_DEFAULT | |||
| # define CUCUL_COLOR_TRANSPARENT CACA_TRANSPARENT | |||
| #endif | |||
| #ifdef __cplusplus | |||
| } | |||
| #endif | |||
| @@ -6,7 +6,7 @@ includedir=@includedir@ | |||
| Name: caca | |||
| Description: Colour ASCII-Art library | |||
| Version: @VERSION@ | |||
| Requires: cucul = @VERSION@ | |||
| Requires: caca = @VERSION@ | |||
| Conflicts: | |||
| Libs: -L${libdir} -lcaca -lcucul | |||
| Libs: -L${libdir} -lcaca -lcaca | |||
| Cflags: -I${includedir} | |||
| @@ -27,10 +27,10 @@ | |||
| #include "caca_internals.h" | |||
| /* These variables are needed to emulate old non-thread safe behaviour */ | |||
| cucul_canvas_t *__caca0_cv = NULL; | |||
| caca_canvas_t *__caca0_cv = NULL; | |||
| caca_display_t *__caca0_dp = NULL; | |||
| unsigned char __caca0_fg = CUCUL_LIGHTGRAY; | |||
| unsigned char __caca0_bg = CUCUL_BLACK; | |||
| unsigned char __caca0_fg = CACA_LIGHTGRAY; | |||
| unsigned char __caca0_bg = CACA_BLACK; | |||
| char __caca0_utf8[2] = " "; | |||
| /* These functions are needed, too */ | |||
| @@ -41,28 +41,28 @@ unsigned int __caca0_sqrt(unsigned int); | |||
| int __caca0_get_feature(int); | |||
| void __caca0_set_feature(int); | |||
| char const *__caca0_get_feature_name(int); | |||
| cucul_canvas_t *__caca0_load_sprite(char const *); | |||
| cucul_dither_t *__caca0_create_bitmap(unsigned int, unsigned int, | |||
| caca_canvas_t *__caca0_load_sprite(char const *); | |||
| caca_dither_t *__caca0_create_bitmap(unsigned int, unsigned int, | |||
| unsigned int, unsigned int, unsigned long int, unsigned long int, | |||
| unsigned long int, unsigned long int); | |||
| void __caca0_free_bitmap(cucul_dither_t *); | |||
| void __caca0_free_bitmap(caca_dither_t *); | |||
| extern char const *__caca0_get_color_name(unsigned char); | |||
| /* Emulation functions */ | |||
| int __caca0_init(void) | |||
| { | |||
| __caca0_cv = cucul_create_canvas(0, 0); | |||
| __caca0_cv = caca_create_canvas(0, 0); | |||
| if(!__caca0_cv) | |||
| return -1; | |||
| __caca0_dp = caca_create_display(__caca0_cv); | |||
| if(!__caca0_dp) | |||
| { | |||
| cucul_free_canvas(__caca0_cv); | |||
| caca_free_canvas(__caca0_cv); | |||
| __caca0_cv = NULL; | |||
| return -1; | |||
| } | |||
| __caca0_fg = CUCUL_LIGHTGRAY; | |||
| __caca0_bg = CUCUL_BLACK; | |||
| __caca0_fg = CACA_LIGHTGRAY; | |||
| __caca0_bg = CACA_BLACK; | |||
| return 0; | |||
| } | |||
| @@ -70,7 +70,7 @@ void __caca0_end(void) | |||
| { | |||
| caca_free_display(__caca0_dp); | |||
| __caca0_dp = NULL; | |||
| cucul_free_canvas(__caca0_cv); | |||
| caca_free_canvas(__caca0_cv); | |||
| __caca0_cv = NULL; | |||
| } | |||
| @@ -144,7 +144,7 @@ static char const *features[] = | |||
| NULL, "none", "ordered2", "ordered4", "ordered8", "random" | |||
| }; | |||
| static cucul_dither_t **bitmaps = NULL; | |||
| static caca_dither_t **bitmaps = NULL; | |||
| static unsigned int nbitmaps = 0; | |||
| static int background = 0x12; | |||
| @@ -172,21 +172,21 @@ void __caca0_set_feature(int feature) | |||
| case 0x11: case 0x12: | |||
| background = feature; | |||
| for(i = 0; i < nbitmaps; i++) | |||
| cucul_set_dither_color(bitmaps[i], features[feature]); | |||
| caca_set_dither_color(bitmaps[i], features[feature]); | |||
| break; | |||
| case 0x20: feature = 0x22; /* CACA_ANTIALIASING_PREFILTER */ | |||
| case 0x21: case 0x22: | |||
| antialiasing = feature; | |||
| for(i = 0; i < nbitmaps; i++) | |||
| cucul_set_dither_antialias(bitmaps[i], features[feature]); | |||
| caca_set_dither_antialias(bitmaps[i], features[feature]); | |||
| break; | |||
| case 0x30: feature = 0x33; /* CACA_DITHERING_ORDERED4 */ | |||
| case 0x31: case 0x32: case 0x33: case 0x34: case 0x35: | |||
| dithering = feature; | |||
| for(i = 0; i < nbitmaps; i++) | |||
| cucul_set_dither_algorithm(bitmaps[i], features[feature]); | |||
| caca_set_dither_algorithm(bitmaps[i], features[feature]); | |||
| break; | |||
| } | |||
| } | |||
| @@ -211,48 +211,48 @@ char const *__caca0_get_feature_name(int feature) | |||
| } | |||
| } | |||
| cucul_canvas_t *__caca0_load_sprite(char const *file) | |||
| caca_canvas_t *__caca0_load_sprite(char const *file) | |||
| { | |||
| cucul_canvas_t *cv; | |||
| caca_canvas_t *cv; | |||
| cv = cucul_create_canvas(0, 0);; | |||
| if(cucul_import_file(cv, file, "") < 0) | |||
| cv = caca_create_canvas(0, 0);; | |||
| if(caca_import_file(cv, file, "") < 0) | |||
| { | |||
| cucul_free_canvas(cv); | |||
| caca_free_canvas(cv); | |||
| return NULL; | |||
| } | |||
| return cv; | |||
| } | |||
| cucul_dither_t *__caca0_create_bitmap(unsigned int bpp, unsigned int w, | |||
| caca_dither_t *__caca0_create_bitmap(unsigned int bpp, unsigned int w, | |||
| unsigned int h, unsigned int pitch, | |||
| unsigned long int r, unsigned long int g, | |||
| unsigned long int b, unsigned long int a) | |||
| { | |||
| cucul_dither_t *d; | |||
| caca_dither_t *d; | |||
| d = cucul_create_dither(bpp, w, h, pitch, r, g, b, a); | |||
| d = caca_create_dither(bpp, w, h, pitch, r, g, b, a); | |||
| if(!d) | |||
| return NULL; | |||
| cucul_set_dither_color(d, features[background]); | |||
| cucul_set_dither_antialias(d, features[antialiasing]); | |||
| cucul_set_dither_algorithm(d, features[dithering]); | |||
| caca_set_dither_color(d, features[background]); | |||
| caca_set_dither_antialias(d, features[antialiasing]); | |||
| caca_set_dither_algorithm(d, features[dithering]); | |||
| /* Store bitmap in our list */ | |||
| nbitmaps++; | |||
| bitmaps = realloc(bitmaps, nbitmaps * (sizeof(cucul_dither_t *))); | |||
| bitmaps = realloc(bitmaps, nbitmaps * (sizeof(caca_dither_t *))); | |||
| bitmaps[nbitmaps - 1] = d; | |||
| return d; | |||
| } | |||
| void __caca0_free_bitmap(cucul_dither_t *d) | |||
| void __caca0_free_bitmap(caca_dither_t *d) | |||
| { | |||
| unsigned int i, found = 0; | |||
| cucul_free_dither(d); | |||
| caca_free_dither(d); | |||
| /* Remove bitmap from our list */ | |||
| for(i = 0; i + 1 < nbitmaps; i++) | |||
| @@ -35,15 +35,15 @@ extern unsigned int __caca0_sqrt(unsigned int); | |||
| extern int __caca0_get_feature(int); | |||
| extern void __caca0_set_feature(int); | |||
| extern char const *__caca0_get_feature_name(int); | |||
| extern cucul_canvas_t *__caca0_load_sprite(char const *); | |||
| extern cucul_dither_t *__caca0_create_bitmap(unsigned int, unsigned int, | |||
| extern caca_canvas_t *__caca0_load_sprite(char const *); | |||
| extern caca_dither_t *__caca0_create_bitmap(unsigned int, unsigned int, | |||
| unsigned int, unsigned int, unsigned long int, unsigned long int, | |||
| unsigned long int, unsigned long int); | |||
| extern void __caca0_free_bitmap(cucul_dither_t *); | |||
| extern void __caca0_free_bitmap(caca_dither_t *); | |||
| extern char const *__caca0_get_color_name(unsigned char); | |||
| /* These variables are needed to emulate old non-thread safe behaviour */ | |||
| extern cucul_canvas_t *__caca0_cv; | |||
| extern caca_canvas_t *__caca0_cv; | |||
| extern caca_display_t *__caca0_dp; | |||
| extern unsigned char __caca0_fg; | |||
| extern unsigned char __caca0_bg; | |||
| @@ -51,22 +51,22 @@ extern unsigned char __caca0_bg; | |||
| /* These enums and macros changed names or values */ | |||
| enum caca_color | |||
| { | |||
| CACA_COLOR_BLACK = CUCUL_BLACK, | |||
| CACA_COLOR_BLUE = CUCUL_BLUE, | |||
| CACA_COLOR_GREEN = CUCUL_GREEN, | |||
| CACA_COLOR_CYAN = CUCUL_CYAN, | |||
| CACA_COLOR_RED = CUCUL_RED, | |||
| CACA_COLOR_MAGENTA = CUCUL_MAGENTA, | |||
| CACA_COLOR_BROWN = CUCUL_BROWN, | |||
| CACA_COLOR_LIGHTGRAY = CUCUL_LIGHTGRAY, | |||
| CACA_COLOR_DARKGRAY = CUCUL_DARKGRAY, | |||
| CACA_COLOR_LIGHTBLUE = CUCUL_LIGHTBLUE, | |||
| CACA_COLOR_LIGHTGREEN = CUCUL_LIGHTGREEN, | |||
| CACA_COLOR_LIGHTCYAN = CUCUL_LIGHTCYAN, | |||
| CACA_COLOR_LIGHTRED = CUCUL_LIGHTRED, | |||
| CACA_COLOR_LIGHTMAGENTA = CUCUL_LIGHTMAGENTA, | |||
| CACA_COLOR_YELLOW = CUCUL_YELLOW, | |||
| CACA_COLOR_WHITE = CUCUL_WHITE, | |||
| CACA_COLOR_BLACK = CACA_BLACK, | |||
| CACA_COLOR_BLUE = CACA_BLUE, | |||
| CACA_COLOR_GREEN = CACA_GREEN, | |||
| CACA_COLOR_CYAN = CACA_CYAN, | |||
| CACA_COLOR_RED = CACA_RED, | |||
| CACA_COLOR_MAGENTA = CACA_MAGENTA, | |||
| CACA_COLOR_BROWN = CACA_BROWN, | |||
| CACA_COLOR_LIGHTGRAY = CACA_LIGHTGRAY, | |||
| CACA_COLOR_DARKGRAY = CACA_DARKGRAY, | |||
| CACA_COLOR_LIGHTBLUE = CACA_LIGHTBLUE, | |||
| CACA_COLOR_LIGHTGREEN = CACA_LIGHTGREEN, | |||
| CACA_COLOR_LIGHTCYAN = CACA_LIGHTCYAN, | |||
| CACA_COLOR_LIGHTRED = CACA_LIGHTRED, | |||
| CACA_COLOR_LIGHTMAGENTA = CACA_LIGHTMAGENTA, | |||
| CACA_COLOR_YELLOW = CACA_YELLOW, | |||
| CACA_COLOR_WHITE = CACA_WHITE, | |||
| }; | |||
| enum caca_feature | |||
| @@ -117,8 +117,8 @@ enum caca_feature | |||
| #define caca_set_feature __caca0_set_feature | |||
| #define caca_get_feature_name __caca0_get_feature_name | |||
| #define caca_get_rendertime() caca_get_display_time(__caca0_dp) | |||
| #define caca_get_width() cucul_get_canvas_width(__caca0_cv) | |||
| #define caca_get_height() cucul_get_canvas_height(__caca0_cv) | |||
| #define caca_get_width() caca_get_canvas_width(__caca0_cv) | |||
| #define caca_get_height() caca_get_canvas_height(__caca0_cv) | |||
| #define caca_set_window_title(s) caca_set_display_title(__caca0_dp, s) | |||
| #define caca_get_window_width() caca_get_display_width(__caca0_dp) | |||
| #define caca_get_window_height() caca_get_display_height(__caca0_dp) | |||
| @@ -131,62 +131,62 @@ enum caca_feature | |||
| #define caca_get_mouse_y() caca_get_mouse_y(__caca0_dp) | |||
| #define caca_set_color(x, y) \ | |||
| (__caca0_fg = (x), __caca0_bg = (y), cucul_set_color_ansi(__caca0_cv, x, y)) | |||
| (__caca0_fg = (x), __caca0_bg = (y), caca_set_color_ansi(__caca0_cv, x, y)) | |||
| #define caca_get_fg_color() __caca0_fg | |||
| #define caca_get_bg_color() __caca0_bg | |||
| #define caca_get_color_name __caca0_get_color_name | |||
| #define caca_putchar(x, y, c) cucul_put_char(__caca0_cv, x, y, c) | |||
| #define caca_putstr(x, y, s) cucul_put_str(__caca0_cv, x, y, s) | |||
| #define caca_printf(x, y, f, z...) cucul_printf(__caca0_cv, x, y, f, ##z) | |||
| #define caca_clear() cucul_clear_canvas(__caca0_cv) | |||
| #define caca_putchar(x, y, c) caca_put_char(__caca0_cv, x, y, c) | |||
| #define caca_putstr(x, y, s) caca_put_str(__caca0_cv, x, y, s) | |||
| #define caca_printf(x, y, f, z...) caca_printf(__caca0_cv, x, y, f, ##z) | |||
| #define caca_clear() caca_clear_canvas(__caca0_cv) | |||
| #define caca_draw_line(x, y, z, t, c) \ | |||
| cucul_draw_line(__caca0_cv, x, y, z, t, c) | |||
| caca_draw_line(__caca0_cv, x, y, z, t, c) | |||
| #define caca_draw_polyline(x, y, z, c) \ | |||
| cucul_draw_polyline(__caca0_cv, x, y, z, c) | |||
| caca_draw_polyline(__caca0_cv, x, y, z, c) | |||
| #define caca_draw_thin_line(x, y, z, t) \ | |||
| cucul_draw_thin_line(__caca0_cv, x, y, z, t) | |||
| caca_draw_thin_line(__caca0_cv, x, y, z, t) | |||
| #define caca_draw_thin_polyline(x, y, z) \ | |||
| cucul_draw_thin_polyline(__caca0_cv, x, y, z) | |||
| caca_draw_thin_polyline(__caca0_cv, x, y, z) | |||
| #define caca_draw_circle(x, y, z, c) \ | |||
| cucul_draw_circle(__caca0_cv, x, y, z, c) | |||
| caca_draw_circle(__caca0_cv, x, y, z, c) | |||
| #define caca_draw_ellipse(x, y, z, t, c) \ | |||
| cucul_draw_ellipse(__caca0_cv, x, y, z, t, c) | |||
| caca_draw_ellipse(__caca0_cv, x, y, z, t, c) | |||
| #define caca_draw_thin_ellipse(x, y, z, t) \ | |||
| cucul_draw_thin_ellipse(__caca0_cv, x, y, z, t) | |||
| caca_draw_thin_ellipse(__caca0_cv, x, y, z, t) | |||
| #define caca_fill_ellipse(x, y, z, t, c) \ | |||
| cucul_fill_ellipse(__caca0_cv, x, y, z, t, c) | |||
| caca_fill_ellipse(__caca0_cv, x, y, z, t, c) | |||
| #define caca_draw_box(x, y, z, t, c) \ | |||
| cucul_draw_box(__caca0_cv, x, y, z, t, c) | |||
| caca_draw_box(__caca0_cv, x, y, z, t, c) | |||
| #define caca_draw_thin_box(x, y, z, t) \ | |||
| cucul_draw_thin_box(__caca0_cv, x, y, z, t) | |||
| caca_draw_thin_box(__caca0_cv, x, y, z, t) | |||
| #define caca_fill_box(x, y, z, t, c) \ | |||
| cucul_fill_box(__caca0_cv, x, y, z, t, c) | |||
| caca_fill_box(__caca0_cv, x, y, z, t, c) | |||
| #define caca_draw_triangle(x, y, z, t, u, v, c) \ | |||
| cucul_draw_triangle(__caca0_cv, x, y, z, t, u, v, c) | |||
| caca_draw_triangle(__caca0_cv, x, y, z, t, u, v, c) | |||
| #define caca_draw_thin_triangle(x, y, z, t, u, v) \ | |||
| cucul_draw_thin_triangle(__caca0_cv, x, y, z, t, u, v) | |||
| caca_draw_thin_triangle(__caca0_cv, x, y, z, t, u, v) | |||
| #define caca_fill_triangle(x, y, z, t, u, v, c) \ | |||
| cucul_fill_triangle(__caca0_cv, x, y, z, t, u, v, c) | |||
| caca_fill_triangle(__caca0_cv, x, y, z, t, u, v, c) | |||
| #define caca_rand(a, b) cucul_rand(a, (b)+1) | |||
| #define caca_rand(a, b) caca_rand(a, (b)+1) | |||
| #define caca_sqrt __caca0_sqrt | |||
| #define caca_sprite cucul_canvas | |||
| #define caca_sprite caca_canvas | |||
| #define caca_load_sprite __caca0_load_sprite | |||
| #define caca_get_sprite_frames(c) 1 | |||
| #define caca_get_sprite_width(c, f) cucul_get_canvas_width(c) | |||
| #define caca_get_sprite_height(c, f) cucul_get_canvas_height(c) | |||
| #define caca_get_sprite_width(c, f) caca_get_canvas_width(c) | |||
| #define caca_get_sprite_height(c, f) caca_get_canvas_height(c) | |||
| #define caca_get_sprite_dx(c, f) 0 | |||
| #define caca_get_sprite_dx(c, f) 0 | |||
| #define caca_draw_sprite(x, y, c, f) cucul_blit(__caca0_cv, x, y, c, NULL) | |||
| #define caca_free_sprite cucul_free_canvas | |||
| #define caca_draw_sprite(x, y, c, f) caca_blit(__caca0_cv, x, y, c, NULL) | |||
| #define caca_free_sprite caca_free_canvas | |||
| #define caca_bitmap cucul_dither | |||
| #define caca_bitmap caca_dither | |||
| #define caca_create_bitmap __caca0_create_bitmap | |||
| #define caca_set_bitmap_palette cucul_set_dither_palette | |||
| #define caca_set_bitmap_palette caca_set_dither_palette | |||
| #define caca_draw_bitmap(x, y, z, t, b, p) \ | |||
| cucul_dither_bitmap(__caca0_cv, x, y, z, t, b, p) | |||
| caca_dither_bitmap(__caca0_cv, x, y, z, t, b, p) | |||
| #define caca_free_bitmap __caca0_free_bitmap | |||
| #ifdef __cplusplus | |||
| @@ -19,11 +19,55 @@ | |||
| typedef struct caca_timer caca_timer_t; | |||
| typedef struct caca_privevent caca_privevent_t; | |||
| typedef struct caca_figfont caca_figfont_t; | |||
| #if !defined(_DOXYGEN_SKIP_ME) | |||
| # define EVENTBUF_LEN 10 | |||
| #endif | |||
| struct caca_frame | |||
| { | |||
| /* Frame size */ | |||
| int width, height; | |||
| /* Cell information */ | |||
| uint32_t *chars; | |||
| uint32_t *attrs; | |||
| /* Painting context */ | |||
| int x, y; | |||
| int handlex, handley; | |||
| uint32_t curattr; | |||
| /* Frame name */ | |||
| char *name; | |||
| }; | |||
| struct caca_canvas | |||
| { | |||
| /* XXX: look at caca_set_canvas_boundaries() before adding anything | |||
| * to this structure. The function is quite hacky. */ | |||
| /* Frame information */ | |||
| int frame, framecount; | |||
| struct caca_frame *frames; | |||
| /* Canvas management */ | |||
| int refcount; | |||
| int autoinc; | |||
| int (*resize_callback)(void *); | |||
| void *resize_data; | |||
| /* Shortcut to the active frame information */ | |||
| int width, height; | |||
| uint32_t *chars; | |||
| uint32_t *attrs; | |||
| uint32_t curattr; | |||
| /* FIGfont management */ | |||
| caca_figfont_t *ff; | |||
| }; | |||
| /* Graphics driver */ | |||
| enum caca_driver | |||
| { | |||
| @@ -104,8 +148,8 @@ struct caca_privevent | |||
| /* Internal caca display context */ | |||
| struct caca_display | |||
| { | |||
| /* A link to our cucul canvas */ | |||
| cucul_canvas_t *cv; | |||
| /* A link to our caca canvas */ | |||
| caca_canvas_t *cv; | |||
| int autorelease; | |||
| #if defined(USE_PLUGINS) | |||
| @@ -168,6 +212,14 @@ struct caca_display | |||
| } events; | |||
| }; | |||
| /* Colour functions */ | |||
| extern uint32_t _caca_attr_to_rgb24fg(uint32_t); | |||
| extern uint32_t _caca_attr_to_rgb24bg(uint32_t); | |||
| /* Frames functions */ | |||
| extern void _caca_save_frame_info(caca_canvas_t *); | |||
| extern void _caca_load_frame_info(caca_canvas_t *); | |||
| /* Internal timer functions */ | |||
| extern void _caca_sleep(int); | |||
| extern int _caca_getticks(caca_timer_t *); | |||
| @@ -1,5 +1,5 @@ | |||
| /* | |||
| * libcucul Canvas for ultrafast compositing of Unicode letters | |||
| * libcaca Colour ASCII-Art library | |||
| * libcaca Colour ASCII-Art library | |||
| * Copyright (c) 2008 Sam Hocevar <sam@zoy.org> | |||
| * All Rights Reserved | |||
| @@ -16,26 +16,26 @@ | |||
| * This file contains definitions for the C99 integer types. | |||
| */ | |||
| #ifndef __CUCUL_TYPES_H__ | |||
| #define __CUCUL_TYPES_H__ | |||
| #ifndef __CACA_TYPES_H__ | |||
| #define __CACA_TYPES_H__ | |||
| #ifndef CUCUL_TYPES | |||
| # define CUCUL_TYPES @CUCUL_TYPES@ | |||
| #ifndef CACA_TYPES | |||
| # define CACA_TYPES @CACA_TYPES@ | |||
| #endif | |||
| /* mode 1: standard <stdint.h> header is present, just include it */ | |||
| #if CUCUL_TYPES == 1 | |||
| #if CACA_TYPES == 1 | |||
| # include <stdint.h> | |||
| # include <unistd.h> | |||
| /* mode 2: standard <inttypes.h> header is present, just include it */ | |||
| #elif CUCUL_TYPES == 2 | |||
| #elif CACA_TYPES == 2 | |||
| # include <inttypes.h> | |||
| # include <unistd.h> | |||
| /* mode 3: <windows.h> indicates Win32, only (u)intptr_t is present | |||
| * FIXME: Win64 probably doesn't work that way */ | |||
| #elif CUCUL_TYPES == 3 | |||
| #elif CACA_TYPES == 3 | |||
| #include <windows.h> | |||
| typedef signed char int8_t; | |||
| @@ -55,47 +55,47 @@ typedef unsigned int size_t; | |||
| * sizeof(long) == sizeof(void *). We don't typedef directly because we | |||
| * have no idea what other typedefs have already been made. */ | |||
| #else | |||
| typedef signed char _cucul_int8_t; | |||
| typedef signed short _cucul_int16_t; | |||
| typedef signed long int _cucul_int32_t; | |||
| typedef signed long long int _cucul_int64_t; | |||
| typedef signed char _caca_int8_t; | |||
| typedef signed short _caca_int16_t; | |||
| typedef signed long int _caca_int32_t; | |||
| typedef signed long long int _caca_int64_t; | |||
| # undef int8_t | |||
| # define int8_t _cucul_int8_t | |||
| # define int8_t _caca_int8_t | |||
| # undef int16_t | |||
| # define int16_t _cucul_int16_t | |||
| # define int16_t _caca_int16_t | |||
| # undef int32_t | |||
| # define int32_t _cucul_int32_t | |||
| # define int32_t _caca_int32_t | |||
| # undef int64_t | |||
| # define int64_t _cucul_int64_t | |||
| # define int64_t _caca_int64_t | |||
| typedef unsigned char _cucul_uint8_t; | |||
| typedef unsigned short _cucul_uint16_t; | |||
| typedef unsigned long int _cucul_uint32_t; | |||
| typedef unsigned long long int _cucul_uint64_t; | |||
| typedef unsigned char _caca_uint8_t; | |||
| typedef unsigned short _caca_uint16_t; | |||
| typedef unsigned long int _caca_uint32_t; | |||
| typedef unsigned long long int _caca_uint64_t; | |||
| # undef uint8_t | |||
| # define uint8_t _cucul_uint8_t | |||
| # define uint8_t _caca_uint8_t | |||
| # undef uint16_t | |||
| # define uint16_t _cucul_uint16_t | |||
| # define uint16_t _caca_uint16_t | |||
| # undef uint32_t | |||
| # define uint32_t _cucul_uint32_t | |||
| # define uint32_t _caca_uint32_t | |||
| # undef uint64_t | |||
| # define uint64_t _cucul_uint64_t | |||
| # define uint64_t _caca_uint64_t | |||
| typedef long int _cucul_intptr_t; | |||
| typedef unsigned long int _cucul_uintptr_t; | |||
| typedef long int _caca_intptr_t; | |||
| typedef unsigned long int _caca_uintptr_t; | |||
| # undef intptr_t | |||
| # define intptr_t _cucul_intptr_t | |||
| # define intptr_t _caca_intptr_t | |||
| # undef uintptr_t | |||
| # define uintptr_t _cucul_uintptr_t | |||
| # define uintptr_t _caca_uintptr_t | |||
| typedef int _cucul_ssize_t; | |||
| typedef unsigned int _cucul_size_t; | |||
| typedef int _caca_ssize_t; | |||
| typedef unsigned int _caca_size_t; | |||
| # undef ssize_t | |||
| # define ssize_t _cucul_ssize_t | |||
| # define ssize_t _caca_ssize_t | |||
| # undef size_t | |||
| # define size_t _cucul_size_t | |||
| # define size_t _caca_size_t | |||
| #endif | |||
| #endif /* __CUCUL_TYPES_H__ */ | |||
| #endif /* __CACA_TYPES_H__ */ | |||
| @@ -1,5 +1,5 @@ | |||
| /* | |||
| * libcucul Canvas for ultrafast compositing of Unicode letters | |||
| * libcaca Colour ASCII-Art library | |||
| * Copyright (c) 2002-2006 Sam Hocevar <sam@zoy.org> | |||
| * All Rights Reserved | |||
| * | |||
| @@ -13,7 +13,7 @@ | |||
| */ | |||
| /* | |||
| * This file contains the main functions used by \e libcucul applications | |||
| * This file contains the main functions used by \e libcaca applications | |||
| * to initialise a drawing context. | |||
| */ | |||
| @@ -30,16 +30,16 @@ | |||
| # endif | |||
| #endif | |||
| #include "cucul.h" | |||
| #include "cucul_internals.h" | |||
| #include "caca.h" | |||
| #include "caca_internals.h" | |||
| static int cucul_resize(cucul_canvas_t *, int, int); | |||
| static int caca_resize(caca_canvas_t *, int, int); | |||
| /** \brief Initialise a \e libcucul canvas. | |||
| /** \brief Initialise a \e libcaca canvas. | |||
| * | |||
| * Initialise internal \e libcucul structures and the backend that will | |||
| * Initialise internal \e libcaca structures and the backend that will | |||
| * be used for subsequent graphical operations. It must be the first | |||
| * \e libcucul function to be called in a function. cucul_free_canvas() | |||
| * \e libcaca function to be called in a function. caca_free_canvas() | |||
| * should be called at the end of the program to free all allocated resources. | |||
| * | |||
| * Both the cursor and the canvas' handle are initialised at the top-left | |||
| @@ -51,11 +51,11 @@ static int cucul_resize(cucul_canvas_t *, int, int); | |||
| * | |||
| * \param width The desired canvas width | |||
| * \param height The desired canvas height | |||
| * \return A libcucul canvas handle upon success, NULL if an error occurred. | |||
| * \return A libcaca canvas handle upon success, NULL if an error occurred. | |||
| */ | |||
| cucul_canvas_t * cucul_create_canvas(int width, int height) | |||
| caca_canvas_t * caca_create_canvas(int width, int height) | |||
| { | |||
| cucul_canvas_t *cv; | |||
| caca_canvas_t *cv; | |||
| if(width < 0 || height < 0) | |||
| { | |||
| @@ -63,7 +63,7 @@ cucul_canvas_t * cucul_create_canvas(int width, int height) | |||
| return NULL; | |||
| } | |||
| cv = malloc(sizeof(cucul_canvas_t)); | |||
| cv = malloc(sizeof(caca_canvas_t)); | |||
| if(!cv) | |||
| goto nomem; | |||
| @@ -75,7 +75,7 @@ cucul_canvas_t * cucul_create_canvas(int width, int height) | |||
| cv->frame = 0; | |||
| cv->framecount = 1; | |||
| cv->frames = malloc(sizeof(struct cucul_frame)); | |||
| cv->frames = malloc(sizeof(struct caca_frame)); | |||
| if(!cv->frames) | |||
| { | |||
| free(cv); | |||
| @@ -90,12 +90,12 @@ cucul_canvas_t * cucul_create_canvas(int width, int height) | |||
| cv->frames[0].curattr = 0; | |||
| cv->frames[0].name = strdup("frame#00000000"); | |||
| _cucul_load_frame_info(cv); | |||
| cucul_set_color_ansi(cv, CUCUL_DEFAULT, CUCUL_TRANSPARENT); | |||
| _caca_load_frame_info(cv); | |||
| caca_set_color_ansi(cv, CACA_DEFAULT, CACA_TRANSPARENT); | |||
| cv->ff = NULL; | |||
| if(cucul_resize(cv, width, height) < 0) | |||
| if(caca_resize(cv, width, height) < 0) | |||
| { | |||
| int saved_errno = geterrno(); | |||
| free(cv->frames[0].name); | |||
| @@ -116,7 +116,7 @@ nomem: | |||
| * | |||
| * Lock a canvas to prevent it from being resized. If non-NULL, | |||
| * the \e callback function pointer will be called upon each | |||
| * \e cucul_set_canvas_size call and if the returned value is zero, the | |||
| * \e caca_set_canvas_size call and if the returned value is zero, the | |||
| * canvas resize request will be denied. | |||
| * | |||
| * This function is only useful for display drivers such as the \e libcaca | |||
| @@ -125,12 +125,12 @@ nomem: | |||
| * If an error occurs, -1 is returned and \b errno is set accordingly: | |||
| * - \c EBUSY The canvas is already being managed. | |||
| * | |||
| * \param cv A libcucul canvas. | |||
| * \param cv A libcaca canvas. | |||
| * \param callback An optional callback function pointer. | |||
| * \param p The argument to be passed to \e callback. | |||
| * \return 0 in case of success, -1 if an error occurred. | |||
| */ | |||
| int cucul_manage_canvas(cucul_canvas_t *cv, int (*callback)(void *), void *p) | |||
| int caca_manage_canvas(caca_canvas_t *cv, int (*callback)(void *), void *p) | |||
| { | |||
| if(cv->refcount) | |||
| { | |||
| @@ -147,9 +147,9 @@ int cucul_manage_canvas(cucul_canvas_t *cv, int (*callback)(void *), void *p) | |||
| /** \brief Unmanage a canvas. | |||
| * | |||
| * Unlock a canvas previously locked by cucul_manage_canvas(). For safety | |||
| * Unlock a canvas previously locked by caca_manage_canvas(). For safety | |||
| * reasons, the callback and callback data arguments must be the same as for | |||
| * the cucul_manage_canvas() call. | |||
| * the caca_manage_canvas() call. | |||
| * | |||
| * This function is only useful for display drivers such as the \e libcaca | |||
| * library. | |||
| @@ -158,13 +158,13 @@ int cucul_manage_canvas(cucul_canvas_t *cv, int (*callback)(void *), void *p) | |||
| * - \c EINVAL The canvas is not managed, or the callback arguments do | |||
| * not match. | |||
| * | |||
| * \param cv A libcucul canvas. | |||
| * \param cv A libcaca canvas. | |||
| * \param callback The \e callback argument previously passed to | |||
| cucul_manage_canvas(). | |||
| * \param p The \e p argument previously passed to cucul_manage_canvas(). | |||
| caca_manage_canvas(). | |||
| * \param p The \e p argument previously passed to caca_manage_canvas(). | |||
| * \return 0 in case of success, -1 if an error occurred. | |||
| */ | |||
| int cucul_unmanage_canvas(cucul_canvas_t *cv, int (*callback)(void *), void *p) | |||
| int caca_unmanage_canvas(caca_canvas_t *cv, int (*callback)(void *), void *p) | |||
| { | |||
| if(!cv->refcount | |||
| || cv->resize_callback != callback || cv->resize_data != p) | |||
| @@ -204,12 +204,12 @@ int cucul_unmanage_canvas(cucul_canvas_t *cv, int (*callback)(void *), void *p) | |||
| * - \c ENOMEM Not enough memory for the requested canvas size. If this | |||
| * happens, the canvas handle becomes invalid and should not be used. | |||
| * | |||
| * \param cv A libcucul canvas. | |||
| * \param cv A libcaca canvas. | |||
| * \param width The desired canvas width. | |||
| * \param height The desired canvas height. | |||
| * \return 0 in case of success, -1 if an error occurred. | |||
| */ | |||
| int cucul_set_canvas_size(cucul_canvas_t *cv, int width, int height) | |||
| int caca_set_canvas_size(caca_canvas_t *cv, int width, int height) | |||
| { | |||
| if(width < 0 || height < 0) | |||
| { | |||
| @@ -224,7 +224,7 @@ int cucul_set_canvas_size(cucul_canvas_t *cv, int width, int height) | |||
| return -1; | |||
| } | |||
| return cucul_resize(cv, width, height); | |||
| return caca_resize(cv, width, height); | |||
| } | |||
| /** \brief Get the canvas width. | |||
| @@ -233,10 +233,10 @@ int cucul_set_canvas_size(cucul_canvas_t *cv, int width, int height) | |||
| * | |||
| * This function never fails. | |||
| * | |||
| * \param cv A libcucul canvas. | |||
| * \param cv A libcaca canvas. | |||
| * \return The canvas width. | |||
| */ | |||
| int cucul_get_canvas_width(cucul_canvas_t const *cv) | |||
| int caca_get_canvas_width(caca_canvas_t const *cv) | |||
| { | |||
| return cv->width; | |||
| } | |||
| @@ -247,10 +247,10 @@ int cucul_get_canvas_width(cucul_canvas_t const *cv) | |||
| * | |||
| * This function never fails. | |||
| * | |||
| * \param cv A libcucul canvas. | |||
| * \param cv A libcaca canvas. | |||
| * \return The canvas height. | |||
| */ | |||
| int cucul_get_canvas_height(cucul_canvas_t const *cv) | |||
| int caca_get_canvas_height(caca_canvas_t const *cv) | |||
| { | |||
| return cv->height; | |||
| } | |||
| @@ -259,17 +259,17 @@ int cucul_get_canvas_height(cucul_canvas_t const *cv) | |||
| * | |||
| * Return the current canvas' internal character array. The array elements | |||
| * consist in native endian 32-bit Unicode values as returned by | |||
| * cucul_get_char(). | |||
| * caca_get_char(). | |||
| * | |||
| * This function is only useful for display drivers such as the \e libcaca | |||
| * library. | |||
| * | |||
| * This function never fails. | |||
| * | |||
| * \param cv A libcucul canvas. | |||
| * \param cv A libcaca canvas. | |||
| * \return The canvas character array. | |||
| */ | |||
| uint8_t const * cucul_get_canvas_chars(cucul_canvas_t const *cv) | |||
| uint8_t const * caca_get_canvas_chars(caca_canvas_t const *cv) | |||
| { | |||
| return (uint8_t const *)cv->chars; | |||
| } | |||
| @@ -278,34 +278,34 @@ uint8_t const * cucul_get_canvas_chars(cucul_canvas_t const *cv) | |||
| * | |||
| * Returns the current canvas' internal attribute array. The array elements | |||
| * consist in native endian 32-bit attribute values as returned by | |||
| * cucul_get_attr(). | |||
| * caca_get_attr(). | |||
| * | |||
| * This function is only useful for display drivers such as the \e libcaca | |||
| * library. | |||
| * | |||
| * This function never fails. | |||
| * | |||
| * \param cv A libcucul canvas. | |||
| * \param cv A libcaca canvas. | |||
| * \return The canvas attribute array. | |||
| */ | |||
| uint8_t const * cucul_get_canvas_attrs(cucul_canvas_t const *cv) | |||
| uint8_t const * caca_get_canvas_attrs(caca_canvas_t const *cv) | |||
| { | |||
| return (uint8_t const *)cv->attrs; | |||
| } | |||
| /** \brief Uninitialise \e libcucul. | |||
| /** \brief Uninitialise \e libcaca. | |||
| * | |||
| * Free all resources allocated by cucul_create_canvas(). After | |||
| * this function has been called, no other \e libcucul functions may be | |||
| * used unless a new call to cucul_create_canvas() is done. | |||
| * Free all resources allocated by caca_create_canvas(). After | |||
| * this function has been called, no other \e libcaca functions may be | |||
| * used unless a new call to caca_create_canvas() is done. | |||
| * | |||
| * If an error occurs, -1 is returned and \b errno is set accordingly: | |||
| * - \c EBUSY The canvas is in use by a display driver and cannot be freed. | |||
| * | |||
| * \param cv A libcucul canvas. | |||
| * \param cv A libcaca canvas. | |||
| * \return 0 in case of success, -1 if an error occurred. | |||
| */ | |||
| int cucul_free_canvas(cucul_canvas_t *cv) | |||
| int caca_free_canvas(caca_canvas_t *cv) | |||
| { | |||
| int f; | |||
| @@ -322,7 +322,7 @@ int cucul_free_canvas(cucul_canvas_t *cv) | |||
| free(cv->frames[f].name); | |||
| } | |||
| cucul_canvas_set_figfont(cv, NULL); | |||
| caca_canvas_set_figfont(cv, NULL); | |||
| free(cv->frames); | |||
| free(cv); | |||
| @@ -341,7 +341,7 @@ int cucul_free_canvas(cucul_canvas_t *cv) | |||
| * \return A random integer comprised between \p min and \p max - 1 | |||
| * (inclusive). | |||
| */ | |||
| int cucul_rand(int min, int max) | |||
| int caca_rand(int min, int max) | |||
| { | |||
| static int need_init = 1; | |||
| @@ -354,24 +354,12 @@ int cucul_rand(int min, int max) | |||
| return min + (int)((1.0 * (max - min)) * rand() / (RAND_MAX + 1.0)); | |||
| } | |||
| /** \brief Return the \e libcucul version. | |||
| * | |||
| * Return a read-only string with the \e libcucul version information. | |||
| * | |||
| * This function never fails. | |||
| * | |||
| * \return The \e libcucul version information. | |||
| */ | |||
| char const * cucul_get_version(void) | |||
| { | |||
| return VERSION; | |||
| } | |||
| /* | |||
| * XXX: The following functions are local. | |||
| */ | |||
| int cucul_resize(cucul_canvas_t *cv, int width, int height) | |||
| int caca_resize(caca_canvas_t *cv, int width, int height) | |||
| { | |||
| int x, y, f, old_width, old_height, new_size, old_size; | |||
| @@ -379,7 +367,7 @@ int cucul_resize(cucul_canvas_t *cv, int width, int height) | |||
| old_height = cv->height; | |||
| old_size = old_width * old_height; | |||
| _cucul_save_frame_info(cv); | |||
| _caca_save_frame_info(cv); | |||
| cv->width = width; | |||
| cv->height = height; | |||
| @@ -507,7 +495,7 @@ int cucul_resize(cucul_canvas_t *cv, int width, int height) | |||
| } | |||
| /* Reset the current frame shortcuts */ | |||
| _cucul_load_frame_info(cv); | |||
| _caca_load_frame_info(cv); | |||
| return 0; | |||
| } | |||
| @@ -1,5 +1,5 @@ | |||
| /* | |||
| * libcucul Canvas for ultrafast compositing of Unicode letters | |||
| * libcaca Colour ASCII-Art library | |||
| * Copyright (c) 2002-2007 Sam Hocevar <sam@zoy.org> | |||
| * 2007 Ben Wiley Sittler <bsittler@gmail.com> | |||
| * All Rights Reserved | |||
| @@ -24,8 +24,8 @@ | |||
| # include <string.h> | |||
| #endif | |||
| #include "cucul.h" | |||
| #include "cucul_internals.h" | |||
| #include "caca.h" | |||
| #include "caca_internals.h" | |||
| /* | |||
| * UTF-8 handling | |||
| @@ -111,7 +111,7 @@ static uint32_t const cp437_lookup2[] = | |||
| * \return The corresponding UTF-32 character, or zero if the character | |||
| * is incomplete. | |||
| */ | |||
| uint32_t cucul_utf8_to_utf32(char const *s, size_t *bytes) | |||
| uint32_t caca_utf8_to_utf32(char const *s, size_t *bytes) | |||
| { | |||
| int todo = trailing[(int)(unsigned char)*s]; | |||
| int i = 0; | |||
| @@ -150,7 +150,7 @@ uint32_t cucul_utf8_to_utf32(char const *s, size_t *bytes) | |||
| * \param ch The UTF-32 character. | |||
| * \return The number of bytes written. | |||
| */ | |||
| size_t cucul_utf32_to_utf8(char *buf, uint32_t ch) | |||
| size_t caca_utf32_to_utf8(char *buf, uint32_t ch) | |||
| { | |||
| static const uint8_t mark[7] = | |||
| { | |||
| @@ -190,7 +190,7 @@ size_t cucul_utf32_to_utf8(char *buf, uint32_t ch) | |||
| * \param ch The UTF-32 character. | |||
| * \return The corresponding CP437 character, or "?" if not representable. | |||
| */ | |||
| uint8_t cucul_utf32_to_cp437(uint32_t ch) | |||
| uint8_t caca_utf32_to_cp437(uint32_t ch) | |||
| { | |||
| unsigned int i; | |||
| @@ -222,7 +222,7 @@ uint8_t cucul_utf32_to_cp437(uint32_t ch) | |||
| * \param ch The CP437 character. | |||
| * \return The corresponding UTF-32 character, or zero if not representable. | |||
| */ | |||
| uint32_t cucul_cp437_to_utf32(uint8_t ch) | |||
| uint32_t caca_cp437_to_utf32(uint8_t ch) | |||
| { | |||
| if(ch > 0x7f) | |||
| return cp437_lookup2[ch - 0x7f]; | |||
| @@ -248,7 +248,7 @@ uint32_t cucul_cp437_to_utf32(uint8_t ch) | |||
| * \return The corresponding ASCII character, or a graphically close | |||
| * equivalent if found, or "?" if not representable. | |||
| */ | |||
| char cucul_utf32_to_ascii(uint32_t ch) | |||
| char caca_utf32_to_ascii(uint32_t ch) | |||
| { | |||
| /* Standard ASCII */ | |||
| if(ch < 0x80) | |||
| @@ -387,7 +387,7 @@ char cucul_utf32_to_ascii(uint32_t ch) | |||
| * \param ch The UTF-32 character. | |||
| * \return 1 if the character is fullwidth, 0 otherwise. | |||
| */ | |||
| int cucul_utf32_is_fullwidth(uint32_t ch) | |||
| int caca_utf32_is_fullwidth(uint32_t ch) | |||
| { | |||
| if(ch < 0x2e80) /* Standard stuff */ | |||
| return 0; | |||
| @@ -1,5 +1,5 @@ | |||
| /* | |||
| * libcucul Canvas for ultrafast compositing of Unicode letters | |||
| * libcaca Colour ASCII-Art library | |||
| * Copyright (c) 2002-2006 Sam Hocevar <sam@zoy.org> | |||
| * All Rights Reserved | |||
| * | |||
| @@ -23,23 +23,23 @@ | |||
| # include <stdlib.h> | |||
| #endif | |||
| #include "cucul.h" | |||
| #include "cucul_internals.h" | |||
| #include "caca.h" | |||
| #include "caca_internals.h" | |||
| static void ellipsepoints(cucul_canvas_t *, int, int, int, int, uint32_t, int); | |||
| static void ellipsepoints(caca_canvas_t *, int, int, int, int, uint32_t, int); | |||
| /** \brief Draw a circle on the canvas using the given character. | |||
| * | |||
| * This function never fails. | |||
| * | |||
| * \param cv The handle to the libcucul canvas. | |||
| * \param cv The handle to the libcaca canvas. | |||
| * \param x Center X coordinate. | |||
| * \param y Center Y coordinate. | |||
| * \param r Circle radius. | |||
| * \param ch UTF-32 character to be used to draw the circle outline. | |||
| * \return This function always returns 0. | |||
| */ | |||
| int cucul_draw_circle(cucul_canvas_t *cv, int x, int y, int r, uint32_t ch) | |||
| int caca_draw_circle(caca_canvas_t *cv, int x, int y, int r, uint32_t ch) | |||
| { | |||
| int test, dx, dy; | |||
| @@ -59,7 +59,7 @@ int cucul_draw_circle(cucul_canvas_t *cv, int x, int y, int r, uint32_t ch) | |||
| * | |||
| * This function never fails. | |||
| * | |||
| * \param cv The handle to the libcucul canvas. | |||
| * \param cv The handle to the libcaca canvas. | |||
| * \param xo Center X coordinate. | |||
| * \param yo Center Y coordinate. | |||
| * \param a Ellipse X radius. | |||
| @@ -67,7 +67,7 @@ int cucul_draw_circle(cucul_canvas_t *cv, int x, int y, int r, uint32_t ch) | |||
| * \param ch UTF-32 character to be used to fill the ellipse. | |||
| * \return This function always returns 0. | |||
| */ | |||
| int cucul_fill_ellipse(cucul_canvas_t *cv, int xo, int yo, int a, int b, | |||
| int caca_fill_ellipse(caca_canvas_t *cv, int xo, int yo, int a, int b, | |||
| uint32_t ch) | |||
| { | |||
| int d2; | |||
| @@ -84,15 +84,15 @@ int cucul_fill_ellipse(cucul_canvas_t *cv, int xo, int yo, int a, int b, | |||
| else | |||
| { | |||
| d1 += b*b*(2*x*1) + a*a*(-2*y+2); | |||
| cucul_draw_line(cv, xo - x, yo - y, xo + x, yo - y, ch); | |||
| cucul_draw_line(cv, xo - x, yo + y, xo + x, yo + y, ch); | |||
| caca_draw_line(cv, xo - x, yo - y, xo + x, yo - y, ch); | |||
| caca_draw_line(cv, xo - x, yo + y, xo + x, yo + y, ch); | |||
| y--; | |||
| } | |||
| x++; | |||
| } | |||
| cucul_draw_line(cv, xo - x, yo - y, xo + x, yo - y, ch); | |||
| cucul_draw_line(cv, xo - x, yo + y, xo + x, yo + y, ch); | |||
| caca_draw_line(cv, xo - x, yo - y, xo + x, yo - y, ch); | |||
| caca_draw_line(cv, xo - x, yo + y, xo + x, yo + y, ch); | |||
| d2 = b*b*(x+0.5)*(x+0.5) + a*a*(y-1)*(y-1) - a*a*b*b; | |||
| while(y > 0) | |||
| @@ -108,8 +108,8 @@ int cucul_fill_ellipse(cucul_canvas_t *cv, int xo, int yo, int a, int b, | |||
| } | |||
| y--; | |||
| cucul_draw_line(cv, xo - x, yo - y, xo + x, yo - y, ch); | |||
| cucul_draw_line(cv, xo - x, yo + y, xo + x, yo + y, ch); | |||
| caca_draw_line(cv, xo - x, yo - y, xo + x, yo - y, ch); | |||
| caca_draw_line(cv, xo - x, yo + y, xo + x, yo + y, ch); | |||
| } | |||
| return 0; | |||
| @@ -119,7 +119,7 @@ int cucul_fill_ellipse(cucul_canvas_t *cv, int xo, int yo, int a, int b, | |||
| * | |||
| * This function never fails. | |||
| * | |||
| * \param cv The handle to the libcucul canvas. | |||
| * \param cv The handle to the libcaca canvas. | |||
| * \param xo Center X coordinate. | |||
| * \param yo Center Y coordinate. | |||
| * \param a Ellipse X radius. | |||
| @@ -127,7 +127,7 @@ int cucul_fill_ellipse(cucul_canvas_t *cv, int xo, int yo, int a, int b, | |||
| * \param ch UTF-32 character to be used to draw the ellipse outline. | |||
| * \return This function always returns 0. | |||
| */ | |||
| int cucul_draw_ellipse(cucul_canvas_t *cv, int xo, int yo, int a, int b, | |||
| int caca_draw_ellipse(caca_canvas_t *cv, int xo, int yo, int a, int b, | |||
| uint32_t ch) | |||
| { | |||
| int d2; | |||
| @@ -176,14 +176,14 @@ int cucul_draw_ellipse(cucul_canvas_t *cv, int xo, int yo, int a, int b, | |||
| * | |||
| * This function never fails. | |||
| * | |||
| * \param cv The handle to the libcucul canvas. | |||
| * \param cv The handle to the libcaca canvas. | |||
| * \param xo Center X coordinate. | |||
| * \param yo Center Y coordinate. | |||
| * \param a Ellipse X radius. | |||
| * \param b Ellipse Y radius. | |||
| * \return This function always returns 0. | |||
| */ | |||
| int cucul_draw_thin_ellipse(cucul_canvas_t *cv, int xo, int yo, int a, int b) | |||
| int caca_draw_thin_ellipse(caca_canvas_t *cv, int xo, int yo, int a, int b) | |||
| { | |||
| /* FIXME: this is not correct */ | |||
| int d2; | |||
| @@ -234,7 +234,7 @@ int cucul_draw_thin_ellipse(cucul_canvas_t *cv, int xo, int yo, int a, int b) | |||
| return 0; | |||
| } | |||
| static void ellipsepoints(cucul_canvas_t *cv, int xo, int yo, int x, int y, | |||
| static void ellipsepoints(caca_canvas_t *cv, int xo, int yo, int x, int y, | |||
| uint32_t ch, int thin) | |||
| { | |||
| uint8_t b = 0; | |||
| @@ -268,7 +268,7 @@ static void ellipsepoints(cucul_canvas_t *cv, int xo, int yo, int x, int y, | |||
| } | |||
| } | |||
| cucul_put_char(cv, xo + x, yo + y, c); | |||
| caca_put_char(cv, xo + x, yo + y, c); | |||
| } | |||
| if((b & (0x2|0x4)) == (0x2|0x4)) { | |||
| uint32_t c = ch; | |||
| @@ -290,7 +290,7 @@ static void ellipsepoints(cucul_canvas_t *cv, int xo, int yo, int x, int y, | |||
| } | |||
| } | |||
| cucul_put_char(cv, xo - x, yo + y, c); | |||
| caca_put_char(cv, xo - x, yo + y, c); | |||
| } | |||
| @@ -314,7 +314,7 @@ static void ellipsepoints(cucul_canvas_t *cv, int xo, int yo, int x, int y, | |||
| } | |||
| } | |||
| cucul_put_char(cv, xo + x, yo - y, c); | |||
| caca_put_char(cv, xo + x, yo - y, c); | |||
| } | |||
| if((b & (0x2|0x8)) == (0x2|0x8)) { | |||
| @@ -337,7 +337,7 @@ static void ellipsepoints(cucul_canvas_t *cv, int xo, int yo, int x, int y, | |||
| } | |||
| } | |||
| cucul_put_char(cv, xo - x, yo - y, c); | |||
| caca_put_char(cv, xo - x, yo - y, c); | |||
| } | |||
| @@ -1,5 +1,5 @@ | |||
| /* | |||
| * libcucul Canvas for ultrafast compositing of Unicode letters | |||
| * libcaca Colour ASCII-Art library | |||
| * Copyright (c) 2002-2006 Sam Hocevar <sam@zoy.org> | |||
| * All Rights Reserved | |||
| * | |||
| @@ -28,8 +28,8 @@ | |||
| # include <string.h> | |||
| #endif | |||
| #include "cucul.h" | |||
| #include "cucul_internals.h" | |||
| #include "caca.h" | |||
| #include "caca_internals.h" | |||
| #define CP437 0 | |||
| @@ -115,14 +115,14 @@ enum color_mode | |||
| COLOR_MODE_FULL16 | |||
| }; | |||
| struct cucul_dither | |||
| struct caca_dither | |||
| { | |||
| int bpp, has_palette, has_alpha; | |||
| int w, h, pitch; | |||
| int rmask, gmask, bmask, amask; | |||
| int rright, gright, bright, aright; | |||
| int rleft, gleft, bleft, aleft; | |||
| void (*get_hsv)(cucul_dither_t *, char *, int, int); | |||
| void (*get_hsv)(caca_dither_t *, char *, int, int); | |||
| int red[256], green[256], blue[256], alpha[256]; | |||
| /* Colour features */ | |||
| @@ -172,7 +172,7 @@ struct cucul_dither | |||
| static void mask2shift(uint32_t, int *, int *); | |||
| static float gammapow(float x, float y); | |||
| static void get_rgba_default(cucul_dither_t const *, uint8_t *, int, int, | |||
| static void get_rgba_default(caca_dither_t const *, uint8_t *, int, int, | |||
| unsigned int *); | |||
| static int init_lookup(void); | |||
| @@ -242,7 +242,7 @@ static inline void rgb2hsv_default(int r, int g, int b, | |||
| * Create a dither structure from its coordinates (depth, width, height and | |||
| * pitch) and pixel mask values. If the depth is 8 bits per pixel, the mask | |||
| * values are ignored and the colour palette should be set using the | |||
| * cucul_set_dither_palette() function. For depths greater than 8 bits per | |||
| * caca_set_dither_palette() function. For depths greater than 8 bits per | |||
| * pixel, a zero alpha mask causes the alpha values to be ignored. | |||
| * | |||
| * If an error occurs, NULL is returned and \b errno is set accordingly: | |||
| @@ -260,11 +260,11 @@ static inline void rgb2hsv_default(int r, int g, int b, | |||
| * \param amask Bitmask for alpha values. | |||
| * \return Dither object upon success, NULL if an error occurred. | |||
| */ | |||
| cucul_dither_t *cucul_create_dither(int bpp, int w, int h, int pitch, | |||
| caca_dither_t *caca_create_dither(int bpp, int w, int h, int pitch, | |||
| uint32_t rmask, uint32_t gmask, | |||
| uint32_t bmask, uint32_t amask) | |||
| { | |||
| cucul_dither_t *d; | |||
| caca_dither_t *d; | |||
| int i; | |||
| /* Minor sanity test */ | |||
| @@ -274,7 +274,7 @@ cucul_dither_t *cucul_create_dither(int bpp, int w, int h, int pitch, | |||
| return NULL; | |||
| } | |||
| d = malloc(sizeof(cucul_dither_t)); | |||
| d = malloc(sizeof(caca_dither_t)); | |||
| if(!d) | |||
| { | |||
| seterrno(ENOMEM); | |||
| @@ -371,7 +371,7 @@ cucul_dither_t *cucul_create_dither(int bpp, int w, int h, int pitch, | |||
| * \param alpha Array of 256 alpha values. | |||
| * \return 0 in case of success, -1 if an error occurred. | |||
| */ | |||
| int cucul_set_dither_palette(cucul_dither_t *d, | |||
| int caca_set_dither_palette(caca_dither_t *d, | |||
| uint32_t red[], uint32_t green[], | |||
| uint32_t blue[], uint32_t alpha[]) | |||
| { | |||
| @@ -420,7 +420,7 @@ int cucul_set_dither_palette(cucul_dither_t *d, | |||
| * \param brightness brightness value. | |||
| * \return 0 in case of success, -1 if an error occurred. | |||
| */ | |||
| int cucul_set_dither_brightness(cucul_dither_t *d, float brightness) | |||
| int caca_set_dither_brightness(caca_dither_t *d, float brightness) | |||
| { | |||
| /* FIXME */ | |||
| d->brightness = brightness; | |||
| @@ -437,7 +437,7 @@ int cucul_set_dither_brightness(cucul_dither_t *d, float brightness) | |||
| * \param d Dither object. | |||
| * \return Brightness value. | |||
| */ | |||
| float cucul_get_dither_brightness(cucul_dither_t const *d) | |||
| float caca_get_dither_brightness(caca_dither_t const *d) | |||
| { | |||
| return d->brightness; | |||
| } | |||
| @@ -454,7 +454,7 @@ float cucul_get_dither_brightness(cucul_dither_t const *d) | |||
| * \param gamma Gamma value. | |||
| * \return 0 in case of success, -1 if an error occurred. | |||
| */ | |||
| int cucul_set_dither_gamma(cucul_dither_t *d, float gamma) | |||
| int caca_set_dither_gamma(caca_dither_t *d, float gamma) | |||
| { | |||
| /* FIXME: we don't need 4096 calls to gammapow(), we could just compute | |||
| * a few of them and do linear interpolation for the rest. This will | |||
| @@ -489,7 +489,7 @@ int cucul_set_dither_gamma(cucul_dither_t *d, float gamma) | |||
| * \param d Dither object. | |||
| * \return Gamma value. | |||
| */ | |||
| float cucul_get_dither_gamma(cucul_dither_t const *d) | |||
| float caca_get_dither_gamma(caca_dither_t const *d) | |||
| { | |||
| return d->gamma; | |||
| } | |||
| @@ -505,7 +505,7 @@ float cucul_get_dither_gamma(cucul_dither_t const *d) | |||
| * \param contrast contrast value. | |||
| * \return 0 in case of success, -1 if an error occurred. | |||
| */ | |||
| int cucul_set_dither_contrast(cucul_dither_t *d, float contrast) | |||
| int caca_set_dither_contrast(caca_dither_t *d, float contrast) | |||
| { | |||
| /* FIXME */ | |||
| d->contrast = contrast; | |||
| @@ -522,7 +522,7 @@ int cucul_set_dither_contrast(cucul_dither_t *d, float contrast) | |||
| * \param d Dither object. | |||
| * \return Contrast value. | |||
| */ | |||
| float cucul_get_dither_contrast(cucul_dither_t const *d) | |||
| float caca_get_dither_contrast(caca_dither_t const *d) | |||
| { | |||
| return d->contrast; | |||
| } | |||
| @@ -543,7 +543,7 @@ float cucul_get_dither_contrast(cucul_dither_t const *d) | |||
| * for the dithering. | |||
| * \return 0 in case of success, -1 if an error occurred. | |||
| */ | |||
| int cucul_set_dither_antialias(cucul_dither_t *d, char const *str) | |||
| int caca_set_dither_antialias(caca_dither_t *d, char const *str) | |||
| { | |||
| if(!strcasecmp(str, "none")) | |||
| { | |||
| @@ -569,7 +569,7 @@ int cucul_set_dither_antialias(cucul_dither_t *d, char const *str) | |||
| * Return a list of available antialiasing methods for a given dither. The | |||
| * list is a NULL-terminated array of strings, interleaving a string | |||
| * containing the internal value for the antialiasing method to be used with | |||
| * cucul_set_dither_antialias(), and a string containing the natural | |||
| * caca_set_dither_antialias(), and a string containing the natural | |||
| * language description for that antialiasing method. | |||
| * | |||
| * This function never fails. | |||
| @@ -578,7 +578,7 @@ int cucul_set_dither_antialias(cucul_dither_t *d, char const *str) | |||
| * \return An array of strings. | |||
| */ | |||
| char const * const * | |||
| cucul_get_dither_antialias_list(cucul_dither_t const *d) | |||
| caca_get_dither_antialias_list(caca_dither_t const *d) | |||
| { | |||
| static char const * const list[] = | |||
| { | |||
| @@ -599,7 +599,7 @@ char const * const * | |||
| * \param d Dither object. | |||
| * \return A static string. | |||
| */ | |||
| char const * cucul_get_dither_antialias(cucul_dither_t const *d) | |||
| char const * caca_get_dither_antialias(caca_dither_t const *d) | |||
| { | |||
| return d->antialias_name; | |||
| } | |||
| @@ -627,7 +627,7 @@ char const * cucul_get_dither_antialias(cucul_dither_t const *d) | |||
| * for the dithering. | |||
| * \return 0 in case of success, -1 if an error occurred. | |||
| */ | |||
| int cucul_set_dither_color(cucul_dither_t *d, char const *str) | |||
| int caca_set_dither_color(caca_dither_t *d, char const *str) | |||
| { | |||
| if(!strcasecmp(str, "mono")) | |||
| { | |||
| @@ -678,7 +678,7 @@ int cucul_set_dither_color(cucul_dither_t *d, char const *str) | |||
| * Return a list of available colour modes for a given dither. The list | |||
| * is a NULL-terminated array of strings, interleaving a string containing | |||
| * the internal value for the colour mode, to be used with | |||
| * cucul_set_dither_color(), and a string containing the natural | |||
| * caca_set_dither_color(), and a string containing the natural | |||
| * language description for that colour mode. | |||
| * | |||
| * This function never fails. | |||
| @@ -687,7 +687,7 @@ int cucul_set_dither_color(cucul_dither_t *d, char const *str) | |||
| * \return An array of strings. | |||
| */ | |||
| char const * const * | |||
| cucul_get_dither_color_list(cucul_dither_t const *d) | |||
| caca_get_dither_color_list(caca_dither_t const *d) | |||
| { | |||
| static char const * const list[] = | |||
| { | |||
| @@ -713,7 +713,7 @@ char const * const * | |||
| * \param d Dither object. | |||
| * \return A static string. | |||
| */ | |||
| char const * cucul_get_dither_color(cucul_dither_t const *d) | |||
| char const * caca_get_dither_color(caca_dither_t const *d) | |||
| { | |||
| return d->color_name; | |||
| } | |||
| @@ -738,7 +738,7 @@ char const * cucul_get_dither_color(cucul_dither_t const *d) | |||
| * for the dithering. | |||
| * \return 0 in case of success, -1 if an error occurred. | |||
| */ | |||
| int cucul_set_dither_charset(cucul_dither_t *d, char const *str) | |||
| int caca_set_dither_charset(caca_dither_t *d, char const *str) | |||
| { | |||
| if(!strcasecmp(str, "shades")) | |||
| { | |||
| @@ -772,7 +772,7 @@ int cucul_set_dither_charset(cucul_dither_t *d, char const *str) | |||
| * Return a list of available character sets for a given dither. The list | |||
| * is a NULL-terminated array of strings, interleaving a string containing | |||
| * the internal value for the character set, to be used with | |||
| * cucul_set_dither_charset(), and a string containing the natural | |||
| * caca_set_dither_charset(), and a string containing the natural | |||
| * language description for that character set. | |||
| * | |||
| * This function never fails. | |||
| @@ -780,7 +780,7 @@ int cucul_set_dither_charset(cucul_dither_t *d, char const *str) | |||
| * \param d Dither object. | |||
| * \return An array of strings. | |||
| */ | |||
| char const * const * cucul_get_dither_charset_list(cucul_dither_t const *d) | |||
| char const * const * caca_get_dither_charset_list(caca_dither_t const *d) | |||
| { | |||
| static char const * const list[] = | |||
| { | |||
| @@ -802,7 +802,7 @@ char const * const * cucul_get_dither_charset_list(cucul_dither_t const *d) | |||
| * \param d Dither object. | |||
| * \return A static string. | |||
| */ | |||
| char const * cucul_get_dither_charset(cucul_dither_t const *d) | |||
| char const * caca_get_dither_charset(caca_dither_t const *d) | |||
| { | |||
| return d->glyph_name; | |||
| } | |||
| @@ -827,7 +827,7 @@ char const * cucul_get_dither_charset(cucul_dither_t const *d) | |||
| * for the dithering. | |||
| * \return 0 in case of success, -1 if an error occurred. | |||
| */ | |||
| int cucul_set_dither_algorithm(cucul_dither_t *d, char const *str) | |||
| int caca_set_dither_algorithm(caca_dither_t *d, char const *str) | |||
| { | |||
| if(!strcasecmp(str, "none")) | |||
| { | |||
| @@ -885,7 +885,7 @@ int cucul_set_dither_algorithm(cucul_dither_t *d, char const *str) | |||
| * Return a list of available dithering algorithms for a given dither. The | |||
| * list is a NULL-terminated array of strings, interleaving a string | |||
| * containing the internal value for the dithering algorithm, to be used | |||
| * with cucul_set_dither_dithering(), and a string containing the natural | |||
| * with caca_set_dither_dithering(), and a string containing the natural | |||
| * language description for that algorithm. | |||
| * | |||
| * This function never fails. | |||
| @@ -893,7 +893,7 @@ int cucul_set_dither_algorithm(cucul_dither_t *d, char const *str) | |||
| * \param d Dither object. | |||
| * \return An array of strings. | |||
| */ | |||
| char const * const * cucul_get_dither_algorithm_list(cucul_dither_t const *d) | |||
| char const * const * caca_get_dither_algorithm_list(caca_dither_t const *d) | |||
| { | |||
| static char const * const list[] = | |||
| { | |||
| @@ -918,7 +918,7 @@ char const * const * cucul_get_dither_algorithm_list(cucul_dither_t const *d) | |||
| * \param d Dither object. | |||
| * \return A static string. | |||
| */ | |||
| char const * cucul_get_dither_algorithm(cucul_dither_t const *d) | |||
| char const * caca_get_dither_algorithm(caca_dither_t const *d) | |||
| { | |||
| return d->algo_name; | |||
| } | |||
| @@ -930,7 +930,7 @@ char const * cucul_get_dither_algorithm(cucul_dither_t const *d) | |||
| * | |||
| * This function never fails. | |||
| * | |||
| * \param cv A handle to the libcucul canvas. | |||
| * \param cv A handle to the libcaca canvas. | |||
| * \param x X coordinate of the upper-left corner of the drawing area. | |||
| * \param y Y coordinate of the upper-left corner of the drawing area. | |||
| * \param w Width of the drawing area. | |||
| @@ -939,8 +939,8 @@ char const * cucul_get_dither_algorithm(cucul_dither_t const *d) | |||
| * \param pixels Bitmap's pixels. | |||
| * \return This function always returns 0. | |||
| */ | |||
| int cucul_dither_bitmap(cucul_canvas_t *cv, int x, int y, int w, int h, | |||
| cucul_dither_t const *d, void *pixels) | |||
| int caca_dither_bitmap(caca_canvas_t *cv, int x, int y, int w, int h, | |||
| caca_dither_t const *d, void *pixels) | |||
| { | |||
| int *floyd_steinberg, *fs_r, *fs_g, *fs_b; | |||
| uint32_t savedattr; | |||
| @@ -950,7 +950,7 @@ int cucul_dither_bitmap(cucul_canvas_t *cv, int x, int y, int w, int h, | |||
| if(!d || !pixels) | |||
| return 0; | |||
| savedattr = cucul_get_attr(cv, -1, -1); | |||
| savedattr = caca_get_attr(cv, -1, -1); | |||
| x1 = x; x2 = x + w - 1; | |||
| y1 = y; y2 = y + h - 1; | |||
| @@ -1127,7 +1127,7 @@ int cucul_dither_bitmap(cucul_canvas_t *cv, int x, int y, int w, int h, | |||
| if(rgba[1] > lum) lum = rgba[1]; | |||
| if(rgba[2] > lum) lum = rgba[2]; | |||
| outfg = outbg; | |||
| outbg = CUCUL_BLACK; | |||
| outbg = CACA_BLACK; | |||
| ch = lum * dchmax / 0x1000; | |||
| if(ch < 0) | |||
| @@ -1169,8 +1169,8 @@ int cucul_dither_bitmap(cucul_canvas_t *cv, int x, int y, int w, int h, | |||
| } | |||
| /* Now output the character */ | |||
| cucul_set_color_ansi(cv, outfg, outbg); | |||
| cucul_put_char(cv, x, y, outch); | |||
| caca_set_color_ansi(cv, outfg, outbg); | |||
| caca_put_char(cv, x, y, outch); | |||
| d->increment_dither(); | |||
| } | |||
| @@ -1179,21 +1179,21 @@ int cucul_dither_bitmap(cucul_canvas_t *cv, int x, int y, int w, int h, | |||
| free(floyd_steinberg); | |||
| cucul_set_attr(cv, savedattr); | |||
| caca_set_attr(cv, savedattr); | |||
| return 0; | |||
| } | |||
| /** \brief Free the memory associated with a dither. | |||
| * | |||
| * Free the memory allocated by cucul_create_dither(). | |||
| * Free the memory allocated by caca_create_dither(). | |||
| * | |||
| * This function never fails. | |||
| * | |||
| * \param d Dither object. | |||
| * \return This function always returns 0. | |||
| */ | |||
| int cucul_free_dither(cucul_dither_t *d) | |||
| int caca_free_dither(caca_dither_t *d) | |||
| { | |||
| if(!d) | |||
| return 0; | |||
| @@ -1296,7 +1296,7 @@ static float gammapow(float x, float y) | |||
| #endif | |||
| } | |||
| static void get_rgba_default(cucul_dither_t const *d, uint8_t *pixels, | |||
| static void get_rgba_default(caca_dither_t const *d, uint8_t *pixels, | |||
| int x, int y, unsigned int *rgba) | |||
| { | |||
| uint32_t bits; | |||
| @@ -1493,7 +1493,7 @@ static void init_random_dither(int line) | |||
| static int get_random_dither(void) | |||
| { | |||
| return cucul_rand(0x00, 0x100); | |||
| return caca_rand(0x00, 0x100); | |||
| } | |||
| static void increment_random_dither(void) | |||
| @@ -1509,16 +1509,16 @@ static int init_lookup(void) | |||
| int v, s, h; | |||
| /* These ones are constant */ | |||
| lookup_colors[0] = CUCUL_BLACK; | |||
| lookup_colors[1] = CUCUL_DARKGRAY; | |||
| lookup_colors[2] = CUCUL_LIGHTGRAY; | |||
| lookup_colors[3] = CUCUL_WHITE; | |||
| lookup_colors[0] = CACA_BLACK; | |||
| lookup_colors[1] = CACA_DARKGRAY; | |||
| lookup_colors[2] = CACA_LIGHTGRAY; | |||
| lookup_colors[3] = CACA_WHITE; | |||
| /* These ones will be overwritten */ | |||
| lookup_colors[4] = CUCUL_MAGENTA; | |||
| lookup_colors[5] = CUCUL_LIGHTMAGENTA; | |||
| lookup_colors[6] = CUCUL_RED; | |||
| lookup_colors[7] = CUCUL_LIGHTRED; | |||
| lookup_colors[4] = CACA_MAGENTA; | |||
| lookup_colors[5] = CACA_LIGHTMAGENTA; | |||
| lookup_colors[6] = CACA_RED; | |||
| lookup_colors[7] = CACA_LIGHTRED; | |||
| for(v = 0; v < LOOKUP_VAL; v++) | |||
| for(s = 0; s < LOOKUP_SAT; s++) | |||
| @@ -23,7 +23,7 @@ | |||
| #import <Cocoa/Cocoa.h> | |||
| #include "cucul.h" | |||
| #include "caca.h" | |||
| #include "caca.h" | |||
| #include "caca_internals.h" | |||
| @@ -195,14 +195,14 @@ static BOOL s_quitting = NO; | |||
| - (void)resizeIfNeeded:(caca_display_t *)dp | |||
| { | |||
| if(_w != cucul_get_canvas_width(dp->cv) | |||
| || _h != cucul_get_canvas_height(dp->cv) | |||
| if(_w != caca_get_canvas_width(dp->cv) | |||
| || _h != caca_get_canvas_height(dp->cv) | |||
| || !_attrs || !_bkg_rects || !_bkg_colors) | |||
| { | |||
| debug_log(@"%s resize to %ux%u", _cmd, _w, _h); | |||
| _w = cucul_get_canvas_width(dp->cv); | |||
| _h = cucul_get_canvas_height(dp->cv); | |||
| _w = caca_get_canvas_width(dp->cv); | |||
| _h = caca_get_canvas_height(dp->cv); | |||
| if(_attrs) | |||
| free(_attrs); | |||
| @@ -216,8 +216,8 @@ static BOOL s_quitting = NO; | |||
| free(_bkg_colors); | |||
| _bkg_colors = malloc(_w * _h * sizeof(NSColor*)); | |||
| [[self window] setContentSize: NSMakeSize(cucul_get_canvas_width(dp->cv) * _font_rect.size.width, | |||
| cucul_get_canvas_height(dp->cv) * _font_rect.size.height)]; | |||
| [[self window] setContentSize: NSMakeSize(caca_get_canvas_width(dp->cv) * _font_rect.size.width, | |||
| caca_get_canvas_height(dp->cv) * _font_rect.size.height)]; | |||
| } | |||
| } | |||
| @@ -228,9 +228,9 @@ static BOOL s_quitting = NO; | |||
| if(_attrs) | |||
| { | |||
| _chars = _attrs + _w * _h; | |||
| memcpy(_attrs, cucul_get_canvas_attrs(dp->cv), | |||
| memcpy(_attrs, caca_get_canvas_attrs(dp->cv), | |||
| _w * _h * sizeof(uint32_t)); | |||
| memcpy(_chars, cucul_get_canvas_chars(dp->cv), | |||
| memcpy(_chars, caca_get_canvas_chars(dp->cv), | |||
| _w * _h * sizeof(uint32_t)); | |||
| [self setNeedsDisplay:TRUE]; | |||
| @@ -270,7 +270,7 @@ static BOOL s_quitting = NO; | |||
| attrs = _attrs + x + y * _w; | |||
| NSColor* color = nil; | |||
| #if USE_RGB12_FGBG | |||
| uint16_t bg = cucul_attr_to_rgb12_bg(*attrs); | |||
| uint16_t bg = caca_attr_to_rgb12_bg(*attrs); | |||
| if(bg) | |||
| { | |||
| # ifdef PRECACHE_WHOLE_COLOR_TABLE | |||
| @@ -288,7 +288,7 @@ static BOOL s_quitting = NO; | |||
| } | |||
| #else | |||
| uint8_t argb[8]; | |||
| cucul_attr_to_argb64(*attrs, argb); | |||
| caca_attr_to_argb64(*attrs, argb); | |||
| color = [NSColor colorWithCalibratedRed:((float)argb[1]) / 15.0 | |||
| green:((float)argb[2]) / 15.0 | |||
| blue:((float)argb[3]) / 15.0 | |||
| @@ -316,7 +316,7 @@ static BOOL s_quitting = NO; | |||
| if(*chars <= 0x00000020) | |||
| continue; | |||
| if(*chars == CUCUL_MAGIC_FULLWIDTH) | |||
| if(*chars == CACA_MAGIC_FULLWIDTH) | |||
| continue; | |||
| /* Plain ASCII, no problem. */ | |||
| @@ -328,7 +328,7 @@ static BOOL s_quitting = NO; | |||
| { | |||
| NSColor* color = nil; | |||
| #if USE_RGB12_FGBG | |||
| uint16_t fg = cucul_attr_to_rgb12_fg(*attrs); | |||
| uint16_t fg = caca_attr_to_rgb12_fg(*attrs); | |||
| # ifdef PRECACHE_WHOLE_COLOR_TABLE | |||
| color = _colorCache[fg]; | |||
| # else // PRECACHE_WHOLE_COLOR_TABLE | |||
| @@ -343,7 +343,7 @@ static BOOL s_quitting = NO; | |||
| # endif // PRECACHE_WHOLE_COLOR_TABLE | |||
| #else // USE_RGB12_FGBG | |||
| uint8_t argb[8]; | |||
| cucul_attr_to_argb64(*attrs, argb); | |||
| caca_attr_to_argb64(*attrs, argb); | |||
| debug_log(@"x,y=[%d,%d] r,g,b back=[%u %u %u] front=[%u %u %u]", | |||
| x, y, argb[1], argb[2], argb[3], argb[5], argb[6], argb[7]); | |||
| color = [NSColor colorWithCalibratedRed:((float)argb[5]) / 15.0 | |||
| @@ -354,7 +354,7 @@ static BOOL s_quitting = NO; | |||
| if(color) | |||
| { | |||
| NSMutableDictionary* attrDict = (*attrs & CUCUL_UNDERLINE) ? | |||
| NSMutableDictionary* attrDict = (*attrs & CACA_UNDERLINE) ? | |||
| _attrDictUnderline : _attrDict; | |||
| [attrDict setObject:color forKey:NSForegroundColorAttributeName]; | |||
| @@ -572,8 +572,8 @@ static void create_first_window(caca_display_t *dp) | |||
| NSFont* font = [NSFont fontWithName:@"Monaco" size:10]; | |||
| NSRect fontRect = [font boundingRectForFont]; | |||
| fontRect = NSMakeRect(0, 0, ceilf(fontRect.size.width), ceilf(fontRect.size.height)); | |||
| NSRect windowRect = NSMakeRect(20, 20, cucul_get_canvas_width(dp->cv) * fontRect.size.width, | |||
| cucul_get_canvas_height(dp->cv) * fontRect.size.height); | |||
| NSRect windowRect = NSMakeRect(20, 20, caca_get_canvas_width(dp->cv) * fontRect.size.width, | |||
| caca_get_canvas_height(dp->cv) * fontRect.size.height); | |||
| convert_NSRect(&windowRect); | |||
| CacaView* view = [[CacaView alloc] initWithFrame:windowRect]; | |||
| @@ -826,8 +826,8 @@ static BOOL handle_mouse_event(caca_display_t *dp, caca_privevent_t *ev, | |||
| static int cocoa_init_graphics(caca_display_t *dp) | |||
| { | |||
| int width = cucul_get_canvas_width(dp->cv); | |||
| int height = cucul_get_canvas_height(dp->cv); | |||
| int width = caca_get_canvas_width(dp->cv); | |||
| int height = caca_get_canvas_height(dp->cv); | |||
| debug_log(@"%s dp->cv: %ux%u", __PRETTY_FUNCTION__, width, height); | |||
| @@ -838,7 +838,7 @@ static int cocoa_init_graphics(caca_display_t *dp) | |||
| return -1; | |||
| dp->resize.allow = 1; | |||
| cucul_set_canvas_size(dp->cv, width ? width : 80, height ? height : 32); | |||
| caca_set_canvas_size(dp->cv, width ? width : 80, height ? height : 32); | |||
| dp->resize.allow = 0; | |||
| // first create a full cocoa app if the host has no bundle | |||
| @@ -858,7 +858,7 @@ static int cocoa_init_graphics(caca_display_t *dp) | |||
| static int cocoa_end_graphics(caca_display_t *dp) | |||
| { | |||
| debug_log(@"%s dp->cv: %ux%u", __PRETTY_FUNCTION__, | |||
| cucul_get_canvas_width(dp->cv), cucul_get_canvas_height(dp->cv)); | |||
| caca_get_canvas_width(dp->cv), caca_get_canvas_height(dp->cv)); | |||
| NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init]; | |||
| [dp->drv.p->window close]; | |||
| @@ -958,8 +958,8 @@ static int cocoa_get_event(caca_display_t *dp, caca_privevent_t *ev) | |||
| static void cocoa_handle_resize(caca_display_t *dp) | |||
| { | |||
| debug_log(@"%s", __PRETTY_FUNCTION__); | |||
| dp->resize.w = cucul_get_canvas_width(dp->cv); | |||
| dp->resize.h = cucul_get_canvas_height(dp->cv); | |||
| dp->resize.w = caca_get_canvas_width(dp->cv); | |||
| dp->resize.h = caca_get_canvas_height(dp->cv); | |||
| } | |||
| static int cocoa_set_display_title(caca_display_t *dp, char const *title) | |||
| @@ -28,7 +28,6 @@ | |||
| #include <stdlib.h> | |||
| #include "cucul.h" | |||
| #include "caca.h" | |||
| #include "caca_internals.h" | |||
| @@ -57,7 +56,7 @@ static int conio_init_graphics(caca_display_t *dp) | |||
| /* FIXME */ | |||
| # endif | |||
| dp->resize.allow = 1; | |||
| cucul_set_canvas_size(dp->cv, dp->drv.p->ti.screenwidth, | |||
| caca_set_canvas_size(dp->cv, dp->drv.p->ti.screenwidth, | |||
| dp->drv.p->ti.screenheight); | |||
| dp->resize.allow = 0; | |||
| @@ -69,7 +68,7 @@ static int conio_end_graphics(caca_display_t *dp) | |||
| _wscroll = 1; | |||
| textcolor((enum COLORS)WHITE); | |||
| textbackground((enum COLORS)BLACK); | |||
| gotoxy(cucul_get_canvas_width(dp->cv), cucul_get_canvas_height(dp->cv)); | |||
| gotoxy(caca_get_canvas_width(dp->cv), caca_get_canvas_height(dp->cv)); | |||
| cputs("\r\n"); | |||
| _setcursortype(_NORMALCURSOR); | |||
| @@ -87,37 +86,37 @@ static int conio_set_display_title(caca_display_t *dp, char const *title) | |||
| static int conio_get_display_width(caca_display_t const *dp) | |||
| { | |||
| /* Fallback to a 6x10 font */ | |||
| return cucul_get_canvas_width(dp->cv) * 6; | |||
| return caca_get_canvas_width(dp->cv) * 6; | |||
| } | |||
| static int conio_get_display_height(caca_display_t const *dp) | |||
| { | |||
| /* Fallback to a 6x10 font */ | |||
| return cucul_get_canvas_height(dp->cv) * 10; | |||
| return caca_get_canvas_height(dp->cv) * 10; | |||
| } | |||
| static void conio_display(caca_display_t *dp) | |||
| { | |||
| char *screen = dp->drv.p->screen; | |||
| uint32_t const *chars = (uint32_t const *)cucul_get_canvas_chars(dp->cv); | |||
| uint32_t const *attrs = (uint32_t const *)cucul_get_canvas_attrs(dp->cv); | |||
| int width = cucul_get_canvas_width(dp->cv); | |||
| int height = cucul_get_canvas_height(dp->cv); | |||
| uint32_t const *chars = (uint32_t const *)caca_get_canvas_chars(dp->cv); | |||
| uint32_t const *attrs = (uint32_t const *)caca_get_canvas_attrs(dp->cv); | |||
| int width = caca_get_canvas_width(dp->cv); | |||
| int height = caca_get_canvas_height(dp->cv); | |||
| int n; | |||
| for(n = height * width; n--; ) | |||
| { | |||
| char ch = cucul_utf32_to_cp437(*chars++); | |||
| if(n && *chars == CUCUL_MAGIC_FULLWIDTH) | |||
| char ch = caca_utf32_to_cp437(*chars++); | |||
| if(n && *chars == CACA_MAGIC_FULLWIDTH) | |||
| { | |||
| *screen++ = '['; | |||
| *screen++ = cucul_attr_to_ansi(*attrs++); | |||
| *screen++ = caca_attr_to_ansi(*attrs++); | |||
| ch = ']'; | |||
| chars++; | |||
| n--; | |||
| } | |||
| *screen++ = ch; | |||
| *screen++ = cucul_attr_to_ansi(*attrs++); | |||
| *screen++ = caca_attr_to_ansi(*attrs++); | |||
| } | |||
| # if defined(SCREENUPDATE_IN_PC_H) | |||
| ScreenUpdate(dp->drv.p->screen); | |||
| @@ -129,8 +128,8 @@ static void conio_display(caca_display_t *dp) | |||
| static void conio_handle_resize(caca_display_t *dp) | |||
| { | |||
| /* We know nothing about our window */ | |||
| dp->resize.w = cucul_get_canvas_width(dp->cv); | |||
| dp->resize.h = cucul_get_canvas_height(dp->cv); | |||
| dp->resize.w = caca_get_canvas_width(dp->cv); | |||
| dp->resize.h = caca_get_canvas_height(dp->cv); | |||
| } | |||
| static int conio_get_event(caca_display_t *dp, caca_privevent_t *ev) | |||
| @@ -35,7 +35,6 @@ | |||
| #include <stdlib.h> | |||
| #include <stdio.h> | |||
| #include "cucul.h" | |||
| #include "caca.h" | |||
| #include "caca_internals.h" | |||
| @@ -65,7 +64,7 @@ struct driver_private | |||
| int window; | |||
| int width, height; | |||
| int new_width, new_height; | |||
| cucul_font_t *f; | |||
| caca_font_t *f; | |||
| float font_width, font_height; | |||
| float incx, incy; | |||
| uint32_t const *blocks; | |||
| @@ -87,8 +86,8 @@ static int gl_init_graphics(caca_display_t *dp) | |||
| char const *geometry; | |||
| char *argv[2] = { "", NULL }; | |||
| char const * const * fonts; | |||
| int width = cucul_get_canvas_width(dp->cv); | |||
| int height = cucul_get_canvas_height(dp->cv); | |||
| int width = caca_get_canvas_width(dp->cv); | |||
| int height = caca_get_canvas_height(dp->cv); | |||
| int argc = 1; | |||
| dp->drv.p = malloc(sizeof(struct driver_private)); | |||
| @@ -102,28 +101,28 @@ static int gl_init_graphics(caca_display_t *dp) | |||
| #endif | |||
| dp->resize.allow = 1; | |||
| cucul_set_canvas_size(dp->cv, width ? width : 80, height ? height : 32); | |||
| caca_set_canvas_size(dp->cv, width ? width : 80, height ? height : 32); | |||
| dp->resize.allow = 0; | |||
| /* Load a libcucul internal font */ | |||
| fonts = cucul_get_font_list(); | |||
| /* Load a libcaca internal font */ | |||
| fonts = caca_get_font_list(); | |||
| if(fonts[0] == NULL) | |||
| { | |||
| fprintf(stderr, "error: libcucul was compiled without any fonts\n"); | |||
| fprintf(stderr, "error: libcaca was compiled without any fonts\n"); | |||
| return -1; | |||
| } | |||
| dp->drv.p->f = cucul_load_font(fonts[0], 0); | |||
| dp->drv.p->f = caca_load_font(fonts[0], 0); | |||
| if(dp->drv.p->f == NULL) | |||
| { | |||
| fprintf(stderr, "error: could not load font \"%s\"\n", fonts[0]); | |||
| return -1; | |||
| } | |||
| dp->drv.p->font_width = cucul_get_font_width(dp->drv.p->f); | |||
| dp->drv.p->font_height = cucul_get_font_height(dp->drv.p->f); | |||
| dp->drv.p->font_width = caca_get_font_width(dp->drv.p->f); | |||
| dp->drv.p->font_height = caca_get_font_height(dp->drv.p->f); | |||
| dp->drv.p->width = cucul_get_canvas_width(dp->cv) * dp->drv.p->font_width; | |||
| dp->drv.p->height = cucul_get_canvas_height(dp->cv) * dp->drv.p->font_height; | |||
| dp->drv.p->width = caca_get_canvas_width(dp->cv) * dp->drv.p->font_width; | |||
| dp->drv.p->height = caca_get_canvas_height(dp->cv) * dp->drv.p->font_height; | |||
| #ifdef HAVE_GLUTCLOSEFUNC | |||
| dp->drv.p->close = 0; | |||
| @@ -192,7 +191,7 @@ static int gl_end_graphics(caca_display_t *dp) | |||
| { | |||
| glutHideWindow(); | |||
| glutDestroyWindow(dp->drv.p->window); | |||
| cucul_free_font(dp->drv.p->f); | |||
| caca_free_font(dp->drv.p->f); | |||
| free(dp->drv.p->txid); | |||
| free(dp->drv.p); | |||
| return 0; | |||
| @@ -216,9 +215,9 @@ static int gl_get_display_height(caca_display_t const *dp) | |||
| static void gl_display(caca_display_t *dp) | |||
| { | |||
| uint32_t const *cvchars = (uint32_t const *)cucul_get_canvas_chars(dp->cv); | |||
| uint32_t const *cvattrs = (uint32_t const *)cucul_get_canvas_attrs(dp->cv); | |||
| int width = cucul_get_canvas_width(dp->cv); | |||
| uint32_t const *cvchars = (uint32_t const *)caca_get_canvas_chars(dp->cv); | |||
| uint32_t const *cvattrs = (uint32_t const *)caca_get_canvas_attrs(dp->cv); | |||
| int width = caca_get_canvas_width(dp->cv); | |||
| int x, y, line; | |||
| glClear(GL_COLOR_BUFFER_BIT); | |||
| @@ -232,7 +231,7 @@ static void gl_display(caca_display_t *dp) | |||
| /* FIXME: optimise using stride */ | |||
| for(x = 0; x < dp->drv.p->width; x += dp->drv.p->font_width) | |||
| { | |||
| uint16_t bg = cucul_attr_to_rgb12_bg(*attrs++); | |||
| uint16_t bg = caca_attr_to_rgb12_bg(*attrs++); | |||
| glColor4b(((bg & 0xf00) >> 8) * 8, | |||
| ((bg & 0x0f0) >> 4) * 8, | |||
| @@ -266,7 +265,7 @@ static void gl_display(caca_display_t *dp) | |||
| uint16_t fg; | |||
| int i, b, fullwidth; | |||
| fullwidth = cucul_utf32_is_fullwidth(ch); | |||
| fullwidth = caca_utf32_is_fullwidth(ch); | |||
| for(b = 0, i = 0; dp->drv.p->blocks[i + 1]; i += 2) | |||
| { | |||
| @@ -284,7 +283,7 @@ static void gl_display(caca_display_t *dp) | |||
| dp->drv.p->txid[b + ch | |||
| - (uint32_t)dp->drv.p->blocks[i]]); | |||
| fg = cucul_attr_to_rgb12_fg(*attrs); | |||
| fg = caca_attr_to_rgb12_fg(*attrs); | |||
| glColor3b(((fg & 0xf00) >> 8) * 8, | |||
| ((fg & 0x0f0) >> 4) * 8, | |||
| (fg & 0x00f) * 8); | |||
| @@ -352,8 +351,8 @@ static int gl_get_event(caca_display_t *dp, caca_privevent_t *ev) | |||
| if(dp->resize.resized) | |||
| { | |||
| ev->type = CACA_EVENT_RESIZE; | |||
| ev->data.resize.w = cucul_get_canvas_width(dp->cv); | |||
| ev->data.resize.h = cucul_get_canvas_height(dp->cv); | |||
| ev->data.resize.w = caca_get_canvas_width(dp->cv); | |||
| ev->data.resize.h = caca_get_canvas_height(dp->cv); | |||
| return 1; | |||
| } | |||
| @@ -513,36 +512,36 @@ static void _display(void) | |||
| static void gl_compute_font(caca_display_t *dp) | |||
| { | |||
| cucul_canvas_t *cv; | |||
| caca_canvas_t *cv; | |||
| uint32_t *image; | |||
| int i, b, w, h, x, y; | |||
| /* Count how many glyphs this font has */ | |||
| dp->drv.p->blocks = cucul_get_font_blocks(dp->drv.p->f); | |||
| dp->drv.p->blocks = caca_get_font_blocks(dp->drv.p->f); | |||
| for(b = 0, i = 0; dp->drv.p->blocks[i + 1]; i += 2) | |||
| b += (int)(dp->drv.p->blocks[i + 1] - dp->drv.p->blocks[i]); | |||
| /* Allocate a libcucul canvas and print all the glyphs on it */ | |||
| cv = cucul_create_canvas(2, b); | |||
| cucul_set_color_ansi(cv, CUCUL_WHITE, CUCUL_BLACK); | |||
| /* Allocate a libcaca canvas and print all the glyphs on it */ | |||
| cv = caca_create_canvas(2, b); | |||
| caca_set_color_ansi(cv, CACA_WHITE, CACA_BLACK); | |||
| for(b = 0, i = 0; dp->drv.p->blocks[i + 1]; i += 2) | |||
| { | |||
| int j, n = (int)(dp->drv.p->blocks[i + 1] - dp->drv.p->blocks[i]); | |||
| for(j = 0; j < n; j++) | |||
| cucul_put_char(cv, 0, b + j, dp->drv.p->blocks[i] + j); | |||
| caca_put_char(cv, 0, b + j, dp->drv.p->blocks[i] + j); | |||
| b += n; | |||
| } | |||
| /* Draw the cucul canvas onto an image buffer */ | |||
| /* Draw the caca canvas onto an image buffer */ | |||
| image = malloc(b * dp->drv.p->font_height * | |||
| 2 * dp->drv.p->font_width * sizeof(uint32_t)); | |||
| cucul_render_canvas(cv, dp->drv.p->f, image, 2 * dp->drv.p->font_width, | |||
| caca_render_canvas(cv, dp->drv.p->f, image, 2 * dp->drv.p->font_width, | |||
| b * dp->drv.p->font_height, 8 * dp->drv.p->font_width); | |||
| cucul_free_canvas(cv); | |||
| caca_free_canvas(cv); | |||
| /* Convert all glyphs in the image buffer to GL textures */ | |||
| dp->drv.p->txid = malloc(b * sizeof(int)); | |||
| @@ -560,7 +559,7 @@ static void gl_compute_font(caca_display_t *dp) | |||
| uint32_t *glyph = image + (int)((b + j) * dp->drv.p->font_width * 2 | |||
| * dp->drv.p->font_height); | |||
| int fullwidth = | |||
| cucul_utf32_is_fullwidth(dp->drv.p->blocks[i] + j); | |||
| caca_utf32_is_fullwidth(dp->drv.p->blocks[i] + j); | |||
| memset(tmp, 0, 16 * 8 * 16); | |||
| @@ -50,7 +50,6 @@ | |||
| # include <termios.h> | |||
| #endif | |||
| #include "cucul.h" | |||
| #include "caca.h" | |||
| #include "caca_internals.h" | |||
| @@ -302,7 +301,7 @@ static int ncurses_init_graphics(caca_display_t *dp) | |||
| } | |||
| dp->resize.allow = 1; | |||
| cucul_set_canvas_size(dp->cv, COLS, LINES); | |||
| caca_set_canvas_size(dp->cv, COLS, LINES); | |||
| dp->resize.allow = 0; | |||
| return 0; | |||
| @@ -335,21 +334,21 @@ static int ncurses_set_display_title(caca_display_t *dp, char const *title) | |||
| static int ncurses_get_display_width(caca_display_t const *dp) | |||
| { | |||
| /* Fallback to a 6x10 font */ | |||
| return cucul_get_canvas_width(dp->cv) * 6; | |||
| return caca_get_canvas_width(dp->cv) * 6; | |||
| } | |||
| static int ncurses_get_display_height(caca_display_t const *dp) | |||
| { | |||
| /* Fallback to a 6x10 font */ | |||
| return cucul_get_canvas_height(dp->cv) * 10; | |||
| return caca_get_canvas_height(dp->cv) * 10; | |||
| } | |||
| static void ncurses_display(caca_display_t *dp) | |||
| { | |||
| uint32_t const *cvchars = (uint32_t const *)cucul_get_canvas_chars(dp->cv); | |||
| uint32_t const *cvattrs = (uint32_t const *)cucul_get_canvas_attrs(dp->cv); | |||
| int width = cucul_get_canvas_width(dp->cv); | |||
| int height = cucul_get_canvas_height(dp->cv); | |||
| uint32_t const *cvchars = (uint32_t const *)caca_get_canvas_chars(dp->cv); | |||
| uint32_t const *cvattrs = (uint32_t const *)caca_get_canvas_attrs(dp->cv); | |||
| int width = caca_get_canvas_width(dp->cv); | |||
| int height = caca_get_canvas_height(dp->cv); | |||
| int x, y; | |||
| for(y = 0; y < (int)height; y++) | |||
| @@ -357,13 +356,13 @@ static void ncurses_display(caca_display_t *dp) | |||
| move(y, 0); | |||
| for(x = width; x--; ) | |||
| { | |||
| attrset(dp->drv.p->attr[cucul_attr_to_ansi(*cvattrs++)]); | |||
| attrset(dp->drv.p->attr[caca_attr_to_ansi(*cvattrs++)]); | |||
| ncurses_write_utf32(*cvchars++); | |||
| } | |||
| } | |||
| x = cucul_get_cursor_x(dp->cv); | |||
| y = cucul_get_cursor_y(dp->cv); | |||
| x = caca_get_cursor_x(dp->cv); | |||
| y = caca_get_cursor_y(dp->cv); | |||
| move(y, x); | |||
| refresh(); | |||
| @@ -389,8 +388,8 @@ static void ncurses_handle_resize(caca_display_t *dp) | |||
| #endif | |||
| /* Fallback */ | |||
| dp->resize.w = cucul_get_canvas_width(dp->cv); | |||
| dp->resize.h = cucul_get_canvas_height(dp->cv); | |||
| dp->resize.w = caca_get_canvas_width(dp->cv); | |||
| dp->resize.h = caca_get_canvas_height(dp->cv); | |||
| } | |||
| static int ncurses_get_event(caca_display_t *dp, caca_privevent_t *ev) | |||
| @@ -432,7 +431,7 @@ static int ncurses_get_event(caca_display_t *dp, caca_privevent_t *ev) | |||
| } | |||
| utf8[i] = '\0'; | |||
| utf32 = cucul_utf8_to_utf32(utf8, &bytes); | |||
| utf32 = caca_utf8_to_utf32(utf8, &bytes); | |||
| while(i > bytes) | |||
| ungetch(keys[--i]); | |||
| @@ -615,11 +614,11 @@ static void ncurses_write_utf32(uint32_t ch) | |||
| int bytes; | |||
| #endif | |||
| if(ch == CUCUL_MAGIC_FULLWIDTH) | |||
| if(ch == CACA_MAGIC_FULLWIDTH) | |||
| return; | |||
| #if defined HAVE_NCURSESW_NCURSES_H | |||
| bytes = cucul_utf32_to_utf8(buf, ch); | |||
| bytes = caca_utf32_to_utf8(buf, ch); | |||
| buf[bytes] = '\0'; | |||
| addstr(buf); | |||
| #else | |||
| @@ -814,7 +813,7 @@ static void ncurses_write_utf32(uint32_t ch) | |||
| break; | |||
| } | |||
| addch(cch); | |||
| if(cucul_utf32_is_fullwidth(ch)) | |||
| if(caca_utf32_is_fullwidth(ch)) | |||
| { | |||
| addch(cch2); | |||
| } | |||
| @@ -23,14 +23,13 @@ | |||
| #include <stdio.h> | |||
| #include <stdlib.h> | |||
| #include "cucul.h" | |||
| #include "caca.h" | |||
| #include "caca_internals.h" | |||
| static int raw_init_graphics(caca_display_t *dp) | |||
| { | |||
| int width = cucul_get_canvas_width(dp->cv); | |||
| int height = cucul_get_canvas_height(dp->cv); | |||
| int width = caca_get_canvas_width(dp->cv); | |||
| int height = caca_get_canvas_height(dp->cv); | |||
| char const *geometry; | |||
| #if defined(HAVE_GETENV) | |||
| @@ -40,7 +39,7 @@ static int raw_init_graphics(caca_display_t *dp) | |||
| #endif | |||
| dp->resize.allow = 1; | |||
| cucul_set_canvas_size(dp->cv, width ? width : 80, height ? height : 24); | |||
| caca_set_canvas_size(dp->cv, width ? width : 80, height ? height : 24); | |||
| dp->resize.allow = 0; | |||
| return 0; | |||
| @@ -71,7 +70,7 @@ static void raw_display(caca_display_t *dp) | |||
| void *buffer; | |||
| size_t len; | |||
| buffer = cucul_export_memory(dp->cv, "caca", &len); | |||
| buffer = caca_export_memory(dp->cv, "caca", &len); | |||
| if(!buffer) | |||
| return; | |||
| fwrite(buffer, len, 1, stdout); | |||
| @@ -33,7 +33,6 @@ | |||
| # include <signal.h> | |||
| #endif | |||
| #include "cucul.h" | |||
| #include "caca.h" | |||
| #include "caca_internals.h" | |||
| @@ -177,7 +176,7 @@ static int slang_init_graphics(caca_display_t *dp) | |||
| #endif | |||
| dp->resize.allow = 1; | |||
| cucul_set_canvas_size(dp->cv, SLtt_Screen_Cols, SLtt_Screen_Rows); | |||
| caca_set_canvas_size(dp->cv, SLtt_Screen_Cols, SLtt_Screen_Rows); | |||
| dp->resize.allow = 0; | |||
| return 0; | |||
| @@ -210,21 +209,21 @@ static int slang_set_display_title(caca_display_t *dp, char const *title) | |||
| static int slang_get_display_width(caca_display_t const *dp) | |||
| { | |||
| /* Fallback to a 6x10 font */ | |||
| return cucul_get_canvas_width(dp->cv) * 6; | |||
| return caca_get_canvas_width(dp->cv) * 6; | |||
| } | |||
| static int slang_get_display_height(caca_display_t const *dp) | |||
| { | |||
| /* Fallback to a 6x10 font */ | |||
| return cucul_get_canvas_height(dp->cv) * 10; | |||
| return caca_get_canvas_height(dp->cv) * 10; | |||
| } | |||
| static void slang_display(caca_display_t *dp) | |||
| { | |||
| uint32_t const *cvchars = (uint32_t const *)cucul_get_canvas_chars(dp->cv); | |||
| uint32_t const *cvattrs = (uint32_t const *)cucul_get_canvas_attrs(dp->cv); | |||
| int width = cucul_get_canvas_width(dp->cv); | |||
| int height = cucul_get_canvas_height(dp->cv); | |||
| uint32_t const *cvchars = (uint32_t const *)caca_get_canvas_chars(dp->cv); | |||
| uint32_t const *cvattrs = (uint32_t const *)caca_get_canvas_attrs(dp->cv); | |||
| int width = caca_get_canvas_width(dp->cv); | |||
| int height = caca_get_canvas_height(dp->cv); | |||
| int x, y; | |||
| for(y = 0; y < (int)height; y++) | |||
| @@ -241,24 +240,24 @@ static void slang_display(caca_display_t *dp) | |||
| * here for, and in cases where SLang does not render | |||
| * bright backgrounds, it's just fucked up. */ | |||
| #if 0 | |||
| uint8_t fgcolor = cucul_attr_to_ansi_fg(*cvattrs); | |||
| uint8_t bgcolor = cucul_attr_to_ansi_bg(*cvattrs); | |||
| uint8_t fgcolor = caca_attr_to_ansi_fg(*cvattrs); | |||
| uint8_t bgcolor = caca_attr_to_ansi_bg(*cvattrs); | |||
| if(fgcolor >= 0x10) | |||
| fgcolor = CUCUL_LIGHTGRAY; | |||
| fgcolor = CACA_LIGHTGRAY; | |||
| if(bgcolor >= 0x10) | |||
| bgcolor = CUCUL_BLACK; /* FIXME: handle transparency */ | |||
| bgcolor = CACA_BLACK; /* FIXME: handle transparency */ | |||
| if(fgcolor == bgcolor) | |||
| { | |||
| if(fgcolor == CUCUL_BLACK) | |||
| fgcolor = CUCUL_WHITE; | |||
| else if(fgcolor == CUCUL_WHITE | |||
| || fgcolor <= CUCUL_LIGHTGRAY) | |||
| fgcolor = CUCUL_BLACK; | |||
| if(fgcolor == CACA_BLACK) | |||
| fgcolor = CACA_WHITE; | |||
| else if(fgcolor == CACA_WHITE | |||
| || fgcolor <= CACA_LIGHTGRAY) | |||
| fgcolor = CACA_BLACK; | |||
| else | |||
| fgcolor = CUCUL_WHITE; | |||
| fgcolor = CACA_WHITE; | |||
| SLsmg_set_color(slang_assoc[fgcolor + 16 * bgcolor]); | |||
| SLsmg_write_char(' '); | |||
| cvattrs++; | |||
| @@ -266,16 +265,16 @@ static void slang_display(caca_display_t *dp) | |||
| else | |||
| #endif | |||
| { | |||
| SLsmg_set_color(slang_assoc[cucul_attr_to_ansi(*cvattrs++)]); | |||
| SLsmg_set_color(slang_assoc[caca_attr_to_ansi(*cvattrs++)]); | |||
| slang_write_utf32(ch); | |||
| } | |||
| #else | |||
| SLsmg_set_color(cucul_attr_to_ansi(*cvattrs++)); | |||
| SLsmg_set_color(caca_attr_to_ansi(*cvattrs++)); | |||
| slang_write_utf32(ch); | |||
| #endif | |||
| } | |||
| } | |||
| SLsmg_gotorc(cucul_get_cursor_y(dp->cv), cucul_get_cursor_x(dp->cv)); | |||
| SLsmg_gotorc(caca_get_cursor_y(dp->cv), caca_get_cursor_x(dp->cv)); | |||
| SLsmg_refresh(); | |||
| } | |||
| @@ -285,8 +284,8 @@ static void slang_handle_resize(caca_display_t *dp) | |||
| dp->resize.w = SLtt_Screen_Cols; | |||
| dp->resize.h = SLtt_Screen_Rows; | |||
| if(dp->resize.w != cucul_get_canvas_width(dp->cv) | |||
| || dp->resize.h != cucul_get_canvas_height(dp->cv)) | |||
| if(dp->resize.w != caca_get_canvas_width(dp->cv) | |||
| || dp->resize.h != caca_get_canvas_height(dp->cv)) | |||
| SLsmg_reinit_smg(); | |||
| } | |||
| @@ -342,7 +341,7 @@ static int slang_get_event(caca_display_t *dp, caca_privevent_t *ev) | |||
| } | |||
| utf8[i] = '\0'; | |||
| utf32 = cucul_utf8_to_utf32(utf8, &bytes); | |||
| utf32 = caca_utf8_to_utf32(utf8, &bytes); | |||
| while(i > bytes) | |||
| SLang_ungetkey(keys[--i]); | |||
| @@ -482,17 +481,17 @@ static void slang_write_utf32(uint32_t ch) | |||
| char ascii; | |||
| #endif | |||
| if(ch == CUCUL_MAGIC_FULLWIDTH) | |||
| if(ch == CACA_MAGIC_FULLWIDTH) | |||
| return; | |||
| #ifdef HAVE_SLSMG_UTF8_ENABLE | |||
| bytes = cucul_utf32_to_utf8(buf, ch); | |||
| bytes = caca_utf32_to_utf8(buf, ch); | |||
| buf[bytes] = '\0'; | |||
| SLsmg_write_string(buf); | |||
| #else | |||
| ascii = cucul_utf32_to_ascii(ch); | |||
| ascii = caca_utf32_to_ascii(ch); | |||
| SLsmg_write_char(ascii); | |||
| if(cucul_utf32_is_fullwidth(ch)) | |||
| if(caca_utf32_is_fullwidth(ch)) | |||
| SLsmg_write_char(ascii); | |||
| #endif | |||
| } | |||
| @@ -20,7 +20,6 @@ | |||
| #if defined(USE_VGA) | |||
| #include "cucul.h" | |||
| #include "caca.h" | |||
| #include "caca_internals.h" | |||
| @@ -75,7 +74,7 @@ static int vga_init_graphics(caca_display_t *dp) | |||
| /* We don't have much choice */ | |||
| dp->resize.allow = 1; | |||
| cucul_set_canvas_size(dp->cv, 80, 25); | |||
| caca_set_canvas_size(dp->cv, 80, 25); | |||
| dp->resize.allow = 0; | |||
| return 0; | |||
| @@ -116,33 +115,33 @@ static int vga_get_display_height(caca_display_t const *dp) | |||
| static void vga_display(caca_display_t *dp) | |||
| { | |||
| char *screen = (char *)(intptr_t)0x000b8000; | |||
| uint32_t const *cvchars = (uint32_t const *)cucul_get_canvas_chars(dp->cv); | |||
| uint32_t const *cvattrs = (uint32_t const *)cucul_get_canvas_attrs(dp->cv); | |||
| int width = cucul_get_canvas_width(dp->cv); | |||
| int height = cucul_get_canvas_height(dp->cv); | |||
| uint32_t const *cvchars = (uint32_t const *)caca_get_canvas_chars(dp->cv); | |||
| uint32_t const *cvattrs = (uint32_t const *)caca_get_canvas_attrs(dp->cv); | |||
| int width = caca_get_canvas_width(dp->cv); | |||
| int height = caca_get_canvas_height(dp->cv); | |||
| int n; | |||
| for(n = height * width; n--; ) | |||
| { | |||
| char ch = cucul_utf32_to_cp437(*cvchars++); | |||
| if(n && *cvchars == CUCUL_MAGIC_FULLWIDTH) | |||
| char ch = caca_utf32_to_cp437(*cvchars++); | |||
| if(n && *cvchars == CACA_MAGIC_FULLWIDTH) | |||
| { | |||
| *screen++ = '['; | |||
| *screen++ = cucul_attr_to_ansi(*cvattrs++); | |||
| *screen++ = caca_attr_to_ansi(*cvattrs++); | |||
| ch = ']'; | |||
| cvchars++; | |||
| n--; | |||
| } | |||
| *screen++ = ch; | |||
| *screen++ = cucul_attr_to_ansi(*cvattrs++); | |||
| *screen++ = caca_attr_to_ansi(*cvattrs++); | |||
| } | |||
| } | |||
| static void vga_handle_resize(caca_display_t *dp) | |||
| { | |||
| /* We know nothing about our window */ | |||
| dp->resize.w = cucul_get_canvas_width(dp->cv); | |||
| dp->resize.h = cucul_get_canvas_height(dp->cv); | |||
| dp->resize.w = caca_get_canvas_width(dp->cv); | |||
| dp->resize.h = caca_get_canvas_height(dp->cv); | |||
| } | |||
| static int vga_get_event(caca_display_t *dp, caca_privevent_t *ev) | |||
| @@ -25,7 +25,6 @@ | |||
| #include <stdlib.h> | |||
| #include <stdio.h> | |||
| #include "cucul.h" | |||
| #include "caca.h" | |||
| #include "caca_internals.h" | |||
| @@ -82,8 +81,8 @@ struct driver_private | |||
| static int win32_init_graphics(caca_display_t *dp) | |||
| { | |||
| int width = cucul_get_canvas_width(dp->cv); | |||
| int height = cucul_get_canvas_height(dp->cv); | |||
| int width = caca_get_canvas_width(dp->cv); | |||
| int height = caca_get_canvas_height(dp->cv); | |||
| CONSOLE_SCREEN_BUFFER_INFO csbi; | |||
| SMALL_RECT rect; | |||
| COORD size; | |||
| @@ -122,16 +121,16 @@ static int win32_init_graphics(caca_display_t *dp) | |||
| rect.Bottom = size.Y - 1; | |||
| SetConsoleWindowInfo(dp->drv.p->screen, TRUE, &rect); | |||
| /* Report our new size to libcucul */ | |||
| /* Report our new size to libcaca */ | |||
| if(!GetConsoleScreenBufferInfo(dp->drv.p->screen, &csbi)) | |||
| return -1; | |||
| dp->resize.allow = 1; | |||
| cucul_set_canvas_size(dp->cv, | |||
| caca_set_canvas_size(dp->cv, | |||
| csbi.srWindow.Right - csbi.srWindow.Left + 1, | |||
| csbi.srWindow.Bottom - csbi.srWindow.Top + 1); | |||
| width = cucul_get_canvas_width(dp->cv); | |||
| height = cucul_get_canvas_height(dp->cv); | |||
| width = caca_get_canvas_width(dp->cv); | |||
| height = caca_get_canvas_height(dp->cv); | |||
| dp->resize.allow = 0; | |||
| SetConsoleMode(dp->drv.p->screen, 0); | |||
| @@ -180,7 +179,7 @@ static int win32_get_display_width(caca_display_t const *dp) | |||
| /* FIXME */ | |||
| /* Fallback to a 6x10 font */ | |||
| return cucul_get_canvas_width(dp->cv) * 6; | |||
| return caca_get_canvas_width(dp->cv) * 6; | |||
| } | |||
| static int win32_get_display_height(caca_display_t const *dp) | |||
| @@ -188,7 +187,7 @@ static int win32_get_display_height(caca_display_t const *dp) | |||
| /* FIXME */ | |||
| /* Fallback to a 6x10 font */ | |||
| return cucul_get_canvas_height(dp->cv) * 10; | |||
| return caca_get_canvas_height(dp->cv) * 10; | |||
| } | |||
| static void win32_display(caca_display_t *dp) | |||
| @@ -196,18 +195,18 @@ static void win32_display(caca_display_t *dp) | |||
| COORD size, pos; | |||
| SMALL_RECT rect; | |||
| CHAR_INFO *buffer = dp->drv.p->buffer; | |||
| uint32_t const *cvchars = (uint32_t const *)cucul_get_canvas_chars(dp->cv); | |||
| uint32_t const *cvattrs = (uint32_t const *)cucul_get_canvas_attrs(dp->cv); | |||
| int width = cucul_get_canvas_width(dp->cv); | |||
| int height = cucul_get_canvas_height(dp->cv); | |||
| uint32_t const *cvchars = (uint32_t const *)caca_get_canvas_chars(dp->cv); | |||
| uint32_t const *cvattrs = (uint32_t const *)caca_get_canvas_attrs(dp->cv); | |||
| int width = caca_get_canvas_width(dp->cv); | |||
| int height = caca_get_canvas_height(dp->cv); | |||
| int n; | |||
| /* Render everything to our screen buffer */ | |||
| for(n = height * width; n--; ) | |||
| { | |||
| uint32_t ch = *cvchars++; | |||
| uint8_t fg = cucul_attr_to_ansi_fg(*cvattrs); | |||
| uint8_t bg = cucul_attr_to_ansi_bg(*cvattrs); | |||
| uint8_t fg = caca_attr_to_ansi_fg(*cvattrs); | |||
| uint8_t bg = caca_attr_to_ansi_bg(*cvattrs); | |||
| #if 0 | |||
| if(ch > 0x00000020 && ch < 0x00000080) | |||
| @@ -215,7 +214,7 @@ static void win32_display(caca_display_t *dp) | |||
| else | |||
| dp->drv.p->buffer[i].Char.AsciiChar = ' '; | |||
| #else | |||
| if(n && *cvchars == CUCUL_MAGIC_FULLWIDTH) | |||
| if(n && *cvchars == CACA_MAGIC_FULLWIDTH) | |||
| ; | |||
| else if(ch > 0x00000020 && ch < 0x00010000) | |||
| buffer->Char.UnicodeChar = (uint16_t)ch; | |||
| @@ -223,8 +222,8 @@ static void win32_display(caca_display_t *dp) | |||
| buffer->Char.UnicodeChar = (uint16_t)' '; | |||
| #endif | |||
| buffer->Attributes = win32_fg_palette[fg < 0x10 ? fg : CUCUL_LIGHTGRAY] | |||
| | win32_bg_palette[bg < 0x10 ? bg : CUCUL_BLACK]; | |||
| buffer->Attributes = win32_fg_palette[fg < 0x10 ? fg : CACA_LIGHTGRAY] | |||
| | win32_bg_palette[bg < 0x10 ? bg : CACA_BLACK]; | |||
| cvattrs++; | |||
| buffer++; | |||
| } | |||
| @@ -246,8 +245,8 @@ static void win32_display(caca_display_t *dp) | |||
| static void win32_handle_resize(caca_display_t *dp) | |||
| { | |||
| /* FIXME: I don't know what to do here. */ | |||
| dp->resize.w = cucul_get_canvas_width(dp->cv); | |||
| dp->resize.h = cucul_get_canvas_height(dp->cv); | |||
| dp->resize.w = caca_get_canvas_width(dp->cv); | |||
| dp->resize.h = caca_get_canvas_height(dp->cv); | |||
| } | |||
| static int win32_get_event(caca_display_t *dp, caca_privevent_t *ev) | |||
| @@ -32,7 +32,7 @@ | |||
| #include <stdlib.h> | |||
| #include <string.h> | |||
| #include "cucul.h" | |||
| #include "caca.h" | |||
| #include "caca.h" | |||
| #include "caca_internals.h" | |||
| @@ -75,8 +75,8 @@ static int x11_init_graphics(caca_display_t *dp) | |||
| int (*old_error_handler)(Display *, XErrorEvent *); | |||
| char const *fonts[] = { NULL, "8x13bold", "fixed" }, **parser; | |||
| char const *geometry; | |||
| int width = cucul_get_canvas_width(dp->cv); | |||
| int height = cucul_get_canvas_height(dp->cv); | |||
| int width = caca_get_canvas_width(dp->cv); | |||
| int height = caca_get_canvas_height(dp->cv); | |||
| int i; | |||
| dp->drv.p = malloc(sizeof(struct driver_private)); | |||
| @@ -88,9 +88,9 @@ static int x11_init_graphics(caca_display_t *dp) | |||
| #endif | |||
| dp->resize.allow = 1; | |||
| cucul_set_canvas_size(dp->cv, width ? width : 80, height ? height : 32); | |||
| width = cucul_get_canvas_width(dp->cv); | |||
| height = cucul_get_canvas_height(dp->cv); | |||
| caca_set_canvas_size(dp->cv, width ? width : 80, height ? height : 32); | |||
| width = caca_get_canvas_width(dp->cv); | |||
| height = caca_get_canvas_height(dp->cv); | |||
| dp->resize.allow = 0; | |||
| dp->drv.p->dpy = XOpenDisplay(NULL); | |||
| @@ -279,20 +279,20 @@ static int x11_set_display_title(caca_display_t *dp, char const *title) | |||
| static int x11_get_display_width(caca_display_t const *dp) | |||
| { | |||
| return cucul_get_canvas_width(dp->cv) * dp->drv.p->font_width; | |||
| return caca_get_canvas_width(dp->cv) * dp->drv.p->font_width; | |||
| } | |||
| static int x11_get_display_height(caca_display_t const *dp) | |||
| { | |||
| return cucul_get_canvas_height(dp->cv) * dp->drv.p->font_height; | |||
| return caca_get_canvas_height(dp->cv) * dp->drv.p->font_height; | |||
| } | |||
| static void x11_display(caca_display_t *dp) | |||
| { | |||
| uint32_t const *cvchars = (uint32_t const *)cucul_get_canvas_chars(dp->cv); | |||
| uint32_t const *cvattrs = (uint32_t const *)cucul_get_canvas_attrs(dp->cv); | |||
| int width = cucul_get_canvas_width(dp->cv); | |||
| int height = cucul_get_canvas_height(dp->cv); | |||
| uint32_t const *cvchars = (uint32_t const *)caca_get_canvas_chars(dp->cv); | |||
| uint32_t const *cvattrs = (uint32_t const *)caca_get_canvas_attrs(dp->cv); | |||
| int width = caca_get_canvas_width(dp->cv); | |||
| int height = caca_get_canvas_height(dp->cv); | |||
| int x, y, len; | |||
| /* First draw the background colours. Splitting the process in two | |||
| @@ -302,11 +302,11 @@ static void x11_display(caca_display_t *dp) | |||
| for(x = 0; x < width; x += len) | |||
| { | |||
| uint32_t const *attrs = cvattrs + x + y * width; | |||
| uint16_t bg = cucul_attr_to_rgb12_bg(*attrs); | |||
| uint16_t bg = caca_attr_to_rgb12_bg(*attrs); | |||
| len = 1; | |||
| while(x + len < width | |||
| && cucul_attr_to_rgb12_bg(attrs[len]) == bg) | |||
| && caca_attr_to_rgb12_bg(attrs[len]) == bg) | |||
| len++; | |||
| XSetForeground(dp->drv.p->dpy, dp->drv.p->gc, | |||
| @@ -330,7 +330,7 @@ static void x11_display(caca_display_t *dp) | |||
| for(x = 0; x < width; x++, chars++, attrs++) | |||
| { | |||
| XSetForeground(dp->drv.p->dpy, dp->drv.p->gc, | |||
| dp->drv.p->colors[cucul_attr_to_rgb12_fg(*attrs)]); | |||
| dp->drv.p->colors[caca_attr_to_rgb12_fg(*attrs)]); | |||
| x11_put_glyph(dp, x * dp->drv.p->font_width, | |||
| y * dp->drv.p->font_height, yoff, | |||
| @@ -344,8 +344,8 @@ static void x11_display(caca_display_t *dp) | |||
| { | |||
| XSetForeground(dp->drv.p->dpy, dp->drv.p->gc, | |||
| dp->drv.p->colors[0xfff]); | |||
| x = cucul_get_cursor_x(dp->cv); | |||
| y = cucul_get_cursor_y(dp->cv); | |||
| x = caca_get_cursor_x(dp->cv); | |||
| y = caca_get_cursor_y(dp->cv); | |||
| XFillRectangle(dp->drv.p->dpy, dp->drv.p->pixmap, dp->drv.p->gc, | |||
| x * dp->drv.p->font_width, y * dp->drv.p->font_height, | |||
| dp->drv.p->font_width, dp->drv.p->font_height); | |||
| @@ -378,8 +378,8 @@ static void x11_handle_resize(caca_display_t *dp) | |||
| static int x11_get_event(caca_display_t *dp, caca_privevent_t *ev) | |||
| { | |||
| int width = cucul_get_canvas_width(dp->cv); | |||
| int height = cucul_get_canvas_height(dp->cv); | |||
| int width = caca_get_canvas_width(dp->cv); | |||
| int height = caca_get_canvas_height(dp->cv); | |||
| XEvent xevent; | |||
| char key; | |||
| @@ -610,23 +610,23 @@ static void x11_put_glyph(caca_display_t *dp, int x, int y, int yoff, | |||
| XChar2b ch16; | |||
| /* Underline */ | |||
| if(attr & CUCUL_UNDERLINE) | |||
| if(attr & CACA_UNDERLINE) | |||
| XFillRectangle(dpy, px, gc, x, y + h - 1, w, 1); | |||
| /* Skip spaces and magic stuff */ | |||
| if(ch <= 0x00000020) | |||
| return; | |||
| if(ch == CUCUL_MAGIC_FULLWIDTH) | |||
| if(ch == CACA_MAGIC_FULLWIDTH) | |||
| return; | |||
| fw = w; | |||
| if(cucul_utf32_is_fullwidth(ch)) | |||
| if(caca_utf32_is_fullwidth(ch)) | |||
| fw *= 2; | |||
| /* We want to be able to print a few special Unicode characters | |||
| * such as the CP437 gradients and half blocks. For unknown | |||
| * characters, print what cucul_utf32_to_ascii() returns. */ | |||
| * characters, print what caca_utf32_to_ascii() returns. */ | |||
| if(ch >= 0x2500 && ch <= 0x256c && udlr[ch - 0x2500]) | |||
| { | |||
| @@ -771,7 +771,7 @@ static void x11_put_glyph(caca_display_t *dp, int x, int y, int yoff, | |||
| else | |||
| { | |||
| ch16.byte1 = 0; | |||
| ch16.byte2 = cucul_utf32_to_ascii(ch); | |||
| ch16.byte2 = caca_utf32_to_ascii(ch); | |||
| } | |||
| XDrawString16(dpy, px, gc, x + (ch16.byte1 ? 0 : (fw - w) / 2), yoff, &ch16, 1); | |||
| @@ -23,7 +23,6 @@ | |||
| # include <string.h> | |||
| #endif | |||
| #include "cucul.h" | |||
| #include "caca.h" | |||
| #include "caca_internals.h" | |||
| @@ -129,7 +128,7 @@ int caca_get_event(caca_display_t *dp, int event_mask, | |||
| */ | |||
| int caca_get_mouse_x(caca_display_t const *dp) | |||
| { | |||
| int width = cucul_get_canvas_width(dp->cv); | |||
| int width = caca_get_canvas_width(dp->cv); | |||
| if(dp->mouse.x >= width) | |||
| return width - 1; | |||
| @@ -151,7 +150,7 @@ int caca_get_mouse_x(caca_display_t const *dp) | |||
| */ | |||
| int caca_get_mouse_y(caca_display_t const *dp) | |||
| { | |||
| int height = cucul_get_canvas_height(dp->cv); | |||
| int height = caca_get_canvas_height(dp->cv); | |||
| if(dp->mouse.y >= height) | |||
| return height - 1; | |||
| @@ -335,8 +334,8 @@ static int _get_next_event(caca_display_t *dp, caca_privevent_t *ev) | |||
| dp->resize.resized = 0; | |||
| _caca_handle_resize(dp); | |||
| ev->type = CACA_EVENT_RESIZE; | |||
| ev->data.resize.w = cucul_get_canvas_width(dp->cv); | |||
| ev->data.resize.h = cucul_get_canvas_height(dp->cv); | |||
| ev->data.resize.w = caca_get_canvas_width(dp->cv); | |||
| ev->data.resize.h = caca_get_canvas_height(dp->cv); | |||
| return 1; | |||
| } | |||
| @@ -1,5 +1,5 @@ | |||
| /* | |||
| * libcucul Canvas for ultrafast compositing of Unicode letters | |||
| * libcaca Colour ASCII-Art library | |||
| * Copyright (c) 2002-2006 Sam Hocevar <sam@zoy.org> | |||
| * 2006 Jean-Yves Lamoureux <jylam@lnxscene.org> | |||
| * All Rights Reserved | |||
| @@ -25,8 +25,8 @@ | |||
| # include <string.h> | |||
| #endif | |||
| #include "cucul.h" | |||
| #include "cucul_internals.h" | |||
| #include "caca.h" | |||
| #include "caca_internals.h" | |||
| static inline int sprintu32(char *s, uint32_t x) | |||
| { | |||
| @@ -44,20 +44,20 @@ static inline int sprintu16(char *s, uint16_t x) | |||
| return 2; | |||
| } | |||
| static void *export_caca(cucul_canvas_t const *, size_t *); | |||
| static void *export_ansi(cucul_canvas_t const *, size_t *); | |||
| static void *export_utf8(cucul_canvas_t const *, size_t *, int); | |||
| static void *export_html(cucul_canvas_t const *, size_t *); | |||
| static void *export_html3(cucul_canvas_t const *, size_t *); | |||
| static void *export_bbfr(cucul_canvas_t const *, size_t *); | |||
| static void *export_irc(cucul_canvas_t const *, size_t *); | |||
| static void *export_ps(cucul_canvas_t const *, size_t *); | |||
| static void *export_svg(cucul_canvas_t const *, size_t *); | |||
| static void *export_tga(cucul_canvas_t const *, size_t *); | |||
| static void *export_caca(caca_canvas_t const *, size_t *); | |||
| static void *export_ansi(caca_canvas_t const *, size_t *); | |||
| static void *export_utf8(caca_canvas_t const *, size_t *, int); | |||
| static void *export_html(caca_canvas_t const *, size_t *); | |||
| static void *export_html3(caca_canvas_t const *, size_t *); | |||
| static void *export_bbfr(caca_canvas_t const *, size_t *); | |||
| static void *export_irc(caca_canvas_t const *, size_t *); | |||
| static void *export_ps(caca_canvas_t const *, size_t *); | |||
| static void *export_svg(caca_canvas_t const *, size_t *); | |||
| static void *export_tga(caca_canvas_t const *, size_t *); | |||
| /** \brief Export a canvas into a foreign format. | |||
| * | |||
| * This function exports a libcucul canvas into various foreign formats such | |||
| * This function exports a libcaca canvas into various foreign formats such | |||
| * as ANSI art, HTML, IRC colours, etc. The returned pointer should be passed | |||
| * to free() to release the allocated storage when it is no longer needed. | |||
| * | |||
| @@ -76,13 +76,13 @@ static void *export_tga(cucul_canvas_t const *, size_t *); | |||
| * - \c EINVAL Unsupported format requested. | |||
| * - \c ENOMEM Not enough memory to allocate output buffer. | |||
| * | |||
| * \param cv A libcucul canvas | |||
| * \param cv A libcaca canvas | |||
| * \param format A string describing the requested output format. | |||
| * \param bytes A pointer to a size_t where the number of allocated bytes | |||
| * will be written. | |||
| * \return A pointer to the exported memory area, or NULL in case of error. | |||
| */ | |||
| void *cucul_export_memory(cucul_canvas_t const *cv, char const *format, | |||
| void *caca_export_memory(caca_canvas_t const *cv, char const *format, | |||
| size_t *bytes) | |||
| { | |||
| if(!strcasecmp("caca", format)) | |||
| @@ -126,14 +126,14 @@ void *cucul_export_memory(cucul_canvas_t const *cv, char const *format, | |||
| * | |||
| * Return a list of available export formats. The list is a NULL-terminated | |||
| * array of strings, interleaving a string containing the internal value for | |||
| * the export format, to be used with cucul_export_memory(), and a string | |||
| * the export format, to be used with caca_export_memory(), and a string | |||
| * containing the natural language description for that export format. | |||
| * | |||
| * This function never fails. | |||
| * | |||
| * \return An array of strings. | |||
| */ | |||
| char const * const * cucul_get_export_list(void) | |||
| char const * const * caca_get_export_list(void) | |||
| { | |||
| static char const * const list[] = | |||
| { | |||
| @@ -159,7 +159,7 @@ char const * const * cucul_get_export_list(void) | |||
| */ | |||
| /* Generate a native libcaca canvas file. */ | |||
| static void *export_caca(cucul_canvas_t const *cv, size_t *bytes) | |||
| static void *export_caca(caca_canvas_t const *cv, size_t *bytes) | |||
| { | |||
| char *data, *cur; | |||
| int f, n; | |||
| @@ -212,7 +212,7 @@ static void *export_caca(cucul_canvas_t const *cv, size_t *bytes) | |||
| } | |||
| /* Generate UTF-8 representation of current canvas. */ | |||
| static void *export_utf8(cucul_canvas_t const *cv, size_t *bytes, | |||
| static void *export_utf8(caca_canvas_t const *cv, size_t *bytes, | |||
| int cr) | |||
| { | |||
| static uint8_t const palette[] = | |||
| @@ -244,11 +244,11 @@ static void *export_utf8(cucul_canvas_t const *cv, size_t *bytes, | |||
| uint32_t ch = linechar[x]; | |||
| uint8_t ansifg, ansibg, fg, bg; | |||
| if(ch == CUCUL_MAGIC_FULLWIDTH) | |||
| if(ch == CACA_MAGIC_FULLWIDTH) | |||
| continue; | |||
| ansifg = cucul_attr_to_ansi_fg(attr); | |||
| ansibg = cucul_attr_to_ansi_bg(attr); | |||
| ansifg = caca_attr_to_ansi_fg(attr); | |||
| ansibg = caca_attr_to_ansi_bg(attr); | |||
| fg = ansifg < 0x10 ? palette[ansifg] : 0x10; | |||
| bg = ansibg < 0x10 ? palette[ansibg] : 0x10; | |||
| @@ -271,7 +271,7 @@ static void *export_utf8(cucul_canvas_t const *cv, size_t *bytes, | |||
| cur += sprintf(cur, "m"); | |||
| } | |||
| cur += cucul_utf32_to_utf8(cur, ch); | |||
| cur += caca_utf32_to_utf8(cur, ch); | |||
| prevfg = fg; | |||
| prevbg = bg; | |||
| @@ -293,7 +293,7 @@ static void *export_utf8(cucul_canvas_t const *cv, size_t *bytes, | |||
| } | |||
| /* Generate ANSI representation of current canvas. */ | |||
| static void *export_ansi(cucul_canvas_t const *cv, size_t *bytes) | |||
| static void *export_ansi(caca_canvas_t const *cv, size_t *bytes) | |||
| { | |||
| static uint8_t const palette[] = | |||
| { | |||
| @@ -320,13 +320,13 @@ static void *export_ansi(cucul_canvas_t const *cv, size_t *bytes) | |||
| for(x = 0; x < cv->width; x++) | |||
| { | |||
| uint8_t ansifg = cucul_attr_to_ansi_fg(lineattr[x]); | |||
| uint8_t ansibg = cucul_attr_to_ansi_bg(lineattr[x]); | |||
| uint8_t fg = ansifg < 0x10 ? palette[ansifg] : CUCUL_LIGHTGRAY; | |||
| uint8_t bg = ansibg < 0x10 ? palette[ansibg] : CUCUL_BLACK; | |||
| uint8_t ansifg = caca_attr_to_ansi_fg(lineattr[x]); | |||
| uint8_t ansibg = caca_attr_to_ansi_bg(lineattr[x]); | |||
| uint8_t fg = ansifg < 0x10 ? palette[ansifg] : CACA_LIGHTGRAY; | |||
| uint8_t bg = ansibg < 0x10 ? palette[ansibg] : CACA_BLACK; | |||
| uint32_t ch = linechar[x]; | |||
| if(ch == CUCUL_MAGIC_FULLWIDTH) | |||
| if(ch == CACA_MAGIC_FULLWIDTH) | |||
| ch = '?'; | |||
| if(fg != prevfg || bg != prevbg) | |||
| @@ -345,7 +345,7 @@ static void *export_ansi(cucul_canvas_t const *cv, size_t *bytes) | |||
| cur += sprintf(cur, "5;1;3%d;4%dm", fg - 8, bg - 8); | |||
| } | |||
| *cur++ = cucul_utf32_to_cp437(ch); | |||
| *cur++ = caca_utf32_to_cp437(ch); | |||
| prevfg = fg; | |||
| prevbg = bg; | |||
| @@ -373,7 +373,7 @@ static void *export_ansi(cucul_canvas_t const *cv, size_t *bytes) | |||
| } | |||
| /* Generate HTML representation of current canvas. */ | |||
| static void *export_html(cucul_canvas_t const *cv, size_t *bytes) | |||
| static void *export_html(caca_canvas_t const *cv, size_t *bytes) | |||
| { | |||
| char *data, *cur; | |||
| int x, y, len; | |||
| @@ -390,7 +390,7 @@ static void *export_html(cucul_canvas_t const *cv, size_t *bytes) | |||
| /* HTML header */ | |||
| cur += sprintf(cur, "<html><head>\n"); | |||
| cur += sprintf(cur, "<title>Generated by libcaca %s</title>\n", | |||
| cucul_get_version()); | |||
| caca_get_version()); | |||
| cur += sprintf(cur, "</head><body>\n"); | |||
| cur += sprintf(cur, "<div cellpadding='0' cellspacing='0' style='%s'>\n", | |||
| @@ -404,19 +404,19 @@ static void *export_html(cucul_canvas_t const *cv, size_t *bytes) | |||
| for(x = 0; x < cv->width; x += len) | |||
| { | |||
| cur += sprintf(cur, "<span style=\""); | |||
| if(cucul_attr_to_ansi_fg(lineattr[x]) < 0x10) | |||
| if(caca_attr_to_ansi_fg(lineattr[x]) < 0x10) | |||
| cur += sprintf(cur, ";color:#%.03x", | |||
| cucul_attr_to_rgb12_fg(lineattr[x])); | |||
| if(cucul_attr_to_ansi_bg(lineattr[x]) < 0x10) | |||
| caca_attr_to_rgb12_fg(lineattr[x])); | |||
| if(caca_attr_to_ansi_bg(lineattr[x]) < 0x10) | |||
| cur += sprintf(cur, ";background-color:#%.03x", | |||
| cucul_attr_to_rgb12_bg(lineattr[x])); | |||
| if(lineattr[x] & CUCUL_BOLD) | |||
| caca_attr_to_rgb12_bg(lineattr[x])); | |||
| if(lineattr[x] & CACA_BOLD) | |||
| cur += sprintf(cur, ";font-weight:bold"); | |||
| if(lineattr[x] & CUCUL_ITALICS) | |||
| if(lineattr[x] & CACA_ITALICS) | |||
| cur += sprintf(cur, ";font-style:italic"); | |||
| if(lineattr[x] & CUCUL_UNDERLINE) | |||
| if(lineattr[x] & CACA_UNDERLINE) | |||
| cur += sprintf(cur, ";text-decoration:underline"); | |||
| if(lineattr[x] & CUCUL_BLINK) | |||
| if(lineattr[x] & CACA_BLINK) | |||
| cur += sprintf(cur, ";text-decoration:blink"); | |||
| cur += sprintf(cur, "\">"); | |||
| @@ -424,7 +424,7 @@ static void *export_html(cucul_canvas_t const *cv, size_t *bytes) | |||
| x + len < cv->width && lineattr[x + len] == lineattr[x]; | |||
| len++) | |||
| { | |||
| if(linechar[x + len] == CUCUL_MAGIC_FULLWIDTH) | |||
| if(linechar[x + len] == CACA_MAGIC_FULLWIDTH) | |||
| ; | |||
| else if(linechar[x + len] <= 0x00000020) | |||
| cur += sprintf(cur, " "); | |||
| @@ -455,7 +455,7 @@ static void *export_html(cucul_canvas_t const *cv, size_t *bytes) | |||
| * but permits viewing in old browsers (or limited ones such as links). It | |||
| * will not work under gecko (mozilla rendering engine) unless you set a | |||
| * correct header. */ | |||
| static void *export_html3(cucul_canvas_t const *cv, size_t *bytes) | |||
| static void *export_html3(caca_canvas_t const *cv, size_t *bytes) | |||
| { | |||
| char *data, *cur; | |||
| int x, y, len; | |||
| @@ -492,33 +492,33 @@ static void *export_html3(cucul_canvas_t const *cv, size_t *bytes) | |||
| cur += sprintf(cur, "<td"); | |||
| if(cucul_attr_to_ansi_fg(lineattr[x]) < 0x10) | |||
| if(caca_attr_to_ansi_fg(lineattr[x]) < 0x10) | |||
| cur += sprintf(cur, " bgcolor=#%.06lx", (unsigned long int) | |||
| _cucul_attr_to_rgb24bg(lineattr[x])); | |||
| _caca_attr_to_rgb24bg(lineattr[x])); | |||
| if(len > 1) | |||
| cur += sprintf(cur, " colspan=%d", len); | |||
| cur += sprintf(cur, ">"); | |||
| needfont = cucul_attr_to_ansi_bg(lineattr[x]) < 0x10; | |||
| needfont = caca_attr_to_ansi_bg(lineattr[x]) < 0x10; | |||
| if(needfont) | |||
| cur += sprintf(cur, "<font color=#%.06lx>", (unsigned long int) | |||
| _cucul_attr_to_rgb24fg(lineattr[x])); | |||
| _caca_attr_to_rgb24fg(lineattr[x])); | |||
| if(lineattr[x] & CUCUL_BOLD) | |||
| if(lineattr[x] & CACA_BOLD) | |||
| cur += sprintf(cur, "<b>"); | |||
| if(lineattr[x] & CUCUL_ITALICS) | |||
| if(lineattr[x] & CACA_ITALICS) | |||
| cur += sprintf(cur, "<i>"); | |||
| if(lineattr[x] & CUCUL_UNDERLINE) | |||
| if(lineattr[x] & CACA_UNDERLINE) | |||
| cur += sprintf(cur, "<u>"); | |||
| if(lineattr[x] & CUCUL_BLINK) | |||
| if(lineattr[x] & CACA_BLINK) | |||
| cur += sprintf(cur, "<blink>"); | |||
| for(i = 0; i < len; i++) | |||
| { | |||
| if(linechar[x + i] == CUCUL_MAGIC_FULLWIDTH) | |||
| if(linechar[x + i] == CACA_MAGIC_FULLWIDTH) | |||
| ; | |||
| else if(linechar[x + i] <= 0x00000020) | |||
| cur += sprintf(cur, " "); | |||
| @@ -528,13 +528,13 @@ static void *export_html3(cucul_canvas_t const *cv, size_t *bytes) | |||
| cur += sprintf(cur, "&#%i;", (unsigned int)linechar[x + i]); | |||
| } | |||
| if(lineattr[x] & CUCUL_BLINK) | |||
| if(lineattr[x] & CACA_BLINK) | |||
| cur += sprintf(cur, "</blink>"); | |||
| if(lineattr[x] & CUCUL_UNDERLINE) | |||
| if(lineattr[x] & CACA_UNDERLINE) | |||
| cur += sprintf(cur, "</u>"); | |||
| if(lineattr[x] & CUCUL_ITALICS) | |||
| if(lineattr[x] & CACA_ITALICS) | |||
| cur += sprintf(cur, "</i>"); | |||
| if(lineattr[x] & CUCUL_BOLD) | |||
| if(lineattr[x] & CACA_BOLD) | |||
| cur += sprintf(cur, "</b>"); | |||
| if(needfont) | |||
| @@ -556,7 +556,7 @@ static void *export_html3(cucul_canvas_t const *cv, size_t *bytes) | |||
| return data; | |||
| } | |||
| static void *export_bbfr(cucul_canvas_t const *cv, size_t *bytes) | |||
| static void *export_bbfr(caca_canvas_t const *cv, size_t *bytes) | |||
| { | |||
| char *data, *cur; | |||
| int x, y, len; | |||
| @@ -594,46 +594,46 @@ static void *export_bbfr(cucul_canvas_t const *cv, size_t *bytes) | |||
| && linechar[x] != ' ') | |||
| len++; | |||
| needback = cucul_attr_to_ansi_bg(lineattr[x]) < 0x10; | |||
| needfront = cucul_attr_to_ansi_fg(lineattr[x]) < 0x10; | |||
| needback = caca_attr_to_ansi_bg(lineattr[x]) < 0x10; | |||
| needfront = caca_attr_to_ansi_fg(lineattr[x]) < 0x10; | |||
| if(needback) | |||
| cur += sprintf(cur, "[f=#%.06lx]", (unsigned long int) | |||
| _cucul_attr_to_rgb24bg(lineattr[x])); | |||
| _caca_attr_to_rgb24bg(lineattr[x])); | |||
| if(linechar[x] == ' ') | |||
| cur += sprintf(cur, "[c=#%.06lx]", (unsigned long int) | |||
| _cucul_attr_to_rgb24bg(lineattr[x])); | |||
| _caca_attr_to_rgb24bg(lineattr[x])); | |||
| else if(needfront) | |||
| cur += sprintf(cur, "[c=#%.06lx]", (unsigned long int) | |||
| _cucul_attr_to_rgb24fg(lineattr[x])); | |||
| _caca_attr_to_rgb24fg(lineattr[x])); | |||
| if(lineattr[x] & CUCUL_BOLD) | |||
| if(lineattr[x] & CACA_BOLD) | |||
| cur += sprintf(cur, "[g]"); | |||
| if(lineattr[x] & CUCUL_ITALICS) | |||
| if(lineattr[x] & CACA_ITALICS) | |||
| cur += sprintf(cur, "[i]"); | |||
| if(lineattr[x] & CUCUL_UNDERLINE) | |||
| if(lineattr[x] & CACA_UNDERLINE) | |||
| cur += sprintf(cur, "[s]"); | |||
| if(lineattr[x] & CUCUL_BLINK) | |||
| if(lineattr[x] & CACA_BLINK) | |||
| ; /* FIXME */ | |||
| for(i = 0; i < len; i++) | |||
| { | |||
| if(linechar[x + i] == CUCUL_MAGIC_FULLWIDTH) | |||
| if(linechar[x + i] == CACA_MAGIC_FULLWIDTH) | |||
| ; | |||
| else if(linechar[x + i] == ' ') | |||
| *cur++ = '_'; | |||
| else | |||
| cur += cucul_utf32_to_utf8(cur, linechar[x + i]); | |||
| cur += caca_utf32_to_utf8(cur, linechar[x + i]); | |||
| } | |||
| if(lineattr[x] & CUCUL_BLINK) | |||
| if(lineattr[x] & CACA_BLINK) | |||
| ; /* FIXME */ | |||
| if(lineattr[x] & CUCUL_UNDERLINE) | |||
| if(lineattr[x] & CACA_UNDERLINE) | |||
| cur += sprintf(cur, "[/s]"); | |||
| if(lineattr[x] & CUCUL_ITALICS) | |||
| if(lineattr[x] & CACA_ITALICS) | |||
| cur += sprintf(cur, "[/i]"); | |||
| if(lineattr[x] & CUCUL_BOLD) | |||
| if(lineattr[x] & CACA_BOLD) | |||
| cur += sprintf(cur, "[/g]"); | |||
| if(linechar[x] == ' ' || needfront) | |||
| @@ -657,7 +657,7 @@ static void *export_bbfr(cucul_canvas_t const *cv, size_t *bytes) | |||
| } | |||
| /* Export a text file with IRC colours */ | |||
| static void *export_irc(cucul_canvas_t const *cv, size_t *bytes) | |||
| static void *export_irc(caca_canvas_t const *cv, size_t *bytes) | |||
| { | |||
| static uint8_t const palette[] = | |||
| { | |||
| @@ -695,11 +695,11 @@ static void *export_irc(cucul_canvas_t const *cv, size_t *bytes) | |||
| uint32_t ch = linechar[x]; | |||
| uint8_t ansifg, ansibg, fg, bg; | |||
| if(ch == CUCUL_MAGIC_FULLWIDTH) | |||
| if(ch == CACA_MAGIC_FULLWIDTH) | |||
| continue; | |||
| ansifg = cucul_attr_to_ansi_fg(attr); | |||
| ansibg = cucul_attr_to_ansi_bg(attr); | |||
| ansifg = caca_attr_to_ansi_fg(attr); | |||
| ansibg = caca_attr_to_ansi_bg(attr); | |||
| fg = ansifg < 0x10 ? palette[ansifg] : 0x10; | |||
| bg = ansibg < 0x10 ? palette[ansibg] : 0x10; | |||
| @@ -741,7 +741,7 @@ static void *export_irc(cucul_canvas_t const *cv, size_t *bytes) | |||
| cur += sprintf(cur, "\x02\x02"); | |||
| } | |||
| cur += cucul_utf32_to_utf8(cur, ch); | |||
| cur += caca_utf32_to_utf8(cur, ch); | |||
| prevfg = fg; | |||
| prevbg = bg; | |||
| } | |||
| @@ -764,7 +764,7 @@ static void *export_irc(cucul_canvas_t const *cv, size_t *bytes) | |||
| } | |||
| /* Export a PostScript document. */ | |||
| static void *export_ps(cucul_canvas_t const *cv, size_t *bytes) | |||
| static void *export_ps(caca_canvas_t const *cv, size_t *bytes) | |||
| { | |||
| static char const *ps_header = | |||
| "%!\n" | |||
| @@ -810,7 +810,7 @@ static void *export_ps(cucul_canvas_t const *cv, size_t *bytes) | |||
| for(x = 0; x < cv->width; x++) | |||
| { | |||
| uint8_t argb[8]; | |||
| cucul_attr_to_argb64(*lineattr++, argb); | |||
| caca_attr_to_argb64(*lineattr++, argb); | |||
| cur += sprintf(cur, "1 0 translate\n %f %f %f csquare\n", | |||
| (float)argb[1] * (1.0 / 0xf), | |||
| (float)argb[2] * (1.0 / 0xf), | |||
| @@ -834,7 +834,7 @@ static void *export_ps(cucul_canvas_t const *cv, size_t *bytes) | |||
| uint8_t argb[8]; | |||
| uint32_t ch = *linechar++; | |||
| cucul_attr_to_argb64(*lineattr++, argb); | |||
| caca_attr_to_argb64(*lineattr++, argb); | |||
| cur += sprintf(cur, "newpath\n"); | |||
| cur += sprintf(cur, "%d %d moveto\n", (x + 1) * 6, y * 10 + 2); | |||
| @@ -873,7 +873,7 @@ static void *export_ps(cucul_canvas_t const *cv, size_t *bytes) | |||
| } | |||
| /* Export an SVG vector image */ | |||
| static void *export_svg(cucul_canvas_t const *cv, size_t *bytes) | |||
| static void *export_svg(caca_canvas_t const *cv, size_t *bytes) | |||
| { | |||
| static char const svg_header[] = | |||
| "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" | |||
| @@ -905,7 +905,7 @@ static void *export_svg(cucul_canvas_t const *cv, size_t *bytes) | |||
| { | |||
| cur += sprintf(cur, "<rect style=\"fill:#%.03x\" x=\"%d\" y=\"%d\"" | |||
| " width=\"6\" height=\"10\"/>\n", | |||
| cucul_attr_to_rgb12_bg(*lineattr++), | |||
| caca_attr_to_rgb12_bg(*lineattr++), | |||
| x * 6, y * 10); | |||
| } | |||
| } | |||
| @@ -920,7 +920,7 @@ static void *export_svg(cucul_canvas_t const *cv, size_t *bytes) | |||
| { | |||
| uint32_t ch = *linechar++; | |||
| if(ch == ' ' || ch == CUCUL_MAGIC_FULLWIDTH) | |||
| if(ch == ' ' || ch == CACA_MAGIC_FULLWIDTH) | |||
| { | |||
| lineattr++; | |||
| continue; | |||
| @@ -928,13 +928,13 @@ static void *export_svg(cucul_canvas_t const *cv, size_t *bytes) | |||
| cur += sprintf(cur, "<text style=\"fill:#%.03x\" " | |||
| "x=\"%d\" y=\"%d\">", | |||
| cucul_attr_to_rgb12_fg(*lineattr++), | |||
| caca_attr_to_rgb12_fg(*lineattr++), | |||
| x * 6, (y * 10) + 8); | |||
| if(ch < 0x00000020) | |||
| *cur++ = '?'; | |||
| else if(ch > 0x0000007f) | |||
| cur += cucul_utf32_to_utf8(cur, ch); | |||
| cur += caca_utf32_to_utf8(cur, ch); | |||
| else switch((uint8_t)ch) | |||
| { | |||
| case '>': cur += sprintf(cur, ">"); break; | |||
| @@ -959,24 +959,24 @@ static void *export_svg(cucul_canvas_t const *cv, size_t *bytes) | |||
| } | |||
| /* Export a TGA image */ | |||
| static void *export_tga(cucul_canvas_t const *cv, size_t *bytes) | |||
| static void *export_tga(caca_canvas_t const *cv, size_t *bytes) | |||
| { | |||
| char const * const *fontlist; | |||
| char *data, *cur; | |||
| cucul_font_t *f; | |||
| caca_font_t *f; | |||
| int i, w, h; | |||
| fontlist = cucul_get_font_list(); | |||
| fontlist = caca_get_font_list(); | |||
| if(!fontlist[0]) | |||
| { | |||
| seterrno(EINVAL); | |||
| return NULL; | |||
| } | |||
| f = cucul_load_font(fontlist[0], 0); | |||
| f = caca_load_font(fontlist[0], 0); | |||
| w = cucul_get_canvas_width(cv) * cucul_get_font_width(f); | |||
| h = cucul_get_canvas_height(cv) * cucul_get_font_height(f); | |||
| w = caca_get_canvas_width(cv) * caca_get_font_width(f); | |||
| h = caca_get_canvas_height(cv) * caca_get_font_height(f); | |||
| *bytes = w * h * 4 + 18; /* 32 bpp + 18 bytes for the header */ | |||
| cur = data = malloc(*bytes); | |||
| @@ -1002,7 +1002,7 @@ static void *export_tga(cucul_canvas_t const *cv, size_t *bytes) | |||
| /* Color Map Data: no colormap */ | |||
| /* Image Data */ | |||
| cucul_render_canvas(cv, f, cur, w, h, 4 * w); | |||
| caca_render_canvas(cv, f, cur, w, h, 4 * w); | |||
| /* Swap bytes. What a waste of time. */ | |||
| for(i = 0; i < w * h * 4; i += 4) | |||
| @@ -1012,7 +1012,7 @@ static void *export_tga(cucul_canvas_t const *cv, size_t *bytes) | |||
| c = cur[i + 1]; cur[i + 1] = cur[i + 2]; cur[i + 2] = c; | |||
| } | |||
| cucul_free_font(f); | |||
| caca_free_font(f); | |||
| return data; | |||
| } | |||
| @@ -1,5 +1,5 @@ | |||
| /* | |||
| * libcucul Canvas for ultrafast compositing of Unicode letters | |||
| * libcaca Colour ASCII-Art library | |||
| * Copyright (c) 2006-2007 Sam Hocevar <sam@zoy.org> | |||
| * All Rights Reserved | |||
| * | |||
| @@ -28,10 +28,10 @@ | |||
| # include <string.h> | |||
| #endif | |||
| #include "cucul.h" | |||
| #include "cucul_internals.h" | |||
| #include "caca.h" | |||
| #include "caca_internals.h" | |||
| struct cucul_figfont | |||
| struct caca_figfont | |||
| { | |||
| int term_width; | |||
| int x, y, w, h, lines; | |||
| @@ -43,18 +43,18 @@ struct cucul_figfont | |||
| int old_layout; | |||
| int print_direction, full_layout, codetag_count; | |||
| int glyphs; | |||
| cucul_canvas_t *fontcv, *charcv; | |||
| caca_canvas_t *fontcv, *charcv; | |||
| int *left, *right; /* Unused yet */ | |||
| uint32_t *lookup; | |||
| }; | |||
| static uint32_t hsmush(uint32_t ch1, uint32_t ch2, int rule); | |||
| static cucul_figfont_t * open_figfont(char const *); | |||
| static int free_figfont(cucul_figfont_t *); | |||
| static caca_figfont_t * open_figfont(char const *); | |||
| static int free_figfont(caca_figfont_t *); | |||
| int cucul_canvas_set_figfont(cucul_canvas_t *cv, char const *path) | |||
| int caca_canvas_set_figfont(caca_canvas_t *cv, char const *path) | |||
| { | |||
| cucul_figfont_t *ff = NULL; | |||
| caca_figfont_t *ff = NULL; | |||
| if(path) | |||
| { | |||
| @@ -65,7 +65,7 @@ int cucul_canvas_set_figfont(cucul_canvas_t *cv, char const *path) | |||
| if(cv->ff) | |||
| { | |||
| cucul_free_canvas(cv->ff->charcv); | |||
| caca_free_canvas(cv->ff->charcv); | |||
| free(cv->ff->left); | |||
| free(cv->ff->right); | |||
| free_figfont(cv->ff); | |||
| @@ -84,7 +84,7 @@ int cucul_canvas_set_figfont(cucul_canvas_t *cv, char const *path) | |||
| ff->x = ff->y = 0; | |||
| ff->w = ff->h = 0; | |||
| ff->lines = 0; | |||
| cucul_set_canvas_size(cv, 0, 0); /* XXX */ | |||
| caca_set_canvas_size(cv, 0, 0); /* XXX */ | |||
| /* from TOIlet’s figlet.c */ | |||
| if(ff->full_layout & 0x3f) | |||
| @@ -117,7 +117,7 @@ int cucul_canvas_set_figfont(cucul_canvas_t *cv, char const *path) | |||
| break; | |||
| } | |||
| ff->charcv = cucul_create_canvas(ff->max_length - 2, ff->height); | |||
| ff->charcv = caca_create_canvas(ff->max_length - 2, ff->height); | |||
| ff->left = malloc(ff->height * sizeof(int)); | |||
| ff->right = malloc(ff->height * sizeof(int)); | |||
| @@ -127,9 +127,9 @@ int cucul_canvas_set_figfont(cucul_canvas_t *cv, char const *path) | |||
| return 0; | |||
| } | |||
| int cucul_put_figchar(cucul_canvas_t *cv, uint32_t ch) | |||
| int caca_put_figchar(caca_canvas_t *cv, uint32_t ch) | |||
| { | |||
| cucul_figfont_t *ff = cv->ff; | |||
| caca_figfont_t *ff = cv->ff; | |||
| int c, w, h, x, y, overlap, extra, xleft, xright; | |||
| switch(ch) | |||
| @@ -154,8 +154,8 @@ int cucul_put_figchar(cucul_canvas_t *cv, uint32_t ch) | |||
| w = ff->lookup[c * 2 + 1]; | |||
| h = ff->height; | |||
| cucul_set_canvas_handle(ff->fontcv, 0, c * ff->height); | |||
| cucul_blit(ff->charcv, 0, 0, ff->fontcv, NULL); | |||
| caca_set_canvas_handle(ff->fontcv, 0, c * ff->height); | |||
| caca_blit(ff->charcv, 0, 0, ff->fontcv, NULL); | |||
| /* Check whether we reached the end of the screen */ | |||
| if(ff->x && ff->x + w > ff->term_width) | |||
| @@ -176,12 +176,12 @@ int cucul_put_figchar(cucul_canvas_t *cv, uint32_t ch) | |||
| { | |||
| /* Compute how much spaces we can eat from the new glyph */ | |||
| for(xright = 0; xright < overlap; xright++) | |||
| if(cucul_get_char(ff->charcv, xright, y) != ' ') | |||
| if(caca_get_char(ff->charcv, xright, y) != ' ') | |||
| break; | |||
| /* Compute how much spaces we can eat from the previous glyph */ | |||
| for(xleft = 0; xright + xleft < overlap && xleft < ff->x; xleft++) | |||
| if(cucul_get_char(cv, ff->x - 1 - xleft, ff->y + y) != ' ') | |||
| if(caca_get_char(cv, ff->x - 1 - xleft, ff->y + y) != ' ') | |||
| break; | |||
| /* Handle overlapping */ | |||
| @@ -192,8 +192,8 @@ int cucul_put_figchar(cucul_canvas_t *cv, uint32_t ch) | |||
| if(ff->hmode == H_SMUSH) | |||
| { | |||
| if(xleft < ff->x && | |||
| hsmush(cucul_get_char(cv, ff->x - 1 - xleft, ff->y + y), | |||
| cucul_get_char(ff->charcv, xright, y), | |||
| hsmush(caca_get_char(cv, ff->x - 1 - xleft, ff->y + y), | |||
| caca_get_char(ff->charcv, xright, y), | |||
| ff->hsmushrule)) | |||
| xleft++; | |||
| } | |||
| @@ -219,29 +219,29 @@ int cucul_put_figchar(cucul_canvas_t *cv, uint32_t ch) | |||
| #if 0 /* deactivated for libcaca insertion */ | |||
| if(attr) | |||
| cucul_set_attr(cv, attr); | |||
| caca_set_attr(cv, attr); | |||
| #endif | |||
| cucul_set_canvas_size(cv, ff->w, ff->h); | |||
| caca_set_canvas_size(cv, ff->w, ff->h); | |||
| /* Render our char (FIXME: create a rect-aware cucul_blit_canvas?) */ | |||
| /* Render our char (FIXME: create a rect-aware caca_blit_canvas?) */ | |||
| for(y = 0; y < h; y++) | |||
| for(x = 0; x < w; x++) | |||
| { | |||
| uint32_t ch1, ch2; | |||
| //uint32_t tmpat = cucul_get_attr(ff->fontcv, x, y + c * ff->height); | |||
| ch2 = cucul_get_char(ff->charcv, x, y); | |||
| //uint32_t tmpat = caca_get_attr(ff->fontcv, x, y + c * ff->height); | |||
| ch2 = caca_get_char(ff->charcv, x, y); | |||
| if(ch2 == ' ') | |||
| continue; | |||
| ch1 = cucul_get_char(cv, ff->x + x - overlap, ff->y + y); | |||
| /* FIXME: this could be changed to cucul_put_attr() when the | |||
| * function is fixed in libcucul */ | |||
| //cucul_set_attr(cv, tmpat); | |||
| ch1 = caca_get_char(cv, ff->x + x - overlap, ff->y + y); | |||
| /* FIXME: this could be changed to caca_put_attr() when the | |||
| * function is fixed in libcaca */ | |||
| //caca_set_attr(cv, tmpat); | |||
| if(ch1 == ' ' || ff->hmode != H_SMUSH) | |||
| cucul_put_char(cv, ff->x + x - overlap, ff->y + y, ch2); | |||
| caca_put_char(cv, ff->x + x - overlap, ff->y + y, ch2); | |||
| else | |||
| cucul_put_char(cv, ff->x + x - overlap, ff->y + y, | |||
| caca_put_char(cv, ff->x + x - overlap, ff->y + y, | |||
| hsmush(ch1, ch2, ff->hsmushrule)); | |||
| //cucul_put_attr(cv, ff->x + x, ff->y + y, tmpat); | |||
| //caca_put_attr(cv, ff->x + x, ff->y + y, tmpat); | |||
| } | |||
| /* Advance cursor */ | |||
| @@ -250,32 +250,32 @@ int cucul_put_figchar(cucul_canvas_t *cv, uint32_t ch) | |||
| return 0; | |||
| } | |||
| int cucul_flush_figlet(cucul_canvas_t *cv) | |||
| int caca_flush_figlet(caca_canvas_t *cv) | |||
| { | |||
| cucul_figfont_t *ff = cv->ff; | |||
| caca_figfont_t *ff = cv->ff; | |||
| int x, y; | |||
| //ff->torender = cv; | |||
| //cucul_set_canvas_size(ff->torender, ff->w, ff->h); | |||
| cucul_set_canvas_size(cv, ff->w, ff->h); | |||
| //caca_set_canvas_size(ff->torender, ff->w, ff->h); | |||
| caca_set_canvas_size(cv, ff->w, ff->h); | |||
| /* FIXME: do this somewhere else, or record hardblank positions */ | |||
| for(y = 0; y < ff->h; y++) | |||
| for(x = 0; x < ff->w; x++) | |||
| if(cucul_get_char(cv, x, y) == 0xa0) | |||
| if(caca_get_char(cv, x, y) == 0xa0) | |||
| { | |||
| uint32_t attr = cucul_get_attr(cv, x, y); | |||
| cucul_put_char(cv, x, y, ' '); | |||
| cucul_put_attr(cv, x, y, attr); | |||
| uint32_t attr = caca_get_attr(cv, x, y); | |||
| caca_put_char(cv, x, y, ' '); | |||
| caca_put_attr(cv, x, y, attr); | |||
| } | |||
| ff->x = ff->y = 0; | |||
| ff->w = ff->h = 0; | |||
| //cv = cucul_create_canvas(1, 1); /* XXX */ | |||
| //cv = caca_create_canvas(1, 1); /* XXX */ | |||
| /* from render.c */ | |||
| ff->lines += cucul_get_canvas_height(cv); | |||
| ff->lines += caca_get_canvas_height(cv); | |||
| return 0; | |||
| } | |||
| @@ -283,17 +283,17 @@ int cucul_flush_figlet(cucul_canvas_t *cv) | |||
| #define STD_GLYPHS (127 - 32) | |||
| #define EXT_GLYPHS (STD_GLYPHS + 7) | |||
| static cucul_figfont_t * open_figfont(char const *path) | |||
| static caca_figfont_t * open_figfont(char const *path) | |||
| { | |||
| char altpath[2048]; | |||
| char buf[2048]; | |||
| char hardblank[10]; | |||
| cucul_figfont_t *ff; | |||
| caca_figfont_t *ff; | |||
| char *data = NULL; | |||
| cucul_file_t *f; | |||
| caca_file_t *f; | |||
| int i, j, size, comment_lines; | |||
| ff = malloc(sizeof(cucul_figfont_t)); | |||
| ff = malloc(sizeof(caca_figfont_t)); | |||
| if(!ff) | |||
| { | |||
| seterrno(ENOMEM); | |||
| @@ -301,7 +301,7 @@ static cucul_figfont_t * open_figfont(char const *path) | |||
| } | |||
| /* Open font: if not found, try .tlf, then .flf */ | |||
| f = cucul_file_open(path, "r"); | |||
| f = caca_file_open(path, "r"); | |||
| #if !defined __KERNEL__ && defined HAVE_SNPRINTF | |||
| #if (! defined(snprintf)) && ( defined(_WIN32) || defined(WIN32) ) && (! defined(__CYGWIN__)) | |||
| @@ -312,13 +312,13 @@ static cucul_figfont_t * open_figfont(char const *path) | |||
| { | |||
| snprintf(altpath, 2047, "%s.tlf", path); | |||
| altpath[2047] = '\0'; | |||
| f = cucul_file_open(altpath, "r"); | |||
| f = caca_file_open(altpath, "r"); | |||
| } | |||
| if(!f) | |||
| { | |||
| snprintf(altpath, 2047, "%s.flf", path); | |||
| altpath[2047] = '\0'; | |||
| f = cucul_file_open(altpath, "r"); | |||
| f = caca_file_open(altpath, "r"); | |||
| } | |||
| #endif | |||
| if(!f) | |||
| @@ -332,14 +332,14 @@ static cucul_figfont_t * open_figfont(char const *path) | |||
| ff->print_direction = 0; | |||
| ff->full_layout = 0; | |||
| ff->codetag_count = 0; | |||
| cucul_file_gets(f, buf, 2048); | |||
| caca_file_gets(f, buf, 2048); | |||
| if(sscanf(buf, "%*[ft]lf2a%6s %u %u %u %i %u %u %u %u\n", hardblank, | |||
| &ff->height, &ff->baseline, &ff->max_length, | |||
| &ff->old_layout, &comment_lines, &ff->print_direction, | |||
| &ff->full_layout, &ff->codetag_count) < 6) | |||
| { | |||
| debug("figfont error: `%s' has invalid header: %s", path, buf); | |||
| cucul_file_close(f); | |||
| caca_file_close(f); | |||
| free(ff); | |||
| seterrno(EINVAL); | |||
| return NULL; | |||
| @@ -351,24 +351,24 @@ static cucul_figfont_t * open_figfont(char const *path) | |||
| { | |||
| debug("figfont error: `%s' has invalid layout %i/%u", | |||
| path, ff->old_layout, ff->full_layout); | |||
| cucul_file_close(f); | |||
| caca_file_close(f); | |||
| free(ff); | |||
| seterrno(EINVAL); | |||
| return NULL; | |||
| } | |||
| ff->hardblank = cucul_utf8_to_utf32(hardblank, NULL); | |||
| ff->hardblank = caca_utf8_to_utf32(hardblank, NULL); | |||
| /* Skip comment lines */ | |||
| for(i = 0; i < comment_lines; i++) | |||
| cucul_file_gets(f, buf, 2048); | |||
| caca_file_gets(f, buf, 2048); | |||
| /* Read mandatory characters (32-127, 196, 214, 220, 228, 246, 252, 223) | |||
| * then read additional characters. */ | |||
| ff->glyphs = 0; | |||
| ff->lookup = NULL; | |||
| for(i = 0, size = 0; !cucul_file_eof(f); ff->glyphs++) | |||
| for(i = 0, size = 0; !caca_file_eof(f); ff->glyphs++) | |||
| { | |||
| if((ff->glyphs % 2048) == 0) | |||
| ff->lookup = realloc(ff->lookup, | |||
| @@ -385,7 +385,7 @@ static cucul_figfont_t * open_figfont(char const *path) | |||
| } | |||
| else | |||
| { | |||
| if(cucul_file_gets(f, buf, 2048) == NULL) | |||
| if(caca_file_gets(f, buf, 2048) == NULL) | |||
| break; | |||
| /* Ignore blank lines, as in jacky.flf */ | |||
| @@ -396,7 +396,7 @@ static cucul_figfont_t * open_figfont(char const *path) | |||
| if(buf[0] == '-') | |||
| { | |||
| for(j = 0; j < ff->height; j++) | |||
| cucul_file_gets(f, buf, 2048); | |||
| caca_file_gets(f, buf, 2048); | |||
| continue; | |||
| } | |||
| @@ -423,12 +423,12 @@ static cucul_figfont_t * open_figfont(char const *path) | |||
| if(i + 2048 >= size) | |||
| data = realloc(data, size += 2048); | |||
| cucul_file_gets(f, data + i, 2048); | |||
| caca_file_gets(f, data + i, 2048); | |||
| i = (uintptr_t)strchr(data + i, 0) - (uintptr_t)data; | |||
| } | |||
| } | |||
| cucul_file_close(f); | |||
| caca_file_close(f); | |||
| if(ff->glyphs < EXT_GLYPHS) | |||
| { | |||
| @@ -442,8 +442,8 @@ static cucul_figfont_t * open_figfont(char const *path) | |||
| } | |||
| /* Import buffer into canvas */ | |||
| ff->fontcv = cucul_create_canvas(0, 0); | |||
| cucul_import_memory(ff->fontcv, data, i, "utf8"); | |||
| ff->fontcv = caca_create_canvas(0, 0); | |||
| caca_import_memory(ff->fontcv, data, i, "utf8"); | |||
| free(data); | |||
| /* Remove EOL characters. For now we ignore hardblanks, don’t do any | |||
| @@ -454,11 +454,11 @@ static cucul_figfont_t * open_figfont(char const *path) | |||
| for(i = ff->max_length; i--;) | |||
| { | |||
| ch = cucul_get_char(ff->fontcv, i, j); | |||
| ch = caca_get_char(ff->fontcv, i, j); | |||
| /* Replace hardblanks with U+00A0 NO-BREAK SPACE */ | |||
| if(ch == ff->hardblank) | |||
| cucul_put_char(ff->fontcv, i, j, ch = 0xa0); | |||
| caca_put_char(ff->fontcv, i, j, ch = 0xa0); | |||
| if(oldch && ch != oldch) | |||
| { | |||
| @@ -466,11 +466,11 @@ static cucul_figfont_t * open_figfont(char const *path) | |||
| ff->lookup[j / ff->height * 2 + 1] = i + 1; | |||
| } | |||
| else if(oldch && ch == oldch) | |||
| cucul_put_char(ff->fontcv, i, j, ' '); | |||
| caca_put_char(ff->fontcv, i, j, ' '); | |||
| else if(ch != ' ') | |||
| { | |||
| oldch = ch; | |||
| cucul_put_char(ff->fontcv, i, j, ' '); | |||
| caca_put_char(ff->fontcv, i, j, ' '); | |||
| } | |||
| } | |||
| } | |||
| @@ -478,9 +478,9 @@ static cucul_figfont_t * open_figfont(char const *path) | |||
| return ff; | |||
| } | |||
| int free_figfont(cucul_figfont_t *ff) | |||
| int free_figfont(caca_figfont_t *ff) | |||
| { | |||
| cucul_free_canvas(ff->fontcv); | |||
| caca_free_canvas(ff->fontcv); | |||
| free(ff->lookup); | |||
| free(ff); | |||
| @@ -1,5 +1,5 @@ | |||
| /* | |||
| * libcucul Canvas for ultrafast compositing of Unicode letters | |||
| * libcaca Colour ASCII-Art library | |||
| * Copyright (c) 2006-2007 Sam Hocevar <sam@zoy.org> | |||
| * All Rights Reserved | |||
| * | |||
| @@ -29,15 +29,15 @@ | |||
| # endif | |||
| #endif | |||
| #include "cucul.h" | |||
| #include "cucul_internals.h" | |||
| #include "caca.h" | |||
| #include "caca_internals.h" | |||
| #if !defined __KERNEL__ && defined HAVE_ZLIB_H | |||
| static int zipread(cucul_file_t *, void *, unsigned int); | |||
| static int zipread(caca_file_t *, void *, unsigned int); | |||
| #endif | |||
| #if !defined __KERNEL__ | |||
| struct cucul_file | |||
| struct caca_file | |||
| { | |||
| # if defined HAVE_ZLIB_H | |||
| uint8_t read_buffer[READSIZE]; | |||
| @@ -50,13 +50,13 @@ struct cucul_file | |||
| }; | |||
| #endif | |||
| cucul_file_t *cucul_file_open(char const *path, const char *mode) | |||
| caca_file_t *caca_file_open(char const *path, const char *mode) | |||
| { | |||
| #if defined __KERNEL__ | |||
| seterrno(ENOSYS); | |||
| return NULL; | |||
| #else | |||
| cucul_file_t *fp = malloc(sizeof(*fp)); | |||
| caca_file_t *fp = malloc(sizeof(*fp)); | |||
| fp->readonly = !!strchr(mode, 'r'); | |||
| @@ -125,7 +125,7 @@ cucul_file_t *cucul_file_open(char const *path, const char *mode) | |||
| #endif | |||
| } | |||
| int cucul_file_close(cucul_file_t *fp) | |||
| int caca_file_close(caca_file_t *fp) | |||
| { | |||
| #if defined __KERNEL__ | |||
| seterrno(ENOSYS); | |||
| @@ -143,7 +143,7 @@ int cucul_file_close(cucul_file_t *fp) | |||
| #endif | |||
| } | |||
| uint64_t cucul_file_tell(cucul_file_t *fp) | |||
| uint64_t caca_file_tell(caca_file_t *fp) | |||
| { | |||
| #if defined __KERNEL__ | |||
| seterrno(ENOSYS); | |||
| @@ -157,7 +157,7 @@ uint64_t cucul_file_tell(cucul_file_t *fp) | |||
| #endif | |||
| } | |||
| size_t cucul_file_read(cucul_file_t *fp, void *ptr, size_t size) | |||
| size_t caca_file_read(caca_file_t *fp, void *ptr, size_t size) | |||
| { | |||
| #if defined __KERNEL__ | |||
| seterrno(ENOSYS); | |||
| @@ -171,7 +171,7 @@ size_t cucul_file_read(cucul_file_t *fp, void *ptr, size_t size) | |||
| #endif | |||
| } | |||
| size_t cucul_file_write(cucul_file_t *fp, const void *ptr, size_t size) | |||
| size_t caca_file_write(caca_file_t *fp, const void *ptr, size_t size) | |||
| { | |||
| #if defined __KERNEL__ | |||
| seterrno(ENOSYS); | |||
| @@ -194,7 +194,7 @@ size_t cucul_file_write(cucul_file_t *fp, const void *ptr, size_t size) | |||
| #endif | |||
| } | |||
| char *cucul_file_gets(cucul_file_t *fp, char *s, int size) | |||
| char *caca_file_gets(caca_file_t *fp, char *s, int size) | |||
| { | |||
| #if defined __KERNEL__ | |||
| seterrno(ENOSYS); | |||
| @@ -228,7 +228,7 @@ char *cucul_file_gets(cucul_file_t *fp, char *s, int size) | |||
| #endif | |||
| } | |||
| int cucul_file_eof(cucul_file_t *fp) | |||
| int caca_file_eof(caca_file_t *fp) | |||
| { | |||
| #if defined __KERNEL__ | |||
| return 1; | |||
| @@ -240,7 +240,7 @@ int cucul_file_eof(cucul_file_t *fp) | |||
| } | |||
| #if !defined __KERNEL__ && defined HAVE_ZLIB_H | |||
| static int zipread(cucul_file_t *fp, void *buf, unsigned int len) | |||
| static int zipread(caca_file_t *fp, void *buf, unsigned int len) | |||
| { | |||
| unsigned int total_read = 0; | |||
| @@ -1,5 +1,5 @@ | |||
| /* | |||
| * libcucul Canvas for ultrafast compositing of Unicode letters | |||
| * libcaca Colour ASCII-Art library | |||
| * Copyright (c) 2002-2006 Sam Hocevar <sam@zoy.org> | |||
| * All Rights Reserved | |||
| * | |||
| @@ -27,8 +27,8 @@ | |||
| # include <string.h> | |||
| #endif | |||
| #include "cucul.h" | |||
| #include "cucul_internals.h" | |||
| #include "caca.h" | |||
| #include "caca_internals.h" | |||
| /* Internal fonts */ | |||
| #include "mono9.data" | |||
| @@ -55,7 +55,7 @@ struct glyph_info | |||
| uint32_t data_offset; | |||
| }; | |||
| struct cucul_font | |||
| struct caca_font | |||
| { | |||
| struct font_header header; | |||
| @@ -91,7 +91,7 @@ DECLARE_UNPACKGLYPH(1) | |||
| /** \brief Load a font from memory for future use. | |||
| * | |||
| * This function loads a font and returns a handle to its internal | |||
| * structure. The handle can then be used with cucul_render_canvas() | |||
| * structure. The handle can then be used with caca_render_canvas() | |||
| * for bitmap output. | |||
| * | |||
| * Internal fonts can also be loaded: if \c size is set to 0, \c data must | |||
| @@ -99,7 +99,7 @@ DECLARE_UNPACKGLYPH(1) | |||
| * | |||
| * If \c size is non-zero, the \c size bytes of memory at address \c data | |||
| * are loaded as a font. This memory are must not be freed by the calling | |||
| * program until the font handle has been freed with cucul_free_font(). | |||
| * program until the font handle has been freed with caca_free_font(). | |||
| * | |||
| * If an error occurs, NULL is returned and \b errno is set accordingly: | |||
| * - \c ENOENT Requested built-in font does not exist. | |||
| @@ -110,17 +110,17 @@ DECLARE_UNPACKGLYPH(1) | |||
| * \param size The size of the memory area, or 0 if the font name is given. | |||
| * \return A font handle or NULL in case of error. | |||
| */ | |||
| cucul_font_t *cucul_load_font(void const *data, size_t size) | |||
| caca_font_t *caca_load_font(void const *data, size_t size) | |||
| { | |||
| cucul_font_t *f; | |||
| caca_font_t *f; | |||
| int i; | |||
| if(size == 0) | |||
| { | |||
| if(!strcasecmp(data, "Monospace 9")) | |||
| return cucul_load_font((char *)&mono9_data, mono9_size); | |||
| return caca_load_font((char *)&mono9_data, mono9_size); | |||
| if(!strcasecmp(data, "Monospace Bold 12")) | |||
| return cucul_load_font((char *)&monobold12_data, monobold12_size); | |||
| return caca_load_font((char *)&monobold12_data, monobold12_size); | |||
| seterrno(ENOENT); | |||
| return NULL; | |||
| @@ -134,7 +134,7 @@ cucul_font_t *cucul_load_font(void const *data, size_t size) | |||
| return NULL; | |||
| } | |||
| f = malloc(sizeof(cucul_font_t)); | |||
| f = malloc(sizeof(caca_font_t)); | |||
| if(!f) | |||
| { | |||
| seterrno(ENOMEM); | |||
| @@ -301,7 +301,7 @@ cucul_font_t *cucul_load_font(void const *data, size_t size) | |||
| * | |||
| * \return An array of strings. | |||
| */ | |||
| char const * const * cucul_get_font_list(void) | |||
| char const * const * caca_get_font_list(void) | |||
| { | |||
| static char const * const list[] = | |||
| { | |||
| @@ -320,10 +320,10 @@ char const * const * cucul_get_font_list(void) | |||
| * | |||
| * This function never fails. | |||
| * | |||
| * \param f The font, as returned by cucul_load_font() | |||
| * \param f The font, as returned by caca_load_font() | |||
| * \return The standard glyph width. | |||
| */ | |||
| int cucul_get_font_width(cucul_font_t const *f) | |||
| int caca_get_font_width(caca_font_t const *f) | |||
| { | |||
| return f->header.width; | |||
| } | |||
| @@ -335,10 +335,10 @@ int cucul_get_font_width(cucul_font_t const *f) | |||
| * | |||
| * This function never fails. | |||
| * | |||
| * \param f The font, as returned by cucul_load_font() | |||
| * \param f The font, as returned by caca_load_font() | |||
| * \return The standard glyph height. | |||
| */ | |||
| int cucul_get_font_height(cucul_font_t const *f) | |||
| int caca_get_font_height(caca_font_t const *f) | |||
| { | |||
| return f->header.height; | |||
| } | |||
| @@ -360,27 +360,27 @@ int cucul_get_font_height(cucul_font_t const *f) | |||
| * | |||
| * This function never fails. | |||
| * | |||
| * \param f The font, as returned by cucul_load_font() | |||
| * \param f The font, as returned by caca_load_font() | |||
| * \return The list of Unicode blocks supported by the font. | |||
| */ | |||
| uint32_t const *cucul_get_font_blocks(cucul_font_t const *f) | |||
| uint32_t const *caca_get_font_blocks(caca_font_t const *f) | |||
| { | |||
| return (uint32_t const *)f->user_block_list; | |||
| } | |||
| /** \brief Free a font structure. | |||
| * | |||
| * This function frees all data allocated by cucul_load_font(). The | |||
| * font structure is no longer usable by other libcucul functions. Once | |||
| * This function frees all data allocated by caca_load_font(). The | |||
| * font structure is no longer usable by other libcaca functions. Once | |||
| * this function has returned, the memory area that was given to | |||
| * cucul_load_font() can be freed. | |||
| * caca_load_font() can be freed. | |||
| * | |||
| * This function never fails. | |||
| * | |||
| * \param f The font, as returned by cucul_load_font() | |||
| * \param f The font, as returned by caca_load_font() | |||
| * \return This function always returns 0. | |||
| */ | |||
| int cucul_free_font(cucul_font_t *f) | |||
| int caca_free_font(caca_font_t *f) | |||
| { | |||
| free(f->glyph_list); | |||
| free(f->user_block_list); | |||
| @@ -396,9 +396,9 @@ int cucul_free_font(cucul_font_t *f) | |||
| * font. The pixel format is fixed (32-bit ARGB, 8 bits for each component). | |||
| * | |||
| * The required image width can be computed using | |||
| * cucul_get_canvas_width() and cucul_get_font_width(). The required | |||
| * height can be computed using cucul_get_canvas_height() and | |||
| * cucul_get_font_height(). | |||
| * caca_get_canvas_width() and caca_get_font_width(). The required | |||
| * height can be computed using caca_get_canvas_height() and | |||
| * caca_get_font_height(). | |||
| * | |||
| * Glyphs that do not fit in the image buffer are currently not rendered at | |||
| * all. They may be cropped instead in future versions. | |||
| @@ -407,14 +407,14 @@ int cucul_free_font(cucul_font_t *f) | |||
| * - \c EINVAL Specified width, height or pitch is invalid. | |||
| * | |||
| * \param cv The canvas to render | |||
| * \param f The font, as returned by cucul_load_font() | |||
| * \param f The font, as returned by caca_load_font() | |||
| * \param buf The image buffer | |||
| * \param width The width (in pixels) of the image buffer | |||
| * \param height The height (in pixels) of the image buffer | |||
| * \param pitch The pitch (in bytes) of an image buffer line. | |||
| * \return 0 in case of success, -1 if an error occurred. | |||
| */ | |||
| int cucul_render_canvas(cucul_canvas_t const *cv, cucul_font_t const *f, | |||
| int caca_render_canvas(caca_canvas_t const *cv, caca_font_t const *f, | |||
| void *buf, int width, int height, int pitch) | |||
| { | |||
| uint8_t *glyph = NULL; | |||
| @@ -471,7 +471,7 @@ int cucul_render_canvas(cucul_canvas_t const *cv, cucul_font_t const *f, | |||
| g = &f->glyph_list[f->block_list[b].index | |||
| + ch - f->block_list[b].start]; | |||
| cucul_attr_to_argb64(attr, argb); | |||
| caca_attr_to_argb64(attr, argb); | |||
| /* Step 1: unpack glyph */ | |||
| switch(f->header.bpp) | |||
| @@ -1,5 +1,5 @@ | |||
| /* | |||
| * libcucul Canvas for ultrafast compositing of Unicode letters | |||
| * libcaca Colour ASCII-Art library | |||
| * Copyright (c) 2002-2006 Sam Hocevar <sam@zoy.org> | |||
| * All Rights Reserved | |||
| * | |||
| @@ -24,8 +24,8 @@ | |||
| # include <string.h> | |||
| #endif | |||
| #include "cucul.h" | |||
| #include "cucul_internals.h" | |||
| #include "caca.h" | |||
| #include "caca_internals.h" | |||
| /** \brief Get the number of frames in a canvas. | |||
| * | |||
| @@ -33,10 +33,10 @@ | |||
| * | |||
| * This function never fails. | |||
| * | |||
| * \param cv A libcucul canvas | |||
| * \param cv A libcaca canvas | |||
| * \return The frame count | |||
| */ | |||
| int cucul_get_frame_count(cucul_canvas_t const *cv) | |||
| int caca_get_frame_count(caca_canvas_t const *cv) | |||
| { | |||
| return cv->framecount; | |||
| } | |||
| @@ -45,18 +45,18 @@ int cucul_get_frame_count(cucul_canvas_t const *cv) | |||
| * | |||
| * Set the active canvas frame. All subsequent drawing operations will | |||
| * be performed on that frame. The current painting context set by | |||
| * cucul_set_attr() is inherited. | |||
| * caca_set_attr() is inherited. | |||
| * | |||
| * If the frame index is outside the canvas' frame range, nothing happens. | |||
| * | |||
| * If an error occurs, -1 is returned and \b errno is set accordingly: | |||
| * - \c EINVAL Requested frame is out of range. | |||
| * | |||
| * \param cv A libcucul canvas | |||
| * \param cv A libcaca canvas | |||
| * \param id The canvas frame to activate | |||
| * \return 0 in case of success, -1 if an error occurred. | |||
| */ | |||
| int cucul_set_frame(cucul_canvas_t *cv, int id) | |||
| int caca_set_frame(caca_canvas_t *cv, int id) | |||
| { | |||
| if(id < 0 || id >= cv->framecount) | |||
| { | |||
| @@ -64,9 +64,9 @@ int cucul_set_frame(cucul_canvas_t *cv, int id) | |||
| return -1; | |||
| } | |||
| _cucul_save_frame_info(cv); | |||
| _caca_save_frame_info(cv); | |||
| cv->frame = id; | |||
| _cucul_load_frame_info(cv); | |||
| _caca_load_frame_info(cv); | |||
| return 0; | |||
| } | |||
| @@ -74,15 +74,15 @@ int cucul_set_frame(cucul_canvas_t *cv, int id) | |||
| /** \brief Get the current frame's name. | |||
| * | |||
| * Return the current frame's name. The returned string is valid until | |||
| * the frame is deleted or cucul_set_frame_name() is called to change | |||
| * the frame is deleted or caca_set_frame_name() is called to change | |||
| * the frame name again. | |||
| * | |||
| * This function never fails. | |||
| * | |||
| * \param cv A libcucul canvas. | |||
| * \param cv A libcaca canvas. | |||
| * \return The current frame's name. | |||
| */ | |||
| char const *cucul_get_frame_name(cucul_canvas_t const *cv) | |||
| char const *caca_get_frame_name(caca_canvas_t const *cv) | |||
| { | |||
| return cv->frames[cv->frame].name; | |||
| } | |||
| @@ -96,11 +96,11 @@ char const *cucul_get_frame_name(cucul_canvas_t const *cv) | |||
| * If an error occurs, -1 is returned and \b errno is set accordingly: | |||
| * - \c ENOMEM Not enough memory to allocate new frame. | |||
| * | |||
| * \param cv A libcucul canvas. | |||
| * \param cv A libcaca canvas. | |||
| * \param name The name to give to the current frame. | |||
| * \return 0 in case of success, -1 if an error occurred. | |||
| */ | |||
| int cucul_set_frame_name(cucul_canvas_t *cv, char const *name) | |||
| int caca_set_frame_name(caca_canvas_t *cv, char const *name) | |||
| { | |||
| char *newname = strdup(name); | |||
| @@ -133,11 +133,11 @@ int cucul_set_frame_name(cucul_canvas_t *cv, char const *name) | |||
| * If an error occurs, -1 is returned and \b errno is set accordingly: | |||
| * - \c ENOMEM Not enough memory to allocate new frame. | |||
| * | |||
| * \param cv A libcucul canvas | |||
| * \param cv A libcaca canvas | |||
| * \param id The index where to insert the new frame | |||
| * \return 0 in case of success, -1 if an error occurred. | |||
| */ | |||
| int cucul_create_frame(cucul_canvas_t *cv, int id) | |||
| int caca_create_frame(caca_canvas_t *cv, int id) | |||
| { | |||
| int size = cv->width * cv->height; | |||
| int f; | |||
| @@ -149,7 +149,7 @@ int cucul_create_frame(cucul_canvas_t *cv, int id) | |||
| cv->framecount++; | |||
| cv->frames = realloc(cv->frames, | |||
| sizeof(struct cucul_frame) * cv->framecount); | |||
| sizeof(struct caca_frame) * cv->framecount); | |||
| for(f = cv->framecount - 1; f > id; f--) | |||
| cv->frames[f] = cv->frames[f - 1]; | |||
| @@ -193,11 +193,11 @@ int cucul_create_frame(cucul_canvas_t *cv, int id) | |||
| * - \c EINVAL Requested frame is out of range, or attempt to delete the | |||
| * last frame of the canvas. | |||
| * | |||
| * \param cv A libcucul canvas | |||
| * \param cv A libcaca canvas | |||
| * \param id The index of the frame to delete | |||
| * \return 0 in case of success, -1 if an error occurred. | |||
| */ | |||
| int cucul_free_frame(cucul_canvas_t *cv, int id) | |||
| int caca_free_frame(caca_canvas_t *cv, int id) | |||
| { | |||
| int f; | |||
| @@ -222,14 +222,14 @@ int cucul_free_frame(cucul_canvas_t *cv, int id) | |||
| cv->framecount--; | |||
| cv->frames = realloc(cv->frames, | |||
| sizeof(struct cucul_frame) * cv->framecount); | |||
| sizeof(struct caca_frame) * cv->framecount); | |||
| if(cv->frame > id) | |||
| cv->frame--; | |||
| else if(cv->frame == id) | |||
| { | |||
| cv->frame = 0; | |||
| _cucul_load_frame_info(cv); | |||
| _caca_load_frame_info(cv); | |||
| } | |||
| return 0; | |||
| @@ -239,7 +239,7 @@ int cucul_free_frame(cucul_canvas_t *cv, int id) | |||
| * XXX: the following functions are local. | |||
| */ | |||
| void _cucul_save_frame_info(cucul_canvas_t *cv) | |||
| void _caca_save_frame_info(caca_canvas_t *cv) | |||
| { | |||
| cv->frames[cv->frame].width = cv->width; | |||
| cv->frames[cv->frame].height = cv->height; | |||
| @@ -247,7 +247,7 @@ void _cucul_save_frame_info(cucul_canvas_t *cv) | |||
| cv->frames[cv->frame].curattr = cv->curattr; | |||
| } | |||
| void _cucul_load_frame_info(cucul_canvas_t *cv) | |||
| void _caca_load_frame_info(caca_canvas_t *cv) | |||
| { | |||
| cv->width = cv->frames[cv->frame].width; | |||
| cv->height = cv->frames[cv->frame].height; | |||
| @@ -24,7 +24,6 @@ | |||
| # include <string.h> | |||
| #endif | |||
| #include "cucul.h" | |||
| #include "caca.h" | |||
| #include "caca_internals.h" | |||
| @@ -241,12 +240,12 @@ void _caca_handle_resize(caca_display_t *dp) | |||
| { | |||
| dp->drv.handle_resize(dp); | |||
| /* Tell libcucul we changed size */ | |||
| if(dp->resize.w != cucul_get_canvas_width(dp->cv) | |||
| || dp->resize.h != cucul_get_canvas_height(dp->cv)) | |||
| /* Tell libcaca we changed size */ | |||
| if(dp->resize.w != caca_get_canvas_width(dp->cv) | |||
| || dp->resize.h != caca_get_canvas_height(dp->cv)) | |||
| { | |||
| dp->resize.allow = 1; | |||
| cucul_set_canvas_size(dp->cv, dp->resize.w, dp->resize.h); | |||
| caca_set_canvas_size(dp->cv, dp->resize.w, dp->resize.h); | |||
| dp->resize.allow = 0; | |||
| } | |||
| } | |||
| @@ -1,5 +1,5 @@ | |||
| /* | |||
| * libcucul Canvas for ultrafast compositing of Unicode letters | |||
| * libcaca Colour ASCII-Art library | |||
| * Copyright (c) 2002-2006 Sam Hocevar <sam@zoy.org> | |||
| * All Rights Reserved | |||
| * | |||
| @@ -23,8 +23,8 @@ | |||
| # include <string.h> | |||
| #endif | |||
| #include "cucul.h" | |||
| #include "cucul_internals.h" | |||
| #include "caca.h" | |||
| #include "caca_internals.h" | |||
| static inline uint32_t sscanu32(void const *s) | |||
| { | |||
| @@ -51,16 +51,16 @@ struct import | |||
| uint8_t faint, strike, proportional; /* unsupported */ | |||
| }; | |||
| static ssize_t import_caca(cucul_canvas_t *, void const *, size_t); | |||
| static ssize_t import_text(cucul_canvas_t *, void const *, size_t); | |||
| static ssize_t import_ansi(cucul_canvas_t *, void const *, size_t, int); | |||
| static ssize_t import_caca(caca_canvas_t *, void const *, size_t); | |||
| static ssize_t import_text(caca_canvas_t *, void const *, size_t); | |||
| static ssize_t import_ansi(caca_canvas_t *, void const *, size_t, int); | |||
| static void ansi_parse_grcm(cucul_canvas_t *, struct import *, | |||
| static void ansi_parse_grcm(caca_canvas_t *, struct import *, | |||
| unsigned int, unsigned int const *); | |||
| /** \brief Import a memory buffer into a canvas | |||
| * | |||
| * Import a memory buffer into the given libcucul canvas's current | |||
| * Import a memory buffer into the given libcaca canvas's current | |||
| * frame. The current frame is resized accordingly and its contents are | |||
| * replaced with the imported data. | |||
| * | |||
| @@ -78,14 +78,14 @@ static void ansi_parse_grcm(cucul_canvas_t *, struct import *, | |||
| * - \c ENOMEM Not enough memory to allocate canvas. | |||
| * - \c EINVAL Invalid format requested. | |||
| * | |||
| * \param cv A libcucul canvas in which to import the file. | |||
| * \param cv A libcaca canvas in which to import the file. | |||
| * \param data A memory area containing the data to be loaded into the canvas. | |||
| * \param len The size in bytes of the memory area. | |||
| * \param format A string describing the input format. | |||
| * \return The number of bytes read, or 0 if there was not enough data, | |||
| * or -1 if an error occurred. | |||
| */ | |||
| ssize_t cucul_import_memory(cucul_canvas_t *cv, void const *data, | |||
| ssize_t caca_import_memory(caca_canvas_t *cv, void const *data, | |||
| size_t len, char const *format) | |||
| { | |||
| if(!strcasecmp("caca", format)) | |||
| @@ -123,7 +123,7 @@ ssize_t cucul_import_memory(cucul_canvas_t *cv, void const *data, | |||
| /** \brief Import a file into a canvas | |||
| * | |||
| * Import a file into the given libcucul canvas's current frame. The | |||
| * Import a file into the given libcaca canvas's current frame. The | |||
| * current frame is resized accordingly and its contents are replaced | |||
| * with the imported data. | |||
| * | |||
| @@ -141,48 +141,48 @@ ssize_t cucul_import_memory(cucul_canvas_t *cv, void const *data, | |||
| * - \c ENOSYS File access is not implemented on this system. | |||
| * - \c ENOMEM Not enough memory to allocate canvas. | |||
| * - \c EINVAL Invalid format requested. | |||
| * cucul_import_file() may also fail and set \b errno for any of the | |||
| * caca_import_file() may also fail and set \b errno for any of the | |||
| * errors specified for the routine fopen(). | |||
| * | |||
| * \param cv A libcucul canvas in which to import the file. | |||
| * \param cv A libcaca canvas in which to import the file. | |||
| * \param filename The name of the file to load. | |||
| * \param format A string describing the input format. | |||
| * \return The number of bytes read, or 0 if there was not enough data, | |||
| * or -1 if an error occurred. | |||
| */ | |||
| ssize_t cucul_import_file(cucul_canvas_t *cv, char const *filename, | |||
| ssize_t caca_import_file(caca_canvas_t *cv, char const *filename, | |||
| char const *format) | |||
| { | |||
| #if defined __KERNEL__ | |||
| seterrno(ENOSYS); | |||
| return -1; | |||
| #else | |||
| cucul_file_t *f; | |||
| caca_file_t *f; | |||
| char *data = NULL; | |||
| ssize_t size = 0; | |||
| int ret; | |||
| f = cucul_file_open(filename, "rb"); | |||
| f = caca_file_open(filename, "rb"); | |||
| if(!f) | |||
| return -1; /* fopen already set errno */ | |||
| while(!cucul_file_eof(f)) | |||
| while(!caca_file_eof(f)) | |||
| { | |||
| data = realloc(data, size + 1024); | |||
| if(!data) | |||
| { | |||
| cucul_file_close(f); | |||
| caca_file_close(f); | |||
| seterrno(ENOMEM); | |||
| return -1; | |||
| } | |||
| ret = cucul_file_read(f, data + size, 1024); | |||
| ret = caca_file_read(f, data + size, 1024); | |||
| if(ret >= 0) | |||
| size += ret; | |||
| } | |||
| cucul_file_close(f); | |||
| caca_file_close(f); | |||
| ret = cucul_import_memory(cv, data, size, format); | |||
| ret = caca_import_memory(cv, data, size, format); | |||
| free(data); | |||
| return ret; | |||
| @@ -193,14 +193,14 @@ ssize_t cucul_import_file(cucul_canvas_t *cv, char const *filename, | |||
| * | |||
| * Return a list of available import formats. The list is a NULL-terminated | |||
| * array of strings, interleaving a string containing the internal value for | |||
| * the import format, to be used with cucul_import_canvas(), and a string | |||
| * the import format, to be used with caca_import_canvas(), and a string | |||
| * containing the natural language description for that import format. | |||
| * | |||
| * This function never fails. | |||
| * | |||
| * \return An array of strings. | |||
| */ | |||
| char const * const * cucul_get_import_list(void) | |||
| char const * const * caca_get_import_list(void) | |||
| { | |||
| static char const * const list[] = | |||
| { | |||
| @@ -219,7 +219,7 @@ char const * const * cucul_get_import_list(void) | |||
| * XXX: the following functions are local. | |||
| */ | |||
| static ssize_t import_caca(cucul_canvas_t *cv, void const *data, size_t size) | |||
| static ssize_t import_caca(caca_canvas_t *cv, void const *data, size_t size) | |||
| { | |||
| uint8_t const *buf = (uint8_t const *)data; | |||
| size_t control_size, data_size, expected_size; | |||
| @@ -284,12 +284,12 @@ static ssize_t import_caca(cucul_canvas_t *cv, void const *data, size_t size) | |||
| goto invalid_caca; | |||
| } | |||
| cucul_set_canvas_size(cv, 0, 0); | |||
| cucul_set_canvas_size(cv, xmax - xmin, ymax - ymin); | |||
| caca_set_canvas_size(cv, 0, 0); | |||
| caca_set_canvas_size(cv, xmax - xmin, ymax - ymin); | |||
| for (f = cucul_get_frame_count(cv); f--; ) | |||
| for (f = caca_get_frame_count(cv); f--; ) | |||
| { | |||
| cucul_free_frame(cv, f); | |||
| caca_free_frame(cv, f); | |||
| } | |||
| for (offset = 0, f = 0; f < frames; f ++) | |||
| @@ -298,8 +298,8 @@ static ssize_t import_caca(cucul_canvas_t *cv, void const *data, size_t size) | |||
| width = sscanu32(buf + 4 + 16 + f * 32); | |||
| height = sscanu32(buf + 4 + 16 + f * 32 + 4); | |||
| cucul_create_frame(cv, f); | |||
| cucul_set_frame(cv, f); | |||
| caca_create_frame(cv, f); | |||
| caca_set_frame(cv, f); | |||
| cv->curattr = sscanu32(buf + 4 + 16 + f * 32 + 12); | |||
| cv->frames[f].x = (int32_t)sscanu32(buf + 4 + 16 + f * 32 + 16); | |||
| @@ -314,9 +314,9 @@ static ssize_t import_caca(cucul_canvas_t *cv, void const *data, size_t size) | |||
| int x = (n % width) - cv->frames[f].handlex - xmin; | |||
| int y = (n / width) - cv->frames[f].handley - ymin; | |||
| cucul_put_char(cv, x, y, sscanu32(buf + 4 + control_size | |||
| caca_put_char(cv, x, y, sscanu32(buf + 4 + control_size | |||
| + offset + 8 * n)); | |||
| cucul_put_attr(cv, x, y, sscanu32(buf + 4 + control_size | |||
| caca_put_attr(cv, x, y, sscanu32(buf + 4 + control_size | |||
| + offset + 8 * n + 4)); | |||
| } | |||
| offset += width * height * 8; | |||
| @@ -327,7 +327,7 @@ static ssize_t import_caca(cucul_canvas_t *cv, void const *data, size_t size) | |||
| cv->frames[f].handley = -ymin; | |||
| } | |||
| cucul_set_frame(cv, 0); | |||
| caca_set_frame(cv, 0); | |||
| return 4 + control_size + data_size; | |||
| @@ -336,12 +336,12 @@ invalid_caca: | |||
| return -1; | |||
| } | |||
| static ssize_t import_text(cucul_canvas_t *cv, void const *data, size_t size) | |||
| static ssize_t import_text(caca_canvas_t *cv, void const *data, size_t size) | |||
| { | |||
| char const *text = (char const *)data; | |||
| unsigned int width = 0, height = 0, x = 0, y = 0, i; | |||
| cucul_set_canvas_size(cv, width, height); | |||
| caca_set_canvas_size(cv, width, height); | |||
| for(i = 0; i < size; i++) | |||
| { | |||
| @@ -365,20 +365,20 @@ static ssize_t import_text(cucul_canvas_t *cv, void const *data, size_t size) | |||
| if(y >= height) | |||
| height = y + 1; | |||
| cucul_set_canvas_size(cv, width, height); | |||
| caca_set_canvas_size(cv, width, height); | |||
| } | |||
| cucul_put_char(cv, x, y, ch); | |||
| caca_put_char(cv, x, y, ch); | |||
| x++; | |||
| } | |||
| if(y > height) | |||
| cucul_set_canvas_size(cv, width, height = y); | |||
| caca_set_canvas_size(cv, width, height = y); | |||
| return size; | |||
| } | |||
| static ssize_t import_ansi(cucul_canvas_t *cv, void const *data, | |||
| static ssize_t import_ansi(caca_canvas_t *cv, void const *data, | |||
| size_t size, int utf8) | |||
| { | |||
| struct import im; | |||
| @@ -399,24 +399,24 @@ static ssize_t import_ansi(cucul_canvas_t *cv, void const *data, | |||
| } | |||
| else | |||
| { | |||
| cucul_set_canvas_size(cv, width = 80, height = 0); | |||
| caca_set_canvas_size(cv, width = 80, height = 0); | |||
| growx = 0; | |||
| growy = 1; | |||
| } | |||
| if(utf8) | |||
| { | |||
| im.dfg = CUCUL_DEFAULT; | |||
| im.dbg = CUCUL_TRANSPARENT; | |||
| im.dfg = CACA_DEFAULT; | |||
| im.dbg = CACA_TRANSPARENT; | |||
| } | |||
| else | |||
| { | |||
| im.dfg = CUCUL_LIGHTGRAY; | |||
| im.dbg = CUCUL_BLACK; | |||
| im.dfg = CACA_LIGHTGRAY; | |||
| im.dbg = CACA_BLACK; | |||
| } | |||
| cucul_set_color_ansi(cv, im.dfg, im.dbg); | |||
| im.clearattr = cucul_get_attr(cv, -1, -1); | |||
| caca_set_color_ansi(cv, im.dfg, im.dbg); | |||
| im.clearattr = caca_get_attr(cv, -1, -1); | |||
| ansi_parse_grcm(cv, &im, 1, &dummy); | |||
| @@ -554,31 +554,31 @@ static ssize_t import_ansi(cucul_canvas_t *cv, void const *data, | |||
| x = (argc && argv[0] > 0) ? argv[0] - 1 : 0; | |||
| break; | |||
| case 'J': /* ED (0x4a) - Erase In Page */ | |||
| savedattr = cucul_get_attr(cv, -1, -1); | |||
| cucul_set_attr(cv, im.clearattr); | |||
| savedattr = caca_get_attr(cv, -1, -1); | |||
| caca_set_attr(cv, im.clearattr); | |||
| if(!argc || argv[0] == 0) | |||
| { | |||
| cucul_draw_line(cv, x, y, width, y, ' '); | |||
| cucul_fill_box(cv, 0, y + 1, width - 1, height - 1, ' '); | |||
| caca_draw_line(cv, x, y, width, y, ' '); | |||
| caca_fill_box(cv, 0, y + 1, width - 1, height - 1, ' '); | |||
| } | |||
| else if(argv[0] == 1) | |||
| { | |||
| cucul_fill_box(cv, 0, 0, width - 1, y - 1, ' '); | |||
| cucul_draw_line(cv, 0, y, x, y, ' '); | |||
| caca_fill_box(cv, 0, 0, width - 1, y - 1, ' '); | |||
| caca_draw_line(cv, 0, y, x, y, ' '); | |||
| } | |||
| else if(argv[0] == 2) | |||
| //x = y = 0; | |||
| cucul_fill_box(cv, 0, 0, width - 1, height - 1, ' '); | |||
| cucul_set_attr(cv, savedattr); | |||
| caca_fill_box(cv, 0, 0, width - 1, height - 1, ' '); | |||
| caca_set_attr(cv, savedattr); | |||
| break; | |||
| case 'K': /* EL (0x4b) - Erase In Line */ | |||
| if(!argc || argv[0] == 0) | |||
| cucul_draw_line(cv, x, y, width, y, ' '); | |||
| caca_draw_line(cv, x, y, width, y, ' '); | |||
| else if(argv[0] == 1) | |||
| cucul_draw_line(cv, 0, y, x, y, ' '); | |||
| caca_draw_line(cv, 0, y, x, y, ' '); | |||
| else if(argv[0] == 2) | |||
| if((unsigned int)x < width) | |||
| cucul_draw_line(cv, x, y, width - 1, y, ' '); | |||
| caca_draw_line(cv, x, y, width - 1, y, ' '); | |||
| //x = width; | |||
| break; | |||
| case 'P': /* DCH (0x50) - Delete Character */ | |||
| @@ -586,25 +586,25 @@ static ssize_t import_ansi(cucul_canvas_t *cv, void const *data, | |||
| argv[0] = 1; /* echo -ne 'foobar\r\e[0P\n' */ | |||
| for(j = 0; (unsigned int)(j + argv[0]) < width; j++) | |||
| { | |||
| cucul_put_char(cv, j, y, | |||
| cucul_get_char(cv, j + argv[0], y)); | |||
| cucul_put_attr(cv, j, y, | |||
| cucul_get_attr(cv, j + argv[0], y)); | |||
| caca_put_char(cv, j, y, | |||
| caca_get_char(cv, j + argv[0], y)); | |||
| caca_put_attr(cv, j, y, | |||
| caca_get_attr(cv, j + argv[0], y)); | |||
| } | |||
| #if 0 | |||
| savedattr = cucul_get_attr(cv, -1, -1); | |||
| cucul_set_attr(cv, im.clearattr); | |||
| savedattr = caca_get_attr(cv, -1, -1); | |||
| caca_set_attr(cv, im.clearattr); | |||
| for( ; (unsigned int)j < width; j++) | |||
| cucul_put_char(cv, j, y, ' '); | |||
| cucul_set_attr(cv, savedattr); | |||
| caca_put_char(cv, j, y, ' '); | |||
| caca_set_attr(cv, savedattr); | |||
| #endif | |||
| case 'X': /* ECH (0x58) - Erase Character */ | |||
| if(argc && argv[0]) | |||
| { | |||
| savedattr = cucul_get_attr(cv, -1, -1); | |||
| cucul_set_attr(cv, im.clearattr); | |||
| cucul_draw_line(cv, x, y, x + argv[0] - 1, y, ' '); | |||
| cucul_set_attr(cv, savedattr); | |||
| savedattr = caca_get_attr(cv, -1, -1); | |||
| caca_set_attr(cv, im.clearattr); | |||
| caca_draw_line(cv, x, y, x + argv[0] - 1, y, ' '); | |||
| caca_set_attr(cv, savedattr); | |||
| } | |||
| case 'd': /* VPA (0x64) - Line Position Absolute */ | |||
| y = (argc && argv[0] > 0) ? argv[0] - 1 : 0; | |||
| @@ -683,14 +683,14 @@ static ssize_t import_ansi(cucul_canvas_t *cv, void const *data, | |||
| size_t bytes; | |||
| if(i + 6 < size) | |||
| ch = cucul_utf8_to_utf32((char const *)(buffer + i), &bytes); | |||
| ch = caca_utf8_to_utf32((char const *)(buffer + i), &bytes); | |||
| else | |||
| { | |||
| /* Add a trailing zero to what we're going to read */ | |||
| char tmp[7]; | |||
| memcpy(tmp, buffer + i, size - i); | |||
| tmp[size - i] = '\0'; | |||
| ch = cucul_utf8_to_utf32(tmp, &bytes); | |||
| ch = caca_utf8_to_utf32(tmp, &bytes); | |||
| } | |||
| if(!bytes) | |||
| @@ -699,12 +699,12 @@ static ssize_t import_ansi(cucul_canvas_t *cv, void const *data, | |||
| ch = buffer[i]; | |||
| bytes = 1; | |||
| } | |||
| wch = cucul_utf32_is_fullwidth(ch) ? 2 : 1; | |||
| wch = caca_utf32_is_fullwidth(ch) ? 2 : 1; | |||
| skip += bytes - 1; | |||
| } | |||
| else | |||
| { | |||
| ch = cucul_cp437_to_utf32(buffer[i]); | |||
| ch = caca_cp437_to_utf32(buffer[i]); | |||
| wch = 1; | |||
| } | |||
| @@ -713,10 +713,10 @@ static ssize_t import_ansi(cucul_canvas_t *cv, void const *data, | |||
| { | |||
| if(growx) | |||
| { | |||
| savedattr = cucul_get_attr(cv, -1, -1); | |||
| cucul_set_attr(cv, im.clearattr); | |||
| cucul_set_canvas_size(cv, width = x + wch, height); | |||
| cucul_set_attr(cv, savedattr); | |||
| savedattr = caca_get_attr(cv, -1, -1); | |||
| caca_set_attr(cv, im.clearattr); | |||
| caca_set_canvas_size(cv, width = x + wch, height); | |||
| caca_set_attr(cv, savedattr); | |||
| } | |||
| else | |||
| { | |||
| @@ -728,11 +728,11 @@ static ssize_t import_ansi(cucul_canvas_t *cv, void const *data, | |||
| /* Scroll or grow vertically */ | |||
| if((unsigned int)y >= height) | |||
| { | |||
| savedattr = cucul_get_attr(cv, -1, -1); | |||
| cucul_set_attr(cv, im.clearattr); | |||
| savedattr = caca_get_attr(cv, -1, -1); | |||
| caca_set_attr(cv, im.clearattr); | |||
| if(growy) | |||
| { | |||
| cucul_set_canvas_size(cv, width, height = y + 1); | |||
| caca_set_canvas_size(cv, width, height = y + 1); | |||
| } | |||
| else | |||
| { | |||
| @@ -745,63 +745,63 @@ static ssize_t import_ansi(cucul_canvas_t *cv, void const *data, | |||
| memcpy(cv->chars + j * cv->width, | |||
| cv->chars + (j + lines) * cv->width, cv->width * 4); | |||
| } | |||
| cucul_fill_box(cv, 0, height - lines, | |||
| caca_fill_box(cv, 0, height - lines, | |||
| cv->width - 1, height - 1, ' '); | |||
| y -= lines; | |||
| } | |||
| cucul_set_attr(cv, savedattr); | |||
| caca_set_attr(cv, savedattr); | |||
| } | |||
| /* Now paste our character, if any */ | |||
| if(wch) | |||
| { | |||
| cucul_put_char(cv, x, y, ch); | |||
| caca_put_char(cv, x, y, ch); | |||
| x += wch; | |||
| } | |||
| } | |||
| if(growy && (unsigned int)y > height) | |||
| { | |||
| savedattr = cucul_get_attr(cv, -1, -1); | |||
| cucul_set_attr(cv, im.clearattr); | |||
| cucul_set_canvas_size(cv, width, height = y); | |||
| cucul_set_attr(cv, savedattr); | |||
| savedattr = caca_get_attr(cv, -1, -1); | |||
| caca_set_attr(cv, im.clearattr); | |||
| caca_set_canvas_size(cv, width, height = y); | |||
| caca_set_attr(cv, savedattr); | |||
| } | |||
| cv->frames[cv->frame].x = x; | |||
| cv->frames[cv->frame].y = y; | |||
| // if(utf8) | |||
| // cucul_set_attr(cv, savedattr); | |||
| // caca_set_attr(cv, savedattr); | |||
| return i; | |||
| } | |||
| /* XXX : ANSI loader helper */ | |||
| static void ansi_parse_grcm(cucul_canvas_t *cv, struct import *im, | |||
| static void ansi_parse_grcm(caca_canvas_t *cv, struct import *im, | |||
| unsigned int argc, unsigned int const *argv) | |||
| { | |||
| static uint8_t const ansi2cucul[] = | |||
| static uint8_t const ansi2caca[] = | |||
| { | |||
| CUCUL_BLACK, CUCUL_RED, CUCUL_GREEN, CUCUL_BROWN, | |||
| CUCUL_BLUE, CUCUL_MAGENTA, CUCUL_CYAN, CUCUL_LIGHTGRAY | |||
| CACA_BLACK, CACA_RED, CACA_GREEN, CACA_BROWN, | |||
| CACA_BLUE, CACA_MAGENTA, CACA_CYAN, CACA_LIGHTGRAY | |||
| }; | |||
| unsigned int j; | |||
| uint8_t efg, ebg; /* Effective (libcucul) fg/bg */ | |||
| uint8_t efg, ebg; /* Effective (libcaca) fg/bg */ | |||
| for(j = 0; j < argc; j++) | |||
| { | |||
| /* Defined in ECMA-48 8.3.117: SGR - SELECT GRAPHIC RENDITION */ | |||
| if(argv[j] >= 30 && argv[j] <= 37) | |||
| im->fg = ansi2cucul[argv[j] - 30]; | |||
| im->fg = ansi2caca[argv[j] - 30]; | |||
| else if(argv[j] >= 40 && argv[j] <= 47) | |||
| im->bg = ansi2cucul[argv[j] - 40]; | |||
| im->bg = ansi2caca[argv[j] - 40]; | |||
| else if(argv[j] >= 90 && argv[j] <= 97) | |||
| im->fg = ansi2cucul[argv[j] - 90] + 8; | |||
| im->fg = ansi2caca[argv[j] - 90] + 8; | |||
| else if(argv[j] >= 100 && argv[j] <= 107) | |||
| im->bg = ansi2cucul[argv[j] - 100] + 8; | |||
| im->bg = ansi2caca[argv[j] - 100] + 8; | |||
| else switch(argv[j]) | |||
| { | |||
| case 0: /* default rendition */ | |||
| @@ -892,7 +892,7 @@ static void ansi_parse_grcm(cucul_canvas_t *cv, struct import *im, | |||
| if(im->concealed) | |||
| { | |||
| efg = ebg = CUCUL_TRANSPARENT; | |||
| efg = ebg = CACA_TRANSPARENT; | |||
| } | |||
| else | |||
| { | |||
| @@ -903,11 +903,11 @@ static void ansi_parse_grcm(cucul_canvas_t *cv, struct import *im, | |||
| { | |||
| if(efg < 8) | |||
| efg += 8; | |||
| else if(efg == CUCUL_DEFAULT) | |||
| efg = CUCUL_WHITE; | |||
| else if(efg == CACA_DEFAULT) | |||
| efg = CACA_WHITE; | |||
| } | |||
| } | |||
| cucul_set_color_ansi(cv, efg, ebg); | |||
| caca_set_color_ansi(cv, efg, ebg); | |||
| } | |||
| @@ -1,5 +1,5 @@ | |||
| /* | |||
| * libcucul Canvas for ultrafast compositing of Unicode letters | |||
| * libcaca Colour ASCII-Art library | |||
| * Copyright (c) 2002-2006 Sam Hocevar <sam@zoy.org> | |||
| * All Rights Reserved | |||
| * | |||
| @@ -25,8 +25,15 @@ | |||
| # include <string.h> | |||
| #endif | |||
| #include "cucul.h" | |||
| #include "cucul_internals.h" | |||
| #include "caca.h" | |||
| #include "caca_internals.h" | |||
| struct cucul_buffer | |||
| { | |||
| size_t size; | |||
| char *data; | |||
| int user_data; | |||
| }; | |||
| /* | |||
| * Functions from canvas.c | |||
| @@ -34,17 +41,17 @@ | |||
| int cucul_putchar(cucul_canvas_t *cv, int x, int y, unsigned long int ch) | |||
| { | |||
| return cucul_put_char(cv, x, y, ch); | |||
| return caca_put_char(cv, x, y, ch); | |||
| } | |||
| unsigned long int cucul_getchar(cucul_canvas_t *cv, int x, int y) | |||
| { | |||
| return cucul_get_char(cv, x, y); | |||
| return caca_get_char(cv, x, y); | |||
| } | |||
| int cucul_putstr(cucul_canvas_t *cv, int x, int y, char const *s) | |||
| { | |||
| return cucul_put_str(cv, x, y, s); | |||
| return caca_put_str(cv, x, y, s); | |||
| } | |||
| /* | |||
| @@ -53,12 +60,12 @@ int cucul_putstr(cucul_canvas_t *cv, int x, int y, char const *s) | |||
| int cucul_set_color(cucul_canvas_t *cv, unsigned char fg, unsigned char bg) | |||
| { | |||
| return cucul_set_color_ansi(cv, fg, bg); | |||
| return caca_set_color_ansi(cv, fg, bg); | |||
| } | |||
| int cucul_set_truecolor(cucul_canvas_t *cv, unsigned int fg, unsigned int bg) | |||
| { | |||
| return cucul_set_color_argb(cv, fg, bg); | |||
| return caca_set_color_argb(cv, fg, bg); | |||
| } | |||
| /* | |||
| @@ -66,22 +73,22 @@ int cucul_set_truecolor(cucul_canvas_t *cv, unsigned int fg, unsigned int bg) | |||
| */ | |||
| int cucul_set_dither_invert(cucul_dither_t *d, int value) | |||
| { | |||
| float gamma = cucul_get_dither_gamma(d); | |||
| float gamma = caca_get_dither_gamma(d); | |||
| if(gamma * (value ? -1 : 1) < 0) | |||
| cucul_set_dither_gamma(d, -gamma); | |||
| caca_set_dither_gamma(d, -gamma); | |||
| return 0; | |||
| } | |||
| int cucul_set_dither_mode(cucul_dither_t *d, char const *s) | |||
| { | |||
| return cucul_set_dither_algorithm(d, s); | |||
| return caca_set_dither_algorithm(d, s); | |||
| } | |||
| char const * const * cucul_get_dither_mode_list(cucul_dither_t const *d) | |||
| { | |||
| return cucul_get_dither_algorithm_list(d); | |||
| return caca_get_dither_algorithm_list(d); | |||
| } | |||
| /* | |||
| @@ -90,12 +97,12 @@ char const * const * cucul_get_dither_mode_list(cucul_dither_t const *d) | |||
| cucul_canvas_t * cucul_import_canvas(cucul_buffer_t *buf, char const *format) | |||
| { | |||
| cucul_canvas_t *cv = cucul_create_canvas(0, 0); | |||
| int ret = cucul_import_memory(cv, (unsigned char const *)buf->data, | |||
| caca_canvas_t *cv = caca_create_canvas(0, 0); | |||
| int ret = caca_import_memory(cv, (unsigned char const *)buf->data, | |||
| buf->size, format); | |||
| if(ret < 0) | |||
| { | |||
| cucul_free_canvas(cv); | |||
| caca_free_canvas(cv); | |||
| return NULL; | |||
| } | |||
| @@ -117,7 +124,7 @@ cucul_buffer_t * cucul_export_canvas(cucul_canvas_t *cv, char const *format) | |||
| return NULL; | |||
| } | |||
| ex->data = cucul_export_memory(cv, format, &ex->size); | |||
| ex->data = caca_export_memory(cv, format, &ex->size); | |||
| if(!ex->data) | |||
| { | |||
| free(ex); | |||
| @@ -135,22 +142,22 @@ cucul_buffer_t * cucul_export_canvas(cucul_canvas_t *cv, char const *format) | |||
| unsigned int cucul_get_canvas_frame_count(cucul_canvas_t *cv) | |||
| { | |||
| return cucul_get_frame_count(cv); | |||
| return caca_get_frame_count(cv); | |||
| } | |||
| int cucul_set_canvas_frame(cucul_canvas_t *cv, unsigned int id) | |||
| { | |||
| return cucul_set_frame(cv, id); | |||
| return caca_set_frame(cv, id); | |||
| } | |||
| int cucul_create_canvas_frame(cucul_canvas_t *cv, unsigned int id) | |||
| { | |||
| return cucul_create_frame(cv, id); | |||
| return caca_create_frame(cv, id); | |||
| } | |||
| int cucul_free_canvas_frame(cucul_canvas_t *cv, unsigned int id) | |||
| { | |||
| return cucul_free_frame(cv, id); | |||
| return caca_free_frame(cv, id); | |||
| } | |||
| /* | |||
| @@ -175,40 +182,40 @@ cucul_buffer_t *cucul_load_memory(void *data, unsigned long int size) | |||
| cucul_buffer_t *cucul_load_file(char const *file) | |||
| { | |||
| cucul_buffer_t *buf; | |||
| cucul_file_t *f; | |||
| caca_file_t *f; | |||
| int ret; | |||
| f = cucul_file_open(file, "rb"); | |||
| f = caca_file_open(file, "rb"); | |||
| if(!f) | |||
| return NULL; | |||
| buf = malloc(sizeof(cucul_buffer_t)); | |||
| if(!buf) | |||
| { | |||
| cucul_file_close(f); | |||
| caca_file_close(f); | |||
| return NULL; | |||
| } | |||
| buf->data = NULL; | |||
| buf->size = 0; | |||
| while(!cucul_file_eof(f)) | |||
| while(!caca_file_eof(f)) | |||
| { | |||
| buf->data = realloc(buf->data, buf->size + 1024); | |||
| if(!buf->data) | |||
| { | |||
| int saved_errno = geterrno(); | |||
| free(buf); | |||
| cucul_file_close(f); | |||
| caca_file_close(f); | |||
| seterrno(saved_errno); | |||
| return NULL; | |||
| } | |||
| ret = cucul_file_read(f, buf->data + buf->size, 1024); | |||
| ret = caca_file_read(f, buf->data + buf->size, 1024); | |||
| if(ret >= 0) | |||
| buf->size += ret; | |||
| } | |||
| cucul_file_close(f); | |||
| caca_file_close(f); | |||
| return buf; | |||
| } | |||
| @@ -239,6 +246,6 @@ int cucul_free_buffer(cucul_buffer_t *buf) | |||
| int cucul_rotate(cucul_canvas_t *cv) | |||
| { | |||
| return cucul_rotate_180(cv); | |||
| return caca_rotate_180(cv); | |||
| } | |||
| @@ -1,5 +1,5 @@ | |||
| /* | |||
| * libcucul Canvas for ultrafast compositing of Unicode letters | |||
| * libcaca Colour ASCII-Art library | |||
| * Copyright (c) 2002-2006 Sam Hocevar <sam@zoy.org> | |||
| * All Rights Reserved | |||
| * | |||
| @@ -23,8 +23,8 @@ | |||
| # include <stdlib.h> | |||
| #endif | |||
| #include "cucul.h" | |||
| #include "cucul_internals.h" | |||
| #include "caca.h" | |||
| #include "caca_internals.h" | |||
| #if !defined(_DOXYGEN_SKIP_ME) | |||
| struct line | |||
| @@ -32,20 +32,20 @@ struct line | |||
| int x1, y1; | |||
| int x2, y2; | |||
| uint32_t ch; | |||
| void (*draw) (cucul_canvas_t *, struct line*); | |||
| void (*draw) (caca_canvas_t *, struct line*); | |||
| }; | |||
| #endif | |||
| static void clip_line(cucul_canvas_t*, struct line*); | |||
| static uint8_t clip_bits(cucul_canvas_t*, int, int); | |||
| static void draw_solid_line(cucul_canvas_t*, struct line*); | |||
| static void draw_thin_line(cucul_canvas_t*, struct line*); | |||
| static void clip_line(caca_canvas_t*, struct line*); | |||
| static uint8_t clip_bits(caca_canvas_t*, int, int); | |||
| static void draw_solid_line(caca_canvas_t*, struct line*); | |||
| static void draw_thin_line(caca_canvas_t*, struct line*); | |||
| /** \brief Draw a line on the canvas using the given character. | |||
| * | |||
| * This function never fails. | |||
| * | |||
| * \param cv The handle to the libcucul canvas. | |||
| * \param cv The handle to the libcaca canvas. | |||
| * \param x1 X coordinate of the first point. | |||
| * \param y1 Y coordinate of the first point. | |||
| * \param x2 X coordinate of the second point. | |||
| @@ -53,7 +53,7 @@ static void draw_thin_line(cucul_canvas_t*, struct line*); | |||
| * \param ch UTF-32 character to be used to draw the line. | |||
| * \return This function always returns 0. | |||
| */ | |||
| int cucul_draw_line(cucul_canvas_t *cv, int x1, int y1, int x2, int y2, | |||
| int caca_draw_line(caca_canvas_t *cv, int x1, int y1, int x2, int y2, | |||
| uint32_t ch) | |||
| { | |||
| struct line s; | |||
| @@ -77,14 +77,14 @@ int cucul_draw_line(cucul_canvas_t *cv, int x1, int y1, int x2, int y2, | |||
| * | |||
| * This function never fails. | |||
| * | |||
| * \param cv The handle to the libcucul canvas. | |||
| * \param cv The handle to the libcaca canvas. | |||
| * \param x Array of X coordinates. Must have \p n + 1 elements. | |||
| * \param y Array of Y coordinates. Must have \p n + 1 elements. | |||
| * \param n Number of lines to draw. | |||
| * \param ch UTF-32 character to be used to draw the lines. | |||
| * \return This function always returns 0. | |||
| */ | |||
| int cucul_draw_polyline(cucul_canvas_t *cv, int const x[], int const y[], | |||
| int caca_draw_polyline(caca_canvas_t *cv, int const x[], int const y[], | |||
| int n, uint32_t ch) | |||
| { | |||
| int i; | |||
| @@ -108,14 +108,14 @@ int cucul_draw_polyline(cucul_canvas_t *cv, int const x[], int const y[], | |||
| * | |||
| * This function never fails. | |||
| * | |||
| * \param cv The handle to the libcucul canvas. | |||
| * \param cv The handle to the libcaca canvas. | |||
| * \param x1 X coordinate of the first point. | |||
| * \param y1 Y coordinate of the first point. | |||
| * \param x2 X coordinate of the second point. | |||
| * \param y2 Y coordinate of the second point. | |||
| * \return This function always returns 0. | |||
| */ | |||
| int cucul_draw_thin_line(cucul_canvas_t *cv, int x1, int y1, int x2, int y2) | |||
| int caca_draw_thin_line(caca_canvas_t *cv, int x1, int y1, int x2, int y2) | |||
| { | |||
| struct line s; | |||
| s.x1 = x1; | |||
| @@ -137,13 +137,13 @@ int cucul_draw_thin_line(cucul_canvas_t *cv, int x1, int y1, int x2, int y2) | |||
| * | |||
| * This function never fails. | |||
| * | |||
| * \param cv The handle to the libcucul canvas. | |||
| * \param cv The handle to the libcaca canvas. | |||
| * \param x Array of X coordinates. Must have \p n + 1 elements. | |||
| * \param y Array of Y coordinates. Must have \p n + 1 elements. | |||
| * \param n Number of lines to draw. | |||
| * \return This function always returns 0. | |||
| */ | |||
| int cucul_draw_thin_polyline(cucul_canvas_t *cv, int const x[], int const y[], | |||
| int caca_draw_thin_polyline(caca_canvas_t *cv, int const x[], int const y[], | |||
| int n) | |||
| { | |||
| int i; | |||
| @@ -167,7 +167,7 @@ int cucul_draw_thin_polyline(cucul_canvas_t *cv, int const x[], int const y[], | |||
| */ | |||
| /* Generic Cohen-Sutherland line clipping function. */ | |||
| static void clip_line(cucul_canvas_t *cv, struct line* s) | |||
| static void clip_line(caca_canvas_t *cv, struct line* s) | |||
| { | |||
| uint8_t bits1, bits2; | |||
| @@ -219,7 +219,7 @@ static void clip_line(cucul_canvas_t *cv, struct line* s) | |||
| } | |||
| /* Helper function for clip_line(). */ | |||
| static uint8_t clip_bits(cucul_canvas_t *cv, int x, int y) | |||
| static uint8_t clip_bits(caca_canvas_t *cv, int x, int y) | |||
| { | |||
| uint8_t b = 0; | |||
| @@ -238,7 +238,7 @@ static uint8_t clip_bits(cucul_canvas_t *cv, int x, int y) | |||
| /* Solid line drawing function, using Bresenham's mid-point line | |||
| * scan-conversion algorithm. */ | |||
| static void draw_solid_line(cucul_canvas_t *cv, struct line* s) | |||
| static void draw_solid_line(caca_canvas_t *cv, struct line* s) | |||
| { | |||
| int x1, y1, x2, y2; | |||
| int dx, dy; | |||
| @@ -260,7 +260,7 @@ static void draw_solid_line(cucul_canvas_t *cv, struct line* s) | |||
| for(; dx>=0; dx--) | |||
| { | |||
| cucul_put_char(cv, x1, y1, s->ch); | |||
| caca_put_char(cv, x1, y1, s->ch); | |||
| if(delta > 0) | |||
| { | |||
| x1 += xinc; | |||
| @@ -282,7 +282,7 @@ static void draw_solid_line(cucul_canvas_t *cv, struct line* s) | |||
| for(; dy >= 0; dy--) | |||
| { | |||
| cucul_put_char(cv, x1, y1, s->ch); | |||
| caca_put_char(cv, x1, y1, s->ch); | |||
| if(delta > 0) | |||
| { | |||
| x1 += xinc; | |||
| @@ -300,7 +300,7 @@ static void draw_solid_line(cucul_canvas_t *cv, struct line* s) | |||
| /* Thin line drawing function, using Bresenham's mid-point line | |||
| * scan-conversion algorithm and ASCII art graphics. */ | |||
| static void draw_thin_line(cucul_canvas_t *cv, struct line* s) | |||
| static void draw_thin_line(caca_canvas_t *cv, struct line* s) | |||
| { | |||
| uint32_t charmapx[2], charmapy[2]; | |||
| int x1, y1, x2, y2; | |||
| @@ -347,7 +347,7 @@ static void draw_thin_line(cucul_canvas_t *cv, struct line* s) | |||
| { | |||
| if(delta > 0) | |||
| { | |||
| cucul_put_char(cv, x1, y1, charmapy[1]); | |||
| caca_put_char(cv, x1, y1, charmapy[1]); | |||
| x1++; | |||
| y1 += yinc; | |||
| delta += dpru; | |||
| @@ -356,9 +356,9 @@ static void draw_thin_line(cucul_canvas_t *cv, struct line* s) | |||
| else | |||
| { | |||
| if(prev) | |||
| cucul_put_char(cv, x1, y1, charmapy[0]); | |||
| caca_put_char(cv, x1, y1, charmapy[0]); | |||
| else | |||
| cucul_put_char(cv, x1, y1, '-'); | |||
| caca_put_char(cv, x1, y1, '-'); | |||
| x1++; | |||
| delta += dpr; | |||
| prev = 0; | |||
| @@ -375,15 +375,15 @@ static void draw_thin_line(cucul_canvas_t *cv, struct line* s) | |||
| { | |||
| if(delta > 0) | |||
| { | |||
| cucul_put_char(cv, x1, y1, charmapx[0]); | |||
| cucul_put_char(cv, x1 + 1, y1, charmapx[1]); | |||
| caca_put_char(cv, x1, y1, charmapx[0]); | |||
| caca_put_char(cv, x1 + 1, y1, charmapx[1]); | |||
| x1++; | |||
| y1 += yinc; | |||
| delta += dpru; | |||
| } | |||
| else | |||
| { | |||
| cucul_put_char(cv, x1, y1, '|'); | |||
| caca_put_char(cv, x1, y1, '|'); | |||
| y1 += yinc; | |||
| delta += dpr; | |||
| } | |||
| @@ -1,4 +1,4 @@ | |||
| /* libcucul font file | |||
| /* libcaca font file | |||
| * "Monospace 9": 96 dpi, 4 bpp, 7x15/14x15 glyphs | |||
| * Automatically generated by tools/makefont.c: | |||
| * tools/makefont mono9 "Monospace 9" 96 4 | |||
| @@ -1,4 +1,4 @@ | |||
| /* libcucul font file | |||
| /* libcaca font file | |||
| * "Monospace Bold 12": 96 dpi, 4 bpp, 10x19/20x19 glyphs | |||
| * Automatically generated by tools/makefont.c: | |||
| * tools/makefont monobold12 "Monospace Bold 12" 96 4 | |||
| @@ -1,5 +1,5 @@ | |||
| /* | |||
| * libcucul Canvas for ultrafast compositing of Unicode letters | |||
| * libcaca Colour ASCII-Art library | |||
| * Copyright (c) 2002-2006 Sam Hocevar <sam@zoy.org> | |||
| * All Rights Reserved | |||
| * | |||
| @@ -35,8 +35,8 @@ | |||
| # endif | |||
| #endif | |||
| #include "cucul.h" | |||
| #include "cucul_internals.h" | |||
| #include "caca.h" | |||
| #include "caca_internals.h" | |||
| /** \brief Set cursor position. | |||
| * | |||
| @@ -46,12 +46,12 @@ | |||
| * | |||
| * This function never fails. | |||
| * | |||
| * \param cv A handle to the libcucul canvas. | |||
| * \param cv A handle to the libcaca canvas. | |||
| * \param x X cursor coordinate. | |||
| * \param y Y cursor coordinate. | |||
| * \return This function always returns 0. | |||
| */ | |||
| int cucul_gotoxy(cucul_canvas_t *cv, int x, int y) | |||
| int caca_gotoxy(caca_canvas_t *cv, int x, int y) | |||
| { | |||
| cv->frames[cv->frame].x = x; | |||
| cv->frames[cv->frame].y = y; | |||
| @@ -65,10 +65,10 @@ int cucul_gotoxy(cucul_canvas_t *cv, int x, int y) | |||
| * | |||
| * This function never fails. | |||
| * | |||
| * \param cv A handle to the libcucul canvas. | |||
| * \param cv A handle to the libcaca canvas. | |||
| * \return The cursor's X coordinate. | |||
| */ | |||
| int cucul_get_cursor_x(cucul_canvas_t const *cv) | |||
| int caca_get_cursor_x(caca_canvas_t const *cv) | |||
| { | |||
| return cv->frames[cv->frame].x; | |||
| } | |||
| @@ -79,10 +79,10 @@ int cucul_get_cursor_x(cucul_canvas_t const *cv) | |||
| * | |||
| * This function never fails. | |||
| * | |||
| * \param cv A handle to the libcucul canvas. | |||
| * \param cv A handle to the libcaca canvas. | |||
| * \return The cursor's Y coordinate. | |||
| */ | |||
| int cucul_get_cursor_y(cucul_canvas_t const *cv) | |||
| int caca_get_cursor_y(caca_canvas_t const *cv) | |||
| { | |||
| return cv->frames[cv->frame].y; | |||
| } | |||
| @@ -99,17 +99,17 @@ int cucul_get_cursor_y(cucul_canvas_t const *cv) | |||
| * | |||
| * The behaviour when printing non-printable characters or invalid UTF-32 | |||
| * characters is undefined. To print a sequence of bytes forming an UTF-8 | |||
| * character instead of an UTF-32 character, use the cucul_put_str() function. | |||
| * character instead of an UTF-32 character, use the caca_put_str() function. | |||
| * | |||
| * This function never fails. | |||
| * | |||
| * \param cv A handle to the libcucul canvas. | |||
| * \param cv A handle to the libcaca canvas. | |||
| * \param x X coordinate. | |||
| * \param y Y coordinate. | |||
| * \param ch The character to print. | |||
| * \return This function always returns 0. | |||
| */ | |||
| int cucul_put_char(cucul_canvas_t *cv, int x, int y, uint32_t ch) | |||
| int caca_put_char(caca_canvas_t *cv, int x, int y, uint32_t ch) | |||
| { | |||
| uint32_t *curchar, *curattr, attr; | |||
| int fullwidth; | |||
| @@ -117,10 +117,10 @@ int cucul_put_char(cucul_canvas_t *cv, int x, int y, uint32_t ch) | |||
| if(x >= (int)cv->width || y < 0 || y >= (int)cv->height) | |||
| return 0; | |||
| if(ch == CUCUL_MAGIC_FULLWIDTH) | |||
| if(ch == CACA_MAGIC_FULLWIDTH) | |||
| return 0; | |||
| fullwidth = cucul_utf32_is_fullwidth(ch); | |||
| fullwidth = caca_utf32_is_fullwidth(ch); | |||
| if(x == -1 && fullwidth) | |||
| { | |||
| @@ -137,7 +137,7 @@ int cucul_put_char(cucul_canvas_t *cv, int x, int y, uint32_t ch) | |||
| /* When overwriting the right part of a fullwidth character, | |||
| * replace its left part with a space. */ | |||
| if(x && curchar[0] == CUCUL_MAGIC_FULLWIDTH) | |||
| if(x && curchar[0] == CACA_MAGIC_FULLWIDTH) | |||
| curchar[-1] = ' '; | |||
| if(fullwidth) | |||
| @@ -148,10 +148,10 @@ int cucul_put_char(cucul_canvas_t *cv, int x, int y, uint32_t ch) | |||
| { | |||
| /* When overwriting the left part of a fullwidth character, | |||
| * replace its right part with a space. */ | |||
| if(x + 2 < (int)cv->width && curchar[2] == CUCUL_MAGIC_FULLWIDTH) | |||
| if(x + 2 < (int)cv->width && curchar[2] == CACA_MAGIC_FULLWIDTH) | |||
| curchar[2] = ' '; | |||
| curchar[1] = CUCUL_MAGIC_FULLWIDTH; | |||
| curchar[1] = CACA_MAGIC_FULLWIDTH; | |||
| curattr[1] = attr; | |||
| } | |||
| } | |||
| @@ -159,7 +159,7 @@ int cucul_put_char(cucul_canvas_t *cv, int x, int y, uint32_t ch) | |||
| { | |||
| /* When overwriting the left part of a fullwidth character, | |||
| * replace its right part with a space. */ | |||
| if(x + 1 != (int)cv->width && curchar[1] == CUCUL_MAGIC_FULLWIDTH) | |||
| if(x + 1 != (int)cv->width && curchar[1] == CACA_MAGIC_FULLWIDTH) | |||
| curchar[1] = ' '; | |||
| } | |||
| @@ -179,19 +179,19 @@ int cucul_put_char(cucul_canvas_t *cv, int x, int y, uint32_t ch) | |||
| * If the coordinates are outside the canvas boundaries, a space (0x20) | |||
| * is returned. | |||
| * | |||
| * A special exception is when CUCUL_MAGIC_FULLWIDTH is returned. This | |||
| * A special exception is when CACA_MAGIC_FULLWIDTH is returned. This | |||
| * value is guaranteed not to be a valid Unicode character, and indicates | |||
| * that the character at the left of the requested one is a fullwidth | |||
| * character. | |||
| * | |||
| * This function never fails. | |||
| * | |||
| * \param cv A handle to the libcucul canvas. | |||
| * \param cv A handle to the libcaca canvas. | |||
| * \param x X coordinate. | |||
| * \param y Y coordinate. | |||
| * \return This function always returns 0. | |||
| */ | |||
| uint32_t cucul_get_char(cucul_canvas_t const *cv, int x, int y) | |||
| uint32_t caca_get_char(caca_canvas_t const *cv, int x, int y) | |||
| { | |||
| if(x < 0 || x >= (int)cv->width || y < 0 || y >= (int)cv->height) | |||
| return ' '; | |||
| @@ -206,18 +206,18 @@ uint32_t cucul_get_char(cucul_canvas_t const *cv, int x, int y) | |||
| * canvas boundaries (eg. a negative Y coordinate) and the string will | |||
| * be cropped accordingly if it is too long. | |||
| * | |||
| * See cucul_put_char() for more information on how fullwidth characters | |||
| * See caca_put_char() for more information on how fullwidth characters | |||
| * are handled when overwriting each other or at the canvas' boundaries. | |||
| * | |||
| * This function never fails. | |||
| * | |||
| * \param cv A handle to the libcucul canvas. | |||
| * \param cv A handle to the libcaca canvas. | |||
| * \param x X coordinate. | |||
| * \param y Y coordinate. | |||
| * \param s The string to print. | |||
| * \return This function always returns 0. | |||
| */ | |||
| int cucul_put_str(cucul_canvas_t *cv, int x, int y, char const *s) | |||
| int caca_put_str(caca_canvas_t *cv, int x, int y, char const *s) | |||
| { | |||
| size_t rd; | |||
| @@ -226,15 +226,15 @@ int cucul_put_str(cucul_canvas_t *cv, int x, int y, char const *s) | |||
| while(*s && x < -1) | |||
| { | |||
| x += cucul_utf32_is_fullwidth(cucul_utf8_to_utf32(s, &rd)) ? 2 : 1; | |||
| x += caca_utf32_is_fullwidth(caca_utf8_to_utf32(s, &rd)) ? 2 : 1; | |||
| s += rd; | |||
| } | |||
| while(*s && x < (int)cv->width) | |||
| { | |||
| uint32_t ch = cucul_utf8_to_utf32(s, &rd); | |||
| cucul_put_char(cv, x, y, ch); | |||
| x += cucul_utf32_is_fullwidth(ch) ? 2 : 1; | |||
| uint32_t ch = caca_utf8_to_utf32(s, &rd); | |||
| caca_put_char(cv, x, y, ch); | |||
| x += caca_utf32_is_fullwidth(ch) ? 2 : 1; | |||
| s += rd; | |||
| } | |||
| @@ -251,14 +251,14 @@ int cucul_put_str(cucul_canvas_t *cv, int x, int y, char const *s) | |||
| * | |||
| * This function never fails. | |||
| * | |||
| * \param cv A handle to the libcucul canvas. | |||
| * \param cv A handle to the libcaca canvas. | |||
| * \param x X coordinate. | |||
| * \param y Y coordinate. | |||
| * \param format The format string to print. | |||
| * \param ... Arguments to the format string. | |||
| * \return This function always returns 0. | |||
| */ | |||
| int cucul_printf(cucul_canvas_t *cv, int x, int y, char const *format, ...) | |||
| int caca_printf(caca_canvas_t *cv, int x, int y, char const *format, ...) | |||
| { | |||
| char tmp[BUFSIZ]; | |||
| char *buf = tmp; | |||
| @@ -279,7 +279,7 @@ int cucul_printf(cucul_canvas_t *cv, int x, int y, char const *format, ...) | |||
| buf[cv->width - x] = '\0'; | |||
| va_end(args); | |||
| cucul_put_str(cv, x, y, buf); | |||
| caca_put_str(cv, x, y, buf); | |||
| if(buf != tmp) | |||
| free(buf); | |||
| @@ -296,7 +296,7 @@ int cucul_printf(cucul_canvas_t *cv, int x, int y, char const *format, ...) | |||
| * \param cv The canvas to clear. | |||
| * \return This function always returns 0. | |||
| */ | |||
| int cucul_clear_canvas(cucul_canvas_t *cv) | |||
| int caca_clear_canvas(caca_canvas_t *cv) | |||
| { | |||
| uint32_t attr = cv->curattr; | |||
| int n; | |||
| @@ -317,12 +317,12 @@ int cucul_clear_canvas(cucul_canvas_t *cv) | |||
| * | |||
| * This function never fails. | |||
| * | |||
| * \param cv A handle to the libcucul canvas. | |||
| * \param cv A handle to the libcaca canvas. | |||
| * \param x X handle coordinate. | |||
| * \param y Y handle coordinate. | |||
| * \return This function always returns 0. | |||
| */ | |||
| int cucul_set_canvas_handle(cucul_canvas_t *cv, int x, int y) | |||
| int caca_set_canvas_handle(caca_canvas_t *cv, int x, int y) | |||
| { | |||
| cv->frames[cv->frame].handlex = x; | |||
| cv->frames[cv->frame].handley = y; | |||
| @@ -336,10 +336,10 @@ int cucul_set_canvas_handle(cucul_canvas_t *cv, int x, int y) | |||
| * | |||
| * This function never fails. | |||
| * | |||
| * \param cv A handle to the libcucul canvas. | |||
| * \param cv A handle to the libcaca canvas. | |||
| * \return The canvas' handle's X coordinate. | |||
| */ | |||
| int cucul_get_canvas_handle_x(cucul_canvas_t const *cv) | |||
| int caca_get_canvas_handle_x(caca_canvas_t const *cv) | |||
| { | |||
| return cv->frames[cv->frame].handlex; | |||
| } | |||
| @@ -350,10 +350,10 @@ int cucul_get_canvas_handle_x(cucul_canvas_t const *cv) | |||
| * | |||
| * This function never fails. | |||
| * | |||
| * \param cv A handle to the libcucul canvas. | |||
| * \param cv A handle to the libcaca canvas. | |||
| * \return The canvas' handle's Y coordinate. | |||
| */ | |||
| int cucul_get_canvas_handle_y(cucul_canvas_t const *cv) | |||
| int caca_get_canvas_handle_y(caca_canvas_t const *cv) | |||
| { | |||
| return cv->frames[cv->frame].handley; | |||
| } | |||
| @@ -374,8 +374,8 @@ int cucul_get_canvas_handle_y(cucul_canvas_t const *cv) | |||
| * \param mask The mask canvas. | |||
| * \return 0 in case of success, -1 if an error occurred. | |||
| */ | |||
| int cucul_blit(cucul_canvas_t *dst, int x, int y, | |||
| cucul_canvas_t const *src, cucul_canvas_t const *mask) | |||
| int caca_blit(caca_canvas_t *dst, int x, int y, | |||
| caca_canvas_t const *src, caca_canvas_t const *mask) | |||
| { | |||
| int i, j, starti, startj, endi, endj; | |||
| @@ -404,11 +404,11 @@ int cucul_blit(cucul_canvas_t *dst, int x, int y, | |||
| int stride = endi - starti; | |||
| /* FIXME: we are ignoring the mask here */ | |||
| if((starti + x) && dst->chars[dstix] == CUCUL_MAGIC_FULLWIDTH) | |||
| if((starti + x) && dst->chars[dstix] == CACA_MAGIC_FULLWIDTH) | |||
| dst->chars[dstix - 1] = ' '; | |||
| if(endi + x < dst->width | |||
| && dst->chars[dstix + stride] == CUCUL_MAGIC_FULLWIDTH) | |||
| && dst->chars[dstix + stride] == CACA_MAGIC_FULLWIDTH) | |||
| dst->chars[dstix + stride] = ' '; | |||
| if(mask) | |||
| @@ -429,10 +429,10 @@ int cucul_blit(cucul_canvas_t *dst, int x, int y, | |||
| } | |||
| /* Fix split fullwidth chars */ | |||
| if(src->chars[srcix] == CUCUL_MAGIC_FULLWIDTH) | |||
| if(src->chars[srcix] == CACA_MAGIC_FULLWIDTH) | |||
| dst->chars[dstix] = ' '; | |||
| if(endi < src->width && src->chars[endi] == CUCUL_MAGIC_FULLWIDTH) | |||
| if(endi < src->width && src->chars[endi] == CACA_MAGIC_FULLWIDTH) | |||
| dst->chars[dstix + stride - 1] = ' '; | |||
| } | |||
| @@ -458,9 +458,9 @@ int cucul_blit(cucul_canvas_t *dst, int x, int y, | |||
| * \param h The height of the cropped area. | |||
| * \return 0 in case of success, -1 if an error occurred. | |||
| */ | |||
| int cucul_set_canvas_boundaries(cucul_canvas_t *cv, int x, int y, int w, int h) | |||
| int caca_set_canvas_boundaries(caca_canvas_t *cv, int x, int y, int w, int h) | |||
| { | |||
| cucul_canvas_t *new; | |||
| caca_canvas_t *new; | |||
| int f, saved_f, framecount; | |||
| if(cv->refcount) | |||
| @@ -475,19 +475,19 @@ int cucul_set_canvas_boundaries(cucul_canvas_t *cv, int x, int y, int w, int h) | |||
| return -1; | |||
| } | |||
| new = cucul_create_canvas(w, h); | |||
| new = caca_create_canvas(w, h); | |||
| framecount = cucul_get_frame_count(cv); | |||
| framecount = caca_get_frame_count(cv); | |||
| saved_f = cv->frame; | |||
| for(f = 0; f < framecount; f++) | |||
| { | |||
| if(f) | |||
| cucul_create_frame(new, framecount); | |||
| caca_create_frame(new, framecount); | |||
| cucul_set_frame(cv, f); | |||
| cucul_set_frame(new, f); | |||
| cucul_blit(new, -x, -y, cv, NULL); | |||
| caca_set_frame(cv, f); | |||
| caca_set_frame(new, f); | |||
| caca_blit(new, -x, -y, cv, NULL); | |||
| free(cv->frames[f].chars); | |||
| free(cv->frames[f].attrs); | |||
| } | |||
| @@ -496,9 +496,9 @@ int cucul_set_canvas_boundaries(cucul_canvas_t *cv, int x, int y, int w, int h) | |||
| cv->frames = new->frames; | |||
| free(new); | |||
| cucul_set_frame(cv, saved_f); | |||
| _cucul_load_frame_info(cv); | |||
| caca_set_frame(cv, saved_f); | |||
| _caca_load_frame_info(cv); | |||
| return 0; | |||
| } | |||
| @@ -1,5 +1,5 @@ | |||
| /* | |||
| * libcucul Canvas for ultrafast compositing of Unicode letters | |||
| * libcaca Colour ASCII-Art library | |||
| * Copyright (c) 2002-2006 Sam Hocevar <sam@zoy.org> | |||
| * All Rights Reserved | |||
| * | |||
| @@ -22,8 +22,8 @@ | |||
| # include <stdlib.h> | |||
| #endif | |||
| #include "cucul.h" | |||
| #include "cucul_internals.h" | |||
| #include "caca.h" | |||
| #include "caca_internals.h" | |||
| static uint32_t flipchar(uint32_t ch); | |||
| static uint32_t flopchar(uint32_t ch); | |||
| @@ -43,7 +43,7 @@ static void rightpair(uint32_t pair[2]); | |||
| * \param cv The canvas to invert. | |||
| * \return This function always returns 0. | |||
| */ | |||
| int cucul_invert(cucul_canvas_t *cv) | |||
| int caca_invert(caca_canvas_t *cv) | |||
| { | |||
| uint32_t *attrs = cv->attrs; | |||
| int i; | |||
| @@ -69,7 +69,7 @@ int cucul_invert(cucul_canvas_t *cv) | |||
| * \param cv The canvas to flip. | |||
| * \return This function always returns 0. | |||
| */ | |||
| int cucul_flip(cucul_canvas_t *cv) | |||
| int caca_flip(caca_canvas_t *cv) | |||
| { | |||
| int y; | |||
| @@ -104,10 +104,10 @@ int cucul_flip(cucul_canvas_t *cv) | |||
| cright = cleft + cv->width - 1; | |||
| for( ; cleft < cright; cleft++) | |||
| { | |||
| if(cleft[0] == CUCUL_MAGIC_FULLWIDTH) | |||
| if(cleft[0] == CACA_MAGIC_FULLWIDTH) | |||
| { | |||
| cleft[0] = cleft[1]; | |||
| cleft[1] = CUCUL_MAGIC_FULLWIDTH; | |||
| cleft[1] = CACA_MAGIC_FULLWIDTH; | |||
| cleft++; | |||
| } | |||
| } | |||
| @@ -128,7 +128,7 @@ int cucul_flip(cucul_canvas_t *cv) | |||
| * \param cv The canvas to flop. | |||
| * \return This function always returns 0. | |||
| */ | |||
| int cucul_flop(cucul_canvas_t *cv) | |||
| int caca_flop(caca_canvas_t *cv) | |||
| { | |||
| int x; | |||
| @@ -174,7 +174,7 @@ int cucul_flop(cucul_canvas_t *cv) | |||
| * \param cv The canvas to rotate. | |||
| * \return This function always returns 0. | |||
| */ | |||
| int cucul_rotate_180(cucul_canvas_t *cv) | |||
| int caca_rotate_180(caca_canvas_t *cv) | |||
| { | |||
| uint32_t *cbegin = cv->chars; | |||
| uint32_t *cend = cbegin + cv->width * cv->height - 1; | |||
| @@ -206,10 +206,10 @@ int cucul_rotate_180(cucul_canvas_t *cv) | |||
| cend = cbegin + cv->width - 1; | |||
| for( ; cbegin < cend; cbegin++) | |||
| { | |||
| if(cbegin[0] == CUCUL_MAGIC_FULLWIDTH) | |||
| if(cbegin[0] == CACA_MAGIC_FULLWIDTH) | |||
| { | |||
| cbegin[0] = cbegin[1]; | |||
| cbegin[1] = CUCUL_MAGIC_FULLWIDTH; | |||
| cbegin[1] = CACA_MAGIC_FULLWIDTH; | |||
| cbegin++; | |||
| } | |||
| } | |||
| @@ -239,7 +239,7 @@ int cucul_rotate_180(cucul_canvas_t *cv) | |||
| * \param cv The canvas to rotate left. | |||
| * \return 0 in case of success, -1 if an error occurred. | |||
| */ | |||
| int cucul_rotate_left(cucul_canvas_t *cv) | |||
| int caca_rotate_left(caca_canvas_t *cv) | |||
| { | |||
| uint32_t *newchars, *newattrs; | |||
| int x, y, w2, h2; | |||
| @@ -251,7 +251,7 @@ int cucul_rotate_left(cucul_canvas_t *cv) | |||
| } | |||
| /* Save the current frame shortcuts */ | |||
| _cucul_save_frame_info(cv); | |||
| _caca_save_frame_info(cv); | |||
| w2 = (cv->width + 1) / 2; | |||
| h2 = cv->height; | |||
| @@ -330,7 +330,7 @@ int cucul_rotate_left(cucul_canvas_t *cv) | |||
| cv->frames[cv->frame].attrs = newattrs; | |||
| /* Reset the current frame shortcuts */ | |||
| _cucul_load_frame_info(cv); | |||
| _caca_load_frame_info(cv); | |||
| return 0; | |||
| } | |||
| @@ -356,7 +356,7 @@ int cucul_rotate_left(cucul_canvas_t *cv) | |||
| * \param cv The canvas to rotate right. | |||
| * \return 0 in case of success, -1 if an error occurred. | |||
| */ | |||
| int cucul_rotate_right(cucul_canvas_t *cv) | |||
| int caca_rotate_right(caca_canvas_t *cv) | |||
| { | |||
| uint32_t *newchars, *newattrs; | |||
| int x, y, w2, h2; | |||
| @@ -368,7 +368,7 @@ int cucul_rotate_right(cucul_canvas_t *cv) | |||
| } | |||
| /* Save the current frame shortcuts */ | |||
| _cucul_save_frame_info(cv); | |||
| _caca_save_frame_info(cv); | |||
| w2 = (cv->width + 1) / 2; | |||
| h2 = cv->height; | |||
| @@ -447,7 +447,7 @@ int cucul_rotate_right(cucul_canvas_t *cv) | |||
| cv->frames[cv->frame].attrs = newattrs; | |||
| /* Reset the current frame shortcuts */ | |||
| _cucul_load_frame_info(cv); | |||
| _caca_load_frame_info(cv); | |||
| return 0; | |||
| } | |||
| @@ -471,7 +471,7 @@ int cucul_rotate_right(cucul_canvas_t *cv) | |||
| * \param cv The canvas to rotate left. | |||
| * \return 0 in case of success, -1 if an error occurred. | |||
| */ | |||
| int cucul_stretch_left(cucul_canvas_t *cv) | |||
| int caca_stretch_left(caca_canvas_t *cv) | |||
| { | |||
| uint32_t *newchars, *newattrs; | |||
| int x, y; | |||
| @@ -483,7 +483,7 @@ int cucul_stretch_left(cucul_canvas_t *cv) | |||
| } | |||
| /* Save the current frame shortcuts */ | |||
| _cucul_save_frame_info(cv); | |||
| _caca_save_frame_info(cv); | |||
| newchars = malloc(cv->width * cv->height * sizeof(uint32_t)); | |||
| if(!newchars) | |||
| @@ -538,7 +538,7 @@ int cucul_stretch_left(cucul_canvas_t *cv) | |||
| cv->frames[cv->frame].attrs = newattrs; | |||
| /* Reset the current frame shortcuts */ | |||
| _cucul_load_frame_info(cv); | |||
| _caca_load_frame_info(cv); | |||
| return 0; | |||
| } | |||
| @@ -562,7 +562,7 @@ int cucul_stretch_left(cucul_canvas_t *cv) | |||
| * \param cv The canvas to rotate right. | |||
| * \return 0 in case of success, -1 if an error occurred. | |||
| */ | |||
| int cucul_stretch_right(cucul_canvas_t *cv) | |||
| int caca_stretch_right(caca_canvas_t *cv) | |||
| { | |||
| uint32_t *newchars, *newattrs; | |||
| int x, y; | |||
| @@ -574,7 +574,7 @@ int cucul_stretch_right(cucul_canvas_t *cv) | |||
| } | |||
| /* Save the current frame shortcuts */ | |||
| _cucul_save_frame_info(cv); | |||
| _caca_save_frame_info(cv); | |||
| newchars = malloc(cv->width * cv->height * sizeof(uint32_t)); | |||
| if(!newchars) | |||
| @@ -629,7 +629,7 @@ int cucul_stretch_right(cucul_canvas_t *cv) | |||
| cv->frames[cv->frame].attrs = newattrs; | |||
| /* Reset the current frame shortcuts */ | |||
| _cucul_load_frame_info(cv); | |||
| _caca_load_frame_info(cv); | |||
| return 0; | |||
| } | |||
| @@ -999,8 +999,8 @@ static uint32_t rightchar(uint32_t ch) | |||
| static uint32_t const leftright2x2[] = | |||
| { | |||
| /* ASCII / Unicode */ | |||
| '-', '-', 0x4e28, CUCUL_MAGIC_FULLWIDTH, /* -- 丨 */ | |||
| '|', '|', 0x2f06, CUCUL_MAGIC_FULLWIDTH, /* || ⼆ */ | |||
| '-', '-', 0x4e28, CACA_MAGIC_FULLWIDTH, /* -- 丨 */ | |||
| '|', '|', 0x2f06, CACA_MAGIC_FULLWIDTH, /* || ⼆ */ | |||
| /* Unicode */ | |||
| 0x2584, 0x2580, 0x2580, 0x2584, /* ▄▀ ▀▄ */ | |||
| 0, 0, 0, 0 | |||
| @@ -1030,22 +1030,22 @@ static uint32_t const leftright2x4[] = | |||
| '.', '_', '.', 0x2575, 0x203e, '\'', 0x2577, '\'', /* ._ .╵ ‾' ╷' */ | |||
| '(', '_', 0x203f, '|', 0x203e, ')', '|', 0x2040, /* (_ ‿| ‾) |⁀ */ | |||
| '(', 0x203e, '|', 0x203f, '_', ')', 0x2040, '|', /* (‾ |‿ _) ⁀| */ | |||
| '\\', '/', 0xff1e, CUCUL_MAGIC_FULLWIDTH, | |||
| '/', '\\', 0xff1c, CUCUL_MAGIC_FULLWIDTH, /* \/ > /\ < */ | |||
| ')', ' ', 0xfe35, CUCUL_MAGIC_FULLWIDTH, | |||
| ' ', '(', 0xfe36, CUCUL_MAGIC_FULLWIDTH, /* ) ︵ ( ︶ */ | |||
| '}', ' ', 0xfe37, CUCUL_MAGIC_FULLWIDTH, | |||
| ' ', '{', 0xfe38, CUCUL_MAGIC_FULLWIDTH, /* } ︷ { ︸ */ | |||
| '\\', '/', 0xff1e, CACA_MAGIC_FULLWIDTH, | |||
| '/', '\\', 0xff1c, CACA_MAGIC_FULLWIDTH, /* \/ > /\ < */ | |||
| ')', ' ', 0xfe35, CACA_MAGIC_FULLWIDTH, | |||
| ' ', '(', 0xfe36, CACA_MAGIC_FULLWIDTH, /* ) ︵ ( ︶ */ | |||
| '}', ' ', 0xfe37, CACA_MAGIC_FULLWIDTH, | |||
| ' ', '{', 0xfe38, CACA_MAGIC_FULLWIDTH, /* } ︷ { ︸ */ | |||
| /* Not perfect, but better than nothing */ | |||
| '(', ' ', 0x02ce, ',', ' ', ')', 0x00b4, '`', /* ( ˎ, ) ´` */ | |||
| ' ', 'v', '>', ' ', 0x028c, ' ', ' ', '<', /* v > ʌ < */ | |||
| ' ', 'V', '>', ' ', 0x039b, ' ', ' ', '<', /* V > Λ < */ | |||
| 'v', ' ', '>', ' ', ' ', 0x028c, ' ', '<', /* v > ʌ < */ | |||
| 'V', ' ', '>', ' ', ' ', 0x039b, ' ', '<', /* V > Λ < */ | |||
| '\\', '|', 0xff1e, CUCUL_MAGIC_FULLWIDTH, | |||
| '|', '\\', 0xff1c, CUCUL_MAGIC_FULLWIDTH, /* \| > |\ < */ | |||
| '|', '/', 0xff1e, CUCUL_MAGIC_FULLWIDTH, | |||
| '/', '|', 0xff1c, CUCUL_MAGIC_FULLWIDTH, /* |/ > /| < */ | |||
| '\\', '|', 0xff1e, CACA_MAGIC_FULLWIDTH, | |||
| '|', '\\', 0xff1c, CACA_MAGIC_FULLWIDTH, /* \| > |\ < */ | |||
| '|', '/', 0xff1e, CACA_MAGIC_FULLWIDTH, | |||
| '/', '|', 0xff1c, CACA_MAGIC_FULLWIDTH, /* |/ > /| < */ | |||
| /* Unicode */ | |||
| 0x2584, ' ', ' ', 0x2584, ' ', 0x2580, 0x2580, ' ', /* ▄ ▄ ▀ ▀ */ | |||
| 0x2588, ' ', 0x2584, 0x2584, ' ', 0x2588, 0x2580, 0x2580, /* █ ▄▄ █ ▀▀ */ | |||
| @@ -1,5 +1,5 @@ | |||
| /* | |||
| * libcucul Canvas for ultrafast compositing of Unicode letters | |||
| * libcaca Colour ASCII-Art library | |||
| * Copyright (c) 2002-2006 Sam Hocevar <sam@zoy.org> | |||
| * All Rights Reserved | |||
| * | |||
| @@ -22,14 +22,14 @@ | |||
| # include <stdlib.h> | |||
| #endif | |||
| #include "cucul.h" | |||
| #include "cucul_internals.h" | |||
| #include "caca.h" | |||
| #include "caca_internals.h" | |||
| /** \brief Draw a triangle on the canvas using the given character. | |||
| * | |||
| * This function never fails. | |||
| * | |||
| * \param cv The handle to the libcucul canvas. | |||
| * \param cv The handle to the libcaca canvas. | |||
| * \param x1 X coordinate of the first point. | |||
| * \param y1 Y coordinate of the first point. | |||
| * \param x2 X coordinate of the second point. | |||
| @@ -39,12 +39,12 @@ | |||
| * \param ch UTF-32 character to be used to draw the triangle outline. | |||
| * \return This function always returns 0. | |||
| */ | |||
| int cucul_draw_triangle(cucul_canvas_t *cv, int x1, int y1, int x2, int y2, | |||
| int caca_draw_triangle(caca_canvas_t *cv, int x1, int y1, int x2, int y2, | |||
| int x3, int y3, uint32_t ch) | |||
| { | |||
| cucul_draw_line(cv, x1, y1, x2, y2, ch); | |||
| cucul_draw_line(cv, x2, y2, x3, y3, ch); | |||
| cucul_draw_line(cv, x3, y3, x1, y1, ch); | |||
| caca_draw_line(cv, x1, y1, x2, y2, ch); | |||
| caca_draw_line(cv, x2, y2, x3, y3, ch); | |||
| caca_draw_line(cv, x3, y3, x1, y1, ch); | |||
| return 0; | |||
| } | |||
| @@ -53,7 +53,7 @@ int cucul_draw_triangle(cucul_canvas_t *cv, int x1, int y1, int x2, int y2, | |||
| * | |||
| * This function never fails. | |||
| * | |||
| * \param cv The handle to the libcucul canvas. | |||
| * \param cv The handle to the libcaca canvas. | |||
| * \param x1 X coordinate of the first point. | |||
| * \param y1 Y coordinate of the first point. | |||
| * \param x2 X coordinate of the second point. | |||
| @@ -62,12 +62,12 @@ int cucul_draw_triangle(cucul_canvas_t *cv, int x1, int y1, int x2, int y2, | |||
| * \param y3 Y coordinate of the third point. | |||
| * \return This function always returns 0. | |||
| */ | |||
| int cucul_draw_thin_triangle(cucul_canvas_t *cv, int x1, int y1, | |||
| int caca_draw_thin_triangle(caca_canvas_t *cv, int x1, int y1, | |||
| int x2, int y2, int x3, int y3) | |||
| { | |||
| cucul_draw_thin_line(cv, x1, y1, x2, y2); | |||
| cucul_draw_thin_line(cv, x2, y2, x3, y3); | |||
| cucul_draw_thin_line(cv, x3, y3, x1, y1); | |||
| caca_draw_thin_line(cv, x1, y1, x2, y2); | |||
| caca_draw_thin_line(cv, x2, y2, x3, y3); | |||
| caca_draw_thin_line(cv, x3, y3, x1, y1); | |||
| return 0; | |||
| } | |||
| @@ -76,7 +76,7 @@ int cucul_draw_thin_triangle(cucul_canvas_t *cv, int x1, int y1, | |||
| * | |||
| * This function never fails. | |||
| * | |||
| * \param cv The handle to the libcucul canvas. | |||
| * \param cv The handle to the libcaca canvas. | |||
| * \param x1 X coordinate of the first point. | |||
| * \param y1 Y coordinate of the first point. | |||
| * \param x2 X coordinate of the second point. | |||
| @@ -86,7 +86,7 @@ int cucul_draw_thin_triangle(cucul_canvas_t *cv, int x1, int y1, | |||
| * \param ch UTF-32 character to be used to fill the triangle. | |||
| * \return This function always returns 0. | |||
| */ | |||
| int cucul_fill_triangle(cucul_canvas_t *cv, int x1, int y1, int x2, int y2, | |||
| int caca_fill_triangle(caca_canvas_t *cv, int x1, int y1, int x2, int y2, | |||
| int x3, int y3, uint32_t ch) | |||
| { | |||
| int x, y, xmin, xmax, ymin, ymax; | |||
| @@ -94,10 +94,10 @@ int cucul_fill_triangle(cucul_canvas_t *cv, int x1, int y1, int x2, int y2, | |||
| /* Bubble-sort y1 <= y2 <= y3 */ | |||
| if(y1 > y2) | |||
| return cucul_fill_triangle(cv, x2, y2, x1, y1, x3, y3, ch); | |||
| return caca_fill_triangle(cv, x2, y2, x1, y1, x3, y3, ch); | |||
| if(y2 > y3) | |||
| return cucul_fill_triangle(cv, x1, y1, x3, y3, x2, y2, ch); | |||
| return caca_fill_triangle(cv, x1, y1, x3, y3, x2, y2, ch); | |||
| /* Compute slopes and promote precision */ | |||
| sl21 = (y2 == y1) ? 0 : (x2 - x1) * 0x10000 / (y2 - y1); | |||
| @@ -146,7 +146,7 @@ int cucul_fill_triangle(cucul_canvas_t *cv, int x1, int y1, int x2, int y2, | |||
| xmax = xx2 + 1 < cv->width ? xx2 + 1 : cv->width; | |||
| for(x = xmin; x < xmax; x++) | |||
| cucul_put_char(cv, x, y, ch); | |||
| caca_put_char(cv, x, y, ch); | |||
| xa += y < y2 ? sl21 : sl32; | |||
| xb += sl31; | |||
| @@ -331,20 +331,20 @@ AC_SUBST(X11_LIBS) | |||
| AC_SUBST(GL_CFLAGS) | |||
| AC_SUBST(GL_LIBS) | |||
| # How to get the C99 types. See cucul/cucul_types.h.in for details about | |||
| # the CUCUL_TYPES variable | |||
| # How to get the C99 types. See caca/caca_types.h.in for details about | |||
| # the CACA_TYPES variable | |||
| if test "${ac_cv_my_have_vga}" = "yes"; then | |||
| CUCUL_TYPES=0 | |||
| CACA_TYPES=0 | |||
| else | |||
| AC_CHECK_HEADERS(stdint.h, | |||
| [CUCUL_TYPES=1], | |||
| [CACA_TYPES=1], | |||
| [AC_CHECK_HEADERS(inttypes.h, | |||
| [CUCUL_TYPES=2], | |||
| [CACA_TYPES=2], | |||
| [AC_CHECK_HEADERS(windows.h, | |||
| [CUCUL_TYPES=3], | |||
| [CUCUL_TYPES=0])])]) | |||
| [CACA_TYPES=3], | |||
| [CACA_TYPES=0])])]) | |||
| fi | |||
| AC_SUBST(CUCUL_TYPES) | |||
| AC_SUBST(CACA_TYPES) | |||
| # Optimizations | |||
| CFLAGS="${CFLAGS} -g -O2 -fno-strength-reduce -fomit-frame-pointer" | |||
| @@ -473,7 +473,6 @@ AM_CONDITIONAL(USE_ZZUF, test "${ZZUF}" != "no") | |||
| AC_CONFIG_FILES([ | |||
| Makefile | |||
| kernel/Makefile | |||
| cucul/Makefile | |||
| caca/Makefile | |||
| src/Makefile | |||
| examples/Makefile | |||
| @@ -487,12 +486,9 @@ AC_CONFIG_FILES([ | |||
| msvc/Makefile | |||
| ]) | |||
| AC_CONFIG_FILES([ | |||
| cucul/cucul_types.h | |||
| cucul/cucul.pc | |||
| caca/caca_types.h | |||
| caca/caca.pc | |||
| csharp/cucul-sharp.dll.config | |||
| csharp/caca-sharp.dll.config | |||
| cxx/cucul++.pc | |||
| cxx/caca++.pc | |||
| doc/doxygen.cfg | |||
| ]) | |||
| @@ -1,32 +1,24 @@ | |||
| # $Id: $ | |||
| cuculdir = $(libdir)/cucul-sharp | |||
| cacadir = $(libdir)/caca-sharp | |||
| cucul_sources = $(srcdir)/AssemblyInfo.cs $(srcdir)/Cucul.cs | |||
| caca_sources = $(srcdir)/AssemblyInfo.cs $(srcdir)/Caca.cs | |||
| caca_sources = $(srcdir)/AssemblyInfo.cs $(srcdir)/Cucul.cs $(srcdir)/Caca.cs | |||
| if USE_CSHARP | |||
| cucul_DATA = cucul-sharp.dll cucul-sharp.dll.config | |||
| caca_DATA = caca-sharp.dll caca-sharp.dll.config | |||
| noinst_DATA = test.exe | |||
| endif | |||
| EXTRA_DIST = $(cucul_sources) cucul-sharp.dll.config.in \ | |||
| $(caca_sources) caca-sharp.dll.config.in \ | |||
| EXTRA_DIST = $(caca_sources) caca-sharp.dll.config.in \ | |||
| $(srcdir)/test.cs | |||
| cucul-sharp.dll: $(cucul_sources) | |||
| gmcs -unsafe $(cucul_sources) -out:$@ -target:library \ | |||
| caca-sharp.dll: $(caca_sources) | |||
| gmcs -unsafe $(caca_sources) -out:$@ -target:library \ | |||
| -r:System.Drawing.dll | |||
| caca-sharp.dll: $(caca_sources) cucul-sharp.dll | |||
| gmcs -unsafe $(caca_sources) -out:$@ -target:library -lib:./ \ | |||
| -r:System.Drawing.dll -r:./cucul-sharp.dll | |||
| test.exe: $(srcdir)/test.cs caca-sharp.dll cucul-sharp.dll | |||
| test.exe: $(srcdir)/test.cs caca-sharp.dll | |||
| gmcs $(srcdir)/test.cs -out:$@ -lib:./ \ | |||
| -r:System.Drawing.dll -r:./cucul-sharp.dll -r:./caca-sharp.dll | |||
| -r:System.Drawing.dll -r:./caca-sharp.dll | |||
| clean-local: | |||
| rm -f *.exe *.dll | |||
| @@ -1 +0,0 @@ | |||
| cucul_types.h | |||
| @@ -1,42 +0,0 @@ | |||
| # $Id$ | |||
| EXTRA_DIST = cucul_types.h.in cucul.pc.in mono9.data monobold12.data | |||
| DISTCLEANFILES = cucul_types.h cucul.pc | |||
| pkgconfig_DATA = cucul.pc | |||
| pkgconfigdir = $(libdir)/pkgconfig | |||
| include_HEADERS = cucul.h cucul_types.h | |||
| lib_LTLIBRARIES = libcucul.la | |||
| libcucul_la_SOURCES = \ | |||
| cucul.c \ | |||
| cucul.h \ | |||
| cucul_types.h \ | |||
| cucul_internals.h \ | |||
| legacy.c \ | |||
| canvas.c \ | |||
| transform.c \ | |||
| charset.c \ | |||
| attr.c \ | |||
| line.c \ | |||
| box.c \ | |||
| conic.c \ | |||
| triangle.c \ | |||
| frame.c \ | |||
| dither.c \ | |||
| font.c \ | |||
| import.c \ | |||
| export.c \ | |||
| file.c \ | |||
| figfont.c \ | |||
| $(NULL) | |||
| libcucul_la_DEPENDENCIES = \ | |||
| mono9.data \ | |||
| monobold12.data \ | |||
| $(NULL) | |||
| AM_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/cucul -I../cucul | |||
| libcucul_la_LDFLAGS = -no-undefined -version-number @LT_VERSION@ | |||
| libcucul_la_LIBADD = $(ZLIB_LIBS) | |||
| @@ -1,383 +0,0 @@ | |||
| /* | |||
| * libcucul Canvas for ultrafast compositing of Unicode letters | |||
| * Copyright (c) 2002-2006 Sam Hocevar <sam@zoy.org> | |||
| * All Rights Reserved | |||
| * | |||
| * $Id$ | |||
| * | |||
| * This library is free software. It comes without any warranty, to | |||
| * the extent permitted by applicable law. You can redistribute it | |||
| * and/or modify it under the terms of the Do What The Fuck You Want | |||
| * To Public License, Version 2, as published by Sam Hocevar. See | |||
| * http://sam.zoy.org/wtfpl/COPYING for more details. | |||
| */ | |||
| /** \file cucul.h | |||
| * \version \$Id$ | |||
| * \author Sam Hocevar <sam@zoy.org> | |||
| * \brief The \e libcucul public header. | |||
| * | |||
| * This header contains the public types and functions that applications | |||
| * using \e libcucul may use. | |||
| */ | |||
| #ifndef __CUCUL_H__ | |||
| #define __CUCUL_H__ | |||
| #include <cucul_types.h> | |||
| #undef __extern | |||
| #if defined(_DOXYGEN_SKIP_ME) | |||
| #elif defined(_WIN32) && defined(__LIBCUCUL__) | |||
| # define __extern extern __declspec(dllexport) | |||
| #else | |||
| # define __extern extern | |||
| #endif | |||
| /** libcucul API version */ | |||
| #define CUCUL_API_VERSION_1 | |||
| #ifdef __cplusplus | |||
| extern "C" | |||
| { | |||
| #endif | |||
| /** \e libcucul canvas */ | |||
| typedef struct cucul_canvas cucul_canvas_t; | |||
| /** dither structure */ | |||
| typedef struct cucul_dither cucul_dither_t; | |||
| /** font structure */ | |||
| typedef struct cucul_font cucul_font_t; | |||
| /** file handle structure */ | |||
| typedef struct cucul_file cucul_file_t; | |||
| /** \defgroup cucul_attr libcucul attribute definitions | |||
| * | |||
| * Colours and styles that can be used with cucul_set_attr(). | |||
| * | |||
| * @{ */ | |||
| #define CUCUL_BLACK 0x00 /**< The colour index for black. */ | |||
| #define CUCUL_BLUE 0x01 /**< The colour index for blue. */ | |||
| #define CUCUL_GREEN 0x02 /**< The colour index for green. */ | |||
| #define CUCUL_CYAN 0x03 /**< The colour index for cyan. */ | |||
| #define CUCUL_RED 0x04 /**< The colour index for red. */ | |||
| #define CUCUL_MAGENTA 0x05 /**< The colour index for magenta. */ | |||
| #define CUCUL_BROWN 0x06 /**< The colour index for brown. */ | |||
| #define CUCUL_LIGHTGRAY 0x07 /**< The colour index for light gray. */ | |||
| #define CUCUL_DARKGRAY 0x08 /**< The colour index for dark gray. */ | |||
| #define CUCUL_LIGHTBLUE 0x09 /**< The colour index for blue. */ | |||
| #define CUCUL_LIGHTGREEN 0x0a /**< The colour index for light green. */ | |||
| #define CUCUL_LIGHTCYAN 0x0b /**< The colour index for light cyan. */ | |||
| #define CUCUL_LIGHTRED 0x0c /**< The colour index for light red. */ | |||
| #define CUCUL_LIGHTMAGENTA 0x0d /**< The colour index for light magenta. */ | |||
| #define CUCUL_YELLOW 0x0e /**< The colour index for yellow. */ | |||
| #define CUCUL_WHITE 0x0f /**< The colour index for white. */ | |||
| #define CUCUL_DEFAULT 0x10 /**< The output driver's default colour. */ | |||
| #define CUCUL_TRANSPARENT 0x20 /**< The transparent colour. */ | |||
| #define CUCUL_BOLD 0x01 /**< The style mask for bold. */ | |||
| #define CUCUL_ITALICS 0x02 /**< The style mask for italics. */ | |||
| #define CUCUL_UNDERLINE 0x04 /**< The style mask for underline. */ | |||
| #define CUCUL_BLINK 0x08 /**< The style mask for blink. */ | |||
| /* @} */ | |||
| /** \defgroup libcucul libcucul basic functions | |||
| * | |||
| * These functions provide the basic \e libcaca routines for library | |||
| * initialisation, system information retrieval and configuration. | |||
| * | |||
| * @{ */ | |||
| __extern cucul_canvas_t * cucul_create_canvas(int, int); | |||
| __extern int cucul_manage_canvas(cucul_canvas_t *, int (*)(void *), void *); | |||
| __extern int cucul_unmanage_canvas(cucul_canvas_t *, int (*)(void *), void *); | |||
| __extern int cucul_set_canvas_size(cucul_canvas_t *, int, int); | |||
| __extern int cucul_get_canvas_width(cucul_canvas_t const *); | |||
| __extern int cucul_get_canvas_height(cucul_canvas_t const *); | |||
| __extern uint8_t const * cucul_get_canvas_chars(cucul_canvas_t const *); | |||
| __extern uint8_t const * cucul_get_canvas_attrs(cucul_canvas_t const *); | |||
| __extern int cucul_free_canvas(cucul_canvas_t *); | |||
| __extern int cucul_rand(int, int); | |||
| __extern char const * cucul_get_version(void); | |||
| /* @} */ | |||
| /** \defgroup cucul_canvas libcucul canvas drawing | |||
| * | |||
| * These functions provide low-level character printing routines and | |||
| * higher level graphics functions. | |||
| * | |||
| * @{ */ | |||
| #define CUCUL_MAGIC_FULLWIDTH 0x000ffffe /**< Used to indicate that the previous character was a fullwidth glyph. */ | |||
| __extern int cucul_gotoxy(cucul_canvas_t *, int, int); | |||
| __extern int cucul_get_cursor_x(cucul_canvas_t const *); | |||
| __extern int cucul_get_cursor_y(cucul_canvas_t const *); | |||
| __extern int cucul_put_char(cucul_canvas_t *, int, int, uint32_t); | |||
| __extern uint32_t cucul_get_char(cucul_canvas_t const *, int, int); | |||
| __extern int cucul_put_str(cucul_canvas_t *, int, int, char const *); | |||
| __extern uint32_t cucul_get_attr(cucul_canvas_t const *, int, int); | |||
| __extern int cucul_set_attr(cucul_canvas_t *, uint32_t); | |||
| __extern int cucul_put_attr(cucul_canvas_t *, int, int, uint32_t); | |||
| __extern int cucul_set_color_ansi(cucul_canvas_t *, uint8_t, uint8_t); | |||
| __extern int cucul_set_color_argb(cucul_canvas_t *, uint16_t, uint16_t); | |||
| __extern int cucul_printf(cucul_canvas_t *, int, int, char const *, ...); | |||
| __extern int cucul_clear_canvas(cucul_canvas_t *); | |||
| __extern int cucul_set_canvas_handle(cucul_canvas_t *, int, int); | |||
| __extern int cucul_get_canvas_handle_x(cucul_canvas_t const *); | |||
| __extern int cucul_get_canvas_handle_y(cucul_canvas_t const *); | |||
| __extern int cucul_blit(cucul_canvas_t *, int, int, cucul_canvas_t const *, | |||
| cucul_canvas_t const *); | |||
| __extern int cucul_set_canvas_boundaries(cucul_canvas_t *, int, int, int, int); | |||
| /* @} */ | |||
| /** \defgroup cucul_transform libcucul canvas transformation | |||
| * | |||
| * These functions perform horizontal and vertical canvas flipping. | |||
| * | |||
| * @{ */ | |||
| __extern int cucul_invert(cucul_canvas_t *); | |||
| __extern int cucul_flip(cucul_canvas_t *); | |||
| __extern int cucul_flop(cucul_canvas_t *); | |||
| __extern int cucul_rotate_180(cucul_canvas_t *); | |||
| __extern int cucul_rotate_left(cucul_canvas_t *); | |||
| __extern int cucul_rotate_right(cucul_canvas_t *); | |||
| __extern int cucul_stretch_left(cucul_canvas_t *); | |||
| __extern int cucul_stretch_right(cucul_canvas_t *); | |||
| /* @} */ | |||
| /** \defgroup cucul_attributes libcucul attribute conversions | |||
| * | |||
| * These functions perform conversions between attribute values. | |||
| * | |||
| * @{ */ | |||
| __extern uint8_t cucul_attr_to_ansi(uint32_t); | |||
| __extern uint8_t cucul_attr_to_ansi_fg(uint32_t); | |||
| __extern uint8_t cucul_attr_to_ansi_bg(uint32_t); | |||
| __extern uint16_t cucul_attr_to_rgb12_fg(uint32_t); | |||
| __extern uint16_t cucul_attr_to_rgb12_bg(uint32_t); | |||
| __extern void cucul_attr_to_argb64(uint32_t, uint8_t[8]); | |||
| /* @} */ | |||
| /** \defgroup cucul_charset libcucul character set conversions | |||
| * | |||
| * These functions perform conversions between usual character sets. | |||
| * | |||
| * @{ */ | |||
| __extern uint32_t cucul_utf8_to_utf32(char const *, size_t *); | |||
| __extern size_t cucul_utf32_to_utf8(char *, uint32_t); | |||
| __extern uint8_t cucul_utf32_to_cp437(uint32_t); | |||
| __extern uint32_t cucul_cp437_to_utf32(uint8_t); | |||
| __extern char cucul_utf32_to_ascii(uint32_t); | |||
| __extern int cucul_utf32_is_fullwidth(uint32_t); | |||
| /* @} */ | |||
| /** \defgroup cucul_primitives libcucul primitives drawing | |||
| * | |||
| * These functions provide routines for primitive drawing, such as lines, | |||
| * boxes, triangles and ellipses. | |||
| * | |||
| * @{ */ | |||
| __extern int cucul_draw_line(cucul_canvas_t *, int, int, int, int, uint32_t); | |||
| __extern int cucul_draw_polyline(cucul_canvas_t *, int const x[], | |||
| int const y[], int, uint32_t); | |||
| __extern int cucul_draw_thin_line(cucul_canvas_t *, int, int, int, int); | |||
| __extern int cucul_draw_thin_polyline(cucul_canvas_t *, int const x[], | |||
| int const y[], int); | |||
| __extern int cucul_draw_circle(cucul_canvas_t *, int, int, int, uint32_t); | |||
| __extern int cucul_draw_ellipse(cucul_canvas_t *, int, int, int, int, uint32_t); | |||
| __extern int cucul_draw_thin_ellipse(cucul_canvas_t *, int, int, int, int); | |||
| __extern int cucul_fill_ellipse(cucul_canvas_t *, int, int, int, int, uint32_t); | |||
| __extern int cucul_draw_box(cucul_canvas_t *, int, int, int, int, uint32_t); | |||
| __extern int cucul_draw_thin_box(cucul_canvas_t *, int, int, int, int); | |||
| __extern int cucul_draw_cp437_box(cucul_canvas_t *, int, int, int, int); | |||
| __extern int cucul_fill_box(cucul_canvas_t *, int, int, int, int, uint32_t); | |||
| __extern int cucul_draw_triangle(cucul_canvas_t *, int, int, int, int, int, | |||
| int, uint32_t); | |||
| __extern int cucul_draw_thin_triangle(cucul_canvas_t *, int, int, int, int, | |||
| int, int); | |||
| __extern int cucul_fill_triangle(cucul_canvas_t *, int, int, int, int, int, | |||
| int, uint32_t); | |||
| /* @} */ | |||
| /** \defgroup cucul_frame libcucul canvas frame handling | |||
| * | |||
| * These functions provide high level routines for canvas frame insertion, | |||
| * removal, copying etc. | |||
| * | |||
| * @{ */ | |||
| __extern int cucul_get_frame_count(cucul_canvas_t const *); | |||
| __extern int cucul_set_frame(cucul_canvas_t *, int); | |||
| __extern char const *cucul_get_frame_name(cucul_canvas_t const *); | |||
| __extern int cucul_set_frame_name(cucul_canvas_t *, char const *); | |||
| __extern int cucul_create_frame(cucul_canvas_t *, int); | |||
| __extern int cucul_free_frame(cucul_canvas_t *, int); | |||
| /* @} */ | |||
| /** \defgroup cucul_dither libcucul bitmap dithering | |||
| * | |||
| * These functions provide high level routines for dither allocation and | |||
| * rendering. | |||
| * | |||
| * @{ */ | |||
| __extern cucul_dither_t *cucul_create_dither(int, int, int, int, | |||
| uint32_t, uint32_t, | |||
| uint32_t, uint32_t); | |||
| __extern int cucul_set_dither_palette(cucul_dither_t *, | |||
| uint32_t r[], uint32_t g[], | |||
| uint32_t b[], uint32_t a[]); | |||
| __extern int cucul_set_dither_brightness(cucul_dither_t *, float); | |||
| __extern float cucul_get_dither_brightness(cucul_dither_t const *); | |||
| __extern int cucul_set_dither_gamma(cucul_dither_t *, float); | |||
| __extern float cucul_get_dither_gamma(cucul_dither_t const *); | |||
| __extern int cucul_set_dither_contrast(cucul_dither_t *, float); | |||
| __extern float cucul_get_dither_contrast(cucul_dither_t const *); | |||
| __extern int cucul_set_dither_antialias(cucul_dither_t *, char const *); | |||
| __extern char const * const * cucul_get_dither_antialias_list(cucul_dither_t | |||
| const *); | |||
| __extern char const * cucul_get_dither_antialias(cucul_dither_t const *); | |||
| __extern int cucul_set_dither_color(cucul_dither_t *, char const *); | |||
| __extern char const * const * cucul_get_dither_color_list(cucul_dither_t | |||
| const *); | |||
| __extern char const * cucul_get_dither_color(cucul_dither_t const *); | |||
| __extern int cucul_set_dither_charset(cucul_dither_t *, char const *); | |||
| __extern char const * const * cucul_get_dither_charset_list(cucul_dither_t | |||
| const *); | |||
| __extern char const * cucul_get_dither_charset(cucul_dither_t const *); | |||
| __extern int cucul_set_dither_algorithm(cucul_dither_t *, char const *); | |||
| __extern char const * const * cucul_get_dither_algorithm_list(cucul_dither_t | |||
| const *); | |||
| __extern char const * cucul_get_dither_algorithm(cucul_dither_t const *); | |||
| __extern int cucul_dither_bitmap(cucul_canvas_t *, int, int, int, int, | |||
| cucul_dither_t const *, void *); | |||
| __extern int cucul_free_dither(cucul_dither_t *); | |||
| /* @} */ | |||
| /** \defgroup cucul_font libcucul font handling | |||
| * | |||
| * These functions provide font handling routines and high quality | |||
| * canvas to bitmap rendering. | |||
| * | |||
| * @{ */ | |||
| __extern cucul_font_t *cucul_load_font(void const *, size_t); | |||
| __extern char const * const * cucul_get_font_list(void); | |||
| __extern int cucul_get_font_width(cucul_font_t const *); | |||
| __extern int cucul_get_font_height(cucul_font_t const *); | |||
| __extern uint32_t const *cucul_get_font_blocks(cucul_font_t const *); | |||
| __extern int cucul_render_canvas(cucul_canvas_t const *, cucul_font_t const *, | |||
| void *, int, int, int); | |||
| __extern int cucul_free_font(cucul_font_t *); | |||
| /* @} */ | |||
| /** \defgroup cucul_figfont libcucul FIGfont handling | |||
| * | |||
| * These functions provide FIGlet and TOIlet font handling routines. | |||
| * | |||
| * @{ */ | |||
| __extern int cucul_canvas_set_figfont(cucul_canvas_t *, char const *); | |||
| __extern int cucul_put_figchar(cucul_canvas_t *, uint32_t); | |||
| __extern int cucul_flush_figlet(cucul_canvas_t *); | |||
| /* @} */ | |||
| /** \defgroup cucul_file libcucul file IO | |||
| * | |||
| * These functions allow to read and write files in a platform-independent | |||
| * way. | |||
| * @{ */ | |||
| __extern cucul_file_t *cucul_file_open(char const *, const char *); | |||
| __extern int cucul_file_close(cucul_file_t *); | |||
| __extern uint64_t cucul_file_tell(cucul_file_t *); | |||
| __extern size_t cucul_file_read(cucul_file_t *, void *, size_t); | |||
| __extern size_t cucul_file_write(cucul_file_t *, const void *, size_t); | |||
| __extern char * cucul_file_gets(cucul_file_t *, char *, int); | |||
| __extern int cucul_file_eof(cucul_file_t *); | |||
| /* @} */ | |||
| /** \defgroup cucul_importexport libcucul importers/exporters from/to various | |||
| * formats | |||
| * | |||
| * These functions import various file formats into a new canvas, or export | |||
| * the current canvas to various text formats. | |||
| * | |||
| * @{ */ | |||
| __extern ssize_t cucul_import_memory(cucul_canvas_t *, void const *, | |||
| size_t, char const *); | |||
| __extern ssize_t cucul_import_file(cucul_canvas_t *, char const *, | |||
| char const *); | |||
| __extern char const * const * cucul_get_import_list(void); | |||
| __extern void *cucul_export_memory(cucul_canvas_t const *, char const *, | |||
| size_t *); | |||
| __extern char const * const * cucul_get_export_list(void); | |||
| /* @} */ | |||
| #if !defined(_DOXYGEN_SKIP_ME) | |||
| /* Legacy stuff from beta versions, will probably disappear in 1.0 */ | |||
| typedef struct cucul_buffer cucul_buffer_t; | |||
| # if defined __GNUC__ && __GNUC__ >= 3 | |||
| # define CUCUL_DEPRECATED __attribute__ ((__deprecated__)) | |||
| # else | |||
| # define CUCUL_DEPRECATED | |||
| # endif | |||
| __extern int cucul_putchar(cucul_canvas_t *, int, int, | |||
| unsigned long int) CUCUL_DEPRECATED; | |||
| __extern unsigned long int cucul_getchar(cucul_canvas_t *, | |||
| int, int) CUCUL_DEPRECATED; | |||
| __extern int cucul_putstr(cucul_canvas_t *, int, int, | |||
| char const *) CUCUL_DEPRECATED; | |||
| __extern int cucul_set_color(cucul_canvas_t *, unsigned char, | |||
| unsigned char) CUCUL_DEPRECATED; | |||
| __extern int cucul_set_truecolor(cucul_canvas_t *, unsigned int, | |||
| unsigned int) CUCUL_DEPRECATED; | |||
| __extern unsigned int cucul_get_canvas_frame_count(cucul_canvas_t *) | |||
| CUCUL_DEPRECATED; | |||
| __extern int cucul_set_canvas_frame(cucul_canvas_t *, | |||
| unsigned int) CUCUL_DEPRECATED; | |||
| __extern int cucul_create_canvas_frame(cucul_canvas_t *, | |||
| unsigned int) CUCUL_DEPRECATED; | |||
| __extern int cucul_free_canvas_frame(cucul_canvas_t *, | |||
| unsigned int) CUCUL_DEPRECATED; | |||
| __extern cucul_buffer_t *cucul_load_memory(void *, | |||
| unsigned long int) CUCUL_DEPRECATED; | |||
| __extern cucul_buffer_t *cucul_load_file(char const *) CUCUL_DEPRECATED; | |||
| __extern unsigned long int cucul_get_buffer_size(cucul_buffer_t *) | |||
| CUCUL_DEPRECATED; | |||
| __extern void * cucul_get_buffer_data(cucul_buffer_t *) CUCUL_DEPRECATED; | |||
| __extern int cucul_free_buffer(cucul_buffer_t *) CUCUL_DEPRECATED; | |||
| __extern cucul_buffer_t * cucul_export_canvas(cucul_canvas_t *, | |||
| char const *) CUCUL_DEPRECATED; | |||
| __extern cucul_canvas_t * cucul_import_canvas(cucul_buffer_t *, | |||
| char const *) CUCUL_DEPRECATED; | |||
| __extern int cucul_rotate(cucul_canvas_t *) CUCUL_DEPRECATED; | |||
| __extern int cucul_set_dither_invert(cucul_dither_t *, int) CUCUL_DEPRECATED; | |||
| __extern int cucul_set_dither_mode(cucul_dither_t *, | |||
| char const *) CUCUL_DEPRECATED; | |||
| __extern char const * const * cucul_get_dither_mode_list(cucul_dither_t | |||
| const *) | |||
| CUCUL_DEPRECATED; | |||
| # define CUCUL_COLOR_BLACK CUCUL_BLACK | |||
| # define CUCUL_COLOR_BLUE CUCUL_BLUE | |||
| # define CUCUL_COLOR_GREEN CUCUL_GREEN | |||
| # define CUCUL_COLOR_CYAN CUCUL_CYAN | |||
| # define CUCUL_COLOR_RED CUCUL_RED | |||
| # define CUCUL_COLOR_MAGENTA CUCUL_MAGENTA | |||
| # define CUCUL_COLOR_BROWN CUCUL_BROWN | |||
| # define CUCUL_COLOR_LIGHTGRAY CUCUL_LIGHTGRAY | |||
| # define CUCUL_COLOR_DARKGRAY CUCUL_DARKGRAY | |||
| # define CUCUL_COLOR_LIGHTBLUE CUCUL_LIGHTBLUE | |||
| # define CUCUL_COLOR_LIGHTGREEN CUCUL_LIGHTGREEN | |||
| # define CUCUL_COLOR_LIGHTCYAN CUCUL_LIGHTCYAN | |||
| # define CUCUL_COLOR_LIGHTRED CUCUL_LIGHTRED | |||
| # define CUCUL_COLOR_LIGHTMAGENTA CUCUL_LIGHTMAGENTA | |||
| # define CUCUL_COLOR_YELLOW CUCUL_YELLOW | |||
| # define CUCUL_COLOR_WHITE CUCUL_YELLOW | |||
| # define CUCUL_COLOR_DEFAULT CUCUL_DEFAULT | |||
| # define CUCUL_COLOR_TRANSPARENT CUCUL_TRANSPARENT | |||
| #endif | |||
| #ifdef __cplusplus | |||
| } | |||
| #endif | |||
| #undef __extern | |||
| #endif /* __CUCUL_H__ */ | |||
| @@ -1,12 +0,0 @@ | |||
| prefix=@prefix@ | |||
| exec_prefix=@exec_prefix@ | |||
| libdir=@libdir@ | |||
| includedir=@includedir@ | |||
| Name: cucul | |||
| Description: Canvas for ultrafast compositing of Unicode letters | |||
| Version: @VERSION@ | |||
| Requires: | |||
| Conflicts: | |||
| Libs: -L${libdir} -lcucul | |||
| Cflags: -I${includedir} | |||
| @@ -1,80 +0,0 @@ | |||
| /* | |||
| * libcucul Canvas for ultrafast compositing of Unicode letters | |||
| * Copyright (c) 2002-2006 Sam Hocevar <sam@zoy.org> | |||
| * All Rights Reserved | |||
| * | |||
| * $Id$ | |||
| * | |||
| * This library is free software. It comes without any warranty, to | |||
| * the extent permitted by applicable law. You can redistribute it | |||
| * and/or modify it under the terms of the Do What The Fuck You Want | |||
| * To Public License, Version 2, as published by Sam Hocevar. See | |||
| * http://sam.zoy.org/wtfpl/COPYING for more details. | |||
| */ | |||
| #ifndef __CUCUL_INTERNALS_H__ | |||
| #define __CUCUL_INTERNALS_H__ | |||
| #include "stubs.h" | |||
| typedef struct cucul_figfont cucul_figfont_t; | |||
| struct cucul_frame | |||
| { | |||
| /* Frame size */ | |||
| int width, height; | |||
| /* Cell information */ | |||
| uint32_t *chars; | |||
| uint32_t *attrs; | |||
| /* Painting context */ | |||
| int x, y; | |||
| int handlex, handley; | |||
| uint32_t curattr; | |||
| /* Frame name */ | |||
| char *name; | |||
| }; | |||
| struct cucul_canvas | |||
| { | |||
| /* XXX: look at cucul_set_canvas_boundaries() before adding anything | |||
| * to this structure. The function is quite hacky. */ | |||
| /* Frame information */ | |||
| int frame, framecount; | |||
| struct cucul_frame *frames; | |||
| /* Canvas management */ | |||
| int refcount; | |||
| int autoinc; | |||
| int (*resize_callback)(void *); | |||
| void *resize_data; | |||
| /* Shortcut to the active frame information */ | |||
| int width, height; | |||
| uint32_t *chars; | |||
| uint32_t *attrs; | |||
| uint32_t curattr; | |||
| /* FIGfont management */ | |||
| cucul_figfont_t *ff; | |||
| }; | |||
| struct cucul_buffer | |||
| { | |||
| size_t size; | |||
| char *data; | |||
| int user_data; | |||
| }; | |||
| /* Colour functions */ | |||
| extern uint32_t _cucul_attr_to_rgb24fg(uint32_t); | |||
| extern uint32_t _cucul_attr_to_rgb24bg(uint32_t); | |||
| /* Frames functions */ | |||
| extern void _cucul_save_frame_info(cucul_canvas_t *); | |||
| extern void _cucul_load_frame_info(cucul_canvas_t *); | |||
| #endif /* __CUCUL_INTERNALS_H__ */ | |||
| @@ -1,28 +1,23 @@ | |||
| # $Id: Makefile.am 552 2006-04-13 16:10:16Z jylam $ | |||
| AM_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/cucul -I../cucul \ | |||
| -I$(top_srcdir)/caca | |||
| AM_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/caca -I../caca | |||
| if USE_CXX | |||
| pkgconfig_DATA = cucul++.pc caca++.pc | |||
| pkgconfig_DATA = caca++.pc | |||
| pkgconfigdir = $(libdir)/pkgconfig | |||
| include_HEADERS = cucul++.h caca++.h | |||
| lib_LTLIBRARIES = libcucul++.la libcaca++.la | |||
| include_HEADERS = caca++.h | |||
| lib_LTLIBRARIES = libcaca++.la | |||
| endif | |||
| libcucul___la_SOURCES = cucul++.cpp cucul++.h | |||
| libcucul___la_LDFLAGS = -no-undefined -version-number @LT_VERSION@ | |||
| libcucul___la_LIBADD = ../cucul/libcucul.la | |||
| libcaca___la_SOURCES = caca++.cpp caca++.h | |||
| libcaca___la_SOURCES = caca++.cpp cucul++.cpp caca++.h | |||
| libcaca___la_LDFLAGS = -no-undefined -version-number @LT_VERSION@ | |||
| libcaca___la_LIBADD = libcucul++.la ../caca/libcaca.la | |||
| libcaca___la_LIBADD = ../caca/libcaca.la | |||
| if USE_CXX | |||
| noinst_PROGRAMS = cxxtest | |||
| endif | |||
| cxxtest_SOURCES = cxxtest.cpp | |||
| cxxtest_LDADD = libcaca++.la libcucul++.la ../caca/libcaca.la ../cucul/libcucul.la | |||
| cxxtest_LDADD = libcaca++.la ../caca/libcaca.la | |||
| @@ -24,9 +24,9 @@ | |||
| #include "caca++.h" | |||
| Caca::Caca(Cucul *cv) | |||
| Caca::Caca(Canvas *cv) | |||
| { | |||
| dp = caca_create_display(cv->get_cucul_canvas_t()); | |||
| dp = caca_create_display(cv->get_caca_canvas_t()); | |||
| if(!dp) | |||
| throw -1; | |||
| } | |||
| @@ -36,9 +36,9 @@ Caca::~Caca() | |||
| caca_free_display(dp); | |||
| } | |||
| void Caca::Attach(Cucul *cv) | |||
| void Caca::Attach(Canvas *cv) | |||
| { | |||
| dp = caca_create_display(cv->get_cucul_canvas_t()); | |||
| dp = caca_create_display(cv->get_caca_canvas_t()); | |||
| if(!dp) | |||
| throw -1; | |||
| } | |||
| @@ -23,9 +23,8 @@ | |||
| #ifndef _CACA_PP_H | |||
| #define _CACA_PP_H | |||
| #include <cucul.h> | |||
| #include <caca.h> | |||
| #include <caca++.h> | |||
| #include <cucul++.h> | |||
| #undef __class | |||
| @@ -61,10 +60,10 @@ __class Caca | |||
| { | |||
| public: | |||
| Caca(); | |||
| Caca(Cucul *cv); | |||
| Caca(Canvas *cv); | |||
| ~Caca(); | |||
| void Attach(Cucul *cv); | |||
| void Attach(Canvas *cv); | |||
| void Detach(); | |||
| void setDisplayTime(unsigned int); | |||
| @@ -1,5 +1,5 @@ | |||
| /* | |||
| * libcucul++ C++ bindings for libcucul | |||
| * libcaca++ C++ bindings for libcaca | |||
| * Copyright (c) 2006 Jean-Yves Lamoureux <jylam@lnxscene.org> | |||
| * All Rights Reserved | |||
| * | |||
| @@ -13,7 +13,7 @@ | |||
| */ | |||
| /* | |||
| * This file contains the main functions used by \e libcucul++ applications | |||
| * This file contains the main functions used by \e libcaca++ applications | |||
| * to initialise a drawing context. | |||
| */ | |||
| @@ -22,92 +22,92 @@ | |||
| #include <stdio.h> // BUFSIZ | |||
| #include <stdarg.h> // va_* | |||
| #include "cucul++.h" | |||
| #include "caca++.h" | |||
| uint32_t Charset::utf8ToUtf32(char const *s, size_t *read) | |||
| { | |||
| return cucul_utf8_to_utf32(s, read); | |||
| return caca_utf8_to_utf32(s, read); | |||
| } | |||
| size_t Charset::utf32ToUtf8(char *buf, uint32_t ch) | |||
| { | |||
| return cucul_utf32_to_utf8(buf, ch); | |||
| return caca_utf32_to_utf8(buf, ch); | |||
| } | |||
| uint8_t Charset::utf32ToCp437(uint32_t ch) | |||
| { | |||
| return cucul_utf32_to_cp437(ch); | |||
| return caca_utf32_to_cp437(ch); | |||
| } | |||
| uint32_t Charset::cp437ToUtf32(uint8_t ch) | |||
| { | |||
| return cucul_cp437_to_utf32(ch); | |||
| return caca_cp437_to_utf32(ch); | |||
| } | |||
| Cucul::Cucul() | |||
| Canvas::Canvas() | |||
| { | |||
| cv = cucul_create_canvas(0, 0); | |||
| cv = caca_create_canvas(0, 0); | |||
| if(!cv) | |||
| throw -1; | |||
| } | |||
| Cucul::Cucul(int width, int height) | |||
| Canvas::Canvas(int width, int height) | |||
| { | |||
| cv = cucul_create_canvas(width, height); | |||
| cv = caca_create_canvas(width, height); | |||
| if(!cv) throw -1; | |||
| } | |||
| Cucul::~Cucul() | |||
| Canvas::~Canvas() | |||
| { | |||
| if(cv) | |||
| cucul_free_canvas(cv); | |||
| caca_free_canvas(cv); | |||
| } | |||
| cucul_canvas_t *Cucul::get_cucul_canvas_t() | |||
| caca_canvas_t *Canvas::get_caca_canvas_t() | |||
| { | |||
| return cv; | |||
| } | |||
| void Cucul::setSize(unsigned int width, unsigned int height) | |||
| void Canvas::setSize(unsigned int width, unsigned int height) | |||
| { | |||
| cucul_set_canvas_size(cv, width, height); | |||
| caca_set_canvas_size(cv, width, height); | |||
| } | |||
| unsigned int Cucul::getWidth(void) | |||
| unsigned int Canvas::getWidth(void) | |||
| { | |||
| return cucul_get_canvas_width(cv); | |||
| return caca_get_canvas_width(cv); | |||
| } | |||
| unsigned int Cucul::getHeight(void) | |||
| unsigned int Canvas::getHeight(void) | |||
| { | |||
| return cucul_get_canvas_height(cv); | |||
| return caca_get_canvas_height(cv); | |||
| } | |||
| int Cucul::setColorANSI(uint8_t f, uint8_t b) | |||
| int Canvas::setColorANSI(uint8_t f, uint8_t b) | |||
| { | |||
| return cucul_set_color_ansi(cv, f, b); | |||
| return caca_set_color_ansi(cv, f, b); | |||
| } | |||
| int Cucul::setColorARGB(unsigned int f, unsigned int b) | |||
| int Canvas::setColorARGB(unsigned int f, unsigned int b) | |||
| { | |||
| return cucul_set_color_argb(cv, f, b); | |||
| return caca_set_color_argb(cv, f, b); | |||
| } | |||
| void Cucul::putChar(int x, int y, uint32_t ch) | |||
| void Canvas::putChar(int x, int y, uint32_t ch) | |||
| { | |||
| cucul_put_char(cv, x, y, ch); | |||
| caca_put_char(cv, x, y, ch); | |||
| } | |||
| uint32_t Cucul::getChar(int x, int y) | |||
| uint32_t Canvas::getChar(int x, int y) | |||
| { | |||
| return cucul_get_char(cv, x, y); | |||
| return caca_get_char(cv, x, y); | |||
| } | |||
| void Cucul::putStr(int x, int y, char *str) | |||
| void Canvas::putStr(int x, int y, char *str) | |||
| { | |||
| cucul_put_str(cv, x, y, str); | |||
| caca_put_str(cv, x, y, str); | |||
| } | |||
| void Cucul::Printf(int x, int y, char const * format, ...) | |||
| void Canvas::Printf(int x, int y, char const * format, ...) | |||
| { | |||
| char tmp[BUFSIZ]; | |||
| char *buf = tmp; | |||
| @@ -125,297 +125,297 @@ void Cucul::Printf(int x, int y, char const * format, ...) | |||
| putStr(x, y, buf); | |||
| } | |||
| void Cucul::Clear(void) | |||
| void Canvas::Clear(void) | |||
| { | |||
| cucul_clear_canvas(cv); | |||
| caca_clear_canvas(cv); | |||
| } | |||
| void Cucul::Blit(int x, int y, Cucul* c1, Cucul* c2) | |||
| void Canvas::Blit(int x, int y, Canvas* c1, Canvas* c2) | |||
| { | |||
| cucul_blit(cv, x, y, c1->get_cucul_canvas_t(), | |||
| c2 ? c2->get_cucul_canvas_t() : NULL); | |||
| caca_blit(cv, x, y, c1->get_caca_canvas_t(), | |||
| c2 ? c2->get_caca_canvas_t() : NULL); | |||
| } | |||
| void Cucul::Invert() | |||
| void Canvas::Invert() | |||
| { | |||
| cucul_invert(cv); | |||
| caca_invert(cv); | |||
| } | |||
| void Cucul::Flip() | |||
| void Canvas::Flip() | |||
| { | |||
| cucul_flip(cv); | |||
| caca_flip(cv); | |||
| } | |||
| void Cucul::Flop() | |||
| void Canvas::Flop() | |||
| { | |||
| cucul_flop(cv); | |||
| caca_flop(cv); | |||
| } | |||
| void Cucul::Rotate180() | |||
| void Canvas::Rotate180() | |||
| { | |||
| cucul_rotate_180(cv); | |||
| caca_rotate_180(cv); | |||
| } | |||
| void Cucul::RotateLeft() | |||
| void Canvas::RotateLeft() | |||
| { | |||
| cucul_rotate_left(cv); | |||
| caca_rotate_left(cv); | |||
| } | |||
| void Cucul::RotateRight() | |||
| void Canvas::RotateRight() | |||
| { | |||
| cucul_rotate_right(cv); | |||
| caca_rotate_right(cv); | |||
| } | |||
| void Cucul::drawLine(int x1, int y1, int x2, int y2, uint32_t ch) | |||
| void Canvas::drawLine(int x1, int y1, int x2, int y2, uint32_t ch) | |||
| { | |||
| cucul_draw_line(cv, x1, y1, x2, y2, ch); | |||
| caca_draw_line(cv, x1, y1, x2, y2, ch); | |||
| } | |||
| void Cucul::drawPolyline(int const x[], int const y[], int f, uint32_t ch) | |||
| void Canvas::drawPolyline(int const x[], int const y[], int f, uint32_t ch) | |||
| { | |||
| cucul_draw_polyline(cv, x, y, f, ch); | |||
| caca_draw_polyline(cv, x, y, f, ch); | |||
| } | |||
| void Cucul::drawThinLine(int x1, int y1, int x2, int y2) | |||
| void Canvas::drawThinLine(int x1, int y1, int x2, int y2) | |||
| { | |||
| cucul_draw_thin_line(cv, x1, y1, x2, y2); | |||
| caca_draw_thin_line(cv, x1, y1, x2, y2); | |||
| } | |||
| void Cucul::drawThinPolyline(int const x[], int const y[], int f) | |||
| void Canvas::drawThinPolyline(int const x[], int const y[], int f) | |||
| { | |||
| cucul_draw_thin_polyline(cv, x, y, f); | |||
| caca_draw_thin_polyline(cv, x, y, f); | |||
| } | |||
| void Cucul::drawCircle(int x, int y, int d, uint32_t ch) | |||
| void Canvas::drawCircle(int x, int y, int d, uint32_t ch) | |||
| { | |||
| cucul_draw_circle(cv, x, y, d, ch); | |||
| caca_draw_circle(cv, x, y, d, ch); | |||
| } | |||
| void Cucul::drawEllipse(int x, int y, int d1, int d2, uint32_t ch) | |||
| void Canvas::drawEllipse(int x, int y, int d1, int d2, uint32_t ch) | |||
| { | |||
| cucul_draw_ellipse(cv, x, y, d1, d2, ch); | |||
| caca_draw_ellipse(cv, x, y, d1, d2, ch); | |||
| } | |||
| void Cucul::drawThinEllipse(int x, int y, int d1, int d2) | |||
| void Canvas::drawThinEllipse(int x, int y, int d1, int d2) | |||
| { | |||
| cucul_draw_thin_ellipse(cv, x, y, d1, d2); | |||
| caca_draw_thin_ellipse(cv, x, y, d1, d2); | |||
| } | |||
| void Cucul::fillEllipse(int x, int y, int d1, int d2, uint32_t ch) | |||
| void Canvas::fillEllipse(int x, int y, int d1, int d2, uint32_t ch) | |||
| { | |||
| cucul_fill_ellipse(cv, x, y, d1, d2, ch); | |||
| caca_fill_ellipse(cv, x, y, d1, d2, ch); | |||
| } | |||
| void Cucul::drawBox(int x, int y, int w, int h, uint32_t ch) | |||
| void Canvas::drawBox(int x, int y, int w, int h, uint32_t ch) | |||
| { | |||
| cucul_draw_box(cv, x, y, w, h, ch); | |||
| caca_draw_box(cv, x, y, w, h, ch); | |||
| } | |||
| void Cucul::drawThinBox(int x, int y, int w, int h) | |||
| void Canvas::drawThinBox(int x, int y, int w, int h) | |||
| { | |||
| cucul_draw_thin_box(cv, x, y, w, h); | |||
| caca_draw_thin_box(cv, x, y, w, h); | |||
| } | |||
| void Cucul::drawCP437Box(int x, int y, int w, int h) | |||
| void Canvas::drawCP437Box(int x, int y, int w, int h) | |||
| { | |||
| cucul_draw_cp437_box(cv, x, y, w, h); | |||
| caca_draw_cp437_box(cv, x, y, w, h); | |||
| } | |||
| void Cucul::fillBox(int x, int y, int w, int h, uint32_t ch) | |||
| void Canvas::fillBox(int x, int y, int w, int h, uint32_t ch) | |||
| { | |||
| cucul_fill_box(cv, x, y, w, h, ch); | |||
| caca_fill_box(cv, x, y, w, h, ch); | |||
| } | |||
| void Cucul::drawTriangle(int x1, int y1, int x2, int y2, int x3, int y3, uint32_t ch) | |||
| void Canvas::drawTriangle(int x1, int y1, int x2, int y2, int x3, int y3, uint32_t ch) | |||
| { | |||
| cucul_draw_triangle(cv, x1, y1, x2, y2, x3, y3, ch); | |||
| caca_draw_triangle(cv, x1, y1, x2, y2, x3, y3, ch); | |||
| } | |||
| void Cucul::drawThinTriangle(int x1, int y1, int x2, int y2, int x3, int y3) | |||
| void Canvas::drawThinTriangle(int x1, int y1, int x2, int y2, int x3, int y3) | |||
| { | |||
| cucul_draw_thin_triangle(cv, x1, y1, x2, y2, x3, y3); | |||
| caca_draw_thin_triangle(cv, x1, y1, x2, y2, x3, y3); | |||
| } | |||
| void Cucul::fillTriangle(int x1, int y1, int x2, int y2, int x3, int y3, uint32_t ch) | |||
| void Canvas::fillTriangle(int x1, int y1, int x2, int y2, int x3, int y3, uint32_t ch) | |||
| { | |||
| cucul_fill_triangle(cv, x1, y1, x2, y2, x3, y3, ch); | |||
| caca_fill_triangle(cv, x1, y1, x2, y2, x3, y3, ch); | |||
| } | |||
| int Cucul::Rand(int min, int max) | |||
| int Canvas::Rand(int min, int max) | |||
| { | |||
| return cucul_rand(min, max); | |||
| return caca_rand(min, max); | |||
| } | |||
| const char * Cucul::getVersion() | |||
| const char * Canvas::getVersion() | |||
| { | |||
| return cucul_get_version(); | |||
| return caca_get_version(); | |||
| } | |||
| int Cucul::setAttr(uint32_t attr) | |||
| int Canvas::setAttr(uint32_t attr) | |||
| { | |||
| return cucul_set_attr(cv, attr); | |||
| return caca_set_attr(cv, attr); | |||
| } | |||
| uint32_t Cucul::getAttr(int x, int y) | |||
| uint32_t Canvas::getAttr(int x, int y) | |||
| { | |||
| return cucul_get_attr(cv, x, y); | |||
| return caca_get_attr(cv, x, y); | |||
| } | |||
| int Cucul::setBoundaries(cucul_canvas_t *, int x, int y, | |||
| int Canvas::setBoundaries(caca_canvas_t *, int x, int y, | |||
| unsigned int w, unsigned int h) | |||
| { | |||
| return cucul_set_canvas_boundaries(cv, x, y, h, w); | |||
| return caca_set_canvas_boundaries(cv, x, y, h, w); | |||
| } | |||
| unsigned int Cucul::getFrameCount() | |||
| unsigned int Canvas::getFrameCount() | |||
| { | |||
| return cucul_get_frame_count(cv); | |||
| return caca_get_frame_count(cv); | |||
| } | |||
| int Cucul::setFrame(unsigned int f) | |||
| int Canvas::setFrame(unsigned int f) | |||
| { | |||
| return cucul_set_frame(cv, f); | |||
| return caca_set_frame(cv, f); | |||
| } | |||
| int Cucul::createFrame(unsigned int f) | |||
| int Canvas::createFrame(unsigned int f) | |||
| { | |||
| return cucul_create_frame(cv, f); | |||
| return caca_create_frame(cv, f); | |||
| } | |||
| int Cucul::freeFrame(unsigned int f) | |||
| int Canvas::freeFrame(unsigned int f) | |||
| { | |||
| return cucul_create_frame(cv, f); | |||
| return caca_create_frame(cv, f); | |||
| } | |||
| char const *const * Cucul::getImportList(void) | |||
| char const *const * Canvas::getImportList(void) | |||
| { | |||
| return cucul_get_import_list(); | |||
| return caca_get_import_list(); | |||
| } | |||
| long int Cucul::importMemory(void const *buf, size_t len, char const *fmt) | |||
| long int Canvas::importMemory(void const *buf, size_t len, char const *fmt) | |||
| { | |||
| return cucul_import_memory(cv, buf, len, fmt); | |||
| return caca_import_memory(cv, buf, len, fmt); | |||
| } | |||
| long int Cucul::importFile(char const *file, char const *fmt) | |||
| long int Canvas::importFile(char const *file, char const *fmt) | |||
| { | |||
| return cucul_import_file(cv, file, fmt); | |||
| return caca_import_file(cv, file, fmt); | |||
| } | |||
| char const *const * Cucul::getExportList(void) | |||
| char const *const * Canvas::getExportList(void) | |||
| { | |||
| return cucul_get_export_list(); | |||
| return caca_get_export_list(); | |||
| } | |||
| void *Cucul::exportMemory(char const *fmt, size_t *len) | |||
| void *Canvas::exportMemory(char const *fmt, size_t *len) | |||
| { | |||
| return cucul_export_memory(cv, fmt, len); | |||
| return caca_export_memory(cv, fmt, len); | |||
| } | |||
| Dither::Dither(unsigned int v1, unsigned int v2, unsigned int v3, unsigned int v4, unsigned int v5, unsigned int v6, unsigned int v7, unsigned int v8) | |||
| { | |||
| dither = cucul_create_dither(v1, v2, v3, v4, v5, v6, v7, v8); | |||
| dither = caca_create_dither(v1, v2, v3, v4, v5, v6, v7, v8); | |||
| } | |||
| Dither::~Dither() | |||
| { | |||
| cucul_free_dither(dither); | |||
| caca_free_dither(dither); | |||
| } | |||
| void Dither::setPalette(uint32_t r[], uint32_t g[], uint32_t b[], uint32_t a[]) | |||
| { | |||
| cucul_set_dither_palette(dither, r, g, b, a); | |||
| caca_set_dither_palette(dither, r, g, b, a); | |||
| } | |||
| void Dither::setBrightness(float f) | |||
| { | |||
| cucul_set_dither_brightness(dither, f); | |||
| caca_set_dither_brightness(dither, f); | |||
| } | |||
| void Dither::setGamma(float f) | |||
| { | |||
| cucul_set_dither_gamma(dither, f); | |||
| caca_set_dither_gamma(dither, f); | |||
| } | |||
| void Dither::setContrast(float f) | |||
| { | |||
| cucul_set_dither_contrast(dither, f); | |||
| caca_set_dither_contrast(dither, f); | |||
| } | |||
| void Dither::setAntialias(char const *cv) | |||
| { | |||
| cucul_set_dither_antialias(dither, cv); | |||
| caca_set_dither_antialias(dither, cv); | |||
| } | |||
| char const *const * Dither::getAntialiasList() | |||
| { | |||
| return cucul_get_dither_antialias_list(dither); | |||
| return caca_get_dither_antialias_list(dither); | |||
| } | |||
| void Dither::setColor(char const *cv) | |||
| { | |||
| cucul_set_dither_color(dither, cv); | |||
| caca_set_dither_color(dither, cv); | |||
| } | |||
| char const *const * Dither::getColorList() | |||
| { | |||
| return cucul_get_dither_color_list(dither); | |||
| return caca_get_dither_color_list(dither); | |||
| } | |||
| void Dither::setCharset(char const *cv) | |||
| { | |||
| cucul_set_dither_charset(dither, cv); | |||
| caca_set_dither_charset(dither, cv); | |||
| } | |||
| char const *const * Dither::getCharsetList() | |||
| { | |||
| return cucul_get_dither_charset_list(dither); | |||
| return caca_get_dither_charset_list(dither); | |||
| } | |||
| void Dither::setMode(char const *cv) | |||
| { | |||
| cucul_set_dither_algorithm(dither, cv); | |||
| caca_set_dither_algorithm(dither, cv); | |||
| } | |||
| char const *const * Dither::getModeList(void) | |||
| { | |||
| return cucul_get_dither_algorithm_list(dither); | |||
| return caca_get_dither_algorithm_list(dither); | |||
| } | |||
| void Dither::Bitmap(Cucul *cv, int x, int y, int w, int h, void *v) | |||
| void Dither::Bitmap(Canvas *cv, int x, int y, int w, int h, void *v) | |||
| { | |||
| cucul_dither_bitmap(cv->get_cucul_canvas_t(), x, y, w, h, dither, v); | |||
| caca_dither_bitmap(cv->get_caca_canvas_t(), x, y, w, h, dither, v); | |||
| } | |||
| Font::Font(void const *s, unsigned int v) | |||
| { | |||
| font = cucul_load_font(s, v); | |||
| font = caca_load_font(s, v); | |||
| if(!font) throw -1; | |||
| } | |||
| char const *const * Font::getList(void) | |||
| { | |||
| return cucul_get_font_list(); | |||
| return caca_get_font_list(); | |||
| } | |||
| unsigned int Font::getWidth() | |||
| { | |||
| return cucul_get_font_width(font); | |||
| return caca_get_font_width(font); | |||
| } | |||
| unsigned int Font::getHeight() | |||
| { | |||
| return cucul_get_font_height(font); | |||
| return caca_get_font_height(font); | |||
| } | |||
| void Font::renderCanvas(Cucul *cv, uint8_t *buf, unsigned int x, unsigned int y, unsigned int w) | |||
| void Font::renderCanvas(Canvas *cv, uint8_t *buf, unsigned int x, unsigned int y, unsigned int w) | |||
| { | |||
| cucul_render_canvas(cv->get_cucul_canvas_t(), font, buf, x, y, w); | |||
| caca_render_canvas(cv->get_caca_canvas_t(), font, buf, x, y, w); | |||
| } | |||
| uint32_t const *Font::getBlocks() | |||
| { | |||
| return cucul_get_font_blocks(font); | |||
| return caca_get_font_blocks(font); | |||
| } | |||
| Font::~Font() | |||
| { | |||
| cucul_free_font(font); | |||
| caca_free_font(font); | |||
| } | |||
| @@ -1,5 +1,5 @@ | |||
| /* | |||
| * libcucul++ C++ bindings for libcucul | |||
| * libcaca++ C++ bindings for libcaca | |||
| * Copyright (c) 2006 Jean-Yves Lamoureux <jylam@lnxscene.org> | |||
| * All Rights Reserved | |||
| * | |||
| @@ -12,28 +12,28 @@ | |||
| * http://sam.zoy.org/wtfpl/COPYING for more details. | |||
| */ | |||
| /** \file cucul++.h | |||
| /** \file caca++.h | |||
| * \version \$Id$ | |||
| * \author Jean-Yves Lamoureux <jylam@lnxscene.org> | |||
| * \brief The \e libcucul++ public header. | |||
| * \brief The \e libcaca++ public header. | |||
| * | |||
| * This header contains the public types and functions that applications | |||
| * using \e libcucul++ may use. | |||
| * using \e libcaca++ may use. | |||
| */ | |||
| #ifndef _CUCUL_PP_H | |||
| #define _CUCUL_PP_H | |||
| #include <cucul.h> | |||
| #include <caca.h> | |||
| #undef __class | |||
| #if defined(_WIN32) && defined(__LIBCUCUL_PP__) | |||
| #if defined(_WIN32) && defined(__LIBCACA_PP__) | |||
| # define __class class __declspec(dllexport) | |||
| #else | |||
| # define __class class | |||
| #endif | |||
| class Cucul; | |||
| class Canvas; | |||
| __class Charset | |||
| { | |||
| @@ -53,12 +53,12 @@ __class Font | |||
| char const *const * getList(void); | |||
| unsigned int getWidth(); | |||
| unsigned int getHeight(); | |||
| void renderCanvas(Cucul *, uint8_t *, unsigned int, | |||
| void renderCanvas(Canvas *, uint8_t *, unsigned int, | |||
| unsigned int, unsigned int); | |||
| uint32_t const *getBlocks(); | |||
| private: | |||
| cucul_font *font; | |||
| caca_font *font; | |||
| }; | |||
| __class Dither | |||
| @@ -81,21 +81,21 @@ __class Dither | |||
| char const *const * getCharsetList(); | |||
| void setMode(char const *); | |||
| char const *const * getModeList(); | |||
| void Bitmap(Cucul *, int, int, int, int, void *); | |||
| void Bitmap(Canvas *, int, int, int, int, void *); | |||
| private: | |||
| cucul_dither *dither; | |||
| caca_dither *dither; | |||
| }; | |||
| __class Cucul | |||
| __class Canvas | |||
| { | |||
| friend class Caca; | |||
| friend class Dither; | |||
| friend class Font; | |||
| public: | |||
| Cucul(); | |||
| Cucul(int width, int height); | |||
| ~Cucul(); | |||
| Canvas(); | |||
| Canvas(int width, int height); | |||
| ~Canvas(); | |||
| void setSize(unsigned int w, unsigned int h); | |||
| unsigned int getWidth(void); | |||
| @@ -109,7 +109,7 @@ __class Cucul | |||
| uint32_t getChar(int, int); | |||
| void putStr(int x, int y, char *str); | |||
| void Clear(void); | |||
| void Blit(int, int, Cucul* c1, Cucul* c2); | |||
| void Blit(int, int, Canvas* c1, Canvas* c2); | |||
| void Invert(); | |||
| void Flip(); | |||
| void Flop(); | |||
| @@ -131,7 +131,7 @@ __class Cucul | |||
| void drawTriangle(int, int, int, int, int, int, uint32_t); | |||
| void drawThinTriangle(int, int, int, int, int, int); | |||
| void fillTriangle(int, int, int, int, int, int, uint32_t); | |||
| int setBoundaries(cucul_canvas_t *, int, int, unsigned int, unsigned int); | |||
| int setBoundaries(caca_canvas_t *, int, int, unsigned int, unsigned int); | |||
| unsigned int getFrameCount(); | |||
| int setFrame(unsigned int); | |||
| int createFrame(unsigned int); | |||
| @@ -147,10 +147,10 @@ __class Cucul | |||
| static char const * getVersion(); | |||
| protected: | |||
| cucul_canvas_t *get_cucul_canvas_t(); | |||
| caca_canvas_t *get_caca_canvas_t(); | |||
| private: | |||
| cucul_canvas_t *cv; | |||
| caca_canvas_t *cv; | |||
| }; | |||
| #endif /* _CUCUL_PP_H */ | |||
| @@ -40,13 +40,13 @@ static char const pigstring[] = | |||
| int main(int argc, char *argv[]) | |||
| { | |||
| Cucul *cv, *pig; | |||
| Canvas *cv, *pig; | |||
| Caca *dp; | |||
| int x = 0, y = 0, ix = 1, iy = 1; | |||
| try { | |||
| cv = new Cucul(); | |||
| cv = new Canvas(); | |||
| } | |||
| catch (int e) { | |||
| cerr << "Error while initializing cucul (" << e << ")" << endl; | |||
| @@ -63,8 +63,8 @@ int main(int argc, char *argv[]) | |||
| try { | |||
| // Import buffer into a canvas | |||
| pig = new Cucul(); | |||
| pig->setColorANSI(CUCUL_LIGHTMAGENTA, CUCUL_TRANSPARENT); | |||
| pig = new Canvas(); | |||
| pig->setColorANSI(CACA_LIGHTMAGENTA, CACA_TRANSPARENT); | |||
| pig->importMemory(pigstring, strlen(pigstring), "text"); | |||
| } | |||
| catch(int e) { | |||
| @@ -89,7 +89,7 @@ int main(int argc, char *argv[]) | |||
| cv->Blit(x, y, pig, NULL); | |||
| /* printf works */ | |||
| cv->setColorANSI(CUCUL_LIGHTBLUE, CUCUL_BLACK); | |||
| cv->setColorANSI(CACA_LIGHTBLUE, CACA_BLACK); | |||
| cv->Printf(cv->getWidth() / 2 - 10, cv->getHeight() / 2, | |||
| "Powered by libcaca %s", dp->getVersion()); | |||
| @@ -8,10 +8,10 @@ man_MANS = caca-config.1 cacafire.1 cacaview.1 cacaserver.1 img2txt.1 cacaplay.1 | |||
| if BUILD_DOCUMENTATION | |||
| htmldoc_DATA = html/doxygen.css | |||
| htmldocdir = $(datadir)/doc/libcucul-dev/html | |||
| htmldocdir = $(datadir)/doc/libcaca-dev/html | |||
| if USE_LATEX | |||
| pdfdoc_DATA = latex/libcaca.pdf | |||
| pdfdocdir = $(datadir)/doc/libcucul-dev/pdf | |||
| pdfdocdir = $(datadir)/doc/libcaca-dev/pdf | |||
| endif | |||
| endif | |||
| @@ -43,9 +43,9 @@ clean-local: | |||
| install-data-local: | |||
| if BUILD_DOCUMENTATION | |||
| $(mkinstalldirs) $(DESTDIR)$(datadir)/doc/libcucul-dev/html | |||
| $(mkinstalldirs) $(DESTDIR)$(datadir)/doc/libcaca-dev/html | |||
| cp `find html -name '*.html' -o -name '*.gif' -o -name '*.png'` \ | |||
| $(DESTDIR)$(datadir)/doc/libcucul-dev/html | |||
| $(DESTDIR)$(datadir)/doc/libcaca-dev/html | |||
| $(mkinstalldirs) $(DESTDIR)$(mandir)/man3 | |||
| for man in $$(find man -name '*.3caca'); do \ | |||
| sed -e 's/man3caca/man3/g' -e "s/fC'\([a-zA-Z0-9]*\)'/fC\"\1\"/g" \ | |||
| @@ -1,82 +1,81 @@ | |||
| # $Id$ | |||
| AM_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/cucul -I../cucul \ | |||
| -I$(top_srcdir)/caca -DDATADIR=\"$(pkgdatadir)\" | |||
| AM_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/caca -DDATADIR=\"$(pkgdatadir)\" | |||
| noinst_PROGRAMS = blit colors cucul demo demo0 dithering driver event export figfont font font2tga frames fullwidth gamma hsv input spritedit swallow text transform truecolor unicode import | |||
| noinst_PROGRAMS = blit canvas colors demo demo0 dithering driver event export figfont font font2tga frames fullwidth gamma hsv input spritedit swallow text transform truecolor unicode import | |||
| blit_SOURCES = blit.c | |||
| blit_LDADD = ../caca/libcaca.la ../cucul/libcucul.la | |||
| blit_LDADD = ../caca/libcaca.la | |||
| colors_SOURCES = colors.c | |||
| colors_LDADD = ../caca/libcaca.la ../cucul/libcucul.la | |||
| canvas_SOURCES = canvas.c | |||
| canvas_LDADD = ../caca/libcaca.la | |||
| cucul_SOURCES = cucul.c | |||
| cucul_LDADD = ../cucul/libcucul.la | |||
| colors_SOURCES = colors.c | |||
| colors_LDADD = ../caca/libcaca.la | |||
| demo_SOURCES = demo.c | |||
| demo_LDADD = ../caca/libcaca.la ../cucul/libcucul.la | |||
| demo_LDADD = ../caca/libcaca.la | |||
| demo_LDFLAGS = @MATH_LIBS@ | |||
| demo0_SOURCES = demo0.c | |||
| demo0_LDADD = ../caca/libcaca.la ../cucul/libcucul.la | |||
| demo0_LDADD = ../caca/libcaca.la | |||
| demo0_LDFLAGS = @MATH_LIBS@ | |||
| dithering_SOURCES = dithering.c | |||
| dithering_LDADD = ../caca/libcaca.la ../cucul/libcucul.la | |||
| dithering_LDADD = ../caca/libcaca.la | |||
| driver_SOURCES = driver.c | |||
| driver_LDADD = ../caca/libcaca.la ../cucul/libcucul.la | |||
| driver_LDADD = ../caca/libcaca.la | |||
| event_SOURCES = event.c | |||
| event_LDADD = ../caca/libcaca.la ../cucul/libcucul.la | |||
| event_LDADD = ../caca/libcaca.la | |||
| export_SOURCES = export.c | |||
| export_LDADD = ../cucul/libcucul.la | |||
| export_LDADD = ../caca/libcaca.la | |||
| figfont_SOURCES = figfont.c | |||
| figfont_LDADD = ../cucul/libcucul.la | |||
| figfont_LDADD = ../caca/libcaca.la | |||
| font_SOURCES = font.c | |||
| font_LDADD = ../caca/libcaca.la ../cucul/libcucul.la | |||
| font_LDADD = ../caca/libcaca.la | |||
| font2tga_SOURCES = font2tga.c | |||
| font2tga_LDADD = ../cucul/libcucul.la | |||
| font2tga_LDADD = ../caca/libcaca.la | |||
| frames_SOURCES = frames.c | |||
| frames_LDADD = ../caca/libcaca.la ../cucul/libcucul.la | |||
| frames_LDADD = ../caca/libcaca.la | |||
| fullwidth_SOURCES = fullwidth.c | |||
| fullwidth_LDADD = ../caca/libcaca.la ../cucul/libcucul.la | |||
| fullwidth_LDADD = ../caca/libcaca.la | |||
| gamma_SOURCES = gamma.c | |||
| gamma_LDADD = ../caca/libcaca.la ../cucul/libcucul.la | |||
| gamma_LDADD = ../caca/libcaca.la | |||
| gamma_LDFLAGS = @MATH_LIBS@ | |||
| hsv_SOURCES = hsv.c | |||
| hsv_LDADD = ../caca/libcaca.la ../cucul/libcucul.la | |||
| hsv_LDADD = ../caca/libcaca.la | |||
| input_SOURCES = input.c | |||
| input_LDADD = ../caca/libcaca.la ../cucul/libcucul.la | |||
| input_LDADD = ../caca/libcaca.la | |||
| spritedit_SOURCES = spritedit.c | |||
| spritedit_LDADD = ../caca/libcaca.la ../cucul/libcucul.la | |||
| spritedit_LDADD = ../caca/libcaca.la | |||
| swallow_SOURCES = swallow.c | |||
| swallow_LDADD = ../caca/libcaca.la ../cucul/libcucul.la | |||
| swallow_LDADD = ../caca/libcaca.la | |||
| text_SOURCES = text.c | |||
| text_LDADD = ../cucul/libcucul.la | |||
| text_LDADD = ../caca/libcaca.la | |||
| transform_SOURCES = transform.c | |||
| transform_LDADD = ../caca/libcaca.la ../cucul/libcucul.la | |||
| transform_LDADD = ../caca/libcaca.la | |||
| truecolor_SOURCES = truecolor.c | |||
| truecolor_LDADD = ../caca/libcaca.la ../cucul/libcucul.la | |||
| truecolor_LDADD = ../caca/libcaca.la | |||
| unicode_SOURCES = unicode.c | |||
| unicode_LDADD = ../caca/libcaca.la ../cucul/libcucul.la | |||
| unicode_LDADD = ../caca/libcaca.la | |||
| import_SOURCES = import.c | |||
| import_LDADD = ../caca/libcaca.la ../cucul/libcucul.la | |||
| import_LDADD = ../caca/libcaca.la | |||
| @@ -19,7 +19,6 @@ | |||
| # include <string.h> | |||
| #endif | |||
| #include "cucul.h" | |||
| #include "caca.h" | |||
| static char const pig[] = | |||
| @@ -40,10 +39,10 @@ static char const pig[] = | |||
| int main(int argc, char *argv[]) | |||
| { | |||
| cucul_canvas_t *cv, *sprite; | |||
| caca_canvas_t *cv, *sprite; | |||
| caca_display_t *dp; | |||
| cv = cucul_create_canvas(80, 24); | |||
| cv = caca_create_canvas(80, 24); | |||
| if(cv == NULL) | |||
| { | |||
| printf("Failed to create canvas\n"); | |||
| @@ -57,25 +56,25 @@ int main(int argc, char *argv[]) | |||
| return 1; | |||
| } | |||
| sprite = cucul_create_canvas(0, 0); | |||
| cucul_set_color_ansi(sprite, CUCUL_LIGHTRED, CUCUL_BLACK); | |||
| cucul_import_memory(sprite, pig, strlen(pig), "text"); | |||
| cucul_set_canvas_handle(sprite, cucul_get_canvas_width(sprite) / 2, | |||
| cucul_get_canvas_height(sprite) / 2); | |||
| sprite = caca_create_canvas(0, 0); | |||
| caca_set_color_ansi(sprite, CACA_LIGHTRED, CACA_BLACK); | |||
| caca_import_memory(sprite, pig, strlen(pig), "text"); | |||
| caca_set_canvas_handle(sprite, caca_get_canvas_width(sprite) / 2, | |||
| caca_get_canvas_height(sprite) / 2); | |||
| cucul_set_color_ansi(cv, CUCUL_WHITE, CUCUL_BLUE); | |||
| cucul_put_str(cv, 0, 0, "Centered sprite"); | |||
| caca_set_color_ansi(cv, CACA_WHITE, CACA_BLUE); | |||
| caca_put_str(cv, 0, 0, "Centered sprite"); | |||
| cucul_blit(cv, cucul_get_canvas_width(cv) / 2, | |||
| cucul_get_canvas_height(cv) / 2, sprite, NULL); | |||
| caca_blit(cv, caca_get_canvas_width(cv) / 2, | |||
| caca_get_canvas_height(cv) / 2, sprite, NULL); | |||
| caca_refresh_display(dp); | |||
| caca_get_event(dp, CACA_EVENT_KEY_PRESS, NULL, -1); | |||
| caca_free_display(dp); | |||
| cucul_free_canvas(sprite); | |||
| cucul_free_canvas(cv); | |||
| caca_free_canvas(sprite); | |||
| caca_free_canvas(cv); | |||
| return 0; | |||
| } | |||
| @@ -19,30 +19,29 @@ | |||
| # include <string.h> | |||
| #endif | |||
| #include "cucul.h" | |||
| #include "caca.h" | |||
| #define ITER 128 | |||
| int main(int argc, char *argv[]) | |||
| { | |||
| cucul_canvas_t *cv; | |||
| caca_canvas_t *cv; | |||
| unsigned int i, j, w, h; | |||
| fprintf(stderr, "testing cucul_create_canvas()\n"); | |||
| fprintf(stderr, "testing caca_create_canvas()\n"); | |||
| for(i = 0; i < ITER; i++) | |||
| { | |||
| w = cucul_rand(1, 1000); | |||
| h = cucul_rand(1, 1000); | |||
| cv = cucul_create_canvas(w, h); | |||
| cucul_put_char(cv, w - 1, h - 1, 'x'); | |||
| if(cucul_get_char(cv, w - 1, h - 1) != 'x') | |||
| w = caca_rand(1, 1000); | |||
| h = caca_rand(1, 1000); | |||
| cv = caca_create_canvas(w, h); | |||
| caca_put_char(cv, w - 1, h - 1, 'x'); | |||
| if(caca_get_char(cv, w - 1, h - 1) != 'x') | |||
| fprintf(stderr, " failed (%ux%u)\n", w, h); | |||
| cucul_free_canvas(cv); | |||
| caca_free_canvas(cv); | |||
| } | |||
| fprintf(stderr, "testing cucul_set_frame_name()\n"); | |||
| cv = cucul_create_canvas(1, 1); | |||
| fprintf(stderr, "testing caca_set_frame_name()\n"); | |||
| cv = caca_create_canvas(1, 1); | |||
| if(cv == NULL) | |||
| { | |||
| printf("Failed to create canvas\n"); | |||
| @@ -51,17 +50,17 @@ int main(int argc, char *argv[]) | |||
| for(i = 0; i < ITER; i++) | |||
| { | |||
| cucul_create_frame(cv, 0); | |||
| caca_create_frame(cv, 0); | |||
| for(j = 0; j < ITER; j++) | |||
| { | |||
| char buf[BUFSIZ]; | |||
| w = cucul_rand(1, 1000); | |||
| w = caca_rand(1, 1000); | |||
| memset(buf, 'x', w); | |||
| buf[w] = '\0'; | |||
| cucul_set_frame_name(cv, buf); | |||
| caca_set_frame_name(cv, buf); | |||
| } | |||
| } | |||
| cucul_free_canvas(cv); | |||
| caca_free_canvas(cv); | |||
| fprintf(stderr, "all tests passed\n"); | |||
| return 0; | |||
| @@ -18,16 +18,15 @@ | |||
| # include <stdio.h> | |||
| #endif | |||
| #include "cucul.h" | |||
| #include "caca.h" | |||
| int main(int argc, char **argv) | |||
| { | |||
| cucul_canvas_t *cv; | |||
| caca_canvas_t *cv; | |||
| caca_display_t *dp; | |||
| int i, j; | |||
| cv = cucul_create_canvas(80, 24); | |||
| cv = caca_create_canvas(80, 24); | |||
| if(cv == NULL) | |||
| { | |||
| printf("Failed to create canvas\n"); | |||
| @@ -41,36 +40,36 @@ int main(int argc, char **argv) | |||
| return 1; | |||
| } | |||
| cucul_set_color_ansi(cv, CUCUL_LIGHTGRAY, CUCUL_BLACK); | |||
| cucul_clear_canvas(cv); | |||
| caca_set_color_ansi(cv, CACA_LIGHTGRAY, CACA_BLACK); | |||
| caca_clear_canvas(cv); | |||
| for(i = 0; i < 16; i++) | |||
| { | |||
| cucul_set_color_ansi(cv, CUCUL_LIGHTGRAY, CUCUL_BLACK); | |||
| cucul_printf(cv, 3, i + (i >= 8 ? 3 : 2), "ANSI %i", i); | |||
| caca_set_color_ansi(cv, CACA_LIGHTGRAY, CACA_BLACK); | |||
| caca_printf(cv, 3, i + (i >= 8 ? 3 : 2), "ANSI %i", i); | |||
| for(j = 0; j < 16; j++) | |||
| { | |||
| cucul_set_color_ansi(cv, i, j); | |||
| cucul_put_str(cv, (j >= 8 ? 13 : 12) + j * 4, i + (i >= 8 ? 3 : 2), | |||
| caca_set_color_ansi(cv, i, j); | |||
| caca_put_str(cv, (j >= 8 ? 13 : 12) + j * 4, i + (i >= 8 ? 3 : 2), | |||
| "Aaホ"); | |||
| } | |||
| } | |||
| cucul_set_color_ansi(cv, CUCUL_LIGHTGRAY, CUCUL_BLACK); | |||
| cucul_put_str(cv, 3, 20, "This is bold This is blink This is italics This is underline"); | |||
| cucul_set_attr(cv, CUCUL_BOLD); | |||
| cucul_put_str(cv, 3 + 8, 20, "bold"); | |||
| cucul_set_attr(cv, CUCUL_BLINK); | |||
| cucul_put_str(cv, 3 + 24, 20, "blink"); | |||
| cucul_set_attr(cv, CUCUL_ITALICS); | |||
| cucul_put_str(cv, 3 + 41, 20, "italics"); | |||
| cucul_set_attr(cv, CUCUL_UNDERLINE); | |||
| cucul_put_str(cv, 3 + 60, 20, "underline"); | |||
| caca_set_color_ansi(cv, CACA_LIGHTGRAY, CACA_BLACK); | |||
| caca_put_str(cv, 3, 20, "This is bold This is blink This is italics This is underline"); | |||
| caca_set_attr(cv, CACA_BOLD); | |||
| caca_put_str(cv, 3 + 8, 20, "bold"); | |||
| caca_set_attr(cv, CACA_BLINK); | |||
| caca_put_str(cv, 3 + 24, 20, "blink"); | |||
| caca_set_attr(cv, CACA_ITALICS); | |||
| caca_put_str(cv, 3 + 41, 20, "italics"); | |||
| caca_set_attr(cv, CACA_UNDERLINE); | |||
| caca_put_str(cv, 3 + 60, 20, "underline"); | |||
| caca_refresh_display(dp); | |||
| caca_get_event(dp, CACA_EVENT_KEY_PRESS, NULL, -1); | |||
| caca_free_display(dp); | |||
| cucul_free_canvas(cv); | |||
| caca_free_canvas(cv); | |||
| return 0; | |||
| } | |||
| @@ -20,7 +20,6 @@ | |||
| # include <stdio.h> | |||
| #endif | |||
| #include "cucul.h" | |||
| #include "caca.h" | |||
| static void display_menu(void); | |||
| @@ -39,10 +38,10 @@ int bounds = 0; | |||
| int outline = 0; | |||
| int dithering = 0; | |||
| #if 0 | |||
| cucul_sprite_t *sprite = NULL; | |||
| caca_sprite_t *sprite = NULL; | |||
| #endif | |||
| cucul_canvas_t *cv; | |||
| caca_canvas_t *cv; | |||
| caca_display_t *dp; | |||
| int main(int argc, char **argv) | |||
| @@ -50,7 +49,7 @@ int main(int argc, char **argv) | |||
| void (*demo)(void) = NULL; | |||
| int quit = 0; | |||
| cv = cucul_create_canvas(80, 24); | |||
| cv = caca_create_canvas(80, 24); | |||
| if(cv == NULL) | |||
| { | |||
| printf("Failed to create canvas\n"); | |||
| @@ -68,11 +67,11 @@ int main(int argc, char **argv) | |||
| /* Initialize data */ | |||
| #if 0 | |||
| sprite = cucul_load_sprite(DATADIR "/caca.txt"); | |||
| sprite = caca_load_sprite(DATADIR "/caca.txt"); | |||
| if(!sprite) | |||
| sprite = cucul_load_sprite("caca.txt"); | |||
| sprite = caca_load_sprite("caca.txt"); | |||
| if(!sprite) | |||
| sprite = cucul_load_sprite("examples/caca.txt"); | |||
| sprite = caca_load_sprite("examples/caca.txt"); | |||
| #endif | |||
| /* Disable cursor */ | |||
| @@ -119,7 +118,7 @@ int main(int argc, char **argv) | |||
| case 'd': | |||
| case 'D': | |||
| dithering = (dithering + 1) % 5; | |||
| cucul_set_feature(cv, dithering); | |||
| caca_set_feature(cv, dithering); | |||
| display_menu(); | |||
| break; | |||
| #endif | |||
| @@ -157,8 +156,8 @@ int main(int argc, char **argv) | |||
| if(demo) | |||
| { | |||
| cucul_set_color_ansi(cv, CUCUL_LIGHTGRAY, CUCUL_BLACK); | |||
| cucul_clear_canvas(cv); | |||
| caca_set_color_ansi(cv, CACA_LIGHTGRAY, CACA_BLACK); | |||
| caca_clear_canvas(cv); | |||
| } | |||
| } | |||
| else if(caca_get_event_type(&ev) & CACA_EVENT_MOUSE_MOTION) | |||
| @@ -178,9 +177,9 @@ int main(int argc, char **argv) | |||
| display_menu(); | |||
| if(mouse && !demo) | |||
| { | |||
| cucul_set_color_ansi(cv, CUCUL_RED, CUCUL_BLACK); | |||
| cucul_put_str(cv, xmouse, ymouse, "."); | |||
| cucul_put_str(cv, xmouse, ymouse + 1, "|\\"); | |||
| caca_set_color_ansi(cv, CACA_RED, CACA_BLACK); | |||
| caca_put_str(cv, xmouse, ymouse, "."); | |||
| caca_put_str(cv, xmouse, ymouse + 1, "|\\"); | |||
| } | |||
| caca_refresh_display(dp); | |||
| mouse = menu = 0; | |||
| @@ -190,10 +189,10 @@ int main(int argc, char **argv) | |||
| { | |||
| demo(); | |||
| cucul_set_color_ansi(cv, CUCUL_LIGHTGRAY, CUCUL_BLACK); | |||
| cucul_draw_thin_box(cv, 1, 1, cucul_get_canvas_width(cv) - 2, | |||
| cucul_get_canvas_height(cv) - 2); | |||
| cucul_printf(cv, 4, 1, "[%i.%i fps]----", | |||
| caca_set_color_ansi(cv, CACA_LIGHTGRAY, CACA_BLACK); | |||
| caca_draw_thin_box(cv, 1, 1, caca_get_canvas_width(cv) - 2, | |||
| caca_get_canvas_height(cv) - 2); | |||
| caca_printf(cv, 4, 1, "[%i.%i fps]----", | |||
| 1000000 / caca_get_display_time(dp), | |||
| (10000000 / caca_get_display_time(dp)) % 10); | |||
| caca_refresh_display(dp); | |||
| @@ -202,49 +201,49 @@ int main(int argc, char **argv) | |||
| /* Clean up */ | |||
| #if 0 | |||
| cucul_free_sprite(sprite); | |||
| caca_free_sprite(sprite); | |||
| #endif | |||
| caca_free_display(dp); | |||
| cucul_free_canvas(cv); | |||
| caca_free_canvas(cv); | |||
| return 0; | |||
| } | |||
| static void display_menu(void) | |||
| { | |||
| int xo = cucul_get_canvas_width(cv) - 2; | |||
| int yo = cucul_get_canvas_height(cv) - 2; | |||
| cucul_set_color_ansi(cv, CUCUL_LIGHTGRAY, CUCUL_BLACK); | |||
| cucul_clear_canvas(cv); | |||
| cucul_draw_thin_box(cv, 1, 1, xo, yo); | |||
| cucul_put_str(cv, (xo - strlen("libcaca demo")) / 2, 3, "libcaca demo"); | |||
| cucul_put_str(cv, (xo - strlen("==============")) / 2, 4, "=============="); | |||
| cucul_put_str(cv, 4, 6, "demos:"); | |||
| cucul_put_str(cv, 4, 7, "'f': full"); | |||
| cucul_put_str(cv, 4, 8, "'1': dots"); | |||
| cucul_put_str(cv, 4, 9, "'2': lines"); | |||
| cucul_put_str(cv, 4, 10, "'3': boxes"); | |||
| cucul_put_str(cv, 4, 11, "'4': triangles"); | |||
| cucul_put_str(cv, 4, 12, "'5': ellipses"); | |||
| cucul_put_str(cv, 4, 13, "'c': colour"); | |||
| cucul_put_str(cv, 4, 14, "'r': render"); | |||
| int xo = caca_get_canvas_width(cv) - 2; | |||
| int yo = caca_get_canvas_height(cv) - 2; | |||
| caca_set_color_ansi(cv, CACA_LIGHTGRAY, CACA_BLACK); | |||
| caca_clear_canvas(cv); | |||
| caca_draw_thin_box(cv, 1, 1, xo, yo); | |||
| caca_put_str(cv, (xo - strlen("libcaca demo")) / 2, 3, "libcaca demo"); | |||
| caca_put_str(cv, (xo - strlen("==============")) / 2, 4, "=============="); | |||
| caca_put_str(cv, 4, 6, "demos:"); | |||
| caca_put_str(cv, 4, 7, "'f': full"); | |||
| caca_put_str(cv, 4, 8, "'1': dots"); | |||
| caca_put_str(cv, 4, 9, "'2': lines"); | |||
| caca_put_str(cv, 4, 10, "'3': boxes"); | |||
| caca_put_str(cv, 4, 11, "'4': triangles"); | |||
| caca_put_str(cv, 4, 12, "'5': ellipses"); | |||
| caca_put_str(cv, 4, 13, "'c': colour"); | |||
| caca_put_str(cv, 4, 14, "'r': render"); | |||
| #if 0 | |||
| if(sprite) | |||
| cucul_put_str(cv, 4, 15, "'s': sprites"); | |||
| caca_put_str(cv, 4, 15, "'s': sprites"); | |||
| #endif | |||
| cucul_put_str(cv, 4, 16, "settings:"); | |||
| cucul_printf(cv, 4, 17, "'o': outline: %s", | |||
| caca_put_str(cv, 4, 16, "settings:"); | |||
| caca_printf(cv, 4, 17, "'o': outline: %s", | |||
| outline == 0 ? "none" : outline == 1 ? "solid" : "thin"); | |||
| cucul_printf(cv, 4, 18, "'b': drawing boundaries: %s", | |||
| caca_printf(cv, 4, 18, "'b': drawing boundaries: %s", | |||
| bounds == 0 ? "screen" : "infinite"); | |||
| //cucul_printf(cv, 4, 19, "'d': dithering (%s)", | |||
| // cucul_get_feature_name(dithering)); | |||
| //caca_printf(cv, 4, 19, "'d': dithering (%s)", | |||
| // caca_get_feature_name(dithering)); | |||
| cucul_put_str(cv, 4, yo - 2, "'q': quit"); | |||
| caca_put_str(cv, 4, yo - 2, "'q': quit"); | |||
| caca_refresh_display(dp); | |||
| } | |||
| @@ -257,104 +256,104 @@ static void demo_all(void) | |||
| i++; | |||
| cucul_set_color_ansi(cv, CUCUL_LIGHTGRAY, CUCUL_BLACK); | |||
| cucul_clear_canvas(cv); | |||
| caca_set_color_ansi(cv, CACA_LIGHTGRAY, CACA_BLACK); | |||
| caca_clear_canvas(cv); | |||
| /* Draw the sun */ | |||
| cucul_set_color_ansi(cv, CUCUL_YELLOW, CUCUL_BLACK); | |||
| xo = cucul_get_canvas_width(cv) / 4; | |||
| yo = cucul_get_canvas_height(cv) / 4 + 5 * sin(0.03*i); | |||
| caca_set_color_ansi(cv, CACA_YELLOW, CACA_BLACK); | |||
| xo = caca_get_canvas_width(cv) / 4; | |||
| yo = caca_get_canvas_height(cv) / 4 + 5 * sin(0.03*i); | |||
| for(j = 0; j < 16; j++) | |||
| { | |||
| xa = xo - (30 + sin(0.03*i) * 8) * sin(0.03*i + M_PI*j/8); | |||
| ya = yo + (15 + sin(0.03*i) * 4) * cos(0.03*i + M_PI*j/8); | |||
| cucul_draw_thin_line(cv, xo, yo, xa, ya); | |||
| caca_draw_thin_line(cv, xo, yo, xa, ya); | |||
| } | |||
| j = 15 + sin(0.03*i) * 8; | |||
| cucul_set_color_ansi(cv, CUCUL_WHITE, CUCUL_BLACK); | |||
| cucul_fill_ellipse(cv, xo, yo, j, j / 2, '#'); | |||
| cucul_set_color_ansi(cv, CUCUL_YELLOW, CUCUL_BLACK); | |||
| cucul_draw_ellipse(cv, xo, yo, j, j / 2, '#'); | |||
| caca_set_color_ansi(cv, CACA_WHITE, CACA_BLACK); | |||
| caca_fill_ellipse(cv, xo, yo, j, j / 2, '#'); | |||
| caca_set_color_ansi(cv, CACA_YELLOW, CACA_BLACK); | |||
| caca_draw_ellipse(cv, xo, yo, j, j / 2, '#'); | |||
| /* Draw the pyramid */ | |||
| xo = cucul_get_canvas_width(cv) * 5 / 8; | |||
| xo = caca_get_canvas_width(cv) * 5 / 8; | |||
| yo = 2; | |||
| xa = cucul_get_canvas_width(cv) / 8 + sin(0.03*i) * 5; | |||
| ya = cucul_get_canvas_height(cv) / 2 + cos(0.03*i) * 5; | |||
| xa = caca_get_canvas_width(cv) / 8 + sin(0.03*i) * 5; | |||
| ya = caca_get_canvas_height(cv) / 2 + cos(0.03*i) * 5; | |||
| xb = cucul_get_canvas_width(cv) - 10 - cos(0.02*i) * 10; | |||
| yb = cucul_get_canvas_height(cv) * 3 / 4 - 5 + sin(0.02*i) * 5; | |||
| xb = caca_get_canvas_width(cv) - 10 - cos(0.02*i) * 10; | |||
| yb = caca_get_canvas_height(cv) * 3 / 4 - 5 + sin(0.02*i) * 5; | |||
| xc = cucul_get_canvas_width(cv) / 4 - sin(0.02*i) * 5; | |||
| yc = cucul_get_canvas_height(cv) * 3 / 4 + cos(0.02*i) * 5; | |||
| xc = caca_get_canvas_width(cv) / 4 - sin(0.02*i) * 5; | |||
| yc = caca_get_canvas_height(cv) * 3 / 4 + cos(0.02*i) * 5; | |||
| cucul_set_color_ansi(cv, CUCUL_GREEN, CUCUL_BLACK); | |||
| cucul_fill_triangle(cv, xo, yo, xb, yb, xa, ya, '%'); | |||
| cucul_set_color_ansi(cv, CUCUL_YELLOW, CUCUL_BLACK); | |||
| cucul_draw_thin_triangle(cv, xo, yo, xb, yb, xa, ya); | |||
| caca_set_color_ansi(cv, CACA_GREEN, CACA_BLACK); | |||
| caca_fill_triangle(cv, xo, yo, xb, yb, xa, ya, '%'); | |||
| caca_set_color_ansi(cv, CACA_YELLOW, CACA_BLACK); | |||
| caca_draw_thin_triangle(cv, xo, yo, xb, yb, xa, ya); | |||
| cucul_set_color_ansi(cv, CUCUL_RED, CUCUL_BLACK); | |||
| cucul_fill_triangle(cv, xa, ya, xb, yb, xc, yc, '#'); | |||
| cucul_set_color_ansi(cv, CUCUL_YELLOW, CUCUL_BLACK); | |||
| cucul_draw_thin_triangle(cv, xa, ya, xb, yb, xc, yc); | |||
| caca_set_color_ansi(cv, CACA_RED, CACA_BLACK); | |||
| caca_fill_triangle(cv, xa, ya, xb, yb, xc, yc, '#'); | |||
| caca_set_color_ansi(cv, CACA_YELLOW, CACA_BLACK); | |||
| caca_draw_thin_triangle(cv, xa, ya, xb, yb, xc, yc); | |||
| cucul_set_color_ansi(cv, CUCUL_BLUE, CUCUL_BLACK); | |||
| cucul_fill_triangle(cv, xo, yo, xb, yb, xc, yc, '%'); | |||
| cucul_set_color_ansi(cv, CUCUL_YELLOW, CUCUL_BLACK); | |||
| cucul_draw_thin_triangle(cv, xo, yo, xb, yb, xc, yc); | |||
| caca_set_color_ansi(cv, CACA_BLUE, CACA_BLACK); | |||
| caca_fill_triangle(cv, xo, yo, xb, yb, xc, yc, '%'); | |||
| caca_set_color_ansi(cv, CACA_YELLOW, CACA_BLACK); | |||
| caca_draw_thin_triangle(cv, xo, yo, xb, yb, xc, yc); | |||
| /* Draw a background triangle */ | |||
| xa = 2; | |||
| ya = 2; | |||
| xb = cucul_get_canvas_width(cv) - 3; | |||
| yb = cucul_get_canvas_height(cv) / 2; | |||
| xb = caca_get_canvas_width(cv) - 3; | |||
| yb = caca_get_canvas_height(cv) / 2; | |||
| xc = cucul_get_canvas_width(cv) / 3; | |||
| yc = cucul_get_canvas_height(cv) - 3; | |||
| xc = caca_get_canvas_width(cv) / 3; | |||
| yc = caca_get_canvas_height(cv) - 3; | |||
| cucul_set_color_ansi(cv, CUCUL_CYAN, CUCUL_BLACK); | |||
| cucul_draw_thin_triangle(cv, xa, ya, xb, yb, xc, yc); | |||
| caca_set_color_ansi(cv, CACA_CYAN, CACA_BLACK); | |||
| caca_draw_thin_triangle(cv, xa, ya, xb, yb, xc, yc); | |||
| xo = cucul_get_canvas_width(cv) / 2 + cos(0.027*i) * cucul_get_canvas_width(cv) / 3; | |||
| yo = cucul_get_canvas_height(cv) / 2 - sin(0.027*i) * cucul_get_canvas_height(cv) / 2; | |||
| xo = caca_get_canvas_width(cv) / 2 + cos(0.027*i) * caca_get_canvas_width(cv) / 3; | |||
| yo = caca_get_canvas_height(cv) / 2 - sin(0.027*i) * caca_get_canvas_height(cv) / 2; | |||
| cucul_draw_thin_line(cv, xa, ya, xo, yo); | |||
| cucul_draw_thin_line(cv, xb, yb, xo, yo); | |||
| cucul_draw_thin_line(cv, xc, yc, xo, yo); | |||
| caca_draw_thin_line(cv, xa, ya, xo, yo); | |||
| caca_draw_thin_line(cv, xb, yb, xo, yo); | |||
| caca_draw_thin_line(cv, xc, yc, xo, yo); | |||
| /* Draw a sprite on the pyramid */ | |||
| #if 0 | |||
| cucul_draw_sprite(cv, xo, yo, sprite, 0); | |||
| caca_draw_sprite(cv, xo, yo, sprite, 0); | |||
| #endif | |||
| /* Draw a trail behind the foreground sprite */ | |||
| for(j = i - 60; j < i; j++) | |||
| { | |||
| int delta = cucul_rand(-5, 6); | |||
| cucul_set_color_ansi(cv, cucul_rand(0, 16), cucul_rand(0, 16)); | |||
| cucul_put_char(cv, cucul_get_canvas_width(cv) / 2 | |||
| + cos(0.02*j) * (delta + cucul_get_canvas_width(cv) / 4), | |||
| cucul_get_canvas_height(cv) / 2 | |||
| + sin(0.02*j) * (delta + cucul_get_canvas_height(cv) / 3), | |||
| int delta = caca_rand(-5, 6); | |||
| caca_set_color_ansi(cv, caca_rand(0, 16), caca_rand(0, 16)); | |||
| caca_put_char(cv, caca_get_canvas_width(cv) / 2 | |||
| + cos(0.02*j) * (delta + caca_get_canvas_width(cv) / 4), | |||
| caca_get_canvas_height(cv) / 2 | |||
| + sin(0.02*j) * (delta + caca_get_canvas_height(cv) / 3), | |||
| '#'); | |||
| } | |||
| /* Draw foreground sprite */ | |||
| #if 0 | |||
| cucul_draw_sprite(cv, cucul_get_canvas_width(cv) / 2 + cos(0.02*i) * cucul_get_canvas_width(cv) / 4, | |||
| cucul_get_canvas_height(cv) / 2 + sin(0.02*i) * cucul_get_canvas_height(cv) / 3, | |||
| caca_draw_sprite(cv, caca_get_canvas_width(cv) / 2 + cos(0.02*i) * caca_get_canvas_width(cv) / 4, | |||
| caca_get_canvas_height(cv) / 2 + sin(0.02*i) * caca_get_canvas_height(cv) / 3, | |||
| sprite, 0); | |||
| #endif | |||
| } | |||
| static void demo_dots(void) | |||
| { | |||
| int xmax = cucul_get_canvas_width(cv); | |||
| int ymax = cucul_get_canvas_height(cv); | |||
| int xmax = caca_get_canvas_width(cv); | |||
| int ymax = caca_get_canvas_height(cv); | |||
| int i; | |||
| static char chars[10] = | |||
| { | |||
| @@ -364,136 +363,136 @@ static void demo_dots(void) | |||
| for(i = 1000; i--;) | |||
| { | |||
| /* Putpixel */ | |||
| cucul_set_color_ansi(cv, cucul_rand(0, 16), cucul_rand(0, 16)); | |||
| cucul_put_char(cv, cucul_rand(0, xmax), cucul_rand(0, ymax), | |||
| chars[cucul_rand(0, 9)]); | |||
| caca_set_color_ansi(cv, caca_rand(0, 16), caca_rand(0, 16)); | |||
| caca_put_char(cv, caca_rand(0, xmax), caca_rand(0, ymax), | |||
| chars[caca_rand(0, 9)]); | |||
| } | |||
| } | |||
| static void demo_lines(void) | |||
| { | |||
| int w = cucul_get_canvas_width(cv); | |||
| int h = cucul_get_canvas_height(cv); | |||
| int w = caca_get_canvas_width(cv); | |||
| int h = caca_get_canvas_height(cv); | |||
| int xa, ya, xb, yb; | |||
| if(bounds) | |||
| { | |||
| xa = cucul_rand(- w, 2 * w); ya = cucul_rand(- h, 2 * h); | |||
| xb = cucul_rand(- w, 2 * w); yb = cucul_rand(- h, 2 * h); | |||
| xa = caca_rand(- w, 2 * w); ya = caca_rand(- h, 2 * h); | |||
| xb = caca_rand(- w, 2 * w); yb = caca_rand(- h, 2 * h); | |||
| } | |||
| else | |||
| { | |||
| xa = cucul_rand(0, w); ya = cucul_rand(0, h); | |||
| xb = cucul_rand(0, w); yb = cucul_rand(0, h); | |||
| xa = caca_rand(0, w); ya = caca_rand(0, h); | |||
| xb = caca_rand(0, w); yb = caca_rand(0, h); | |||
| } | |||
| cucul_set_color_ansi(cv, cucul_rand(0, 16), CUCUL_BLACK); | |||
| caca_set_color_ansi(cv, caca_rand(0, 16), CACA_BLACK); | |||
| if(outline > 1) | |||
| cucul_draw_thin_line(cv, xa, ya, xb, yb); | |||
| caca_draw_thin_line(cv, xa, ya, xb, yb); | |||
| else | |||
| cucul_draw_line(cv, xa, ya, xb, yb, '#'); | |||
| caca_draw_line(cv, xa, ya, xb, yb, '#'); | |||
| } | |||
| static void demo_boxes(void) | |||
| { | |||
| int w = cucul_get_canvas_width(cv); | |||
| int h = cucul_get_canvas_height(cv); | |||
| int w = caca_get_canvas_width(cv); | |||
| int h = caca_get_canvas_height(cv); | |||
| int xa, ya, xb, yb; | |||
| if(bounds) | |||
| { | |||
| xa = cucul_rand(- w, 2 * w); ya = cucul_rand(- h, 2 * h); | |||
| xb = cucul_rand(- w, 2 * w); yb = cucul_rand(- h, 2 * h); | |||
| xa = caca_rand(- w, 2 * w); ya = caca_rand(- h, 2 * h); | |||
| xb = caca_rand(- w, 2 * w); yb = caca_rand(- h, 2 * h); | |||
| } | |||
| else | |||
| { | |||
| xa = cucul_rand(0, w); ya = cucul_rand(0, h); | |||
| xb = cucul_rand(0, w); yb = cucul_rand(0, h); | |||
| xa = caca_rand(0, w); ya = caca_rand(0, h); | |||
| xb = caca_rand(0, w); yb = caca_rand(0, h); | |||
| } | |||
| cucul_set_color_ansi(cv, cucul_rand(0, 16), cucul_rand(0, 16)); | |||
| cucul_fill_box(cv, xa, ya, xb, yb, '#'); | |||
| caca_set_color_ansi(cv, caca_rand(0, 16), caca_rand(0, 16)); | |||
| caca_fill_box(cv, xa, ya, xb, yb, '#'); | |||
| cucul_set_color_ansi(cv, cucul_rand(0, 16), CUCUL_BLACK); | |||
| caca_set_color_ansi(cv, caca_rand(0, 16), CACA_BLACK); | |||
| if(outline == 2) | |||
| cucul_draw_thin_box(cv, xa, ya, xb, yb); | |||
| caca_draw_thin_box(cv, xa, ya, xb, yb); | |||
| else if(outline == 1) | |||
| cucul_draw_box(cv, xa, ya, xb, yb, '#'); | |||
| caca_draw_box(cv, xa, ya, xb, yb, '#'); | |||
| } | |||
| static void demo_ellipses(void) | |||
| { | |||
| int w = cucul_get_canvas_width(cv); | |||
| int h = cucul_get_canvas_height(cv); | |||
| int w = caca_get_canvas_width(cv); | |||
| int h = caca_get_canvas_height(cv); | |||
| int x, y, a, b; | |||
| if(bounds) | |||
| { | |||
| x = cucul_rand(- w, 2 * w); y = cucul_rand(- h, 2 * h); | |||
| a = cucul_rand(0, w); b = cucul_rand(0, h); | |||
| x = caca_rand(- w, 2 * w); y = caca_rand(- h, 2 * h); | |||
| a = caca_rand(0, w); b = caca_rand(0, h); | |||
| } | |||
| else | |||
| { | |||
| do | |||
| { | |||
| x = cucul_rand(0, w); y = cucul_rand(0, h); | |||
| a = cucul_rand(0, w); b = cucul_rand(0, h); | |||
| x = caca_rand(0, w); y = caca_rand(0, h); | |||
| a = caca_rand(0, w); b = caca_rand(0, h); | |||
| } while(x - a < 0 || x + a >= w || y - b < 0 || y + b >= h); | |||
| } | |||
| cucul_set_color_ansi(cv, cucul_rand(0, 16), cucul_rand(0, 16)); | |||
| cucul_fill_ellipse(cv, x, y, a, b, '#'); | |||
| caca_set_color_ansi(cv, caca_rand(0, 16), caca_rand(0, 16)); | |||
| caca_fill_ellipse(cv, x, y, a, b, '#'); | |||
| cucul_set_color_ansi(cv, cucul_rand(0, 16), CUCUL_BLACK); | |||
| caca_set_color_ansi(cv, caca_rand(0, 16), CACA_BLACK); | |||
| if(outline == 2) | |||
| cucul_draw_thin_ellipse(cv, x, y, a, b); | |||
| caca_draw_thin_ellipse(cv, x, y, a, b); | |||
| else if(outline == 1) | |||
| cucul_draw_ellipse(cv, x, y, a, b, '#'); | |||
| caca_draw_ellipse(cv, x, y, a, b, '#'); | |||
| } | |||
| static void demo_triangles(void) | |||
| { | |||
| int w = cucul_get_canvas_width(cv); | |||
| int h = cucul_get_canvas_height(cv); | |||
| int w = caca_get_canvas_width(cv); | |||
| int h = caca_get_canvas_height(cv); | |||
| int xa, ya, xb, yb, xc, yc; | |||
| if(bounds) | |||
| { | |||
| xa = cucul_rand(- w, 2 * w); ya = cucul_rand(- h, 2 * h); | |||
| xb = cucul_rand(- w, 2 * w); yb = cucul_rand(- h, 2 * h); | |||
| xc = cucul_rand(- w, 2 * w); yc = cucul_rand(- h, 2 * h); | |||
| xa = caca_rand(- w, 2 * w); ya = caca_rand(- h, 2 * h); | |||
| xb = caca_rand(- w, 2 * w); yb = caca_rand(- h, 2 * h); | |||
| xc = caca_rand(- w, 2 * w); yc = caca_rand(- h, 2 * h); | |||
| } | |||
| else | |||
| { | |||
| xa = cucul_rand(0, w); ya = cucul_rand(0, h); | |||
| xb = cucul_rand(0, w); yb = cucul_rand(0, h); | |||
| xc = cucul_rand(0, w); yc = cucul_rand(0, h); | |||
| xa = caca_rand(0, w); ya = caca_rand(0, h); | |||
| xb = caca_rand(0, w); yb = caca_rand(0, h); | |||
| xc = caca_rand(0, w); yc = caca_rand(0, h); | |||
| } | |||
| cucul_set_color_ansi(cv, cucul_rand(0, 16), cucul_rand(0, 16)); | |||
| cucul_fill_triangle(cv, xa, ya, xb, yb, xc, yc, '#'); | |||
| caca_set_color_ansi(cv, caca_rand(0, 16), caca_rand(0, 16)); | |||
| caca_fill_triangle(cv, xa, ya, xb, yb, xc, yc, '#'); | |||
| cucul_set_color_ansi(cv, cucul_rand(0, 16), CUCUL_BLACK); | |||
| caca_set_color_ansi(cv, caca_rand(0, 16), CACA_BLACK); | |||
| if(outline == 2) | |||
| cucul_draw_thin_triangle(cv, xa, ya, xb, yb, xc, yc); | |||
| caca_draw_thin_triangle(cv, xa, ya, xb, yb, xc, yc); | |||
| else if(outline == 1) | |||
| cucul_draw_triangle(cv, xa, ya, xb, yb, xc, yc, '#'); | |||
| caca_draw_triangle(cv, xa, ya, xb, yb, xc, yc, '#'); | |||
| } | |||
| #if 0 | |||
| static void demo_sprites(void) | |||
| { | |||
| cucul_draw_sprite(cv, cucul_rand(0, cucul_get_canvas_width(cv)), | |||
| cucul_rand(0, cucul_get_canvas_height(cv)), sprite, 0); | |||
| caca_draw_sprite(cv, caca_rand(0, caca_get_canvas_width(cv)), | |||
| caca_rand(0, caca_get_canvas_height(cv)), sprite, 0); | |||
| } | |||
| #endif | |||
| #if 0 | |||
| static void demo_render(void) | |||
| { | |||
| cucul_dither_t *dither; | |||
| caca_dither_t *dither; | |||
| //short buffer[256*256]; | |||
| //short *dest = buffer; | |||
| int buffer[256*256]; | |||
| @@ -510,12 +509,12 @@ static void demo_render(void) | |||
| //*dest++ = ((x >> 3) << 11) | ((y >> 2) << 5) | ((z >> 3)); | |||
| *dest++ = (x << 16) | (y << 8) | (z); | |||
| } | |||
| cucul_set_dither_invert(dither, 1); | |||
| //dither = cucul_create_dither(16, 256, 256, 2 * 256, 0xf800, 0x07e0, 0x001f, 0x0000); | |||
| dither = cucul_create_dither(32, 256, 256, 4 * 256, 0x00ff0000, 0x0000ff00, 0x000000ff, 0xff000000); | |||
| cucul_dither_bitmap(cv, 0, 0, cucul_get_canvas_width(cv), cucul_get_canvas_height(cv), | |||
| caca_set_dither_invert(dither, 1); | |||
| //dither = caca_create_dither(16, 256, 256, 2 * 256, 0xf800, 0x07e0, 0x001f, 0x0000); | |||
| dither = caca_create_dither(32, 256, 256, 4 * 256, 0x00ff0000, 0x0000ff00, 0x000000ff, 0xff000000); | |||
| caca_dither_bitmap(cv, 0, 0, caca_get_canvas_width(cv), caca_get_canvas_height(cv), | |||
| dither, buffer); | |||
| cucul_free_dither(dither); | |||
| caca_free_dither(dither); | |||
| } | |||
| #endif | |||
| @@ -523,7 +522,7 @@ static void draw_circle(int *buffer, int xo, int yo, int r, int mask, int val); | |||
| static void demo_render(void) | |||
| { | |||
| cucul_dither_t *dither; | |||
| caca_dither_t *dither; | |||
| int buffer[256*256]; | |||
| int *dest; | |||
| int x, y, z, xo, yo; | |||
| @@ -556,10 +555,10 @@ static void demo_render(void) | |||
| for(z = 0; z < 240; z++) | |||
| draw_circle(buffer, xo, yo, z, 0x000000ff, 200); | |||
| dither = cucul_create_dither(32, 256, 256, 4 * 256, 0x00ff0000, 0x0000ff00, 0x000000ff, 0xff000000); | |||
| cucul_set_dither_gamma(dither, -1.0); | |||
| cucul_dither_bitmap(cv, 0, 0, cucul_get_canvas_width(cv), cucul_get_canvas_height(cv), dither, (char *)buffer); | |||
| cucul_free_dither(dither); | |||
| dither = caca_create_dither(32, 256, 256, 4 * 256, 0x00ff0000, 0x0000ff00, 0x000000ff, 0xff000000); | |||
| caca_set_dither_gamma(dither, -1.0); | |||
| caca_dither_bitmap(cv, 0, 0, caca_get_canvas_width(cv), caca_get_canvas_height(cv), dither, (char *)buffer); | |||
| caca_free_dither(dither); | |||
| } | |||
| static void draw_circle(int *buffer, int x, int y, int r, int mask, int val) | |||
| @@ -18,7 +18,6 @@ | |||
| # include <stdio.h> | |||
| #endif | |||
| #include "cucul.h" | |||
| #include "caca.h" | |||
| #define XRATIO 100*100 | |||
| @@ -27,20 +26,20 @@ | |||
| unsigned int points[] = | |||
| { | |||
| CUCUL_BLACK, CUCUL_DARKGRAY, CUCUL_LIGHTGRAY, | |||
| CUCUL_WHITE, CUCUL_RED, CUCUL_LIGHTRED | |||
| CACA_BLACK, CACA_DARKGRAY, CACA_LIGHTGRAY, | |||
| CACA_WHITE, CACA_RED, CACA_LIGHTRED | |||
| }; | |||
| char density[] = " ',+:;o&%w$W@#"; | |||
| int main(int argc, char *argv[]) | |||
| { | |||
| cucul_canvas_t *cv; | |||
| caca_canvas_t *cv; | |||
| caca_display_t *dp; | |||
| int neara, dista, nearb, distb, dist; | |||
| int x, y; | |||
| cv = cucul_create_canvas(80, 24); | |||
| cv = caca_create_canvas(80, 24); | |||
| if(cv == NULL) | |||
| { | |||
| printf("Failed to create canvas\n"); | |||
| @@ -67,7 +66,7 @@ int main(int argc, char *argv[]) | |||
| /* distance to 40% */ | |||
| dist = XRATIO * (x - 40) * (x - 40) + YRATIO * y * y; | |||
| if(cucul_rand(-FUZZY, FUZZY+1) + dist < dista) | |||
| if(caca_rand(-FUZZY, FUZZY+1) + dist < dista) | |||
| { | |||
| nearb = neara; distb = dista; neara = 1; dista = dist; | |||
| } | |||
| @@ -78,22 +77,22 @@ int main(int argc, char *argv[]) | |||
| /* check dist to 70% */ | |||
| dist = XRATIO * (x - 70) * (x - 70) + YRATIO * y * y; | |||
| if(cucul_rand(-FUZZY, FUZZY+1) + dist < dista) | |||
| if(caca_rand(-FUZZY, FUZZY+1) + dist < dista) | |||
| { | |||
| nearb = neara; distb = dista; neara = 2; dista = dist; | |||
| } | |||
| else if(cucul_rand(-FUZZY, FUZZY+1) + dist < distb) | |||
| else if(caca_rand(-FUZZY, FUZZY+1) + dist < distb) | |||
| { | |||
| nearb = 2; distb = dist; | |||
| } | |||
| /* check dist to white */ | |||
| dist = XRATIO * (x - 100) * (x - 100) + YRATIO * y * y; | |||
| if(cucul_rand(-FUZZY, FUZZY+1) + dist < dista) | |||
| if(caca_rand(-FUZZY, FUZZY+1) + dist < dista) | |||
| { | |||
| nearb = neara; distb = dista; neara = 3; dista = dist; | |||
| } | |||
| else if(cucul_rand(-FUZZY, FUZZY+1) + dist < distb) | |||
| else if(caca_rand(-FUZZY, FUZZY+1) + dist < distb) | |||
| { | |||
| nearb = 3; distb = dist; | |||
| } | |||
| @@ -102,11 +101,11 @@ int main(int argc, char *argv[]) | |||
| /* check dist to dark */ | |||
| dist = XRATIO * (x - 40) * (x - 40) + YRATIO * (y - 100) * (y - 100); | |||
| dist = dist * 12 / 16; | |||
| if(cucul_rand(-FUZZY, FUZZY+1) + dist < dista) | |||
| if(caca_rand(-FUZZY, FUZZY+1) + dist < dista) | |||
| { | |||
| nearb = neara; distb = dista; neara = 4; dista = dist; | |||
| } | |||
| else if(cucul_rand(-FUZZY, FUZZY+1) + dist < distb) | |||
| else if(caca_rand(-FUZZY, FUZZY+1) + dist < distb) | |||
| { | |||
| nearb = 4; distb = dist; | |||
| } | |||
| @@ -114,11 +113,11 @@ int main(int argc, char *argv[]) | |||
| /* check dist to light */ | |||
| dist = XRATIO * (x - 100) * (x - 100) + YRATIO * (y - 100) * (y - 100); | |||
| dist = dist * 8 / 16; | |||
| if(cucul_rand(-FUZZY, FUZZY+1) + dist < dista) | |||
| if(caca_rand(-FUZZY, FUZZY+1) + dist < dista) | |||
| { | |||
| nearb = neara; distb = dista; neara = 5; dista = dist; | |||
| } | |||
| else if(cucul_rand(-FUZZY, FUZZY+1) + dist < distb) | |||
| else if(caca_rand(-FUZZY, FUZZY+1) + dist < distb) | |||
| { | |||
| nearb = 5; distb = dist; | |||
| } | |||
| @@ -129,10 +128,10 @@ int main(int argc, char *argv[]) | |||
| ch = density[distb * 2 * 13 / (dista + distb)]; | |||
| else | |||
| ch = density[dista * 2 * 13 / (dista + distb)]; | |||
| cucul_set_color_ansi(cv, points[nearb], points[neara]); | |||
| caca_set_color_ansi(cv, points[nearb], points[neara]); | |||
| cucul_put_char(cv, x * cucul_get_canvas_width(cv) / 100, | |||
| (100 - y) * cucul_get_canvas_height(cv) / 100, ch); | |||
| caca_put_char(cv, x * caca_get_canvas_width(cv) / 100, | |||
| (100 - y) * caca_get_canvas_height(cv) / 100, ch); | |||
| } | |||
| caca_refresh_display(dp); | |||
| @@ -140,7 +139,7 @@ int main(int argc, char *argv[]) | |||
| caca_get_event(dp, CACA_EVENT_KEY_PRESS, NULL, -1); | |||
| caca_free_display(dp); | |||
| cucul_free_canvas(cv); | |||
| caca_free_canvas(cv); | |||
| return 0; | |||
| } | |||
| @@ -19,14 +19,13 @@ | |||
| # include <stdio.h> | |||
| #endif | |||
| #include "cucul.h" | |||
| #include "caca.h" | |||
| int main(int argc, char *argv[]) | |||
| { | |||
| char const * const *list; | |||
| caca_display_t *dp; | |||
| cucul_canvas_t *cv; | |||
| caca_canvas_t *cv; | |||
| list = caca_get_display_driver_list(); | |||
| @@ -38,14 +37,14 @@ int main(int argc, char *argv[]) | |||
| } | |||
| cv = caca_get_canvas(dp); | |||
| cucul_set_color_ansi(cv, CUCUL_WHITE, CUCUL_BLACK); | |||
| caca_set_color_ansi(cv, CACA_WHITE, CACA_BLACK); | |||
| while(1) | |||
| { | |||
| char const *driver; | |||
| int i, cur = 0; | |||
| cucul_put_str(cv, 1, 0, "Available drivers:"); | |||
| caca_put_str(cv, 1, 0, "Available drivers:"); | |||
| driver = caca_get_display_driver(dp); | |||
| @@ -55,12 +54,12 @@ int main(int argc, char *argv[]) | |||
| if(match) | |||
| cur = i; | |||
| cucul_draw_line(cv, 0, i + 2, 9999, i + 2, ' '); | |||
| cucul_printf(cv, 2, i + 2, "%c %s (%s)", | |||
| caca_draw_line(cv, 0, i + 2, 9999, i + 2, ' '); | |||
| caca_printf(cv, 2, i + 2, "%c %s (%s)", | |||
| match ? '*' : ' ', list[i], list[i + 1]); | |||
| } | |||
| cucul_put_str(cv, 1, i + 2, "Switching driver in 5 seconds"); | |||
| caca_put_str(cv, 1, i + 2, "Switching driver in 5 seconds"); | |||
| caca_refresh_display(dp); | |||
| @@ -20,10 +20,9 @@ | |||
| # include <stdlib.h> | |||
| #endif | |||
| #include "cucul.h" | |||
| #include "caca.h" | |||
| static cucul_canvas_t *cv; | |||
| static caca_canvas_t *cv; | |||
| static caca_display_t *dp; | |||
| static void print_event(int, int, caca_event_t *); | |||
| @@ -33,7 +32,7 @@ int main(int argc, char **argv) | |||
| caca_event_t *events; | |||
| int i, h, quit; | |||
| cv = cucul_create_canvas(80, 24); | |||
| cv = caca_create_canvas(80, 24); | |||
| if(cv == NULL) | |||
| { | |||
| printf("Failed to create canvas\n"); | |||
| @@ -47,13 +46,13 @@ int main(int argc, char **argv) | |||
| return 1; | |||
| } | |||
| h = cucul_get_canvas_height(cv) - 1; | |||
| h = caca_get_canvas_height(cv) - 1; | |||
| cucul_set_color_ansi(cv, CUCUL_WHITE, CUCUL_BLUE); | |||
| cucul_draw_line(cv, 0, 0, cucul_get_canvas_width(cv) - 1, 0, ' '); | |||
| caca_set_color_ansi(cv, CACA_WHITE, CACA_BLUE); | |||
| caca_draw_line(cv, 0, 0, caca_get_canvas_width(cv) - 1, 0, ' '); | |||
| cucul_draw_line(cv, 0, h, cucul_get_canvas_width(cv) - 1, h, ' '); | |||
| cucul_put_str(cv, 0, h, "type \"quit\" to exit"); | |||
| caca_draw_line(cv, 0, h, caca_get_canvas_width(cv) - 1, h, ' '); | |||
| caca_put_str(cv, 0, h, "type \"quit\" to exit"); | |||
| caca_refresh_display(dp); | |||
| @@ -91,19 +90,19 @@ int main(int argc, char **argv) | |||
| } | |||
| while(ret); | |||
| cucul_set_color_ansi(cv, CUCUL_LIGHTGRAY, CUCUL_BLACK); | |||
| cucul_clear_canvas(cv); | |||
| caca_set_color_ansi(cv, CACA_LIGHTGRAY, CACA_BLACK); | |||
| caca_clear_canvas(cv); | |||
| /* Print current event */ | |||
| cucul_set_color_ansi(cv, CUCUL_WHITE, CUCUL_BLUE); | |||
| cucul_draw_line(cv, 0, 0, cucul_get_canvas_width(cv) - 1, 0, ' '); | |||
| caca_set_color_ansi(cv, CACA_WHITE, CACA_BLUE); | |||
| caca_draw_line(cv, 0, 0, caca_get_canvas_width(cv) - 1, 0, ' '); | |||
| print_event(0, 0, events); | |||
| cucul_draw_line(cv, 0, h, cucul_get_canvas_width(cv) - 1, h, ' '); | |||
| cucul_printf(cv, 0, h, "type \"quit\" to exit: %s", quit_string[quit]); | |||
| caca_draw_line(cv, 0, h, caca_get_canvas_width(cv) - 1, h, ' '); | |||
| caca_printf(cv, 0, h, "type \"quit\" to exit: %s", quit_string[quit]); | |||
| /* Print previous events */ | |||
| cucul_set_color_ansi(cv, CUCUL_WHITE, CUCUL_BLACK); | |||
| caca_set_color_ansi(cv, CACA_WHITE, CACA_BLACK); | |||
| for(i = 1; i < h && caca_get_event_type(&events[i]); i++) | |||
| print_event(0, i, events + i); | |||
| @@ -113,7 +112,7 @@ int main(int argc, char **argv) | |||
| /* Clean up */ | |||
| free(events); | |||
| caca_free_display(dp); | |||
| cucul_free_canvas(cv); | |||
| caca_free_canvas(cv); | |||
| return 0; | |||
| } | |||
| @@ -125,40 +124,40 @@ static void print_event(int x, int y, caca_event_t *ev) | |||
| switch(caca_get_event_type(ev)) | |||
| { | |||
| case CACA_EVENT_NONE: | |||
| cucul_printf(cv, x, y, "CACA_EVENT_NONE"); | |||
| caca_printf(cv, x, y, "CACA_EVENT_NONE"); | |||
| break; | |||
| case CACA_EVENT_KEY_PRESS: | |||
| character = caca_get_event_key_ch(ev); | |||
| cucul_printf(cv, x, y, "CACA_EVENT_KEY_PRESS 0x%02x (%c)", character, | |||
| caca_printf(cv, x, y, "CACA_EVENT_KEY_PRESS 0x%02x (%c)", character, | |||
| (character > 0x1f && character < 0x80) ? character : '?'); | |||
| break; | |||
| case CACA_EVENT_KEY_RELEASE: | |||
| character = caca_get_event_key_ch(ev); | |||
| cucul_printf(cv, x, y, "CACA_EVENT_KEY_RELEASE 0x%02x (%c)", character, | |||
| caca_printf(cv, x, y, "CACA_EVENT_KEY_RELEASE 0x%02x (%c)", character, | |||
| (character > 0x1f && character < 0x80) ? character : '?'); | |||
| break; | |||
| case CACA_EVENT_MOUSE_MOTION: | |||
| cucul_printf(cv, x, y, "CACA_EVENT_MOUSE_MOTION %u %u", | |||
| caca_printf(cv, x, y, "CACA_EVENT_MOUSE_MOTION %u %u", | |||
| caca_get_event_mouse_x(ev), caca_get_event_mouse_y(ev)); | |||
| break; | |||
| case CACA_EVENT_MOUSE_PRESS: | |||
| cucul_printf(cv, x, y, "CACA_EVENT_MOUSE_PRESS %u", | |||
| caca_printf(cv, x, y, "CACA_EVENT_MOUSE_PRESS %u", | |||
| caca_get_event_mouse_button(ev)); | |||
| break; | |||
| case CACA_EVENT_MOUSE_RELEASE: | |||
| cucul_printf(cv, x, y, "CACA_EVENT_MOUSE_RELEASE %u", | |||
| caca_printf(cv, x, y, "CACA_EVENT_MOUSE_RELEASE %u", | |||
| caca_get_event_mouse_button(ev)); | |||
| break; | |||
| case CACA_EVENT_RESIZE: | |||
| cucul_printf(cv, x, y, "CACA_EVENT_RESIZE %u %u", | |||
| caca_printf(cv, x, y, "CACA_EVENT_RESIZE %u %u", | |||
| caca_get_event_resize_width(ev), | |||
| caca_get_event_resize_height(ev)); | |||
| break; | |||
| case CACA_EVENT_QUIT: | |||
| cucul_printf(cv, x, y, "CACA_EVENT_QUIT"); | |||
| caca_printf(cv, x, y, "CACA_EVENT_QUIT"); | |||
| break; | |||
| default: | |||
| cucul_printf(cv, x, y, "CACA_EVENT_UNKNOWN"); | |||
| caca_printf(cv, x, y, "CACA_EVENT_UNKNOWN"); | |||
| } | |||
| } | |||
| @@ -1,5 +1,5 @@ | |||
| /* | |||
| * export libcucul export test program | |||
| * export libcaca export test program | |||
| * Copyright (c) 2006 Sam Hocevar <sam@zoy.org> | |||
| * All Rights Reserved | |||
| * | |||
| @@ -20,7 +20,7 @@ | |||
| # include <string.h> | |||
| #endif | |||
| #include "cucul.h" | |||
| #include "caca.h" | |||
| #define WIDTH 80 | |||
| #define HEIGHT 32 | |||
| @@ -29,15 +29,15 @@ uint32_t pixels[256*256]; | |||
| int main(int argc, char *argv[]) | |||
| { | |||
| cucul_canvas_t *cv; | |||
| cucul_dither_t *dither; | |||
| caca_canvas_t *cv; | |||
| caca_dither_t *dither; | |||
| void *buffer; | |||
| char *file, *format; | |||
| char const * const * exports, * const * p; | |||
| size_t len; | |||
| int x, y; | |||
| exports = cucul_get_export_list(); | |||
| exports = caca_get_export_list(); | |||
| if(argc < 2 || argc > 3) | |||
| { | |||
| @@ -75,8 +75,8 @@ int main(int argc, char *argv[]) | |||
| if(file) | |||
| { | |||
| cv = cucul_create_canvas(0, 0); | |||
| if(cucul_import_file(cv, file, "") < 0) | |||
| cv = caca_create_canvas(0, 0); | |||
| if(caca_import_file(cv, file, "") < 0) | |||
| { | |||
| fprintf(stderr, "%s: `%s' has unknown format\n", argv[0], file); | |||
| exit(-1); | |||
| @@ -84,7 +84,7 @@ int main(int argc, char *argv[]) | |||
| } | |||
| else | |||
| { | |||
| cv = cucul_create_canvas(WIDTH, HEIGHT); | |||
| cv = caca_create_canvas(WIDTH, HEIGHT); | |||
| for(y = 0; y < 256; y++) | |||
| { | |||
| @@ -97,62 +97,62 @@ int main(int argc, char *argv[]) | |||
| } | |||
| } | |||
| dither = cucul_create_dither(32, 256, 256, 4 * 256, | |||
| dither = caca_create_dither(32, 256, 256, 4 * 256, | |||
| 0x00ff0000, 0x0000ff00, 0x000000ff, 0x0); | |||
| if(!strcmp(format, "ansi") || !strcmp(format, "utf8")) | |||
| cucul_set_dither_charset(dither, "shades"); | |||
| cucul_dither_bitmap(cv, 0, 0, cucul_get_canvas_width(cv), | |||
| cucul_get_canvas_height(cv), dither, pixels); | |||
| cucul_free_dither(dither); | |||
| caca_set_dither_charset(dither, "shades"); | |||
| caca_dither_bitmap(cv, 0, 0, caca_get_canvas_width(cv), | |||
| caca_get_canvas_height(cv), dither, pixels); | |||
| caca_free_dither(dither); | |||
| cucul_set_color_ansi(cv, CUCUL_WHITE, CUCUL_BLACK); | |||
| cucul_draw_thin_box(cv, 0, 0, WIDTH - 1, HEIGHT - 1); | |||
| caca_set_color_ansi(cv, CACA_WHITE, CACA_BLACK); | |||
| caca_draw_thin_box(cv, 0, 0, WIDTH - 1, HEIGHT - 1); | |||
| cucul_set_color_ansi(cv, CUCUL_BLACK, CUCUL_WHITE); | |||
| cucul_fill_ellipse(cv, WIDTH / 2, HEIGHT / 2, | |||
| caca_set_color_ansi(cv, CACA_BLACK, CACA_WHITE); | |||
| caca_fill_ellipse(cv, WIDTH / 2, HEIGHT / 2, | |||
| WIDTH / 4, HEIGHT / 4, ' '); | |||
| cucul_set_color_ansi(cv, CUCUL_LIGHTGRAY, CUCUL_BLACK); | |||
| cucul_put_str(cv, WIDTH / 2 - 12, HEIGHT / 2 - 6, | |||
| caca_set_color_ansi(cv, CACA_LIGHTGRAY, CACA_BLACK); | |||
| caca_put_str(cv, WIDTH / 2 - 12, HEIGHT / 2 - 6, | |||
| " lightgray on black "); | |||
| cucul_set_color_ansi(cv, CUCUL_DEFAULT, CUCUL_TRANSPARENT); | |||
| cucul_put_str(cv, WIDTH / 2 - 12, HEIGHT / 2 - 5, | |||
| caca_set_color_ansi(cv, CACA_DEFAULT, CACA_TRANSPARENT); | |||
| caca_put_str(cv, WIDTH / 2 - 12, HEIGHT / 2 - 5, | |||
| " default on transparent "); | |||
| cucul_set_color_ansi(cv, CUCUL_BLACK, CUCUL_WHITE); | |||
| cucul_put_str(cv, WIDTH / 2 - 12, HEIGHT / 2 - 4, | |||
| caca_set_color_ansi(cv, CACA_BLACK, CACA_WHITE); | |||
| caca_put_str(cv, WIDTH / 2 - 12, HEIGHT / 2 - 4, | |||
| " black on white "); | |||
| cucul_set_color_ansi(cv, CUCUL_BLACK, CUCUL_WHITE); | |||
| cucul_put_str(cv, WIDTH / 2 - 8, HEIGHT / 2 - 3, "[<><><><> <>--<>]"); | |||
| cucul_put_str(cv, WIDTH / 2 - 8, HEIGHT / 2 - 2, "[ドラゴン ボーレ]"); | |||
| cucul_put_str(cv, WIDTH / 2 - 7, HEIGHT / 2 + 2, "äβç ░▒▓█▓▒░ ΔЗҒ"); | |||
| cucul_put_str(cv, WIDTH / 2 - 5, HEIGHT / 2 + 4, "(\") \\o/ <&>"); | |||
| cucul_set_attr(cv, CUCUL_BOLD); | |||
| cucul_put_str(cv, WIDTH / 2 - 16, HEIGHT / 2 + 3, "Bold"); | |||
| cucul_set_attr(cv, CUCUL_BLINK); | |||
| cucul_put_str(cv, WIDTH / 2 - 9, HEIGHT / 2 + 3, "Blink"); | |||
| cucul_set_attr(cv, CUCUL_ITALICS); | |||
| cucul_put_str(cv, WIDTH / 2 - 1, HEIGHT / 2 + 3, "Italics"); | |||
| cucul_set_attr(cv, CUCUL_UNDERLINE); | |||
| cucul_put_str(cv, WIDTH / 2 + 8, HEIGHT / 2 + 3, "Underline"); | |||
| cucul_set_attr(cv, 0); | |||
| cucul_set_color_ansi(cv, CUCUL_WHITE, CUCUL_LIGHTBLUE); | |||
| cucul_put_str(cv, WIDTH / 2 - 7, HEIGHT / 2, " LIBCACA "); | |||
| caca_set_color_ansi(cv, CACA_BLACK, CACA_WHITE); | |||
| caca_put_str(cv, WIDTH / 2 - 8, HEIGHT / 2 - 3, "[<><><><> <>--<>]"); | |||
| caca_put_str(cv, WIDTH / 2 - 8, HEIGHT / 2 - 2, "[ドラゴン ボーレ]"); | |||
| caca_put_str(cv, WIDTH / 2 - 7, HEIGHT / 2 + 2, "äβç ░▒▓█▓▒░ ΔЗҒ"); | |||
| caca_put_str(cv, WIDTH / 2 - 5, HEIGHT / 2 + 4, "(\") \\o/ <&>"); | |||
| caca_set_attr(cv, CACA_BOLD); | |||
| caca_put_str(cv, WIDTH / 2 - 16, HEIGHT / 2 + 3, "Bold"); | |||
| caca_set_attr(cv, CACA_BLINK); | |||
| caca_put_str(cv, WIDTH / 2 - 9, HEIGHT / 2 + 3, "Blink"); | |||
| caca_set_attr(cv, CACA_ITALICS); | |||
| caca_put_str(cv, WIDTH / 2 - 1, HEIGHT / 2 + 3, "Italics"); | |||
| caca_set_attr(cv, CACA_UNDERLINE); | |||
| caca_put_str(cv, WIDTH / 2 + 8, HEIGHT / 2 + 3, "Underline"); | |||
| caca_set_attr(cv, 0); | |||
| caca_set_color_ansi(cv, CACA_WHITE, CACA_LIGHTBLUE); | |||
| caca_put_str(cv, WIDTH / 2 - 7, HEIGHT / 2, " LIBCACA "); | |||
| for(x = 0; x < 16; x++) | |||
| { | |||
| cucul_set_color_argb(cv, 0xff00 | x, 0xf00f | (x << 4)); | |||
| cucul_put_char(cv, WIDTH / 2 - 7 + x, HEIGHT / 2 + 6, '#'); | |||
| caca_set_color_argb(cv, 0xff00 | x, 0xf00f | (x << 4)); | |||
| caca_put_char(cv, WIDTH / 2 - 7 + x, HEIGHT / 2 + 6, '#'); | |||
| } | |||
| } | |||
| buffer = cucul_export_memory(cv, format, &len); | |||
| buffer = caca_export_memory(cv, format, &len); | |||
| fwrite(buffer, len, 1, stdout); | |||
| free(buffer); | |||
| cucul_free_canvas(cv); | |||
| caca_free_canvas(cv); | |||
| return 0; | |||
| } | |||
| @@ -1,5 +1,5 @@ | |||
| /* | |||
| * figfont libcucul FIGfont test program | |||
| * figfont libcaca FIGfont test program | |||
| * Copyright (c) 2007 Sam Hocevar <sam@zoy.org> | |||
| * All Rights Reserved | |||
| * | |||
| @@ -19,11 +19,11 @@ | |||
| # include <stdlib.h> | |||
| #endif | |||
| #include "cucul.h" | |||
| #include "caca.h" | |||
| int main(int argc, char *argv[]) | |||
| { | |||
| cucul_canvas_t *cv; | |||
| caca_canvas_t *cv; | |||
| void *buffer; | |||
| size_t len; | |||
| uint8_t color = 0; | |||
| @@ -34,8 +34,8 @@ int main(int argc, char *argv[]) | |||
| return -1; | |||
| } | |||
| cv = cucul_create_canvas(0, 0); | |||
| if(cucul_canvas_set_figfont(cv, argv[1])) | |||
| cv = caca_create_canvas(0, 0); | |||
| if(caca_canvas_set_figfont(cv, argv[1])) | |||
| { | |||
| fprintf(stderr, "Could not open font\n"); | |||
| return -1; | |||
| @@ -43,15 +43,15 @@ int main(int argc, char *argv[]) | |||
| while(argv[2][0]) | |||
| { | |||
| cucul_set_color_ansi(cv, 1 + ((color += 4) % 15), CUCUL_TRANSPARENT); | |||
| cucul_put_figchar(cv, argv[2]++[0]); | |||
| caca_set_color_ansi(cv, 1 + ((color += 4) % 15), CACA_TRANSPARENT); | |||
| caca_put_figchar(cv, argv[2]++[0]); | |||
| } | |||
| buffer = cucul_export_memory(cv, "utf8", &len); | |||
| buffer = caca_export_memory(cv, "utf8", &len); | |||
| fwrite(buffer, len, 1, stdout); | |||
| free(buffer); | |||
| cucul_free_canvas(cv); | |||
| caca_free_canvas(cv); | |||
| return 0; | |||
| } | |||
| @@ -1,5 +1,5 @@ | |||
| /* | |||
| * font libcucul font test program | |||
| * font libcaca font test program | |||
| * Copyright (c) 2006 Sam Hocevar <sam@zoy.org> | |||
| * All Rights Reserved | |||
| * | |||
| @@ -24,21 +24,20 @@ | |||
| # include <string.h> | |||
| #endif | |||
| #include "cucul.h" | |||
| #include "caca.h" | |||
| int main(int argc, char *argv[]) | |||
| { | |||
| cucul_canvas_t *cv; | |||
| caca_canvas_t *cv; | |||
| caca_display_t *dp; | |||
| cucul_font_t *f; | |||
| cucul_dither_t *d; | |||
| caca_font_t *f; | |||
| caca_dither_t *d; | |||
| uint8_t *buf; | |||
| unsigned int w, h; | |||
| char const * const * fonts; | |||
| /* Create a canvas */ | |||
| cv = cucul_create_canvas(8, 2); | |||
| cv = caca_create_canvas(8, 2); | |||
| if(cv == NULL) | |||
| { | |||
| printf("Can't create canvas\n"); | |||
| @@ -47,21 +46,21 @@ int main(int argc, char *argv[]) | |||
| /* Draw stuff on our canvas */ | |||
| cucul_set_color_ansi(cv, CUCUL_WHITE, CUCUL_BLACK); | |||
| cucul_put_str(cv, 0, 0, "ABcde"); | |||
| cucul_set_color_ansi(cv, CUCUL_LIGHTRED, CUCUL_BLACK); | |||
| cucul_put_str(cv, 5, 0, "\\o/"); | |||
| cucul_set_color_ansi(cv, CUCUL_WHITE, CUCUL_BLUE); | |||
| cucul_put_str(cv, 0, 1, "&$âøÿØ?!"); | |||
| /* Load a libcucul internal font */ | |||
| fonts = cucul_get_font_list(); | |||
| caca_set_color_ansi(cv, CACA_WHITE, CACA_BLACK); | |||
| caca_put_str(cv, 0, 0, "ABcde"); | |||
| caca_set_color_ansi(cv, CACA_LIGHTRED, CACA_BLACK); | |||
| caca_put_str(cv, 5, 0, "\\o/"); | |||
| caca_set_color_ansi(cv, CACA_WHITE, CACA_BLUE); | |||
| caca_put_str(cv, 0, 1, "&$âøÿØ?!"); | |||
| /* Load a libcaca internal font */ | |||
| fonts = caca_get_font_list(); | |||
| if(fonts[0] == NULL) | |||
| { | |||
| fprintf(stderr, "error: libcucul was compiled without any fonts\n"); | |||
| fprintf(stderr, "error: libcaca was compiled without any fonts\n"); | |||
| return -1; | |||
| } | |||
| f = cucul_load_font(fonts[0], 0); | |||
| f = caca_load_font(fonts[0], 0); | |||
| if(f == NULL) | |||
| { | |||
| fprintf(stderr, "error: could not load font \"%s\"\n", fonts[0]); | |||
| @@ -69,15 +68,15 @@ int main(int argc, char *argv[]) | |||
| } | |||
| /* Create our bitmap buffer (32-bit ARGB) */ | |||
| w = cucul_get_canvas_width(cv) * cucul_get_font_width(f); | |||
| h = cucul_get_canvas_height(cv) * cucul_get_font_height(f); | |||
| w = caca_get_canvas_width(cv) * caca_get_font_width(f); | |||
| h = caca_get_canvas_height(cv) * caca_get_font_height(f); | |||
| buf = malloc(4 * w * h); | |||
| /* Render the canvas onto our image buffer */ | |||
| cucul_render_canvas(cv, f, buf, w, h, 4 * w); | |||
| caca_render_canvas(cv, f, buf, w, h, 4 * w); | |||
| /* Just for fun, render the image using libcaca */ | |||
| cucul_set_canvas_size(cv, 80, 32); | |||
| caca_set_canvas_size(cv, 80, 32); | |||
| dp = caca_create_display(cv); | |||
| { | |||
| @@ -88,15 +87,15 @@ int main(int argc, char *argv[]) | |||
| uint32_t const tmp = 0x12345678; | |||
| if(*(uint8_t const *)&tmp == 0x12) | |||
| #endif | |||
| d = cucul_create_dither(32, w, h, 4 * w, | |||
| d = caca_create_dither(32, w, h, 4 * w, | |||
| 0xff0000, 0xff00, 0xff, 0xff000000); | |||
| else | |||
| d = cucul_create_dither(32, w, h, 4 * w, | |||
| d = caca_create_dither(32, w, h, 4 * w, | |||
| 0xff00, 0xff0000, 0xff000000, 0xff); | |||
| } | |||
| cucul_dither_bitmap(cv, 0, 0, cucul_get_canvas_width(cv), | |||
| cucul_get_canvas_height(cv), d, buf); | |||
| caca_dither_bitmap(cv, 0, 0, caca_get_canvas_width(cv), | |||
| caca_get_canvas_height(cv), d, buf); | |||
| caca_refresh_display(dp); | |||
| caca_get_event(dp, CACA_EVENT_KEY_PRESS, NULL, -1); | |||
| @@ -104,9 +103,9 @@ int main(int argc, char *argv[]) | |||
| /* Free everything */ | |||
| caca_free_display(dp); | |||
| free(buf); | |||
| cucul_free_dither(d); | |||
| cucul_free_font(f); | |||
| cucul_free_canvas(cv); | |||
| caca_free_dither(d); | |||
| caca_free_font(f); | |||
| caca_free_canvas(cv); | |||
| return 0; | |||
| } | |||
| @@ -1,5 +1,5 @@ | |||
| /* | |||
| * font2tga libcucul font test program | |||
| * font2tga libcaca font test program | |||
| * Copyright (c) 2006 Sam Hocevar <sam@zoy.org> | |||
| * All Rights Reserved | |||
| * | |||
| @@ -19,27 +19,27 @@ | |||
| # include <stdlib.h> | |||
| #endif | |||
| #include "cucul.h" | |||
| #include "caca.h" | |||
| int main(int argc, char *argv[]) | |||
| { | |||
| uint32_t const *blocks; | |||
| cucul_font_t *f; | |||
| caca_font_t *f; | |||
| char const * const * fonts; | |||
| cucul_canvas_t *cv; | |||
| caca_canvas_t *cv; | |||
| void *buffer; | |||
| size_t len; | |||
| unsigned int i, j, x, y, cells, width; | |||
| fonts = cucul_get_font_list(); | |||
| f = cucul_load_font(fonts[0], 0); | |||
| blocks = cucul_get_font_blocks(f); | |||
| fonts = caca_get_font_list(); | |||
| f = caca_load_font(fonts[0], 0); | |||
| blocks = caca_get_font_blocks(f); | |||
| for(i = 0, cells = 0; blocks[i + 1]; i += 2) | |||
| { | |||
| cells += blocks[i + 1] - blocks[i]; | |||
| for(j = blocks[i]; j < blocks[i + 1]; j++) | |||
| if(cucul_utf32_is_fullwidth(j)) | |||
| if(caca_utf32_is_fullwidth(j)) | |||
| cells++; | |||
| } | |||
| @@ -47,10 +47,10 @@ int main(int argc, char *argv[]) | |||
| ; | |||
| /* Create a canvas */ | |||
| cv = cucul_create_canvas(width, (cells + width - 1) / (width - 1)); | |||
| cucul_set_color_ansi(cv, CUCUL_RED, CUCUL_RED); | |||
| cucul_clear_canvas(cv); | |||
| cucul_set_color_ansi(cv, CUCUL_BLACK, CUCUL_WHITE); | |||
| cv = caca_create_canvas(width, (cells + width - 1) / (width - 1)); | |||
| caca_set_color_ansi(cv, CACA_RED, CACA_RED); | |||
| caca_clear_canvas(cv); | |||
| caca_set_color_ansi(cv, CACA_BLACK, CACA_WHITE); | |||
| /* Put all glyphs on the canvas */ | |||
| x = y = 0; | |||
| @@ -59,9 +59,9 @@ int main(int argc, char *argv[]) | |||
| { | |||
| for(j = blocks[i]; j < blocks[i + 1]; j++) | |||
| { | |||
| cucul_put_char(cv, x, y, j); | |||
| caca_put_char(cv, x, y, j); | |||
| if(cucul_utf32_is_fullwidth(j)) | |||
| if(caca_utf32_is_fullwidth(j)) | |||
| ++x; | |||
| if(++x >= width - 1) | |||
| @@ -72,14 +72,14 @@ int main(int argc, char *argv[]) | |||
| } | |||
| } | |||
| cucul_free_font(f); | |||
| caca_free_font(f); | |||
| buffer = cucul_export_memory(cv, "tga", &len); | |||
| buffer = caca_export_memory(cv, "tga", &len); | |||
| fwrite(buffer, len, 1, stdout); | |||
| free(buffer); | |||
| /* Free everything */ | |||
| cucul_free_canvas(cv); | |||
| caca_free_canvas(cv); | |||
| return 0; | |||
| } | |||
| @@ -18,18 +18,17 @@ | |||
| # include <stdio.h> | |||
| #endif | |||
| #include "cucul.h" | |||
| #include "caca.h" | |||
| int main(int argc, char *argv[]) | |||
| { | |||
| cucul_canvas_t *cv; | |||
| caca_canvas_t *cv; | |||
| caca_display_t *dp; | |||
| int n, frame; | |||
| /* Create a canvas with 200 frames */ | |||
| cv = cucul_create_canvas(0, 0); | |||
| cv = caca_create_canvas(0, 0); | |||
| if(cv == NULL) | |||
| { | |||
| printf("Can't create canvas\n"); | |||
| @@ -37,44 +36,44 @@ int main(int argc, char *argv[]) | |||
| } | |||
| for(frame = 1; frame < 200; frame++) | |||
| cucul_create_frame(cv, frame); | |||
| caca_create_frame(cv, frame); | |||
| fprintf(stderr, "canvas created, size is %ix%i\n", | |||
| cucul_get_canvas_width(cv), cucul_get_canvas_height(cv)); | |||
| caca_get_canvas_width(cv), caca_get_canvas_height(cv)); | |||
| /* Resize it to 150 x 80 (around 19MB) */ | |||
| cucul_set_canvas_size(cv, 150, 80); | |||
| caca_set_canvas_size(cv, 150, 80); | |||
| fprintf(stderr, "canvas expanded, size is %ix%i\n", | |||
| cucul_get_canvas_width(cv), cucul_get_canvas_height(cv)); | |||
| caca_get_canvas_width(cv), caca_get_canvas_height(cv)); | |||
| /* Fill the first 16 frames with a different colour */ | |||
| for(frame = 0; frame < 16; frame++) | |||
| { | |||
| cucul_set_frame(cv, frame); | |||
| cucul_set_color_ansi(cv, CUCUL_WHITE, frame); | |||
| cucul_fill_box(cv, 0, 0, 40, 15, ':'); | |||
| cucul_set_color_ansi(cv, CUCUL_WHITE, CUCUL_BLUE); | |||
| cucul_put_str(cv, frame * 5 / 2, frame, "カカ"); | |||
| cucul_set_color_ansi(cv, CUCUL_DEFAULT, CUCUL_TRANSPARENT); | |||
| caca_set_frame(cv, frame); | |||
| caca_set_color_ansi(cv, CACA_WHITE, frame); | |||
| caca_fill_box(cv, 0, 0, 40, 15, ':'); | |||
| caca_set_color_ansi(cv, CACA_WHITE, CACA_BLUE); | |||
| caca_put_str(cv, frame * 5 / 2, frame, "カカ"); | |||
| caca_set_color_ansi(cv, CACA_DEFAULT, CACA_TRANSPARENT); | |||
| } | |||
| /* Resize it to a more decent size */ | |||
| cucul_set_canvas_size(cv, 41, 16); | |||
| caca_set_canvas_size(cv, 41, 16); | |||
| fprintf(stderr, "canvas shrinked, size is %ix%i\n", | |||
| cucul_get_canvas_width(cv), cucul_get_canvas_height(cv)); | |||
| caca_get_canvas_width(cv), caca_get_canvas_height(cv)); | |||
| dp = caca_create_display(cv); | |||
| caca_set_display_time(dp, 50000); | |||
| fprintf(stderr, "display attached, size is %ix%i\n", | |||
| cucul_get_canvas_width(cv), cucul_get_canvas_height(cv)); | |||
| caca_get_canvas_width(cv), caca_get_canvas_height(cv)); | |||
| n = 0; | |||
| while(!caca_get_event(dp, CACA_EVENT_KEY_PRESS, NULL, 0)) | |||
| { | |||
| cucul_set_frame(cv, n % 16); | |||
| caca_set_frame(cv, n % 16); | |||
| caca_refresh_display(dp); | |||
| n++; | |||
| } | |||
| @@ -83,7 +82,7 @@ int main(int argc, char *argv[]) | |||
| /* It is possible, though not necessary, to free all additional frames | |||
| * separately. */ | |||
| cucul_free_canvas(cv); | |||
| caca_free_canvas(cv); | |||
| return 0; | |||
| } | |||
| @@ -18,19 +18,18 @@ | |||
| # include <stdio.h> | |||
| #endif | |||
| #include "cucul.h" | |||
| #include "caca.h" | |||
| #define CACA "쫊쫊쫊쫊쫊쫊쫊쫊쫊쫊쫊쫊쫊쫊쫊" | |||
| int main(int argc, char *argv[]) | |||
| { | |||
| cucul_canvas_t *cv, *caca, *line; | |||
| caca_canvas_t *cv, *caca, *line; | |||
| caca_display_t *dp; | |||
| unsigned int i; | |||
| cv = cucul_create_canvas(0, 0); | |||
| cv = caca_create_canvas(0, 0); | |||
| if(cv == NULL) | |||
| { | |||
| printf("Can't created canvas\n"); | |||
| @@ -43,42 +42,42 @@ int main(int argc, char *argv[]) | |||
| return -1; | |||
| } | |||
| caca = cucul_create_canvas(6, 10); | |||
| line = cucul_create_canvas(2, 1); | |||
| caca = caca_create_canvas(6, 10); | |||
| line = caca_create_canvas(2, 1); | |||
| /* Line of x's */ | |||
| for(i = 0; i < 10; i++) | |||
| { | |||
| cucul_set_color_ansi(caca, CUCUL_WHITE, CUCUL_BLUE); | |||
| cucul_put_str(caca, 0, i, CACA); | |||
| cucul_set_color_ansi(caca, CUCUL_WHITE, CUCUL_RED); | |||
| cucul_put_char(caca, i - 2, i, 'x'); | |||
| caca_set_color_ansi(caca, CACA_WHITE, CACA_BLUE); | |||
| caca_put_str(caca, 0, i, CACA); | |||
| caca_set_color_ansi(caca, CACA_WHITE, CACA_RED); | |||
| caca_put_char(caca, i - 2, i, 'x'); | |||
| } | |||
| cucul_blit(cv, 1, 1, caca, NULL); | |||
| caca_blit(cv, 1, 1, caca, NULL); | |||
| /* Line of ホ's */ | |||
| for(i = 0; i < 10; i++) | |||
| { | |||
| cucul_set_color_ansi(caca, CUCUL_WHITE, CUCUL_BLUE); | |||
| cucul_put_str(caca, 0, i, CACA); | |||
| cucul_set_color_ansi(caca, CUCUL_WHITE, CUCUL_GREEN); | |||
| cucul_put_str(caca, i - 2, i, "ホ"); | |||
| caca_set_color_ansi(caca, CACA_WHITE, CACA_BLUE); | |||
| caca_put_str(caca, 0, i, CACA); | |||
| caca_set_color_ansi(caca, CACA_WHITE, CACA_GREEN); | |||
| caca_put_str(caca, i - 2, i, "ホ"); | |||
| } | |||
| cucul_blit(cv, 15, 1, caca, NULL); | |||
| caca_blit(cv, 15, 1, caca, NULL); | |||
| /* Line of canvas */ | |||
| cucul_set_color_ansi(line, CUCUL_WHITE, CUCUL_MAGENTA); | |||
| cucul_put_str(line, 0, 0, "ほ"); | |||
| caca_set_color_ansi(line, CACA_WHITE, CACA_MAGENTA); | |||
| caca_put_str(line, 0, 0, "ほ"); | |||
| for(i = 0; i < 10; i++) | |||
| { | |||
| cucul_set_color_ansi(caca, CUCUL_WHITE, CUCUL_BLUE); | |||
| cucul_put_str(caca, 0, i, CACA); | |||
| cucul_blit(caca, i - 2, i, line, NULL); | |||
| caca_set_color_ansi(caca, CACA_WHITE, CACA_BLUE); | |||
| caca_put_str(caca, 0, i, CACA); | |||
| caca_blit(caca, i - 2, i, line, NULL); | |||
| } | |||
| cucul_blit(cv, 29, 1, caca, NULL); | |||
| caca_blit(cv, 29, 1, caca, NULL); | |||
| caca_refresh_display(dp); | |||
| @@ -86,9 +85,9 @@ int main(int argc, char *argv[]) | |||
| caca_free_display(dp); | |||
| cucul_free_canvas(line); | |||
| cucul_free_canvas(caca); | |||
| cucul_free_canvas(cv); | |||
| caca_free_canvas(line); | |||
| caca_free_canvas(caca); | |||
| caca_free_canvas(cv); | |||
| return 0; | |||
| } | |||
| @@ -1,5 +1,5 @@ | |||
| /* | |||
| * gamma libcucul gamma test program | |||
| * gamma libcaca gamma test program | |||
| * Copyright (c) 2006 Sam Hocevar <sam@zoy.org> | |||
| * All Rights Reserved | |||
| * | |||
| @@ -19,7 +19,6 @@ | |||
| # include <math.h> | |||
| #endif | |||
| #include "cucul.h" | |||
| #include "caca.h" | |||
| uint32_t buffer[256 * 4]; | |||
| @@ -27,13 +26,13 @@ uint32_t buffer[256 * 4]; | |||
| int main(int argc, char *argv[]) | |||
| { | |||
| caca_event_t ev; | |||
| cucul_canvas_t *cv, *cw, *mask; | |||
| caca_canvas_t *cv, *cw, *mask; | |||
| caca_display_t *dp; | |||
| cucul_dither_t *left, *right; | |||
| caca_dither_t *left, *right; | |||
| float gam; | |||
| int x; | |||
| cv = cucul_create_canvas(0, 0); | |||
| cv = caca_create_canvas(0, 0); | |||
| if(cv == NULL) | |||
| { | |||
| printf("Can't created canvas\n"); | |||
| @@ -46,8 +45,8 @@ int main(int argc, char *argv[]) | |||
| return -1; | |||
| } | |||
| cw = cucul_create_canvas(cucul_get_canvas_width(cv), cucul_get_canvas_height(cv)); | |||
| mask = cucul_create_canvas(cucul_get_canvas_width(cv), cucul_get_canvas_height(cv)); | |||
| cw = caca_create_canvas(caca_get_canvas_width(cv), caca_get_canvas_height(cv)); | |||
| mask = caca_create_canvas(caca_get_canvas_width(cv), caca_get_canvas_height(cv)); | |||
| for(x = 0; x < 256; x++) | |||
| { | |||
| @@ -57,11 +56,11 @@ int main(int argc, char *argv[]) | |||
| buffer[x + 768] = (x << 16) | (0x00 << 8) | (0xff << 0); | |||
| } | |||
| left = cucul_create_dither(32, 256, 4, 4 * 256, | |||
| left = caca_create_dither(32, 256, 4, 4 * 256, | |||
| 0x00ff0000, 0x0000ff00, 0x000000ff, 0x0); | |||
| right = cucul_create_dither(32, 256, 4, 4 * 256, | |||
| right = caca_create_dither(32, 256, 4, 4 * 256, | |||
| 0x00ff0000, 0x0000ff00, 0x000000ff, 0x0); | |||
| gam = cucul_get_dither_gamma(right); | |||
| gam = caca_get_dither_gamma(right); | |||
| caca_set_display_time(dp, 20000); | |||
| for(x = 0; ; x++) | |||
| @@ -81,46 +80,46 @@ int main(int argc, char *argv[]) | |||
| } | |||
| /* Resize the spare canvas, just in case the main one changed */ | |||
| cucul_set_canvas_size(cw, cucul_get_canvas_width(cv), cucul_get_canvas_height(cv)); | |||
| cucul_set_canvas_size(mask, cucul_get_canvas_width(cv), cucul_get_canvas_height(cv)); | |||
| caca_set_canvas_size(cw, caca_get_canvas_width(cv), caca_get_canvas_height(cv)); | |||
| caca_set_canvas_size(mask, caca_get_canvas_width(cv), caca_get_canvas_height(cv)); | |||
| /* Draw the regular dither on the main canvas */ | |||
| cucul_dither_bitmap(cv, 0, 0, cucul_get_canvas_width(cv), | |||
| cucul_get_canvas_height(cv), left, buffer); | |||
| caca_dither_bitmap(cv, 0, 0, caca_get_canvas_width(cv), | |||
| caca_get_canvas_height(cv), left, buffer); | |||
| /* Draw the gamma-modified dither on the spare canvas */ | |||
| cucul_set_dither_gamma(right, gam); | |||
| cucul_dither_bitmap(cw, 0, 0, cucul_get_canvas_width(cw), | |||
| cucul_get_canvas_height(cw), right, buffer); | |||
| caca_set_dither_gamma(right, gam); | |||
| caca_dither_bitmap(cw, 0, 0, caca_get_canvas_width(cw), | |||
| caca_get_canvas_height(cw), right, buffer); | |||
| /* Draw something on the mask */ | |||
| cucul_set_color_ansi(mask, CUCUL_LIGHTGRAY, CUCUL_BLACK); | |||
| cucul_clear_canvas(mask); | |||
| cucul_set_color_ansi(mask, CUCUL_WHITE, CUCUL_WHITE); | |||
| cucul_fill_ellipse(mask, (1.0 + sin(0.05 * (float)x)) | |||
| * 0.5 * cucul_get_canvas_width(mask), | |||
| caca_set_color_ansi(mask, CACA_LIGHTGRAY, CACA_BLACK); | |||
| caca_clear_canvas(mask); | |||
| caca_set_color_ansi(mask, CACA_WHITE, CACA_WHITE); | |||
| caca_fill_ellipse(mask, (1.0 + sin(0.05 * (float)x)) | |||
| * 0.5 * caca_get_canvas_width(mask), | |||
| (1.0 + cos(0.05 * (float)x)) | |||
| * 0.5 * cucul_get_canvas_height(mask), | |||
| cucul_get_canvas_width(mask) / 2, | |||
| cucul_get_canvas_height(mask) / 2, '#'); | |||
| * 0.5 * caca_get_canvas_height(mask), | |||
| caca_get_canvas_width(mask) / 2, | |||
| caca_get_canvas_height(mask) / 2, '#'); | |||
| /* Blit the spare canvas onto the first one */ | |||
| cucul_blit(cv, 0, 0, cw, mask); | |||
| caca_blit(cv, 0, 0, cw, mask); | |||
| cucul_set_color_ansi(cv, CUCUL_WHITE, CUCUL_BLUE); | |||
| cucul_printf(cv, 2, 1, | |||
| caca_set_color_ansi(cv, CACA_WHITE, CACA_BLUE); | |||
| caca_printf(cv, 2, 1, | |||
| "gamma=%g - use arrows to change, Esc to quit", gam); | |||
| caca_refresh_display(dp); | |||
| } | |||
| cucul_free_dither(left); | |||
| cucul_free_dither(right); | |||
| caca_free_dither(left); | |||
| caca_free_dither(right); | |||
| caca_free_display(dp); | |||
| cucul_free_canvas(mask); | |||
| cucul_free_canvas(cw); | |||
| cucul_free_canvas(cv); | |||
| caca_free_canvas(mask); | |||
| caca_free_canvas(cw); | |||
| caca_free_canvas(cv); | |||
| return 0; | |||
| } | |||
| @@ -18,7 +18,6 @@ | |||
| # include <stdio.h> | |||
| #endif | |||
| #include "cucul.h" | |||
| #include "caca.h" | |||
| uint32_t buffer[256*256]; | |||
| @@ -26,9 +25,9 @@ uint32_t buffer[256*256]; | |||
| int main(int argc, char *argv[]) | |||
| { | |||
| caca_display_t *dp; | |||
| cucul_canvas_t *cv; | |||
| caca_canvas_t *cv; | |||
| cucul_dither_t *dither; | |||
| caca_dither_t *dither; | |||
| int x, y; | |||
| dp = caca_create_display(NULL); | |||
| @@ -46,11 +45,11 @@ int main(int argc, char *argv[]) | |||
| buffer[y * 256 + x] = ((y * x / 256) << 16) | ((y * x / 256) << 8) | (x<< 0); | |||
| } | |||
| dither = cucul_create_dither(32, 256, 256, 4 * 256, | |||
| dither = caca_create_dither(32, 256, 256, 4 * 256, | |||
| 0x00ff0000, 0x0000ff00, 0x000000ff, 0x0); | |||
| cucul_dither_bitmap(caca_get_canvas(dp), 0, 0, cucul_get_canvas_width(cv), | |||
| cucul_get_canvas_height(cv), dither, buffer); | |||
| cucul_free_dither(dither); | |||
| caca_dither_bitmap(caca_get_canvas(dp), 0, 0, caca_get_canvas_width(cv), | |||
| caca_get_canvas_height(cv), dither, buffer); | |||
| caca_free_dither(dither); | |||
| caca_refresh_display(dp); | |||
| @@ -19,12 +19,11 @@ | |||
| # include <stdlib.h> | |||
| #endif | |||
| #include "cucul.h" | |||
| #include "caca.h" | |||
| int main(int argc, char *argv[]) | |||
| { | |||
| cucul_canvas_t *cv; | |||
| caca_canvas_t *cv; | |||
| caca_display_t *dp; | |||
| if(argc < 2) | |||
| @@ -34,17 +33,17 @@ int main(int argc, char *argv[]) | |||
| return 1; | |||
| } | |||
| cv = cucul_create_canvas(0, 0); | |||
| cv = caca_create_canvas(0, 0); | |||
| if(cv == NULL) | |||
| { | |||
| printf("Can't create canvas\n"); | |||
| return -1; | |||
| } | |||
| if(cucul_import_file(cv, argv[1], argc >= 3 ? argv[2] : "") < 0) | |||
| if(caca_import_file(cv, argv[1], argc >= 3 ? argv[2] : "") < 0) | |||
| { | |||
| fprintf(stderr, "%s: could not open `%s'.\n", argv[0], argv[1]); | |||
| cucul_free_canvas(cv); | |||
| caca_free_canvas(cv); | |||
| return 1; | |||
| } | |||
| @@ -60,7 +59,7 @@ int main(int argc, char *argv[]) | |||
| caca_get_event(dp, CACA_EVENT_KEY_PRESS, NULL, -1); | |||
| caca_free_display(dp); | |||
| cucul_free_canvas(cv); | |||
| caca_free_canvas(cv); | |||
| return 0; | |||
| } | |||
| @@ -19,7 +19,6 @@ | |||
| # include <stdio.h> | |||
| #endif | |||
| #include "cucul.h" | |||
| #include "caca.h" | |||
| #define BUFFER_SIZE 75 | |||
| @@ -34,11 +33,11 @@ typedef struct textentry | |||
| int main(int argc, char *argv[]) | |||
| { | |||
| textentry entries[TEXT_ENTRIES]; | |||
| cucul_canvas_t *cv; | |||
| caca_canvas_t *cv; | |||
| caca_display_t *dp; | |||
| unsigned int i, e = 0, running = 1; | |||
| cv = cucul_create_canvas(0, 0); | |||
| cv = caca_create_canvas(0, 0); | |||
| if(cv == NULL) | |||
| { | |||
| printf("Can't create canvas\n"); | |||
| @@ -52,8 +51,8 @@ int main(int argc, char *argv[]) | |||
| } | |||
| caca_set_cursor(dp, 1); | |||
| cucul_set_color_ansi(cv, CUCUL_WHITE, CUCUL_BLUE); | |||
| cucul_put_str(cv, 1, 1, "Text entries - press tab to cycle"); | |||
| caca_set_color_ansi(cv, CACA_WHITE, CACA_BLUE); | |||
| caca_put_str(cv, 1, 1, "Text entries - press tab to cycle"); | |||
| for(i = 0; i < TEXT_ENTRIES; i++) | |||
| { | |||
| @@ -70,21 +69,21 @@ int main(int argc, char *argv[]) | |||
| { | |||
| unsigned int j, start, size; | |||
| cucul_set_color_ansi(cv, CUCUL_BLACK, CUCUL_LIGHTGRAY); | |||
| cucul_fill_box(cv, 2, 3 * i + 4, 2 + BUFFER_SIZE, 3 * i + 4, ' '); | |||
| caca_set_color_ansi(cv, CACA_BLACK, CACA_LIGHTGRAY); | |||
| caca_fill_box(cv, 2, 3 * i + 4, 2 + BUFFER_SIZE, 3 * i + 4, ' '); | |||
| start = 0; | |||
| size = entries[i].size; | |||
| for(j = 0; j < size; j++) | |||
| { | |||
| cucul_put_char(cv, 2 + j, 3 * i + 4, | |||
| caca_put_char(cv, 2 + j, 3 * i + 4, | |||
| entries[i].buffer[start + j]); | |||
| } | |||
| } | |||
| /* Put the cursor on the active textentry */ | |||
| cucul_gotoxy(cv, 2 + entries[e].cursor, 3 * e + 4); | |||
| caca_gotoxy(cv, 2 + entries[e].cursor, 3 * e + 4); | |||
| caca_refresh_display(dp); | |||
| @@ -149,7 +148,7 @@ int main(int argc, char *argv[]) | |||
| } | |||
| caca_free_display(dp); | |||
| cucul_free_canvas(cv); | |||
| caca_free_canvas(cv); | |||
| return 0; | |||
| } | |||
| @@ -20,7 +20,6 @@ | |||
| # include <stdlib.h> | |||
| #endif | |||
| #include "cucul.h" | |||
| #include "caca.h" | |||
| /* Courtesy of Zashi */ | |||
| @@ -48,46 +47,46 @@ char *guy[] = { | |||
| int main(int argc, char **argv) | |||
| { | |||
| cucul_canvas_t *sprite; | |||
| caca_canvas_t *sprite; | |||
| size_t len; | |||
| void *buffer; | |||
| int i; | |||
| /* Create a canvas with 4 frames */ | |||
| sprite = cucul_create_canvas(0, 0); | |||
| sprite = caca_create_canvas(0, 0); | |||
| for(i = 0; i < 3; i++) | |||
| cucul_create_frame(sprite, 0); | |||
| caca_create_frame(sprite, 0); | |||
| /* Load stuff in all 4 frames */ | |||
| for(i = 0; i < 4; i++) | |||
| { | |||
| cucul_set_frame(sprite, i); | |||
| cucul_import_memory(sprite, guy[i], strlen(guy[i]), "utf8"); | |||
| caca_set_frame(sprite, i); | |||
| caca_import_memory(sprite, guy[i], strlen(guy[i]), "utf8"); | |||
| } | |||
| /* Export our sprite in a memory buffer. We could save this to | |||
| * disk afterwards. */ | |||
| buffer = cucul_export_memory(sprite, "caca", &len); | |||
| buffer = caca_export_memory(sprite, "caca", &len); | |||
| /* Free our sprite and reload it from the memory buffer. We could | |||
| * load this from disk, too. */ | |||
| cucul_free_canvas(sprite); | |||
| sprite = cucul_create_canvas(0, 0); | |||
| cucul_import_memory(sprite, buffer, len, "caca"); | |||
| caca_free_canvas(sprite); | |||
| sprite = caca_create_canvas(0, 0); | |||
| caca_import_memory(sprite, buffer, len, "caca"); | |||
| free(buffer); | |||
| /* Print each sprite frame to stdout */ | |||
| for(i = 0; i < 4; i++) | |||
| { | |||
| cucul_set_frame(sprite, i); | |||
| caca_set_frame(sprite, i); | |||
| printf("Frame #%i\n", i); | |||
| buffer = cucul_export_memory(sprite, "utf8", &len); | |||
| buffer = caca_export_memory(sprite, "utf8", &len); | |||
| fwrite(buffer, len, 1, stdout); | |||
| free(buffer); | |||
| } | |||
| /* Free our sprite */ | |||
| cucul_free_canvas(sprite); | |||
| caca_free_canvas(sprite); | |||
| return 0; | |||
| } | |||
| @@ -20,13 +20,12 @@ | |||
| # include <stdlib.h> | |||
| #endif | |||
| #include "cucul.h" | |||
| #include "caca.h" | |||
| int main(int argc, char **argv) | |||
| { | |||
| char cmd[BUFSIZ]; | |||
| static cucul_canvas_t *cv, *app; | |||
| static caca_canvas_t *cv, *app; | |||
| static caca_display_t *dp; | |||
| uint8_t *buf[4]; | |||
| long int bytes[4], total[4]; | |||
| @@ -39,8 +38,8 @@ int main(int argc, char **argv) | |||
| return 1; | |||
| } | |||
| cv = cucul_create_canvas(0, 0); | |||
| app = cucul_create_canvas(0, 0); | |||
| cv = caca_create_canvas(0, 0); | |||
| app = caca_create_canvas(0, 0); | |||
| dp = caca_create_display(cv); | |||
| if(cv == NULL || app == NULL ) | |||
| @@ -54,15 +53,15 @@ int main(int argc, char **argv) | |||
| return -1; | |||
| } | |||
| w = (cucul_get_canvas_width(cv) - 4) / 2; | |||
| h = (cucul_get_canvas_height(cv) - 6) / 2; | |||
| w = (caca_get_canvas_width(cv) - 4) / 2; | |||
| h = (caca_get_canvas_height(cv) - 6) / 2; | |||
| if(w < 0 || h < 0) | |||
| return 1; | |||
| cucul_set_color_ansi(cv, CUCUL_WHITE, CUCUL_BLUE); | |||
| cucul_draw_line(cv, 0, 0, cucul_get_canvas_width(cv) - 1, 0, ' '); | |||
| cucul_printf(cv, cucul_get_canvas_width(cv) / 2 - 10, 0, | |||
| caca_set_color_ansi(cv, CACA_WHITE, CACA_BLUE); | |||
| caca_draw_line(cv, 0, 0, caca_get_canvas_width(cv) - 1, 0, ' '); | |||
| caca_printf(cv, caca_get_canvas_width(cv) / 2 - 10, 0, | |||
| "libcaca multiplexer"); | |||
| for(i = 0; i < 4; i++) | |||
| @@ -74,7 +73,7 @@ int main(int argc, char **argv) | |||
| f[i] = popen(cmd, "r"); | |||
| if(!f[i]) | |||
| return 1; | |||
| cucul_printf(cv, (w + 2) * (i / 2) + 1, | |||
| caca_printf(cv, (w + 2) * (i / 2) + 1, | |||
| (h + 2) * ((i % 2) + 1), "%s", argv[i + 1]); | |||
| } | |||
| @@ -88,14 +87,14 @@ int main(int argc, char **argv) | |||
| for(i = 0; i < 4; i++) | |||
| { | |||
| bytes[i] = cucul_import_memory(app, buf[i], total[i], "caca"); | |||
| bytes[i] = caca_import_memory(app, buf[i], total[i], "caca"); | |||
| if(bytes[i] > 0) | |||
| { | |||
| total[i] -= bytes[i]; | |||
| memmove(buf[i], buf[i] + bytes[i], total[i]); | |||
| cucul_blit(cv, (w + 2) * (i / 2) + 1, | |||
| caca_blit(cv, (w + 2) * (i / 2) + 1, | |||
| (h + 2) * (i % 2) + 2, app, NULL); | |||
| caca_refresh_display(dp); | |||
| } | |||
| @@ -115,8 +114,8 @@ int main(int argc, char **argv) | |||
| /* Clean up */ | |||
| caca_free_display(dp); | |||
| cucul_free_canvas(cv); | |||
| cucul_free_canvas(app); | |||
| caca_free_canvas(cv); | |||
| caca_free_canvas(app); | |||
| return 0; | |||
| } | |||
| @@ -20,7 +20,7 @@ | |||
| # include <stdlib.h> | |||
| #endif | |||
| #include "cucul.h" | |||
| #include "caca.h" | |||
| #define STRING \ | |||
| " |_| \n" \ | |||
| @@ -35,16 +35,16 @@ | |||
| int main(int argc, char *argv[]) | |||
| { | |||
| cucul_canvas_t *cv, *pig; | |||
| caca_canvas_t *cv, *pig; | |||
| void *buffer; | |||
| size_t len; | |||
| int i, j; | |||
| pig = cucul_create_canvas(0, 0); | |||
| cucul_import_memory(pig, STRING, strlen(STRING), "text"); | |||
| pig = caca_create_canvas(0, 0); | |||
| caca_import_memory(pig, STRING, strlen(STRING), "text"); | |||
| cv = cucul_create_canvas(cucul_get_canvas_width(pig) * 2, | |||
| cucul_get_canvas_height(pig) * 2); | |||
| cv = caca_create_canvas(caca_get_canvas_width(pig) * 2, | |||
| caca_get_canvas_height(pig) * 2); | |||
| if(cv == NULL || pig == NULL) | |||
| { | |||
| @@ -52,41 +52,41 @@ int main(int argc, char *argv[]) | |||
| return -1; | |||
| } | |||
| cucul_blit(cv, 0, 0, pig, NULL); | |||
| cucul_flip(pig); | |||
| cucul_blit(cv, cucul_get_canvas_width(pig), 0, pig, NULL); | |||
| cucul_flip(pig); | |||
| cucul_flop(pig); | |||
| cucul_blit(cv, 0, cucul_get_canvas_height(pig), pig, NULL); | |||
| cucul_flop(pig); | |||
| cucul_rotate_180(pig); | |||
| cucul_blit(cv, cucul_get_canvas_width(pig), | |||
| cucul_get_canvas_height(pig), pig, NULL); | |||
| caca_blit(cv, 0, 0, pig, NULL); | |||
| caca_flip(pig); | |||
| caca_blit(cv, caca_get_canvas_width(pig), 0, pig, NULL); | |||
| caca_flip(pig); | |||
| caca_flop(pig); | |||
| caca_blit(cv, 0, caca_get_canvas_height(pig), pig, NULL); | |||
| caca_flop(pig); | |||
| caca_rotate_180(pig); | |||
| caca_blit(cv, caca_get_canvas_width(pig), | |||
| caca_get_canvas_height(pig), pig, NULL); | |||
| for(j = 0; j < cucul_get_canvas_height(cv); j++) | |||
| for(j = 0; j < caca_get_canvas_height(cv); j++) | |||
| { | |||
| for(i = 0; i < cucul_get_canvas_width(cv); i += 2) | |||
| for(i = 0; i < caca_get_canvas_width(cv); i += 2) | |||
| { | |||
| unsigned long int a; | |||
| cucul_set_color_ansi(cv, CUCUL_LIGHTBLUE + (i + j) % 6, | |||
| CUCUL_DEFAULT); | |||
| a = cucul_get_attr(cv, -1, -1); | |||
| cucul_put_attr(cv, i, j, a); | |||
| cucul_put_attr(cv, i + 1, j, a); | |||
| caca_set_color_ansi(cv, CACA_LIGHTBLUE + (i + j) % 6, | |||
| CACA_DEFAULT); | |||
| a = caca_get_attr(cv, -1, -1); | |||
| caca_put_attr(cv, i, j, a); | |||
| caca_put_attr(cv, i + 1, j, a); | |||
| } | |||
| } | |||
| buffer = cucul_export_memory(cv, "utf8", &len); | |||
| buffer = caca_export_memory(cv, "utf8", &len); | |||
| fwrite(buffer, len, 1, stdout); | |||
| free(buffer); | |||
| cucul_rotate_left(cv); | |||
| buffer = cucul_export_memory(cv, "utf8", &len); | |||
| caca_rotate_left(cv); | |||
| buffer = caca_export_memory(cv, "utf8", &len); | |||
| fwrite(buffer, len, 1, stdout); | |||
| free(buffer); | |||
| cucul_free_canvas(pig); | |||
| cucul_free_canvas(cv); | |||
| caca_free_canvas(pig); | |||
| caca_free_canvas(cv); | |||
| return 0; | |||
| } | |||
| @@ -19,7 +19,6 @@ | |||
| # include <string.h> | |||
| #endif | |||
| #include "cucul.h" | |||
| #include "caca.h" | |||
| static char const pig[] = | |||
| @@ -39,10 +38,10 @@ static char const duck[] = | |||
| int main(int argc, char *argv[]) | |||
| { | |||
| cucul_canvas_t *cv, *image, *tmp, *sprite; | |||
| caca_canvas_t *cv, *image, *tmp, *sprite; | |||
| caca_display_t *dp; | |||
| cv = cucul_create_canvas(0, 0); | |||
| cv = caca_create_canvas(0, 0); | |||
| if(cv == NULL) | |||
| { | |||
| printf("Can't created canvas\n"); | |||
| @@ -55,64 +54,64 @@ int main(int argc, char *argv[]) | |||
| return -1; | |||
| } | |||
| image = cucul_create_canvas(70, 6); | |||
| tmp = cucul_create_canvas(70, 6); | |||
| sprite = cucul_create_canvas(0, 0); | |||
| image = caca_create_canvas(70, 6); | |||
| tmp = caca_create_canvas(70, 6); | |||
| sprite = caca_create_canvas(0, 0); | |||
| cucul_set_color_ansi(sprite, CUCUL_LIGHTMAGENTA, CUCUL_BLACK); | |||
| cucul_import_memory(sprite, pig, strlen(pig), "text"); | |||
| cucul_blit(image, 55, 0, sprite, NULL); | |||
| caca_set_color_ansi(sprite, CACA_LIGHTMAGENTA, CACA_BLACK); | |||
| caca_import_memory(sprite, pig, strlen(pig), "text"); | |||
| caca_blit(image, 55, 0, sprite, NULL); | |||
| cucul_set_color_ansi(sprite, CUCUL_LIGHTGREEN, CUCUL_BLACK); | |||
| cucul_import_memory(sprite, duck, strlen(duck), "text"); | |||
| cucul_blit(image, 30, 1, sprite, NULL); | |||
| caca_set_color_ansi(sprite, CACA_LIGHTGREEN, CACA_BLACK); | |||
| caca_import_memory(sprite, duck, strlen(duck), "text"); | |||
| caca_blit(image, 30, 1, sprite, NULL); | |||
| cucul_set_color_ansi(image, CUCUL_LIGHTCYAN, CUCUL_BLACK); | |||
| cucul_put_str(image, 1, 1, "hahaha mais vieux porc immonde !! [⽼ ⾗]"); | |||
| cucul_set_color_ansi(image, CUCUL_LIGHTRED, CUCUL_BLACK); | |||
| cucul_put_char(image, 38, 1, '|'); | |||
| caca_set_color_ansi(image, CACA_LIGHTCYAN, CACA_BLACK); | |||
| caca_put_str(image, 1, 1, "hahaha mais vieux porc immonde !! [⽼ ⾗]"); | |||
| caca_set_color_ansi(image, CACA_LIGHTRED, CACA_BLACK); | |||
| caca_put_char(image, 38, 1, '|'); | |||
| cucul_set_color_ansi(image, CUCUL_YELLOW, CUCUL_BLACK); | |||
| cucul_put_str(image, 4, 2, "\\o\\ \\o| _o/ \\o_ |o/ /o/"); | |||
| caca_set_color_ansi(image, CACA_YELLOW, CACA_BLACK); | |||
| caca_put_str(image, 4, 2, "\\o\\ \\o| _o/ \\o_ |o/ /o/"); | |||
| cucul_set_color_ansi(image, CUCUL_WHITE, CUCUL_LIGHTRED); | |||
| cucul_put_str(image, 7, 3, "▙▘▌▙▘▞▖▞▖▌ ▞▖▌ ▌▌"); | |||
| cucul_put_str(image, 7, 4, "▛▖▌▛▖▚▘▚▘▚▖▚▘▚▖▖▖"); | |||
| cucul_set_color_ansi(image, CUCUL_BLACK, CUCUL_LIGHTRED); | |||
| cucul_put_str(image, 4, 3, "▓▒░"); | |||
| cucul_put_str(image, 4, 4, "▓▒░"); | |||
| cucul_put_str(image, 24, 3, "░▒▓"); | |||
| cucul_put_str(image, 24, 4, "░▒▓"); | |||
| caca_set_color_ansi(image, CACA_WHITE, CACA_LIGHTRED); | |||
| caca_put_str(image, 7, 3, "▙▘▌▙▘▞▖▞▖▌ ▞▖▌ ▌▌"); | |||
| caca_put_str(image, 7, 4, "▛▖▌▛▖▚▘▚▘▚▖▚▘▚▖▖▖"); | |||
| caca_set_color_ansi(image, CACA_BLACK, CACA_LIGHTRED); | |||
| caca_put_str(image, 4, 3, "▓▒░"); | |||
| caca_put_str(image, 4, 4, "▓▒░"); | |||
| caca_put_str(image, 24, 3, "░▒▓"); | |||
| caca_put_str(image, 24, 4, "░▒▓"); | |||
| /* Blit the transformed canvas onto the main canvas */ | |||
| cucul_set_color_ansi(cv, CUCUL_WHITE, CUCUL_BLUE); | |||
| cucul_put_str(cv, 0, 0, "normal"); | |||
| cucul_blit(cv, 10, 0, image, NULL); | |||
| caca_set_color_ansi(cv, CACA_WHITE, CACA_BLUE); | |||
| caca_put_str(cv, 0, 0, "normal"); | |||
| caca_blit(cv, 10, 0, image, NULL); | |||
| cucul_put_str(cv, 0, 6, "flip"); | |||
| cucul_blit(tmp, 0, 0, image, NULL); | |||
| cucul_flip(tmp); | |||
| cucul_blit(cv, 10, 6, tmp, NULL); | |||
| caca_put_str(cv, 0, 6, "flip"); | |||
| caca_blit(tmp, 0, 0, image, NULL); | |||
| caca_flip(tmp); | |||
| caca_blit(cv, 10, 6, tmp, NULL); | |||
| cucul_put_str(cv, 0, 12, "flop"); | |||
| cucul_blit(tmp, 0, 0, image, NULL); | |||
| cucul_flop(tmp); | |||
| cucul_blit(cv, 10, 12, tmp, NULL); | |||
| caca_put_str(cv, 0, 12, "flop"); | |||
| caca_blit(tmp, 0, 0, image, NULL); | |||
| caca_flop(tmp); | |||
| caca_blit(cv, 10, 12, tmp, NULL); | |||
| cucul_put_str(cv, 0, 18, "rotate"); | |||
| cucul_blit(tmp, 0, 0, image, NULL); | |||
| cucul_rotate_180(tmp); | |||
| cucul_blit(cv, 10, 18, tmp, NULL); | |||
| caca_put_str(cv, 0, 18, "rotate"); | |||
| caca_blit(tmp, 0, 0, image, NULL); | |||
| caca_rotate_180(tmp); | |||
| caca_blit(cv, 10, 18, tmp, NULL); | |||
| caca_refresh_display(dp); | |||
| caca_get_event(dp, CACA_EVENT_KEY_PRESS, NULL, -1); | |||
| caca_free_display(dp); | |||
| cucul_free_canvas(tmp); | |||
| cucul_free_canvas(sprite); | |||
| cucul_free_canvas(image); | |||
| cucul_free_canvas(cv); | |||
| caca_free_canvas(tmp); | |||
| caca_free_canvas(sprite); | |||
| caca_free_canvas(image); | |||
| caca_free_canvas(cv); | |||
| return 0; | |||
| } | |||
| @@ -18,17 +18,16 @@ | |||
| # include <stdio.h> | |||
| #endif | |||
| #include "cucul.h" | |||
| #include "caca.h" | |||
| int main(int argc, char *argv[]) | |||
| { | |||
| cucul_canvas_t *cv; | |||
| caca_canvas_t *cv; | |||
| caca_display_t *dp; | |||
| int x, y; | |||
| cv = cucul_create_canvas(32, 16); | |||
| cv = caca_create_canvas(32, 16); | |||
| if(cv == NULL) | |||
| { | |||
| printf("Failed to create canvas\n"); | |||
| @@ -48,19 +47,19 @@ int main(int argc, char *argv[]) | |||
| uint16_t bgcolor = 0xff00 | (y << 4) | x; | |||
| uint16_t fgcolor = 0xf000 | ((15 - y) << 4) | ((15 - x) << 8); | |||
| cucul_set_color_argb(cv, fgcolor, bgcolor); | |||
| cucul_put_str(cv, x * 2, y, "CA"); | |||
| caca_set_color_argb(cv, fgcolor, bgcolor); | |||
| caca_put_str(cv, x * 2, y, "CA"); | |||
| } | |||
| cucul_set_color_ansi(cv, CUCUL_WHITE, CUCUL_LIGHTBLUE); | |||
| cucul_put_str(cv, 2, 1, " truecolor libcaca "); | |||
| caca_set_color_ansi(cv, CACA_WHITE, CACA_LIGHTBLUE); | |||
| caca_put_str(cv, 2, 1, " truecolor libcaca "); | |||
| caca_refresh_display(dp); | |||
| caca_get_event(dp, CACA_EVENT_KEY_PRESS, NULL, -1); | |||
| caca_free_display(dp); | |||
| cucul_free_canvas(cv); | |||
| caca_free_canvas(cv); | |||
| return 0; | |||
| } | |||
| @@ -18,15 +18,14 @@ | |||
| # include <stdio.h> | |||
| #endif | |||
| #include "cucul.h" | |||
| #include "caca.h" | |||
| int main(int argc, char *argv[]) | |||
| { | |||
| cucul_canvas_t *cv; | |||
| caca_canvas_t *cv; | |||
| caca_display_t *dp; | |||
| cv = cucul_create_canvas(0, 0); | |||
| cv = caca_create_canvas(0, 0); | |||
| if(cv == NULL) | |||
| { | |||
| printf("Can't created canvas\n"); | |||
| @@ -38,66 +37,66 @@ int main(int argc, char *argv[]) | |||
| printf("Can't create display\n"); | |||
| return -1; | |||
| } | |||
| cucul_set_color_ansi(cv, CUCUL_WHITE, CUCUL_BLUE); | |||
| cucul_put_str(cv, 1, 1, "Basic Unicode support"); | |||
| cucul_set_color_ansi(cv, CUCUL_DEFAULT, CUCUL_TRANSPARENT); | |||
| cucul_put_str(cv, 1, 2, "This is ASCII: | abc DEF 123 !@# |"); | |||
| cucul_put_str(cv, 1, 3, "This is Unicode: | äßç δεφ ☺♥♀ ╞╬╗ |"); | |||
| cucul_put_str(cv, 1, 4, "And this is, too: | ἀβϛ ΔЗҒ ᚴᛒᛯ ♩♔✈ |"); | |||
| cucul_put_str(cv, 1, 5, "If the three lines do not have the same length, there is a bug somewhere."); | |||
| cucul_set_color_ansi(cv, CUCUL_WHITE, CUCUL_BLUE); | |||
| cucul_put_str(cv, 1, 7, "Gradient glyphs"); | |||
| cucul_set_color_ansi(cv, CUCUL_DEFAULT, CUCUL_TRANSPARENT); | |||
| cucul_put_str(cv, 31, 8, " 0%"); | |||
| cucul_put_str(cv, 31, 9, " 25%"); | |||
| cucul_put_str(cv, 31, 10, " 50%"); | |||
| cucul_put_str(cv, 31, 11, " 75%"); | |||
| cucul_put_str(cv, 31, 12, "100%"); | |||
| cucul_set_color_ansi(cv, CUCUL_LIGHTRED, CUCUL_LIGHTGREEN); | |||
| cucul_put_str(cv, 1, 8, " "); | |||
| cucul_put_str(cv, 1, 9, "░░░░░░░░░░░░░░░░░░░░░░░░░░░░░"); | |||
| cucul_put_str(cv, 1, 10, "▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒"); | |||
| cucul_put_str(cv, 1, 11, "▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓"); | |||
| cucul_put_str(cv, 1, 12, "█████████████████████████████"); | |||
| cucul_set_color_ansi(cv, CUCUL_LIGHTGREEN, CUCUL_LIGHTRED); | |||
| cucul_put_str(cv, 36, 8, "█████████████████████████████"); | |||
| cucul_put_str(cv, 36, 9, "▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓"); | |||
| cucul_put_str(cv, 36, 10, "▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒"); | |||
| cucul_put_str(cv, 36, 11, "░░░░░░░░░░░░░░░░░░░░░░░░░░░░░"); | |||
| cucul_put_str(cv, 36, 12, " "); | |||
| cucul_set_color_ansi(cv, CUCUL_WHITE, CUCUL_BLUE); | |||
| cucul_put_str(cv, 1, 14, "Double width characters"); | |||
| cucul_set_color_ansi(cv, CUCUL_LIGHTRED, CUCUL_TRANSPARENT); | |||
| cucul_put_str(cv, 1, 15, "| ドラゴン ボーレ |"); | |||
| cucul_set_color_ansi(cv, CUCUL_DEFAULT, CUCUL_TRANSPARENT); | |||
| cucul_put_str(cv, 1, 16, "| ()()()() ()()() |"); | |||
| cucul_set_color_ansi(cv, CUCUL_YELLOW, CUCUL_TRANSPARENT); | |||
| cucul_put_str(cv, 1, 17, "| ドラゴン"); | |||
| cucul_put_str(cv, 12, 17, "ボーレ |"); | |||
| cucul_set_color_ansi(cv, CUCUL_DEFAULT, CUCUL_TRANSPARENT); | |||
| cucul_put_str(cv, 1, 18, "If the three lines do not have the same length, there is a bug somewhere."); | |||
| cucul_put_str(cv, 1, 20, "CP437 glyphs: ☺ ☻ ♥ ♦ ♣ ♠ • ◘ ○ ◙ ♂ ♀ ♪ ♫ ☼ ► ◄ ↕ ‼ ¶ § ▬ ↨ ↑ ↓ → ← ∟ ↔ ▲ ▼"); | |||
| cucul_put_str(cv, 1, 21, "more CP437: α ß Γ π Σ σ µ τ Φ Θ Ω δ ∞ φ ε ∩ ≡ ± ≥ ≤ ⌠ ⌡ ÷ ≈ ° ∙ · √ ⁿ ² ■"); | |||
| cucul_put_str(cv, 1, 22, "drawing blocks: ███ ▓▓▓ ▒▒▒ ░░░ ▀ ▄ ▌ ▐ █ ▖ ▗ ▘ ▝ ▚ ▞ ▙ ▛ ▜ ▟ ─ │ ┌ ┐ └ ┘ ├ ┤"); | |||
| cucul_put_str(cv, 1, 23, "more drawing: ┬ ┴ ┼ ═ ║ ╒ ╓ ╔ ╕ ╖ ╗ ╘ ╙ ╚ ╛ ╜ ╝ ╞ ╟ ╠ ╡ ╢ ╣ ╤ ╥ ╦ ╧ ╨ ╩ ╪ ╫ ╬"); | |||
| cucul_put_str(cv, 1, 24, "misc Unicode: ● ☭ ☮ ☯ ♔ ♛ ♙ ♞ ⚒ ⚓ ⚠"); | |||
| caca_set_color_ansi(cv, CACA_WHITE, CACA_BLUE); | |||
| caca_put_str(cv, 1, 1, "Basic Unicode support"); | |||
| caca_set_color_ansi(cv, CACA_DEFAULT, CACA_TRANSPARENT); | |||
| caca_put_str(cv, 1, 2, "This is ASCII: | abc DEF 123 !@# |"); | |||
| caca_put_str(cv, 1, 3, "This is Unicode: | äßç δεφ ☺♥♀ ╞╬╗ |"); | |||
| caca_put_str(cv, 1, 4, "And this is, too: | ἀβϛ ΔЗҒ ᚴᛒᛯ ♩♔✈ |"); | |||
| caca_put_str(cv, 1, 5, "If the three lines do not have the same length, there is a bug somewhere."); | |||
| caca_set_color_ansi(cv, CACA_WHITE, CACA_BLUE); | |||
| caca_put_str(cv, 1, 7, "Gradient glyphs"); | |||
| caca_set_color_ansi(cv, CACA_DEFAULT, CACA_TRANSPARENT); | |||
| caca_put_str(cv, 31, 8, " 0%"); | |||
| caca_put_str(cv, 31, 9, " 25%"); | |||
| caca_put_str(cv, 31, 10, " 50%"); | |||
| caca_put_str(cv, 31, 11, " 75%"); | |||
| caca_put_str(cv, 31, 12, "100%"); | |||
| caca_set_color_ansi(cv, CACA_LIGHTRED, CACA_LIGHTGREEN); | |||
| caca_put_str(cv, 1, 8, " "); | |||
| caca_put_str(cv, 1, 9, "░░░░░░░░░░░░░░░░░░░░░░░░░░░░░"); | |||
| caca_put_str(cv, 1, 10, "▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒"); | |||
| caca_put_str(cv, 1, 11, "▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓"); | |||
| caca_put_str(cv, 1, 12, "█████████████████████████████"); | |||
| caca_set_color_ansi(cv, CACA_LIGHTGREEN, CACA_LIGHTRED); | |||
| caca_put_str(cv, 36, 8, "█████████████████████████████"); | |||
| caca_put_str(cv, 36, 9, "▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓"); | |||
| caca_put_str(cv, 36, 10, "▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒"); | |||
| caca_put_str(cv, 36, 11, "░░░░░░░░░░░░░░░░░░░░░░░░░░░░░"); | |||
| caca_put_str(cv, 36, 12, " "); | |||
| caca_set_color_ansi(cv, CACA_WHITE, CACA_BLUE); | |||
| caca_put_str(cv, 1, 14, "Double width characters"); | |||
| caca_set_color_ansi(cv, CACA_LIGHTRED, CACA_TRANSPARENT); | |||
| caca_put_str(cv, 1, 15, "| ドラゴン ボーレ |"); | |||
| caca_set_color_ansi(cv, CACA_DEFAULT, CACA_TRANSPARENT); | |||
| caca_put_str(cv, 1, 16, "| ()()()() ()()() |"); | |||
| caca_set_color_ansi(cv, CACA_YELLOW, CACA_TRANSPARENT); | |||
| caca_put_str(cv, 1, 17, "| ドラゴン"); | |||
| caca_put_str(cv, 12, 17, "ボーレ |"); | |||
| caca_set_color_ansi(cv, CACA_DEFAULT, CACA_TRANSPARENT); | |||
| caca_put_str(cv, 1, 18, "If the three lines do not have the same length, there is a bug somewhere."); | |||
| caca_put_str(cv, 1, 20, "CP437 glyphs: ☺ ☻ ♥ ♦ ♣ ♠ • ◘ ○ ◙ ♂ ♀ ♪ ♫ ☼ ► ◄ ↕ ‼ ¶ § ▬ ↨ ↑ ↓ → ← ∟ ↔ ▲ ▼"); | |||
| caca_put_str(cv, 1, 21, "more CP437: α ß Γ π Σ σ µ τ Φ Θ Ω δ ∞ φ ε ∩ ≡ ± ≥ ≤ ⌠ ⌡ ÷ ≈ ° ∙ · √ ⁿ ² ■"); | |||
| caca_put_str(cv, 1, 22, "drawing blocks: ███ ▓▓▓ ▒▒▒ ░░░ ▀ ▄ ▌ ▐ █ ▖ ▗ ▘ ▝ ▚ ▞ ▙ ▛ ▜ ▟ ─ │ ┌ ┐ └ ┘ ├ ┤"); | |||
| caca_put_str(cv, 1, 23, "more drawing: ┬ ┴ ┼ ═ ║ ╒ ╓ ╔ ╕ ╖ ╗ ╘ ╙ ╚ ╛ ╜ ╝ ╞ ╟ ╠ ╡ ╢ ╣ ╤ ╥ ╦ ╧ ╨ ╩ ╪ ╫ ╬"); | |||
| caca_put_str(cv, 1, 24, "misc Unicode: ● ☭ ☮ ☯ ♔ ♛ ♙ ♞ ⚒ ⚓ ⚠"); | |||
| caca_refresh_display(dp); | |||
| caca_get_event(dp, CACA_EVENT_KEY_PRESS, NULL, -1); | |||
| caca_free_display(dp); | |||
| cucul_free_canvas(cv); | |||
| caca_free_canvas(cv); | |||
| return 0; | |||
| } | |||
| @@ -1,5 +1,5 @@ | |||
| /* | |||
| * libcucul Canvas for ultrafast compositing of Unicode letters | |||
| * libcaca Canvas for ultrafast compositing of Unicode letters | |||
| * libcaca Colour ASCII-Art library | |||
| * Copyright (c) 2006 Sam Hocevar <sam@zoy.org> | |||
| * 2006 Jean-Yves Lamoureux <jylam@lnxscene.org> | |||
| @@ -16,12 +16,12 @@ | |||
| /* | |||
| * This file contains replacement functions for the standard C library | |||
| * that must be used when building libcucul and libcaca into a kernel. | |||
| * that must be used when building libcaca and libcaca into a kernel. | |||
| */ | |||
| #include "config.h" | |||
| #include "cucul_types.h" | |||
| #include "caca_types.h" | |||
| #ifdef __KERNEL__ | |||
| @@ -1,5 +1,5 @@ | |||
| /* | |||
| * libcucul Canvas for ultrafast compositing of Unicode letters | |||
| * libcaca Canvas for ultrafast compositing of Unicode letters | |||
| * libcaca Colour ASCII-Art library | |||
| * Copyright (c) 2006 Sam Hocevar <sam@zoy.org> | |||
| * All Rights Reserved | |||
| @@ -15,7 +15,7 @@ | |||
| /* | |||
| * This file contains replacement functions for the standard C library | |||
| * that must be used when building libcucul and libcaca into a kernel. | |||
| * that must be used when building libcaca and libcaca into a kernel. | |||
| */ | |||
| /* Various defines */ | |||
| @@ -4,12 +4,12 @@ NULL = | |||
| EXTRA_DIST = libcaca.sln \ | |||
| config.h \ | |||
| cucul_types.h \ | |||
| libcucul.vcproj \ | |||
| caca_types.h \ | |||
| libcaca.vcproj \ | |||
| libcaca.vcproj \ | |||
| cacafire.vcproj \ | |||
| cacademo.vcproj \ | |||
| cucul-sharp.csproj \ | |||
| caca-sharp.csproj \ | |||
| caca-sharp.csproj \ | |||
| test-csharp.csproj \ | |||
| $(NULL) | |||
| @@ -1,2 +1,2 @@ | |||
| #define CUCUL_TYPES 3 | |||
| #include "../cucul/cucul_types.h.in" | |||
| #define CACA_TYPES 3 | |||
| #include "../caca/caca_types.h.in" | |||
| @@ -4,30 +4,22 @@ rubylibdir = $(RUBY_SITEARCHDIR) | |||
| rubysitedir = $(RUBY_SITELIBDIR) | |||
| if USE_RUBY | |||
| rubylib_LTLIBRARIES = caca.la cucul.la | |||
| rubylib_LTLIBRARIES = caca.la | |||
| rubysite_DATA = lib/caca.rb | |||
| TESTS = test | |||
| endif | |||
| CFLAGS += -Wno-strict-prototypes -Wno-missing-prototypes | |||
| cucul_la_CPPFLAGS = -I$(top_srcdir)/cucul -I../cucul $(RUBY_CFLAGS) | |||
| cucul_la_SOURCES = cucul.c \ | |||
| common.h \ | |||
| cucul-canvas.c \ | |||
| cucul-canvas.h \ | |||
| cucul-dither.c \ | |||
| cucul-dither.h \ | |||
| cucul-font.c \ | |||
| cucul-font.h \ | |||
| $(NULL) | |||
| cucul_la_LDFLAGS = -module -avoid-version -shared $(RUBY_LIBS) | |||
| cucul_la_LIBADD = ../cucul/libcucul.la | |||
| caca_la_CPPFLAGS = -I$(top_srcdir)/caca -I$(top_srcdir)/cucul -I../cucul \ | |||
| $(RUBY_CFLAGS) | |||
| caca_la_CPPFLAGS = -I$(top_srcdir)/caca -I../caca $(RUBY_CFLAGS) | |||
| caca_la_SOURCES = caca.c \ | |||
| common.h \ | |||
| caca-canvas.c \ | |||
| caca-canvas.h \ | |||
| caca-dither.c \ | |||
| caca-dither.h \ | |||
| caca-font.c \ | |||
| caca-font.h \ | |||
| caca-display.c \ | |||
| caca-display.h \ | |||
| caca-event.c \ | |||
| @@ -1,5 +1,5 @@ | |||
| /* | |||
| * libcucul Ruby bindings | |||
| * libcaca Ruby bindings | |||
| * Copyright (c) 2007 Pascal Terjan <pterjan@linuxfr.org> | |||
| * | |||
| * This library is free software. It comes without any warranty, to | |||
| @@ -10,10 +10,10 @@ | |||
| */ | |||
| #include <ruby.h> | |||
| #include <cucul.h> | |||
| #include <caca.h> | |||
| #include <errno.h> | |||
| #include "cucul-dither.h" | |||
| #include "cucul-font.h" | |||
| #include "caca-dither.h" | |||
| #include "caca-font.h" | |||
| #include "common.h" | |||
| VALUE cCanvas; | |||
| @@ -21,7 +21,7 @@ VALUE cCanvas; | |||
| #define simple_func(x) \ | |||
| static VALUE x (VALUE self) \ | |||
| { \ | |||
| if( cucul_##x (_SELF) <0) \ | |||
| if( caca_##x (_SELF) <0) \ | |||
| rb_raise(rb_eRuntimeError, strerror(errno)); \ | |||
| \ | |||
| return self; \ | |||
| @@ -30,12 +30,12 @@ static VALUE x (VALUE self) \ | |||
| #define get_int(x) \ | |||
| static VALUE get_##x (VALUE self) \ | |||
| { \ | |||
| return INT2NUM(cucul_get_##x (_SELF)); \ | |||
| return INT2NUM(caca_get_##x (_SELF)); \ | |||
| } | |||
| static void canvas_free(void * p) | |||
| { | |||
| cucul_free_canvas((cucul_canvas_t *)p); | |||
| caca_free_canvas((caca_canvas_t *)p); | |||
| } | |||
| static VALUE canvas_alloc(VALUE klass) | |||
| @@ -45,16 +45,16 @@ static VALUE canvas_alloc(VALUE klass) | |||
| return obj; | |||
| } | |||
| VALUE canvas_create(cucul_canvas_t *canvas) | |||
| VALUE canvas_create(caca_canvas_t *canvas) | |||
| { | |||
| return Data_Wrap_Struct(cCanvas, NULL, NULL, canvas); | |||
| } | |||
| static VALUE canvas_initialize(VALUE self, VALUE width, VALUE height) | |||
| { | |||
| cucul_canvas_t *canvas; | |||
| caca_canvas_t *canvas; | |||
| canvas = cucul_create_canvas(NUM2INT(width), NUM2INT(height)); | |||
| canvas = caca_create_canvas(NUM2INT(width), NUM2INT(height)); | |||
| if(canvas == NULL) | |||
| { | |||
| @@ -71,7 +71,7 @@ get_int(canvas_width) | |||
| static VALUE set_canvas_width(VALUE self, VALUE width) | |||
| { | |||
| cucul_set_canvas_size(_SELF, NUM2INT(width), cucul_get_canvas_height(_SELF)); | |||
| caca_set_canvas_size(_SELF, NUM2INT(width), caca_get_canvas_height(_SELF)); | |||
| return width; | |||
| } | |||
| @@ -83,7 +83,7 @@ static VALUE set_canvas_width2(VALUE self, VALUE width) | |||
| static VALUE set_canvas_height(VALUE self, VALUE height) | |||
| { | |||
| cucul_set_canvas_size(_SELF, cucul_get_canvas_width(_SELF), NUM2INT(height)); | |||
| caca_set_canvas_size(_SELF, caca_get_canvas_width(_SELF), NUM2INT(height)); | |||
| return height; | |||
| } | |||
| @@ -95,7 +95,7 @@ static VALUE set_canvas_height2(VALUE self, VALUE height) | |||
| static VALUE set_canvas_size(VALUE self, VALUE height, VALUE width) | |||
| { | |||
| cucul_set_canvas_size(_SELF, NUM2INT(width), NUM2INT(height)); | |||
| caca_set_canvas_size(_SELF, NUM2INT(width), NUM2INT(height)); | |||
| return self; | |||
| } | |||
| @@ -103,7 +103,7 @@ static VALUE set_canvas_size(VALUE self, VALUE height, VALUE width) | |||
| static VALUE gotoxy(VALUE self, VALUE x, VALUE y) | |||
| { | |||
| if( cucul_gotoxy(_SELF, NUM2INT(x), NUM2INT(y)) <0) { | |||
| if( caca_gotoxy(_SELF, NUM2INT(x), NUM2INT(y)) <0) { | |||
| rb_raise(rb_eRuntimeError, strerror(errno)); | |||
| } | |||
| return self; | |||
| @@ -116,33 +116,33 @@ simple_func(clear_canvas) | |||
| static VALUE put_char(VALUE self, VALUE x, VALUE y, VALUE ch) | |||
| { | |||
| cucul_put_char(_SELF, NUM2INT(x), NUM2INT(y), NUM2ULONG(ch)); | |||
| caca_put_char(_SELF, NUM2INT(x), NUM2INT(y), NUM2ULONG(ch)); | |||
| return self; | |||
| } | |||
| static VALUE get_char(VALUE self, VALUE x, VALUE y) | |||
| { | |||
| unsigned long int ch; | |||
| ch = cucul_get_char(_SELF, NUM2INT(x), NUM2INT(y)); | |||
| ch = caca_get_char(_SELF, NUM2INT(x), NUM2INT(y)); | |||
| return INT2NUM(ch); | |||
| } | |||
| static VALUE put_str(VALUE self, VALUE x, VALUE y, VALUE str) | |||
| { | |||
| cucul_put_str(_SELF, NUM2INT(x), NUM2INT(y), StringValuePtr(str)); | |||
| caca_put_str(_SELF, NUM2INT(x), NUM2INT(y), StringValuePtr(str)); | |||
| return self; | |||
| } | |||
| static VALUE get_attr(VALUE self, VALUE x, VALUE y) | |||
| { | |||
| unsigned long int ch; | |||
| ch = cucul_get_attr(_SELF, NUM2INT(x), NUM2INT(y)); | |||
| ch = caca_get_attr(_SELF, NUM2INT(x), NUM2INT(y)); | |||
| return INT2NUM(ch); | |||
| } | |||
| static VALUE set_attr(VALUE self, VALUE attr) | |||
| { | |||
| if(cucul_set_attr(_SELF, NUM2ULONG(attr)) <0) | |||
| if(caca_set_attr(_SELF, NUM2ULONG(attr)) <0) | |||
| rb_raise(rb_eRuntimeError, strerror(errno)); | |||
| return self; | |||
| @@ -156,7 +156,7 @@ static VALUE set_attr2(VALUE self, VALUE attr) | |||
| static VALUE put_attr(VALUE self, VALUE x, VALUE y, VALUE attr) | |||
| { | |||
| if(cucul_put_attr(_SELF, NUM2INT(x), NUM2INT(y), NUM2ULONG(attr)) <0) | |||
| if(caca_put_attr(_SELF, NUM2INT(x), NUM2INT(y), NUM2ULONG(attr)) <0) | |||
| rb_raise(rb_eRuntimeError, strerror(errno)); | |||
| return self; | |||
| @@ -164,7 +164,7 @@ static VALUE put_attr(VALUE self, VALUE x, VALUE y, VALUE attr) | |||
| static VALUE set_color_ansi(VALUE self, VALUE fg, VALUE bg) | |||
| { | |||
| if(cucul_set_color_ansi(_SELF, NUM2INT(fg), NUM2INT(bg)) <0) | |||
| if(caca_set_color_ansi(_SELF, NUM2INT(fg), NUM2INT(bg)) <0) | |||
| rb_raise(rb_eRuntimeError, strerror(errno)); | |||
| return self; | |||
| @@ -172,7 +172,7 @@ static VALUE set_color_ansi(VALUE self, VALUE fg, VALUE bg) | |||
| static VALUE set_color_argb(VALUE self, VALUE fg, VALUE bg) | |||
| { | |||
| if(cucul_set_color_argb(_SELF, NUM2UINT(fg), NUM2UINT(bg)) <0) { | |||
| if(caca_set_color_argb(_SELF, NUM2UINT(fg), NUM2UINT(bg)) <0) { | |||
| rb_raise(rb_eRuntimeError, strerror(errno)); | |||
| } | |||
| return self; | |||
| @@ -186,7 +186,7 @@ static VALUE cprintf(int argc, VALUE* argv, VALUE self) | |||
| x = NUM2INT(rx); | |||
| y = NUM2INT(ry); | |||
| string = rb_funcall2(rb_mKernel, rb_intern("sprintf"), argc-2, argv+2); | |||
| cucul_put_str(_SELF, x, y, StringValuePtr(string)); | |||
| caca_put_str(_SELF, x, y, StringValuePtr(string)); | |||
| return self; | |||
| } | |||
| @@ -196,13 +196,13 @@ get_int(canvas_handle_y) | |||
| static VALUE set_canvas_handle(VALUE self, VALUE x, VALUE y) | |||
| { | |||
| cucul_set_canvas_handle(_SELF, NUM2INT(x), NUM2INT(y)); | |||
| caca_set_canvas_handle(_SELF, NUM2INT(x), NUM2INT(y)); | |||
| return self; | |||
| } | |||
| static VALUE blit(int argc, VALUE* argv, VALUE self) { | |||
| VALUE x, y, src, mask; | |||
| cucul_canvas_t *csrc, *cmask; | |||
| caca_canvas_t *csrc, *cmask; | |||
| rb_scan_args(argc, argv, "31", &x, &y, &src, &mask); | |||
| @@ -213,7 +213,7 @@ static VALUE blit(int argc, VALUE* argv, VALUE self) { | |||
| { | |||
| rb_raise(rb_eArgError, "src is not a Cucul::Canvas"); | |||
| } | |||
| Data_Get_Struct(src, cucul_canvas_t, csrc); | |||
| Data_Get_Struct(src, caca_canvas_t, csrc); | |||
| if(!NIL_P(mask)) | |||
| { | |||
| @@ -221,12 +221,12 @@ static VALUE blit(int argc, VALUE* argv, VALUE self) { | |||
| { | |||
| rb_raise(rb_eArgError, "mask is not a Cucul::Canvas"); | |||
| } | |||
| Data_Get_Struct(mask, cucul_canvas_t, cmask); | |||
| Data_Get_Struct(mask, caca_canvas_t, cmask); | |||
| } | |||
| else | |||
| cmask = NULL; | |||
| if(cucul_blit(_SELF, NUM2INT(x), NUM2INT(y), csrc, cmask)<0) | |||
| if(caca_blit(_SELF, NUM2INT(x), NUM2INT(y), csrc, cmask)<0) | |||
| rb_raise(rb_eRuntimeError, strerror(errno)); | |||
| return self; | |||
| @@ -234,7 +234,7 @@ static VALUE blit(int argc, VALUE* argv, VALUE self) { | |||
| static VALUE set_canvas_boundaries(VALUE self, VALUE x, VALUE y, VALUE w, VALUE h) | |||
| { | |||
| if(cucul_set_canvas_boundaries(_SELF, NUM2INT(x), NUM2INT(y), NUM2UINT(w), NUM2UINT(h))<0) | |||
| if(caca_set_canvas_boundaries(_SELF, NUM2INT(x), NUM2INT(y), NUM2UINT(w), NUM2UINT(h))<0) | |||
| { | |||
| rb_raise(rb_eRuntimeError, strerror(errno)); | |||
| } | |||
| @@ -256,7 +256,7 @@ simple_func(stretch_right) | |||
| static VALUE draw_line(VALUE self, VALUE x1, VALUE y1, VALUE x2, VALUE y2, VALUE ch) | |||
| { | |||
| cucul_draw_line(_SELF, NUM2INT(x1), NUM2INT(y1), NUM2INT(x2), NUM2INT(y2),NUM2ULONG(ch)); | |||
| caca_draw_line(_SELF, NUM2INT(x1), NUM2INT(y1), NUM2INT(x2), NUM2INT(y2),NUM2ULONG(ch)); | |||
| return self; | |||
| } | |||
| @@ -308,7 +308,7 @@ static VALUE draw_polyline(VALUE self, VALUE points, VALUE ch) | |||
| n--; | |||
| cucul_draw_polyline(_SELF, ax, ay, n, NUM2ULONG(ch)); | |||
| caca_draw_polyline(_SELF, ax, ay, n, NUM2ULONG(ch)); | |||
| free(ax); | |||
| free(ay); | |||
| @@ -318,7 +318,7 @@ static VALUE draw_polyline(VALUE self, VALUE points, VALUE ch) | |||
| static VALUE draw_thin_line(VALUE self, VALUE x1, VALUE y1, VALUE x2, VALUE y2) | |||
| { | |||
| cucul_draw_thin_line(_SELF, NUM2INT(x1), NUM2INT(y1), NUM2INT(x2), NUM2INT(y2)); | |||
| caca_draw_thin_line(_SELF, NUM2INT(x1), NUM2INT(y1), NUM2INT(x2), NUM2INT(y2)); | |||
| return self; | |||
| } | |||
| @@ -370,7 +370,7 @@ static VALUE draw_thin_polyline(VALUE self, VALUE points) | |||
| n--; | |||
| cucul_draw_thin_polyline(_SELF, ax, ay, n); | |||
| caca_draw_thin_polyline(_SELF, ax, ay, n); | |||
| free(ax); | |||
| free(ay); | |||
| @@ -380,67 +380,67 @@ static VALUE draw_thin_polyline(VALUE self, VALUE points) | |||
| static VALUE draw_circle(VALUE self, VALUE x, VALUE y, VALUE r, VALUE ch) | |||
| { | |||
| cucul_draw_circle(_SELF, NUM2INT(x), NUM2INT(y), NUM2INT(r), NUM2ULONG(ch)); | |||
| caca_draw_circle(_SELF, NUM2INT(x), NUM2INT(y), NUM2INT(r), NUM2ULONG(ch)); | |||
| return self; | |||
| } | |||
| static VALUE draw_ellipse(VALUE self, VALUE x, VALUE y, VALUE a, VALUE b, VALUE ch) | |||
| { | |||
| cucul_draw_ellipse(_SELF, NUM2INT(x), NUM2INT(y), NUM2INT(a), NUM2INT(b), NUM2ULONG(ch)); | |||
| caca_draw_ellipse(_SELF, NUM2INT(x), NUM2INT(y), NUM2INT(a), NUM2INT(b), NUM2ULONG(ch)); | |||
| return self; | |||
| } | |||
| static VALUE draw_thin_ellipse(VALUE self, VALUE x, VALUE y, VALUE a, VALUE b) | |||
| { | |||
| cucul_draw_thin_ellipse(_SELF, NUM2INT(x), NUM2INT(y), NUM2INT(a), NUM2INT(b)); | |||
| caca_draw_thin_ellipse(_SELF, NUM2INT(x), NUM2INT(y), NUM2INT(a), NUM2INT(b)); | |||
| return self; | |||
| } | |||
| static VALUE fill_ellipse(VALUE self, VALUE x, VALUE y, VALUE a, VALUE b, VALUE ch) | |||
| { | |||
| cucul_fill_ellipse(_SELF, NUM2INT(x), NUM2INT(y), NUM2INT(a), NUM2INT(b), NUM2ULONG(ch)); | |||
| caca_fill_ellipse(_SELF, NUM2INT(x), NUM2INT(y), NUM2INT(a), NUM2INT(b), NUM2ULONG(ch)); | |||
| return self; | |||
| } | |||
| static VALUE draw_box(VALUE self, VALUE x, VALUE y, VALUE w, VALUE h, VALUE ch) | |||
| { | |||
| cucul_draw_box(_SELF, NUM2INT(x), NUM2INT(y), NUM2INT(w), NUM2INT(h), NUM2ULONG(ch)); | |||
| caca_draw_box(_SELF, NUM2INT(x), NUM2INT(y), NUM2INT(w), NUM2INT(h), NUM2ULONG(ch)); | |||
| return self; | |||
| } | |||
| static VALUE draw_thin_box(VALUE self, VALUE x, VALUE y, VALUE w, VALUE h) | |||
| { | |||
| cucul_draw_thin_box(_SELF, NUM2INT(x), NUM2INT(y), NUM2INT(w), NUM2INT(h)); | |||
| caca_draw_thin_box(_SELF, NUM2INT(x), NUM2INT(y), NUM2INT(w), NUM2INT(h)); | |||
| return self; | |||
| } | |||
| static VALUE draw_cp437_box(VALUE self, VALUE x, VALUE y, VALUE w, VALUE h) | |||
| { | |||
| cucul_draw_cp437_box(_SELF, NUM2INT(x), NUM2INT(y), NUM2INT(w), NUM2INT(h)); | |||
| caca_draw_cp437_box(_SELF, NUM2INT(x), NUM2INT(y), NUM2INT(w), NUM2INT(h)); | |||
| return self; | |||
| } | |||
| static VALUE fill_box(VALUE self, VALUE x, VALUE y, VALUE w, VALUE h, VALUE ch) | |||
| { | |||
| cucul_fill_box(_SELF, NUM2INT(x), NUM2INT(y), NUM2INT(w), NUM2INT(h), NUM2ULONG(ch)); | |||
| caca_fill_box(_SELF, NUM2INT(x), NUM2INT(y), NUM2INT(w), NUM2INT(h), NUM2ULONG(ch)); | |||
| return self; | |||
| } | |||
| static VALUE draw_triangle(VALUE self, VALUE x1, VALUE y1, VALUE x2, VALUE y2, VALUE x3, VALUE y3, VALUE ch) | |||
| { | |||
| cucul_draw_triangle(_SELF, NUM2INT(x1), NUM2INT(y1), NUM2INT(x2), NUM2INT(y2), NUM2INT(x3), NUM2INT(y3), NUM2ULONG(ch)); | |||
| caca_draw_triangle(_SELF, NUM2INT(x1), NUM2INT(y1), NUM2INT(x2), NUM2INT(y2), NUM2INT(x3), NUM2INT(y3), NUM2ULONG(ch)); | |||
| return self; | |||
| } | |||
| static VALUE draw_thin_triangle(VALUE self, VALUE x1, VALUE y1, VALUE x2, VALUE y2, VALUE x3, VALUE y3) | |||
| { | |||
| cucul_draw_thin_triangle(_SELF, NUM2INT(x1), NUM2INT(y1), NUM2INT(x2), NUM2INT(y2), NUM2INT(x3), NUM2INT(y3)); | |||
| caca_draw_thin_triangle(_SELF, NUM2INT(x1), NUM2INT(y1), NUM2INT(x2), NUM2INT(y2), NUM2INT(x3), NUM2INT(y3)); | |||
| return self; | |||
| } | |||
| static VALUE fill_triangle(VALUE self, VALUE x1, VALUE y1, VALUE x2, VALUE y2, VALUE x3, VALUE y3, VALUE ch) | |||
| { | |||
| cucul_fill_triangle(_SELF, NUM2INT(x1), NUM2INT(y1), NUM2INT(x2), NUM2INT(y2), NUM2INT(x3), NUM2INT(y3), NUM2ULONG(ch)); | |||
| caca_fill_triangle(_SELF, NUM2INT(x1), NUM2INT(y1), NUM2INT(x2), NUM2INT(y2), NUM2INT(x3), NUM2INT(y3), NUM2ULONG(ch)); | |||
| return self; | |||
| } | |||
| @@ -450,7 +450,7 @@ static VALUE dither_bitmap(VALUE self, VALUE x, VALUE y, VALUE w, VALUE h, VALUE | |||
| rb_raise(rb_eArgError, "d is not a Cucul::Dither"); | |||
| Check_Type(pixels, T_STRING); | |||
| cucul_dither_bitmap(_SELF, NUM2INT(x), NUM2INT(y), NUM2INT(w), NUM2INT(h), DATA_PTR(d), StringValuePtr(pixels)); | |||
| caca_dither_bitmap(_SELF, NUM2INT(x), NUM2INT(y), NUM2INT(w), NUM2INT(h), DATA_PTR(d), StringValuePtr(pixels)); | |||
| return self; | |||
| } | |||
| @@ -460,7 +460,7 @@ get_int(frame_count) | |||
| static VALUE set_frame(VALUE self, VALUE id) | |||
| { | |||
| if(cucul_set_frame(_SELF, NUM2INT(id))<0) | |||
| if(caca_set_frame(_SELF, NUM2INT(id))<0) | |||
| rb_raise(rb_eArgError, strerror(errno)); | |||
| return self; | |||
| @@ -474,12 +474,12 @@ static VALUE set_frame2(VALUE self, VALUE id) | |||
| static VALUE get_frame_name(VALUE self) | |||
| { | |||
| return rb_str_new2(cucul_get_frame_name(_SELF)); | |||
| return rb_str_new2(caca_get_frame_name(_SELF)); | |||
| } | |||
| static VALUE set_frame_name(VALUE self, VALUE name) | |||
| { | |||
| if(cucul_set_frame_name(_SELF, StringValuePtr(name))<0) | |||
| if(caca_set_frame_name(_SELF, StringValuePtr(name))<0) | |||
| rb_raise(rb_eRuntimeError, strerror(errno)); | |||
| return self; | |||
| @@ -493,7 +493,7 @@ static VALUE set_frame_name2(VALUE self, VALUE name) | |||
| static VALUE create_frame(VALUE self, VALUE id) | |||
| { | |||
| if(cucul_create_frame(_SELF, NUM2INT(id))<0) { | |||
| if(caca_create_frame(_SELF, NUM2INT(id))<0) { | |||
| rb_raise(rb_eRuntimeError, strerror(errno)); | |||
| } | |||
| return self; | |||
| @@ -501,7 +501,7 @@ static VALUE create_frame(VALUE self, VALUE id) | |||
| static VALUE free_frame(VALUE self, VALUE id) | |||
| { | |||
| if(cucul_free_frame(_SELF, NUM2INT(id))<0) { | |||
| if(caca_free_frame(_SELF, NUM2INT(id))<0) { | |||
| rb_raise(rb_eArgError, strerror(errno)); | |||
| } | |||
| return self; | |||
| @@ -512,7 +512,7 @@ static VALUE free_frame(VALUE self, VALUE id) | |||
| static VALUE render_canvas(VALUE self, VALUE font, VALUE width, VALUE height, VALUE pitch) | |||
| { | |||
| void *buf; | |||
| cucul_font_t *f; | |||
| caca_font_t *f; | |||
| VALUE b; | |||
| if(CLASS_OF(font) != cFont) | |||
| @@ -527,7 +527,7 @@ static VALUE render_canvas(VALUE self, VALUE font, VALUE width, VALUE height, VA | |||
| } | |||
| f = DATA_PTR(font); | |||
| cucul_render_canvas(_SELF, f, buf, NUM2UINT(width), NUM2UINT(height), NUM2UINT(pitch)); | |||
| caca_render_canvas(_SELF, f, buf, NUM2UINT(width), NUM2UINT(height), NUM2UINT(pitch)); | |||
| b = rb_str_new(buf, width*height*4); | |||
| free(buf); | |||
| @@ -537,7 +537,7 @@ static VALUE render_canvas(VALUE self, VALUE font, VALUE width, VALUE height, VA | |||
| static VALUE import_memory(VALUE self, VALUE data, VALUE format) | |||
| { | |||
| long int bytes; | |||
| bytes = cucul_import_memory (_SELF, StringValuePtr(data), RSTRING(StringValue(data))->len, StringValuePtr(format)); | |||
| bytes = caca_import_memory (_SELF, StringValuePtr(data), RSTRING(StringValue(data))->len, StringValuePtr(format)); | |||
| if(bytes <= 0) | |||
| rb_raise(rb_eRuntimeError, strerror(errno)); | |||
| @@ -547,7 +547,7 @@ static VALUE import_memory(VALUE self, VALUE data, VALUE format) | |||
| static VALUE import_file(VALUE self, VALUE filename, VALUE format) | |||
| { | |||
| long int bytes; | |||
| bytes = cucul_import_file (_SELF, StringValuePtr(filename), StringValuePtr(format)); | |||
| bytes = caca_import_file (_SELF, StringValuePtr(filename), StringValuePtr(format)); | |||
| if(bytes <= 0) | |||
| rb_raise(rb_eRuntimeError, strerror(errno)); | |||
| @@ -559,7 +559,7 @@ static VALUE export_memory(VALUE self, VALUE format) | |||
| unsigned long int bytes; | |||
| void *result; | |||
| VALUE ret; | |||
| result = cucul_export_memory (_SELF, StringValuePtr(format), &bytes); | |||
| result = caca_export_memory (_SELF, StringValuePtr(format), &bytes); | |||
| ret = rb_str_new(result, bytes); | |||
| free(result); | |||
| return ret; | |||
| @@ -570,7 +570,7 @@ get_singleton_double_list(import) | |||
| /****/ | |||
| void Init_cucul_canvas(VALUE mCucul) | |||
| void Init_caca_canvas(VALUE mCucul) | |||
| { | |||
| cCanvas = rb_define_class_under(mCucul, "Canvas", rb_cObject); | |||
| rb_define_alloc_func(cCanvas, canvas_alloc); | |||
| @@ -0,0 +1,10 @@ | |||
| #ifndef __CACA_CANVAS_H__ | |||
| #define __CACA_CANVAS_H__ | |||
| #include <ruby.h> | |||
| extern VALUE cCanvas; | |||
| extern void Init_caca_canvas(VALUE); | |||
| extern VALUE canvas_create(caca_canvas_t *canvas); | |||
| #endif | |||
| @@ -13,7 +13,7 @@ | |||
| #include <caca.h> | |||
| #include <errno.h> | |||
| #include "caca-event.h" | |||
| #include "cucul-canvas.h" | |||
| #include "caca-canvas.h" | |||
| #include "common.h" | |||
| VALUE cDisplay; | |||
| @@ -33,7 +33,7 @@ static VALUE display_alloc(VALUE klass) | |||
| static VALUE display_initialize(int argc, VALUE* argv, VALUE self) | |||
| { | |||
| caca_display_t *display; | |||
| cucul_canvas_t *canvas = NULL; | |||
| caca_canvas_t *canvas = NULL; | |||
| const char *driver = NULL; | |||
| VALUE cv = Qnil; | |||
| VALUE arg1, arg2; | |||
| @@ -1,5 +1,5 @@ | |||
| /* | |||
| * libcucul Ruby bindings | |||
| * libcaca Ruby bindings | |||
| * Copyright (c) 2007 Pascal Terjan <pterjan@linuxfr.org> | |||
| * | |||
| * This library is free software. It comes without any warranty, to | |||
| @@ -10,7 +10,7 @@ | |||
| */ | |||
| #include <ruby.h> | |||
| #include <cucul.h> | |||
| #include <caca.h> | |||
| #include <errno.h> | |||
| #include "common.h" | |||
| @@ -18,7 +18,7 @@ VALUE cDither; | |||
| void dither_free(void *dither) | |||
| { | |||
| cucul_free_dither((cucul_dither_t *)dither); | |||
| caca_free_dither((caca_dither_t *)dither); | |||
| } | |||
| static VALUE dither_alloc(VALUE klass) | |||
| @@ -30,9 +30,9 @@ static VALUE dither_alloc(VALUE klass) | |||
| static VALUE dither_initialize(VALUE self, VALUE bpp, VALUE w, VALUE h, VALUE pitch, VALUE rmask, VALUE gmask, VALUE bmask, VALUE amask) | |||
| { | |||
| cucul_dither_t *dither; | |||
| caca_dither_t *dither; | |||
| dither = cucul_create_dither(NUM2UINT(bpp), NUM2UINT(w), NUM2UINT(h), NUM2UINT(pitch), NUM2ULONG(rmask), NUM2ULONG(gmask), NUM2ULONG(bmask), NUM2ULONG(amask)); | |||
| dither = caca_create_dither(NUM2UINT(bpp), NUM2UINT(w), NUM2UINT(h), NUM2UINT(pitch), NUM2ULONG(rmask), NUM2ULONG(gmask), NUM2ULONG(bmask), NUM2ULONG(amask)); | |||
| if(dither == NULL) | |||
| { | |||
| rb_raise(rb_eRuntimeError, strerror(errno)); | |||
| @@ -115,7 +115,7 @@ static VALUE set_dither_palette(VALUE self, VALUE palette) | |||
| rb_raise(rb_eArgError, "Invalid palette"); | |||
| } | |||
| if(cucul_set_dither_palette(_SELF, red, green, blue, alpha)<0) | |||
| if(caca_set_dither_palette(_SELF, red, green, blue, alpha)<0) | |||
| { | |||
| free(red); | |||
| free(green); | |||
| @@ -141,7 +141,7 @@ static VALUE set_dither_palette2(VALUE self, VALUE palette) | |||
| #define set_float(x) \ | |||
| static VALUE set_##x(VALUE self, VALUE x) \ | |||
| { \ | |||
| if(cucul_set_dither_##x(_SELF, (float)NUM2DBL(x))<0)\ | |||
| if(caca_set_dither_##x(_SELF, (float)NUM2DBL(x))<0)\ | |||
| rb_raise(rb_eRuntimeError, strerror(errno)); \ | |||
| \ | |||
| return x; \ | |||
| @@ -161,7 +161,7 @@ set_float(contrast) | |||
| get_double_list(dither_##x) \ | |||
| static VALUE set_dither_##x(VALUE self, VALUE x) \ | |||
| { \ | |||
| if(cucul_set_dither_##x(_SELF, StringValuePtr(x))<0) \ | |||
| if(caca_set_dither_##x(_SELF, StringValuePtr(x))<0) \ | |||
| { \ | |||
| rb_raise(rb_eRuntimeError, strerror(errno)); \ | |||
| } \ | |||
| @@ -179,7 +179,7 @@ get_set_str_from_list(color) | |||
| get_set_str_from_list(charset) | |||
| get_set_str_from_list(algorithm) | |||
| void Init_cucul_dither(VALUE mCucul) | |||
| void Init_caca_dither(VALUE mCucul) | |||
| { | |||
| cDither = rb_define_class_under(mCucul, "Dither", rb_cObject); | |||
| rb_define_alloc_func(cDither, dither_alloc); | |||
| @@ -0,0 +1,9 @@ | |||
| #ifndef __CACA_DITHER_H__ | |||
| #define __CACA_DITHER_H__ | |||
| #include <ruby.h> | |||
| extern VALUE cDither; | |||
| extern void Init_caca_dither(VALUE); | |||
| #endif | |||
| @@ -1,5 +1,5 @@ | |||
| /* | |||
| * libcucul Ruby bindings | |||
| * libcaca Ruby bindings | |||
| * Copyright (c) 2007 Pascal Terjan <pterjan@linuxfr.org> | |||
| * | |||
| * This library is free software. It comes without any warranty, to | |||
| @@ -10,7 +10,7 @@ | |||
| */ | |||
| #include <ruby.h> | |||
| #include <cucul.h> | |||
| #include <caca.h> | |||
| #include <errno.h> | |||
| #include "common.h" | |||
| @@ -18,7 +18,7 @@ VALUE cFont; | |||
| void font_free(void *font) | |||
| { | |||
| cucul_free_font((cucul_font_t *)font); | |||
| caca_free_font((caca_font_t *)font); | |||
| } | |||
| static VALUE font_alloc(VALUE klass) | |||
| @@ -30,9 +30,9 @@ static VALUE font_alloc(VALUE klass) | |||
| static VALUE font_initialize(VALUE self, VALUE name) | |||
| { | |||
| cucul_font_t *font; | |||
| caca_font_t *font; | |||
| font = cucul_load_font(StringValuePtr(name), 0); | |||
| font = caca_load_font(StringValuePtr(name), 0); | |||
| if(font == NULL) | |||
| { | |||
| rb_raise(rb_eRuntimeError, strerror(errno)); | |||
| @@ -46,7 +46,7 @@ static VALUE font_list(void) | |||
| VALUE ary; | |||
| char const* const* list; | |||
| list = cucul_get_font_list(); | |||
| list = caca_get_font_list(); | |||
| ary = rb_ary_new(); | |||
| while (*list != NULL) | |||
| @@ -60,12 +60,12 @@ static VALUE font_list(void) | |||
| static VALUE get_font_width(VALUE self) | |||
| { | |||
| return UINT2NUM(cucul_get_font_width(_SELF)); | |||
| return UINT2NUM(caca_get_font_width(_SELF)); | |||
| } | |||
| static VALUE get_font_height(VALUE self) | |||
| { | |||
| return UINT2NUM(cucul_get_font_height(_SELF)); | |||
| return UINT2NUM(caca_get_font_height(_SELF)); | |||
| } | |||
| static VALUE get_font_blocks(VALUE self) | |||
| @@ -73,7 +73,7 @@ static VALUE get_font_blocks(VALUE self) | |||
| VALUE ary; | |||
| uint32_t const *list; | |||
| list = cucul_get_font_blocks(_SELF); | |||
| list = caca_get_font_blocks(_SELF); | |||
| ary = rb_ary_new(); | |||
| while (*list != 0L) | |||
| @@ -85,7 +85,7 @@ static VALUE get_font_blocks(VALUE self) | |||
| return ary; | |||
| } | |||
| void Init_cucul_font(VALUE mCucul) | |||
| void Init_caca_font(VALUE mCucul) | |||
| { | |||
| cFont = rb_define_class_under(mCucul, "Font", rb_cObject); | |||
| rb_define_alloc_func(cFont, font_alloc); | |||
| @@ -0,0 +1,9 @@ | |||
| #ifndef __CACA_FONT_H__ | |||
| #define __CACA_FONT_H__ | |||
| #include <ruby.h> | |||
| extern VALUE cFont; | |||
| extern void Init_caca_font(VALUE); | |||
| #endif | |||
| @@ -12,6 +12,9 @@ | |||
| #include <ruby.h> | |||
| #include <caca.h> | |||
| #include "caca-canvas.h" | |||
| #include "caca-dither.h" | |||
| #include "caca-font.h" | |||
| #include "caca-display.h" | |||
| #include "caca-event.h" | |||
| @@ -26,6 +29,33 @@ void Init_caca() | |||
| rb_define_singleton_method(mCaca, "version", get_version, 0); | |||
| rb_define_const(mCaca, "BLACK", INT2FIX(CACA_BLACK)); | |||
| rb_define_const(mCaca, "BLUE", INT2FIX(CACA_BLUE)); | |||
| rb_define_const(mCaca, "GREEN", INT2FIX(CACA_GREEN)); | |||
| rb_define_const(mCaca, "CYAN", INT2FIX(CACA_CYAN)); | |||
| rb_define_const(mCaca, "RED", INT2FIX(CACA_RED)); | |||
| rb_define_const(mCaca, "MAGENTA", INT2FIX(CACA_MAGENTA)); | |||
| rb_define_const(mCaca, "BROWN", INT2FIX(CACA_BROWN)); | |||
| rb_define_const(mCaca, "LIGHTGRAY", INT2FIX(CACA_LIGHTGRAY)); | |||
| rb_define_const(mCaca, "DARKGRAY", INT2FIX(CACA_DARKGRAY)); | |||
| rb_define_const(mCaca, "LIGHTBLUE", INT2FIX(CACA_LIGHTBLUE)); | |||
| rb_define_const(mCaca, "LIGHTGREEN", INT2FIX(CACA_LIGHTGREEN)); | |||
| rb_define_const(mCaca, "LIGHTCYAN", INT2FIX(CACA_LIGHTCYAN)); | |||
| rb_define_const(mCaca, "LIGHTRED", INT2FIX(CACA_LIGHTRED)); | |||
| rb_define_const(mCaca, "LIGHTMAGENTA", INT2FIX(CACA_LIGHTMAGENTA)); | |||
| rb_define_const(mCaca, "YELLOW", INT2FIX(CACA_YELLOW)); | |||
| rb_define_const(mCaca, "WHITE", INT2FIX(CACA_WHITE)); | |||
| rb_define_const(mCaca, "DEFAULT", INT2FIX(CACA_DEFAULT)); | |||
| rb_define_const(mCaca, "TRANSPARENT", INT2FIX(CACA_TRANSPARENT)); | |||
| rb_define_const(mCaca, "BOLD", INT2FIX(CACA_BOLD)); | |||
| rb_define_const(mCaca, "ITALICS", INT2FIX(CACA_ITALICS)); | |||
| rb_define_const(mCaca, "UNDERLINE", INT2FIX(CACA_UNDERLINE)); | |||
| rb_define_const(mCaca, "BLINK", INT2FIX(CACA_BLINK)); | |||
| Init_caca_canvas(mCaca); | |||
| Init_caca_dither(mCaca); | |||
| Init_caca_font(mCaca); | |||
| Init_caca_display(mCaca); | |||
| Init_caca_event(mCaca); | |||
| } | |||
| @@ -9,7 +9,7 @@ static VALUE x##_list(void) \ | |||
| VALUE ary, ary2; \ | |||
| char const* const* list; \ | |||
| \ | |||
| list = cucul_get_##x##_list(); \ | |||
| list = caca_get_##x##_list(); \ | |||
| ary = rb_ary_new(); \ | |||
| while (*list != NULL) \ | |||
| { \ | |||
| @@ -30,7 +30,7 @@ static VALUE x##_list(VALUE self) \ | |||
| VALUE ary, ary2; \ | |||
| char const* const* list; \ | |||
| \ | |||
| list = cucul_get_##x##_list(_SELF); \ | |||
| list = caca_get_##x##_list(_SELF); \ | |||
| ary = rb_ary_new(); \ | |||
| while (*list != NULL) \ | |||
| { \ | |||
| @@ -1,10 +0,0 @@ | |||
| #ifndef __CUCUL_CANVAS_H__ | |||
| #define __CUCUL_CANVAS_H__ | |||
| #include <ruby.h> | |||
| extern VALUE cCanvas; | |||
| extern void Init_cucul_canvas(VALUE); | |||
| extern VALUE canvas_create(cucul_canvas_t *canvas); | |||
| #endif | |||
| @@ -1,9 +0,0 @@ | |||
| #ifndef __CUCUL_DITHER_H__ | |||
| #define __CUCUL_DITHER_H__ | |||
| #include <ruby.h> | |||
| extern VALUE cDither; | |||
| extern void Init_cucul_dither(VALUE); | |||
| #endif | |||
| @@ -1,9 +0,0 @@ | |||
| #ifndef __CUCUL_FONT_H__ | |||
| #define __CUCUL_FONT_H__ | |||
| #include <ruby.h> | |||
| extern VALUE cFont; | |||
| extern void Init_cucul_font(VALUE); | |||
| #endif | |||
| @@ -1,57 +0,0 @@ | |||
| /* | |||
| * libcucul Ruby bindings | |||
| * Copyright (c) 2007 Pascal Terjan <pterjan@linuxfr.org> | |||
| * | |||
| * This library is free software. It comes without any warranty, to | |||
| * the extent permitted by applicable law. You can redistribute it | |||
| * and/or modify it under the terms of the Do What The Fuck You Want | |||
| * To Public License, Version 2, as published by Sam Hocevar. See | |||
| * http://sam.zoy.org/wtfpl/COPYING for more details. | |||
| */ | |||
| #include <ruby.h> | |||
| #include <cucul.h> | |||
| #include "cucul-canvas.h" | |||
| #include "cucul-dither.h" | |||
| #include "cucul-font.h" | |||
| static VALUE get_version(VALUE self) | |||
| { | |||
| return rb_str_new2(cucul_get_version()); | |||
| } | |||
| void Init_cucul() | |||
| { | |||
| VALUE mCucul = rb_define_module("Cucul"); | |||
| rb_define_singleton_method(mCucul, "version", get_version, 0); | |||
| rb_define_const(mCucul, "BLACK", INT2FIX(CUCUL_BLACK)); | |||
| rb_define_const(mCucul, "BLUE", INT2FIX(CUCUL_BLUE)); | |||
| rb_define_const(mCucul, "GREEN", INT2FIX(CUCUL_GREEN)); | |||
| rb_define_const(mCucul, "CYAN", INT2FIX(CUCUL_CYAN)); | |||
| rb_define_const(mCucul, "RED", INT2FIX(CUCUL_RED)); | |||
| rb_define_const(mCucul, "MAGENTA", INT2FIX(CUCUL_MAGENTA)); | |||
| rb_define_const(mCucul, "BROWN", INT2FIX(CUCUL_BROWN)); | |||
| rb_define_const(mCucul, "LIGHTGRAY", INT2FIX(CUCUL_LIGHTGRAY)); | |||
| rb_define_const(mCucul, "DARKGRAY", INT2FIX(CUCUL_DARKGRAY)); | |||
| rb_define_const(mCucul, "LIGHTBLUE", INT2FIX(CUCUL_LIGHTBLUE)); | |||
| rb_define_const(mCucul, "LIGHTGREEN", INT2FIX(CUCUL_LIGHTGREEN)); | |||
| rb_define_const(mCucul, "LIGHTCYAN", INT2FIX(CUCUL_LIGHTCYAN)); | |||
| rb_define_const(mCucul, "LIGHTRED", INT2FIX(CUCUL_LIGHTRED)); | |||
| rb_define_const(mCucul, "LIGHTMAGENTA", INT2FIX(CUCUL_LIGHTMAGENTA)); | |||
| rb_define_const(mCucul, "YELLOW", INT2FIX(CUCUL_YELLOW)); | |||
| rb_define_const(mCucul, "WHITE", INT2FIX(CUCUL_WHITE)); | |||
| rb_define_const(mCucul, "DEFAULT", INT2FIX(CUCUL_DEFAULT)); | |||
| rb_define_const(mCucul, "TRANSPARENT", INT2FIX(CUCUL_TRANSPARENT)); | |||
| rb_define_const(mCucul, "BOLD", INT2FIX(CUCUL_BOLD)); | |||
| rb_define_const(mCucul, "ITALICS", INT2FIX(CUCUL_ITALICS)); | |||
| rb_define_const(mCucul, "UNDERLINE", INT2FIX(CUCUL_UNDERLINE)); | |||
| rb_define_const(mCucul, "BLINK", INT2FIX(CUCUL_BLINK)); | |||
| Init_cucul_canvas(mCucul); | |||
| Init_cucul_dither(mCucul); | |||
| Init_cucul_font(mCucul); | |||
| } | |||
| @@ -3,35 +3,35 @@ | |||
| pkgdata_DATA = caca.txt | |||
| EXTRA_DIST = caca.txt | |||
| AM_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/cucul -I../cucul \ | |||
| AM_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/caca -I../caca \ | |||
| -I$(top_srcdir)/caca -DLIBCACA=1 -DX_DISPLAY_MISSING=1 | |||
| bin_PROGRAMS = cacademo cacafire cacaplay cacaview img2txt $(fcntl_programs) | |||
| noinst_PROGRAMS = cacadraw | |||
| cacademo_SOURCES = cacademo.c texture.h | |||
| cacademo_LDADD = ../caca/libcaca.la ../cucul/libcucul.la | |||
| cacademo_LDADD = ../caca/libcaca.la ../caca/libcaca.la | |||
| cacademo_LDFLAGS = @MATH_LIBS@ | |||
| cacafire_SOURCES = aafire.c | |||
| cacafire_LDADD = ../caca/libcaca.la ../cucul/libcucul.la | |||
| cacafire_LDADD = ../caca/libcaca.la ../caca/libcaca.la | |||
| cacaview_SOURCES = cacaview.c common-image.c common-image.h | |||
| cacaview_LDADD = ../caca/libcaca.la ../cucul/libcucul.la | |||
| cacaview_LDADD = ../caca/libcaca.la ../caca/libcaca.la | |||
| cacaview_CFLAGS = $(IMLIB2_CFLAGS) | |||
| cacaview_LDFLAGS = $(IMLIB2_LIBS) | |||
| cacadraw_SOURCES = cacadraw.c | |||
| cacadraw_LDADD = ../caca/libcaca.la ../cucul/libcucul.la | |||
| cacadraw_LDADD = ../caca/libcaca.la ../caca/libcaca.la | |||
| cacaplay_SOURCES = cacaplay.c | |||
| cacaplay_LDADD = ../caca/libcaca.la ../cucul/libcucul.la | |||
| cacaplay_LDADD = ../caca/libcaca.la ../caca/libcaca.la | |||
| cacaserver_SOURCES = cacaserver.c | |||
| cacaserver_LDADD = ../cucul/libcucul.la | |||
| cacaserver_LDADD = ../caca/libcaca.la | |||
| img2txt_SOURCES = img2txt.c $(GETOPT) common-image.c common-image.h | |||
| img2txt_LDADD = ../cucul/libcucul.la | |||
| img2txt_LDADD = ../caca/libcaca.la | |||
| img2txt_CFLAGS = $(IMLIB2_CFLAGS) | |||
| img2txt_LDFLAGS = $(IMLIB2_LIBS) $(GETOPT_LIBS) | |||
| @@ -29,7 +29,6 @@ | |||
| # include <stdlib.h> | |||
| # include <string.h> | |||
| #endif | |||
| #include "cucul.h" | |||
| #include "caca.h" | |||
| #else | |||
| #include <stdio.h> | |||
| @@ -40,10 +39,10 @@ | |||
| #endif | |||
| #define MAXTABLE (256*5) | |||
| #ifdef LIBCACA | |||
| static cucul_canvas_t *cv; | |||
| static caca_canvas_t *cv; | |||
| static caca_display_t *dp; | |||
| static int XSIZ, YSIZ; | |||
| static cucul_dither_t *cucul_dither; | |||
| static caca_dither_t *caca_dither; | |||
| static char *bitmap; | |||
| static int paused = 0; | |||
| #else | |||
| @@ -101,10 +100,10 @@ initialize (void) | |||
| #endif | |||
| #ifdef LIBCACA | |||
| cv = cucul_create_canvas(80, 32); | |||
| cv = caca_create_canvas(80, 32); | |||
| if (!cv) | |||
| { | |||
| printf ("Failed to initialize libcucul\n"); | |||
| printf ("Failed to initialize libcaca\n"); | |||
| exit (1); | |||
| } | |||
| dp = caca_create_display(cv); | |||
| @@ -114,8 +113,8 @@ initialize (void) | |||
| exit (1); | |||
| } | |||
| caca_set_display_time(dp, 10000); | |||
| XSIZ = cucul_get_canvas_width(cv) * 2; | |||
| YSIZ = cucul_get_canvas_height(cv) * 2 - 4; | |||
| XSIZ = caca_get_canvas_width(cv) * 2; | |||
| YSIZ = caca_get_canvas_height(cv) * 2 - 4; | |||
| #else | |||
| context = aa_autoinit (&aa_defparams); | |||
| if (context == NULL) | |||
| @@ -141,12 +140,12 @@ initialize (void) | |||
| #endif | |||
| #ifdef LIBCACA | |||
| cucul_dither = cucul_create_dither(8, XSIZ, YSIZ - 2, XSIZ, 0, 0, 0, 0); | |||
| cucul_set_dither_palette(cucul_dither, r, g, b, a); | |||
| bitmap = malloc(4 * cucul_get_canvas_width(cv) | |||
| * cucul_get_canvas_height(cv)); | |||
| memset(bitmap, 0, 4 * cucul_get_canvas_width(cv) | |||
| * cucul_get_canvas_height(cv)); | |||
| caca_dither = caca_create_dither(8, XSIZ, YSIZ - 2, XSIZ, 0, 0, 0, 0); | |||
| caca_set_dither_palette(caca_dither, r, g, b, a); | |||
| bitmap = malloc(4 * caca_get_canvas_width(cv) | |||
| * caca_get_canvas_height(cv)); | |||
| memset(bitmap, 0, 4 * caca_get_canvas_width(cv) | |||
| * caca_get_canvas_height(cv)); | |||
| #else | |||
| aa_hidecursor (context); | |||
| #endif | |||
| @@ -156,7 +155,7 @@ uninitialize (void) | |||
| { | |||
| #ifdef LIBCACA | |||
| caca_free_display(dp); | |||
| cucul_free_canvas(cv); | |||
| caca_free_canvas(cv); | |||
| #else | |||
| aa_close (context); | |||
| #endif | |||
| @@ -238,12 +237,12 @@ drawfire (void) | |||
| firemain (); | |||
| #ifdef LIBCACA | |||
| _paused: | |||
| cucul_dither_bitmap(cv, 0, 0, cucul_get_canvas_width(cv), | |||
| cucul_get_canvas_height(cv), cucul_dither, bitmap); | |||
| cucul_set_color_ansi(cv, CUCUL_WHITE, CUCUL_BLUE); | |||
| caca_dither_bitmap(cv, 0, 0, caca_get_canvas_width(cv), | |||
| caca_get_canvas_height(cv), caca_dither, bitmap); | |||
| caca_set_color_ansi(cv, CACA_WHITE, CACA_BLUE); | |||
| if (sloop < 100) | |||
| cucul_put_str(cv, cucul_get_canvas_width(cv) - 30, | |||
| cucul_get_canvas_height(cv) - 2, | |||
| caca_put_str(cv, caca_get_canvas_width(cv) - 30, | |||
| caca_get_canvas_height(cv) - 2, | |||
| " -=[ Powered by libcaca ]=- "); | |||
| caca_refresh_display(dp); | |||
| @@ -26,20 +26,19 @@ | |||
| # endif | |||
| #endif | |||
| #include "cucul.h" | |||
| #include "caca.h" | |||
| enum action { PREPARE, INIT, UPDATE, RENDER, FREE }; | |||
| void transition(cucul_canvas_t *, int, int); | |||
| void plasma(enum action, cucul_canvas_t *); | |||
| void metaballs(enum action, cucul_canvas_t *); | |||
| void moire(enum action, cucul_canvas_t *); | |||
| void langton(enum action, cucul_canvas_t *); | |||
| void matrix(enum action, cucul_canvas_t *); | |||
| void rotozoom(enum action, cucul_canvas_t *); | |||
| void transition(caca_canvas_t *, int, int); | |||
| void plasma(enum action, caca_canvas_t *); | |||
| void metaballs(enum action, caca_canvas_t *); | |||
| void moire(enum action, caca_canvas_t *); | |||
| void langton(enum action, caca_canvas_t *); | |||
| void matrix(enum action, caca_canvas_t *); | |||
| void rotozoom(enum action, caca_canvas_t *); | |||
| void (*fn[])(enum action, cucul_canvas_t *) = | |||
| void (*fn[])(enum action, caca_canvas_t *) = | |||
| { | |||
| plasma, | |||
| metaballs, | |||
| @@ -50,7 +49,7 @@ void (*fn[])(enum action, cucul_canvas_t *) = | |||
| }; | |||
| #define DEMOS (sizeof(fn)/sizeof(*fn)) | |||
| #define DEMO_FRAMES cucul_rand(500, 1000) | |||
| #define DEMO_FRAMES caca_rand(500, 1000) | |||
| #define TRANSITION_FRAMES 40 | |||
| #define TRANSITION_COUNT 5 | |||
| @@ -70,25 +69,25 @@ static int frame = 0; | |||
| int main(int argc, char **argv) | |||
| { | |||
| static caca_display_t *dp; | |||
| static cucul_canvas_t *frontcv, *backcv, *mask; | |||
| static caca_canvas_t *frontcv, *backcv, *mask; | |||
| int demo, next = -1, paused = 0, next_transition = DEMO_FRAMES; | |||
| unsigned int i; | |||
| int tmode = cucul_rand(0, TRANSITION_COUNT); | |||
| int tmode = caca_rand(0, TRANSITION_COUNT); | |||
| /* Set up two canvases, a mask, and attach a display to the front one */ | |||
| frontcv = cucul_create_canvas(0, 0); | |||
| backcv = cucul_create_canvas(0, 0); | |||
| mask = cucul_create_canvas(0, 0); | |||
| frontcv = caca_create_canvas(0, 0); | |||
| backcv = caca_create_canvas(0, 0); | |||
| mask = caca_create_canvas(0, 0); | |||
| dp = caca_create_display(frontcv); | |||
| if(!dp) | |||
| return 1; | |||
| cucul_set_canvas_size(backcv, cucul_get_canvas_width(frontcv), | |||
| cucul_get_canvas_height(frontcv)); | |||
| cucul_set_canvas_size(mask, cucul_get_canvas_width(frontcv), | |||
| cucul_get_canvas_height(frontcv)); | |||
| caca_set_canvas_size(backcv, caca_get_canvas_width(frontcv), | |||
| caca_get_canvas_height(frontcv)); | |||
| caca_set_canvas_size(mask, caca_get_canvas_width(frontcv), | |||
| caca_get_canvas_height(frontcv)); | |||
| caca_set_display_time(dp, 20000); | |||
| @@ -97,7 +96,7 @@ int main(int argc, char **argv) | |||
| fn[i](PREPARE, frontcv); | |||
| /* Choose a demo at random */ | |||
| demo = cucul_rand(0, DEMOS); | |||
| demo = caca_rand(0, DEMOS); | |||
| fn[demo](INIT, frontcv); | |||
| for(;;) | |||
| @@ -127,10 +126,10 @@ int main(int argc, char **argv) | |||
| } | |||
| /* Resize the spare canvas, just in case the main one changed */ | |||
| cucul_set_canvas_size(backcv, cucul_get_canvas_width(frontcv), | |||
| cucul_get_canvas_height(frontcv)); | |||
| cucul_set_canvas_size(mask, cucul_get_canvas_width(frontcv), | |||
| cucul_get_canvas_height(frontcv)); | |||
| caca_set_canvas_size(backcv, caca_get_canvas_width(frontcv), | |||
| caca_get_canvas_height(frontcv)); | |||
| caca_set_canvas_size(mask, caca_get_canvas_width(frontcv), | |||
| caca_get_canvas_height(frontcv)); | |||
| if(paused) | |||
| goto _paused; | |||
| @@ -141,7 +140,7 @@ int main(int argc, char **argv) | |||
| /* Handle transitions */ | |||
| if(frame == next_transition) | |||
| { | |||
| next = cucul_rand(0, DEMOS); | |||
| next = caca_rand(0, DEMOS); | |||
| if(next == demo) | |||
| next = (next + 1) % DEMOS; | |||
| fn[next](INIT, backcv); | |||
| @@ -152,7 +151,7 @@ int main(int argc, char **argv) | |||
| demo = next; | |||
| next = -1; | |||
| next_transition = frame + DEMO_FRAMES; | |||
| tmode = cucul_rand(0, TRANSITION_COUNT); | |||
| tmode = caca_rand(0, TRANSITION_COUNT); | |||
| } | |||
| if(next != -1) | |||
| @@ -167,18 +166,18 @@ _paused: | |||
| if(next != -1) | |||
| { | |||
| fn[next](RENDER, backcv); | |||
| cucul_set_color_ansi(mask, CUCUL_LIGHTGRAY, CUCUL_BLACK); | |||
| cucul_clear_canvas(mask); | |||
| cucul_set_color_ansi(mask, CUCUL_WHITE, CUCUL_WHITE); | |||
| caca_set_color_ansi(mask, CACA_LIGHTGRAY, CACA_BLACK); | |||
| caca_clear_canvas(mask); | |||
| caca_set_color_ansi(mask, CACA_WHITE, CACA_WHITE); | |||
| transition(mask, tmode, | |||
| 100 * (frame - next_transition) / TRANSITION_FRAMES); | |||
| cucul_blit(frontcv, 0, 0, backcv, mask); | |||
| caca_blit(frontcv, 0, 0, backcv, mask); | |||
| } | |||
| cucul_set_color_ansi(frontcv, CUCUL_WHITE, CUCUL_BLUE); | |||
| caca_set_color_ansi(frontcv, CACA_WHITE, CACA_BLUE); | |||
| if(frame < 100) | |||
| cucul_put_str(frontcv, cucul_get_canvas_width(frontcv) - 30, | |||
| cucul_get_canvas_height(frontcv) - 2, | |||
| caca_put_str(frontcv, caca_get_canvas_width(frontcv) - 30, | |||
| caca_get_canvas_height(frontcv) - 2, | |||
| " -=[ Powered by libcaca ]=- "); | |||
| caca_refresh_display(dp); | |||
| } | |||
| @@ -188,15 +187,15 @@ end: | |||
| fn[demo](FREE, frontcv); | |||
| caca_free_display(dp); | |||
| cucul_free_canvas(mask); | |||
| cucul_free_canvas(backcv); | |||
| cucul_free_canvas(frontcv); | |||
| caca_free_canvas(mask); | |||
| caca_free_canvas(backcv); | |||
| caca_free_canvas(frontcv); | |||
| return 0; | |||
| } | |||
| /* Transitions */ | |||
| void transition(cucul_canvas_t *mask, int tmode, int completed) | |||
| void transition(caca_canvas_t *mask, int tmode, int completed) | |||
| { | |||
| static float const star[] = | |||
| { | |||
| @@ -223,14 +222,14 @@ void transition(cucul_canvas_t *mask, int tmode, int completed) | |||
| }; | |||
| static float square_rot[sizeof(square)/sizeof(*square)]; | |||
| float mulx = 0.0075f * completed * cucul_get_canvas_width(mask); | |||
| float muly = 0.0075f * completed * cucul_get_canvas_height(mask); | |||
| int w2 = cucul_get_canvas_width(mask) / 2; | |||
| int h2 = cucul_get_canvas_height(mask) / 2; | |||
| float mulx = 0.0075f * completed * caca_get_canvas_width(mask); | |||
| float muly = 0.0075f * completed * caca_get_canvas_height(mask); | |||
| int w2 = caca_get_canvas_width(mask) / 2; | |||
| int h2 = caca_get_canvas_height(mask) / 2; | |||
| float angle = (0.0075f * completed * 360) * 3.14 / 180, x, y; | |||
| unsigned int i; | |||
| int w = cucul_get_canvas_width(mask); | |||
| int h = cucul_get_canvas_height(mask); | |||
| int w = caca_get_canvas_width(mask); | |||
| int h = caca_get_canvas_height(mask); | |||
| switch(tmode) | |||
| { | |||
| @@ -247,11 +246,11 @@ void transition(cucul_canvas_t *mask, int tmode, int completed) | |||
| mulx *= 1.8; | |||
| muly *= 1.8; | |||
| cucul_fill_triangle(mask, | |||
| caca_fill_triangle(mask, | |||
| square_rot[0*2] * mulx + w2, square_rot[0*2+1] * muly + h2, \ | |||
| square_rot[1*2] * mulx + w2, square_rot[1*2+1] * muly + h2, \ | |||
| square_rot[2*2] * mulx + w2, square_rot[2*2+1] * muly + h2, '#'); | |||
| cucul_fill_triangle(mask, | |||
| caca_fill_triangle(mask, | |||
| square_rot[0*2] * mulx + w2, square_rot[0*2+1] * muly + h2, \ | |||
| square_rot[2*2] * mulx + w2, square_rot[2*2+1] * muly + h2, \ | |||
| square_rot[3*2] * mulx + w2, square_rot[3*2+1] * muly + h2, '#'); | |||
| @@ -273,7 +272,7 @@ void transition(cucul_canvas_t *mask, int tmode, int completed) | |||
| muly *= 1.8; | |||
| #define DO_TRI(a, b, c) \ | |||
| cucul_fill_triangle(mask, \ | |||
| caca_fill_triangle(mask, \ | |||
| star_rot[(a)*2] * mulx + w2, star_rot[(a)*2+1] * muly + h2, \ | |||
| star_rot[(b)*2] * mulx + w2, star_rot[(b)*2+1] * muly + h2, \ | |||
| star_rot[(c)*2] * mulx + w2, star_rot[(c)*2+1] * muly + h2, '#') | |||
| @@ -288,14 +287,14 @@ void transition(cucul_canvas_t *mask, int tmode, int completed) | |||
| break; | |||
| case TRANSITION_CIRCLE: | |||
| cucul_fill_ellipse(mask, w2, h2, mulx, muly, '#'); | |||
| caca_fill_ellipse(mask, w2, h2, mulx, muly, '#'); | |||
| break; | |||
| case TRANSITION_VLINES: | |||
| for(i = 0; i < 8; i++) | |||
| { | |||
| int z = ((i & 1) ? w : (-w)/2) * (100 - completed) / 100; | |||
| cucul_fill_box(mask, i * w / 8, z , (w / 8) + 1, z + h, '#'); | |||
| caca_fill_box(mask, i * w / 8, z , (w / 8) + 1, z + h, '#'); | |||
| } | |||
| break; | |||
| @@ -304,7 +303,7 @@ void transition(cucul_canvas_t *mask, int tmode, int completed) | |||
| for(i = 0; i < 6; i++) | |||
| { | |||
| int z = ((i & 1) ? w : (-w)/2) * (100 - completed) / 100; | |||
| cucul_fill_box(mask, z, i * h / 6, z + w, (h / 6) + 1, '#'); | |||
| caca_fill_box(mask, z, i * h / 6, z + w, (h / 6) + 1, '#'); | |||
| } | |||
| break; | |||
| } | |||
| @@ -318,9 +317,9 @@ static uint8_t table[TABLEX * TABLEY]; | |||
| static void do_plasma(uint8_t *, | |||
| double, double, double, double, double, double); | |||
| void plasma(enum action action, cucul_canvas_t *cv) | |||
| void plasma(enum action action, caca_canvas_t *cv) | |||
| { | |||
| static cucul_dither_t *dither; | |||
| static caca_dither_t *dither; | |||
| static uint8_t *screen; | |||
| static uint32_t red[256], green[256], blue[256], alpha[256]; | |||
| static double r[3], R[6]; | |||
| @@ -335,10 +334,10 @@ void plasma(enum action action, cucul_canvas_t *cv) | |||
| red[i] = green[i] = blue[i] = alpha[i] = 0; | |||
| for(i = 0; i < 3; i++) | |||
| r[i] = (double)(cucul_rand(1, 1000)) / 60000 * M_PI; | |||
| r[i] = (double)(caca_rand(1, 1000)) / 60000 * M_PI; | |||
| for(i = 0; i < 6; i++) | |||
| R[i] = (double)(cucul_rand(1, 1000)) / 10000; | |||
| R[i] = (double)(caca_rand(1, 1000)) / 10000; | |||
| for(y = 0 ; y < TABLEY ; y++) | |||
| for(x = 0 ; x < TABLEX ; x++) | |||
| @@ -353,7 +352,7 @@ void plasma(enum action action, cucul_canvas_t *cv) | |||
| case INIT: | |||
| screen = malloc(XSIZ * YSIZ * sizeof(uint8_t)); | |||
| dither = cucul_create_dither(8, XSIZ, YSIZ, XSIZ, 0, 0, 0, 0); | |||
| dither = caca_create_dither(8, XSIZ, YSIZ, XSIZ, 0, 0, 0, 0); | |||
| break; | |||
| case UPDATE: | |||
| @@ -367,7 +366,7 @@ void plasma(enum action action, cucul_canvas_t *cv) | |||
| } | |||
| /* Set the palette */ | |||
| cucul_set_dither_palette(dither, red, green, blue, alpha); | |||
| caca_set_dither_palette(dither, red, green, blue, alpha); | |||
| do_plasma(screen, | |||
| (1.0 + sin(((double)frame) * R[0])) / 2, | |||
| @@ -379,15 +378,15 @@ void plasma(enum action action, cucul_canvas_t *cv) | |||
| break; | |||
| case RENDER: | |||
| cucul_dither_bitmap(cv, 0, 0, | |||
| cucul_get_canvas_width(cv), | |||
| cucul_get_canvas_height(cv), | |||
| caca_dither_bitmap(cv, 0, 0, | |||
| caca_get_canvas_width(cv), | |||
| caca_get_canvas_height(cv), | |||
| dither, screen); | |||
| break; | |||
| case FREE: | |||
| free(screen); | |||
| cucul_free_dither(dither); | |||
| caca_free_dither(dither); | |||
| break; | |||
| } | |||
| } | |||
| @@ -425,9 +424,9 @@ static uint8_t metaball[METASIZE * METASIZE]; | |||
| static void create_ball(void); | |||
| static void draw_ball(uint8_t *, unsigned int, unsigned int); | |||
| void metaballs(enum action action, cucul_canvas_t *cv) | |||
| void metaballs(enum action action, caca_canvas_t *cv) | |||
| { | |||
| static cucul_dither_t *cucul_dither; | |||
| static caca_dither_t *caca_dither; | |||
| static uint8_t *screen; | |||
| static uint32_t r[256], g[256], b[256], a[256]; | |||
| static float dd[METABALLS], di[METABALLS], dj[METABALLS], dk[METABALLS]; | |||
| @@ -451,13 +450,13 @@ void metaballs(enum action action, cucul_canvas_t *cv) | |||
| for(n = 0; n < METABALLS; n++) | |||
| { | |||
| dd[n] = cucul_rand(0, 100); | |||
| di[n] = (float)cucul_rand(500, 4000) / 6000.0; | |||
| dj[n] = (float)cucul_rand(500, 4000) / 6000.0; | |||
| dk[n] = (float)cucul_rand(500, 4000) / 6000.0; | |||
| dd[n] = caca_rand(0, 100); | |||
| di[n] = (float)caca_rand(500, 4000) / 6000.0; | |||
| dj[n] = (float)caca_rand(500, 4000) / 6000.0; | |||
| dk[n] = (float)caca_rand(500, 4000) / 6000.0; | |||
| } | |||
| angleoff = cucul_rand(0, 360); | |||
| angleoff = caca_rand(0, 360); | |||
| for(n = 0; n < 360 + 80; n++) | |||
| offset[n] = 1.0 + sin((double)(n * M_PI / 60)); | |||
| @@ -465,9 +464,9 @@ void metaballs(enum action action, cucul_canvas_t *cv) | |||
| case INIT: | |||
| screen = malloc(XSIZ * YSIZ * sizeof(uint8_t)); | |||
| /* Create a libcucul dither smaller than our pixel buffer, so that we | |||
| /* Create a libcaca dither smaller than our pixel buffer, so that we | |||
| * display only the interesting part of it */ | |||
| cucul_dither = cucul_create_dither(8, XSIZ - METASIZE, YSIZ - METASIZE, | |||
| caca_dither = caca_create_dither(8, XSIZ - METASIZE, YSIZ - METASIZE, | |||
| XSIZ, 0, 0, 0, 0); | |||
| break; | |||
| @@ -492,7 +491,7 @@ void metaballs(enum action action, cucul_canvas_t *cv) | |||
| } | |||
| /* Set the palette */ | |||
| cucul_set_dither_palette(cucul_dither, r, g, b, a); | |||
| caca_set_dither_palette(caca_dither, r, g, b, a); | |||
| /* Silly paths for our balls */ | |||
| for(n = 0; n < METABALLS; n++) | |||
| @@ -516,15 +515,15 @@ void metaballs(enum action action, cucul_canvas_t *cv) | |||
| break; | |||
| case RENDER: | |||
| cucul_dither_bitmap(cv, 0, 0, | |||
| cucul_get_canvas_width(cv), | |||
| cucul_get_canvas_height(cv), | |||
| cucul_dither, screen + (METASIZE / 2) * (1 + XSIZ)); | |||
| caca_dither_bitmap(cv, 0, 0, | |||
| caca_get_canvas_width(cv), | |||
| caca_get_canvas_height(cv), | |||
| caca_dither, screen + (METASIZE / 2) * (1 + XSIZ)); | |||
| break; | |||
| case FREE: | |||
| free(screen); | |||
| cucul_free_dither(cucul_dither); | |||
| caca_free_dither(caca_dither); | |||
| break; | |||
| } | |||
| } | |||
| @@ -576,9 +575,9 @@ static uint8_t disc[DISCSIZ * DISCSIZ]; | |||
| static void put_disc(uint8_t *, int, int); | |||
| static void draw_line(int, int, char); | |||
| void moire(enum action action, cucul_canvas_t *cv) | |||
| void moire(enum action action, caca_canvas_t *cv) | |||
| { | |||
| static cucul_dither_t *dither; | |||
| static caca_dither_t *dither; | |||
| static uint8_t *screen; | |||
| static float d[6]; | |||
| static uint32_t red[256], green[256], blue[256], alpha[256]; | |||
| @@ -593,7 +592,7 @@ void moire(enum action action, cucul_canvas_t *cv) | |||
| red[i] = green[i] = blue[i] = alpha[i] = 0; | |||
| for(i = 0; i < 6; i++) | |||
| d[i] = ((float)cucul_rand(50, 70)) / 1000.0; | |||
| d[i] = ((float)caca_rand(50, 70)) / 1000.0; | |||
| red[0] = green[0] = blue[0] = 0x777; | |||
| red[1] = green[1] = blue[1] = 0xfff; | |||
| @@ -616,7 +615,7 @@ void moire(enum action action, cucul_canvas_t *cv) | |||
| case INIT: | |||
| screen = malloc(XSIZ * YSIZ * sizeof(uint8_t)); | |||
| dither = cucul_create_dither(8, XSIZ, YSIZ, XSIZ, 0, 0, 0, 0); | |||
| dither = caca_create_dither(8, XSIZ, YSIZ, XSIZ, 0, 0, 0, 0); | |||
| break; | |||
| case UPDATE: | |||
| @@ -631,7 +630,7 @@ void moire(enum action action, cucul_canvas_t *cv) | |||
| green[1] = 0.5 * (1 + cos(d[4] * frame + 5.0)) * 0xfff; | |||
| blue[1] = 0.5 * (1 + cos(d[5] * (frame + 4000))) * 0xfff; | |||
| cucul_set_dither_palette(dither, red, green, blue, alpha); | |||
| caca_set_dither_palette(dither, red, green, blue, alpha); | |||
| /* Draw circles */ | |||
| x = cos(d[0] * (frame + 1000)) * 128.0 + (XSIZ / 2); | |||
| @@ -644,15 +643,15 @@ void moire(enum action action, cucul_canvas_t *cv) | |||
| break; | |||
| case RENDER: | |||
| cucul_dither_bitmap(cv, 0, 0, | |||
| cucul_get_canvas_width(cv), | |||
| cucul_get_canvas_height(cv), | |||
| caca_dither_bitmap(cv, 0, 0, | |||
| caca_get_canvas_width(cv), | |||
| caca_get_canvas_height(cv), | |||
| dither, screen); | |||
| break; | |||
| case FREE: | |||
| free(screen); | |||
| cucul_free_dither(dither); | |||
| caca_free_dither(dither); | |||
| break; | |||
| } | |||
| } | |||
| @@ -687,7 +686,7 @@ static void draw_line(int x, int y, char color) | |||
| #define ANTS 15 | |||
| #define ITER 2 | |||
| void langton(enum action action, cucul_canvas_t *cv) | |||
| void langton(enum action action, caca_canvas_t *cv) | |||
| { | |||
| static char gradient[] = | |||
| { | |||
| @@ -704,13 +703,13 @@ void langton(enum action action, cucul_canvas_t *cv) | |||
| switch(action) | |||
| { | |||
| case PREPARE: | |||
| width = cucul_get_canvas_width(cv); | |||
| height = cucul_get_canvas_height(cv); | |||
| width = caca_get_canvas_width(cv); | |||
| height = caca_get_canvas_height(cv); | |||
| for(i = 0; i < ANTS; i++) | |||
| { | |||
| ax[i] = cucul_rand(0, width); | |||
| ay[i] = cucul_rand(0, height); | |||
| dir[i] = cucul_rand(0, 4); | |||
| ax[i] = caca_rand(0, width); | |||
| ay[i] = caca_rand(0, height); | |||
| dir[i] = caca_rand(0, 4); | |||
| } | |||
| break; | |||
| @@ -757,10 +756,10 @@ void langton(enum action action, cucul_canvas_t *cv) | |||
| uint8_t p = screen[x + width * y]; | |||
| if(p & 0x0f) | |||
| cucul_set_color_ansi(cv, CUCUL_WHITE, p >> 4); | |||
| caca_set_color_ansi(cv, CACA_WHITE, p >> 4); | |||
| else | |||
| cucul_set_color_ansi(cv, CUCUL_BLACK, CUCUL_BLACK); | |||
| cucul_put_char(cv, x, y, gradient[p & 0x0f]); | |||
| caca_set_color_ansi(cv, CACA_BLACK, CACA_BLACK); | |||
| caca_put_char(cv, x, y, gradient[p & 0x0f]); | |||
| } | |||
| } | |||
| break; | |||
| @@ -776,7 +775,7 @@ void langton(enum action action, cucul_canvas_t *cv) | |||
| #define MINLEN 15 | |||
| #define MAXLEN 30 | |||
| void matrix(enum action action, cucul_canvas_t *cv) | |||
| void matrix(enum action action, caca_canvas_t *cv) | |||
| { | |||
| static struct drop | |||
| { | |||
| @@ -792,12 +791,12 @@ void matrix(enum action action, cucul_canvas_t *cv) | |||
| case PREPARE: | |||
| for(i = 0; i < MAXDROPS; i++) | |||
| { | |||
| drop[i].x = cucul_rand(0, 1000); | |||
| drop[i].y = cucul_rand(0, 1000); | |||
| drop[i].speed = 5 + cucul_rand(0, 30); | |||
| drop[i].len = MINLEN + cucul_rand(0, (MAXLEN - MINLEN)); | |||
| drop[i].x = caca_rand(0, 1000); | |||
| drop[i].y = caca_rand(0, 1000); | |||
| drop[i].speed = 5 + caca_rand(0, 30); | |||
| drop[i].len = MINLEN + caca_rand(0, (MAXLEN - MINLEN)); | |||
| for(j = 0; j < MAXLEN; j++) | |||
| drop[i].str[j] = cucul_rand('0', 'z'); | |||
| drop[i].str[j] = caca_rand('0', 'z'); | |||
| } | |||
| break; | |||
| @@ -805,8 +804,8 @@ void matrix(enum action action, cucul_canvas_t *cv) | |||
| break; | |||
| case UPDATE: | |||
| w = cucul_get_canvas_width(cv); | |||
| h = cucul_get_canvas_height(cv); | |||
| w = caca_get_canvas_width(cv); | |||
| h = caca_get_canvas_height(cv); | |||
| for(i = 0; i < MAXDROPS && i < (w * h / 32); i++) | |||
| { | |||
| @@ -814,17 +813,17 @@ void matrix(enum action action, cucul_canvas_t *cv) | |||
| if(drop[i].y > 1000) | |||
| { | |||
| drop[i].y -= 1000; | |||
| drop[i].x = cucul_rand(0, 1000); | |||
| drop[i].x = caca_rand(0, 1000); | |||
| } | |||
| } | |||
| break; | |||
| case RENDER: | |||
| w = cucul_get_canvas_width(cv); | |||
| h = cucul_get_canvas_height(cv); | |||
| w = caca_get_canvas_width(cv); | |||
| h = caca_get_canvas_height(cv); | |||
| cucul_set_color_ansi(cv, CUCUL_BLACK, CUCUL_BLACK); | |||
| cucul_clear_canvas(cv); | |||
| caca_set_color_ansi(cv, CACA_BLACK, CACA_BLACK); | |||
| caca_clear_canvas(cv); | |||
| for(i = 0; i < MAXDROPS && i < (w * h / 32); i++) | |||
| { | |||
| @@ -838,16 +837,16 @@ void matrix(enum action action, cucul_canvas_t *cv) | |||
| unsigned int fg; | |||
| if(j < 2) | |||
| fg = CUCUL_WHITE; | |||
| fg = CACA_WHITE; | |||
| else if(j < drop[i].len / 4) | |||
| fg = CUCUL_LIGHTGREEN; | |||
| fg = CACA_LIGHTGREEN; | |||
| else if(j < drop[i].len * 4 / 5) | |||
| fg = CUCUL_GREEN; | |||
| fg = CACA_GREEN; | |||
| else | |||
| fg = CUCUL_DARKGRAY; | |||
| cucul_set_color_ansi(cv, fg, CUCUL_BLACK); | |||
| fg = CACA_DARKGRAY; | |||
| caca_set_color_ansi(cv, fg, CACA_BLACK); | |||
| cucul_put_char(cv, x, y - j, | |||
| caca_put_char(cv, x, y - j, | |||
| drop[i].str[(y - j) % drop[i].len]); | |||
| } | |||
| } | |||
| @@ -871,13 +870,13 @@ void matrix(enum action action, cucul_canvas_t *cv) | |||
| #include "texture.h" | |||
| void rotozoom(enum action action, cucul_canvas_t *canvas) | |||
| void rotozoom(enum action action, caca_canvas_t *canvas) | |||
| { | |||
| static uint32_t screen[XSIZ * YSIZ]; | |||
| static int cos_tab[TABLE_SIZE], sin_tab[TABLE_SIZE]; | |||
| static int y_tab[TEXTURE_SIZE]; | |||
| static cucul_dither_t *dither; | |||
| static caca_dither_t *dither; | |||
| static uint32_t *texture; | |||
| uint32_t *p; | |||
| static int alphaF, tF; | |||
| @@ -903,7 +902,7 @@ void rotozoom(enum action action, cucul_canvas_t *canvas) | |||
| break; | |||
| case INIT: | |||
| dither = cucul_create_dither(32, XSIZ, YSIZ, XSIZ * 4, | |||
| dither = caca_create_dither(32, XSIZ, YSIZ, XSIZ * 4, | |||
| 0x00FF0000, | |||
| 0x0000FF00, | |||
| 0x000000FF, | |||
| @@ -941,14 +940,14 @@ void rotozoom(enum action action, cucul_canvas_t *canvas) | |||
| break; | |||
| case RENDER: | |||
| cucul_dither_bitmap(canvas, 0, 0, | |||
| cucul_get_canvas_width(canvas), | |||
| cucul_get_canvas_height(canvas), | |||
| caca_dither_bitmap(canvas, 0, 0, | |||
| caca_get_canvas_width(canvas), | |||
| caca_get_canvas_height(canvas), | |||
| dither, screen); | |||
| break; | |||
| case FREE: | |||
| cucul_free_dither(dither); | |||
| caca_free_dither(dither); | |||
| break; | |||
| } | |||
| } | |||