properly export cucul_utf8_to_utf32(). Evil API breakage, but no one uses these functions anyway.tags/v0.99.beta14
@@ -46,7 +46,6 @@ extern cucul_canvas_t *__caca0_cv; | |||||
extern caca_display_t *__caca0_dp; | extern caca_display_t *__caca0_dp; | ||||
extern unsigned char __caca0_fg; | extern unsigned char __caca0_fg; | ||||
extern unsigned char __caca0_bg; | extern unsigned char __caca0_bg; | ||||
extern char __caca0_utf8[]; | |||||
/* These enums and macros changed names or values */ | /* These enums and macros changed names or values */ | ||||
enum caca_color | enum caca_color | ||||
@@ -141,39 +140,33 @@ enum caca_feature | |||||
#define caca_clear() cucul_clear_canvas(__caca0_cv) | #define caca_clear() cucul_clear_canvas(__caca0_cv) | ||||
#define caca_draw_line(x, y, z, t, c) \ | #define caca_draw_line(x, y, z, t, c) \ | ||||
(__caca0_utf8[0] = c, \ | |||||
cucul_draw_line(__caca0_cv, x, y, z, t, __caca0_utf8)) | |||||
cucul_draw_line(__caca0_cv, x, y, z, t, c) | |||||
#define caca_draw_polyline(x, y, z, c) \ | #define caca_draw_polyline(x, y, z, c) \ | ||||
(__caca0_utf8[0] = c, \ | |||||
cucul_draw_polyline(__caca0_cv, x, y, z, __caca0_utf8)) | |||||
cucul_draw_polyline(__caca0_cv, x, y, z, c) | |||||
#define caca_draw_thin_line(x, y, z, t) \ | #define caca_draw_thin_line(x, y, z, t) \ | ||||
cucul_draw_thin_line(__caca0_cv, x, y, z, t) | cucul_draw_thin_line(__caca0_cv, x, y, z, t) | ||||
#define caca_draw_thin_polyline(x, y, z) \ | #define caca_draw_thin_polyline(x, y, z) \ | ||||
cucul_draw_thin_polyline(__caca0_cv, x, y, z) | cucul_draw_thin_polyline(__caca0_cv, x, y, z) | ||||
#define caca_draw_circle(x, y, z, c) \ | #define caca_draw_circle(x, y, z, c) \ | ||||
(__caca0_utf8[0] = c, cucul_draw_circle(__caca0_cv, x, y, z, __caca0_utf8)) | |||||
cucul_draw_circle(__caca0_cv, x, y, z, c) | |||||
#define caca_draw_ellipse(x, y, z, t, c) \ | #define caca_draw_ellipse(x, y, z, t, c) \ | ||||
(__caca0_utf8[0] = c, \ | |||||
cucul_draw_ellipse(__caca0_cv, x, y, z, t, __caca0_utf8)) | |||||
cucul_draw_ellipse(__caca0_cv, x, y, z, t, c) | |||||
#define caca_draw_thin_ellipse(x, y, z, t) \ | #define caca_draw_thin_ellipse(x, y, z, t) \ | ||||
cucul_draw_thin_ellipse(__caca0_cv, x, y, z, t) | cucul_draw_thin_ellipse(__caca0_cv, x, y, z, t) | ||||
#define caca_fill_ellipse(x, y, z, t, c) \ | #define caca_fill_ellipse(x, y, z, t, c) \ | ||||
(__caca0_utf8[0] = c, \ | |||||
cucul_fill_ellipse(__caca0_cv, x, y, z, t, __caca0_utf8)) | |||||
cucul_fill_ellipse(__caca0_cv, x, y, z, t, c) | |||||
#define caca_draw_box(x, y, z, t, c) \ | #define caca_draw_box(x, y, z, t, c) \ | ||||
(__caca0_utf8[0] = c, cucul_draw_box(__caca0_cv, x, y, z, t, __caca0_utf8)) | |||||
cucul_draw_box(__caca0_cv, x, y, z, t, c) | |||||
#define caca_draw_thin_box(x, y, z, t) \ | #define caca_draw_thin_box(x, y, z, t) \ | ||||
cucul_draw_thin_box(__caca0_cv, x, y, z, t) | cucul_draw_thin_box(__caca0_cv, x, y, z, t) | ||||
#define caca_fill_box(x, y, z, t, c) \ | #define caca_fill_box(x, y, z, t, c) \ | ||||
(__caca0_utf8[0] = c, cucul_fill_box(__caca0_cv, x, y, z, t, __caca0_utf8)) | |||||
cucul_fill_box(__caca0_cv, x, y, z, t, c) | |||||
#define caca_draw_triangle(x, y, z, t, u, v, c) \ | #define caca_draw_triangle(x, y, z, t, u, v, c) \ | ||||
(__caca0_utf8[0] = c, \ | |||||
cucul_draw_triangle(__caca0_cv, x, y, z, t, u, v, __caca0_utf8)) | |||||
cucul_draw_triangle(__caca0_cv, x, y, z, t, u, v, c) | |||||
#define caca_draw_thin_triangle(x, y, z, t, u, v) \ | #define caca_draw_thin_triangle(x, y, z, t, u, v) \ | ||||
cucul_draw_thin_triangle(__caca0_cv, x, y, z, t, u, v) | cucul_draw_thin_triangle(__caca0_cv, x, y, z, t, u, v) | ||||
#define caca_fill_triangle(x, y, z, t, u, v, c) \ | #define caca_fill_triangle(x, y, z, t, u, v, c) \ | ||||
(__caca0_utf8[0] = c, \ | |||||
cucul_fill_triangle(__caca0_cv, x, y, z, t, u, v, __caca0_utf8)) | |||||
cucul_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) cucul_rand(a, (b)+1) | ||||
#define caca_sqrt __caca0_sqrt | #define caca_sqrt __caca0_sqrt | ||||
@@ -34,16 +34,16 @@ | |||||
* \param y1 Y coordinate of the upper-left corner of the box. | * \param y1 Y coordinate of the upper-left corner of the box. | ||||
* \param x2 X coordinate of the lower-right corner of the box. | * \param x2 X coordinate of the lower-right corner of the box. | ||||
* \param y2 Y coordinate of the lower-right corner of the box. | * \param y2 Y coordinate of the lower-right corner of the box. | ||||
* \param str UTF-8 string containing the character to use to draw the box. | |||||
* \param ch UTF-32 character to be used to draw the box. | |||||
* \return This function always returns 0. | * \return This function always returns 0. | ||||
*/ | */ | ||||
int cucul_draw_box(cucul_canvas_t *cv, int x1, int y1, int x2, int y2, | int cucul_draw_box(cucul_canvas_t *cv, int x1, int y1, int x2, int y2, | ||||
char const *str) | |||||
unsigned long int ch) | |||||
{ | { | ||||
cucul_draw_line(cv, x1, y1, x1, y2, str); | |||||
cucul_draw_line(cv, x1, y2, x2, y2, str); | |||||
cucul_draw_line(cv, x2, y2, x2, y1, str); | |||||
cucul_draw_line(cv, x2, y1, x1, y1, str); | |||||
cucul_draw_line(cv, x1, y1, x1, y2, ch); | |||||
cucul_draw_line(cv, x1, y2, x2, y2, ch); | |||||
cucul_draw_line(cv, x2, y2, x2, y1, ch); | |||||
cucul_draw_line(cv, x2, y1, x1, y1, ch); | |||||
return 0; | return 0; | ||||
} | } | ||||
@@ -175,14 +175,13 @@ int cucul_draw_cp437_box(cucul_canvas_t *cv, int x1, int y1, int x2, int y2) | |||||
* \param y1 Y coordinate of the upper-left corner of the box. | * \param y1 Y coordinate of the upper-left corner of the box. | ||||
* \param x2 X coordinate of the lower-right corner of the box. | * \param x2 X coordinate of the lower-right corner of the box. | ||||
* \param y2 Y coordinate of the lower-right corner of the box. | * \param y2 Y coordinate of the lower-right corner of the box. | ||||
* \param str UTF-8 string containing the character to fill the box with. | |||||
* \param ch UTF-32 character to be used to draw the box. | |||||
* \return This function always returns 0. | * \return This function always returns 0. | ||||
*/ | */ | ||||
int cucul_fill_box(cucul_canvas_t *cv, int x1, int y1, int x2, int y2, | int cucul_fill_box(cucul_canvas_t *cv, int x1, int y1, int x2, int y2, | ||||
char const *str) | |||||
unsigned long int ch) | |||||
{ | { | ||||
int x, y, xmax, ymax; | int x, y, xmax, ymax; | ||||
uint32_t ch; | |||||
if(x1 > x2) | if(x1 > x2) | ||||
{ | { | ||||
@@ -207,8 +206,6 @@ int cucul_fill_box(cucul_canvas_t *cv, int x1, int y1, int x2, int y2, | |||||
if(x2 > xmax) x2 = xmax; | if(x2 > xmax) x2 = xmax; | ||||
if(y2 > ymax) y2 = ymax; | if(y2 > ymax) y2 = ymax; | ||||
ch = cucul_utf8_to_utf32(str, NULL); | |||||
for(y = y1; y <= y2; y++) | for(y = y1; y <= y2; y++) | ||||
for(x = x1; x <= x2; x++) | for(x = x1; x <= x2; x++) | ||||
cucul_putchar(cv, x, y, ch); | cucul_putchar(cv, x, y, ch); | ||||
@@ -36,14 +36,13 @@ static void ellipsepoints(cucul_canvas_t *, int, int, int, int, uint32_t); | |||||
* \param x Center X coordinate. | * \param x Center X coordinate. | ||||
* \param y Center Y coordinate. | * \param y Center Y coordinate. | ||||
* \param r Circle radius. | * \param r Circle radius. | ||||
* \param str UTF-8 string representing the character that should be used | |||||
* to draw the circle outline. | |||||
* \param ch UTF-32 character to be used to draw the circle outline. | |||||
* \return This function always returns 0. | * \return This function always returns 0. | ||||
*/ | */ | ||||
int cucul_draw_circle(cucul_canvas_t *cv, int x, int y, int r, char const *str) | |||||
int cucul_draw_circle(cucul_canvas_t *cv, int x, int y, int r, | |||||
unsigned long int ch) | |||||
{ | { | ||||
int test, dx, dy; | int test, dx, dy; | ||||
uint32_t ch = cucul_utf8_to_utf32(str, NULL); | |||||
/* Optimized Bresenham. Kick ass. */ | /* Optimized Bresenham. Kick ass. */ | ||||
for(test = 0, dx = 0, dy = r ; dx <= dy ; dx++) | for(test = 0, dx = 0, dy = r ; dx <= dy ; dx++) | ||||
@@ -66,12 +65,11 @@ int cucul_draw_circle(cucul_canvas_t *cv, int x, int y, int r, char const *str) | |||||
* \param yo Center Y coordinate. | * \param yo Center Y coordinate. | ||||
* \param a Ellipse X radius. | * \param a Ellipse X radius. | ||||
* \param b Ellipse Y radius. | * \param b Ellipse Y radius. | ||||
* \param str UTF-8 string representing the character that should be used | |||||
* to fill the ellipse. | |||||
* \param ch UTF-32 character to be used to fill the ellipse. | |||||
* \return This function always returns 0. | * \return This function always returns 0. | ||||
*/ | */ | ||||
int cucul_fill_ellipse(cucul_canvas_t *cv, int xo, int yo, int a, int b, | int cucul_fill_ellipse(cucul_canvas_t *cv, int xo, int yo, int a, int b, | ||||
char const *str) | |||||
unsigned long int ch) | |||||
{ | { | ||||
int d2; | int d2; | ||||
int x = 0; | int x = 0; | ||||
@@ -87,15 +85,15 @@ int cucul_fill_ellipse(cucul_canvas_t *cv, int xo, int yo, int a, int b, | |||||
else | else | ||||
{ | { | ||||
d1 += b*b*(2*x*1) + a*a*(-2*y+2); | d1 += b*b*(2*x*1) + a*a*(-2*y+2); | ||||
cucul_draw_line(cv, xo - x, yo - y, xo + x, yo - y, str); | |||||
cucul_draw_line(cv, xo - x, yo + y, xo + x, yo + y, str); | |||||
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); | |||||
y--; | y--; | ||||
} | } | ||||
x++; | x++; | ||||
} | } | ||||
cucul_draw_line(cv, xo - x, yo - y, xo + x, yo - y, str); | |||||
cucul_draw_line(cv, xo - x, yo + y, xo + x, yo + y, str); | |||||
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); | |||||
d2 = b*b*(x+0.5)*(x+0.5) + a*a*(y-1)*(y-1) - a*a*b*b; | d2 = b*b*(x+0.5)*(x+0.5) + a*a*(y-1)*(y-1) - a*a*b*b; | ||||
while(y > 0) | while(y > 0) | ||||
@@ -111,8 +109,8 @@ int cucul_fill_ellipse(cucul_canvas_t *cv, int xo, int yo, int a, int b, | |||||
} | } | ||||
y--; | y--; | ||||
cucul_draw_line(cv, xo - x, yo - y, xo + x, yo - y, str); | |||||
cucul_draw_line(cv, xo - x, yo + y, xo + x, yo + y, str); | |||||
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); | |||||
} | } | ||||
return 0; | return 0; | ||||
@@ -127,18 +125,16 @@ int cucul_fill_ellipse(cucul_canvas_t *cv, int xo, int yo, int a, int b, | |||||
* \param yo Center Y coordinate. | * \param yo Center Y coordinate. | ||||
* \param a Ellipse X radius. | * \param a Ellipse X radius. | ||||
* \param b Ellipse Y radius. | * \param b Ellipse Y radius. | ||||
* \param str UTF-8 string representing the character that should be used | |||||
* to draw the ellipse outline. | |||||
* \param ch UTF-32 character to be used to draw the ellipse outline. | |||||
* \return This function always returns 0. | * \return This function always returns 0. | ||||
*/ | */ | ||||
int cucul_draw_ellipse(cucul_canvas_t *cv, int xo, int yo, int a, int b, | int cucul_draw_ellipse(cucul_canvas_t *cv, int xo, int yo, int a, int b, | ||||
char const *str) | |||||
unsigned long int ch) | |||||
{ | { | ||||
int d2; | int d2; | ||||
int x = 0; | int x = 0; | ||||
int y = b; | int y = b; | ||||
int d1 = b*b - (a*a*b) + (a*a/4); | int d1 = b*b - (a*a*b) + (a*a/4); | ||||
uint32_t ch = cucul_utf8_to_utf32(str, NULL); | |||||
ellipsepoints(cv, xo, yo, x, y, ch); | ellipsepoints(cv, xo, yo, x, y, ch); | ||||
@@ -134,24 +134,28 @@ extern int cucul_utf32_is_fullwidth(unsigned long int); | |||||
* boxes, triangles and ellipses. | * boxes, triangles and ellipses. | ||||
* | * | ||||
* @{ */ | * @{ */ | ||||
int cucul_draw_line(cucul_canvas_t *, int, int, int, int, char const *); | |||||
int cucul_draw_polyline(cucul_canvas_t *, int const x[], int const y[], int, char const *); | |||||
int cucul_draw_line(cucul_canvas_t *, int, int, int, int, unsigned long int); | |||||
int cucul_draw_polyline(cucul_canvas_t *, int const x[], int const y[], int, | |||||
unsigned long int); | |||||
int cucul_draw_thin_line(cucul_canvas_t *, int, int, int, int); | int cucul_draw_thin_line(cucul_canvas_t *, int, int, int, int); | ||||
int cucul_draw_thin_polyline(cucul_canvas_t *, int const x[], int const y[], int); | |||||
int cucul_draw_thin_polyline(cucul_canvas_t *, int const x[], int const y[], | |||||
int); | |||||
int cucul_draw_circle(cucul_canvas_t *, int, int, int, char const *); | |||||
int cucul_draw_ellipse(cucul_canvas_t *, int, int, int, int, char const *); | |||||
int cucul_draw_circle(cucul_canvas_t *, int, int, int, unsigned long int); | |||||
int cucul_draw_ellipse(cucul_canvas_t *, int, int, int, int, unsigned long int); | |||||
int cucul_draw_thin_ellipse(cucul_canvas_t *, int, int, int, int); | int cucul_draw_thin_ellipse(cucul_canvas_t *, int, int, int, int); | ||||
int cucul_fill_ellipse(cucul_canvas_t *, int, int, int, int, char const *); | |||||
int cucul_fill_ellipse(cucul_canvas_t *, int, int, int, int, unsigned long int); | |||||
int cucul_draw_box(cucul_canvas_t *, int, int, int, int, char const *); | |||||
int cucul_draw_box(cucul_canvas_t *, int, int, int, int, unsigned long int); | |||||
int cucul_draw_thin_box(cucul_canvas_t *, int, int, int, int); | int cucul_draw_thin_box(cucul_canvas_t *, int, int, int, int); | ||||
int cucul_draw_cp437_box(cucul_canvas_t *, int, int, int, int); | int cucul_draw_cp437_box(cucul_canvas_t *, int, int, int, int); | ||||
int cucul_fill_box(cucul_canvas_t *, int, int, int, int, char const *); | |||||
int cucul_fill_box(cucul_canvas_t *, int, int, int, int, unsigned long int); | |||||
int cucul_draw_triangle(cucul_canvas_t *, int, int, int, int, int, int, char const *); | |||||
int cucul_draw_triangle(cucul_canvas_t *, int, int, int, int, int, int, | |||||
unsigned long int); | |||||
int cucul_draw_thin_triangle(cucul_canvas_t *, int, int, int, int, int, int); | int cucul_draw_thin_triangle(cucul_canvas_t *, int, int, int, int, int, int); | ||||
int cucul_fill_triangle(cucul_canvas_t *, int, int, int, int, int, int, char const *); | |||||
int cucul_fill_triangle(cucul_canvas_t *, int, int, int, int, int, int, | |||||
unsigned long int); | |||||
/* @} */ | /* @} */ | ||||
/** \defgroup frame libcucul canvas frame handling | /** \defgroup frame libcucul canvas frame handling | ||||
@@ -50,18 +50,18 @@ static void draw_thin_line(cucul_canvas_t*, struct line*); | |||||
* \param y1 Y coordinate of the first point. | * \param y1 Y coordinate of the first point. | ||||
* \param x2 X coordinate of the second point. | * \param x2 X coordinate of the second point. | ||||
* \param y2 Y coordinate of the second point. | * \param y2 Y coordinate of the second point. | ||||
* \param str UTF-8 string containing the character to use to draw the line. | |||||
* \param ch UTF-32 character to be used to draw the line. | |||||
* \return This function always returns 0. | * \return This function always returns 0. | ||||
*/ | */ | ||||
int cucul_draw_line(cucul_canvas_t *cv, int x1, int y1, int x2, int y2, | int cucul_draw_line(cucul_canvas_t *cv, int x1, int y1, int x2, int y2, | ||||
char const *str) | |||||
unsigned long int ch) | |||||
{ | { | ||||
struct line s; | struct line s; | ||||
s.x1 = x1; | s.x1 = x1; | ||||
s.y1 = y1; | s.y1 = y1; | ||||
s.x2 = x2; | s.x2 = x2; | ||||
s.y2 = y2; | s.y2 = y2; | ||||
s.ch = cucul_utf8_to_utf32(str, NULL); | |||||
s.ch = ch; | |||||
s.draw = draw_solid_line; | s.draw = draw_solid_line; | ||||
clip_line(cv, &s); | clip_line(cv, &s); | ||||
@@ -81,15 +81,15 @@ int cucul_draw_line(cucul_canvas_t *cv, int x1, int y1, int x2, int y2, | |||||
* \param x Array of X coordinates. Must have \p n + 1 elements. | * \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 y Array of Y coordinates. Must have \p n + 1 elements. | ||||
* \param n Number of lines to draw. | * \param n Number of lines to draw. | ||||
* \param str UTF-8 string containing the character to use to draw the lines. | |||||
* \param ch UTF-32 character to be used to draw the lines. | |||||
* \return This function always returns 0. | * \return This function always returns 0. | ||||
*/ | */ | ||||
int cucul_draw_polyline(cucul_canvas_t *cv, int const x[], int const y[], | int cucul_draw_polyline(cucul_canvas_t *cv, int const x[], int const y[], | ||||
int n, char const *str) | |||||
int n, unsigned long int ch) | |||||
{ | { | ||||
int i; | int i; | ||||
struct line s; | struct line s; | ||||
s.ch = cucul_utf8_to_utf32(str, NULL); | |||||
s.ch = ch; | |||||
s.draw = draw_solid_line; | s.draw = draw_solid_line; | ||||
for(i = 0; i < n; i++) | for(i = 0; i < n; i++) | ||||
@@ -36,16 +36,15 @@ | |||||
* \param y2 Y coordinate of the second point. | * \param y2 Y coordinate of the second point. | ||||
* \param x3 X coordinate of the third point. | * \param x3 X coordinate of the third point. | ||||
* \param y3 Y coordinate of the third point. | * \param y3 Y coordinate of the third point. | ||||
* \param str UTF-8 string representing the character that should be used | |||||
* to draw the triangle outline. | |||||
* \param ch UTF-32 character to be used to draw the triangle outline. | |||||
* \return This function always returns 0. | * \return This function always returns 0. | ||||
*/ | */ | ||||
int cucul_draw_triangle(cucul_canvas_t *cv, int x1, int y1, int x2, int y2, | int cucul_draw_triangle(cucul_canvas_t *cv, int x1, int y1, int x2, int y2, | ||||
int x3, int y3, char const *str) | |||||
int x3, int y3, unsigned long int ch) | |||||
{ | { | ||||
cucul_draw_line(cv, x1, y1, x2, y2, str); | |||||
cucul_draw_line(cv, x2, y2, x3, y3, str); | |||||
cucul_draw_line(cv, x3, y3, x1, y1, str); | |||||
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); | |||||
return 0; | return 0; | ||||
} | } | ||||
@@ -84,25 +83,21 @@ int cucul_draw_thin_triangle(cucul_canvas_t *cv, int x1, int y1, | |||||
* \param y2 Y coordinate of the second point. | * \param y2 Y coordinate of the second point. | ||||
* \param x3 X coordinate of the third point. | * \param x3 X coordinate of the third point. | ||||
* \param y3 Y coordinate of the third point. | * \param y3 Y coordinate of the third point. | ||||
* \param str UTF-8 string representing the character that should be used | |||||
* to fill the triangle. | |||||
* \param ch UTF-32 character to be used to fill the triangle. | |||||
* \return This function always returns 0. | * \return This function always returns 0. | ||||
*/ | */ | ||||
int cucul_fill_triangle(cucul_canvas_t *cv, int x1, int y1, int x2, int y2, | int cucul_fill_triangle(cucul_canvas_t *cv, int x1, int y1, int x2, int y2, | ||||
int x3, int y3, char const *str) | |||||
int x3, int y3, unsigned long int ch) | |||||
{ | { | ||||
int x, y, xmin, xmax, ymin, ymax; | int x, y, xmin, xmax, ymin, ymax; | ||||
long int xx1, xx2, xa, xb, sl21, sl31, sl32; | long int xx1, xx2, xa, xb, sl21, sl31, sl32; | ||||
uint32_t ch; | |||||
/* Bubble-sort y1 <= y2 <= y3 */ | /* Bubble-sort y1 <= y2 <= y3 */ | ||||
if(y1 > y2) | if(y1 > y2) | ||||
return cucul_fill_triangle(cv, x2, y2, x1, y1, x3, y3, str); | |||||
return cucul_fill_triangle(cv, x2, y2, x1, y1, x3, y3, ch); | |||||
if(y2 > y3) | if(y2 > y3) | ||||
return cucul_fill_triangle(cv, x1, y1, x3, y3, x2, y2, str); | |||||
ch = cucul_utf8_to_utf32(str, NULL); | |||||
return cucul_fill_triangle(cv, x1, y1, x3, y3, x2, y2, ch); | |||||
/* Compute slopes and promote precision */ | /* Compute slopes and promote precision */ | ||||
sl21 = (y2 == y1) ? 0 : (x2 - x1) * 0x10000 / (y2 - y1); | sl21 = (y2 == y1) ? 0 : (x2 - x1) * 0x10000 / (y2 - y1); | ||||
@@ -234,7 +234,7 @@ void transition(cucul_canvas_t *mask, int tmode, int completed) | |||||
cucul_fill_triangle(mask, \ | cucul_fill_triangle(mask, \ | ||||
star_rot[(a)*2] * mulx + w2, star_rot[(a)*2+1] * muly + h2, \ | 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[(b)*2] * mulx + w2, star_rot[(b)*2+1] * muly + h2, \ | ||||
star_rot[(c)*2] * mulx + w2, star_rot[(c)*2+1] * muly + h2, "#") | |||||
star_rot[(c)*2] * mulx + w2, star_rot[(c)*2+1] * muly + h2, '#') | |||||
DO_TRI(0, 1, 9); | DO_TRI(0, 1, 9); | ||||
DO_TRI(1, 2, 3); | DO_TRI(1, 2, 3); | ||||
DO_TRI(3, 4, 5); | DO_TRI(3, 4, 5); | ||||
@@ -246,7 +246,7 @@ void transition(cucul_canvas_t *mask, int tmode, int completed) | |||||
break; | break; | ||||
case TRANSITION_CIRCLE: | case TRANSITION_CIRCLE: | ||||
cucul_fill_ellipse(mask, w2, h2, mulx, muly, "#"); | |||||
cucul_fill_ellipse(mask, w2, h2, mulx, muly, '#'); | |||||
break; | break; | ||||
} | } | ||||
@@ -419,8 +419,8 @@ int main(int argc, char **argv) | |||||
static void print_status(void) | static void print_status(void) | ||||
{ | { | ||||
cucul_set_color_ansi(cv, CUCUL_WHITE, CUCUL_BLUE); | cucul_set_color_ansi(cv, CUCUL_WHITE, CUCUL_BLUE); | ||||
cucul_draw_line(cv, 0, 0, ww - 1, 0, " "); | |||||
cucul_draw_line(cv, 0, wh - 2, ww - 1, wh - 2, "-"); | |||||
cucul_draw_line(cv, 0, 0, ww - 1, 0, ' '); | |||||
cucul_draw_line(cv, 0, wh - 2, ww - 1, wh - 2, '-'); | |||||
cucul_putstr(cv, 0, 0, "q:Quit np:Next/Prev +-x:Zoom gG:Gamma " | cucul_putstr(cv, 0, 0, "q:Quit np:Next/Prev +-x:Zoom gG:Gamma " | ||||
"hjkl:Move d:Dither a:Antialias"); | "hjkl:Move d:Dither a:Antialias"); | ||||
cucul_putstr(cv, ww - strlen("?:Help"), 0, "?:Help"); | cucul_putstr(cv, ww - strlen("?:Help"), 0, "?:Help"); | ||||
@@ -429,7 +429,7 @@ static void print_status(void) | |||||
cucul_printf(cv, ww - 14, wh - 2, "(zoom: %s%i)", zoom > 0 ? "+" : "", zoom); | cucul_printf(cv, ww - 14, wh - 2, "(zoom: %s%i)", zoom > 0 ? "+" : "", zoom); | ||||
cucul_set_color_ansi(cv, CUCUL_LIGHTGRAY, CUCUL_BLACK); | cucul_set_color_ansi(cv, CUCUL_LIGHTGRAY, CUCUL_BLACK); | ||||
cucul_draw_line(cv, 0, wh - 1, ww - 1, wh - 1, " "); | |||||
cucul_draw_line(cv, 0, wh - 1, ww - 1, wh - 1, ' '); | |||||
} | } | ||||
static void print_help(int x, int y) | static void print_help(int x, int y) | ||||
@@ -263,9 +263,9 @@ static void demo_all(void) | |||||
j = 15 + sin(0.03*i) * 8; | j = 15 + sin(0.03*i) * 8; | ||||
cucul_set_color_ansi(cv, CUCUL_WHITE, CUCUL_BLACK); | cucul_set_color_ansi(cv, CUCUL_WHITE, CUCUL_BLACK); | ||||
cucul_fill_ellipse(cv, xo, yo, j, j / 2, "#"); | |||||
cucul_fill_ellipse(cv, xo, yo, j, j / 2, '#'); | |||||
cucul_set_color_ansi(cv, CUCUL_YELLOW, CUCUL_BLACK); | cucul_set_color_ansi(cv, CUCUL_YELLOW, CUCUL_BLACK); | ||||
cucul_draw_ellipse(cv, xo, yo, j, j / 2, "#"); | |||||
cucul_draw_ellipse(cv, xo, yo, j, j / 2, '#'); | |||||
/* Draw the pyramid */ | /* Draw the pyramid */ | ||||
xo = cucul_get_canvas_width(cv) * 5 / 8; | xo = cucul_get_canvas_width(cv) * 5 / 8; | ||||
@@ -281,17 +281,17 @@ static void demo_all(void) | |||||
yc = cucul_get_canvas_height(cv) * 3 / 4 + cos(0.02*i) * 5; | yc = cucul_get_canvas_height(cv) * 3 / 4 + cos(0.02*i) * 5; | ||||
cucul_set_color_ansi(cv, CUCUL_GREEN, CUCUL_BLACK); | cucul_set_color_ansi(cv, CUCUL_GREEN, CUCUL_BLACK); | ||||
cucul_fill_triangle(cv, xo, yo, xb, yb, xa, ya, "%"); | |||||
cucul_fill_triangle(cv, xo, yo, xb, yb, xa, ya, '%'); | |||||
cucul_set_color_ansi(cv, CUCUL_YELLOW, CUCUL_BLACK); | cucul_set_color_ansi(cv, CUCUL_YELLOW, CUCUL_BLACK); | ||||
cucul_draw_thin_triangle(cv, xo, yo, xb, yb, xa, ya); | cucul_draw_thin_triangle(cv, xo, yo, xb, yb, xa, ya); | ||||
cucul_set_color_ansi(cv, CUCUL_RED, CUCUL_BLACK); | cucul_set_color_ansi(cv, CUCUL_RED, CUCUL_BLACK); | ||||
cucul_fill_triangle(cv, xa, ya, xb, yb, xc, yc, "#"); | |||||
cucul_fill_triangle(cv, xa, ya, xb, yb, xc, yc, '#'); | |||||
cucul_set_color_ansi(cv, CUCUL_YELLOW, CUCUL_BLACK); | cucul_set_color_ansi(cv, CUCUL_YELLOW, CUCUL_BLACK); | ||||
cucul_draw_thin_triangle(cv, xa, ya, xb, yb, xc, yc); | cucul_draw_thin_triangle(cv, xa, ya, xb, yb, xc, yc); | ||||
cucul_set_color_ansi(cv, CUCUL_BLUE, CUCUL_BLACK); | cucul_set_color_ansi(cv, CUCUL_BLUE, CUCUL_BLACK); | ||||
cucul_fill_triangle(cv, xo, yo, xb, yb, xc, yc, "%"); | |||||
cucul_fill_triangle(cv, xo, yo, xb, yb, xc, yc, '%'); | |||||
cucul_set_color_ansi(cv, CUCUL_YELLOW, CUCUL_BLACK); | cucul_set_color_ansi(cv, CUCUL_YELLOW, CUCUL_BLACK); | ||||
cucul_draw_thin_triangle(cv, xo, yo, xb, yb, xc, yc); | cucul_draw_thin_triangle(cv, xo, yo, xb, yb, xc, yc); | ||||
@@ -380,7 +380,7 @@ static void demo_lines(void) | |||||
if(outline > 1) | if(outline > 1) | ||||
cucul_draw_thin_line(cv, xa, ya, xb, yb); | cucul_draw_thin_line(cv, xa, ya, xb, yb); | ||||
else | else | ||||
cucul_draw_line(cv, xa, ya, xb, yb, "#"); | |||||
cucul_draw_line(cv, xa, ya, xb, yb, '#'); | |||||
} | } | ||||
static void demo_boxes(void) | static void demo_boxes(void) | ||||
@@ -401,13 +401,13 @@ static void demo_boxes(void) | |||||
} | } | ||||
cucul_set_color_ansi(cv, cucul_rand(0, 16), cucul_rand(0, 16)); | cucul_set_color_ansi(cv, cucul_rand(0, 16), cucul_rand(0, 16)); | ||||
cucul_fill_box(cv, xa, ya, xb, yb, "#"); | |||||
cucul_fill_box(cv, xa, ya, xb, yb, '#'); | |||||
cucul_set_color_ansi(cv, cucul_rand(0, 16), CUCUL_BLACK); | cucul_set_color_ansi(cv, cucul_rand(0, 16), CUCUL_BLACK); | ||||
if(outline == 2) | if(outline == 2) | ||||
cucul_draw_thin_box(cv, xa, ya, xb, yb); | cucul_draw_thin_box(cv, xa, ya, xb, yb); | ||||
else if(outline == 1) | else if(outline == 1) | ||||
cucul_draw_box(cv, xa, ya, xb, yb, "#"); | |||||
cucul_draw_box(cv, xa, ya, xb, yb, '#'); | |||||
} | } | ||||
static void demo_ellipses(void) | static void demo_ellipses(void) | ||||
@@ -432,13 +432,13 @@ static void demo_ellipses(void) | |||||
} | } | ||||
cucul_set_color_ansi(cv, cucul_rand(0, 16), cucul_rand(0, 16)); | cucul_set_color_ansi(cv, cucul_rand(0, 16), cucul_rand(0, 16)); | ||||
cucul_fill_ellipse(cv, x, y, a, b, "#"); | |||||
cucul_fill_ellipse(cv, x, y, a, b, '#'); | |||||
cucul_set_color_ansi(cv, cucul_rand(0, 16), CUCUL_BLACK); | cucul_set_color_ansi(cv, cucul_rand(0, 16), CUCUL_BLACK); | ||||
if(outline == 2) | if(outline == 2) | ||||
cucul_draw_thin_ellipse(cv, x, y, a, b); | cucul_draw_thin_ellipse(cv, x, y, a, b); | ||||
else if(outline == 1) | else if(outline == 1) | ||||
cucul_draw_ellipse(cv, x, y, a, b, "#"); | |||||
cucul_draw_ellipse(cv, x, y, a, b, '#'); | |||||
} | } | ||||
static void demo_triangles(void) | static void demo_triangles(void) | ||||
@@ -462,13 +462,13 @@ static void demo_triangles(void) | |||||
} | } | ||||
cucul_set_color_ansi(cv, cucul_rand(0, 16), cucul_rand(0, 16)); | cucul_set_color_ansi(cv, cucul_rand(0, 16), cucul_rand(0, 16)); | ||||
cucul_fill_triangle(cv, xa, ya, xb, yb, xc, yc, "#"); | |||||
cucul_fill_triangle(cv, xa, ya, xb, yb, xc, yc, '#'); | |||||
cucul_set_color_ansi(cv, cucul_rand(0, 16), CUCUL_BLACK); | cucul_set_color_ansi(cv, cucul_rand(0, 16), CUCUL_BLACK); | ||||
if(outline == 2) | if(outline == 2) | ||||
cucul_draw_thin_triangle(cv, xa, ya, xb, yb, xc, yc); | cucul_draw_thin_triangle(cv, xa, ya, xb, yb, xc, yc); | ||||
else if(outline == 1) | else if(outline == 1) | ||||
cucul_draw_triangle(cv, xa, ya, xb, yb, xc, yc, "#"); | |||||
cucul_draw_triangle(cv, xa, ya, xb, yb, xc, yc, '#'); | |||||
} | } | ||||
#if 0 | #if 0 | ||||
static void demo_sprites(void) | static void demo_sprites(void) | ||||
@@ -42,9 +42,9 @@ int main(int argc, char **argv) | |||||
h = cucul_get_canvas_height(cv) - 1; | h = cucul_get_canvas_height(cv) - 1; | ||||
cucul_set_color_ansi(cv, CUCUL_WHITE, CUCUL_BLUE); | cucul_set_color_ansi(cv, CUCUL_WHITE, CUCUL_BLUE); | ||||
cucul_draw_line(cv, 0, 0, cucul_get_canvas_width(cv) - 1, 0, " "); | |||||
cucul_draw_line(cv, 0, 0, cucul_get_canvas_width(cv) - 1, 0, ' '); | |||||
cucul_draw_line(cv, 0, h, cucul_get_canvas_width(cv) - 1, h, " "); | |||||
cucul_draw_line(cv, 0, h, cucul_get_canvas_width(cv) - 1, h, ' '); | |||||
cucul_putstr(cv, 0, h, "type \"quit\" to exit"); | cucul_putstr(cv, 0, h, "type \"quit\" to exit"); | ||||
caca_refresh_display(dp); | caca_refresh_display(dp); | ||||
@@ -88,10 +88,10 @@ int main(int argc, char **argv) | |||||
/* Print current event */ | /* Print current event */ | ||||
cucul_set_color_ansi(cv, CUCUL_WHITE, CUCUL_BLUE); | cucul_set_color_ansi(cv, CUCUL_WHITE, CUCUL_BLUE); | ||||
cucul_draw_line(cv, 0, 0, cucul_get_canvas_width(cv) - 1, 0, " "); | |||||
cucul_draw_line(cv, 0, 0, cucul_get_canvas_width(cv) - 1, 0, ' '); | |||||
print_event(0, 0, events); | print_event(0, 0, events); | ||||
cucul_draw_line(cv, 0, h, cucul_get_canvas_width(cv) - 1, h, " "); | |||||
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]); | cucul_printf(cv, 0, h, "type \"quit\" to exit: %s", quit_string[quit]); | ||||
/* Print previous events */ | /* Print previous events */ | ||||
@@ -113,7 +113,7 @@ int main(int argc, char *argv[]) | |||||
cucul_set_color_ansi(cv, CUCUL_BLACK, CUCUL_WHITE); | cucul_set_color_ansi(cv, CUCUL_BLACK, CUCUL_WHITE); | ||||
cucul_fill_ellipse(cv, WIDTH / 2, HEIGHT / 2, | cucul_fill_ellipse(cv, WIDTH / 2, HEIGHT / 2, | ||||
WIDTH / 4, HEIGHT / 4, " "); | |||||
WIDTH / 4, HEIGHT / 4, ' '); | |||||
cucul_putstr(cv, WIDTH / 2 - 5, HEIGHT / 2 - 5, "(\") \\o/ <&>"); | cucul_putstr(cv, WIDTH / 2 - 5, HEIGHT / 2 - 5, "(\") \\o/ <&>"); | ||||
cucul_putstr(cv, WIDTH / 2 - 8, HEIGHT / 2 - 3, "[<><><><> <>--<>]"); | cucul_putstr(cv, WIDTH / 2 - 8, HEIGHT / 2 - 3, "[<><><><> <>--<>]"); | ||||
cucul_putstr(cv, WIDTH / 2 - 8, HEIGHT / 2 - 2, "[ドラゴン ボーレ]"); | cucul_putstr(cv, WIDTH / 2 - 8, HEIGHT / 2 - 2, "[ドラゴン ボーレ]"); | ||||
@@ -49,7 +49,7 @@ int main(int argc, char *argv[]) | |||||
{ | { | ||||
cucul_set_canvas_frame(cv, frame); | cucul_set_canvas_frame(cv, frame); | ||||
cucul_set_color_ansi(cv, CUCUL_WHITE, frame); | cucul_set_color_ansi(cv, CUCUL_WHITE, frame); | ||||
cucul_fill_box(cv, 0, 0, 40, 15, ":"); | |||||
cucul_fill_box(cv, 0, 0, 40, 15, ':'); | |||||
cucul_set_color_ansi(cv, CUCUL_WHITE, CUCUL_BLUE); | cucul_set_color_ansi(cv, CUCUL_WHITE, CUCUL_BLUE); | ||||
cucul_putstr(cv, frame * 5 / 2, frame, "カカ"); | cucul_putstr(cv, frame * 5 / 2, frame, "カカ"); | ||||
} | } | ||||
@@ -94,7 +94,7 @@ int main(int argc, char *argv[]) | |||||
(1.0 + cos(0.05 * (float)x)) | (1.0 + cos(0.05 * (float)x)) | ||||
* 0.5 * cucul_get_canvas_height(mask), | * 0.5 * cucul_get_canvas_height(mask), | ||||
cucul_get_canvas_width(mask) / 2, | cucul_get_canvas_width(mask) / 2, | ||||
cucul_get_canvas_height(mask) / 2, "#"); | |||||
cucul_get_canvas_height(mask) / 2, '#'); | |||||
/* Blit the spare canvas onto the first one */ | /* Blit the spare canvas onto the first one */ | ||||
cucul_blit(cv, 0, 0, cw, mask); | cucul_blit(cv, 0, 0, cw, mask); | ||||
@@ -62,7 +62,7 @@ int main(int argc, char *argv[]) | |||||
unsigned int j, start, size; | unsigned int j, start, size; | ||||
cucul_set_color_ansi(cv, CUCUL_BLACK, CUCUL_LIGHTGRAY); | cucul_set_color_ansi(cv, CUCUL_BLACK, CUCUL_LIGHTGRAY); | ||||
cucul_fill_box(cv, 2, 3 * i + 4, 2 + BUFFER_SIZE, 3 * i + 4, " "); | |||||
cucul_fill_box(cv, 2, 3 * i + 4, 2 + BUFFER_SIZE, 3 * i + 4, ' '); | |||||
start = 0; | start = 0; | ||||
size = entries[i].size; | size = entries[i].size; | ||||