Modules | Functions

Modules

 libcaca canvas frame handling
 

Functions

__extern int caca_draw_line (caca_canvas_t *, int, int, int, int, uint32_t)
 Draw a line on the canvas using the given character. More...
 
__extern int caca_draw_polyline (caca_canvas_t *, int const x[], int const y[], int, uint32_t)
 Draw a polyline. More...
 
__extern int caca_draw_thin_line (caca_canvas_t *, int, int, int, int)
 Draw a thin line on the canvas, using ASCII art. More...
 
__extern int caca_draw_thin_polyline (caca_canvas_t *, int const x[], int const y[], int)
 Draw an ASCII art thin polyline. More...
 
__extern int caca_draw_circle (caca_canvas_t *, int, int, int, uint32_t)
 Draw a circle on the canvas using the given character. More...
 
__extern int caca_draw_ellipse (caca_canvas_t *, int, int, int, int, uint32_t)
 Draw an ellipse on the canvas using the given character. More...
 
__extern int caca_draw_thin_ellipse (caca_canvas_t *, int, int, int, int)
 Draw a thin ellipse on the canvas. More...
 
__extern int caca_fill_ellipse (caca_canvas_t *, int, int, int, int, uint32_t)
 Fill an ellipse on the canvas using the given character. More...
 
__extern int caca_draw_box (caca_canvas_t *, int, int, int, int, uint32_t)
 Draw a box on the canvas using the given character. More...
 
__extern int caca_draw_thin_box (caca_canvas_t *, int, int, int, int)
 Draw a thin box on the canvas. More...
 
__extern int caca_draw_cp437_box (caca_canvas_t *, int, int, int, int)
 Draw a box on the canvas using CP437 characters. More...
 
__extern int caca_fill_box (caca_canvas_t *, int, int, int, int, uint32_t)
 Fill a box on the canvas using the given character. More...
 
__extern int caca_draw_triangle (caca_canvas_t *, int, int, int, int, int, int, uint32_t)
 Draw a triangle on the canvas using the given character. More...
 
__extern int caca_draw_thin_triangle (caca_canvas_t *, int, int, int, int, int, int)
 Draw a thin triangle on the canvas. More...
 
__extern int caca_fill_triangle (caca_canvas_t *, int, int, int, int, int, int, uint32_t)
 Fill a triangle on the canvas using the given character. More...
 
__extern int caca_fill_triangle_textured (caca_canvas_t *cv, int coords[6], caca_canvas_t *tex, float uv[6])
 Fill a triangle on the canvas using an arbitrary-sized texture. More...
 

Detailed Description

These functions provide routines for primitive drawing, such as lines, boxes, triangles and ellipses.

Function Documentation

◆ caca_draw_line()

__extern int caca_draw_line ( caca_canvas_t cv,
int  x1,
int  y1,
int  x2,
int  y2,
uint32_t  ch 
)

This function never fails.

Parameters
cvThe handle to the libcaca canvas.
x1X coordinate of the first point.
y1Y coordinate of the first point.
x2X coordinate of the second point.
y2Y coordinate of the second point.
chUTF-32 character to be used to draw the line.
Returns
This function always returns 0.

Referenced by caca_draw_box(), caca_draw_triangle(), and caca_fill_ellipse().

◆ caca_draw_polyline()

__extern int caca_draw_polyline ( caca_canvas_t cv,
int const  x[],
int const  y[],
int  n,
uint32_t  ch 
)

Draw a polyline on the canvas using the given character and coordinate arrays. The first and last points are not connected, hence in order to draw a polygon you need to specify the starting point at the end of the list as well.

This function never fails.

Parameters
cvThe handle to the libcaca canvas.
xArray of X coordinates. Must have n + 1 elements.
yArray of Y coordinates. Must have n + 1 elements.
nNumber of lines to draw.
chUTF-32 character to be used to draw the lines.
Returns
This function always returns 0.

◆ caca_draw_thin_line()

__extern int caca_draw_thin_line ( caca_canvas_t cv,
int  x1,
int  y1,
int  x2,
int  y2 
)

This function never fails.

Parameters
cvThe handle to the libcaca canvas.
x1X coordinate of the first point.
y1Y coordinate of the first point.
x2X coordinate of the second point.
y2Y coordinate of the second point.
Returns
This function always returns 0.

Referenced by caca_draw_thin_triangle().

◆ caca_draw_thin_polyline()

__extern int caca_draw_thin_polyline ( caca_canvas_t cv,
int const  x[],
int const  y[],
int  n 
)

Draw a thin polyline on the canvas using the given coordinate arrays and with ASCII art. The first and last points are not connected, so in order to draw a polygon you need to specify the starting point at the end of the list as well.

This function never fails.

Parameters
cvThe handle to the libcaca canvas.
xArray of X coordinates. Must have n + 1 elements.
yArray of Y coordinates. Must have n + 1 elements.
nNumber of lines to draw.
Returns
This function always returns 0.

◆ caca_draw_circle()

__extern int caca_draw_circle ( caca_canvas_t cv,
int  x,
int  y,
int  r,
uint32_t  ch 
)

This function never fails.

Parameters
cvThe handle to the libcaca canvas.
xCenter X coordinate.
yCenter Y coordinate.
rCircle radius.
chUTF-32 character to be used to draw the circle outline.
Returns
This function always returns 0.

◆ caca_draw_ellipse()

__extern int caca_draw_ellipse ( caca_canvas_t cv,
int  xo,
int  yo,
int  a,
int  b,
uint32_t  ch 
)

