libcaca  0.99.beta19
About: libcaca is a graphics library that outputs text instead of pixels, so that it can work on older video cards or text terminals (something like an advanced AAlib library).
  Fossies Dox: libcaca-0.99.beta19.tar.gz  ("inofficial" and yet experimental doxygen-generated source code documentation)  

libcaca primitives drawing

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

Functions

int caca_draw_line (caca_canvas_t *, int, int, int, int, uint32_t)
 Draw a line on the canvas using the given character. More...
 
int caca_draw_polyline (caca_canvas_t *, int const x[], int const y[], int, uint32_t)
 Draw a polyline. More...
 
int caca_draw_thin_line (caca_canvas_t *, int, int, int, int)
 Draw a thin line on the canvas, using ASCII art. More...
 
int caca_draw_thin_polyline (caca_canvas_t *, int const x[], int const y[], int)
 Draw an ASCII art thin polyline. More...
 
int caca_draw_circle (caca_canvas_t *, int, int, int, uint32_t)
 Draw a circle on the canvas using the given character. More...
 
int caca_draw_ellipse (caca_canvas_t *, int, int, int, int, uint32_t)
 Draw an ellipse on the canvas using the given character. More...
 
int caca_draw_thin_ellipse (caca_canvas_t *, int, int, int, int)
 Draw a thin ellipse on the canvas. More...
 
int caca_fill_ellipse (caca_canvas_t *, int, int, int, int, uint32_t)
 Fill an ellipse on the canvas using the given character. More...
 
int caca_draw_box (caca_canvas_t *, int, int, int, int, uint32_t)
 Draw a box on the canvas using the given character. More...
 
int caca_draw_thin_box (caca_canvas_t *, int, int, int, int)
 Draw a thin box on the canvas. More...
 
int caca_draw_cp437_box (caca_canvas_t *, int, int, int, int)
 Draw a box on the canvas using CP437 characters. More...
 
int caca_fill_box (caca_canvas_t *, int, int, int, int, uint32_t)
 Fill a box on the canvas using the given character. More...
 
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...
 
int caca_draw_thin_triangle (caca_canvas_t *, int, int, int, int, int, int)
 Draw a thin triangle on the canvas. More...
 
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...
 
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_box()

int caca_draw_box ( caca_canvas_t ,
int  ,
int  ,
int  ,
int  ,
uint32_t   
)

Draw a box on the canvas using the given character.

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.

Definition at line 41 of file box.c.

References caca_draw_line, cv, x, and y.

◆ caca_draw_circle()

int caca_draw_circle ( caca_canvas_t ,
int  ,
int  ,
int  ,
uint32_t   
)

Draw a circle on the canvas using the given character.

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.

Definition at line 40 of file conic.c.

References cv, dx, dy, ellipsepoints(), x, and y.

◆ caca_draw_cp437_box()

int caca_draw_cp437_box ( caca_canvas_t ,
int  ,
int  ,
int  ,
int   
)

Draw a box on the canvas using CP437 characters.

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.

Definition at line 86 of file box.c.

References cv, draw_box(), x, and y.

Referenced by draw_cp437_box(), Canvas::drawCP437Box(), and Java_org_zoy_caca_Canvas_canvasDrawCp437Box().

◆ caca_draw_ellipse()

int caca_draw_ellipse ( caca_canvas_t ,
int  ,
int  ,
int  ,
int  ,
uint32_t   
)

Draw an ellipse on the canvas using the given character.

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.

Definition at line 128 of file conic.c.

References cv, ellipsepoints(), x, and y.

◆ caca_draw_line()

int caca_draw_line ( caca_canvas_t ,
int  ,
int  ,
int  ,
int  ,
uint32_t   
)

Draw a line on the canvas using the given character.

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.

Definition at line 54 of file line.c.

References line::ch, clip_line(), cv, line::draw, draw_solid_line(), line::x1, line::x2, line::y1, and line::y2.

◆ caca_draw_polyline()

int caca_draw_polyline ( caca_canvas_t ,
int const  x[],
int const  y[],
int  ,
uint32_t   
)

Draw a polyline.

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.

Definition at line 85 of file line.c.

References line::ch, clip_line(), cv, line::draw, draw_solid_line(), x, line::x1, line::x2, y, line::y1, and line::y2.

◆ caca_draw_thin_box()

int caca_draw_thin_box ( caca_canvas_t ,
int  ,
int  ,
int  ,
int   
)

Draw a thin box on the canvas.

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.

Definition at line 65 of file box.c.

References cv, draw_box(), x, and y.

◆ caca_draw_thin_ellipse()

int caca_draw_thin_ellipse ( caca_canvas_t ,
int  ,
int  ,
int  ,
int   
)

Draw a thin ellipse on the canvas.

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.

Definition at line 184 of file conic.c.

References cv, ellipsepoints(), x, and y.

◆ caca_draw_thin_line()

int caca_draw_thin_line ( caca_canvas_t ,
int  ,
int  ,
int  ,
int   
)

Draw a thin line on the canvas, using ASCII art.

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.

Definition at line 116 of file line.c.

References clip_line(), cv, line::draw, draw_thin_line(), line::x1, line::x2, line::y1, and line::y2.

◆ caca_draw_thin_polyline()

int caca_draw_thin_polyline ( caca_canvas_t ,
int const  x[],
int const  y[],
int   
)

Draw an ASCII art thin polyline.

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.

Definition at line 144 of file line.c.

References clip_line(), cv, line::draw, draw_thin_line(), x, line::x1, line::x2, y, line::y1, and line::y2.

◆ caca_draw_thin_triangle()

int caca_draw_thin_triangle ( caca_canvas_t ,
int  ,
int  ,
int  ,
int  ,
int  ,
int   
)

Draw a thin triangle on the canvas.

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.

Definition at line 63 of file triangle.c.

References caca_draw_thin_line, and cv.

◆ caca_draw_triangle()

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.

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.

Definition at line 40 of file triangle.c.

References caca_draw_line, and cv.

◆ caca_fill_box()

int caca_fill_box ( caca_canvas_t ,
int  ,
int  ,
int  ,
int  ,
uint32_t   
)

Fill a box on the canvas using the given character.

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.

Definition at line 109 of file box.c.

References caca_add_dirty_rect(), caca_put_char(), cv, caca_canvas::dirty_disabled, caca_canvas::height, caca_canvas::width, x, and y.

◆ caca_fill_ellipse()

int caca_fill_ellipse ( caca_canvas_t ,
int  ,
int  ,
int  ,
int  ,
uint32_t   
)

Fill an ellipse on the canvas using the given character.

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.

Definition at line 68 of file conic.c.

References caca_draw_line, cv, x, and y.

◆ caca_fill_triangle()

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.

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.

Definition at line 87 of file triangle.c.

References caca_put_char(), cv, caca_canvas::height, caca_canvas::width, x, and y.

◆ caca_fill_triangle_textured()

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.

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.

Definition at line 361 of file triangle.c.

References caca_fill_triangle_textured_l(), and cv.

Referenced by fill_triangle_textured(), and Canvas::fillTriangleTextured().