Ignore:
Timestamp:
Sep 27, 2008, 3:12:46 PM (12 years ago)
Author:
Sam Hocevar
Message:

Starting refactoring to get rid of libcucul. The initial reason for the
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.

File:
1 copied

Legend:

Unmodified
Added
Removed
  • libcaca/trunk/caca/triangle.c

    r2819 r2821  
    11/*
    2  *  libcucul      Canvas for ultrafast compositing of Unicode letters
     2 *  libcaca       Colour ASCII-Art library
    33 *  Copyright (c) 2002-2006 Sam Hocevar <sam@zoy.org>
    44 *                All Rights Reserved
     
    2323#endif
    2424
    25 #include "cucul.h"
    26 #include "cucul_internals.h"
     25#include "caca.h"
     26#include "caca_internals.h"
    2727
    2828/** \brief Draw a triangle on the canvas using the given character.
     
    3030 *  This function never fails.
    3131 *
    32  *  \param cv The handle to the libcucul canvas.
     32 *  \param cv The handle to the libcaca canvas.
    3333 *  \param x1 X coordinate of the first point.
    3434 *  \param y1 Y coordinate of the first point.
     
    4040 *  \return This function always returns 0.
    4141 */
    42 int cucul_draw_triangle(cucul_canvas_t *cv, int x1, int y1, int x2, int y2,
     42int caca_draw_triangle(caca_canvas_t *cv, int x1, int y1, int x2, int y2,
    4343                        int x3, int y3, uint32_t ch)
    4444{
    45     cucul_draw_line(cv, x1, y1, x2, y2, ch);
    46     cucul_draw_line(cv, x2, y2, x3, y3, ch);
    47     cucul_draw_line(cv, x3, y3, x1, y1, ch);
     45    caca_draw_line(cv, x1, y1, x2, y2, ch);
     46    caca_draw_line(cv, x2, y2, x3, y3, ch);
     47    caca_draw_line(cv, x3, y3, x1, y1, ch);
    4848
    4949    return 0;
     
    5454 *  This function never fails.
    5555 *
    56  *  \param cv The handle to the libcucul canvas.
     56 *  \param cv The handle to the libcaca canvas.
    5757 *  \param x1 X coordinate of the first point.
    5858 *  \param y1 Y coordinate of the first point.
     
    6363 *  \return This function always returns 0.
    6464 */
    65 int cucul_draw_thin_triangle(cucul_canvas_t *cv, int x1, int y1,
     65int caca_draw_thin_triangle(caca_canvas_t *cv, int x1, int y1,
    6666                             int x2, int y2, int x3, int y3)
    6767{
    68     cucul_draw_thin_line(cv, x1, y1, x2, y2);
    69     cucul_draw_thin_line(cv, x2, y2, x3, y3);
    70     cucul_draw_thin_line(cv, x3, y3, x1, y1);
     68    caca_draw_thin_line(cv, x1, y1, x2, y2);
     69    caca_draw_thin_line(cv, x2, y2, x3, y3);
     70    caca_draw_thin_line(cv, x3, y3, x1, y1);
    7171
    7272    return 0;
     
    7777 *  This function never fails.
    7878 *
    79  *  \param cv The handle to the libcucul canvas.
     79 *  \param cv The handle to the libcaca canvas.
    8080 *  \param x1 X coordinate of the first point.
    8181 *  \param y1 Y coordinate of the first point.
     
    8787 *  \return This function always returns 0.
    8888 */
    89 int cucul_fill_triangle(cucul_canvas_t *cv, int x1, int y1, int x2, int y2,
     89int caca_fill_triangle(caca_canvas_t *cv, int x1, int y1, int x2, int y2,
    9090                        int x3, int y3, uint32_t ch)
    9191{
     
    9595    /* Bubble-sort y1 <= y2 <= y3 */
    9696    if(y1 > y2)
    97         return cucul_fill_triangle(cv, x2, y2, x1, y1, x3, y3, ch);
     97        return caca_fill_triangle(cv, x2, y2, x1, y1, x3, y3, ch);
    9898
    9999    if(y2 > y3)
    100         return cucul_fill_triangle(cv, x1, y1, x3, y3, x2, y2, ch);
     100        return caca_fill_triangle(cv, x1, y1, x3, y3, x2, y2, ch);
    101101
    102102    /* Compute slopes and promote precision */
     
    147147
    148148        for(x = xmin; x < xmax; x++)
    149             cucul_put_char(cv, x, y, ch);
     149            caca_put_char(cv, x, y, ch);
    150150
    151151        xa += y < y2 ? sl21 : sl32;
Note: See TracChangeset for help on using the changeset viewer.