This function never fails.

Parameters
cvThe handle to the libcaca canvas.
xoCenter X coordinate.
yoCenter Y coordinate.
aEllipse X radius.
bEllipse Y radius.
chUTF-32 character to be used to draw the ellipse outline.
Returns
This function always returns 0.

◆ caca_draw_thin_ellipse()

__extern int caca_draw_thin_ellipse ( caca_canvas_t cv,
int  xo,
int  yo,
int  a,
int  b 
)

This function never fails.

Parameters
cvThe handle to the libcaca canvas.
xoCenter X coordinate.
yoCenter Y coordinate.
aEllipse X radius.
bEllipse Y radius.
Returns
This function always returns 0.

◆ caca_fill_ellipse()

__extern int caca_fill_ellipse ( caca_canvas_t cv,
int  xo,
int  yo,
int  a,
int  b,
uint32_t  ch 
)

This function never fails.

Parameters
cvThe handle to the libcaca canvas.
xoCenter X coordinate.
yoCenter Y coordinate.
aEllipse X radius.
bEllipse Y radius.
chUTF-32 character to be used to fill the ellipse.
Returns
This function always returns 0.

References caca_draw_line().

◆ caca_draw_box()

__extern int caca_draw_box ( caca_canvas_t cv,
int  x,
int  y,
int  w,
int  h,
uint32_t  ch 
)

This function never fails.

Parameters
cvThe handle to the libcaca canvas.
xX coordinate of the upper-left corner of the box.
yY coordinate of the upper-left corner of the box.
wWidth of the box.
hHeight of the box.
chUTF-32 character to be used to draw the box.
Returns
This function always returns 0.

References caca_draw_line().

◆ caca_draw_thin_box()

__extern int caca_draw_thin_box ( caca_canvas_t cv,
int  x,
int  y,
int  w,
int  h 
)

This function never fails.

Parameters
cvThe handle to the libcaca canvas.
xX coordinate of the upper-left corner of the box.
yY coordinate of the upper-left corner of the box.
wWidth of the box.
hHeight of the box.
Returns
This function always returns 0.

◆ caca_draw_cp437_box()

__extern int caca_draw_cp437_box ( caca_canvas_t cv,
int  x,
int  y,
int  w,
int  h 
)

This function never fails.

Parameters
cvThe handle to the libcaca canvas.
xX coordinate of the upper-left corner of the box.
yY coordinate of the upper-left corner of the box.
wWidth of the box.
hHeight of the box.
Returns
This function always returns 0.

◆ caca_fill_box()

__extern int caca_fill_box ( caca_canvas_t cv,
int  x,
int  y,
int  w,
int  h,
uint32_t  ch 
)

This function never fails.

Parameters
cvThe handle to the libcaca canvas.
xX coordinate of the upper-left corner of the box.
yY coordinate of the upper-left corner of the box.
wWidth of the box.
hHeight of the box.
chUTF-32 character to be used to draw the box.
Returns
This function always returns 0.

References caca_add_dirty_rect(), and caca_put_char().

Referenced by caca_conio_clreol().

◆ caca_draw_triangle()

__extern int caca_draw_triangle ( caca_canvas_t cv,
int  x1,
int  y1,
int  x2,
int  y2,
int  x3,
int  y3,
uint32_t  ch 
)

This function never fails.

Parameters
cvThe handle to the libcaca canvas.
x1X coordinate of the first point.
y1Y coordinate of the first point.
x2X coordinate of the second point.
y2Y coordinate of the second point.
x3X coordinate of the third point.
y3Y coordinate of the third point.
chUTF-32 character to be used to draw the triangle outline.
Returns
This function always returns 0.

References caca_draw_line().

◆ caca_draw_thin_triangle()

__extern int caca_draw_thin_triangle ( caca_canvas_t cv,
int  x1,
int  y1,
int  x2,
int  y2,
int  x3,
int  y3 
)

This function never fails.

Parameters
cvThe handle to the libcaca canvas.
x1X coordinate of the first point.
y1Y coordinate of the first point.
x2X coordinate of the second point.
y2Y coordinate of the second point.
x3X coordinate of the third point.
y3Y coordinate of the third point.
Returns
This function always returns 0.

References caca_draw_thin_line().

◆ caca_fill_triangle()

__extern int caca_fill_triangle ( caca_canvas_t cv,
int  x1,
int  y1,
int  x2,
int  y2,
int  x3,
int  y3,
uint32_t  ch 
)

This function never fails.

Parameters
cvThe handle to the libcaca canvas.
x1X coordinate of the first point.
y1Y coordinate of the first point.
x2X coordinate of the second point.
y2Y coordinate of the second point.
x3X coordinate of the third point.
y3Y coordinate of the third point.
chUTF-32 character to be used to fill the triangle.
Returns
This function always returns 0.

References caca_fill_triangle(), and caca_put_char().

Referenced by caca_fill_triangle().

◆ caca_fill_triangle_textured()

__extern int caca_fill_triangle_textured ( caca_canvas_t cv,
int  coords[6],
caca_canvas_t tex,
float  uv[6] 
)

This function fails if one or both the canvas are missing

Parameters
cvThe handle to the libcaca canvas.
coordsThe coordinates of the triangle (3{x,y})
texThe handle of the canvas texture.
uvThe coordinates of the texture (3{u,v})
Returns
This function return 0 if ok, -1 if canvas or texture are missing.